示例#1
0
function do_retour($stuff, $confirmed = 1)
{
    global $dbh;
    global $msg;
    global $alert_sound_list, $pmb_play_pret_sound;
    global $pmb_gestion_amende, $pmb_gestion_financiere, $pmb_blocage_retard, $pmb_blocage_max, $pmb_blocage_delai, $pmb_blocage_coef;
    global $deflt_docs_location;
    $erreur_affichage = '';
    if (!is_object($stuff)) {
        die("erreur dans le module ./circ/retour.inc [do_retour()]. Contactez l'admin");
    }
    // récupération localisation exemplaire
    $query = "SELECT t.tdoc_libelle as type_doc";
    $query .= ", l.location_libelle as location";
    $query .= ", s.section_libelle as section";
    $query .= " FROM docs_type t";
    $query .= ", docs_location l";
    $query .= ", docs_section s";
    $query .= " WHERE t.idtyp_doc=" . $stuff->expl_typdoc;
    $query .= " AND l.idlocation=" . $stuff->expl_location;
    $query .= " AND s.idsection=" . $stuff->expl_section;
    $query .= " LIMIT 1";
    $result = mysql_query($query, $dbh);
    $info_doc = mysql_fetch_object($result);
    print pmb_bidi("<br /><form><div class='row'><div class='left'><strong>" . $stuff->libelle . "</strong></div>");
    // flag confirm retour
    if (!$confirmed and $stuff->pret_idempr) {
        print "\n\t\t\t<div class='right'>\n\t\t\t<input type='button' class='bouton' \n\t\t\t\t\tname='confirm_ret' value='" . $msg['retour_confirm'] . "'\n\t\t\t\t\tonClick=\"document.location='./circ.php?categ=retour&cb_expl=" . $stuff->expl_cb . "'\">\n\t\t\t</div>";
    } elseif ($stuff->pret_idempr) {
        print "\n\t\t\t\t<div class='right'>\n\t\t\t\t\t<font color='RED'><b>{$msg['retour_ok']}</b></font>\n\t\t\t\t</div>";
    }
    print "</div>";
    print pmb_bidi("<br /><b>" . $stuff->expl_cb . "</b> " . $info_doc->type_doc);
    print pmb_bidi('.&nbsp;' . $info_doc->location);
    print pmb_bidi('.&nbsp;' . $info_doc->section);
    print pmb_bidi('.&nbsp;' . $stuff->expl_cote);
    print "&nbsp;&nbsp;<input class='bouton' type='button' value=\"" . $msg[375] . "\" onClick=\"document.location='circ.php?categ=visu_ex&form_cb_expl=" . $stuff->expl_cb . "';\" />";
    print "</form>";
    //Champs personalisés
    $p_perso = new parametres_perso("expl");
    $perso_aff = "";
    if (!$p_perso->no_special_fields) {
        $perso_ = $p_perso->show_fields($stuff->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) {
        print "<div class='row'>" . $perso_aff . "</div>";
    }
    $script_magnetique = "\n<script language='javascript' type='text/javascript'>\nvar requete = null;\n\nfunction creerRequette(){\n\tif(window.XMLHttpRequest) // Firefox\n\t\trequete = new XMLHttpRequest();\n\telse if(window.ActiveXObject) // Internet Explorer\n  \t\trequete = new ActiveXObject('Microsoft.XMLHTTP');\n\telse { // XMLHttpRequest non supporté par le navigateur\n   \t\talert('Votre navigateur ne supporte pas les objets XMLHTTPRequest...');\n    \treturn;\n\t}\n}\n\nfunction magnetise(commande){\n\tcreerRequette();\n\tif(netscape.security.PrivilegeManager)netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');\t\n\trequete.open('GET', 'http://localhost:30000/?send_value='+commande+'&command=Send', false);\n\trequete.send(null);\n\tif(requete.readyState != 4) alert('Requête antivol non effectuée !');\n}\n\n";
    global $pmb_antivol;
    if ($pmb_antivol > 0) {
        if ($stuff->type_antivol == 1) {
            // c'est un support non magnétique (livre, revue...)
            print "{$script_magnetique}" . "magnetise('RRR');</script>";
        }
        if ($stuff->type_antivol == 2) {
            //c'est un support magnétique (cassette)
            print "{$script_magnetique}" . "magnetise('SSS');</script>";
        }
    }
    //si le retour se passe sur un site différent de ce lui de l'exemplaire
    global $pmb_transferts_actif;
    $transfert_mauvais_site = false;
    if ($stuff->expl_location != $deflt_docs_location) {
        $alert_sound_list[] = "critique";
        $html_erreur_site = "<hr /><div class='erreur'>";
        //on agit pour faire l'action par defaut
        //et que c'est un retour d'emprunt
        if ($pmb_transferts_actif && $stuff->pret_idempr) {
            global $transferts_retour_action_defaut;
            global $transferts_retour_action_autorise_autre;
            $trans = new transfert();
            //pour afficher le site de l'exemplaire
            $rqtSite = "SELECT location_libelle FROM docs_location WHERE idlocation=" . $stuff->expl_location;
            $resSite = mysql_result(mysql_query($rqtSite), 0);
            //si on propose une autre action
            if ($transferts_retour_action_autorise_autre == "1") {
                $texte_change_loc = str_replace("!!lbl_site!!", $resSite, $msg["transferts_circ_retour_lbl_change_localisation"]);
            }
            $texte_change_loc = str_replace("!!liste_sections!!", "<select onchange='enregLoc(this)'>!!liste!!</select>", $texte_change_loc);
            //on genere la liste des sections
            $rqt = "SELECT idsection, section_libelle FROM docs_section ORDER BY section_libelle";
            $res_section = mysql_query($rqt);
            $liste_section = "";
            while ($value = mysql_fetch_object($res_section)) {
                $liste_section .= "<option value='" . $value->idsection . "'";
                if ($value->idsection == $stuff->expl_section) {
                    $liste_section .= " selected";
                    $expl_section_libelle = $value->section_libelle;
                }
                $liste_section .= ">" . $value->section_libelle . "</option>";
            }
            $texte_change_loc = addslashes(str_replace("!!liste!!", $liste_section, $texte_change_loc));
            $html_erreur_site .= "\n<form name='actionTrans'>\n<input type='hidden' name='typeTrans' value='" . $transferts_retour_action_defaut . "'>\n<input type='hidden' name='explTrans' value='" . $stuff->expl_id . "'>\n<script language='javascript'>\nmsg_inf_loc = '" . $texte_change_loc . "';\nmsg_bt_loc = '" . str_replace("'", "\\'", $msg["transferts_circ_retour_bt_retour_mauvaise_localisation"]) . "';\nmsg_inf_trans = '" . str_replace("'", "\\'", str_replace("!!lbl_site!!", $resSite, $msg["transferts_circ_retour_lbl_transfert"])) . "';\nmsg_bt_trans = '" . str_replace("'", "\\'", $msg["transferts_circ_retour_bt_changement_localisation"]) . "';\n\nfunction changeAction() {\n\n\tvar actionTrans = new http_request();\n\tvar url= './ajax.php?module=circ&categ=transferts&idexpl=' + document.actionTrans.explTrans.value + '&action=';\n\t\t\t\t\n\tswitch (document.actionTrans.typeTrans.value) {\n\t\tcase '0':\n\t\t\t//il y a eu un changement localisation\n\t\t\t//on propose un transfert\n\t\t\tif (confirm('" . addslashes($msg["transferts_circ_retour_confirm_gen_transfert"]) . "')) {\n\n\t\t\t\turl = url + 'gen_transfert&param=' + document.actionTrans.paramTrans.value ;\n\t\t\t\n\t\t\t\tif (actionTrans.request(url)) {\n\t\t\t\t\t// Il y a une erreur. Afficher le message retourné\n\t\t\t\t\talert ( '" . addslashes($msg["540"]) . " : ' + actionTrans.get_text() );\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t//tout c'est bien passe\n\t\t\t\t\t\n\t\t\t\t\t//on recupere les infos\n\t\t\t\t\tdocument.actionTrans.typeTrans.value = '1';\n\t\t\t\t\tdocument.actionTrans.paramTrans.value = actionTrans.get_text();\n\t\t\t\t\t\n\t\t\t\t\t//on change les textes\n\t\t\t\t\tdocument.actionTrans.btActionTrans.value = msg_bt_trans;\n\t\t\t\t\tdocument.getElementById('libInfoTransfert').innerHTML = msg_inf_trans; \n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t\t}//if confirm\n\t\t\t\n\t\t\t\n\t\t\tbreak;\n\t\n\t\tcase '1':\n\t\t\t//il y a eu un transfert\n\t\t\t//on propose un changement de localisation\n\t\t\tif (confirm('" . addslashes($msg["transferts_circ_retour_confirm_change_loc"]) . "')) {\n\n\t\t\t\turl = url + 'change_loc&param=' + document.actionTrans.paramTrans.value ;\n\t\t\t\n\t\t\t\tif (actionTrans.request(url)) {\n\t\t\t\t\t// Il y a une erreur. Afficher le message retourné\n\t\t\t\t\talert ( '" . addslashes($msg["540"]) . " : ' + actionTrans.get_text() );\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t//tout c'est bien passe\n\t\t\t\t\t\n\t\t\t\t\t//on recupere les infos\n\t\t\t\t\tdocument.actionTrans.typeTrans.value = '0';\n\t\t\t\t\tdocument.actionTrans.paramTrans.value = actionTrans.get_text();\n\t\t\t\t\t\n\t\t\t\t\t//on change les textes\n\t\t\t\t\tdocument.actionTrans.btActionTrans.value = msg_bt_loc;\n\t\t\t\t\tdocument.getElementById('libInfoTransfert').innerHTML = msg_inf_loc; \n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t\t} //if confirm\n\t\t\tbreak;\n\t} //switch\n\t\t\n}\n\nfunction enregLoc(obj) {\n\tval = obj.options[obj.selectedIndex].value;\n\t\n\tvar actionTrans = new http_request();\n\tvar url= './ajax.php?module=circ&categ=transferts&idexpl=' + document.actionTrans.explTrans.value + '&action=change_section&param='+val;\n\t\n\tif (actionTrans.request(url)) {\n\t\t// Il y a une erreur. Afficher le message retourné\n\t\talert ( '" . addslashes($msg["540"]) . " : ' + actionTrans.get_text() );\t\t\t\n\t}\n}\n</script>";
            if ($stuff->resa_idempr) {
                // le doc en retour peut servir à valider une résa suivante
                if (!verif_cb_utilise($stuff->expl_cb)) {
                    $affect = affecte_cb($stuff->expl_cb);
                }
            }
            if (!$affect) {
                switch ($transferts_retour_action_defaut) {
                    case "0":
                        //change la localisation d'origine
                        $param = $trans->retour_exemplaire_change_localisation($stuff->expl_id);
                        //le message a l'ecran
                        $html_erreur_site .= "<div id='libInfoTransfert'>" . str_replace("!!lbl_site!!", $resSite, $msg["transferts_circ_retour_lbl_change_localisation"]) . "</div>";
                        if ($transferts_retour_action_autorise_autre == "1") {
                            //on propose de générer le transfert
                            $html_erreur_site .= "&nbsp;<input class='bouton' name='btActionTrans' type='button' value=\"" . $msg["transferts_circ_retour_bt_retour_mauvaise_localisation"] . "\" " . " onclick=\"changeAction();\"" . ">";
                        }
                        break;
                    case "1":
                        //genere le transfert automatique de l'exemplaire
                        $param = $trans->retour_exemplaire_genere_transfert_retour($stuff->expl_id);
                        //le message a l'ecran
                        $html_erreur_site .= "<div id='libInfoTransfert'>" . $msg["transferts_circ_retour_lbl_transfert"] . "</div>";
                        if ($transferts_retour_action_autorise_autre == "1") {
                            //on propose de changer la localisation
                            $html_erreur_site .= "&nbsp;<input class='bouton' name='btActionTrans' type='button' value=\"" . $msg["transferts_circ_retour_bt_changement_localisation"] . "\" " . " onclick=\"changeAction();\"" . ">";
                        }
                        break;
                }
                //switch
            }
            if ($transferts_retour_action_autorise_autre == "1") {
                $html_erreur_site .= "<input type='hidden' name='paramTrans' value='" . $param . "'></form>";
            }
            $html_erreur_site = str_replace("!!lbl_site!!", $resSite, $html_erreur_site);
            $html_erreur_site = str_replace("!!liste_sections!!", $expl_section_libelle, $html_erreur_site);
            $transfert_mauvais_site = true;
        } else {
            //if (($pmb_transferts_actif)&&($stuff->pret_idempr))
            //le message à l'écran
            $html_erreur_site .= $msg[expl_retour_bad_location];
        }
        $html_erreur_site .= "</div>";
        print pmb_bidi($html_erreur_site);
        // fin de if ($stuff->expl_location != $deflt_docs_location)
    }
    if ($stuff->expl_note) {
        $alert_sound_list[] = "critique";
        print pmb_bidi("<hr /><div class='erreur'>{$msg[377]} :</div><div class='message_important'>" . $stuff->expl_note . "</div>");
    } elseif ($pmb_play_pret_sound) {
        $alert_sound_list[] = "information";
    }
    // zone du dernier emrunteur
    if ($stuff->expl_lastempr) {
        $dernier_empr = "<hr /><div class='row'>{$msg['expl_prev_empr']} ";
        $link = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($stuff->lastempr_cb) . "'>";
        $dernier_empr .= $link . $stuff->lastempr_prenom . ' ' . $stuff->lastempr_nom . ' (' . $stuff->lastempr_cb . ')</a>';
        $dernier_empr .= "</div><hr />";
    }
    if ($stuff->pret_idempr) {
        // l'exemplaire était effectivement emprunté
        // calcul du retard éventuel
        $rqt_date = "select ((TO_DAYS(CURDATE()) - TO_DAYS('{$stuff->pret_retour}'))) as retard ";
        $resultatdate = mysql_query($rqt_date);
        $resdate = mysql_fetch_object($resultatdate);
        $retard = $resdate->retard;
        if ($retard > 0) {
            //Calcul du vrai nombre de jours
            $date_debut = explode("-", $stuff->pret_retour);
            $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
            if ($ndays > 0) {
                $retard = (int) $ndays;
                print "<br /><div class='erreur'>" . $msg[369] . "&nbsp;: " . $retard . " " . $msg[370] . "</div>";
                $alert_sound_list[] = "critique";
            }
        }
        //Calcul du blocage
        if ($pmb_blocage_retard) {
            $date_debut = explode("-", $stuff->pret_retour);
            $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
            if ($ndays > $pmb_blocage_delai) {
                $ndays = $ndays * $pmb_blocage_coef;
                if ($ndays > $pmb_blocage_max && $pmb_blocage_max != 0) {
                    $ndays = $pmb_blocage_max;
                }
            } else {
                $ndays = 0;
            }
            if ($ndays > 0) {
                //Le lecteur est-il déjà bloqué ?
                $date_fin_blocage_empr = mysql_result(mysql_query("select date_fin_blocage from empr where id_empr='" . $stuff->pret_idempr . "'"), 0, 0);
                //Calcul de la date de fin
                $date_fin = calendar::add_days(date("d"), date("m"), date("Y"), $ndays);
                if ($date_fin > $date_fin_blocage_empr) {
                    //Mise à jour
                    mysql_query("update empr set date_fin_blocage='" . $date_fin . "' where id_empr='" . $stuff->pret_idempr . "'");
                    print "<br /><div class='erreur'>" . sprintf($msg["blocage_retard_pret"], formatdate($date_fin)) . "</div>";
                    $alertsound_list[] = "critique";
                } else {
                    print "<br /><div class='erreur'>" . sprintf($msg["blocage_already_retard_pret"], formatdate($date_fin_blocage_empr)) . "</div>";
                    $alertsound_list[] = "critique";
                }
            }
        }
        //Vérification des amendes
        if ($pmb_gestion_financiere && $pmb_gestion_amende) {
            $amende = new amende($stuff->pret_idempr);
            $amende_t = $amende->get_amende($stuff->pret_idexpl);
            //Si il y a une amende, je la débite
            if ($amende_t["valeur"]) {
                print pmb_bidi("<br /><div class='erreur'>" . $msg["finance_retour_amende"] . "&nbsp;: " . comptes::format($amende_t["valeur"]));
                $alert_sound_list[] = "critique";
                $compte_id = comptes::get_compte_id_from_empr($stuff->pret_idempr, 2);
                if ($compte_id) {
                    $cpte = new comptes($compte_id);
                    if ($cpte->id_compte) {
                        $cpte->record_transaction("", $amende_t["valeur"], -1, sprintf($msg["finance_retour_amende_expl"], $stuff->pret_idexpl), 0);
                        print " " . $msg["finance_retour_amende_recorded"];
                    }
                }
                print "</div>";
            }
        }
        // zone du dernier emrunteur
        print pmb_bidi($dernier_empr);
        // code de suppression prêt et la mise en table de stat
        if ($confirmed) {
            if (del_pret($stuff)) {
                if (!maj_stat_pret($stuff)) {
                    // impossible de maj en table stat
                    print "<div class='erreur'>{$msg[371]}</div>";
                }
            } else {
                // impossible de supprimer en table pret
                print "<div class='erreur'>{$msg[372]}</div>";
            }
            // traitement de l'éventuelle réservation
            if ($stuff->resa_idempr) {
                // le doc en retour peut servir à valider une résa suivante
                if (!verif_cb_utilise($stuff->expl_cb) || $affect) {
                    if (!$affect) {
                        $affect = affecte_cb($stuff->expl_cb);
                    }
                    // affichage message de réservation
                    if ($affect) {
                        $trans_en_cours = false;
                        $msg_trans = "";
                        if ($pmb_transferts_actif == "1" && !$transfert_mauvais_site) {
                            //si le transfert est actif et qu'un transfert n'est pas deja fait
                            $res_transfert = resa_transfert($affect, $stuff->expl_cb);
                            if ($res_transfert != 0) {
                                $rqt = "SELECT location_libelle FROM docs_location WHERE idlocation=" . $res_transfert;
                                $lib_loc = mysql_result(mysql_query($rqt), 0);
                                $msg_trans = "<strong>" . str_replace("!!site_dest!!", $lib_loc, $msg["transferts_circ_resa_validation_alerte"]) . "</strong><br />";
                                $trans_en_cours = true;
                            }
                        }
                        $query = "select distinct ";
                        $query .= "empr_prenom, empr_nom, empr_cb ";
                        $query .= "from (((resa LEFT JOIN notices AS notices_m ON resa_idnotice = notices_m.notice_id ) LEFT JOIN bulletins ON resa_idbulletin = bulletins.bulletin_id) LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), empr ";
                        $query .= "where id_resa in (" . $affect . ") and resa_idempr=id_empr";
                        $result = mysql_query($query, $dbh);
                        $empr = @mysql_fetch_object($result);
                        print pmb_bidi("<div class='message_important'>{$msg['352']}</div>\n\t\t\t\t\t\t\t<div class='row'>{$msg_trans}\n\t\t\t\t\t\t\t{$msg[373]}\n\t\t\t\t\t\t\t<strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode($empr->empr_cb) . "'>" . $empr->empr_prenom . "&nbsp;" . $empr->empr_nom . "</a></strong>\n\t\t\t\t\t\t\t&nbsp;({$empr->empr_cb} )\n\t\t\t\t\t\t\t</div>");
                        $alert_sound_list[] = "critique";
                        if (!$trans_en_cours) {
                            alert_empr_resa($affect);
                        }
                    }
                    // fin if affect
                }
                // fin if !verif_cb_utilise
            }
            // fin if resa
        }
        // fin confirmed
        $empr = new emprunteur($stuff->pret_idempr, $erreur_affichage, FALSE, 2);
        print pmb_bidi($empr->fiche_affichage);
    } else {
        print "<div class='erreur'>{$msg[605]}</div>";
        $alert_sound_list[] = "critique";
    }
    // show_report($stuff); // this stands for debugging
}
function extrait_info_empr($sql = "", $entete = 1, $flag = "")
{
    global $dbh;
    global $dest;
    global $worksheet;
    global $entete_bloc;
    global $msg;
    global $charset;
    global $debligne_excel;
    global $etat_table;
    // permet de savoir si les tag table sont ouverts ou fermés
    global $max_perso;
    global $res_compte1;
    if (!$debligne_excel) {
        $debligne_excel = 0;
    }
    $res = @pmb_mysql_query($sql, $dbh);
    $nbr_lignes = @pmb_mysql_num_rows($res);
    $nbr_champs = @pmb_mysql_num_fields($res);
    if ($nbr_lignes) {
        switch ($dest) {
            case "TABLEAU":
                if ($entete) {
                    $worksheet->write_string(1 + $debligne_excel, 0, $msg["caddie_mess_edition_" . $entete_bloc]);
                    $debligne_excel++;
                }
                for ($i = 0; $i < $nbr_champs; $i++) {
                    // entête de colonnes
                    $fieldname = pmb_mysql_field_name($res, $i);
                    if ($entete) {
                        $worksheet->write_string(1 + $debligne_excel, 0, $msg['caddie_action_marque']);
                        $worksheet->write_string(1 + $debligne_excel, $i + 1, ${fieldname});
                    }
                }
                if ($entete) {
                    $worksheet->write_string(1 + $debligne_excel, $nbr_champs + 1, "DESCR");
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = pmb_mysql_fetch_object($res_compte1);
                        $worksheet->write_string(1 + $debligne_excel, $nbr_champs + 2 + $i, $perso->titre);
                    }
                }
                if ($entete) {
                    $debligne_excel++;
                }
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $debligne_excel++;
                    $row = pmb_mysql_fetch_row($res);
                    $id_notice = $row[0];
                    if ($flag) {
                        $worksheet->write_string($i + $debligne_excel, 0, "X");
                    }
                    $j = 0;
                    foreach ($row as $dummykey => $col) {
                        if (!$col) {
                            $col = " ";
                        }
                        $worksheet->write_string($i + $debligne_excel, $j + 1, $col);
                        $j++;
                    }
                    $p_perso = new parametres_perso("empr");
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            $worksheet->write_string($debligne_excel, $nbr_champs + 2 + $i, html_entity_decode($p["AFF"], ENT_QUOTES | ENT_COMPAT, $charset));
                        }
                    }
                }
                break;
            case "TABLEAUHTML":
                if ($entete) {
                    if ($etat_table) {
                        echo "\n</table>";
                    }
                    echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>";
                    echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>";
                    $etat_table = 1;
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        $fieldname = pmb_mysql_field_name($res, $i);
                        print "<th align='left'>{$fieldname}</th>";
                    }
                    print "<th align='left'>DESCR</th>";
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = pmb_mysql_fetch_object($res_compte1);
                        print "<th align='left'>" . $perso->titre . "</th>";
                    }
                }
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $row = pmb_mysql_fetch_row($res);
                    $id_notice = $row[0];
                    echo "<tr>";
                    if ($flag) {
                        print "<td>X</td>";
                    } else {
                        print "<td>&nbsp;</td>";
                    }
                    foreach ($row as $dummykey => $col) {
                        if (is_numeric($col)) {
                            $col = "'" . $col;
                        }
                        if (!$col) {
                            $col = "&nbsp;";
                        }
                        print pmb_bidi("<td>{$col}</td>");
                    }
                    print "<td>&nbsp;</td>";
                    $p_perso = new parametres_perso("empr");
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            print "<td>" . $p["AFF"] . "</td>";
                        }
                    }
                    echo "</tr>";
                }
                break;
            default:
                if ($entete) {
                    if ($etat_table) {
                        echo "\n</table>";
                    }
                    echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>";
                    echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>";
                    $etat_table = 1;
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        $fieldname = pmb_mysql_field_name($res, $i);
                        print "<th align='left'>{$fieldname}</th>";
                    }
                    print "<th align='left'>DESCR</th>";
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = pmb_mysql_fetch_object($res_compte1);
                        print "<th align='left'>" . $perso->titre . "</th>";
                    }
                }
                $odd_even = 0;
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $row = pmb_mysql_fetch_row($res);
                    $id_notice = $row[0];
                    if ($odd_even == 0) {
                        echo "\t<tr class='odd'>";
                        $odd_even = 1;
                    } else {
                        if ($odd_even == 1) {
                            echo "\t<tr class='even'>";
                            $odd_even = 0;
                        }
                    }
                    if ($flag) {
                        print "<td>X</td>";
                    } else {
                        print "<td>&nbsp;</td>";
                    }
                    foreach ($row as $dummykey => $col) {
                        if (!$col) {
                            $col = "&nbsp;";
                        }
                        print pmb_bidi("<td>{$col}</td>");
                    }
                    print "<td>&nbsp;</td>";
                    $p_perso = new parametres_perso("empr");
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            print "<td>" . $p["AFF"] . "</td>";
                        }
                    }
                    echo "</tr>";
                }
                break;
        }
        // fin switch
    }
    // fin if nbr_lignes
}
示例#3
0
 function show_consult_form($last_modified = 0)
 {
     global $idetat, $iduser, $idempr, $user_input;
     global $date_debut, $date_fin, $id_type, $id_theme, $dmde_loc;
     global $form_consult_dmde, $charset, $msg, $dbh, $demandes_init_workflow, $form_consult_linked_record;
     global $pmb_type_audit, $opac_demandes_no_action, $opac_demandes_allow_from_record;
     $form_consult_dmde = str_replace('!!form_title!!', htmlentities($this->titre_demande, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!sujet_dmde!!', htmlentities($this->sujet_demande, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!etat_dmde!!', htmlentities($this->workflow->getStateCommentById($this->etat_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_dmde!!', htmlentities(formatdate($this->date_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_butoir_dmde!!', htmlentities(formatdate($this->deadline_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_prevue_dmde!!', htmlentities(formatdate($this->date_prevue), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!progression_dmde!!', htmlentities($this->progression . '%', ENT_QUOTES, $charset), $form_consult_dmde);
     for ($i = 0; $i < sizeof($this->users); $i++) {
         if ($i == sizeof($this->users) - 1) {
             $users .= htmlentities($this->users[$i]['nom'], ENT_QUOTES, $charset);
         } else {
             $users .= htmlentities($this->users[$i]['nom'], ENT_QUOTES, $charset) . " / ";
         }
     }
     $carac_empr = $this->getCaracEmpr($this->num_demandeur);
     $nom = $carac_empr['nom'];
     $cb = $carac_empr['empr_cb'];
     $nom_emprunteur = "";
     if (SESSrights & CIRCULATION_AUTH) {
         $nom_emprunteur = "<a href=\"circ.php?categ=pret&form_cb={$cb}\" >" . htmlentities($nom, ENT_QUOTES, $charset) . "</a>";
     }
     $form_consult_dmde = str_replace('!!demandeur!!', $nom_emprunteur ? $nom_emprunteur : $nom, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!attribution!!', $users, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!iddemande!!', $this->id_demande, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!theme_dmde!!', htmlentities($this->theme_libelle, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!type_dmde!!', htmlentities($this->type_libelle, ENT_QUOTES, $charset), $form_consult_dmde);
     if ($opac_demandes_allow_from_record && $this->num_linked_notice) {
         $record_datas = record_display::get_record_datas($this->num_linked_notice);
         $form_consult_dmde = str_replace('!!form_linked_record!!', $form_consult_linked_record, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record!!', htmlentities($record_datas->get_tit1(), ENT_QUOTES, $charset), $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record_id!!', htmlentities($this->num_linked_notice, ENT_QUOTES, $charset), $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record_link!!', htmlentities($record_datas->get_permalink(), ENT_QUOTES, $charset), $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!form_linked_record!!', "", $form_consult_dmde);
     }
     //Champs personalisés
     $perso_aff = "";
     $p_perso = new parametres_perso("demandes");
     if (!$p_perso->no_special_fields) {
         $perso_ = $p_perso->show_fields($this->id_demande);
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             if ($p["AFF"] && $p["OPAC_SHOW"]) {
                 $perso_aff .= "<br />" . $p["TITRE"] . " " . nl2br($p["AFF"]);
             }
         }
     }
     if ($perso_aff) {
         $form_consult_dmde = str_replace("!!champs_perso!!", $perso_aff, $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace("!!champs_perso!!", "", $form_consult_dmde);
     }
     if (self::is_notice_visible($this)) {
         $link_noti = "<a href='" . $opac_url_base . "index.php?lvl=notice_display&id=" . $this->num_notice . "' alt='" . $msg['demandes_see_notice'] . "' title='" . $msg['demandes_see_notice'] . "'><img src='{$base_path}/images/mois.gif' /></a>";
     } else {
         $link_noti = "";
     }
     $form_consult_dmde = str_replace('!!icone!!', $link_noti, $form_consult_dmde);
     //construction de l'url de retour
     $params_retour = '';
     if ($idetat) {
         $params_retour .= "&idetat=" . $idetat;
     }
     // 		if($iduser){
     // 			$params_retour.="&iduser="******"&idempr=".$idempr;
     // 		}
     if ($user_input) {
         $params_retour .= "&user_input=" . $user_input;
     }
     if ($date_debut) {
         $params_retour .= "&date_debut=" . $date_debut;
     }
     if ($date_fin) {
         $params_retour .= "&date_fin=" . $date_fin;
     }
     if ($id_type) {
         $params_retour .= "&id_type=" . $id_type;
     }
     if ($id_theme) {
         $params_retour .= "&id_theme=" . $id_theme;
     }
     if ($dmde_loc) {
         $params_retour .= "&dmde_loc=" . $dmde_loc;
     }
     if ($params_retour) {
         $form_consult_dmde = str_replace('!!params_retour!!', htmlentities(stripslashes($params_retour), ENT_QUOTES, $charset), $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!params_retour!!', "", $form_consult_dmde);
     }
     if (sizeof($this->users) && $demandes_init_workflow !== "2" && !$opac_demandes_no_action) {
         $listActionButton = '&nbsp;' . $msg['demandes_action_type_add'] . '&nbsp;';
         if (sizeof($this->allowed_actions)) {
             foreach ($this->allowed_actions as $key => $actionType) {
                 if ($actionType['active'] == 1) {
                     $listActionButton .= "<input type='button' class='bouton' value='" . htmlentities($actionType['comment'], ENT_QUOTES, $charset) . "' onClick=\"document.location='./empr.php?tab=request&lvl=list_dmde&sub=add_action&type_action=" . $actionType['id'] . "&iddemande={$this->id_demande}'\" />";
                 }
             }
         }
         if ($listActionButton) {
             $form_consult_dmde = str_replace('!!add_actions_list!!', $listActionButton, $form_consult_dmde);
         } else {
             $form_consult_dmde = str_replace('!!add_actions_list!!', "", $form_consult_dmde);
         }
     } else {
         $form_consult_dmde = str_replace('!!add_actions_list!!', "", $form_consult_dmde);
     }
     $modify_button = "";
     foreach ($this->workflow->object_states_by_id as $key => $value) {
         //id d'etat de demande par défaut
         if ($this->workflow->object_workflow['STARTSTATE'][0]['value'] == $value && $key == $this->etat_demande) {
             $modify_button = "<input type='button' class='bouton' value='" . $msg['demandes_modify'] . "' onClick=\"document.location='./empr.php?tab=request&lvl=list_dmde&sub=add_demande&iddemande={$this->id_demande}'\" />";
         }
     }
     $form_consult_dmde = str_replace('!!demande_modify!!', $modify_button, $form_consult_dmde);
     if (sizeof($this->users) && $demandes_init_workflow !== "2") {
         //Liste des actions
         $this->fetch_data($this->id_demande, false);
         if ($this->etat_demande == 4 || $this->etat_demande == 5) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande);
         } elseif ($last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $last_modified);
         } elseif ($this->last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $this->last_modified->id_action);
         } else {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande);
         }
     }
     if ($this->etat_demande == 1 && !sizeof($this->actions) && $this->dmde_read_opac == 1) {
         demandes::demande_read($this->id_demande, true, "_opac");
         $this->fetch_data($this->id_demande, false);
     }
     print $form_consult_dmde;
 }
示例#4
0
 function fetch_empr($empr_cb = '', $empr_id = '')
 {
     global $dbh;
     global $msg;
     global $charset;
     $result = array('empr_id' => 0, 'empr_cb' => "", 'nom' => "", 'prenom' => "", 'sexe' => 0, 'birth' => "", 'adr1' => "", 'adr2' => "", 'cp' => "", 'ville' => "", 'pays' => "", 'mail' => "", 'tel1' => "", 'sms' => 0, 'tel2' => "", 'prof' => "", 'categ' => "", 'cat_l' => "", 'cstat' => "", 'cstat_l' => "", 'cdate' => "", 'mdate' => "", 'login' => "", 'pwd' => "", 'type_abt' => 0, 'location' => 0, 'location_l' => "", 'date_blocage' => "", 'statut' => 0, 'statut_libelle' => "", 'total_loans' => 0, 'allow_loan' => 0, 'allow_book' => 0, 'allow_opac' => 0, 'allow_dsi' => 0, 'allow_dsi_priv' => 0, 'allow_sugg' => 0, 'allow_prol' => 0, 'date_adhesion' => "", 'date_expiration' => "", 'last_loan_date' => "", 'nb_pret' => 0, 'msg' => "", 'ldap' => 0, 'pperso_list' => array(), 'groupe_list' => array(), 'prets' => array(), 'reservations' => array(), 'nb_retard' => 0, 'nb_resa' => 0, 'nb_previsions' => 0);
     $empr_cb = $this->clean_field($empr_cb);
     $empr_id += 0;
     if (!$empr_id && $empr_cb == '') {
         return $this->build_ok($result, "idempr et empr_cb vide.", false);
     }
     if ($empr_id) {
         $where = " id_empr = {$empr_id} ";
     } else {
         $where = " empr_cb = '" . addslashes($empr_cb) . "' ";
     }
     $sql = "SELECT id_empr, empr_cb FROM empr WHERE {$where}";
     $res = pmb_mysql_query($sql);
     if (!$res || !pmb_mysql_num_rows($res)) {
         return $this->build_ok($result, "Lecteur inconnu.", false);
     }
     $empr_res = pmb_mysql_fetch_object($res);
     $empr_id = $empr_res->id_empr;
     $empr = new emprunteur($empr_id, '', false, 1);
     if (!$empr->cb) {
         return $this->build_ok($result, "Lecteur inconnu.", false);
     }
     $sql = "select id_groupe, libelle_groupe from groupe, empr_groupe where empr_id='" . $empr_id . "' and id_groupe=groupe_id order by libelle_groupe";
     $res = pmb_mysql_query($sql);
     $i = 0;
     $groupes_infos = array();
     while ($res_info = pmb_mysql_fetch_object($res)) {
         $groupes_infos[$i]['id'] = $res_info->id_groupe;
         $groupes_infos[$i]['libelle'] = $res_info->libelle_groupe;
         $i++;
     }
     $requete_nb_pret = "select count(1) as nb_pret from pret where pret_idempr=" . $empr_id;
     $result_nb_pret = pmb_mysql_query($requete_nb_pret, $dbh);
     $r_nb_pret = pmb_mysql_fetch_object($result_nb_pret);
     $nb_pret = $r_nb_pret->nb_pret;
     $resa_list = array();
     $sql = "SELECT resa_idnotice, resa_idbulletin, resa_date, resa_date_debut, resa_date_fin, resa_cb, resa_confirmee, resa_idempr, ifnull(expl_cote,'') as expl_cote, empr_nom, empr_prenom, empr_cb, location_libelle, resa_loc_retrait, ";
     $sql .= " trim(concat(if(series_m.serie_name <>'', if(notices_m.tnvol <>'', concat(series_m.serie_name,', ',notices_m.tnvol,'. '), concat(series_m.serie_name,'. ')), if(notices_m.tnvol <>'', concat(notices_m.tnvol,'. '),'')), ";
     $sql .= " if(series_s.serie_name <>'', if(notices_s.tnvol <>'', concat(series_s.serie_name,', ',notices_s.tnvol,'. '), series_s.serie_name), if(notices_s.tnvol <>'', concat(notices_s.tnvol,'. '),'')), ";
     $sql .= "\tifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, id_resa, ";
     $sql .= " ifnull(notices_m.typdoc,notices_s.typdoc) as typdoc, ";
     $sql .= " IF(resa_date_fin>=sysdate() or resa_date_fin='0000-00-00',0,1) as perimee, date_format(resa_date_debut, '" . $msg["format_date"] . "') as aff_resa_date_debut, if(resa_date_fin='0000-00-00', '', date_format(resa_date_fin, '" . $msg["format_date"] . "')) as aff_resa_date_fin, date_format(resa_date, '" . $msg["format_date"] . "') as aff_resa_date ";
     $sql .= " FROM ((((resa LEFT JOIN notices AS notices_m ON resa_idnotice = notices_m.notice_id ";
     $sql .= " LEFT JOIN series AS series_m ON notices_m.tparent_id = series_m.serie_id ) ";
     $sql .= " LEFT JOIN bulletins ON resa_idbulletin = bulletins.bulletin_id) ";
     $sql .= " LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id ";
     $sql .= " LEFT JOIN series AS series_s ON notices_s.tparent_id = series_s.serie_id ) ";
     $sql .= " LEFT JOIN exemplaires ON resa_cb = exemplaires.expl_cb), ";
     $sql .= " empr, docs_location ";
     $sql .= " WHERE resa_idempr = id_empr AND idlocation = empr_location  AND id_empr='{$empr_id}'";
     $res = pmb_mysql_query($sql);
     while ($res_info = pmb_mysql_fetch_object($res)) {
         $resa["title"] = $res_info->tit;
         $resa["typdoc"] = $res_info->typdoc;
         $resa["date"] = $res_info->aff_resa_date;
         $resa["date_debut"] = $res_info->aff_resa_date_debut;
         $resa["date_fin"] = $res_info->aff_resa_date_fin;
         $resa["cb"] = $res_info->resa_cb;
         $resa["confirmee"] = $res_info->resa_confirmee;
         $resa["perimee"] = $res_info->perimee;
         $resa["id"] = $res_info->id_resa;
         $resa_list[] = $resa;
     }
     $p_perso = new parametres_perso("empr");
     $perso_ = $p_perso->show_fields($empr_id);
     $pperso_list = array();
     if (count($perso_)) {
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             $pperso_list[$i]["id"] = $p["ID"];
             $pperso_list[$i]["name"] = $p["NAME"];
             $pperso_list[$i]["libelle"] = $p["TITRE"];
             $pperso_list[$i]["aff"] = $p["AFF"];
         }
     }
     $result = array('empr_id' => $empr_id, 'empr_cb' => $empr->cb, 'nom' => $empr->nom, 'prenom' => $empr->prenom, 'sexe' => $empr->sexe, 'birth' => $empr->birth, 'adr1' => $empr->adr1, 'adr2' => $empr->adr2, 'cp' => $empr->cp, 'ville' => $empr->ville, 'pays' => $empr->pays, 'mail' => $empr->mail, 'tel1' => $empr->tel1, 'sms' => $empr->sms, 'tel2' => $empr->tel2, 'prof' => $empr->prof, 'categ' => $empr->categ, 'cat_l' => $empr->cat_l, 'cstat' => $empr->cstat, 'cstat_l' => $empr->cstat_l, 'cdate' => $empr->cdate, 'mdate' => $empr->mdate, 'login' => $empr->login, 'pwd' => $empr->pwd, 'type_abt' => $empr->type_abt, 'location' => $empr->empr_location, 'location_l' => $empr->empr_location_l, 'date_blocage' => $empr->date_blocage, 'statut' => $empr->empr_statut, 'statut_libelle' => $empr->empr_statut_libelle, 'total_loans' => $empr->total_loans, 'allow_loan' => $empr->allow_loan, 'allow_book' => $empr->allow_book, 'allow_opac' => $empr->allow_opac, 'allow_dsi' => $empr->allow_dsi, 'allow_dsi_priv' => $empr->allow_dsi_priv, 'allow_sugg' => $empr->allow_sugg, 'allow_prol' => $empr->allow_prol, 'date_adhesion' => $empr->date_adhesion, 'date_expiration' => $empr->date_expiration, 'last_loan_date' => $empr->last_loan_date, 'nb_pret' => $nb_pret, 'msg' => $empr->empr_msg, 'ldap' => $empr->empr_ldap, 'pperso_list' => $pperso_list, 'groupe_list' => $groupes_infos, 'prets' => $empr->prets, 'reservations' => $resa_list, 'nb_retard' => $empr->retard, 'nb_resa' => $empr->nb_reservations, 'nb_previsions' => $empr->nb_previsions);
     return $this->build_ok($result);
 }
示例#5
0
 /**
  * Retourne les paramètres persos
  * @return array
  */
 public function get_p_perso()
 {
     if (!$this->p_perso) {
         global $memo_p_perso_notices;
         $this->p_perso = array();
         if (!$memo_p_perso_notices) {
             $memo_p_perso_notices = new parametres_perso("notices");
         }
         $ppersos = $memo_p_perso_notices->show_fields($this->id);
         // Filtre ceux qui ne sont pas visibles à l'OPAC ou qui n'ont pas de valeur
         foreach ($ppersos['FIELDS'] as $pperso) {
             if ($pperso['OPAC_SHOW'] && $pperso['AFF']) {
                 $this->p_perso[] = $pperso;
             }
         }
     }
     return $this->p_perso;
 }
示例#6
0
 function show_consult_form($last_modified = 0)
 {
     global $idetat, $iduser, $idempr, $user_input;
     global $date_debut, $date_fin, $id_type, $id_theme, $dmde_loc;
     global $form_consult_dmde, $charset, $msg, $dbh, $demandes_init_workflow, $form_consult_linked_record;
     global $pmb_type_audit, $reponse_finale;
     $form_consult_dmde = str_replace('!!form_title!!', htmlentities($this->titre_demande, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!sujet_dmde!!', htmlentities($this->sujet_demande, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!etat_dmde!!', htmlentities($this->workflow->getStateCommentById($this->etat_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_dmde!!', htmlentities(formatdate($this->date_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_butoir_dmde!!', htmlentities(formatdate($this->deadline_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_prevue_dmde!!', htmlentities(formatdate($this->date_prevue), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!progression_dmde!!', htmlentities($this->progression . '%', ENT_QUOTES, $charset), $form_consult_dmde);
     $nom_user = '';
     if (sizeof($this->users)) {
         foreach ($this->users as $id => $user) {
             if ($user['statut'] == 1) {
                 if ($nom_user) {
                     $nom_user .= "/ ";
                 }
                 $nom_user .= $user['nom'];
             }
         }
     }
     $carac_empr = $this->getCaracEmpr($this->num_demandeur);
     $nom = $carac_empr['nom'];
     $cb = $carac_empr['empr_cb'];
     $nom_emprunteur = "";
     if (SESSrights & CIRCULATION_AUTH) {
         $nom_emprunteur = "<a href=\"circ.php?categ=pret&form_cb={$cb}\" >" . htmlentities($nom, ENT_QUOTES, $charset) . "</a>";
     }
     $form_consult_dmde = str_replace('!!demandeur!!', $nom_emprunteur ? $nom_emprunteur : $nom, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!attribution!!', $nom_user, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!iddemande!!', $this->id_demande, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!theme_dmde!!', htmlentities($this->theme_libelle, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!type_dmde!!', htmlentities($this->type_libelle, ENT_QUOTES, $charset), $form_consult_dmde);
     if ($this->num_linked_notice) {
         $display = new mono_display($this->num_linked_notice, 0, '', 0, '', '', '', 0, 0, 0, 0, "", 0, false, true);
         $form_consult_dmde = str_replace('!!form_linked_record!!', $form_consult_linked_record, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record!!', htmlentities($display->result, ENT_QUOTES, $charset), $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record_id!!', htmlentities($this->num_linked_notice, ENT_QUOTES, $charset), $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record_link!!', htmlentities($url_base . "catalog.php?categ=isbd&id=" . $this->num_linked_notice, ENT_QUOTES, $charset), $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!form_linked_record!!', "&nbsp;", $form_consult_dmde);
     }
     //Champs personalisés
     $perso_aff = "";
     $p_perso = new parametres_perso("demandes");
     if (!$p_perso->no_special_fields) {
         $perso_ = $p_perso->show_fields($this->id_demande);
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             if ($p["AFF"]) {
                 $perso_aff .= "<br />" . $p["TITRE"] . " " . nl2br($p["AFF"]);
             }
         }
     }
     if ($perso_aff) {
         $form_consult_dmde = str_replace("!!champs_perso!!", $perso_aff, $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace("!!champs_perso!!", "", $form_consult_dmde);
     }
     //afficher la liste des boutons de changement d'état
     if ($this->etat_demande && sizeof($this->users) || $demandes_init_workflow !== "2") {
         $states = $this->workflow->getStateList($this->etat_demande);
         $states_btn = $this->getDisplayStateBtn($states);
         $form_consult_dmde = str_replace('!!btn_etat!!', $states_btn, $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!btn_etat!!', "", $form_consult_dmde);
     }
     //afficher la liste des boutons de la notice
     if ($this->num_notice != 0) {
         $notice = "<a onclick=\"show_notice('" . $this->num_notice . "')\" href='#'><img border='0' align='top' src='./images/search.gif' alt='" . htmlentities($msg['demandes_see_notice'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['demandes_see_notice'], ENT_QUOTES, $charset) . "' /></a>";
     } else {
         $notice = "";
     }
     $form_consult_dmde = str_replace('!!icone!!', $notice, $form_consult_dmde);
     if (sizeof($this->users) || $demandes_init_workflow !== "2") {
         $req = "select count(1) as nb from demandes join demandes_actions on id_demande=num_demande join explnum_doc_actions on num_action=id_action where id_demande='" . $this->id_demande . "'";
         $res = pmb_mysql_query($req, $dbh);
         $docnum = pmb_mysql_fetch_object($res);
         // bouton doc num
         if ($docnum->nb) {
             $btn_attach = "&nbsp;<input type='submit' class='bouton' value='" . $msg['demandes_attach_docnum'] . "' onClick='this.form.act.value=\"attach\" ; ' />";
         } else {
             $btn_attach = "";
         }
         // boutons notice
         if ($this->num_notice != 0) {
             $btn_notices = "<input type='submit' class='bouton' value='" . $msg['demandes_complete_notice'] . "' onClick='this.form.act.value=\"notice\" ; ' />" . $btn_attach . "&nbsp;<input type='submit' class='bouton' value='" . $msg['demandes_generate_rapport'] . "' onClick='this.form.act.value=\"rapport\" ; ' />";
             $btn_suppr_notice = "<input type='submit' class='bouton' value='" . $msg['demandes_delete_notice'] . "' onClick='this.form.act.value=\"delete_notice\"  ; return confirm_delete(); ' />";
         } else {
             $btn_notices = "<input type='submit' class='bouton' value='" . $msg['demandes_create_notice'] . "' onClick='this.form.act.value=\"create_notice\" ; ' />" . $btn_attach . "&nbsp;<input type='hidden' class='bouton' value='" . $msg['demandes_generate_rapport'] . "' onClick='this.form.act.value=\"rapport\" ; ' />" . $btn_attach . "&nbsp;<input type='submit' class='bouton' value='" . $msg['demandes_generate_rapport'] . "' onClick='this.form.act.value=\"rapport\" ; ' />";
             $btn_suppr_notice = "";
         }
         // bouton audit
         if ($pmb_type_audit) {
             $btn_audit = "&nbsp;<input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=14&object_id={$this->id_demande}', 'audit_popup', 700, 500, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" title=\"" . $msg['audit_button'] . "\" value=\"" . $msg['audit_button'] . "\" />&nbsp;";
         } else {
             $btn_audit = "";
         }
         // affichage des boutons de création de la réponse finale
         $btn_repfinal = $btn_faq = "";
         if ($this->etat_demande == 4) {
             if (!$this->reponse_finale || $this->reponse_finale == '') {
                 $btn_repfinal = "&nbsp;<input type='submit' class='bouton' value='" . $msg['demandes_repfinale_creation'] . "' onclick='this.form.act.value=\"final_response\" ; ' />&nbsp;";
             }
         }
         if ($this->etat_demande == 4) {
             if (!$this->num_faq_question) {
                 $btn_faq = "&nbsp;<input type='button' class='bouton' value='" . $msg['demandes_creation_faq_question'] . "' onclick='document.location=\"./demandes.php?categ=faq&sub=question&action=new&num_demande=" . $this->id_demande . "\" ; ' />&nbsp;";
             } else {
                 $btn_faq = "&nbsp;<input type='button' class='bouton' value='" . $msg['demandes_edit_faq_question'] . "' onclick='document.location=\"./demandes.php?categ=faq&sub=question&action=edit&id=" . $this->num_faq_question . "\" ; ' />&nbsp;";
             }
         }
         $form_consult_dmde = str_replace('!!btns_notice!!', $btn_notices, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_suppr_notice!!', $btn_suppr_notice, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_audit!!', $btn_audit, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_repfinal!!', $btn_repfinal, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_faq!!', $btn_faq, $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!btns_notice!!', "", $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_suppr_notice!!', "", $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_audit!!', "", $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_repfinal!!', $btn_repfinal, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_faq!!', "", $form_consult_dmde);
     }
     //construction de l'url de retour
     $params_retour = '';
     if ($idetat) {
         $params_retour .= "&idetat=" . $idetat;
     }
     if ($iduser) {
         $params_retour .= "&iduser="******"&idempr=" . $idempr;
     }
     if ($user_input) {
         $params_retour .= "&user_input=" . $user_input;
     }
     if ($date_debut) {
         $params_retour .= "&date_debut=" . $date_debut;
     }
     if ($date_fin) {
         $params_retour .= "&date_fin=" . $date_fin;
     }
     if ($id_type) {
         $params_retour .= "&id_type=" . $id_type;
     }
     if ($id_theme) {
         $params_retour .= "&id_theme=" . $id_theme;
     }
     if ($dmde_loc) {
         $params_retour .= "&dmde_loc=" . $dmde_loc;
     }
     if ($params_retour) {
         $form_consult_dmde = str_replace('!!params_retour!!', htmlentities(stripslashes($params_retour), ENT_QUOTES, $charset), $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!params_retour!!', "", $form_consult_dmde);
     }
     if (sizeof($this->users) || $demandes_init_workflow !== "2") {
         //Liste des actions
         $this->fetch_data($this->id_demande, false);
         if ($this->etat_demande == 4 || $this->etat_demande == 5) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande);
         } elseif ($last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $last_modified);
         } elseif ($this->last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $this->last_modified->id_action);
         } elseif ($this->last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $this->last_modified->id_action);
         } else {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande);
         }
     }
     if ($this->etat_demande == 4 && $this->reponse_finale != '') {
         $reponse_finale = str_replace('!!repfinale!!', $this->reponse_finale, $reponse_finale);
         $reponse_finale = str_replace('!!iddemande!!', htmlentities($this->id_demande, ENT_QUOTES, $charset), $reponse_finale);
         $act_form = "./demandes.php?categ=gestion";
         $reponse_finale = str_replace('!!form_action!!', htmlentities($act_form, ENT_QUOTES, $charset), $reponse_finale);
         $form_consult_dmde .= $reponse_finale;
     }
     if ($this->etat_demande == 1 && !sizeof($this->actions) && $this->dmde_read_gestion == 1) {
         demandes::demande_read($this->id_demande, true, "_gestion");
         $this->fetch_data($this->id_demande, false);
     }
     print $form_consult_dmde;
 }
示例#7
0
function extrait_info_notice($sql = "", $entete = 1, $flag = "")
{
    global $dbh;
    global $dest;
    global $worksheet;
    global $myCart;
    global $entete_bloc;
    global $msg;
    global $debligne_excel;
    global $etat_table;
    // permet de savoir si les tag table sont ouverts ou fermés
    global $max_aut;
    // le nombre max de colonnes d'auteurs
    global $thesaurus_mode_pmb;
    global $thesaurus_defaut;
    global $lang;
    global $pmb_keyword_sep;
    global $max_perso;
    global $res_compte3;
    if (!$debligne_excel) {
        $debligne_excel = 0;
    }
    $res = @mysql_query($sql, $dbh);
    $nbr_lignes = @mysql_num_rows($res);
    $nbr_champs = @mysql_num_fields($res);
    if ($nbr_lignes) {
        // Pour les champs personnalisés
        $caddie_type = $myCart->type;
        switch ($caddie_type) {
            case 'EXPL':
                $libelle_caddie_type = "expl";
                break;
            case 'NOTI':
            default:
                $libelle_caddie_type = "notices";
                break;
        }
        switch ($dest) {
            case "TABLEAU":
                if ($entete) {
                    $worksheet->write_string(1 + $debligne_excel, 0, $msg["caddie_mess_edition_" . $entete_bloc]);
                    $debligne_excel++;
                    $worksheet->write_string(1 + $debligne_excel, 0, $msg['caddie_action_marque']);
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        // entête de colonnes
                        $fieldname = mysql_field_name($res, $i);
                        $worksheet->write_string(1 + $debligne_excel, $i + 1, $fieldname);
                    }
                    for ($i = 0; $i < $max_aut; $i++) {
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 1 + $nbr_champs, "aut_entree_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 2 + $nbr_champs, "aut_rejete_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 3 + $nbr_champs, "aut_dates_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 4 + $nbr_champs, "aut_fonction_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 5 + $nbr_champs, "aut_type_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 6 + $nbr_champs, "aut_resp_type_{$i}");
                    }
                    $worksheet->write_string(1 + $debligne_excel, $max_aut * 6 + $nbr_champs + 1, "DESCR");
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = mysql_fetch_object($res_compte3);
                        $worksheet->write_string(1 + $debligne_excel, $max_aut * 6 + $nbr_champs + 2 + $i, $perso->titre);
                    }
                    $debligne_excel++;
                }
                //Fonctions d'auteurs
                $codes_auteurs = get_functions_authors();
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $debligne_excel++;
                    $row = mysql_fetch_row($res);
                    switch ($caddie_type) {
                        case 'EXPL':
                            $id_notice = $row[2];
                            break;
                        case 'NOTI':
                        default:
                            $id_notice = $row[0];
                            break;
                    }
                    if ($flag) {
                        $worksheet->write_string($debligne_excel, 0, "X");
                    }
                    $j = 0;
                    foreach ($row as $dummykey => $col) {
                        if (!$col) {
                            $col = " ";
                        }
                        $worksheet->write_string($debligne_excel, $j + 1, $col);
                        $j++;
                    }
                    $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
                    $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
                    $rqt_aut .= "WHERE responsability_notice={$id_notice} ";
                    $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
                    $res_aut = @mysql_query($rqt_aut);
                    for ($iaut = 0; $iaut < $max_aut; $iaut++) {
                        $aut = @mysql_fetch_row($res_aut);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 1 + $nbr_champs, $aut[0]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 2 + $nbr_champs, $aut[1]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 3 + $nbr_champs, $aut[2]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 4 + $nbr_champs, $codes_auteurs[$aut[3]]);
                        if ($aut[4] == "70") {
                            $lib_type_aut = $msg[203];
                        } else {
                            if ($aut[4] == "71") {
                                $lib_type_aut = $msg[204];
                            } else {
                                if ($aut[4] == "72") {
                                    $lib_type_aut = $msg["congres_libelle"];
                                } else {
                                    $lib_type_aut = $aut[4];
                                }
                            }
                        }
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 5 + $nbr_champs, $lib_type_aut);
                        $lib_resp_type = "";
                        if ($aut[0]) {
                            if ($aut[5] == 0) {
                                $lib_resp_type = $msg["export_main_author"];
                            } else {
                                if ($aut[5] == 1) {
                                    $lib_resp_type = $msg["export_other_author"];
                                } else {
                                    if ($aut[5] == 2) {
                                        $lib_resp_type = $msg["export_secondary_author"];
                                    }
                                }
                            }
                        }
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 6 + $nbr_champs, $lib_resp_type);
                    }
                    $q = "drop table if exists catlg ";
                    $r = mysql_query($q, $dbh);
                    $q = "CREATE TEMPORARY TABLE catlg ENGINE=MyISAM as ";
                    $q .= "SELECT categories.num_noeud, categories.libelle_categorie ";
                    $q .= "FROM noeuds, categories, notices_categories ";
                    $q .= "WHERE notices_categories.notcateg_notice = '" . $id_notice . "' ";
                    $q .= "AND categories.langue = '" . $lang . "' ";
                    $q .= "AND categories.num_noeud = notices_categories.num_noeud ";
                    $q .= "AND categories.num_noeud = noeuds.id_noeud ";
                    $q .= "ORDER BY ordre_categorie";
                    $r = mysql_query($q, $dbh);
                    $q = "DROP TABLE IF EXISTS catdef ";
                    $r = mysql_query($q, $dbh);
                    $q = "CREATE TEMPORARY TABLE catdef ( ";
                    $q .= "num_noeud int(9) unsigned not null default '0', ";
                    $q .= "num_thesaurus int(3) unsigned not null default '0', ";
                    $q .= "libelle_categorie text not null ) ENGINE=MyISAM ";
                    $r = mysql_query($q, $dbh);
                    $thes_list = thesaurus::getThesaurusList();
                    $q = '';
                    foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) {
                        $thes = new thesaurus($id_thesaurus);
                        $q = "INSERT INTO catdef ";
                        $q .= "SELECT categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
                        $q .= "FROM noeuds, categories, notices_categories ";
                        $q .= "WHERE noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' ";
                        $q .= "AND categories.langue = '" . $thes->langue_defaut . "' ";
                        $q .= "AND categories.num_noeud = notices_categories.num_noeud ";
                        $q .= "AND categories.num_noeud = noeuds.id_noeud ";
                        $q .= "ORDER BY ordre_categorie";
                        $r = mysql_query($q, $dbh);
                    }
                    $q = "select catdef.num_thesaurus as num_thesaurus, ";
                    $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
                    $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
                    if (!$thesaurus_mode_pmb) {
                        $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' ";
                    }
                    $res_desc = mysql_query($q, $dbh);
                    $lib_desc = "";
                    while ($desc = mysql_fetch_object($res_desc)) {
                        $lib_desc .= $lib_desc ? $pmb_keyword_sep : "";
                        if ($thesaurus_mode_pmb) {
                            $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] ';
                        }
                        $lib_desc .= $desc->libelle_categorie;
                    }
                    $worksheet->write_string($debligne_excel, $max_aut * 6 + $nbr_champs + 1, "{$lib_desc}");
                    $p_perso = new parametres_perso($libelle_caddie_type);
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            $worksheet->write_string($debligne_excel, $max_aut * 6 + $nbr_champs + 2 + $i, html_entity_decode($p["AFF"], ENT_QUOTES | ENT_COMPAT, "iso-8859-15"));
                        }
                    }
                }
                break;
            case "TABLEAUHTML":
                if ($entete) {
                    if ($etat_table) {
                        echo "\n</table>";
                    }
                    echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>";
                    echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>";
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        $fieldname = mysql_field_name($res, $i);
                        print "<th align='left'>{$fieldname}</th>";
                    }
                    for ($i = 0; $i < $max_aut; $i++) {
                        print pmb_bidi("<th align='left'>aut_entree_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_rejete_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_dates_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_fonction_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_type_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_resp_type_{$i}</th>");
                    }
                    print "<th align='left'>DESCR</th>";
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = mysql_fetch_object($res_compte3);
                        print "<th align='left'>" . $perso->titre . "</th>";
                    }
                    $etat_table = 1;
                }
                //Fonctions d'auteurs
                $codes_auteurs = get_functions_authors();
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $row = mysql_fetch_row($res);
                    switch ($caddie_type) {
                        case 'EXPL':
                            $id_notice = $row[2];
                            break;
                        case 'NOTI':
                        default:
                            $id_notice = $row[0];
                            break;
                    }
                    echo "<tr>";
                    if ($flag) {
                        print "<td>X</td>";
                    } else {
                        print "<td>&nbsp;</td>";
                    }
                    foreach ($row as $dummykey => $col) {
                        if (is_numeric($col)) {
                            $col = "'" . $col;
                        }
                        if (!$col) {
                            $col = "&nbsp;";
                        }
                        print pmb_bidi("<td>{$col}</td>");
                    }
                    $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
                    $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
                    $rqt_aut .= "WHERE responsability_notice={$id_notice} ";
                    $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
                    $res_aut = @mysql_query($rqt_aut, $dbh);
                    for ($i = 0; $i < $max_aut; $i++) {
                        $aut = @mysql_fetch_row($res_aut);
                        print pmb_bidi("<td>{$aut['0']}</td>");
                        print pmb_bidi("<td>{$aut['1']}</td>");
                        print pmb_bidi("<td>{$aut['2']}</td>");
                        print pmb_bidi("<td>" . $codes_auteurs[$aut[3]] . "</td>");
                        if ($aut[4] == "70") {
                            $lib_type_aut = $msg[203];
                        } else {
                            if ($aut[4] == "71") {
                                $lib_type_aut = $msg[204];
                            } else {
                                if ($aut[4] == "72") {
                                    $lib_type_aut = $msg["congres_libelle"];
                                } else {
                                    $lib_type_aut = $aut[4];
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_type_aut}</td>");
                        $lib_resp_type = "";
                        if ($aut[0]) {
                            if ($aut[5] == 0) {
                                $lib_resp_type = $msg["export_main_author"];
                            } else {
                                if ($aut[5] == 1) {
                                    $lib_resp_type = $msg["export_other_author"];
                                } else {
                                    if ($aut[5] == 2) {
                                        $lib_resp_type = $msg["export_secondary_author"];
                                    }
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_resp_type}</td>");
                    }
                    $q = "drop table if exists catlg ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catlg ENGINE=MyISAM as ";
                    $q .= "select categories.num_noeud, categories.libelle_categorie ";
                    $q .= "from noeuds, categories, notices_categories ";
                    $q .= "where notices_categories.notcateg_notice = '" . $id_notice . "' ";
                    $q .= "and categories.langue = '" . $lang . "' ";
                    $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                    $q .= "and categories.num_noeud = noeuds.id_noeud ";
                    $q .= "ORDER BY ordre_categorie";
                    $r = mysql_query($q, $dbh);
                    $q = "drop table if exists catdef ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catdef ( ";
                    $q .= "num_noeud int(9) unsigned not null default '0', ";
                    $q .= "num_thesaurus int(3) unsigned not null default '0', ";
                    $q .= "libelle_categorie text not null ";
                    $q .= ") ENGINE=MyISAM ";
                    $r = mysql_query($q, $dbh);
                    $thes_list = thesaurus::getThesaurusList();
                    $q = '';
                    foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) {
                        $thes = new thesaurus($id_thesaurus);
                        $q = "insert into catdef ";
                        $q .= "select categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
                        $q .= "from noeuds, categories, notices_categories ";
                        $q .= "where noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' ";
                        $q .= "and categories.langue = '" . $thes->langue_defaut . "' ";
                        $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                        $q .= "and categories.num_noeud = noeuds.id_noeud ";
                        $q .= "ORDER BY ordre_categorie";
                        $r = mysql_query($q, $dbh);
                    }
                    $q = "select catdef.num_thesaurus as num_thesaurus, ";
                    $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
                    $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
                    if (!$thesaurus_mode_pmb) {
                        $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' ";
                    }
                    $res_desc = mysql_query($q, $dbh);
                    $lib_desc = "";
                    while ($desc = mysql_fetch_object($res_desc)) {
                        $lib_desc .= $lib_desc ? $pmb_keyword_sep : "";
                        if ($thesaurus_mode_pmb) {
                            $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] ';
                        }
                        $lib_desc .= $desc->libelle_categorie;
                    }
                    print pmb_bidi("<td>{$lib_desc}</td>");
                    $p_perso = new parametres_perso($libelle_caddie_type);
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            print "<td>" . $p["AFF"] . "</td>";
                        }
                    }
                    echo "</tr>";
                }
                break;
            default:
                if ($entete) {
                    if ($etat_table) {
                        echo "\n</table>";
                    }
                    echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>";
                    echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>";
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        $fieldname = mysql_field_name($res, $i);
                        print "<th align='left'>{$fieldname}</th>";
                    }
                    for ($i = 0; $i < $max_aut; $i++) {
                        print pmb_bidi("<th align='left'>aut_entree_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_rejete_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_dates_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_fonction_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_type_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_resp_type_{$i}</th>");
                    }
                    print "<th align='left'>DESCR</th>";
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = mysql_fetch_object($res_compte3);
                        print "<th align='left'>" . $perso->titre . "</th>";
                    }
                    $etat_table = 1;
                }
                //Fonctions d'auteurs
                $codes_auteurs = get_functions_authors();
                $odd_even = 0;
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $row = mysql_fetch_row($res);
                    switch ($caddie_type) {
                        case 'EXPL':
                            $id_notice = $row[2];
                            break;
                        case 'NOTI':
                        default:
                            $id_notice = $row[0];
                            break;
                    }
                    if ($odd_even == 0) {
                        echo "\t<tr class='odd'>";
                        $odd_even = 1;
                    } else {
                        if ($odd_even == 1) {
                            echo "\t<tr class='even'>";
                            $odd_even = 0;
                        }
                    }
                    if ($flag) {
                        print "<td>X</td>";
                    } else {
                        print "<td>&nbsp;</td>";
                    }
                    foreach ($row as $dummykey => $col) {
                        if (!$col) {
                            $col = "&nbsp;";
                        }
                        print pmb_bidi("<td>{$col}</td>");
                    }
                    $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
                    $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
                    $rqt_aut .= "WHERE responsability_notice={$id_notice} ";
                    $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
                    $res_aut = @mysql_query($rqt_aut, $dbh);
                    for ($i = 0; $i < $max_aut; $i++) {
                        $aut = @mysql_fetch_row($res_aut);
                        print pmb_bidi("<td>{$aut['0']}</td>");
                        print pmb_bidi("<td>{$aut['1']}</td>");
                        print pmb_bidi("<td>{$aut['2']}</td>");
                        print pmb_bidi("<td>" . $codes_auteurs[$aut[3]] . "</td>");
                        if ($aut[4] == "70") {
                            $lib_type_aut = $msg[203];
                        } else {
                            if ($aut[4] == "71") {
                                $lib_type_aut = $msg[204];
                            } else {
                                if ($aut[4] == "72") {
                                    $lib_type_aut = $msg["congres_libelle"];
                                } else {
                                    $lib_type_aut = $aut[4];
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_type_aut}</td>");
                        $lib_resp_type = "";
                        if ($aut[0]) {
                            if ($aut[5] == 0) {
                                $lib_resp_type = $msg["export_main_author"];
                            } else {
                                if ($aut[5] == 1) {
                                    $lib_resp_type = $msg["export_other_author"];
                                } else {
                                    if ($aut[5] == 2) {
                                        $lib_resp_type = $msg["export_secondary_author"];
                                    }
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_resp_type}</td>");
                    }
                    $q = "drop table if exists catlg ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catlg ENGINE=MyISAM as ";
                    $q .= "select categories.num_noeud, categories.libelle_categorie ";
                    $q .= "from noeuds, categories, notices_categories ";
                    $q .= "where notices_categories.notcateg_notice = '" . $id_notice . "' ";
                    $q .= "and categories.langue = '" . $lang . "' ";
                    $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                    $q .= "and categories.num_noeud = noeuds.id_noeud ";
                    $q .= "ORDER BY ordre_categorie";
                    $r = mysql_query($q, $dbh);
                    $q = "drop table if exists catdef ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catdef ( ";
                    $q .= "num_noeud int(9) unsigned not null default '0', ";
                    $q .= "num_thesaurus int(3) unsigned not null default '0', ";
                    $q .= "libelle_categorie text not null ";
                    $q .= ") ENGINE=MyISAM ";
                    $r = mysql_query($q, $dbh);
                    $thes_list = thesaurus::getThesaurusList();
                    $q = '';
                    foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) {
                        $thes = new thesaurus($id_thesaurus);
                        $q = "insert into catdef ";
                        $q .= "select categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
                        $q .= "from noeuds, categories, notices_categories ";
                        $q .= "where noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' ";
                        $q .= "and categories.langue = '" . $thes->langue_defaut . "' ";
                        $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                        $q .= "and categories.num_noeud = noeuds.id_noeud ";
                        $q .= "ORDER BY ordre_categorie";
                        $r = mysql_query($q, $dbh);
                    }
                    $q = "select catdef.num_thesaurus as num_thesaurus, ";
                    $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
                    $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
                    if (!$thesaurus_mode_pmb) {
                        $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' ";
                    }
                    $res_desc = mysql_query($q, $dbh);
                    $lib_desc = "";
                    while ($desc = mysql_fetch_object($res_desc)) {
                        $lib_desc .= $lib_desc ? $pmb_keyword_sep : "";
                        if ($thesaurus_mode_pmb) {
                            $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] ';
                        }
                        $lib_desc .= $desc->libelle_categorie;
                    }
                    print pmb_bidi("<td>{$lib_desc}</td>");
                    $p_perso = new parametres_perso($libelle_caddie_type);
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            print "<td>" . $p["AFF"] . "</td>";
                        }
                    }
                    echo "</tr>";
                }
                break;
        }
        // fin switch
    }
    // fin if nbr_lignes
}
示例#8
0
 function expl_list($type, $id, $bull_id = 0, $build_ifempty = 1)
 {
     global $dbh;
     global $msg, $charset;
     global $expl_list_header, $expl_list_footer;
     global $opac_expl_data, $opac_expl_order, $opac_url_base;
     global $pmb_transferts_actif, $transferts_statut_transferts;
     global $memo_p_perso_expl;
     global $opac_show_empty_items_block;
     global $opac_show_exemplaires_analysis;
     global $expl_list_header_loc_tpl, $opac_aff_expl_localises;
     global $opac_sur_location_activate, $opac_view_filter_class;
     $nb_expl_autre_loc = 0;
     $nb_perso_aff = 0;
     // les dépouillements ou périodiques n'ont pas d'exemplaire
     if ($type == "a" && !$opac_show_exemplaires_analysis || $type == "s") {
         return "";
     }
     if (!$memo_p_perso_expl) {
         $memo_p_perso_expl = new parametres_perso("expl");
     }
     $header_found_p_perso = 0;
     if ($opac_sur_location_activate) {
         $opac_sur_location_select = ", sur_location.*";
         $opac_sur_location_from = ", sur_location";
         $opac_sur_location_where = " AND docs_location.surloc_num=sur_location.surloc_id";
     }
     if ($opac_view_filter_class) {
         if (sizeof($opac_view_filter_class->params["nav_sections"])) {
             $opac_view_filter_where = " AND idlocation in (" . implode(",", $opac_view_filter_class->params["nav_sections"]) . ")";
         } else {
             return "";
         }
     }
     // les exemplaires des monographies
     if ($type == "m") {
         $requete = "SELECT exemplaires.*, pret.*, docs_location.*, docs_section.*, docs_statut.*, docs_type.*, docs_codestat.*, lenders.* {$opac_sur_location_select}";
         $requete .= " FROM exemplaires LEFT JOIN pret ON exemplaires.expl_id=pret.pret_idexpl, docs_location, docs_section, docs_statut, docs_type, docs_codestat, lenders {$opac_sur_location_from}";
         $requete .= " WHERE expl_notice='{$id}' and expl_bulletin='{$bull_id}'";
         $requete .= " AND location_visible_opac=1 AND section_visible_opac=1 AND statut_visible_opac=1";
         $requete .= $opac_sur_location_where;
         $requete .= $opac_view_filter_where;
         $requete .= " AND exemplaires.expl_location=docs_location.idlocation";
         $requete .= " AND exemplaires.expl_section=docs_section.idsection ";
         $requete .= " AND exemplaires.expl_statut=docs_statut.idstatut ";
         $requete .= " AND exemplaires.expl_typdoc=docs_type. idtyp_doc ";
         $requete .= " AND exemplaires.expl_codestat=docs_codestat.idcode ";
         $requete .= " AND exemplaires.expl_owner=lenders.idlender ";
         if ($opac_expl_order) {
             $requete .= " ORDER BY {$opac_expl_order} ";
         }
         $requete_resa = "SELECT count(1) from resa where resa_idnotice='{$id}' ";
     }
     // fin si "m"
     // les exemplaires des bulletins
     if ($type == "b") {
         $requete = "SELECT exemplaires.*, pret.*, docs_location.*, docs_section.*, docs_statut.*, docs_type.*, docs_codestat.*, lenders.* {$opac_sur_location_select}";
         $requete .= " FROM exemplaires LEFT JOIN pret ON exemplaires.expl_id=pret.pret_idexpl, docs_location, docs_section, docs_statut, docs_type, docs_codestat, lenders {$opac_sur_location_from}";
         $requete .= " WHERE expl_notice='0' and expl_bulletin='{$bull_id}'";
         $requete .= " AND location_visible_opac=1 AND section_visible_opac=1 AND statut_visible_opac=1";
         $requete .= $opac_sur_location_where;
         $requete .= $opac_view_filter_where;
         $requete .= " AND exemplaires.expl_location=docs_location.idlocation";
         $requete .= " AND exemplaires.expl_section=docs_section.idsection ";
         $requete .= " AND exemplaires.expl_statut=docs_statut.idstatut ";
         $requete .= " AND exemplaires.expl_typdoc=docs_type. idtyp_doc ";
         $requete .= " AND exemplaires.expl_codestat=docs_codestat.idcode ";
         $requete .= " AND exemplaires.expl_owner=lenders.idlender ";
         if ($opac_expl_order) {
             $requete .= " ORDER BY {$opac_expl_order} ";
         }
         $requete_resa = "SELECT count(1) from resa where resa_idbulletin='{$bull_id}' ";
     }
     // fin si "b"
     // les exemplaires des bulletins des articles affichés
     // ERICROBERT : A faire ici !
     if ($type == "a" && $opac_show_exemplaires_analysis) {
         $requete = "SELECT exemplaires.*, pret.*, docs_location.*, docs_section.*, docs_statut.*, docs_type.*, docs_codestat.*, lenders.* {$opac_sur_location_select}";
         $requete .= " FROM exemplaires LEFT JOIN pret ON exemplaires.expl_id=pret.pret_idexpl, docs_location, docs_section, docs_statut, docs_type, docs_codestat, lenders {$opac_sur_location_from}";
         $requete .= " WHERE expl_notice='0' and expl_bulletin='{$bull_id}'";
         $requete .= " AND location_visible_opac=1 AND section_visible_opac=1 AND statut_visible_opac=1";
         $requete .= $opac_sur_location_where;
         $requete .= $opac_view_filter_where;
         $requete .= " AND exemplaires.expl_location=docs_location.idlocation";
         $requete .= " AND exemplaires.expl_section=docs_section.idsection ";
         $requete .= " AND exemplaires.expl_statut=docs_statut.idstatut ";
         $requete .= " AND exemplaires.expl_typdoc=docs_type. idtyp_doc ";
         $requete .= " AND exemplaires.expl_codestat=docs_codestat.idcode ";
         $requete .= " AND exemplaires.expl_owner=lenders.idlender ";
         if ($opac_expl_order) {
             $requete .= " ORDER BY {$opac_expl_order} ";
         }
         $requete_resa = "SELECT count(1) from resa where resa_idbulletin='{$bull_id}' ";
     }
     // fin si "a"
     // récupération du nombre d'exemplaires
     $res = mysql_query($requete, $dbh);
     if (!$build_ifempty && !mysql_num_rows($res)) {
         return "";
     }
     $surloc_field = "";
     if ($opac_sur_location_activate == 1) {
         $surloc_field = "surloc_libelle,";
     }
     if (!$opac_expl_data) {
         $opac_expl_data = "expl_cb,expl_cote,tdoc_libelle," . $surloc_field . "location_libelle,section_libelle";
     }
     $colonnesarray = explode(",", $opac_expl_data);
     $expl_list_header_deb = "<tr>";
     for ($i = 0; $i < count($colonnesarray); $i++) {
         eval("\$colencours=\$msg['expl_header_" . $colonnesarray[$i] . "'];");
         $expl_list_header_deb .= "<th class='expl_header_" . $colonnesarray[$i] . "'>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</th>";
     }
     $expl_list_header_deb .= "<th>{$msg['statut']}</th>";
     $expl_liste = "";
     $nb_resa = mysql_result(mysql_query($requete_resa, $dbh), 0, 0);
     while ($expl = mysql_fetch_object($res)) {
         $compteur = $compteur + 1;
         $expl_liste .= "<tr>";
         $colencours = "";
         for ($i = 0; $i < count($colonnesarray); $i++) {
             eval("\$colencours=\$expl->" . $colonnesarray[$i] . ";");
             if ($colonnesarray[$i] == "location_libelle" && $expl->num_infopage) {
                 if ($expl->surloc_id != "0") {
                     $param_surloc = "&surloc=" . $expl->surloc_id;
                 } else {
                     $param_surloc = "";
                 }
                 $expl_liste .= "<td class='" . $colonnesarray[$i] . "'><a href=\"" . $opac_url_base . "index.php?lvl=infopages&pagesid=" . $expl->num_infopage . "&location=" . $expl->expl_location . $param_surloc . "\" alt=\"" . $msg['location_more_info'] . "\" title=\"" . $msg['location_more_info'] . "\">" . htmlentities($colencours, ENT_QUOTES, $charset) . "</a></td>";
             } else {
                 $expl_liste .= "<td class='" . $colonnesarray[$i] . "'>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</td>";
             }
         }
         $requete_resa = "SELECT count(1) from resa where resa_cb='{$expl->expl_cb}' ";
         $flag_resa = mysql_result(mysql_query($requete_resa, $dbh), 0, 0);
         $requete_resa = "SELECT count(1) from resa_ranger where resa_cb='{$expl->expl_cb}' ";
         $flag_resa = $flag_resa + mysql_result(mysql_query($requete_resa, $dbh), 0, 0);
         $situation = "";
         if ($expl->statut_libelle_opac != "") {
             $situation .= $expl->statut_libelle_opac . "<br />";
         }
         if ($flag_resa) {
             $nb_resa--;
             $situation .= "<strong>{$msg['expl_reserve']}</strong>";
         } else {
             if ($expl->pret_flag) {
                 if ($expl->pret_retour) {
                     // exemplaire sorti
                     global $opac_show_empr;
                     if ($opac_show_empr == 1 && $_SESSION["user_code"] || $opac_show_empr == 2) {
                         $rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='{$expl->pret_idempr}' ";
                         $res_empr = mysql_query($rqt_empr, $dbh);
                         $res_empr_obj = mysql_fetch_object($res_empr);
                         $situation .= $msg[entete_show_empr] . htmlentities(" {$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}", ENT_QUOTES, $charset) . "<br />";
                     }
                     $situation .= "<strong>{$msg['out_until']} " . formatdate($expl->pret_retour) . '</strong>';
                     // ****** Affichage de l'emprunteur
                 } else {
                     // pas sorti
                     $situation .= "<strong>" . $msg['available'] . "</strong>";
                 }
             } else {
                 // pas prêtable
                 // exemplaire pas prêtable, on affiche juste "exclu du pret"
                 if ($pmb_transferts_actif == "1" && "" . $expl->expl_statut . "" == $transferts_statut_transferts) {
                     $situation .= "<strong>" . $msg['reservation_lib_entransfert'] . "</strong>";
                 } else {
                     $situation .= "<strong>" . $msg['exclu'] . "</strong>";
                 }
             }
         }
         // fin if else $flag_resa
         $expl_liste .= "<td class='expl_situation'>{$situation} </td>";
         //Champs personalisés
         $perso_aff = "";
         if (!$memo_p_perso_expl->no_special_fields) {
             $perso_ = $memo_p_perso_expl->show_fields($expl->expl_id);
             for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                 $p = $perso_["FIELDS"][$i];
                 if ($p['OPAC_SHOW']) {
                     if (!$header_found_p_perso) {
                         $header_perso_aff .= "<th class='expl_header_tdoc_libelle'>" . $p["TITRE_CLEAN"] . "</th>";
                         $nb_perso_aff++;
                     }
                     if ($p["AFF"]) {
                         $perso_aff .= "<td class='p_perso'>" . $p["AFF"] . "</td>";
                     } else {
                         $perso_aff .= "<td class='p_perso'>&nbsp;</td>";
                     }
                 }
             }
         }
         $header_found_p_perso = 1;
         $expl_liste .= $perso_aff;
         $expl_liste .= "</tr>";
         $expl_liste_all .= $expl_liste;
         if ($opac_aff_expl_localises && $_SESSION["empr_location"]) {
             if ($expl->expl_location == $_SESSION["empr_location"]) {
                 $expl_liste_loc .= $expl_liste;
             } else {
                 $nb_expl_autre_loc++;
             }
         }
         $expl_liste = "";
     }
     // fin while
     //S'il y a des titres de champs perso dans les exemplaires
     if ($header_perso_aff) {
         $expl_list_header_deb .= $header_perso_aff;
     }
     if ($opac_aff_expl_localises && $_SESSION["empr_location"] && $nb_expl_autre_loc) {
         // affichage avec onglet selon la localisation
         if (!$expl_liste_loc) {
             $expl_liste_loc = "<tr class=even><td colspan='" . (count($colonnesarray) + 1 + $nb_perso_aff) . "'>" . $msg["no_expl"] . "</td></tr>";
         }
         $expl_liste_all = str_replace("!!EXPL!!", $expl_list_header_deb . $expl_liste_all, $expl_list_header_loc_tpl);
         $expl_liste_all = str_replace("!!EXPL_LOC!!", $expl_list_header_deb . $expl_liste_loc, $expl_liste_all);
         $expl_liste_all = str_replace("!!mylocation!!", $_SESSION["empr_location_libelle"], $expl_liste_all);
         $expl_liste_all = str_replace("!!id!!", $id + $bull_id, $expl_liste_all);
     } else {
         // affichage de la liste d'exemplaires calculée ci-dessus
         if (!$expl_liste_all && $opac_show_empty_items_block == 1) {
             $expl_liste_all = $expl_list_header . $expl_list_header_deb . "<tr class=even><td colspan='" . (count($colonnesarray) + 1) . "'>" . $msg["no_expl"] . "</td></tr>" . $expl_list_footer;
         } elseif (!$expl_liste_all && $opac_show_empty_items_block == 0) {
             $expl_liste_all = "";
         } else {
             $expl_liste_all = $expl_list_header . $expl_list_header_deb . $expl_liste_all . $expl_list_footer;
         }
     }
     return $expl_liste_all;
 }
 function fetch_data()
 {
     global $dbh;
     global $msg;
     global $charset;
     global $val_list_empr;
     global $pmb_gestion_financiere, $pmb_gestion_abonnement, $pmb_gestion_tarif_prets, $pmb_gestion_amende;
     global $deflt_docs_location;
     if (!$this->id_empr || !$dbh) {
         return FALSE;
     }
     $requete = "SELECT e.*, c.libelle AS code1, s.libelle AS code2, es.statut_libelle AS empr_statut_libelle, allow_loan, allow_book, allow_opac, allow_dsi, allow_dsi_priv, allow_sugg, allow_prol, d.location_libelle as localisation, date_format(empr_date_adhesion, '" . $msg["format_date"] . "') as aff_empr_date_adhesion, date_format(empr_date_expiration, '" . $msg["format_date"] . "') as aff_empr_date_expiration FROM empr e left join docs_location as d on e.empr_location=d.idlocation, empr_categ c, empr_codestat s, empr_statut es ";
     $requete .= " WHERE e.id_empr='" . $this->id_empr . "' ";
     $requete .= " AND c.id_categ_empr=e.empr_categ";
     $requete .= " AND s.idcode=e.empr_codestat";
     $requete .= " AND es.idstatut=e.empr_statut";
     $requete .= " LIMIT 1";
     $result = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . " " . $requete);
     if (!pmb_mysql_num_rows($result)) {
         return FALSE;
     }
     $empr = pmb_mysql_fetch_object($result);
     // affectation des propriétés
     $this->empr_cb = $empr->empr_cb;
     // code barre emprunteur
     $this->empr_nom = $empr->empr_nom;
     // nom emprunteur
     $this->empr_prenom = $empr->empr_prenom;
     // prénom mprunteur
     $this->empr_adr1 = $empr->empr_adr1;
     // adresse ligne 1
     $this->empr_adr2 = $empr->empr_adr2;
     // adresse ligne 2
     $this->empr_cp = $empr->empr_cp;
     // code postal
     $this->empr_ville = $empr->empr_ville;
     // ville
     $this->empr_pays = $empr->empr_pays;
     // ville
     $this->empr_mail = $empr->empr_mail;
     // adresse email
     $this->empr_tel1 = $empr->empr_tel1;
     // téléphone 1
     $this->empr_tel2 = $empr->empr_tel2;
     // téléphone 2
     $this->empr_prof = $empr->empr_prof;
     // profession
     $this->empr_year = $empr->empr_year;
     // année de naissance
     $this->empr_categ = $empr->empr_categ;
     // catégorie emprunteur
     $this->empr_codestat = $empr->empr_codestat;
     // code statistique
     $this->empr_creation = $empr->empr_creation;
     // date de création
     $this->empr_modif = $empr->empr_modif;
     // date de modification
     $this->empr_sexe = $empr->empr_sexe;
     // sexe de l'emprunteur
     $this->empr_login = $empr->empr_login;
     // login pour services OPAC
     $this->empr_password = $empr->empr_password;
     // mot de passe OPAC
     $this->empr_ldap = $empr->empr_ldap;
     $this->type_abt = $empr->type_abt;
     // type d'abonnement
     $this->empr_location = $empr->empr_location;
     // localisation
     $this->empr_location_l = $empr->localisation;
     // localisation
     $this->date_fin_blocage = $empr->date_fin_blocage;
     // Date de fin de blocage de l'emprunteur
     $this->empr_statut = $empr->empr_statut;
     $this->empr_statut_l = $empr->empr_statut_libelle;
     $this->total_loans = $empr->total_loans;
     $this->date_adhesion = $empr->empr_date_adhesion;
     // début adhésion
     $this->date_expiration = $empr->empr_date_expiration;
     // fin adhésion
     $this->aff_date_adhesion = $empr->aff_empr_date_adhesion;
     // début adhésion
     $this->aff_date_expiration = $empr->aff_empr_date_expiration;
     // fin adhésion
     $this->empr_msg = $empr->empr_msg;
     // message emprunteur
     $this->cat_l = $empr->code1;
     // libellé catégorie emprunteur
     $this->cstat_l = $empr->code2;
     // libellé code statistique. voir ce bug avec Eric
     $this->allow_loan = $empr->allow_loan;
     $this->allow_book = $empr->allow_book;
     $this->allow_opac = $empr->allow_opac;
     $this->allow_dsi = $empr->allow_dsi;
     $this->allow_dsi_priv = $empr->allow_dsi_priv;
     $this->allow_sugg = $empr->allow_sugg;
     $this->allow_prol = $empr->allow_prol;
     global $selector_prop_ajout_caddie_empr, $empr_show_caddie;
     if ($empr_show_caddie) {
         $this->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=" . $this->id . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}')\">";
     } else {
         $this->img_ajout_empr_caddie = "";
     }
     $this->lien_nom_prenom = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($this->cb) . "'>{$this->nom},&nbsp;{$this->prenom}</a>";
     $date_blocage = array();
     $date_blocage = explode("-", $this->date_fin_blocage);
     if (mktime(0, 0, 0, $date_blocage[1], $date_blocage[2], $date_blocage[0]) > time()) {
         $this->blocage_active = true;
     }
     //Groupes
     $requete = "select id_groupe, libelle_groupe from groupe, empr_groupe where empr_id='" . $this->id . "' and id_groupe=groupe_id";
     $result = pmb_mysql_query($requete);
     if (pmb_mysql_num_rows($result)) {
         while ($grp_temp = pmb_mysql_fetch_object($result)) {
             $this->groupes[] = "<a href='./circ.php?categ=groups&action=showgroup&groupID=" . $grp_temp->id_groupe . "'>" . htmlentities($grp_temp->libelle_groupe, ENT_QUOTES, $charset) . "</a>";
         }
     } else {
         $this->groupes = array();
     }
     //Paramètres perso
     //Liste des champs
     $p_perso = new parametres_perso("empr");
     $perso_ = $p_perso->show_fields($this->id_empr);
     $perso = "";
     $class = "colonne3";
     $c = 0;
     if (count($perso_["FIELDS"])) {
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             $perso .= "<div class='{$class}'>";
             $perso .= "<div class='row'>" . $p["TITRE"];
             $perso .= $p["AFF"] . "</div>";
             $perso .= "</div>";
             if ($c == 0) {
                 $c = 1;
             } else {
                 if ($c == 1) {
                     $class = "colonne_suite";
                     $c = 2;
                 } else {
                     if ($c == 2) {
                         $class = "colonne3";
                         $c = 0;
                     }
                 }
             }
         }
         $reste = 2 - $c;
         if ($c != 0) {
             for ($i = 0; $i < $reste; $i++) {
                 $perso .= "<div class='colonne3'>&nbsp;</div>";
                 $c++;
             }
             $perso .= "<div class='colonne_suite'>&nbsp;</div>";
         }
     }
     $this->perso = $perso;
     //Comptes si gestion financiere
     if ($pmb_gestion_financiere) {
         $compte = "";
         $n_c = 0;
         $neg = "<span class='erreur'>%s</span>";
         $pos = "%s";
         $compte .= "<div class='row'><hr /></div><div class='row'>";
         if ($pmb_gestion_abonnement) {
             $cpt_id = comptes::get_compte_id_from_empr($this->id, 1);
             $cpt = new comptes($cpt_id);
             $solde = $cpt->update_solde();
             $novalid = $cpt->summarize_transactions("", "", 0, 0);
             if ($cpt_id) {
                 $compte .= "<div class='colonne3'><div><strong><a href='./circ.php?categ=pret&sub=compte&id=" . $this->id . "&typ_compte=1'>" . $msg["finance_solde_abt"] . "</a></strong> " . comptes::format($solde) . "</div>";
                 if ($novalid) {
                     $compte .= "<div>" . $msg["finance_not_validated"] . " : " . comptes::format($novalid) . "</div>";
                 }
                 $compte .= "</div>";
             }
             $n_c++;
         }
         if ($pmb_gestion_tarif_prets) {
             $cpt_id = comptes::get_compte_id_from_empr($this->id, 3);
             $cpt = new comptes($cpt_id);
             $solde = $cpt->update_solde();
             $novalid = $cpt->summarize_transactions("", "", 0, 0);
             if ($cpt_id) {
                 $compte .= "<div class='colonne3'><div><strong><a href='./circ.php?categ=pret&sub=compte&id=" . $this->id . "&typ_compte=3'>" . $msg["finance_solde_pret"] . "</a></strong> " . comptes::format($solde) . "</div>";
                 if ($novalid) {
                     $compte .= "<div>" . $msg["finance_not_validated"] . " : " . comptes::format($novalid) . "</div>";
                 }
                 $compte .= "</div>";
             }
             $n_c++;
         }
         if ($pmb_gestion_amende) {
             $cpt_id = comptes::get_compte_id_from_empr($this->id, 2);
             $cpt = new comptes($cpt_id);
             $solde = $cpt->update_solde();
             $novalid = $cpt->summarize_transactions("", "", 0, 0);
             if ($cpt_id) {
                 //Calcul des amendes
                 $amende = new amende($this->id);
                 $total_amende = $amende->get_total_amendes();
                 $compte .= "<div class='colonne3'><div><strong><a href='./circ.php?categ=pret&sub=compte&id=" . $this->id . "&typ_compte=2'>" . $msg["finance_solde_amende"] . "</a></strong> " . comptes::format($solde) . "</div>";
                 if ($novalid) {
                     $compte .= "<div>" . $msg["finance_not_validated"] . " : " . comptes::format($novalid) . "</div>";
                 }
                 if ($total_amende) {
                     $compte .= "<div> " . $msg["finance_pret_amende_en_cours"] . " : " . comptes::format($total_amende) . "</div>";
                 }
                 $compte .= "</div>";
             }
             $n_c++;
         }
         if ($n_c < 2) {
             for ($i = $n_c; $i < 3; $i++) {
                 $compte .= "<div class='colonne3'>&nbsp;</div>";
             }
         }
         $compte .= "</div><div class='row'></div>";
     }
     $this->compte = $compte;
 }
示例#10
0
 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;
 }
 function expl_info_display($affichage_emprunteurs = 1, $affichage_zone_notes = 1)
 {
     global $msg, $expl_view_form, $pmb_expl_show_dates, $charset;
     $expl_aff = $expl_view_form;
     $expl_aff = str_replace('!!code_barre!!', htmlentities($this->expl_data->expl_cb, ENT_QUOTES, $charset), $expl_aff);
     $expl_aff = str_replace('!!cote!!', htmlentities($this->expl_data->expl_cote, ENT_QUOTES, $charset), $expl_aff);
     $expl_aff = str_replace('!!type_doc!!', htmlentities($this->expl_data->tdoc_libelle, ENT_QUOTES, $charset), $expl_aff);
     $expl_aff = str_replace('!!localisation!!', htmlentities($this->expl_data->location_libelle, ENT_QUOTES, $charset), $expl_aff);
     $expl_aff = str_replace('!!section!!', htmlentities($this->expl_data->section_libelle, ENT_QUOTES, $charset), $expl_aff);
     $expl_aff = str_replace('!!owner!!', htmlentities($this->expl_data->lender_libelle, ENT_QUOTES, $charset), $expl_aff);
     $expl_aff = str_replace('!!statut!!', htmlentities($this->expl_data->statut_libelle, ENT_QUOTES, $charset), $expl_aff);
     $expl_aff = str_replace('!!codestat!!', htmlentities($this->expl_data->codestat_libelle, ENT_QUOTES, $charset), $expl_aff);
     $expl_aff = str_replace('!!note!!', htmlentities($this->expl_data->expl_note, ENT_QUOTES, $charset), $expl_aff);
     $expl_aff = str_replace('!!comment!!', htmlentities($this->expl_data->expl_comment, ENT_QUOTES, $charset), $expl_aff);
     //on compte de nombre de prets pour cet exemplaire
     $req = "select count(arc_expl_id) as nb_prets from pret_archive where arc_expl_id = " . $this->expl_data->expl_id;
     $res = pmb_mysql_query($req);
     if (pmb_mysql_num_rows($res)) {
         $arch_pret = pmb_mysql_fetch_object($res);
         $nb_prets = $arch_pret->nb_prets;
     } else {
         $nb_prets = 0;
     }
     $expl_aff = str_replace('!!nb_prets!!', $nb_prets, $expl_aff);
     //Date de création / modification
     if ($pmb_expl_show_dates == '1' || $pmb_expl_show_dates == '3') {
         $tmp = "<tr>\n\t\t\t<td align='right'><label class='etiquette'>" . htmlentities($msg['exp_cre_date'], ENT_QUOTES, $charset) . "</label></td>\n\t\t\t<td align='left'>" . htmlentities(format_date($this->expl_data->create_date), ENT_QUOTES, $charset) . "</td>\n\t\t\t<td align='right'><label class='etiquette'>" . htmlentities($msg['exp_upd_date'], ENT_QUOTES, $charset) . "</label></td>\n\t\t\t<td align='left'>" . htmlentities(format_date($this->expl_data->update_date), ENT_QUOTES, $charset) . "</td>\t\t\t\t\t\n\t\t</tr>";
         $expl_aff = str_replace('<!-- exp_date_admin -->', $tmp, $expl_aff);
     }
     //Date de dépôt / retour
     if ($pmb_expl_show_dates == '2' || $pmb_expl_show_dates == '3') {
         $tmp = "<tr>\n\t\t\t<td align='right'><label class='etiquette'>" . htmlentities($msg['filing_date'], ENT_QUOTES, $charset) . "</label></td>\n\t\t\t<td align='left'>" . htmlentities(format_date($this->expl_data->expl_date_depot), ENT_QUOTES, $charset) . "</td>\n\t\t\t<td align='right'><label class='etiquette'>" . htmlentities($msg['return_date'], ENT_QUOTES, $charset) . "</label></td>\n\t\t\t<td align='left'>" . htmlentities(format_date($this->expl_data->expl_date_retour), ENT_QUOTES, $charset) . "</td>\t\t\t\t\t\n\t\t</tr>";
         $expl_aff = str_replace('<!-- exp_date_filing -->', $tmp, $expl_aff);
     }
     $p_perso = new parametres_perso("expl");
     if (!$p_perso->no_special_fields) {
         $c = 0;
         $perso = "";
         $perso_ = $p_perso->show_fields($this->expl_data->expl_id);
         $nb_param = count($perso_["FIELDS"]);
         $perso_aff = '';
         for ($i = 0; $i < $nb_param; $i++) {
             $nb_colonne = 2;
             $perso_aff .= "<tr>\n";
             for ($i; $i < $nb_param; $i++) {
                 $p = $perso_["FIELDS"][$i];
                 $perso_aff .= "<td align='right'><label class='etiquette'>" . $p["TITRE"] . "</label></td>";
                 $perso_aff .= "<td align='left'>" . $p["AFF"] . "</td>";
                 if (!--$nb_colonne) {
                     break;
                 }
             }
             $perso_aff .= "</tr>\n";
         }
     }
     $expl_aff = str_replace('!!champs_perso!!', $perso_aff, $expl_aff);
     return $expl_aff;
 }
示例#12
0
if ($empr_mail) {
    $tab_empr_info[$i]["titre"] = $msg["empr_mail"];
    $tab_empr_info[$i++]["val"] = "<a href='mailto:{$empr_mail}'>{$empr_mail}</a>";
}
if ($empr_prof) {
    $tab_empr_info[$i]["titre"] = $msg["empr_tpl_prof"];
    $tab_empr_info[$i++]["val"] = $empr_prof;
}
if ($empr_year) {
    $tab_empr_info[$i]["titre"] = $msg["empr_tpl_year"];
    $tab_empr_info[$i++]["val"] = $empr_year;
}
//Paramètres perso
require_once "{$class_path}/parametres_perso.class.php";
$p_perso = new parametres_perso("empr");
$perso_ = $p_perso->show_fields($id_empr);
if (count($perso_["FIELDS"])) {
    for ($ipp = 0; $ipp < count($perso_["FIELDS"]); $ipp++) {
        $p = $perso_["FIELDS"][$ipp];
        if ($p[OPAC_SHOW] == 1) {
            $tab_empr_info[$i]["titre"] = $p["TITRE_CLEAN"];
            $tab_empr_info[$i++]["val"] = $p["AFF"];
        }
    }
}
$adhesion = str_replace("!!date_adhesion!!", "<strong>" . $aff_empr_date_adhesion . "</strong>", $msg["empr_format_adhesion"]);
$adhesion = str_replace("!!date_expiration!!", "<strong>" . $aff_empr_date_expiration . "</strong>", $adhesion);
$tab_empr_info[$i]["titre"] = $msg["empr_tpl_adh"];
$tab_empr_info[$i++]["val"] = $adhesion;
if ($date_fin_blocage != "0000-00-00") {
    $date_blocage = array();
示例#13
0
 function fetch_info()
 {
     global $dbh;
     global $msg;
     global $charset;
     global $val_list_empr;
     global $pmb_gestion_financiere, $pmb_gestion_abonnement, $pmb_gestion_tarif_prets, $pmb_gestion_amende, $empr_header_format;
     global $deflt_docs_location;
     global $pmb_opac_view_activate, $pmb_sur_location_activate;
     if (!$this->id || !$dbh) {
         return FALSE;
     }
     $requete = "SELECT e.*, c.libelle AS code1, s.libelle AS code2, es.statut_libelle AS empr_statut_libelle, allow_loan, allow_book, allow_opac, allow_dsi, allow_dsi_priv, allow_sugg, allow_prol, d.location_libelle as localisation, date_format(empr_date_adhesion, '" . $msg["format_date"] . "') as aff_empr_date_adhesion, date_format(empr_date_expiration, '" . $msg["format_date"] . "') as aff_empr_date_expiration,date_format(last_loan_date, '" . $msg["format_date"] . "') as aff_last_loan_date FROM empr e left join docs_location as d on e.empr_location=d.idlocation, empr_categ c, empr_codestat s, empr_statut es ";
     $requete .= " WHERE e.id_empr='" . $this->id . "' ";
     $requete .= " AND c.id_categ_empr=e.empr_categ";
     $requete .= " AND s.idcode=e.empr_codestat";
     $requete .= " AND es.idstatut=e.empr_statut";
     $requete .= " LIMIT 1";
     $result = mysql_query($requete, $dbh) or die(mysql_error() . " " . $requete);
     if (!mysql_num_rows($result)) {
         return FALSE;
     }
     $empr = mysql_fetch_object($result);
     // affectation des propriétés
     $this->cb = $empr->empr_cb;
     // code barre emprunteur
     $this->nom = $empr->empr_nom;
     // nom emprunteur
     $this->prenom = $empr->empr_prenom;
     // prénom mprunteur
     $this->adr1 = $empr->empr_adr1;
     // adresse ligne 1
     $this->adr2 = $empr->empr_adr2;
     // adresse ligne 2
     $this->cp = $empr->empr_cp;
     // code postal
     $this->ville = $empr->empr_ville;
     // ville
     $this->pays = $empr->empr_pays;
     // ville
     $this->mail = $empr->empr_mail;
     // adresse email
     $this->tel1 = $empr->empr_tel1;
     // téléphone 1
     $this->sms = $empr->empr_sms;
     // sms activation
     $this->tel2 = $empr->empr_tel2;
     // téléphone 2
     $this->prof = $empr->empr_prof;
     // profession
     $this->birth = $empr->empr_year;
     // année de naissance
     $this->categ = $empr->empr_categ;
     // catégorie emprunteur
     $this->cstat = $empr->empr_codestat;
     // code statistique
     $this->cdate = $empr->empr_creation;
     // date de création
     $this->mdate = $empr->empr_modif;
     // date de modification
     $this->sexe = $empr->empr_sexe;
     // sexe de l'emprunteur
     $this->login = $empr->empr_login;
     // login pour services OPAC
     $this->pwd = $empr->empr_password;
     // mot de passe OPAC
     $this->type_abt = $empr->type_abt;
     // type d'abonnement
     $this->empr_location = $empr->empr_location;
     // localisation
     $this->empr_location_l = $empr->localisation;
     // localisation
     $this->date_blocage = $empr->date_fin_blocage;
     // Date de fin de blocage de l'emprunteur
     $this->empr_statut = $empr->empr_statut;
     $this->empr_statut_libelle = $empr->empr_statut_libelle;
     $this->total_loans = $empr->total_loans;
     $this->allow_loan = $empr->allow_loan;
     $this->allow_book = $empr->allow_book;
     $this->allow_opac = $empr->allow_opac;
     $this->allow_dsi = $empr->allow_dsi;
     $this->allow_dsi_priv = $empr->allow_dsi_priv;
     $this->allow_sugg = $empr->allow_sugg;
     $this->allow_prol = $empr->allow_prol;
     global $selector_prop_ajout_caddie_empr, $empr_show_caddie;
     if ($empr_show_caddie) {
         $this->img_ajout_empr_caddie = "<img src='./images/basket_empr.gif' alt='basket' title=\"{$msg[400]}\" ";
         $this->img_ajout_empr_caddie .= "onClick=\"openPopUp('./cart.php?object_type=EMPR&item=" . $this->id . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}');\">";
     } else {
         $this->img_ajout_empr_caddie = "";
     }
     $this->lien_nom_prenom = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($this->cb) . "'>{$this->nom},&nbsp;{$this->prenom}</a>";
     if ($pmb_opac_view_activate) {
         $this->opac_view = new opac_view(0, $this->id);
     }
     if ($pmb_sur_location_activate) {
         $sur_loc = sur_location::get_info_surloc_from_location($expl->idlocation);
     }
     $date_blocage = array();
     $date_blocage = explode("-", $this->date_blocage);
     if (mktime(0, 0, 0, $date_blocage[1], $date_blocage[2], $date_blocage[0]) > time()) {
         $this->blocage_active = true;
     }
     //Groupes
     $requete = "select id_groupe, libelle_groupe from groupe, empr_groupe where empr_id='" . $this->id . "' and id_groupe=groupe_id";
     $result = mysql_query($requete);
     if (mysql_num_rows($result)) {
         while ($grp_temp = mysql_fetch_object($result)) {
             $this->groupes[] = "<a href='./circ.php?categ=groups&action=showgroup&groupID=" . $grp_temp->id_groupe . "'>" . htmlentities($grp_temp->libelle_groupe, ENT_QUOTES, $charset) . "</a>";
         }
     } else {
         $this->groupes = array();
     }
     if ($empr->empr_ldap) {
         $this->ldap = 'LDAP';
         // flag AuthLdap
     } else {
         $this->ldap = 'MYSQL';
     }
     $this->date_adhesion = $empr->empr_date_adhesion;
     // début adhésion
     $this->date_expiration = $empr->empr_date_expiration;
     // fin adhésion
     $this->last_loan_date = $empr->last_loan_date;
     // date du dernier emprunt
     $this->aff_date_adhesion = $empr->aff_empr_date_adhesion;
     // début adhésion
     $this->aff_date_expiration = $empr->aff_empr_date_expiration;
     // fin adhésion
     $this->aff_last_loan_date = $empr->aff_last_loan_date;
     // date du dernier emprunt
     $this->empr_msg = $empr->empr_msg;
     // message emprunteur
     $this->cat_l = $empr->code1;
     // libellé catégorie emprunteur
     $this->cstat_l = $empr->code2;
     // libellé code statistique. voir ce bug avec Eric
     //Paramètres perso
     //Liste des champs
     $p_perso = new parametres_perso("empr");
     $perso_ = $p_perso->show_fields($this->id);
     $perso = "";
     $header_format = "";
     $class = "colonne3";
     $c = 0;
     if (count($perso_["FIELDS"])) {
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             if ($empr_header_format) {
                 $s = explode(",", $empr_header_format);
                 if (array_search($p["ID"], $s) !== FALSE) {
                     $header_format .= $p["TITRE"] . $p["AFF"] . "&nbsp;";
                 }
             }
             $perso .= "<div class='{$class}'>";
             $perso .= "<div class='row'>" . $p["TITRE"];
             $perso .= $p["AFF"] . "</div>";
             $perso .= "</div>";
             if ($c == 0) {
                 $c = 1;
             } else {
                 if ($c == 1) {
                     $class = "colonne_suite";
                     $c = 2;
                 } else {
                     if ($c == 2) {
                         $class = "colonne3";
                         $c = 0;
                     }
                 }
             }
         }
         $reste = 2 - $c;
         if ($c != 0) {
             for ($i = 0; $i < $reste; $i++) {
                 $perso .= "<div class='colonne3'>&nbsp;</div>";
                 $c++;
             }
             $perso .= "<div class='colonne_suite'>&nbsp;</div>";
         }
     }
     $this->header_format = $header_format;
     $this->perso = $perso;
 }
示例#14
0
 /**
  * Retourne les paramètres persos
  * @return array
  */
 public function get_p_perso()
 {
     if (!$this->p_perso) {
         $this->p_perso = array();
         if ($this->get_type_object() != AUT_TABLE_CONCEPT) {
             $parametres_perso = new parametres_perso($this->get_prefix_for_pperso());
             $ppersos = $parametres_perso->show_fields($this->num_object);
             if (is_array($ppersos['FIELDS'])) {
                 foreach ($ppersos['FIELDS'] as $pperso) {
                     $this->p_perso[] = $pperso;
                 }
             }
         }
     }
     return $this->p_perso;
 }
 /**
  * Génère la liste des exemplaires
  * @param int $notice_id Identifiant de la notice
  * @return string
  */
 public static function get_display_expl_responsive_list($notice_id)
 {
     global $dbh;
     global $msg, $charset;
     global $expl_list_header, $expl_list_footer;
     global $opac_expl_data, $opac_expl_order, $opac_url_base;
     global $pmb_transferts_actif, $transferts_statut_transferts;
     global $memo_p_perso_expl;
     global $opac_show_empty_items_block;
     global $opac_show_exemplaires_analysis;
     global $expl_list_header_loc_tpl, $opac_aff_expl_localises;
     global $opac_sur_location_activate;
     $nb_expl_autre_loc = 0;
     $nb_perso_aff = 0;
     $record_datas = static::get_record_datas($notice_id);
     $type = $record_datas->get_niveau_biblio();
     $id = $record_datas->get_id();
     $bull = $record_datas->get_bul_info();
     $bull_id = $bull['bulletin_id'];
     // les dépouillements ou périodiques n'ont pas d'exemplaire
     if ($type == "a" && !$opac_show_exemplaires_analysis || $type == "s") {
         return "";
     }
     if (!$memo_p_perso_expl) {
         $memo_p_perso_expl = new parametres_perso("expl");
     }
     $header_found_p_perso = 0;
     $expls_datas = $record_datas->get_expls_datas();
     $expl_list_header_deb = "<tr class='thead'>";
     foreach ($expls_datas['colonnesarray'] as $colonne) {
         $expl_list_header_deb .= "<th class='expl_header_" . $colonne . "'>" . htmlentities($msg['expl_header_' . $colonne], ENT_QUOTES, $charset) . "</th>";
     }
     $expl_list_header_deb .= "<th class='expl_header_statut'>" . $msg['statut'] . "</th>";
     $expl_liste = "";
     foreach ($expls_datas['expls'] as $expl) {
         $expl_liste .= "<tr class='item_expl !!class_statut!!'>";
         $colencours = "";
         foreach ($expls_datas['colonnesarray'] as $colonne) {
             $colencours = $expl[$colonne];
             if ($colonne == "location_libelle" && $expl['num_infopage']) {
                 if ($expl['surloc_id'] != "0") {
                     $param_surloc = "&surloc=" . $expl['surloc_id'];
                 } else {
                     $param_surloc = "";
                 }
                 $expl_liste .= "<td class='" . htmlentities($msg['expl_header_' . $colonne], ENT_QUOTES, $charset) . "'><a href=\"" . $opac_url_base . "index.php?lvl=infopages&pagesid=" . $expl['num_infopage'] . "&location=" . $expl['expl_location'] . $param_surloc . "\" alt=\"" . $msg['location_more_info'] . "\" title=\"" . $msg['location_more_info'] . "\">" . htmlentities($expl[$colonne], ENT_QUOTES, $charset) . "</a></td>";
             } else {
                 $expl_liste .= "<td class='" . htmlentities($msg['expl_header_' . $colonne], ENT_QUOTES, $charset) . "'>" . htmlentities($expl[$colonne], ENT_QUOTES, $charset) . "</td>";
             }
         }
         $situation = "";
         if ($expl['statut_libelle_opac'] != "") {
             $situation .= $expl['statut_libelle_opac'] . "<br />";
         }
         if ($expl['flag_resa']) {
             $situation .= "<strong>" . $msg['expl_reserve'] . "</strong>";
             $class_statut = "expl_reserve";
         } else {
             if ($expl['pret_flag']) {
                 if ($expl['pret_retour']) {
                     // exemplaire sorti
                     global $opac_show_empr;
                     if ($opac_show_empr == 1 && $_SESSION["user_code"] || $opac_show_empr == 2) {
                         $situation .= $msg['entete_show_empr'] . htmlentities(" " . $expl['empr_prenom'] . " " . $expl['empr_nom'], ENT_QUOTES, $charset) . "<br />";
                     }
                     $situation .= "<strong>" . $msg['out_until'] . " " . formatdate($expl['pret_retour']) . "</strong>";
                     $class_statut = "expl_out";
                     // ****** Affichage de l'emprunteur
                 } else {
                     // pas sorti
                     $situation .= "<strong>" . $msg['available'] . "</strong>";
                     $class_statut = "expl_available";
                 }
             } else {
                 // pas prêtable
                 // exemplaire pas prêtable, on affiche juste "exclu du pret"
                 if ($pmb_transferts_actif == "1" && "" . $expl['expl_statut'] . "" == $transferts_statut_transferts) {
                     $situation .= "<strong>" . $msg['reservation_lib_entransfert'] . "</strong>";
                     $class_statut = "expl_transfert";
                 } else {
                     $situation .= "<strong>" . $msg['exclu'] . "</strong>";
                     $class_statut = "expl_unavailable";
                 }
             }
         }
         // fin if else $flag_resa
         $expl_liste .= "<td class='" . $msg['statut'] . "'>" . $situation . " </td>";
         $expl_liste = str_replace("!!class_statut!!", $class_statut, $expl_liste);
         //Champs personalisés
         $perso_aff = "";
         if (!$memo_p_perso_expl->no_special_fields) {
             $perso_ = $memo_p_perso_expl->show_fields($expl['expl_id']);
             for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                 $p = $perso_["FIELDS"][$i];
                 if ($p['OPAC_SHOW']) {
                     if (!$header_found_p_perso) {
                         $header_perso_aff .= "<th class='expl_header_tdoc_libelle'>" . $p["TITRE_CLEAN"] . "</th>";
                         $nb_perso_aff++;
                     }
                     if ($p["AFF"]) {
                         $perso_aff .= "<td class='p_perso'>" . $p["AFF"] . "</td>";
                     } else {
                         $perso_aff .= "<td class='p_perso'>&nbsp;</td>";
                     }
                 }
             }
         }
         $header_found_p_perso = 1;
         $expl_liste .= $perso_aff;
         $expl_liste .= "</tr>";
         $expl_liste_all .= $expl_liste;
         if ($opac_aff_expl_localises && $_SESSION["empr_location"]) {
             if ($expl['expl_location'] == $_SESSION["empr_location"]) {
                 $expl_liste_loc .= $expl_liste;
             } else {
                 $nb_expl_autre_loc++;
             }
         }
         $expl_liste = "";
     }
     // fin while
     //S'il y a des titres de champs perso dans les exemplaires
     if ($header_perso_aff) {
         $expl_list_header_deb .= $header_perso_aff;
     }
     if ($opac_aff_expl_localises && $_SESSION["empr_location"] && $nb_expl_autre_loc) {
         // affichage avec onglet selon la localisation
         if (!$expl_liste_loc) {
             $expl_liste_loc = "<tr class=even><td colspan='" . (count($expls_datas['colonnesarray']) + 1 + $nb_perso_aff) . "'>" . $msg["no_expl"] . "</td></tr>";
         }
         $expl_liste_all = str_replace("!!EXPL!!", $expl_list_header_deb . $expl_liste_all, $expl_list_header_loc_tpl);
         $expl_liste_all = str_replace("!!EXPL_LOC!!", $expl_list_header_deb . $expl_liste_loc, $expl_liste_all);
         $expl_liste_all = str_replace("!!mylocation!!", $_SESSION["empr_location_libelle"], $expl_liste_all);
         $expl_liste_all = str_replace("!!id!!", $id + $bull_id, $expl_liste_all);
     } else {
         // affichage de la liste d'exemplaires calculée ci-dessus
         if (!$expl_liste_all && $opac_show_empty_items_block == 1) {
             $expl_liste_all = $expl_list_header . $expl_list_header_deb . "<tr class=even><td colspan='" . (count($expls_datas['colonnesarray']) + 1) . "'>" . $msg["no_expl"] . "</td></tr>" . $expl_list_footer;
         } elseif (!$expl_liste_all && $opac_show_empty_items_block == 0) {
             $expl_liste_all = "";
         } else {
             $expl_liste_all = $expl_list_header . $expl_list_header_deb . $expl_liste_all . $expl_list_footer;
         }
     }
     return $expl_liste_all;
 }
示例#16
0
function _export_($id, $keep_expl)
{
    global $charset, $msg;
    if (!$id) {
        return;
    }
    $requete = "select * from notices where notice_id=" . $id;
    $resultat = mysql_query($requete);
    $res = mysql_fetch_object($resultat);
    $environement["short"] = 1;
    $environement["ex"] = 0;
    $environement["exnum"] = 0;
    $environement["link"] = "";
    $environement["link_analysis"] = "";
    $environement["link_explnum"] = "";
    $environement["link_bulletin"] = "";
    if ($res->niveau_biblio != 's' && $res->niveau_biblio != 'a') {
        $display = new mono_display($id, $environement["short"], $environement["link"], $environement["ex"], $environement["link_expl"], '', $environement["link_explnum"], 0, 1);
        //récup des infos bulletins: bulletin_cb
        $requete = "select * from bulletins where num_notice=" . $id;
        $resultat_bul = mysql_query($requete);
        if (mysql_num_rows($resultat_bul)) {
            $res_bul = mysql_fetch_object($resultat_bul);
            $bulletin_cb = $res_bul->bulletin_cb;
        }
    } else {
        // on a affaire à un périodique
        $display = new serial_display($id, $environement["short"], $environement["link_serial"], $environement["link_analysis"], $environement["link_bulletin"], "", $environement["link_explnum"], 0, 0, 1, 1, true, 1);
    }
    //Champs personalisés
    $p_perso = new parametres_perso("notices");
    $perso_aff = $titre = $loc = $etablissement = $date = "";
    if (!$p_perso->no_special_fields) {
        $perso_ = $p_perso->show_fields($id);
        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
            $p = $perso_["FIELDS"][$i];
            if ($p['OPAC_SHOW'] && $p["AFF"]) {
                if ($p["NAME"] == "t_d_f_titre") {
                    $titre = $p["AFF"];
                } elseif ($p["NAME"] == "t_d_f_lieu_etabl") {
                    $loc = $p["AFF"];
                } elseif ($p["NAME"] == "t_d_f_etablissement") {
                    $etablissement = $p["AFF"];
                } elseif ($p["NAME"] == "t_d_f_date") {
                    $date = $p["AFF"];
                }
            }
        }
    }
    if ($titre) {
        $perso_aff = $titre;
    }
    if ($perso_aff && $loc) {
        $loc = explode("/", $loc);
        $perso_aff .= " ";
        $perso_aff .= $loc[0];
    }
    if ($perso_aff && $date) {
        $perso_aff .= ", ";
    }
    $perso_aff .= $date;
    if ($perso_aff) {
        $titre_de_forme = $msg["n_titre_de_forme"] . "[" . $perso_aff . "] ";
    }
    // langues
    $langues = "";
    if (count($display->langues)) {
        $langues = $msg[537] . " : " . construit_liste_langues($display->langues);
    }
    //	if(count($display->languesorg)) {
    //		$langues .= $msg[711]." : ".construit_liste_langues($display->languesorg);
    //	}
    if ($langues) {
        $langues = "\n" . $langues;
    }
    $notice = "<notice>\n";
    //notice (ID)
    $notice .= "<ID>{$id}</ID>\n";
    //isbn (ISBN)
    if ($display->isbn) {
        $notice .= "<ISBN>" . htmlspecialchars($display->isbn, ENT_QUOTES, $charset) . "</ISBN>\n";
    } elseif ($bulletin_cb) {
        $notice .= "<ISBN>" . htmlspecialchars($bulletin_cb, ENT_QUOTES, $charset) . "</ISBN>\n";
    }
    //Année publication(YEAR)
    if ($display->notice->year) {
        $notice .= "<YEAR>" . htmlspecialchars($display->notice->year, ENT_QUOTES, $charset) . "</YEAR>\n";
    }
    //isbd(ISBD)
    $display_isbd = mba_isbd($display);
    //if ($display->isbd) {
    //	$isbd=str_replace("<br />","\n",$titre_de_forme.$display->isbd.$langues);
    $isbd = str_replace("<br />", " ", $titre_de_forme . $display_isbd);
    if ($display->notice->lien) {
        $isbd .= " " . $display->notice->lien;
    }
    $isbd = strip_tags($isbd);
    $notice .= "<ISBD>" . htmlspecialchars(html_entity_decode($isbd, ENT_QUOTES, $charset), ENT_QUOTES, $charset) . "</ISBD>\n";
    //}
    $notice .= "</notice>\n";
    return $notice;
}