> aucune info de gestion : liste simple define ('GESTION_INFO_GESTION', 1); // pour traitement des prévisions define ('LECTEUR_INFO_GESTION', 2); // pour affichage en fiche lecteur define ('EDIT_INFO_GESTION', 3); // pour affichage en édition function planning_list($idempr=0, $idnotice=0, $order="",$info_gestion=NO_INFO_GESTION) { global $dbh ; global $msg, $charset; global $montrerquoi, $f_loc ; global $current_module ; global $pdflettreresa_priorite_email_manuel; global $pmb_transferts_actif; global $pmb_lecteurs_localises; $aff_final = ""; switch ($info_gestion) { case GESTION_INFO_GESTION: if (!$montrerquoi) $montrerquoi='all' ; $url_gestion = "./circ.php?categ=resa_planning"; $aff_final .= "
" ; $aff_final .= ""; $aff_final .= "   
"; //la liste de sélection de la localisation $aff_final .= "
".$msg["transferts_circ_resa_lib_localisation"]; $aff_final .= ""; if ($f_loc) { $clause .= " AND empr_location='".$f_loc."' "; } $aff_final .= "
 
" ; break; case LECTEUR_INFO_GESTION: break; case EDIT_INFO_GESTION: break; default: case NO_INFO_GESTION: break; } if (!$order) $order="empr_nom, empr_prenom, tit, resa_idnotice, resa_date " ; $q = "select id_resa, resa_idnotice, resa_date, resa_date_debut, resa_date_fin, resa_validee, resa_confirmee, resa_idempr, "; $q.= "trim(concat(if(series.serie_name <>'', if(notices.tnvol <>'', concat(series.serie_name,', ',notices.tnvol,'. '), concat(series.serie_name,'. ')), if(notices.tnvol <>'', concat(notices.tnvol,'. '),'')),notices.tit1)) as tit, "; $q.= "concat(empr_nom,', ',empr_prenom) as empr_nom_prenom, id_empr, empr_cb, location_libelle,"; $q.= "IF(resa_date_fin>=sysdate() or resa_date_fin='0000-00-00',0,1) as perimee, date_format(resa_date_debut, '".$msg["format_date"]."') as aff_resa_date_debut, if(resa_date_fin='0000-00-00', '', date_format(resa_date_fin, '".$msg["format_date"]."')) as aff_resa_date_fin, date_format(resa_date, '".$msg["format_date"]."') as aff_resa_date " ; $q.= "FROM resa_planning LEFT JOIN notices ON resa_idnotice = notices.notice_id LEFT JOIN series ON notices.tparent_id = series.serie_id, empr, docs_location "; $q.= "where resa_idempr = id_empr "; if ($clause) $q.= $clause; $q.= "and idlocation = empr_location "; if ($idnotice) $q.= "and notice_id = '".$idnotice."' "; if ($idempr) $q.= "and id_empr = '".$idempr."' "; $q.= "order by ".$order; $r = mysql_query($q) or die("Erreur SQL !
".$q."
".mysql_error()); if (!mysql_num_rows($r)) { switch ($info_gestion) { case GESTION_INFO_GESTION: $aff_final .= "
" ; break; case LECTEUR_INFO_GESTION: break; case EDIT_INFO_GESTION: break; default: case NO_INFO_GESTION: break; } return $aff_final ; } switch ($info_gestion) { case GESTION_INFO_GESTION: break; case LECTEUR_INFO_GESTION: $url_gestion = "./circ.php?categ=pret"; $aff_final .= ""; break; case EDIT_INFO_GESTION: break; default: case NO_INFO_GESTION: break; } $aff_final .= " "; switch ($info_gestion) { case GESTION_INFO_GESTION: case EDIT_INFO_GESTION: $aff_final .= " ".($pmb_lecteurs_localises ? "" :""); break; case LECTEUR_INFO_GESTION: $aff_final .= ""; break; default: case NO_INFO_GESTION: $aff_final .= " ".($pmb_lecteurs_localises ? "" :""); break; } $aff_final .= ""; switch ($info_gestion) { case GESTION_INFO_GESTION: $aff_final .= ""; if ($pmb_transferts_actif=="1") $aff_final .= ""; $aff_final .= "" ; break; case LECTEUR_INFO_GESTION: $aff_final .= " "; if ($pmb_transferts_actif=="1") $aff_final .= ""; $aff_final .= "" ; break; case EDIT_INFO_GESTION: $aff_final .= ""; if ($pmb_transferts_actif=="1") $aff_final .= ""; break; default: case NO_INFO_GESTION: break; } $aff_final .= ""; $odd_even=0; while ($data = mysql_fetch_object($r)) { if ($odd_even==0) { $aff_final .= "\n"; $odd_even=1; } else if ($odd_even==1) { $aff_final .= "\n"; $odd_even=0; } switch ($info_gestion) { case GESTION_INFO_GESTION: case EDIT_INFO_GESTION: if (SESSrights & CATALOGAGE_AUTH) $link = "".htmlentities($data->tit, ENT_QUOTES, $charset).""; else $link = htmlentities($data->tit, ENT_QUOTES, $charset); $aff_final.= ""; if (SESSrights & CIRCULATION_AUTH) $aff_final .= ""; else $aff_final .= ""; if ($pmb_lecteurs_localises) $aff_final.= ""; break; case LECTEUR_INFO_GESTION: if (SESSrights & CATALOGAGE_AUTH) $link = "".htmlentities($data->tit, ENT_QUOTES, $charset).""; else $link = htmlentities($data->tit, ENT_QUOTES, $charset); $aff_final.= ""; break; default: case NO_INFO_GESTION: if (SESSrights & CIRCULATION_AUTH) $aff_final .= ""; else $aff_final .= ""; if ($pmb_lecteurs_localises) $aff_final.= ""; break; } $aff_final.= ""; switch ($info_gestion) { case GESTION_INFO_GESTION: case LECTEUR_INFO_GESTION: $aff_final.= ""; if($data->resa_validee) { $aff_final.= ""; $aff_final.= ""; $aff_final.= ""; } else { $aff_final .= ""; $aff_final .= ""; $aff_final.= ""; } if($data->resa_confirmee) $aff_final.= ""; else $aff_final.= ""; if ($pmb_transferts_actif=="1") { $loc_retrait = resa_planning_loc_retrait($data->id_resa); $rqt = "SELECT location_libelle FROM docs_location WHERE idlocation='".$loc_retrait."'"; $libloc = @mysql_result(mysql_query($rqt),0); $aff_final .= ""; } break; case EDIT_INFO_GESTION: $aff_final.= ""; $aff_final.= ""; if($data->resa_validee) { $aff_final.= ""; } else { $aff_final.= ""; } if($data->resa_confirmee) { $aff_final.= ""; } else { $aff_final.= ""; } if ($pmb_transferts_actif=="1") { $loc_retrait = resa_planning_loc_retrait($data->id_resa); $rqt = "SELECT location_libelle FROM docs_location WHERE idlocation='".$loc_retrait."'"; $libloc = @mysql_result(mysql_query($rqt),0); $aff_final .= ""; } break; default: case NO_INFO_GESTION: $aff_final.= ""; $aff_final.= ""; break; } switch ($info_gestion) { case GESTION_INFO_GESTION: $aff_final .= "\n" ; break; case LECTEUR_INFO_GESTION: $aff_final .= "\n" ; break; case EDIT_INFO_GESTION: break; default: case NO_INFO_GESTION: break; } $aff_final.= ""; } $aff_final.= "
".htmlentities($msg['233'], ENT_QUOTES, $charset)." ".htmlentities($msg['empr_nom_prenom'], ENT_QUOTES, $charset)."".htmlentities($msg["empr_location"], ENT_QUOTES, $charset)."".htmlentities($msg['233'], ENT_QUOTES, $charset)."".htmlentities($msg['empr_nom_prenom'], ENT_QUOTES, $charset)."".htmlentities($msg["empr_location"], ENT_QUOTES, $charset)."".htmlentities($msg['374'], ENT_QUOTES, $charset)." ".htmlentities($msg['resa_planning_date_debut'], ENT_QUOTES, $charset)." ".htmlentities($msg['resa_planning_date_fin'], ENT_QUOTES, $charset)."".htmlentities($msg['resa_validee'], ENT_QUOTES, $charset)." ".htmlentities($msg['resa_confirmee'], ENT_QUOTES, $charset)."" . $msg["resa_loc_retrait"] . "".htmlentities($msg['resa_selectionner'], ENT_QUOTES, $charset)."".htmlentities($msg['resa_validee'], ENT_QUOTES, $charset)." ".htmlentities($msg['resa_confirmee'], ENT_QUOTES, $charset)."" . $msg["resa_loc_retrait"] . "" . $msg["resa_suppr_th"] . "".htmlentities($msg['resa_validee'], ENT_QUOTES, $charset)." ".htmlentities($msg['resa_confirmee'], ENT_QUOTES, $charset)."" . $msg["resa_loc_retrait"] . "
".$link."empr_cb)."\">".htmlentities($data->empr_nom_prenom, ENT_QUOTES, $charset)."".htmlentities($data->empr_nom_prenom, ENT_QUOTES, $charset)."".$data->location_libelle."".$link."empr_cb)."\">".htmlentities($data->empr_nom_prenom, ENT_QUOTES, $charset)."".htmlentities($data->empr_nom_prenom, ENT_QUOTES, $charset)."".$data->location_libelle."".$data->aff_resa_date."".$data->aff_resa_date_debut."".$data->aff_resa_date_fin." X"; $aff_final .= ""; $resa_date_debut = str_replace("-", "", $data->resa_date_debut); $aff_final .= ""; $aff_final .= "id_resa."¶m2=form_resa_date_debut_lib_".$data->id_resa."&auto_submit=NO&date_anterieure=YES&func_to_call=func_callback&id=".$data->id_resa."&sub_param1=1', 'resa_date_debut', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes'); \" value='".$data->aff_resa_date_debut."' name='form_resa_date_debut_lib_".$data->id_resa."'>"; $aff_final .= ""; $aff_final .= ""; $resa_date_fin = str_replace("-", "", $data->resa_date_fin); $aff_final .= ""; $aff_final .= "id_resa."¶m2=form_resa_date_fin_lib_".$data->id_resa."&auto_submit=NO&date_anterieure=YES&func_to_call=func_callback&id=".$data->id_resa."&sub_param1=2', 'resa_date_fin', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\" value='".$data->aff_resa_date_fin."' name='form_resa_date_fin_lib_".$data->id_resa."'>"; $aff_final .= "X".$libloc."".$data->aff_resa_date_debut."".$data->aff_resa_date_fin." XX".$libloc."".$data->aff_resa_date_debut."".$data->aff_resa_date_fin." id_resa."&id_empr=".$idempr."';\" />
"; $aff_final.= "
"; switch ($info_gestion) { case GESTION_INFO_GESTION: $aff_final .= "
 
     
" ; $aff_final.= " "; break; case LECTEUR_INFO_GESTION: break; case EDIT_INFO_GESTION: break; default: case NO_INFO_GESTION: break; } return $aff_final ; } function resa_planning_loc_retrait($id_resa) { global $transferts_choix_lieu_opac, $transferts_site_fixe; $res_trans = 0; switch ($transferts_choix_lieu_opac) { case "2": //retrait de la resa sur lieu fixé $res_trans = $transferts_site_fixe; break; case "3": //retrait de la resa sur lieu exemplaire //==>on fait rien ! break; case "1": default: //retrait de la resa sur lieu lecteur //on recupere la localisation de l'emprunteur $rqt = "SELECT empr_location FROM resa_planning INNER JOIN empr ON resa_idempr = id_empr WHERE id_resa='".$id_resa."'"; $res = mysql_query($rqt); $res_trans = mysql_result($res,0) ; break; } return $res_trans; } //Affichage entete réservation avec verification numero lecteur function aff_entete($id_empr=0) { global $msg,$dbh, $layout_begin; if (!$id_empr) { // pas d'id empr, quelque chose ne va pas error_message($msg[350], $msg[54], 1 , './circ.php'); break; } else { // récupération nom emprunteur $requete = "SELECT empr_nom, empr_prenom, empr_cb FROM empr WHERE id_empr='".$id_empr."' LIMIT 1"; $result = @mysql_query($requete, $dbh); if(!mysql_num_rows($result)) { // pas d'emprunteur correspondant, quelque chose ne va pas error_message($msg[350], $msg[54], 1 , './circ.php'); break; } else { $empr = mysql_fetch_object($result); $name = $empr->empr_prenom; $name ? $name .= ' '.$empr->empr_nom : $name = $empr->empr_nom; //echo window_title($database_window_title.$name.$msg[1003].$msg[352]); $layout_begin = str_replace('!!nom_lecteur!!', $name, $layout_begin); $layout_begin = str_replace('!!cb_lecteur!!', $empr->empr_cb, $layout_begin); return $layout_begin; } } } //Affichage des réservations planifiées sur le document courant par le lecteur courant function doc_planning_list($id_empr, $id_notice) { global $msg, $dbh; $requete3 = "SELECT id_resa, resa_idempr, resa_idnotice, resa_date, resa_date_debut, resa_date_fin, resa_validee, IF(resa_date_fin>=sysdate() or resa_date_fin='0000-00-00',0,1) as perimee, date_format(resa_date_fin, '".$msg["format_date_sql"]."') as aff_date_fin "; $requete3.= "FROM resa_planning "; $requete3.= "WHERE resa_idempr='".$id_empr."' and resa_idnotice='".$id_notice."' "; $result3 = mysql_query($requete3, $dbh); if (mysql_num_rows($result3)) $message_resa = '
'.$msg['resa_planning_enc'].''; while ($resa = mysql_fetch_array($result3)) { $id_resa = $resa['id_resa']; $resa_idempr = $resa['resa_idempr']; $resa_idnotice = $resa['resa_idnotice']; $resa_date = $resa['resa_date']; $resa_date_debut = $resa['resa_date_debut']; $resa_date_fin = $resa['resa_date_fin']; $resa_validee = $resa['resa_validee']; $message_resa.= "
".$msg['resa_planning_date_debut']." ".formatdate($resa_date_debut)." ".$msg['resa_planning_date_fin']." ".formatdate($resa_date_fin)." " ; if (!$resa['perimee']) { if ($resa['resa_validee']) $message_resa.= " ".$msg['resa_validee'] ; else $message_resa.= " ".$msg['resa_attente_validation']." " ; } else $message_resa.= " ".$msg['resa_overtime']." " ; $message_resa.= "
" ; } return $message_resa; } function alert_empr_resa_planning($id_resa=0, $id_empr_concerne=0) { global $dbh; global $msg, $charset; global $PMBuserid, $PMBuseremail, $PMBuseremailbcc ; global $pdflettreresa_priorite_email ; global $pdflettreresa_before_list , $pdflettreresa_madame_monsieur, $pdflettreresa_after_list, $pdflettreresa_fdp; global $biblio_name, $biblio_email ; global $biblio_adr1, $biblio_adr2, $biblio_cp, $biblio_town, $biblio_phone ; global $pdflettreresa_priorite_email_manuel; if ($pdflettreresa_priorite_email_manuel==3) return ; $query = "select distinct "; $query.= "trim(notices.tit1) as tit, "; $query.= "date_format(resa_date_fin, '".$msg["format_date"]."') as aff_resa_date_fin, "; $query.= "date_format(resa_date_debut, '".$msg["format_date"]."') as aff_resa_date_debut, "; $query.= "empr_prenom, empr_nom, empr_cb, empr_mail "; $query.= "from resa_planning LEFT JOIN notices ON resa_idnotice = notices.notice_id, empr "; $query.= "where id_resa in (".$id_resa.") and resa_idempr=id_empr "; if ($id_empr_concerne) $query .= "and id_empr=$id_empr_concerne "; $result = mysql_query($query, $dbh); $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=".$charset."\n"; $var = "pdflettreresa_fdp"; eval ("\$pdflettreresa_fdp=\"".$$var."\";"); // le texte après la liste des ouvrages en résa $var = "pdflettreresa_after_list"; eval ("\$pdflettreresa_after_list=\"".$$var."\";"); // le texte avant la liste des ouvrages en réservation $var = "pdflettreresa_before_list"; eval ("\$pdflettreresa_before_list=\"".$$var."\";"); // le "Madame, Monsieur," ou tout autre truc du genre "Cher adhérent," $var = "pdflettreresa_madame_monsieur"; eval ("\$pdflettreresa_madame_monsieur=\"".$$var."\";"); while ($empr=mysql_fetch_object($result)) { $id_empr = $empr->id_empr ; if (($pdflettreresa_priorite_email_manuel==1 || $pdflettreresa_priorite_email_manuel==2) && $empr->empr_mail) { $to = $empr->empr_prenom." ".$empr->empr_nom." <".$empr->empr_mail.">"; $output_final = "" ; $texte_madame_monsieur=str_replace("!!empr_name!!", $empr->empr_nom,$pdflettreresa_madame_monsieur); $texte_madame_monsieur=str_replace("!!empr_first_name!!", $empr->empr_prenom,$texte_madame_monsieur); $output_final .= $texte_madame_monsieur.'
'.$pdflettreresa_before_list ; $output_final .= '
'.$empr->tit.''; $output_final .= '
' ; $output_final .= $msg['resa_planning_date_debut'].' '.$empr->aff_resa_date_debut.' '.$msg['resa_planning_date_fin'].' '.$empr->aff_resa_date_fin ; $output_final .= '
'.$pdflettreresa_after_list.'
'.$pdflettreresa_fdp."

".mail_bloc_adresse() ; $output_final .= ''; $res_envoi=mailpmb($empr->empr_prenom.' '.$empr->empr_nom, $empr->empr_mail,$msg['mail_obj_resa_validee'],$output_final,$biblio_name, $biblio_email, $headers, "", $PMBuseremailbcc); if (!$res_envoi || $pdflettreresa_priorite_email_manuel==2) { print ""; } } elseif ($pdflettreresa_priorite_email_manuel!=3) { print ""; } $rqt_maj = "update resa_planning set resa_confirmee=1 where id_resa in (".$id_resa.") " ; if ($id_empr_concerne) $rqt_maj .= " and resa_idempr=$id_empr_concerne "; mysql_query($rqt_maj, $dbh); } // end while } ?>