function prefill_cote($id_notice = 0, $cote = "")
{
    global $dbh;
    global $deflt_docs_location;
    global $value_prefix_cote;
    $res_dewey = '';
    $res_author = '';
    $res_title = '';
    $res_nvol = '';
    $res_cote = '';
    if (!$cote) {
        // fetch the dewey code
        $requete = "SELECT indexint_name FROM indexint, notices where notice_id='{$id_notice}' and indexint=indexint_id ";
        $result = @pmb_mysql_query($requete, $dbh);
        $nbr_lignes = pmb_mysql_num_rows($result);
        if ($nbr_lignes) {
            $res = pmb_mysql_fetch_object($result);
            $res_dewey = $res->indexint_name;
        }
        // fetch the title and the volume number
        $requete = "SELECT index_sew, tnvol FROM notices WHERE notice_id= '{$id_notice}' ";
        $result = @pmb_mysql_query($requete, $dbh);
        $res = pmb_mysql_fetch_object($result);
        $res_title = pmb_strtoupper(pmb_str_replace(" ", "", $res->index_sew));
        $res_nvol = $res->tnvol;
        // récupération du libellé de la localisation par défaut du catalogueur
        // si la localisation a dans son libellé ou son codage d'import ENSAI, on récupèrera 4 lettres pour l'auteur, dans les autres cas, on récupèrera 3 lettres
        $requete = "SELECT location_libelle, locdoc_codage_import FROM docs_location WHERE idlocation= '" . $deflt_docs_location . "' ";
        $result = @pmb_mysql_query($requete, $dbh);
        $res = pmb_mysql_fetch_object($result);
        if (preg_match("#ENSAI#", $res->location_libelle) || preg_match("#ENSAI#", $res->locdoc_codage_import)) {
            $nb_car_auteur_cote = 4;
        } else {
            $nb_car_auteur_cote = 3;
        }
        // fetch the first author, but only if his responsability_type is 0
        $requete = "SELECT index_author, responsability_type FROM authors, responsability WHERE author_id=responsability_author and responsability_notice = '{$id_notice}' ORDER BY responsability_type, responsability_ordre LIMIT 1";
        $result = @pmb_mysql_query($requete, $dbh);
        $nbr_lignes = pmb_mysql_num_rows($result);
        // build the code using also the author name
        if ($nbr_lignes) {
            $res = pmb_mysql_fetch_object($result);
            $res_author = pmb_strtoupper(pmb_substr(pmb_str_replace(" ", "", $res->index_author), 0, $nb_car_auteur_cote));
            $res_cote = $res_dewey . " " . $res_author;
        } else {
            // no author at responsability_type 0 so build the code using only the title
            $res_title = pmb_substr($res_title, 0, $nb_car_auteur_cote);
            $res_cote = $res_dewey . " " . $res_title . " " . $res_nvol;
        }
        return $value_prefix_cote . $res_cote;
    } else {
        return $cote;
    }
}
Example #2
0
function prefill_cote($id_notice = 0, $cote = "")
{
    global $dbh;
    global $value_prefix_cote;
    $res_dewey = '';
    $res_author = '';
    $res_title = '';
    $res_nvol = '';
    $res_cote = '';
    if (!$cote) {
        // fetch the dewey code
        $requete = "SELECT indexint_name FROM indexint, notices where notice_id='{$id_notice}' and indexint=indexint_id ";
        $result = @mysql_query($requete, $dbh);
        $nbr_lignes = mysql_num_rows($result);
        if ($nbr_lignes) {
            $res = mysql_fetch_object($result);
            $res_dewey = $res->indexint_name;
        }
        // fetch the title and the volume number
        $requete = "SELECT index_sew, tnvol FROM notices WHERE notice_id= '{$id_notice}' ";
        $result = @mysql_query($requete, $dbh);
        $res = mysql_fetch_object($result);
        $res_title = pmb_strtoupper(pmb_str_replace(" ", "", $res->index_sew));
        $res_nvol = $res->tnvol;
        // fetch the editor
        $requete = "SELECT ed_name, index_publisher FROM publishers, notices WHERE ed1_id=ed_id and notice_id = '{$id_notice}'";
        $result = @mysql_query($requete, $dbh);
        $nbr_lignes = mysql_num_rows($result);
        // build the code using also the author name
        if ($nbr_lignes) {
            $res = mysql_fetch_object($result);
            if (strpos($res->ed_name, '(') > 0) {
                $res_editor = substr(stristr($res->ed_name, '('), 1, 4);
            } else {
                $res_editor = strtoupper(substr($res->ed_name, 0, 4));
            }
            $res_title = pmb_substr($res_title, 0, 3);
            $res_cote = $res_dewey . " " . $res_editor;
        } else {
            // no author at responsability_type 0 so build the code using only the title
            $res_title = pmb_substr($res_title, 0, 4);
            $res_cote = $res_dewey . " " . $res_title . " " . $res_nvol;
        }
        return $value_prefix_cote . $res_cote;
    } else {
        return $cote;
    }
}
Example #3
0
function prefill_cote($id_notice = 0, $cote = "")
{
    global $dbh;
    global $value_prefix_cote;
    $res_dewey = '';
    $res_author = '';
    $res_title = '';
    $res_nvol = '';
    $res_cote = '';
    if (!$cote) {
        // fetch the dewey code
        $requete = "SELECT indexint_name FROM indexint, notices where notice_id='{$id_notice}' and indexint=indexint_id ";
        $result = @mysql_query($requete, $dbh);
        $nbr_lignes = mysql_num_rows($result);
        if ($nbr_lignes) {
            $res = mysql_fetch_object($result);
            $res_dewey = $res->indexint_name;
        }
        // fetch the title and the volume number
        $requete = "SELECT index_sew, tnvol FROM notices WHERE notice_id= '{$id_notice}' ";
        $result = @mysql_query($requete, $dbh);
        $res = mysql_fetch_object($result);
        $res_title = pmb_strtoupper(pmb_str_replace(" ", "", $res->index_sew));
        $res_nvol = $res->tnvol;
        // fetch the first author, but only if his responsability_type is 0
        $requete = "SELECT index_author, responsability_type FROM authors, responsability WHERE author_id=responsability_author and responsability_notice = '{$id_notice}' and responsability_type = '0' LIMIT 1";
        $result = @mysql_query($requete, $dbh);
        $nbr_lignes = mysql_num_rows($result);
        // build the code using also the author name
        if ($nbr_lignes) {
            $res = mysql_fetch_object($result);
            $res_author = pmb_strtoupper(pmb_substr(pmb_str_replace(" ", "", $res->index_author), 0, 3));
            $res_title = pmb_substr($res_title, 0, 3);
            $res_cote = $res_dewey . " " . $res_author . "-" . $res_title . " " . $res_nvol;
        } else {
            // no author at responsability_type 0 so build the code using only the title
            $res_title = pmb_substr($res_title, 0, 7);
            $res_cote = $res_dewey . " " . $res_title . " " . $res_nvol;
        }
        return $value_prefix_cote . $res_cote;
    } else {
        return $cote;
    }
}
Example #4
0
 function getDataAbc()
 {
     global $dbh, $filtre_select;
     $this->titles = array();
     $tbCorrespondance = array();
     $ongletInc = 0;
     $req = $this->getQuery();
     $resultat = pmb_mysql_query($req);
     if ($nb_notices = pmb_mysql_num_rows($resultat)) {
         while ($r = pmb_mysql_fetch_object($resultat)) {
             if (pmb_substr($r->notice_id, 0, pmb_strlen("es)")) == "es" && $filtre_select != 2) {
                 // si cataloguée, on ne l'affiche pas. sauf si on filtre par fonds externe ($filtre_select!=2)
                 if ($this->get_doublon_ex($this->extract_external_id($r->notice_id))) {
                     continue;
                 }
             }
             $letter = pmb_substr(trim(pmb_strtolower($r->index_sew)), 0, 1);
             //On classe selon la première lettre
             if (is_numeric($letter)) {
                 $letter = "0";
             }
             if (isset($tbCorrespondance[$letter])) {
                 $tbCorrespondance[$letter]["qt"]++;
                 $tbCorrespondance[$letter]["lastTitle"] = trim($r->index_sew);
                 $onglet = $tbCorrespondance[$letter]["onglet"];
             } else {
                 $ongletInc++;
                 $ongletSubInc = 1;
                 $tbCorrespondance[$letter]["qt"] = 1;
                 $tbCorrespondance[$letter]["onglet"] = $ongletInc;
                 if (is_numeric($letter)) {
                     $this->onglets_contens[$ongletInc]["label"] = "0 - 9";
                 } elseif ($letter == " ") {
                     // les inclassables
                     $this->onglets_contens[$ongletInc]["label"] = " # ";
                 } else {
                     $this->onglets_contens[$ongletInc]["label"] = " " . pmb_strtoupper($letter) . " ";
                 }
                 $this->onglets_contens[$ongletInc]["letter"][] = $letter;
                 $onglet = $ongletInc;
             }
             //Sous-onglet
             if (!isset($this->onglets_sub_contens[$onglet][$ongletSubInc])) {
                 $this->onglets_sub_contens[$onglet][$ongletSubInc]["label"] = pmb_strtoupper(trim($r->index_sew));
             }
             $this->onglets_sub_contens[$onglet][$ongletSubInc]["id"][] = $r->notice_id;
             $this->onglets_sub_contens[$onglet][$ongletSubInc]["last_label"] = pmb_strtoupper(trim($r->index_sew));
             if (count($this->onglets_sub_contens[$onglet][$ongletSubInc]["id"]) == $this->max_per_onglet) {
                 $ongletSubInc++;
             }
             //On mémorise le couple onglet/sous-onglet pour la recherche ajax
             $t = array();
             $t["onglet"] = $onglet . '_' . $ongletSubInc;
             $t["label"] = pmb_strtoupper(trim($r->index_sew));
             $t["title"] = $r->tit1;
             $t["id"] = $r->notice_id;
             if (pmb_substr($r->notice_id, 0, pmb_strlen("es)")) == "es") {
                 // 				$this->titles[]="xxxxxxxxx";
                 // 				print $r->notice_id;
             } else {
                 $this->titles[] = $t;
             }
         }
         //On transforme les labels
         foreach ($this->onglets_sub_contens as $onglet => $myOnglet) {
             foreach ($myOnglet as $ongletSub => $myOngletSub) {
                 $lastOngletSub = $ongletSub;
                 if ($ongletSub == 1) {
                     $this->onglets_sub_contens[$onglet][$ongletSub]["label"] = pmb_substr($this->onglets_sub_contens[$onglet][$ongletSub]["label"], 0, 1);
                 } else {
                     $mesTermes = $this->difference_label($this->onglets_sub_contens[$onglet][$ongletSub - 1]["last_label"], $this->onglets_sub_contens[$onglet][$ongletSub]["label"]);
                     $this->onglets_sub_contens[$onglet][$ongletSub - 1]["last_label"] = $mesTermes[0];
                     $this->onglets_sub_contens[$onglet][$ongletSub]["label"] = $mesTermes[1];
                 }
             }
             //On retravaille le dernier
             $mesTermes = $this->difference_label($this->onglets_sub_contens[$onglet][$lastOngletSub]["label"], $this->onglets_sub_contens[$onglet][$lastOngletSub]["last_label"]);
             $this->onglets_sub_contens[$onglet][$lastOngletSub]["last_label"] = $mesTermes[1];
         }
     }
 }
Example #5
0
 function do_fiche()
 {
     global $empr_tmpl;
     global $msg;
     $this->fiche = $empr_tmpl;
     $this->fiche = str_replace('!!cb!!', $this->cb, $this->fiche);
     $this->fiche = str_replace('!!nom!!', pmb_strtoupper($this->nom), $this->fiche);
     $this->fiche = str_replace('!!prenom!!', $this->prenom, $this->fiche);
     $this->fiche = str_replace('!!id!!', $this->id, $this->fiche);
     $this->fiche = str_replace('!!adr1!!', $this->adr1, $this->fiche);
     $this->fiche = str_replace('!!adr2!!', $this->adr2, $this->fiche);
     $this->fiche = str_replace('!!tel1!!', $this->tel1, $this->fiche);
     $this->fiche = str_replace('!!tel2!!', $this->tel2, $this->fiche);
     $this->fiche = str_replace('!!cp!!', $this->cp, $this->fiche);
     $this->fiche = str_replace('!!ville!!', $this->ville, $this->fiche);
     $emails = array();
     $email_final = array();
     $emails = explode(';', $this->mail);
     for ($i = 0; $i < count($emails); $i++) {
         $email_final[] = "<a href='mailto:" . $emails[$i] . "'>" . $emails[$i] . "</a>";
     }
     $this->fiche = str_replace('!!mail_all!!', $this->mail, $this->fiche);
     $this->fiche = str_replace('!!prof!!', $this->prof, $this->fiche);
     $this->fiche = str_replace('!!date!!', $this->birth, $this->fiche);
     $this->fiche = str_replace('!!categ!!', $this->categ . '-' . $this->cat_l, $this->fiche);
     $this->fiche = str_replace('!!codestat!!', $this->cstat . '-' . $this->cstat_l, $this->fiche);
     $this->fiche = str_replace('!!adhesion!!', $this->aff_date_adhesion, $this->fiche);
     $this->fiche = str_replace('!!expiration!!', $this->aff_date_expiration, $this->fiche);
     if ($this->serious_message) {
         $this->fiche = str_replace('!!class_msg!!', 'empr-serious-msg', $this->fiche);
     } else {
         $this->fiche = str_replace('!!class_msg!!', 'empr-msg', $this->fiche);
     }
     if (!$this->message) {
         $this->message = $msg["empr_no_message_for"];
     }
     $this->fiche = str_replace('!!empr_msg!!', $this->message, $this->fiche);
     $fsexe[0] = $msg[128];
     $fsexe[1] = $msg[126];
     $fsexe[2] = $msg[127];
     $this->fiche = str_replace('!!sexe!!', $fsexe[$this->sexe], $this->fiche);
     // valeur pour les champ hidden du prêt. L'id empr est pris en charge plus haut (voir Eric)
     $this->fiche = str_replace('!!cb!!', $this->cb, $this->fiche);
     // traitement liste exemplaires en prêt
     if (!sizeof($this->prets)) {
         // dans ce cas, le lecteur n'a rien en prêt
         $prets_list = "<tr><td class='ex-strip' colspan='5'>" . $msg["empr_no_expl"] . "</td></tr>";
     } else {
         // constitution du code HTML
         while (list($cle, $valeur) = each($this->prets)) {
             $prets_list .= "\n\t\t\t<tr>\n\t\t\t<form name=prolong{$valeur['cb']} action='circ.php'>\n\t\t\t\t<td class='strip'>\n\t\t\t\t\t{$valeur['cb']}\n\t\t\t\t</td>\n\t\t\t\t<td class='empr-msg'>\n\t\t\t\t\t{$valeur['libelle']}\n\t\t\t\t</td>\n\t\t\t\t<td class='strip'>\n\t\t\t\t\t{$valeur['typdoc']}\n\t\t\t\t</td>\n\t\t\t\t<td class='strip'>\n\t\t\t\t\t{$valeur['date_pret']}\n\t\t\t\t</td>\n\t\t\t\t<td class='strip'>\n\t\t\t\t\t<input type='hidden' name='categ' value='pret'>\n\n\t\t\t\t\t<input type='hidden' name='sub' value='pret_prolongation'>\n\n\t\t\t\t\t<input type='hidden' name='form_cb' value='{$this->cb}'>\n\n\t\t\t\t\t<input type='hidden' name='cb_doc' value='{$valeur['cb']}'>\n\n\t\t\t\t\t<input type='hidden' name='date_retour' value=\"\">\n\n\t\t\t\t";
             $prets_list .= "\t</td>\n\t\t\t\t\t\t</form></tr>\n\t\t\t\t\t\t";
             // ouf, c'est fini ;-)
         }
     }
     $this->fiche = str_replace('!!pret_list!!', $prets_list, $this->fiche);
     // mise à jour de la liste des réservations
     $this->fiche = str_replace('!!resa_list!!', $this->fetch_resa(), $this->fiche);
 }
 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;
 }
Example #7
0
 function do_fiche_consultation()
 {
     global $empr_tmpl_consultation, $empr_pret_allowed;
     global $msg, $charset;
     global $groupID;
     global $biblio_email;
     global $pmb_lecteurs_localises;
     global $pmb_gestion_abonnement, $pmb_gestion_financiere, $pmb_gestion_tarif_prets, $pmb_gestion_amende;
     global $finance_blocage_abt, $finance_blocage_amende, $finance_blocage_pret, $pmb_blocage_retard, $pmb_blocage_retard_force;
     global $force_finance;
     global $pmb_resa_planning;
     global $dbh;
     global $pmb_blocage_retard, $pmb_blocage_coef, $pmb_blocage_max, $pmb_blocage_delai;
     global $empr_fiche_depliee;
     //global $cb_inpret;
     global $alert_sound_list;
     // l'utilisateur veut-il les sons d'alerte
     $this->fiche_consultation = $empr_tmpl_consultation;
     $this->fiche_consultation = str_replace('!!cb!!', $this->cb, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!nom!!', pmb_strtoupper($this->nom), $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!prenom!!', $this->prenom, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!image_caddie_empr!! ', $this->img_ajout_empr_caddie, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!info_nb_pret!!', $this->nb_pret, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!info_nb_resa!!', $this->nb_reservations, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!info_authldap!!', $this->ldap, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!id!!', $this->id, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!adr1!!', $this->adr1, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!adr2!!', $this->adr2, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!tel1!!', $this->tel1, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!sms!!', $this->sms, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!tel2!!', $this->tel2, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!cp!!', $this->cp, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!ville!!', $this->ville, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!pays!!', $this->pays, $this->fiche_consultation);
     $emails = array();
     $email_final = array();
     $emails = explode(';', $this->mail);
     for ($i = 0; $i < count($emails); $i++) {
         $email_final[] = "<a href='mailto:" . $emails[$i] . "'>" . $emails[$i] . "</a>";
     }
     $this->fiche_consultation = str_replace('!!mail_all!!', implode("&nbsp;", $email_final), $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!prof!!', $this->prof, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!date!!', $this->birth, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!categ!!', $this->cat_l, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!codestat!!', $this->cstat_l, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!adhesion!!', $this->aff_date_adhesion, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!expiration!!', $this->aff_date_expiration, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!last_loan_date!!', $this->aff_last_loan_date, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!perso!!', $this->perso, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!header_format!!', $this->header_format, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!empr_login!!', $this->login, $this->fiche_consultation);
     if ($this->pwd) {
         $this->fiche_consultation = str_replace('!!empr_pwd!!', "<i><strong>" . $msg["empr_pwd_opac_affected"] . "</strong></i>", $this->fiche_consultation);
     } else {
         $this->fiche_consultation = str_replace('!!empr_pwd!!', "", $this->fiche_consultation);
     }
     $this->fiche_consultation = str_replace('!!comptes!!', $this->compte, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!empr_statut_libelle!!', $this->empr_statut_libelle, $this->fiche_consultation);
     $this->fiche_consultation = str_replace('!!empr_picture!!', $this->picture_empr($this->cb), $this->fiche_consultation);
     if ($empr_fiche_depliee == "1") {
         $this->fiche_consultation = str_replace('!!depliee!!', " startOpen=\"Yes\"", $this->fiche_consultation);
     } else {
         $this->fiche_consultation = str_replace('!!depliee!!', "", $this->fiche_consultation);
     }
     if ($pmb_lecteurs_localises) {
         $this->fiche_consultation = str_replace("<!-- !!localisation!! -->", "<div class='row'><strong>{$msg['empr_location']} : </strong>" . $this->empr_location_l . "</div>", $this->fiche_consultation);
     }
     //Groupes
     if (count($this->groupes)) {
         $this->fiche_consultation = str_replace('!!groupes!!', "<strong>" . $msg[groupes_empr] . " : </strong>" . implode(" / ", $this->groupes) . "\n", $this->fiche_consultation);
     } else {
         $this->fiche_consultation = str_replace('!!groupes!!', "&nbsp;", $this->fiche_consultation);
     }
     if ($pmb_gestion_financiere && $pmb_gestion_abonnement == 2) {
         if ($this->type_abt) {
             $requete = "select type_abt_libelle from type_abts where id_type_abt='" . $this->type_abt . "'";
             $resultat_type_abt = mysql_query($requete);
             if (@mysql_num_rows($resultat_type_abt)) {
                 $abonnement = mysql_result($resultat_type_abt, 0, 0);
             }
         }
     }
     if ($abonnement) {
         $this->fiche_consultation = str_replace("!!abonnement!!", "<div class='row'><strong>" . $msg["finance_type_abt"] . " : </strong>" . htmlentities($abonnement, ENT_QUOTES, $charset) . "</div>\n", $this->fiche_consultation);
     } else {
         $this->fiche_consultation = str_replace("!!abonnement!!", "", $this->fiche_consultation);
     }
     if ($this->empr_msg) {
         $message_fiche_empr = "\n\t\t\t\t\t<hr />\n\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t<div class='colonne10'><img src='./images/info.png' /></div>\n\t\t\t\t\t\t<div class='colonne-suite'><span class='erreur'>{$this->empr_msg}</span></div>\n\t\t\t\t\t\t</div><br />";
         $this->fiche_consultation = str_replace('!!empr_msg!!', $message_fiche_empr, $this->fiche_consultation);
     } else {
         $this->fiche_consultation = str_replace('!!empr_msg!!', "", $this->fiche_consultation);
     }
     $fsexe[0] = $msg[128];
     $fsexe[1] = $msg[126];
     $fsexe[2] = $msg[127];
     $this->fiche_consultation = str_replace('!!sexe!!', $fsexe[$this->sexe], $this->fiche_consultation);
 }