Beispiel #1
0
     // archivage resa
     $rqt_arch = "UPDATE resa_archive, resa SET resarc_pretee = 1 WHERE id_resa = '" . $statut->id_resa . "' AND resa_arc = resarc_id ";
     pmb_mysql_query($rqt_arch, $dbh);
     $rqt_arch = "select resarc_id from resa_archive, resa WHERE id_resa = '" . $statut->id_resa . "' AND resa_arc = resarc_id ";
     $resarc_res = pmb_mysql_query($rqt_arch, $dbh);
     $resarc = pmb_mysql_fetch_object($resarc_res);
     $resarc_id = $resarc->resarc_id;
     // suppression de la resa pour ce lecteur
     del_resa($id_empr, $statut->idnotice, $statut->idbulletin, $statut->expl_cb);
 }
 // ajout du prêt
 del_resa($id_empr, $statut->idnotice, $statut->idbulletin, $statut->expl_cb);
 add_pret($id_empr, $id_expl, $cb_doc, $resarc_id, $short_loan);
 // mise à jour de l'affichage
 if ($pmb_pret_groupement) {
     if ($id_group = groupexpls::get_group_expl($cb_doc)) {
         // ce document appartient à un groupe
         $is_doc_group = 1;
         $groupexpl = new groupexpl($id_group);
         $information_text .= $groupexpl->get_confirm_form($cb_doc);
         $information_group = $groupexpl->get_confirm_form($cb_doc);
         //	$statut->flag+=IS_GROUP; client ne veut pas de comfirmation
     }
 }
 // ajout du bouton d'annulation violente
 $erreur_affichage = $information_group . "<hr />\n\t\t\t\t\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t\t\t\t<div class='colonne10'><img src='./images/info.png' /></div>\n\t\t\t\t\t\t\t\t\t\t<div class='colonne-suite'>{$titre_prete} : <span class='erreur'>" . $msg[384] . "</span><br />\n\t\t\t\t\t\t\t\t\t\t";
 $erreur_affichage .= get_display_custom_fields($id_empr, $id_expl);
 if ($pmb_play_pret_sound) {
     $alert_sound_list[] = "information";
 }
 $erreur_affichage .= "<input type='button' class='bouton' value='{$msg[76]}' onClick=\"document.location='circ.php?categ=pret&sub=pret_annulation&id_empr=" . $id_empr . "&id_expl=" . $id_expl . "&cb_doc=" . $cb_doc . "&short_loan=" . $short_loan . "'\" />";
 function do_form_retour($action_piege = 0, $piege_resa = 0)
 {
     global $msg, $dbh, $form_retour_tpl, $script_magnetique, $pmb_antivol, $deflt_docs_location, $pmb_transferts_actif;
     global $transferts_retour_origine, $transferts_retour_origine_force;
     global $script_antivol_rfid, $pmb_rfid_activate, $pmb_rfid_serveur_url, $transferts_retour_action_defaut;
     global $expl_section, $retour_ok_tpl, $retour_intouvable_tpl, $categ;
     global $pmb_resa_retour_action_defaut, $pmb_hide_retdoc_loc_error;
     global $alert_sound_list, $pmb_play_pret_sound, $pmb_lecteurs_localises;
     global $pmb_resa_planning, $pmb_location_resa_planning;
     global $pmb_pret_groupement;
     global $pmb_expl_show_lastempr;
     global $transferts_retour_action_autorise_autre;
     global $transferts_validation_actif;
     $form_retour_tpl_temp = $form_retour_tpl;
     if (!$this->expl_id) {
         // l'exemplaire est inconnu
         $this->expl_form = "<div class='erreur'>" . $this->expl_cb . "&nbsp;: {$msg[367]}</div>";
         // Ajouter ici la recherche empr
         if ($this->expl_cb) {
             // on a un code-barres, est-ce un cb empr ?
             $query_empr = "select id_empr, empr_cb from empr where empr_cb='" . $this->expl_cb . "' ";
             $result_empr = pmb_mysql_query($query_empr, $dbh);
             if (pmb_mysql_num_rows($result_empr)) {
                 $this->expl_form .= "<script type=\"text/javascript\">document.location='./circ.php?categ=pret&form_cb={$this->expl_cb}'</script>";
             }
         }
         $alert_sound_list[] = "information";
         return false;
     }
     // En  retour de document, si pas en prêt, on n'effectue plus aucun traitement (transfert, résa...)
     $expl_no_checkout = 0;
     $query = "select * from pret where pret_idexpl=" . $this->expl_id;
     $res = pmb_mysql_query($query, $dbh);
     if (!pmb_mysql_num_rows($res) && $categ != "ret_todo" && !$piege_resa && !$action_piege) {
         $alert_sound_list[] = "critique";
         $expl_no_checkout = 1;
     } else {
         $this->expl->expl_location_origine = $this->expl->expl_location;
         // sera recalculer dans si transferts actif
     }
     //	if($pmb_lecteurs_localises) {
     if (!$expl_no_checkout && $this->expl->expl_location != $deflt_docs_location && !$piege_resa && $deflt_docs_location) {
         // l'exemplaire n'appartient pas à cette localisation
         if ($pmb_transferts_actif == "1" && !isset($action_piege)) {
             // transfert actif et pas de forcage effectué
             if (transfert::is_retour_exemplaire_loc_origine($this->expl_id)) {
                 $action_piege = 0;
                 // l'action par défaut résoud le pb
                 //est ce qu'on peut force le retour en local
             } elseif ($transferts_retour_origine == "1" && $transferts_retour_origine_force == "0") {
                 //pas de forcage possible, on interdit le retour
                 $question_form = "<div class='message_important'><br />" . str_replace("!!lib_localisation!!", $this->info_doc->location, $msg["transferts_circ_retour_emprunt_erreur_localisation"]) . "<br /></div>";
                 $alert_sound_list[] = "critique";
                 $this->piege = 2;
             } elseif ($transferts_retour_action_autorise_autre == 1) {
                 //formulaire de Quoi faire?
                 $selected[$transferts_retour_action_defaut] = " checked ";
                 $question_form = "\n\t\t\t\t\t\t<form name='piege' method='post' action='" . $this->url . "&form_cb_expl=" . rawurlencode(stripslashes($this->expl_cb)) . "' >\n\t\t\t\t\t\t<div class='message_important'><br />" . str_replace("!!lib_localisation!!", $this->info_doc->location, $msg["transferts_circ_retour_emprunt_erreur_localisation"]) . "<br />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class='erreur'>\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"action_piege\" value=\"0\" {$selected['2']}>&nbsp;" . $msg["transferts_circ_retour_accepter_retour"] . "<br />\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"action_piege\" value=\"2\" {$selected['1']}>&nbsp;" . $msg["transferts_circ_retour_changer_loc"] . "&nbsp;" . $this->get_liste_section() . "<br />\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"action_piege\" value=\"3\" {$selected['0']}>&nbsp;" . $msg["transferts_circ_retour_traiter_plus_tard"] . "<br />\n\t\t\t\t\t\t\t<input type=\"submit\" class=\"bouton\" value=\"" . $msg["transferts_circ_retour_exec_action"] . "\" >\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</form>";
                 $alert_sound_list[] = "question";
                 $this->piege = 1;
             } else {
                 $action_piege = 0;
                 $alert_sound_list[] = "information";
             }
             /*
             				}else{
             					$action_piege=1;	
             					$alert_sound_list[]="information";
             				}	*/
         } elseif (!$pmb_transferts_actif) {
             if (!$pmb_hide_retdoc_loc_error) {
                 // pas de message et le retour se fait
             } elseif ($pmb_hide_retdoc_loc_error == 1) {
                 // Message et pas de retour
                 $this->expl_form = "<div class='erreur'><br />" . str_replace("!!lib_localisation!!", $this->info_doc->location, $msg["transferts_circ_retour_emprunt_erreur_localisation"]) . "<br /></div>";
                 $alert_sound_list[] = "critique";
                 return false;
             } elseif ($pmb_hide_retdoc_loc_error == 2) {
                 // Message et pas de retour
                 $question_form = "<div class='erreur'><br />" . str_replace("!!lib_localisation!!", $this->info_doc->location, $msg["transferts_circ_retour_emprunt_erreur_localisation"]) . "<br /></div>";
                 $alert_sound_list[] = "information";
             }
         }
     }
     //fin si lecteur localisé
     //	}
     if ($pmb_pret_groupement) {
         if ($id_group = groupexpls::get_group_expl($this->expl_cb)) {
             // ce document appartient à un groupe
             $is_doc_group = 1;
             $groupexpl = new groupexpl($id_group);
             $question_form .= $groupexpl->get_confirm_form($this->expl_cb);
         }
     }
     //affichage de l'erreur de site et eventuellement du formulaire de forcage
     $form_retour_tpl_temp = str_replace('!!html_erreur_site_tpl!!', $question_form, $form_retour_tpl_temp);
     if (!$expl_no_checkout && $pmb_transferts_actif == "1" && !$this->piege) {
         $trans = new transfert();
         $trans->est_retournable($this->expl_id);
         $this->expl->expl_location_origine = $trans->location_origine;
         switch ($action_piege) {
             case '1':
                 //issu d'une autre localisation: accepter le retour
                 if ($this->expl->pret_idempr) {
                     $message_del_pret = $this->del_pret();
                 }
                 $this->calcul_resa();
                 if ($this->flag_resa_is_affecte) {
                     $message_resa = "<div class='erreur'>" . $msg["circ_retour_ranger_resa"] . "</div>";
                     global $charset;
                     $requete = "SELECT empr_cb, empr_nom, empr_prenom, location_libelle, resa_cb FROM resa JOIN empr ON resa_idempr=id_empr JOIN docs_location ON resa_loc_retrait=idlocation  WHERE id_resa=" . $this->id_resa . "";
                     $res = pmb_mysql_query($requete);
                     $message_resa .= "<div class='row'>";
                     $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_resa_par"] . " : </strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode(pmb_mysql_result($res, 0, 0)) . "'>" . htmlentities(pmb_mysql_result($res, 0, 2), ENT_QUOTES, $charset) . " " . htmlentities(pmb_strtoupper(pmb_mysql_result($res, 0, 1), ENT_QUOTES, $charset), $charset) . "</a></span><br/>";
                     $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_loc_retrait"] . " : </strong>" . htmlentities(pmb_mysql_result($res, 0, 3), ENT_QUOTES, $charset) . "</span><br/>";
                     $message_resa .= "</div>";
                     $alert_sound_list[] = "information";
                 }
                 if ($this->flag_resa_ici) {
                 } elseif ($this->flag_resa_origine) {
                     //Gen retour sur site origine
                     $param = $trans->retour_exemplaire_genere_transfert_retour($this->expl_id);
                     $message_transfert = "<div class='erreur'>" . str_replace("!!lbl_site!!", $this->info_doc->location, $msg["transferts_circ_retour_lbl_transfert"]) . "</div>";
                 } elseif ($this->flag_resa_autre_site) {
                     //Gen retour sur autre site....
                     // Pour l'instant on retourne au site d'origine
                     $param = $trans->retour_exemplaire_genere_transfert_retour($this->expl_id);
                     $message_transfert = "<div class='erreur'>" . str_replace("!!lbl_site!!", $this->info_doc->location, $msg["transferts_circ_retour_lbl_transfert"]) . "</div>";
                 } else {
                     // pas de résa on genère un retour au site d'origine
                     $param = $trans->retour_exemplaire_genere_transfert_retour($this->expl_id);
                     $message_transfert = "<div class='erreur'>" . str_replace("!!lbl_site!!", $this->info_doc->location, $msg["transferts_circ_retour_lbl_transfert"]) . "</div>";
                 }
                 $rqt = "UPDATE exemplaires SET expl_location=" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                 pmb_mysql_query($rqt);
                 break;
             case '3':
                 // A traiter plus tard
                 if ($this->expl->pret_idempr) {
                     $message_del_pret = $this->del_pret();
                 }
                 $this->piege = 1;
                 break;
             case '4':
                 // retour sur le site d'origne, il faut nettoyer
                 $param = $trans->retour_exemplaire_loc_origine($this->expl_id);
                 if ($this->expl->pret_idempr) {
                     $message_del_pret = $this->del_pret();
                 }
                 $this->calcul_resa();
                 break;
             case '2':
                 //issu d'une autre localisation: changer la loc, effacer les transfert
                 //$trans->retour_exemplaire_supprime_transfert( $this->expl_id, $param );
                 //change la localisation d'origine
                 $param = $trans->retour_exemplaire_change_localisation($this->expl_id);
                 $rqt = "update transferts_source SET trans_source_numloc=" . $deflt_docs_location . " where trans_source_numexpl=" . $this->expl_id;
                 pmb_mysql_query($rqt);
                 // modif de la section, si demandée
                 if ($expl_section && $expl_section != $this->expl->expl_section) {
                     $rqt = "UPDATE exemplaires SET expl_section={$expl_section}, transfert_section_origine={$expl_section} WHERE expl_id=" . $this->expl_id;
                     pmb_mysql_query($rqt);
                 }
                 //
                 $rqt = "UPDATE exemplaires SET transfert_location_origine =" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                 pmb_mysql_query($rqt);
                 // pas de break; on fait le reste du traitement par défaut
             // pas de break; on fait le reste du traitement par défaut
             default:
                 if ($this->expl->pret_idempr) {
                     $message_del_pret = $this->del_pret();
                 }
                 $resa_id = $this->calcul_resa();
                 if ($this->flag_resa_is_affecte) {
                     $message_resa = "<div class='erreur'>" . $msg["circ_retour_ranger_resa"] . "</div>";
                     global $charset;
                     $requete = "SELECT empr_cb, empr_nom, empr_prenom, location_libelle, resa_cb FROM resa JOIN empr ON resa_idempr=id_empr JOIN docs_location ON resa_loc_retrait=idlocation  WHERE id_resa=" . $this->id_resa . "";
                     $res = pmb_mysql_query($requete);
                     $message_resa .= "<div class='row'>";
                     $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_resa_par"] . " : </strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode(pmb_mysql_result($res, 0, 0)) . "'>" . htmlentities(pmb_mysql_result($res, 0, 2), ENT_QUOTES, $charset) . " " . htmlentities(pmb_strtoupper(pmb_mysql_result($res, 0, 1)), ENT_QUOTES, $charset) . "</a></span><br/>";
                     $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_loc_retrait"] . " : </strong>" . htmlentities(pmb_mysql_result($res, 0, 3), ENT_QUOTES, $charset) . "</span><br/>";
                     $message_resa .= "</div>";
                     $alert_sound_list[] = "information";
                 }
                 if ($this->flag_resa_ici) {
                 } elseif ($this->flag_resa_origine) {
                     /*
                     					//Gen retour sur site origine
                     					if(!$trans->est_retournable($this->expl_id)) {
                     						// si pas encore généré
                     						$param = $trans->retour_exemplaire_genere_transfert_retour($this->expl_id);
                     						$message_transfert= "<div class='erreur'>" . str_replace("!!lbl_site!!",$this->info_doc->location,$msg["transferts_circ_retour_lbl_transfert"]) . "</div>";
                     					} else {
                     						// le retour est déjà généré
                     						$message_transfert = "<hr /><div class='erreur'>".$msg["transferts_circ_menu_titre"].":</div><div class='message_important'>".
                     			 			str_replace("!!source_location!!", $trans->location_libelle_source,$msg["transferts_circ_retour_a_retourner"])."</div>";							
                     						$alert_sound_list[]="information";
                     					}	*/
                     if ($trans->est_retournable($this->expl_id)) {
                         $num_trans = $trans->retour_exemplaire_genere_transfert_retour_origine($this->expl_id);
                         // netoyer les transferts intermédiaires
                         if ($num_trans) {
                             $message_transfert = "<hr /><div class='erreur'>" . $msg["transferts_circ_menu_titre"] . ":</div><div class='message_important'><br />" . str_replace("!!source_location!!", $trans->location_libelle_origine, $msg["transferts_circ_retour_a_retourner"]) . "<br /><br /></div>";
                             $alert_sound_list[] = "information";
                         }
                     } else {
                         // A ranger
                     }
                 } elseif ($this->flag_resa_autre_site) {
                     // si résa autre site à déja une demande de transfert, ou transfert
                     $req = "select * from transferts, transferts_demande where num_transfert=id_transfert and resa_trans='{$resa_id}' and etat_transfert=0";
                     $r = pmb_mysql_query($req, $dbh);
                     if (!pmb_mysql_num_rows($r)) {
                         $trans->memo_origine($this->expl_id);
                         $rqt = "UPDATE exemplaires SET expl_location=" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                         pmb_mysql_query($rqt);
                         // cloture des transferts précédant pour ne pas qu'il se retrouve à la fois en envoi et en retour sur le site
                         $rqt = "update transferts,transferts_demande, exemplaires set etat_transfert=1\r\n\t\t\t\t\t\tWHERE id_transfert=num_transfert and num_expl=expl_id  and etat_transfert=0 AND expl_cb='" . $this->expl_cb . "' ";
                         pmb_mysql_query($rqt);
                         //Gen transfert sur site de la résa....
                         $param = $trans->transfert_pour_resa($this->expl_cb, $this->resa_loc_trans, $resa_id);
                         // récupération localisation exemplaire
                         $query = "SELECT location_libelle FROM  docs_location WHERE idlocation=" . $this->resa_loc_trans . " LIMIT 1";
                         $result = pmb_mysql_query($query, $dbh);
                         $info_loc = pmb_mysql_fetch_object($result);
                         if ($transferts_validation_actif) {
                             $message_transfert = "<div class='erreur'><br />" . str_replace("!!site_dest!!", $info_loc->location_libelle, $msg["transferts_circ_transfert_pour_resa"]) . "<br /><br /></div>";
                         } else {
                             $message_transfert = "<div class='erreur'><br />" . str_replace("!!source_location!!", $info_loc->location_libelle, $msg["transferts_circ_retour_lbl_transfert"]) . "<br /><br /></div>";
                         }
                     }
                 } else {
                     // pas de résa.Doit-il être retourné à son site d'origine?
                     if ($trans->est_retournable($this->expl_id)) {
                         $num_trans = $trans->retour_exemplaire_genere_transfert_retour_origine($this->expl_id);
                         // netoyer les transferts intermédiaires
                         if ($num_trans) {
                             $message_transfert = "<hr /><div class='erreur'>" . $msg["transferts_circ_menu_titre"] . ":</div><div class='message_important'><br />" . str_replace("!!source_location!!", $trans->location_libelle_origine, $msg["transferts_circ_retour_a_retourner"]) . "<br /><br /></div>";
                             $alert_sound_list[] = "information";
                         } else {
                             $rqt = "UPDATE exemplaires SET expl_location=" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                             pmb_mysql_query($rqt);
                         }
                     } else {
                         $rqt = "UPDATE exemplaires SET expl_location=" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                         pmb_mysql_query($rqt);
                         // A ranger
                     }
                 }
                 $rqt = "UPDATE exemplaires SET expl_location=" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                 pmb_mysql_query($rqt);
                 //vérifions s'il y a des réservations prévisionnelles sur ce document..
                 if ($pmb_resa_planning) {
                     $this->calcul_resa_planning();
                     if ($this->flag_resa_planning_is_affecte) {
                         global $charset;
                         $message_resa_planning = "<div class='erreur'>{$msg['resas_planning']}</div>";
                         $message_resa_planning .= "<div class='row'>\n\t\t\t\t\t\t\t<img src='./images/plus.gif' class='img_plus'\n\t\t\t\t\t\t\tonClick=\"\n\t\t\t\t\t\t\t\tvar elt=document.getElementById('erreur-child');\n\t\t\t\t\t\t\t\tvar vis=elt.style.display;\n\t\t\t\t\t\t\t\tif (vis=='block'){\n\t\t\t\t\t\t\t\t\telt.style.display='none';\n\t\t\t\t\t\t\t\t\tthis.src='./images/plus.gif';\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\telt.style.display='block';\n\t\t\t\t\t\t\t\t\tthis.src='./images/minus.gif';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\" /> " . htmlentities($msg['resa_planning_encours'], ENT_QUOTES, $charset) . " <a href='./circ.php?categ=pret&form_cb=" . rawurlencode($reservataire_empr_cb) . "'>" . $reservataire_nom_prenom . "</a><br />";
                         //Affichage des réservations prévisionnelles sur le document courant
                         $q = "SELECT id_resa, 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, ";
                         $q .= "resa_idempr, concat(lower(empr_prenom), ' ',upper(empr_nom)) as resa_nom, if(resa_idempr!='" . $this->expl->pret_idempr . "', 0, 1) as resa_same ";
                         $q .= "FROM resa_planning left join empr on resa_idempr=id_empr ";
                         $q .= "where resa_idnotice in (select expl_notice from exemplaires where expl_cb = '" . $this->expl_cb . "') ";
                         if ($pmb_location_resa_planning) {
                             $q .= "and empr_location in (select expl_location from exemplaires where expl_cb = '" . $this->expl_cb . "') ";
                         }
                         $r = pmb_mysql_query($q, $dbh);
                         if (pmb_mysql_num_rows($r)) {
                             $message_resa_planning .= "<div id='erreur-child' class='erreur-child'>";
                             while ($resa = pmb_mysql_fetch_array($r)) {
                                 $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'];
                                 $resa_nom = $resa['resa_nom'];
                                 $resa_same = $resa['resa_same'];
                                 if ($resa_idempr == $id_empr) {
                                     $message_resa_planning .= "<b>" . htmlentities($resa_nom, ENT_QUOTES, $charset) . "&nbsp;</b>";
                                 } else {
                                     $message_resa_planning .= htmlentities($resa_nom, ENT_QUOTES, $charset) . "&nbsp;";
                                 }
                                 $message_resa_planning .= " &gt;&gt; <b>" . $msg['resa_planning_date_debut'] . "</b> " . formatdate($resa_date_debut) . "&nbsp;<b>" . $msg['resa_planning_date_fin'] . "</b> " . formatdate($resa_date_fin) . "&nbsp;";
                                 if (!$resa['perimee']) {
                                     if ($resa['resa_validee']) {
                                         $message_resa_planning .= " " . $msg['resa_validee'];
                                     } else {
                                         $message_resa_planning .= " " . $msg['resa_attente_validation'] . " ";
                                     }
                                 } else {
                                     $message_resa_planning .= " " . $msg['resa_overtime'] . " ";
                                 }
                                 $message_resa_planning .= "<br />";
                             }
                             //while
                             $message_resa_planning .= "</div></div>";
                             $alert_sound_list[] = "information";
                         }
                     }
                 }
                 break;
         }
     }
     if (!$expl_no_checkout && !$pmb_transferts_actif) {
         if ($this->expl->pret_idempr) {
             $message_del_pret = $this->del_pret();
         }
         $this->calcul_resa();
         if ($this->flag_resa_is_affecte) {
             $message_resa = "<div class='erreur'>" . $msg["circ_retour_ranger_resa"] . "</div>";
             global $charset;
             $requete = "SELECT empr_cb, empr_nom, empr_prenom, location_libelle, resa_cb FROM resa JOIN empr ON resa_idempr=id_empr JOIN docs_location ON resa_loc_retrait=idlocation  WHERE id_resa=" . $this->id_resa . "";
             $res = pmb_mysql_query($requete);
             $message_resa .= "<div class='row'>";
             $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_resa_par"] . " : </strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode(pmb_mysql_result($res, 0, 0)) . "'>" . htmlentities(pmb_mysql_result($res, 0, 2), ENT_QUOTES, $charset) . " " . pmb_strtoupper(htmlentities(pmb_mysql_result($res, 0, 1), ENT_QUOTES, $charset), $charset) . "</a></span><br/>";
             $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_loc_retrait"] . " : </strong>" . htmlentities(pmb_mysql_result($res, 0, 3), ENT_QUOTES, $charset) . "</span><br/>";
             $message_resa .= "</div>";
             $alert_sound_list[] = "information";
         }
         if ($pmb_resa_planning) {
             $this->calcul_resa_planning();
             if ($this->flag_resa_planning_is_affecte) {
                 global $charset;
                 $message_resa_planning = "<div class='erreur'>{$msg['resas_planning']}</div>";
                 $message_resa_planning .= "<div class='row'>\n\t\t\t\t\t<img src='./images/plus.gif' class='img_plus'\n\t\t\t\t\tonClick=\"\n\t\t\t\t\t\tvar elt=document.getElementById('erreur-child');\n\t\t\t\t\t\tvar vis=elt.style.display;\n\t\t\t\t\t\tif (vis=='block'){\n\t\t\t\t\t\t\telt.style.display='none';\n\t\t\t\t\t\t\tthis.src='./images/plus.gif';\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\telt.style.display='block';\n\t\t\t\t\t\t\tthis.src='./images/minus.gif';\n\t\t\t\t\t\t}\n\t\t\t\t\t\" /> " . htmlentities($msg['resa_planning_encours'], ENT_QUOTES, $charset) . " <a href='./circ.php?categ=pret&form_cb=" . rawurlencode($reservataire_empr_cb) . "'>" . $reservataire_nom_prenom . "</a><br />";
                 //Affichage des réservations prévisionnelles sur le document courant
                 $q = "SELECT id_resa, 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, ";
                 $q .= "resa_idempr, concat(lower(empr_prenom), ' ',upper(empr_nom)) as resa_nom, if(resa_idempr!='" . $this->expl->pret_idempr . "', 0, 1) as resa_same ";
                 $q .= "FROM resa_planning left join empr on resa_idempr=id_empr ";
                 $q .= "where resa_idnotice in (select expl_notice from exemplaires where expl_cb = '" . $this->expl_cb . "') ";
                 if ($pmb_location_resa_planning) {
                     $q .= "and empr_location in (select expl_location from exemplaires where expl_cb = '" . $this->expl_cb . "') ";
                 }
                 $r = pmb_mysql_query($q, $dbh);
                 if (pmb_mysql_num_rows($r)) {
                     $message_resa_planning .= "<div id='erreur-child' class='erreur-child'>";
                     while ($resa = pmb_mysql_fetch_array($r)) {
                         $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'];
                         $resa_nom = $resa['resa_nom'];
                         $resa_same = $resa['resa_same'];
                         if ($resa_idempr == $id_empr) {
                             $message_resa_planning .= "<b>" . htmlentities($resa_nom, ENT_QUOTES, $charset) . "&nbsp;</b>";
                         } else {
                             $message_resa_planning .= htmlentities($resa_nom, ENT_QUOTES, $charset) . "&nbsp;";
                         }
                         $message_resa_planning .= " &gt;&gt; <b>" . $msg['resa_planning_date_debut'] . "</b> " . formatdate($resa_date_debut) . "&nbsp;<b>" . $msg['resa_planning_date_fin'] . "</b> " . formatdate($resa_date_fin) . "&nbsp;";
                         if (!$resa['perimee']) {
                             if ($resa['resa_validee']) {
                                 $message_resa_planning .= " " . $msg['resa_validee'];
                             } else {
                                 $message_resa_planning .= " " . $msg['resa_attente_validation'] . " ";
                             }
                         } else {
                             $message_resa_planning .= " " . $msg['resa_overtime'] . " ";
                         }
                         $message_resa_planning .= "<br />";
                     }
                     //while
                     $message_resa_planning .= "</div></div>";
                     $alert_sound_list[] = "information";
                 }
             }
         }
     }
     if (!$expl_no_checkout && !$this->piege) {
         if ($this->flag_resa_ici && !$piege_resa) {
             $query = "SELECT empr_location,empr_prenom, empr_nom, empr_cb FROM resa INNER JOIN empr ON resa_idempr = id_empr WHERE id_resa='" . $this->id_resa_to_validate . "'";
             $result = pmb_mysql_query($query, $dbh);
             $empr = @pmb_mysql_fetch_object($result);
             $info_resa = "<div class='message_important'>{$msg['352']}</div>\n\t\t\t<div class='row'>" . $msg[373] . "&nbsp;<strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode($empr->empr_cb) . "'>" . $empr->empr_prenom . "&nbsp;" . $empr->empr_nom . "</a></strong>&nbsp;({$empr->empr_cb} )\n\t\t\t</div>";
             if ($categ == "ret_todo" || $pmb_resa_retour_action_defaut == 1) {
                 $checked[1] = "checked";
             } else {
                 $checked[2] = "checked";
             }
             $question_resa = "\n\t\t\t\t<form name='piege' method='post' action='" . $this->url . "&form_cb_expl=" . rawurlencode($this->expl_cb) . "' >\n\t\t\t\t{$info_resa}\n\t\t\t\t<div class='erreur'>\n\t\t\t\t\t<input type=\"radio\" name=\"piege_resa\" value=\"1\" {$checked['1']} >&nbsp;" . $msg["circ_retour_piege_resa_affecter"] . "<br />\n\t\t\t\t\t<input type=\"radio\" name=\"piege_resa\" value=\"2\" {$checked['2']} >&nbsp;" . $msg["transferts_circ_retour_traiter_plus_tard"] . "<br />\n\t\t\t\t\t<input type=\"submit\" class=\"bouton\" value=\"" . $msg["transferts_circ_retour_exec_action"] . "\" >\n\t\t\t\t</div>\n\t\t\t\t</form>";
             $alert_sound_list[] = "question";
             $this->piege_resa = 1;
         } elseif ($this->flag_resa_ici && $piege_resa == 1) {
             alert_empr_resa($this->affecte_resa());
             $message_resa = "<div class='erreur'>" . $msg["circ_retour_ranger_resa"] . "</div>";
             global $charset;
             $requete = "SELECT empr_cb, empr_nom, empr_prenom, location_libelle, resa_cb FROM resa JOIN empr ON resa_idempr=id_empr JOIN docs_location ON resa_loc_retrait=idlocation  WHERE id_resa=" . $this->id_resa . "";
             $res = pmb_mysql_query($requete);
             $message_resa .= "<div class='row'>";
             $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_resa_par"] . " : </strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode(pmb_mysql_result($res, 0, 0)) . "'>" . htmlentities(pmb_mysql_result($res, 0, 2), ENT_QUOTES, $charset) . " " . mb_strtoupper(htmlentities(pmb_mysql_result($res, 0, 1), ENT_QUOTES, $charset), $charset) . "</a></span><br/>";
             $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_loc_retrait"] . " : </strong>" . htmlentities(pmb_mysql_result($res, 0, 3), ENT_QUOTES, $charset) . "</span><br/>";
             $message_resa .= "</div>";
             $alert_sound_list[] = "information";
         } elseif ($this->flag_resa_ici) {
             $this->piege_resa = 1;
         }
     }
     if (!$expl_no_checkout && $this->piege || $this->piege_resa && $piege_resa != 1) {
         // il y a des pieges, on marque comme exemplaire à problème dans la localisation qui fait le retour
         $sql = "UPDATE exemplaires set expl_retloc='" . $deflt_docs_location . "' where expl_cb='" . addslashes($this->expl_cb) . "' limit 1";
     } else {
         // pas de pièges, ou pièges résolus, on démarque
         $sql = "UPDATE exemplaires set expl_retloc=0 where expl_cb='" . addslashes($this->expl_cb) . "' limit 1";
     }
     pmb_mysql_query($sql);
     $form_retour_tpl_temp = str_replace('!!piege_resa_ici!!', $question_resa, $form_retour_tpl_temp);
     if ($this->expl->pret_idempr) {
         $this->empr = new emprunteur($this->expl->pret_idempr, "", FALSE, 2);
     }
     if ($pmb_rfid_activate && $pmb_rfid_serveur_url) {
         $form_retour_tpl_temp = str_replace('<!--antivol_script-->', $script_antivol_rfid, $form_retour_tpl_temp);
         $this->cb_tmpl = str_replace("//antivol_test//", "if(0)", $this->cb_tmpl);
     } elseif ($pmb_antivol > 0) {
         // gestion de  l'antivol magnétique 3M
         if ($this->expl->type_antivol == 1) {
             // c'est un support non magnétique (livre, revue...)
             $script_magnetique = str_replace('<!--call_script_magnetique-->', "magnetise('RRR');", $script_magnetique);
         }
         if ($this->expl->type_antivol == 2) {
             //c'est un support magnétique (cassette)
             $script_magnetique = str_replace('<!--call_script_magnetique-->', "magnetise('SSS');", $script_magnetique);
         }
         $form_retour_tpl_temp = str_replace('<!--antivol_script-->', $script_magnetique, $form_retour_tpl_temp);
     }
     if ($this->flag_rendu && $pmb_play_pret_sound) {
         $alert_sound_list[] = "information";
     }
     $form_retour_tpl_temp = str_replace('!!message_del_pret!!', $message_del_pret, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!message_resa!!', $message_resa, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!message_resa_planning!!', $message_resa_planning, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!message_transfert!!', $message_transfert, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!libelle!!', $this->expl->libelle, $form_retour_tpl_temp);
     // si la loc à été modifier:
     if ($pmb_transferts_actif) {
         // pour mettre les données modifiées à jour
         $this->fetch_data();
     }
     $form_retour_tpl_temp = str_replace('!!type_doc!!', $this->info_doc->type_doc, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!location!!', $this->info_doc->location, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!section!!', $this->info_doc->section, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!statut!!', $this->info_doc->statut, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!expl_cote!!', $this->expl->expl_cote, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!expl_cb!!', $this->expl_cb, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!expl_owner!!', $this->expl_owner_name, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!expl_id!!', $this->expl_id, $form_retour_tpl_temp);
     if ($this->flag_rendu) {
         $form_retour_tpl_temp = str_replace('!!message_retour!!', $retour_ok_tpl, $form_retour_tpl_temp);
     } elseif ($categ != "ret_todo" && !$piege_resa && !$this->piege) {
         $form_retour_tpl_temp = str_replace('!!message_retour!!', $retour_intouvable_tpl, $form_retour_tpl_temp);
     } else {
         $form_retour_tpl_temp = str_replace('!!message_retour!!', "", $form_retour_tpl_temp);
     }
     //Champs personalisés
     $p_perso = new parametres_perso("expl");
     $perso_aff = "";
     if (!$p_perso->no_special_fields) {
         $perso_ = $p_perso->show_fields($this->expl_id);
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             if ($p["AFF"]) {
                 $perso_aff .= "<br />" . $p["TITRE"] . " " . $p["AFF"];
             }
         }
     }
     if ($perso_aff) {
         $perso_aff = "<div class='row'>" . $perso_aff . "</div>";
     }
     $form_retour_tpl_temp = str_replace('!!perso_aff!!', $perso_aff, $form_retour_tpl_temp);
     if ($this->expl->expl_note) {
         $alert_sound_list[] = "critique";
         $expl_note .= pmb_bidi("<hr /><div class='erreur'>{$msg[377]} :</div><div class='message_important'>" . $this->expl->expl_note . "</div>");
     }
     $form_retour_tpl_temp = str_replace('!!expl_note!!', $expl_note, $form_retour_tpl_temp);
     if ($this->expl->expl_comment) {
         if (!$this->expl->expl_note) {
             $expl_comment .= pmb_bidi("<hr />");
         }
         $expl_comment .= pmb_bidi("<div class='erreur'>{$msg[expl_zone_comment]} :</div><div class='expl_comment'>" . $this->expl->expl_comment . "</div>");
     }
     $form_retour_tpl_temp = str_replace('!!expl_comment!!', $expl_comment, $form_retour_tpl_temp);
     // zone du dernier emrunteur
     if ($pmb_expl_show_lastempr && $this->expl->expl_lastempr) {
         $dernier_empr = "<hr /><div class='row'>{$msg['expl_prev_empr']} ";
         $link = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($this->expl->lastempr_cb) . "'>";
         $dernier_empr .= $link . $this->expl->lastempr_prenom . ' ' . $this->expl->lastempr_nom . ' (' . $this->expl->lastempr_cb . ')</a>';
         $dernier_empr .= "</div><hr />";
     }
     $form_retour_tpl_temp = str_replace('!!expl_lastempr!!', $dernier_empr, $form_retour_tpl_temp);
     if ($this->empr) {
         $expl_empr = pmb_bidi($this->empr->fiche_affichage);
     }
     $form_retour_tpl_temp = str_replace('!!expl_empr!!', $expl_empr, $form_retour_tpl_temp);
     $this->expl_form = $form_retour_tpl_temp;
 }
Beispiel #3
0
        $groupexpl = new groupexpl($id);
        $groupexpl->delete();
        $groupexpls = new groupexpls();
        print $groupexpls->get_list();
        break;
    case "add_expl":
        $groupexpl = new groupexpl($id);
        $groupexpl->add_expl($form_cb_expl);
        print $groupexpl->get_form();
        break;
    case "search_expl":
        if ($id = groupexpls::get_group_expl($form_cb_expl)) {
            $groupexpl = new groupexpl($id);
            print $groupexpl->get_see_form();
        } else {
            $groupexpls = new groupexpls();
            $groupexpls->set_error_message($msg["groupexpl_list_error_cb_not_in_group"]);
            print $groupexpls->get_list();
        }
        break;
    case "del_expl":
        $groupexpl = new groupexpl($id);
        $groupexpl->del_expl($form_cb_expl);
        print $groupexpl->get_form();
        break;
    case "list":
    default:
        $groupexpls = new groupexpls();
        print $groupexpls->get_list();
        break;
}
 function show_expl_per_notice($no_notice, $link_expl = '', $expl_bulletin = 0)
 {
     global $msg, $dbh, $base_path, $class_path;
     global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises, $transferts_gestion_transferts;
     global $pmb_expl_list_display_comments;
     global $pmb_sur_location_activate;
     global $pmb_url_base, $pmb_expl_data, $charset;
     global $pmb_expl_display_location_without_expl;
     global $pmb_html_allow_expl_cote;
     global $pmb_transferts_actif, $pmb_pret_groupement;
     // params :
     // $no_notice= id de la notice
     // $link_expl= lien associé à l'exemplaire avec !!expl_id!! et !!expl_cb!! à mettre à jour
     if (!$no_notice && !$expl_bulletin) {
         return;
     }
     $explr_tab_invis = explode(",", $explr_invisible);
     $explr_tab_unmod = explode(",", $explr_visible_unmod);
     $explr_tab_modif = explode(",", $explr_visible_mod);
     // récupération du nombre total d'exemplaires
     if ($expl_bulletin) {
         $requete = "SELECT COUNT(1) FROM exemplaires WHERE expl_bulletin='{$expl_bulletin}' ";
     } else {
         $requete = "SELECT COUNT(1) FROM exemplaires WHERE expl_notice='{$no_notice}' ";
     }
     $res = pmb_mysql_query($requete, $dbh);
     $nb_ex = pmb_mysql_result($res, 0, 0);
     if ($nb_ex) {
         // on récupère les données des exemplaires
         // visibilité des exemplaires:
         if ($pmb_droits_explr_localises && $explr_invisible) {
             $where_expl_localises = "and expl_location not in ({$explr_invisible})";
         } else {
             $where_expl_localises = "";
         }
         //Liste des champs d'exemplaires
         if ($pmb_sur_location_activate) {
             $surloc_field = "surloc_libelle,";
         }
         if (!$pmb_expl_data) {
             $pmb_expl_data = "expl_cb,expl_cote," . $surloc_field . "location_libelle,section_libelle,statut_libelle,tdoc_libelle";
         }
         $colonnesarray = explode(",", $pmb_expl_data);
         if (!in_array("expl_cb", $colonnesarray)) {
             array_unshift($colonnesarray, "expl_cb");
         }
         $total_columns = count($colonnesarray);
         if ($pmb_pret_groupement || $pmb_transferts_actif) {
             $total_columns++;
         }
         //Présence de champs personnalisés
         if (strstr($pmb_expl_data, "#")) {
             $cp = new parametres_perso("expl");
         }
         if ($expl_bulletin) {
             $where_expl_notice_expl_bulletin = " expl_bulletin='{$expl_bulletin}' ";
             $prefix = "bull_" . $expl_bulletin;
         } else {
             $where_expl_notice_expl_bulletin = " expl_notice='{$no_notice}' ";
             $prefix = "noti_" . $no_notice;
         }
         $requete = "SELECT exemplaires.*, pret.*, docs_location.*, docs_section.*, docs_statut.*, docs_codestat.*, lenders.*, tdoc_libelle, ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= "sur_location.*, ";
         }
         $requete .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, ";
         $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, ";
         $requete .= " IF(pret_retour>sysdate(),0,1) as retard ";
         $requete .= " FROM exemplaires LEFT JOIN pret ON exemplaires.expl_id=pret.pret_idexpl ";
         $requete .= " left join docs_location on exemplaires.expl_location=docs_location.idlocation ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= " left join sur_location on docs_location.surloc_num=sur_location.surloc_id ";
         }
         $requete .= " left join docs_section on exemplaires.expl_section=docs_section.idsection ";
         $requete .= " left join docs_statut on exemplaires.expl_statut=docs_statut.idstatut ";
         $requete .= " left join docs_codestat on exemplaires.expl_codestat=docs_codestat.idcode ";
         $requete .= " left join lenders on exemplaires.expl_owner=lenders.idlender ";
         $requete .= " left join docs_type on exemplaires.expl_typdoc=docs_type.idtyp_doc  ";
         $requete .= " WHERE {$where_expl_notice_expl_bulletin} {$where_expl_localises} ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= " order by surloc_libelle,location_libelle, section_libelle, expl_cote, expl_cb ";
         } else {
             $requete .= " order by location_libelle, section_libelle, expl_cote, expl_cb ";
         }
         $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
         $nbr_expl = pmb_mysql_num_rows($result);
         if ($nbr_expl) {
             $expl_list_id = array();
             if ($pmb_transferts_actif) {
                 $expl_list_id_transfer = array();
             }
             while ($expl = pmb_mysql_fetch_object($result)) {
                 $expl_list_id[] = $expl->expl_id;
                 //visibilité des exemplaires
                 if ($pmb_droits_explr_localises) {
                     $as_invis = array_search($expl->idlocation, $explr_tab_invis);
                     $as_unmod = array_search($expl->idlocation, $explr_tab_unmod);
                     $as_modif = array_search($expl->idlocation, $explr_tab_modif);
                 } else {
                     $as_invis = false;
                     $as_unmod = false;
                     $as_modif = true;
                 }
                 if ($link_expl) {
                     if ($expl_bulletin) {
                         $tlink = "./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=!!bull_id!!&expl_id=!!expl_id!!";
                         $tlink = str_replace('!!bull_id!!', $expl_bulletin, $tlink);
                         $tlink = str_replace('!!expl_id!!', $expl->expl_id, $tlink);
                         $tlink = str_replace('!!expl_cb!!', rawurlencode($expl->expl_cb), $tlink);
                     } else {
                         $tlink = str_replace('!!expl_id!!', $expl->expl_id, $link_expl);
                         $tlink = str_replace('!!expl_cb!!', rawurlencode($expl->expl_cb), $tlink);
                         $tlink = str_replace('!!notice_id!!', $expl->expl_notice, $tlink);
                     }
                 }
                 $expl_liste .= "<tr>";
                 for ($i = 0; $i < count($colonnesarray); $i++) {
                     if (!(substr($colonnesarray[$i], 0, 1) == "#")) {
                         eval("\$colencours=\$expl->" . $colonnesarray[$i] . ";");
                     }
                     if ($i == 0 && ($expl->expl_note || $expl->expl_comment) && $pmb_expl_list_display_comments) {
                         $expl_rowspan = "rowspan='2'";
                     } else {
                         $expl_rowspan = "";
                     }
                     $aff_column = "";
                     $id_column = "";
                     if (substr($colonnesarray[$i], 0, 1) == "#") {
                         //champs personnalisés
                         $id = substr($colonnesarray[$i], 1);
                         $cp->get_values($expl->expl_id);
                         if (!$cp->no_special_fields) {
                             $temp = $cp->get_formatted_output($cp->values[$id], $id);
                             if (!$temp) {
                                 $temp = "&nbsp;";
                             }
                             $aff_column .= $temp;
                         }
                     } else {
                         if ($colonnesarray[$i] == "expl_cb") {
                             if ($tlink && ($as_modif !== FALSE && $as_modif !== NULL)) {
                                 $aff_column .= "<a href='{$tlink}'>" . $colencours . "</a>";
                             } else {
                                 $aff_column .= $colencours;
                             }
                         } else {
                             if ($colonnesarray[$i] == "expl_cote") {
                                 if ($pmb_html_allow_expl_cote) {
                                     $aff_column .= "<strong>" . $colencours . "</strong>";
                                 } else {
                                     $aff_column .= "<strong>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</strong>";
                                 }
                             } else {
                                 if ($colonnesarray[$i] == "statut_libelle") {
                                     if ($expl->pret_retour) {
                                         // exemplaire sorti
                                         $rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='{$expl->pret_idempr}' ";
                                         $res_empr = pmb_mysql_query($rqt_empr, $dbh);
                                         $res_empr_obj = pmb_mysql_fetch_object($res_empr);
                                         $situation = "<strong>{$msg[358]} " . $expl->aff_pret_retour . "</strong>";
                                         global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
                                         if ($empr_show_caddie && SESSrights & CIRCULATION_AUTH) {
                                             $img_ajout_empr_caddie = "<img src='" . $base_path . "/images/basket_empr.gif' align='middle' alt='basket' title=\"{$msg[400]}\" onClick=\"openPopUp('" . $base_path . "/cart.php?object_type=EMPR&item=" . $expl->pret_idempr . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}')\">&nbsp;";
                                         } else {
                                             $img_ajout_empr_caddie = "";
                                         }
                                         switch ($this->print_mode) {
                                             case '2':
                                                 $situation .= "<br />{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}";
                                                 break;
                                             default:
                                                 $situation .= "<br />{$img_ajout_empr_caddie}<a href='" . $base_path . "/circ.php?categ=pret&form_cb=" . rawurlencode($res_empr_obj->empr_cb) . "'>{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}</a>";
                                                 break;
                                         }
                                     } else {
                                         // tester si réservé
                                         $result_resa = pmb_mysql_query("select 1 from resa where resa_cb='" . addslashes($expl->expl_cb) . "' ", $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                                         $reserve = pmb_mysql_num_rows($result_resa);
                                         // tester à ranger
                                         $result_aranger = pmb_mysql_query(" select 1 from resa_ranger where resa_cb='" . addslashes($expl->expl_cb) . "' ", $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                                         $aranger = pmb_mysql_num_rows($result_aranger);
                                         if ($reserve) {
                                             $situation = "<strong>" . $msg['expl_reserve'] . "</strong>";
                                         } elseif ($expl->expl_retloc) {
                                             $situation = $msg['resa_menu_a_traiter'];
                                         } elseif ($aranger) {
                                             $situation = "<strong>" . $msg['resa_menu_a_ranger'] . "</strong>";
                                         } elseif ($expl->pret_flag) {
                                             $situation = "<strong>{$msg[359]}</strong>";
                                         } else {
                                             $situation = "";
                                         }
                                     }
                                     $aff_column .= htmlentities($colencours, ENT_QUOTES, $charset);
                                     if ($situation) {
                                         $aff_column .= "<br />{$situation}";
                                     }
                                 } else {
                                     if ($colonnesarray[$i] == "groupexpl_name") {
                                         $id_column = "id='groupexpl_name_" . $expl->expl_cb . "'";
                                         $colencours = groupexpls::get_group_name_expl($expl->expl_cb);
                                         $aff_column = htmlentities($colencours, ENT_QUOTES, $charset);
                                     } else {
                                         $aff_column = htmlentities($colencours, ENT_QUOTES, $charset);
                                     }
                                 }
                             }
                         }
                     }
                     $expl_liste .= "<td {$expl_rowspan} {$id_column}>" . $aff_column . "</td>";
                 }
                 if ($this->print_mode) {
                     $expl_liste .= "<td>&nbsp;</td>";
                 } else {
                     if (SESSrights & CATALOGAGE_AUTH) {
                         //le panier d'exemplaire
                         $cart_click = "onClick=\"openPopUp('" . $base_path . "/cart.php?object_type=EXPL&item=" . $expl->expl_id . "', 'cart', 600, 700, -2, -2, 'toolbar=no, dependent=yes, width=500, height=400, resizable=yes, scrollbars=yes')\"";
                         $cart_link = "<a href='#' {$cart_click}><img src='" . $base_path . "/images/basket_small_20x20.gif' align='center' alt='basket' title=\"{$msg[400]}\"></a>";
                         //l'icon pour le drag&drop de panier
                         $drag_link = "<span onMouseOver='if(init_drag) init_drag();' id='EXPL_drag_" . $expl->expl_id . "'  dragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($expl->expl_cb, ENT_QUOTES, $charset) . "\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"" . $base_path . "/images/notice_drag.png\"/></span>";
                     } else {
                         $cart_click = "";
                         $cart_link = "";
                         $drag_link = "";
                     }
                     //l'impression de la fiche exemplaire
                     $fiche_click = "onClick=\"openPopUp('" . $base_path . "/pdf.php?pdfdoc=fiche_catalographique&expl_id=" . $expl->expl_id . "', 'Fiche', 500, 400, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes')\"";
                     $fiche_link = "<a href='#' {$fiche_click}><img src='" . $base_path . "/images/print.gif' align='center' alt='" . $msg['print_fiche_catalographique'] . "' title='" . $msg['print_fiche_catalographique'] . "'></a>";
                     global $pmb_transferts_actif;
                     //si les transferts sont activés
                     if ($pmb_transferts_actif) {
                         //si l'exemplaire n'est pas transferable on a une image vide
                         $transfer_link = "<img src='" . $base_path . "/images/spacer.gif' align='center' height=20 width=20>";
                         $dispo_pour_transfert = transfert::est_transferable($expl->expl_id);
                         if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert) {
                             //l'icon de demande de transfert
                             $transfer_link = "<a href=\"#\" onClick=\"openPopUp('" . $base_path . "/catalog/transferts/transferts_popup.php?expl=" . $expl->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\"><img src='" . $base_path . "/images/peb_in.png' align='center' border=0 alt=\"" . $msg["transferts_alt_libelle_icon"] . "\" title=\"" . $msg["transferts_alt_libelle_icon"] . "\"></a>";
                             $expl_list_id_transfer[] = $expl->expl_id;
                         }
                     }
                     //on met tout dans la colonne
                     $expl_liste .= "<td>{$fiche_link} {$cart_link} {$transfer_link} {$drag_link}</td>";
                 }
                 if ($pmb_pret_groupement || $pmb_transferts_actif) {
                     $expl_liste .= "<td align='center'><input type='checkbox' id='checkbox_expl[" . $expl->expl_id . "]' name='checkbox_expl[" . $expl->expl_id . "]' /></td>";
                 }
                 $expl_liste .= "</tr>";
                 if (($expl->expl_note || $expl->expl_comment) && $pmb_expl_list_display_comments) {
                     $notcom = array();
                     $expl_liste .= "<tr><td colspan='" . $total_columns . "'>";
                     if ($expl->expl_note && $pmb_expl_list_display_comments & 1) {
                         $notcom[] .= "<span class='erreur'>{$expl->expl_note}</span>";
                     }
                     if ($expl->expl_comment && $pmb_expl_list_display_comments & 2) {
                         $notcom[] .= "{$expl->expl_comment}";
                     }
                     $expl_liste .= implode("<br />", $notcom);
                     $expl_liste .= "</tr>";
                 }
             }
             // fin while
         }
         // fin il y a des expl visibles
         if ($expl_liste) {
             $entry = "<table border='0' class='expl-list'>";
             if ($pmb_pret_groupement || $pmb_transferts_actif) {
                 if ($pmb_pret_groupement) {
                     $on_click_groupexpl = "if(check_if_checked(document.getElementById('" . $prefix . "_expl_list_id').value,'groupexpl')) openPopUp('./select.php?what=groupexpl&caller=form_" . $prefix . "_expl&expl_list_id='+get_expl_checked(document.getElementById('" . $prefix . "_expl_list_id').value), 'select_groupexpl', 400, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')";
                 }
                 if ($pmb_transferts_actif) {
                     $on_click_transferts = "if(check_if_checked(document.getElementById('" . $prefix . "_expl_list_id_transfer').value,'transfer')) openPopUp('./catalog/transferts/transferts_popup.php?expl='+get_expl_checked(document.getElementById('" . $prefix . "_expl_list_id_transfer').value), 'select_transferts', 400, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')";
                 }
                 $entry .= "\n\t\t\t\t\t<script type='text/javascript' src='./javascript/expl_list.js'></script>\n\t\t\t\t\t<script type='text/javascript'>\n \t\t\t\t\t\tvar msg_select_all = '" . $msg["notice_expl_check_all"] . "';\n \t\t\t\t\t\tvar msg_unselect_all = '" . $msg["notice_expl_uncheck_all"] . "';\n \t\t\t\t\t\tvar msg_have_select_expl = '" . $msg["notice_expl_have_select_expl"] . "';\n \t\t\t\t\t\tvar msg_have_select_transfer_expl = '" . $msg["notice_expl_have_select_transfer_expl"] . "';\n \t\t\t\t\t\tvar msg_have_same_loc_expl = '" . $msg["notice_expl_have_same_loc_expl"] . "';\n \t\t\t\t\t</script>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th colspan='" . count($colonnesarray) . "'>\n\t\t\t\t\t\t\t" . $msg["notice_for_expl_checked"] . "\n\t\t\t\t\t\t\t" . ($pmb_pret_groupement ? "<input class='bouton' type='button' value=\"" . $msg["notice_for_expl_checked_groupexpl"] . "\" onClick=\"" . $on_click_groupexpl . "\" />&nbsp;&nbsp;" : "") . "\n\t\t\t\t\t\t\t" . ($pmb_transferts_actif ? "<input class='bouton' type='button' value=\"" . $msg["notice_for_expl_checked_transfert"] . "\" onClick=\"" . $on_click_transferts . "\" />" : "") . "\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th></th>\n\t\t\t\t\t\t<th></th>\n\t\t\t\t\t</tr>";
             }
             $entry .= "<tr>";
             for ($i = 0; $i < count($colonnesarray); $i++) {
                 if (substr($colonnesarray[$i], 0, 1) == "#") {
                     //champs personnalisés
                     if (!$cp->no_special_fields) {
                         $id = substr($colonnesarray[$i], 1);
                         $entry .= "<th>" . htmlentities($cp->t_fields[$id][TITRE], ENT_QUOTES, $charset) . "</th>";
                     }
                 } else {
                     eval("\$colencours=\$msg[expl_header_" . $colonnesarray[$i] . "];");
                     $entry .= "<th>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</th>";
                 }
             }
             $entry .= "<th>&nbsp;</th>";
             if ($pmb_pret_groupement || $pmb_transferts_actif) {
                 $entry .= "<th align='center'>\n\t\t\t\t\t\t<input type='checkbox' onclick=\"check_all_expl(this,document.getElementById('" . $prefix . "_expl_list_id').value)\" title='" . $msg["notice_expl_check_all"] . "' id='" . $prefix . "_select_all' name='" . $prefix . "_select_all' />\n\t\t\t\t\t\t<input type='hidden' id='" . $prefix . "_expl_list_id' name='" . $prefix . "_expl_list_id' value='" . implode(",", $expl_list_id) . "' />\n\t\t\t\t\t\t<input type='hidden' id='" . $prefix . "_expl_list_id_transfer' name='" . $prefix . "_expl_list_id_transfer' value='" . implode(",", $expl_list_id_transfer) . "' />\n\t\t\t\t\t</th>";
             }
             $entry .= "</tr>{$expl_liste}</table>";
         } else {
             $entry = "";
         }
         if ($pmb_expl_display_location_without_expl) {
             if ($pmb_sur_location_activate) {
                 $array_surloc = array();
                 $requete = "SELECT * FROM sur_location ORDER BY surloc_libelle";
                 $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                 $nb_surloc = pmb_mysql_num_rows($result);
                 if ($nb_surloc) {
                     while ($surloc = pmb_mysql_fetch_object($result)) {
                         $array_surloc[] = array("id" => $surloc->surloc_id, "libelle" => $surloc->surloc_libelle, "locations" => array());
                     }
                 }
                 if (count($array_surloc)) {
                     foreach ($array_surloc as $key => $surloc) {
                         $requete = "SELECT idlocation, location_libelle from docs_location where surloc_num=" . $surloc["id"] . " AND\n\t\t\t\t\t\tidlocation not in (SELECT expl_location from exemplaires WHERE expl_notice={$no_notice}) order by location_libelle";
                         $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                         $nb_loc = pmb_mysql_num_rows($result);
                         if ($nb_loc) {
                             while ($loc = pmb_mysql_fetch_object($result)) {
                                 $array_surloc[$key]["locations"][] = array("id" => $loc->idlocation, "libelle" => $loc->location_libelle);
                             }
                         } else {
                             unset($array_surloc[$key]);
                         }
                     }
                 }
                 //Au moins une surloc à afficher
                 if (count($array_surloc)) {
                     $tr_surloc = "";
                     foreach ($array_surloc as $key => $surloc) {
                         $tr_surloc .= "<tr><td>";
                         $tr_loc = "";
                         foreach ($surloc["locations"] as $keyloc => $loc) {
                             $tr_loc .= "<tr><td>" . $loc["libelle"] . "</td></tr>";
                         }
                         $tpl_surloc = "\n\t\t\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t\t\t{$tr_loc}\n\t\t\t\t\t\t\t</table>";
                         $tr_surloc .= gen_plus('surlocation_without_expl' . $key . '_' . $no_notice, $surloc["libelle"], $tpl_surloc, 0);
                         $tr_surloc .= "</td></tr>";
                     }
                     $tpl = "\n\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t{$tr_surloc}\n\t\t\t\t\t</table>";
                     $entry .= gen_plus('location_without_expl' . $no_notice, $msg['expl_surlocation_without_expl'], $tpl, 0);
                 }
             } else {
                 $requete = "SELECT location_libelle from docs_location where\n\t\t\t\tidlocation not in (SELECT expl_location from exemplaires WHERE expl_notice={$no_notice}) order by location_libelle";
                 $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                 $nb_loc = pmb_mysql_num_rows($result);
                 if ($nb_loc) {
                     $items = "";
                     while ($loc = pmb_mysql_fetch_object($result)) {
                         $items .= "<tr><td>" . $loc->location_libelle . "</td></tr>";
                     }
                     $tpl = "\n\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t{$items}\n\t\t\t\t\t</table>";
                     $tpl = gen_plus('location_without_expl' . $no_notice, $msg['expl_location_without_expl'], $tpl, 0);
                     $entry .= $tpl;
                 }
             }
         }
         $this->nb_expl = $nbr_expl;
         return $entry;
     } else {
         return "";
     }
 }
function get_expl($expl, $show_in_reception = 0, $return_count = false)
{
    global $msg, $dbh, $charset;
    global $base_path, $class_path;
    global $cart_link_non;
    global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises;
    global $pmb_transferts_actif;
    global $pmb_expl_list_display_comments;
    global $pmb_sur_location_activate;
    global $pmb_expl_data;
    global $class_path;
    global $pmb_pret_groupement;
    // attention, $bul est un array
    if (!sizeof($expl) || !is_array($expl)) {
        return $msg["bull_no_expl"];
    }
    $explr_tab_invis = explode(",", $explr_invisible);
    $explr_tab_unmod = explode(",", $explr_visible_unmod);
    $explr_tab_modif = explode(",", $explr_visible_mod);
    //	$th_sur_location="";
    //	if($pmb_sur_location_activate)$th_sur_location="<th>".$msg["sur_location_expl"]."</th>";
    //
    //	$result  = "<table border=\"0\" cellspacing=\"1\">";
    //	$result .= "<tr><th>".$msg[293]."</th><th>".$msg[4016]."</th>$th_sur_location<th>".$msg[4017]."</th><th>".$msg[4018]."</th><th>".$msg[4019]."</th><th>".$msg[4015]."</th><th></th>";
    //	while(list($cle, $valeur) = each($expl)) {
    //		$requete = "SELECT pret_idempr, ";
    //		$requete .= " date_format(pret_retour, '".$msg["format_date"]."') as aff_pret_retour ";
    //		$requete .= " FROM pret ";
    //		$requete .= " WHERE pret_idexpl='$valeur->expl_id' ";
    //		$result_prets = pmb_mysql_query($requete, $dbh) or die ("<br />".pmb_mysql_error()."<br />".$requete);
    //		if (pmb_mysql_num_rows($result_prets)) $expl_pret = pmb_mysql_fetch_object($result_prets) ;
    //		else $expl_pret="";
    //		$situation = "";
    //		// prêtable ou pas s'il est prêté, on affiche son état
    //		if (is_object($expl_pret) && $expl_pret->pret_idempr) {
    //			// exemplaire sorti
    //			$rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='$expl_pret->pret_idempr' ";
    //			$res_empr = pmb_mysql_query($rqt_empr, $dbh) ;
    //			$res_empr_obj = pmb_mysql_fetch_object($res_empr) ;
    //			$situation = "<strong>${msg[358]} ".$expl_pret->aff_pret_retour."</strong>";
    //			global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
    //			if (!$show_in_reception && $empr_show_caddie && (SESSrights & CIRCULATION_AUTH)) {
    //				$img_ajout_empr_caddie="<img src='./images/basket_empr.gif' align='middle' alt='basket' title=\"${msg[400]}\" onClick=\"openPopUp('./cart.php?object_type=EMPR&item=".$expl->pret_idempr."', 'cart', 600, 700, -2, -2, '$selector_prop_ajout_caddie_empr')\">&nbsp;";
    //			} else {
    //				$img_ajout_empr_caddie="";
    //			}
    //			if (!$show_in_reception) {
    //				$situation .= "<br />$img_ajout_empr_caddie<a href='./circ.php?categ=pret&form_cb=".rawurlencode($res_empr_obj->empr_cb)."'>$res_empr_obj->empr_prenom $res_empr_obj->empr_nom</a>";
    //			} else {
    //				$situation .= "<br />$res_empr_obj->empr_prenom $res_empr_obj->empr_nom";
    //			}
    //		} else {
    //			// tester si réservé
    //			$result_resa = pmb_mysql_query("select 1 from resa where resa_cb='".addslashes($valeur->expl_cb)."' ", $dbh) or die ();
    //			$reserve = pmb_mysql_num_rows($result_resa);
    //			if ($reserve)
    //				$situation = "<strong>".$msg['expl_reserve']."</strong>"; // exemplaire réservé
    //			elseif ($valeur->pret_flag)
    //				$situation = "<strong>${msg[359]}</strong>"; // exemplaire disponible
    //			else
    //				$situation = "";
    //		}
    //
    //		if(!$show_in_reception && (SESSrights & CATALOGAGE_AUTH)){
    //			$selector_prop = "toolbar=no, dependent=yes, resizable=yes, scrollbars=yes";
    //			$cart_click_expl = "onClick=\"openPopUp('./cart.php?object_type=EXPL&item=!!item!!', 'cart', 600, 700, -2, -2, '$selector_prop')\"";
    //			$cart_link = "<img src='./images/basket_small_20x20.gif' align='center' alt='middle' title=\"${msg[400]}\" $cart_click_expl>";
    //			$ajout_expl_panier = str_replace('!!item!!', $valeur->expl_id, $cart_link) ;
    //		}else{
    //			$ajout_expl_panier ="";
    //		}
    //
    //		//si les transferts sont activés
    //		if (!$show_in_reception && $pmb_transferts_actif) {
    //			//si l'exemplaire n'est pas transferable on a une image vide
    //			$dispo_pour_transfert = transfert::est_transferable ( $valeur->expl_id );
    //			if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert)
    //				//l'icon de demande de transfert
    //				$ajout_expl_panier .= "<a href=\"#\" onClick=\"openPopUp('./catalog/transferts/transferts_popup.php?expl=" . $valeur->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\">" . "<img src='./images/peb_in.png' align='center' border=0 alt=\"" . $msg ["transferts_alt_libelle_icon"] . "\" title=\"" . $msg ["transferts_alt_libelle_icon"] . "\"></a>";
    //			else
    //				$ajout_expl_panier .= "<img src='./images/spacer.gif' align='center' height=20 width=20>";
    //
    //		}
    //
    //		$as_invis = false;
    //		$as_unmod = false;
    //		$as_modif = true;
    //		global $flag_no_delete_bulletin;
    //		$flag_no_delete_bulletin=0;
    //		//visibilité des exemplaires
    //		if ($pmb_droits_explr_localises) {
    //			$as_invis = in_array($valeur->expl_location,$explr_tab_invis);
    //			$as_unmod = in_array($valeur->expl_location,$explr_tab_unmod);
    //			//$as_modif = in_array($valeur->expl_location,$explr_tab_modif);
    //
    //			if(!($as_modif=in_array  ($valeur->expl_location,$explr_tab_modif) )) $flag_no_delete_bulletin=1;
    //
    //		}
    //		if ($show_in_reception || $cart_link_non || !(SESSrights & CATALOGAGE_AUTH))
    //			$link =  htmlentities($valeur->expl_cb,ENT_QUOTES, $charset);
    //		else {
    //			if ($as_modif) {
    //				$link = "<a href=\"./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=".$valeur->expl_bulletin."&expl_id=".$valeur->expl_id."\">".htmlentities($valeur->expl_cb,ENT_QUOTES, $charset)."</a>";
    //			} else {
    //				$link = htmlentities($valeur->expl_cb,ENT_QUOTES, $charset);
    //			}
    //		}
    //
    //		if ($situation) $situation="<br />".$situation;
    //		if(!$show_in_reception && SESSrights & CATALOGAGE_AUTH){
    //			$ajout_expl_panier.="<span id='EXPL_drag_".$valeur->expl_id."'  dragicon=\"$base_path/images/icone_drag_notice.png\" dragtext=\"".htmlentities($valeur->expl_cb,ENT_QUOTES, $charset)."\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"".$base_path."/images/notice_drag.png\"/></span>";
    //		}
    //
    //		$line = "<tr>";
    //		if (($valeur->expl_note || $valeur->expl_comment) && $pmb_expl_list_display_comments) $line .= "<td rowspan='2'>$link</td>";
    //		else $line .= "<td>$link</td>";
    //		$line .= "<td>$valeur->expl_cote</td>";
    //		if($pmb_sur_location_activate) $line .= "<td>$valeur->sur_loc_libelle</td>";
    //		$line .= "<td>$valeur->location_libelle</td>";
    //		$line .= "<td>$valeur->section_libelle</td>";
    //		$line .= "<td>$valeur->statut_libelle.$situation</td>";
    //		$line .= "<td>$valeur->tdoc_libelle</td>";
    //		$line .= "<td>$ajout_expl_panier</td>";
    //		if (($valeur->expl_note || $valeur->expl_comment) && $pmb_expl_list_display_comments) {
    //			$notcom=array();
    //			$line .= "<tr><td colspan='6'>";
    //			if ($valeur->expl_note && ($pmb_expl_list_display_comments & 1)) $notcom[] .= "<span class='erreur'>$valeur->expl_note</span>";
    //			if ($valeur->expl_comment && ($pmb_expl_list_display_comments & 2)) $notcom[] .= "$valeur->expl_comment";
    //			$line .= implode("<br />",$notcom);
    //			$line .= "</tr>";
    //		}
    //		$result .= $line;
    //	} //while(list($cle, $valeur) = each($expl))
    //
    //	$result .= "</table>";
    //
    //maintenant
    //Liste des champs d'exemplaires
    if ($pmb_sur_location_activate) {
        $surloc_field = "surloc_libelle,";
    }
    if (!$pmb_expl_data) {
        $pmb_expl_data = "expl_cb,expl_cote," . $surloc_field . "location_libelle,section_libelle,statut_libelle,tdoc_libelle";
    }
    $colonnesarray = explode(",", $pmb_expl_data);
    if (!in_array("expl_cb", $colonnesarray)) {
        array_unshift($colonnesarray, "expl_cb");
    }
    $total_columns = count($colonnesarray);
    if ($pmb_pret_groupement || $pmb_transferts_actif) {
        $total_columns++;
    }
    //Présence de champs personnalisés
    if (strstr($pmb_expl_data, "#")) {
        require_once $class_path . "/parametres_perso.class.php";
        $cp = new parametres_perso("expl");
    }
    if ($return_count) {
        return count($expl);
    }
    if (count($expl)) {
        $result .= "<table border=\"0\" cellspacing=\"1\">";
        if ($pmb_pret_groupement || $pmb_transferts_actif) {
            if ($pmb_pret_groupement) {
                $on_click_groupexpl = "if(check_if_checked(document.getElementById('expl_list_id').value,'groupexpl')) openPopUp('./select.php?what=groupexpl&caller=form_expl&expl_list_id='+get_expl_checked(document.getElementById('expl_list_id').value), 'select_groupexpl', 400, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')";
            }
            if ($pmb_transferts_actif) {
                $on_click_transferts = "if(check_if_checked(document.getElementById('expl_list_id_transfer').value,'transfer')) openPopUp('./catalog/transferts/transferts_popup.php?expl='+get_expl_checked(document.getElementById('expl_list_id_transfer').value), 'select_transferts', 400, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')";
            }
            $entry .= "\n\t\t\t\t\t<script type='text/javascript' src='./javascript/expl_list.js'></script>\n\t\t\t\t\t<script type='text/javascript'>\n \t\t\t\t\t\tvar msg_select_all = '" . $msg["notice_expl_check_all"] . "';\n \t\t\t\t\t\tvar msg_unselect_all = '" . $msg["notice_expl_uncheck_all"] . "';\n \t\t\t\t\t\tvar msg_have_select_expl = '" . $msg["notice_expl_have_select_expl"] . "';\n \t\t\t\t\t\tvar msg_have_select_transfer_expl = '" . $msg["notice_expl_have_select_transfer_expl"] . "';\n \t\t\t\t\t\tvar msg_have_same_loc_expl = '" . $msg["notice_expl_have_same_loc_expl"] . "';\n \t\t\t\t\t</script>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th colspan='" . count($colonnesarray) . "'>\n\t\t\t\t\t\t\t" . $msg["notice_for_expl_checked"] . "\n\t\t\t\t\t\t\t" . ($pmb_pret_groupement ? "<input class='bouton' type='button' value=\"" . $msg["notice_for_expl_checked_groupexpl"] . "\" onClick=\"" . $on_click_groupexpl . "\" />&nbsp;&nbsp;" : "") . "\n\t\t\t\t\t\t\t" . ($pmb_transferts_actif ? "<input class='bouton' type='button' value=\"" . $msg["notice_for_expl_checked_transfert"] . "\" onClick=\"" . $on_click_transferts . "\" />" : "") . "\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th></th>\n\t\t\t\t\t\t<th></th>\n\t\t\t\t\t</tr>";
        }
        //un premier tour pour aller chercher les libellés...
        for ($i = 0; $i < count($colonnesarray); $i++) {
            if (substr($colonnesarray[$i], 0, 1) == "#") {
                //champs personnalisés
                if (!$cp->no_special_fields) {
                    $id = substr($colonnesarray[$i], 1);
                    $entry .= "<th>" . htmlentities($cp->t_fields[$id][TITRE], ENT_QUOTES, $charset) . "</th>";
                }
            } else {
                eval("\$colencours=\$msg['expl_header_" . $colonnesarray[$i] . "'];");
                $entry .= "<th>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</th>";
            }
        }
        $result .= "<tr>" . $entry . "<th>&nbsp;</th>";
        if ($pmb_pret_groupement || $pmb_transferts_actif) {
            $expl_list_id = array();
            $expl_list_id_transfer = array();
            $result .= "<th align='center'>\n\t\t\t\t\t\t<input type='checkbox' onclick=\"check_all_expl(this,document.getElementById('expl_list_id').value)\" title='" . $msg["notice_expl_check_all"] . "' id='select_all' name='select_all' />\t\t\n\t\t\t\t\t</th>";
        }
        $result .= "</tr>";
        foreach ($expl as $exemplaire) {
            $requete = "SELECT pret_idempr, ";
            $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour ";
            $requete .= " FROM pret ";
            $requete .= " WHERE pret_idexpl='{$exemplaire->expl_id}' ";
            $result_prets = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
            if (pmb_mysql_num_rows($result_prets)) {
                $expl_pret = pmb_mysql_fetch_object($result_prets);
            } else {
                $expl_pret = "";
            }
            $situation = "";
            // prêtable ou pas s'il est prêté, on affiche son état
            if (is_object($expl_pret) && $expl_pret->pret_idempr) {
                // exemplaire sorti
                $rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='{$expl_pret->pret_idempr}' ";
                $res_empr = pmb_mysql_query($rqt_empr, $dbh);
                $res_empr_obj = pmb_mysql_fetch_object($res_empr);
                $situation = "<strong>{$msg[358]} " . $expl_pret->aff_pret_retour . "</strong>";
                global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
                if (!$show_in_reception && $empr_show_caddie && SESSrights & CIRCULATION_AUTH) {
                    $img_ajout_empr_caddie = "<img src='./images/basket_empr.gif' align='middle' alt='basket' title=\"{$msg[400]}\" onClick=\"openPopUp('./cart.php?object_type=EMPR&item=" . $exemplaire->pret_idempr . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}')\">&nbsp;";
                } else {
                    $img_ajout_empr_caddie = "";
                }
                if (!$show_in_reception) {
                    $situation .= "<br />{$img_ajout_empr_caddie}<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($res_empr_obj->empr_cb) . "'>{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}</a>";
                } else {
                    $situation .= "<br />{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}";
                }
            } else {
                // tester si réservé
                $result_resa = pmb_mysql_query("select 1 from resa where resa_cb='" . addslashes($exemplaire->expl_cb) . "' ", $dbh) or die;
                $reserve = pmb_mysql_num_rows($result_resa);
                if ($reserve) {
                    $situation = "<strong>" . $msg['expl_reserve'] . "</strong>";
                    // exemplaire réservé
                } elseif ($exemplaire->pret_flag) {
                    $situation = "<strong>{$msg[359]}</strong>";
                    // exemplaire disponible
                } else {
                    $situation = "";
                }
            }
            if (!$show_in_reception && SESSrights & CATALOGAGE_AUTH) {
                $selector_prop = "toolbar=no, dependent=yes, resizable=yes, scrollbars=yes";
                $cart_click_expl = "onClick=\"openPopUp('./cart.php?object_type=EXPL&item=!!item!!', 'cart', 600, 700, -2, -2, '{$selector_prop}')\"";
                $cart_link = "<img src='./images/basket_small_20x20.gif' align='center' alt='middle' title=\"{$msg[400]}\" {$cart_click_expl}>";
                $ajout_expl_panier = str_replace('!!item!!', $exemplaire->expl_id, $cart_link);
            } else {
                $ajout_expl_panier = "";
            }
            //si les transferts sont activés
            if (!$show_in_reception && $pmb_transferts_actif) {
                //si l'exemplaire n'est pas transferable on a une image vide
                $dispo_pour_transfert = transfert::est_transferable($exemplaire->expl_id);
                if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert) {
                    //l'icon de demande de transfert
                    $ajout_expl_panier .= "<a href=\"#\" onClick=\"openPopUp('./catalog/transferts/transferts_popup.php?expl=" . $exemplaire->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\">" . "<img src='./images/peb_in.png' align='center' border=0 alt=\"" . $msg["transferts_alt_libelle_icon"] . "\" title=\"" . $msg["transferts_alt_libelle_icon"] . "\"></a>";
                    $expl_list_id_transfer[] = $exemplaire->expl_id;
                } else {
                    $ajout_expl_panier .= "<img src='./images/spacer.gif' align='center' height=20 width=20>";
                }
            }
            $as_invis = false;
            $as_unmod = false;
            $as_modif = true;
            global $flag_no_delete_bulletin;
            $flag_no_delete_bulletin = 0;
            //visibilité des exemplaires
            if ($pmb_droits_explr_localises) {
                $as_invis = in_array($exemplaire->expl_location, $explr_tab_invis);
                $as_unmod = in_array($exemplaire->expl_location, $explr_tab_unmod);
                //$as_modif = in_array($exemplaire->expl_location,$explr_tab_modif);
                if (!($as_modif = in_array($exemplaire->expl_location, $explr_tab_modif))) {
                    $flag_no_delete_bulletin = 1;
                }
            }
            if ($show_in_reception || $cart_link_non || !(SESSrights & CATALOGAGE_AUTH)) {
                $link = htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset);
            } else {
                if ($as_modif) {
                    $link = "<a href=\"./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=" . $exemplaire->expl_bulletin . "&expl_id=" . $exemplaire->expl_id . "\">" . htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset) . "</a>";
                } else {
                    $link = htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset);
                }
            }
            if ($situation) {
                $situation = "<br />" . $situation;
            }
            if (!$show_in_reception && SESSrights & CATALOGAGE_AUTH) {
                $ajout_expl_panier .= "<span id='EXPL_drag_" . $exemplaire->expl_id . "'  dragicon=\"{$base_path}/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset) . "\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"" . $base_path . "/images/notice_drag.png\"/></span>";
            }
            global $pmb_serialcirc_subst;
            if ($pmb_serialcirc_subst) {
                $ajout_expl_panier .= "<img src='./images/print.gif' alt='Imprimer...' title='Imprimer...' align='middle' border='0'\tstyle='padding-left:7px' \t\t\t\n\t\t\t\t\tonclick=\"openPopUp('./ajax.php?module=circ&categ=periocirc&sub=print_cote&expl_id=" . $exemplaire->expl_id . "', 'circulation', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\"\n\t\t\t\t>";
            }
            $line = "<tr>";
            for ($i = 0; $i < count($colonnesarray); $i++) {
                if ($i == 0 && ($exemplaire->expl_note || $exemplaire->expl_comment) && $pmb_expl_list_display_comments) {
                    $expl_rowspan = "rowspan='2'";
                } else {
                    $expl_rowspan = "";
                }
                $aff_column = "";
                $id_column = "";
                if (substr($colonnesarray[$i], 0, 1) == "#") {
                    //champs personnalisés
                    $id = substr($colonnesarray[$i], 1);
                    $cp->get_values($exemplaire->expl_id);
                    if (!$cp->no_special_fields) {
                        $temp = $cp->get_formatted_output($cp->values[$id], $id);
                        if (!$temp) {
                            $temp = "&nbsp;";
                        }
                        $aff_column .= $temp;
                    }
                } else {
                    eval("\$colencours=\$exemplaire->" . $colonnesarray[$i] . ";");
                    if ($colonnesarray[$i] == "expl_cb") {
                        $aff_column = $link;
                    } else {
                        if ($colonnesarray[$i] == "expl_cote") {
                            $aff_column = "<strong>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</strong>";
                        } else {
                            if ($colonnesarray[$i] == "surloc_libelle") {
                                $aff_column = htmlentities($exemplaire->sur_loc_libelle, ENT_QUOTES, $charset);
                            } else {
                                if ($colonnesarray[$i] == "statut_libelle") {
                                    $aff_column = htmlentities($colencours, ENT_QUOTES, $charset) . $situation;
                                } else {
                                    if ($colonnesarray[$i] == "groupexpl_name") {
                                        $id_column = "id='groupexpl_name_" . $exemplaire->expl_cb . "'";
                                        $colencours = groupexpls::get_group_name_expl($exemplaire->expl_cb);
                                        $aff_column = htmlentities($colencours, ENT_QUOTES, $charset);
                                    } else {
                                        $aff_column = htmlentities($colencours, ENT_QUOTES, $charset);
                                    }
                                }
                            }
                        }
                    }
                }
                $line .= "<td {$expl_rowspan} {$id_column}>" . $aff_column . "</td>";
            }
            $line .= "<td>{$ajout_expl_panier}</td>";
            if ($pmb_pret_groupement || $pmb_transferts_actif) {
                $line .= "<td align='center'><input type='checkbox' id='checkbox_expl[" . $exemplaire->expl_id . "]' name='checkbox_expl[" . $exemplaire->expl_id . "]' /></td>";
                $expl_list_id[] = $exemplaire->expl_id;
            }
            $line .= "</tr>";
            if (($exemplaire->expl_note || $exemplaire->expl_comment) && $pmb_expl_list_display_comments) {
                $notcom = array();
                $line .= "<tr><td colspan='" . $total_columns . "'>";
                if ($exemplaire->expl_note && $pmb_expl_list_display_comments & 1) {
                    $notcom[] .= "<span class='erreur'>{$exemplaire->expl_note}</span>";
                }
                if ($exemplaire->expl_comment && $pmb_expl_list_display_comments & 2) {
                    $notcom[] .= "{$exemplaire->expl_comment}";
                }
                $line .= implode("<br />", $notcom);
                $line .= "</tr>";
            }
            $result .= $line;
        }
        if ($pmb_pret_groupement || $pmb_transferts_actif) {
            $result .= "<input type='hidden' id='expl_list_id' name='expl_list_id' value='" . implode(",", $expl_list_id) . "' \t/>\n\t\t\t<input type='hidden' id='expl_list_id_transfer' name='expl_list_id_transfer' value='" . implode(",", $expl_list_id_transfer) . "' />";
        }
        $result .= "</table>";
    }
    return $result;
}