예제 #1
0
function traite_rqt($requete = "", $message = "")
{
    global $dbh, $charset;
    $retour = "";
    /*if($charset == "utf-8"){ //Contrairement au addon ce n'est pas à faire car dans les fichiers alter_vX.inc.php on fait un set names latin1
    		$requete=utf8_encode($requete);
    	}*/
    $res = pmb_mysql_query($requete, $dbh);
    $erreur_no = pmb_mysql_errno();
    if (!$erreur_no) {
        $retour = "Successful";
    } else {
        switch ($erreur_no) {
            case "1060":
                $retour = "Field already exists, no problem.";
                break;
            case "1061":
                $retour = "Key already exists, no problem.";
                break;
            case "1091":
                $retour = "Object already deleted, no problem.";
                break;
            default:
                $retour = "<font color=\"#FF0000\">Error may be fatal : <i>" . pmb_mysql_error() . "<i></font>";
                break;
        }
    }
    return "<tr><td><font size='1'>" . ($charset == "utf-8" ? utf8_encode($message) : $message) . "</font></td><td><font size='1'>" . $retour . "</font></td></tr>";
}
예제 #2
0
 function getData()
 {
     global $dbh;
     if (!$this->s_id) {
         // pas d'identifiant. on retourne un tableau vide
         $this->s_id = 0;
         $this->name = '';
         $this->index = '';
         $this->num_statut = 1;
     } else {
         $requete = "SELECT * FROM series WHERE serie_id='" . $this->s_id . "' ";
         $result = pmb_mysql_query($requete, $dbh) or die($requete . "<br />" . pmb_mysql_error());
         if (pmb_mysql_num_rows($result)) {
             $temp = pmb_mysql_fetch_object($result);
             $this->s_id = $temp->serie_id;
             $this->name = $temp->serie_name;
             $this->index = $temp->serie_index;
             $authority = new authority(0, $this->s_id, AUT_TABLE_SERIES);
             $this->num_statut = $authority->get_num_statut();
             // Ajoute un lien sur la fiche série si l'utilisateur à accès aux autorités
             if (SESSrights & AUTORITES_AUTH) {
                 //$this->isbd_entry_lien_gestion = "<a href='./autorites.php?categ=series&sub=serie_form&id=".$this->s_id."' class='lien_gestion'>".$this->name."</a>";
                 $this->isbd_entry_lien_gestion = "<a href='./autorites.php?categ=see&sub=serie&id=" . $this->s_id . "' class='lien_gestion'>" . $this->name . "</a>";
             } else {
                 $this->isbd_entry_lien_gestion = $this->name;
             }
         } else {
             // pas de titre avec cette clé
             $this->s_id = 0;
             $this->name = '';
             $this->index = '';
             $this->num_statut = 1;
         }
     }
 }
예제 #3
0
 function getData()
 {
     global $dbh;
     if (!$this->indexint_id) {
         if ($this->name) {
             // rech par cote et non par $id
             $requete = "SELECT indexint_id,indexint_name,indexint_comment,num_pclass FROM indexint WHERE indexint_name='" . $this->name . "' ";
             $result = pmb_mysql_query($requete, $dbh) or die($requete . "<br />" . pmb_mysql_error());
             if (pmb_mysql_num_rows($result)) {
                 $temp = pmb_mysql_fetch_object($result);
                 $this->indexint_id = $temp->indexint_id;
                 $this->name = $temp->indexint_name;
                 $this->comment = $temp->indexint_comment;
                 $this->pclass = $temp->num_pclass;
                 if ($this->comment) {
                     $this->display = $this->name . " ({$this->comment})";
                 } else {
                     $this->display = $this->name;
                 }
             } else {
                 // pas de titre avec cette clé
                 $this->indexint_id = 0;
                 $this->name = '';
                 $this->comment = '';
                 $this->pclass = 0;
                 $this->display = "";
             }
         } else {
             // pas d'identifiant. on retourne un tableau vide
             $this->indexint_id = 0;
             $this->name = '';
             $this->comment = '';
             $this->pclass = 0;
             $this->display = "";
         }
     } else {
         $requete = "SELECT indexint_id,indexint_name,indexint_comment,num_pclass FROM indexint WHERE indexint_id='" . $this->indexint_id . "' ";
         $result = pmb_mysql_query($requete, $dbh) or die($requete . "<br />" . pmb_mysql_error());
         if (pmb_mysql_num_rows($result)) {
             $temp = pmb_mysql_fetch_object($result);
             $this->indexint_id = $temp->indexint_id;
             $this->name = $temp->indexint_name;
             $this->comment = $temp->indexint_comment;
             $this->pclass = $temp->num_pclass;
             if ($this->comment) {
                 $this->display = $this->name . " ({$this->comment})";
             } else {
                 $this->display = $this->name;
             }
         } else {
             // pas de titre avec cette clé
             $this->indexint_id = 0;
             $this->name = '';
             $this->comment = '';
             $this->pclass = 0;
             $this->display = "";
         }
     }
     $this->cherche_child();
 }
예제 #4
0
function traite_rqt($requete = "", $message = "")
{
    global $dbh, $charset;
    $retour = "";
    if ($charset == "utf-8") {
        $requete = utf8_encode($requete);
    }
    $res = pmb_mysql_query($requete, $dbh);
    $erreur_no = pmb_mysql_errno();
    if (!$erreur_no) {
        $retour = "Successful";
    } else {
        switch ($erreur_no) {
            case "1060":
                $retour = "Field already exists, no problem.";
                break;
            case "1061":
                $retour = "Key already exists, no problem.";
                break;
            case "1091":
                $retour = "Object already deleted, no problem.";
                break;
            default:
                $retour = "<font color=\"#FF0000\">Error may be fatal : <i>" . pmb_mysql_error() . "<i></font>";
                break;
        }
    }
    return "<tr><td><font size='1'>" . ($charset == "utf-8" ? utf8_encode($message) : $message) . "</font></td><td><font size='1'>" . $retour . "</font></td></tr>";
}
예제 #5
0
function cpt_transferts($clause_where)
{
    global $deflt_docs_location;
    global $msg;
    $rqt = "SELECT 1 " . "FROM transferts " . "INNER JOIN transferts_demande ON id_transfert = num_transfert " . "WHERE " . $clause_where . " " . "LIMIT 1";
    //echo $rqt."<br />";
    $req = pmb_mysql_query($rqt) or die($msg["err_sql"] . "<br />" . $rqt . "<br />" . pmb_mysql_error());
    $nb_limite = pmb_mysql_num_rows($req);
    return $nb_limite;
}
예제 #6
0
function my_error($echo = 1)
{
    if (!pmb_mysql_errno()) {
        return "";
    }
    $erreur = 'erreur ' . pmb_mysql_errno() . ' : ' . pmb_mysql_error() . '<br />';
    if ($echo) {
        echo $erreur;
    } else {
        trigger_error($erreur, E_USER_ERROR);
        return $erreur;
    }
}
예제 #7
0
function alerte_demandes()
{
    global $dbh;
    global $msg;
    // comptage des demandes à valider
    $sql = " SELECT 1 FROM demandes where etat_demande=1 limit 1";
    $req = pmb_mysql_query($sql) or die($msg["err_sql"] . "<br />" . $sql . "<br />" . pmb_mysql_error());
    $nb_limite = pmb_mysql_num_rows($req);
    if (!$nb_limite) {
        return "";
    } else {
        return "<li><a href='./demandes.php?categ=list&idetat=1' target='_parent'>{$msg['alerte_demandes_traiter']}</a></li>";
    }
}
예제 #8
0
 static function get_info_surloc_from_location($id_docs_location = 0)
 {
     global $dbh;
     if ($id_docs_location) {
         $requete = "SELECT * FROM docs_location where idlocation='{$id_docs_location}'";
         $res = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . "<br />{$requete}");
         if (pmb_mysql_num_rows($res)) {
             $row = pmb_mysql_fetch_object($res);
             if ($row->surloc_num) {
                 $sur_loc = new sur_location($row->surloc_num);
                 return $sur_loc;
             }
         }
     }
     return $sur_loc = new sur_location();
 }
예제 #9
0
function expl_retour_todo()
{
    global $dbh;
    global $msg;
    global $deflt_docs_location;
    if (!$deflt_docs_location) {
        return "";
    }
    $sql = "SELECT expl_id FROM exemplaires where expl_retloc='{$deflt_docs_location}' limit 1";
    $req = pmb_mysql_query($sql) or die($msg["err_sql"] . "<br />" . $sql . "<br />" . pmb_mysql_error());
    $nb = pmb_mysql_num_rows($req);
    if (!$nb) {
        return "";
    } else {
        return "<li><a href='./circ.php?categ=ret_todo' target='_parent'>" . $msg["alert_circ_retour_todo"] . "</a></li>";
    }
}
예제 #10
0
function alerte_sugg()
{
    global $dbh;
    global $msg;
    global $opac_show_suggest;
    if (!$opac_show_suggest) {
        return "";
    }
    // comptage des tags à valider
    $sql = " SELECT 1 FROM suggestions where statut=1 limit 1";
    $req = pmb_mysql_query($sql) or die($msg["err_sql"] . "<br />" . $sql . "<br />" . pmb_mysql_error());
    $nb_limite = pmb_mysql_num_rows($req);
    if (!$nb_limite) {
        return "";
    } else {
        return "<li><a href='./acquisition.php?categ=sug&action=list&statut=1' target='_parent'>{$msg['alerte_suggestion_traiter']}</a></li>";
    }
}
예제 #11
0
function alerte_avis()
{
    global $dbh;
    global $msg;
    global $opac_avis_allow;
    if (!$opac_avis_allow) {
        return "";
    }
    // comptage des avis à valider
    $sql = " SELECT 1 FROM avis where valide=0 limit 1";
    $req = pmb_mysql_query($sql) or die($msg["err_sql"] . "<br />" . $sql . "<br />" . pmb_mysql_error());
    $nb_depasse = pmb_mysql_num_rows($req);
    if (!$nb_depasse) {
        return "";
    } else {
        return "<li><a href='./catalog.php?categ=avis' target='_parent'>{$msg['alerte_avis_a_valider']}</a></li>";
    }
}
예제 #12
0
function get_info_expl($cb_doc)
{
    global $dbh, $msg;
    $requete = "SELECT notices_m.notice_id as m_id, notices_s.notice_id as s_id, expl_cb, expl_cote, expl_location,pret_date, pret_retour, tdoc_libelle, section_libelle, location_libelle, trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, ";
    $requete .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, ";
    $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, ";
    $requete .= " IF(pret_retour>sysdate(),0,1) as retard, notices_m.tparent_id, notices_m.tnvol ";
    $requete .= " FROM (((exemplaires LEFT JOIN notices AS notices_m ON expl_notice = notices_m.notice_id ) LEFT JOIN bulletins ON expl_bulletin = bulletins.bulletin_id) LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), docs_type, docs_section, docs_location, pret ";
    $requete .= " WHERE expl_cb='" . $cb_doc . "' and expl_typdoc = idtyp_doc and expl_section = idsection and expl_location = idlocation and pret_idexpl = expl_id  ";
    $res = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error());
    $expl = pmb_mysql_fetch_object($res);
    $responsabilites = get_notice_authors($expl->m_id + $expl->s_id);
    $as = array_search("0", $responsabilites["responsabilites"]);
    if ($as !== FALSE && $as !== NULL) {
        $auteur_0 = $responsabilites["auteurs"][$as];
        $auteur = new auteur($auteur_0["id"]);
        $header_aut .= $auteur->isbd_entry;
    } else {
        $aut1_libelle = array();
        $as = array_keys($responsabilites["responsabilites"], "1");
        for ($i = 0; $i < count($as); $i++) {
            $indice = $as[$i];
            $auteur_1 = $responsabilites["auteurs"][$indice];
            $auteur = new auteur($auteur_1["id"]);
            $aut1_libelle[] = $auteur->isbd_entry;
        }
        $header_aut .= implode(", ", $aut1_libelle);
    }
    $header_aut ? $auteur = " / " . $header_aut : ($auteur = "");
    $expl->header_aut = $header_aut;
    // récupération du titre de série
    if ($expl->tparent_id && $expl->m_id) {
        $parent = new serie($expl->tparent_id);
        $tit_serie = $parent->name;
        if ($expl->tnvol) {
            $tit_serie .= ', ' . $expl->tnvol;
        }
    }
    if ($tit_serie) {
        $expl->tit = $tit_serie . '. ' . $expl->tit;
    }
    return $expl;
}
예제 #13
0
 static function add_days($dd, $md, $yd, $days)
 {
     global $pmb_utiliser_calendrier;
     global $deflt2docs_location;
     if ($pmb_utiliser_calendrier) {
         $requete = "select min(date_ouverture) from ouvertures where ouvert=1 and num_location={$deflt2docs_location} and date_ouverture>=adddate('" . $yd . "-" . $md . "-" . $dd . "', interval {$days} day)";
         $resultat = pmb_mysql_query($requete) or die($requete . " " . pmb_mysql_error());
         if (!@pmb_mysql_num_rows($resultat)) {
             $requete = "select adddate('" . $yd . "-" . $md . "-" . $dd . "', interval {$days} day)";
             $resultat = pmb_mysql_query($requete) or die($requete . " " . pmb_mysql_error());
         }
         if ($date = pmb_mysql_result($resultat, 0, 0)) {
             return $date;
         }
     }
     $requete = "select adddate('" . $yd . "-" . $md . "-" . $dd . "', interval {$days} day)";
     $resultat = pmb_mysql_query($requete) or die($requete . " " . pmb_mysql_error());
     $date = pmb_mysql_result($resultat, 0, 0);
     return $date;
 }
예제 #14
0
function empr_categ_change()
{
    global $dbh;
    global $msg;
    global $pmb_lecteurs_localises, $deflt2docs_location;
    // comptage des emprunteurs qui n'ont pas le droit d'être dans la catégorie
    $sql = "select 1 from empr left join empr_categ on empr_categ = id_categ_empr ";
    $sql .= " where ((((age_min<> 0) || (age_max <> 0)) && (age_max >= age_min)) && (((DATE_FORMAT( curdate() , '%Y' )-empr_year) < age_min) || ((DATE_FORMAT( curdate() , '%Y' )-empr_year) > age_max)))";
    // restriction localisation le cas échéant
    if ($pmb_lecteurs_localises) {
        $sql .= " AND empr_location='{$deflt2docs_location}' ";
    }
    $req = pmb_mysql_query($sql) or die($msg["err_sql"] . "<br />" . $sql . "<br />" . pmb_mysql_error());
    $nb_change = pmb_mysql_num_rows($req);
    if (!$nb_change) {
        return "";
    } else {
        return "<li><a href='./edit.php?categ=empr&sub=categ_change' target='_parent'>{$msg['empr_change_categ_todo']}</a></li>";
    }
}
예제 #15
0
 function getData()
 {
     global $dbh;
     if ($this->idlender == "") {
         // pas d'identifiant. on retourne un tableau vide
         $this->idlender = 0;
         $this->lender_libelle = "";
     } else {
         $requete = "SELECT idlender, lender_libelle FROM lenders WHERE idlender='" . $this->idlender . "' LIMIT 1 " or die(pmb_mysql_error());
         $result = pmb_mysql_query($requete, $dbh);
         if (pmb_mysql_num_rows($result)) {
             $temp = pmb_mysql_fetch_object($result);
             $this->idlender = $temp->idlender;
             $this->lender_libelle = $temp->lender_libelle;
         } else {
             // pas de lender avec cette clé
             $this->idlender = 0;
             $this->lender_libelle = "";
         }
     }
 }
예제 #16
0
function show_procs($dbh)
{
    global $msg;
    global $PMBuserid;
    print "<hr /><table>";
    // affichage du tableau des procédures
    if ($PMBuserid != 1) {
        $where = " where (autorisations='{$PMBuserid}' or autorisations like '{$PMBuserid} %' or autorisations like '% {$PMBuserid} %' or autorisations like '% {$PMBuserid}') ";
    }
    $requete = "SELECT idproc, type, name, requete, comment, autorisations FROM empr_caddie_procs {$where} ORDER BY type, name ";
    $res = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . $requete);
    $nbr = pmb_mysql_num_rows($res);
    $parity = 1;
    for ($i = 0; $i < $nbr; $i++) {
        $row = pmb_mysql_fetch_row($res);
        $rqt_autorisation = explode(" ", $row[5]);
        if (array_search($PMBuserid, $rqt_autorisation) !== FALSE || $PMBuserid == 1) {
            if ($parity % 2) {
                $pair_impair = "even";
            } else {
                $pair_impair = "odd";
            }
            $parity += 1;
            $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./circ.php?categ=caddie&sub=gestion&quoi=procs&action=modif&id={$row['0']}';\" ";
            print "<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>\n        \t\t<td width='10'>\n        \t\t";
            if ($row[1] != "ACTION") {
                print "\t<input class='bouton' type='button' value=' {$msg['procs_options_tester_requete']} ' onClick=\"document.location='./circ.php?categ=caddie&sub=gestion&quoi=procs&action=execute&id={$row['0']}'\" />";
            } else {
                print "&nbsp;";
            }
            print "\n\t\t\t\t\t</td>\n\t\t\t\t\t<td width='80'>\n\t\t\t\t\t\t{$row['1']}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<strong>{$row['2']}</strong><br />\n\t\t\t\t\t\t<small>{$row['4']}&nbsp;</small>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<td>";
            if (preg_match_all("|!!(.*)!!|U", $row[3], $query_parameters)) {
                print "<a href='./circ.php?categ=caddie&sub=gestion&quoi=procs&action=configure&id_query=" . $row[0] . "'>{$msg['procs_options_config_param']}</a>";
            }
            print "</td>";
            print "<td><input class='bouton' type='button' value=\"" . $msg[procs_bt_export] . "\" onClick=\"document.location='./export.php?quoi=procs&sub=empr_caddie&id={$row['0']}'\" /></td>\n\t\t\t\t\t\t</tr>";
        }
    }
    print "</table><hr />\n\t\t<input class='bouton' type='button' value=' {$msg['704']} ' onClick=\"document.location='./circ.php?categ=caddie&sub=gestion&quoi=procs&action=add'\" />\n\t\t<input class='bouton' type='button' value=' {$msg['procs_bt_import']} ' onClick=\"document.location='./circ.php?categ=caddie&sub=gestion&quoi=procs&action=import'\" />";
}
예제 #17
0
 function getData()
 {
     global $dbh;
     global $msg;
     if (!$this->id_equation) {
         // pas d'identifiant. on retourne un tableau vide
         $this->id_equation = 0;
         $this->num_classement = 1;
         $this->nom_equation = "";
         $this->comment_equation = "";
         $this->requete = "";
         $this->proprio_equation = 0;
         $this->human_query = "";
     } else {
         $requete = "SELECT id_equation, num_classement, nom_equation,comment_equation,requete, proprio_equation FROM equations WHERE id_equation='" . $this->id_equation . "' ";
         $result = pmb_mysql_query($requete, $dbh) or die($requete . "<br /> in equation.class.php : " . pmb_mysql_error());
         if (pmb_mysql_num_rows($result)) {
             $temp = pmb_mysql_fetch_object($result);
             $this->id_equation = $temp->id_equation;
             $this->num_classement = $temp->num_classement;
             $this->nom_equation = $temp->nom_equation;
             $this->comment_equation = $temp->comment_equation;
             $this->requete = $temp->requete;
             $this->proprio_equation = $temp->proprio_equation;
             $this->human_query = $this->search_class->make_serialized_human_query($this->requete);
         } else {
             // pas de bannette avec cette clé
             $this->id_equation = 0;
             $this->num_classement = 1;
             $this->nom_equation = "";
             $this->comment_equation = "";
             $this->requete = "";
             $this->proprio_equation = 0;
             $this->human_query = "";
         }
     }
 }
 private function opacitem_globals_list($opacitem)
 {
     $globals_list = array();
     //on recharge du formulaire si il a déjà été saisi.
     if ($this->parameters['opacitem'] == $opacitem && sizeof($this->parameters['globals'])) {
         foreach ($this->parameters['globals'] as $globalName => $globalValue) {
             $globals_list[$globalName] = $globalValue;
         }
     } else {
         switch ($opacitem) {
             case 'cms_module_opacitem_item_infopage':
                 global $opac_show_infopages_id;
                 global $opac_show_infopages_id_top;
                 $globals_list['opac_show_infopages_id']['value'] = $opac_show_infopages_id;
                 $globals_list['opac_show_infopages_id_top']['value'] = $opac_show_infopages_id_top;
                 break;
             case 'cms_module_opacitem_item_navperio':
                 global $opac_perio_a2z_abc_search;
                 global $opac_perio_a2z_max_per_onglet;
                 global $opac_bull_results_per_page;
                 global $opac_notices_depliable;
                 global $opac_sur_location_activate;
                 global $opac_fonction_affichage_liste_bull;
                 global $opac_visionneuse_allow;
                 global $opac_cart_allow;
                 global $opac_max_resa;
                 global $opac_resa_planning;
                 global $opac_show_exemplaires;
                 global $opac_resa_popup;
                 global $opac_resa;
                 global $opac_perio_a2z_show_bulletin_notice;
                 $globals_list['opac_perio_a2z_abc_search']['value'] = $opac_perio_a2z_abc_search;
                 $globals_list['opac_perio_a2z_max_per_onglet']['value'] = $opac_perio_a2z_max_per_onglet;
                 $globals_list['opac_bull_results_per_page']['value'] = $opac_bull_results_per_page;
                 $globals_list['opac_notices_depliable']['value'] = $opac_notices_depliable;
                 $globals_list['opac_sur_location_activate']['value'] = $opac_sur_location_activate;
                 $globals_list['opac_fonction_affichage_liste_bull']['value'] = $opac_fonction_affichage_liste_bull;
                 $globals_list['opac_visionneuse_allow']['value'] = $opac_visionneuse_allow;
                 $globals_list['opac_cart_allow']['value'] = $opac_cart_allow;
                 $globals_list['opac_max_resa']['value'] = $opac_max_resa;
                 $globals_list['opac_resa_planning']['value'] = $opac_resa_planning;
                 $globals_list['opac_show_exemplaires']['value'] = $opac_show_exemplaires;
                 $globals_list['opac_resa_popup']['value'] = $opac_resa_popup;
                 $globals_list['opac_resa']['value'] = $opac_resa;
                 $globals_list['opac_perio_a2z_show_bulletin_notice']['value'] = $opac_perio_a2z_show_bulletin_notice;
                 break;
             case 'cms_module_opacitem_item_categ':
                 global $opac_show_categ_browser;
                 global $opac_show_categ_browser_tab;
                 global $opac_show_categ_browser_home_id_thes;
                 global $opac_categories_max_display;
                 global $opac_categories_nav_max_display;
                 global $opac_thesaurus_defaut;
                 global $opac_categories_sub_mode;
                 global $opac_categories_sub_display;
                 global $opac_thesaurus;
                 global $opac_categories_columns;
                 $globals_list['opac_show_categ_browser']['value'] = $opac_show_categ_browser;
                 $globals_list['opac_show_categ_browser_tab']['value'] = $opac_show_categ_browser_tab;
                 $globals_list['opac_show_categ_browser_home_id_thes']['value'] = $opac_show_categ_browser_home_id_thes;
                 $globals_list['opac_categories_max_display']['value'] = $opac_categories_max_display;
                 $globals_list['opac_categories_nav_max_display']['value'] = $opac_categories_nav_max_display;
                 $globals_list['opac_thesaurus_defaut']['value'] = $opac_thesaurus_defaut;
                 $globals_list['opac_categories_sub_mode']['value'] = $opac_categories_sub_mode;
                 $globals_list['opac_categories_sub_display']['value'] = $opac_categories_sub_display;
                 $globals_list['opac_thesaurus']['value'] = $opac_thesaurus;
                 $globals_list['opac_categories_columns']['value'] = $opac_categories_columns;
                 break;
             case 'cms_module_opacitem_item_bannettes_abo':
                 global $opac_show_subscribed_bannettes;
                 global $opac_bannette_nb_liste;
                 global $opac_bannette_notices_format;
                 global $opac_bannette_notices_depliables;
                 $globals_list['opac_show_subscribed_bannettes']['value'] = $opac_show_subscribed_bannettes;
                 $globals_list['opac_bannette_nb_liste']['value'] = $opac_bannette_nb_liste;
                 $globals_list['opac_bannette_notices_format']['value'] = $opac_bannette_notices_format;
                 $globals_list['opac_bannette_notices_depliables']['value'] = $opac_bannette_notices_depliables;
                 break;
             case 'cms_module_opacitem_item_bannettes_pub':
                 global $opac_show_public_bannettes;
                 global $opac_bannette_nb_liste;
                 global $opac_bannette_notices_format;
                 global $opac_bannette_notices_depliables;
                 $globals_list['opac_show_public_bannettes']['value'] = $opac_show_public_bannettes;
                 $globals_list['opac_bannette_nb_liste']['value'] = $opac_bannette_nb_liste;
                 $globals_list['opac_bannette_notices_format']['value'] = $opac_bannette_notices_format;
                 $globals_list['opac_bannette_notices_depliables']['value'] = $opac_bannette_notices_depliables;
                 break;
             case 'cms_module_opacitem_item_section':
                 global $opac_show_section_browser;
                 global $opac_sur_location_activate;
                 global $opac_nb_localisations_per_line;
                 $globals_list['opac_show_section_browser']['value'] = $opac_show_section_browser;
                 $globals_list['opac_sur_location_activate']['value'] = $opac_sur_location_activate;
                 $globals_list['opac_nb_localisations_per_line']['value'] = $opac_nb_localisations_per_line;
                 break;
             case 'cms_module_opacitem_item_margueritte':
                 global $opac_show_marguerite_browser;
                 $globals_list['opac_show_marguerite_browser']['value'] = $opac_show_marguerite_browser;
                 break;
             case 'cms_module_opacitem_item_centcases':
                 global $opac_show_100cases_browser;
                 $globals_list['opac_show_100cases_browser']['value'] = $opac_show_100cases_browser;
                 break;
             case 'cms_module_opacitem_item_dernotices':
                 global $opac_show_dernieresnotices;
                 global $opac_show_dernieresnotices_nb;
                 $globals_list['opac_show_dernieresnotices']['value'] = $opac_show_dernieresnotices;
                 $globals_list['opac_show_dernieresnotices_nb']['value'] = $opac_show_dernieresnotices_nb;
                 break;
             case 'cms_module_opacitem_item_etageres':
                 global $opac_show_etageresaccueil;
                 global $opac_etagere_nbnotices_accueil;
                 global $opac_etagere_notices_format;
                 global $opac_etagere_notices_depliables;
                 global $opac_websubscribe_show;
                 global $opac_password_forgotten_show;
                 global $opac_photo_filtre_mimetype;
                 global $opac_explnum_order;
                 global $opac_show_links_invisible_docnums;
                 global $opac_photo_mean_size_x;
                 global $opac_photo_mean_size_y;
                 global $opac_photo_watermark;
                 global $opac_photo_watermark_transparency;
                 global $opac_default_sort;
                 global $opac_default_sort_list;
                 global $opac_nb_max_criteres_tri;
                 global $opac_etagere_order;
                 global $opac_etagere_notices_order;
                 $globals_list['opac_show_etageresaccueil']['value'] = $opac_show_etageresaccueil;
                 $globals_list['opac_etagere_nbnotices_accueil']['value'] = $opac_etagere_nbnotices_accueil;
                 $globals_list['opac_etagere_notices_format']['value'] = $opac_etagere_notices_format;
                 $globals_list['opac_etagere_notices_depliables']['value'] = $opac_etagere_notices_depliables;
                 $globals_list['opac_websubscribe_show']['value'] = $opac_websubscribe_show;
                 $globals_list['opac_password_forgotten_show']['value'] = $opac_password_forgotten_show;
                 $globals_list['opac_photo_filtre_mimetype']['value'] = $opac_photo_filtre_mimetype;
                 $globals_list['opac_explnum_order']['value'] = $opac_explnum_order;
                 $globals_list['opac_show_links_invisible_docnums']['value'] = $opac_show_links_invisible_docnums;
                 $globals_list['opac_photo_mean_size_x']['value'] = $opac_photo_mean_size_x;
                 $globals_list['opac_photo_mean_size_y']['value'] = $opac_photo_mean_size_y;
                 $globals_list['opac_photo_watermark']['value'] = $opac_photo_watermark;
                 $globals_list['opac_photo_watermark_transparency']['value'] = $opac_photo_watermark_transparency;
                 $globals_list['opac_default_sort']['value'] = $opac_default_sort;
                 $globals_list['opac_default_sort_list']['value'] = $opac_default_sort_list;
                 $globals_list['opac_nb_max_criteres_tri']['value'] = $opac_nb_max_criteres_tri;
                 $globals_list['opac_etagere_order']['value'] = $opac_etagere_order;
                 $globals_list['opac_etagere_notices_order']['value'] = $opac_etagere_notices_order;
                 break;
             case 'cms_module_opacitem_item_rssflux':
                 global $opac_show_rss_browser;
                 global $opac_curl_available;
                 $globals_list['opac_show_rss_browser']['value'] = $opac_show_rss_browser;
                 $globals_list['opac_curl_available']['value'] = $opac_curl_available;
                 break;
         }
     }
     $query = 'SELECT type_param,sstype_param,comment_param FROM parametres WHERE CONCAT(type_param,"_",sstype_param) IN ("' . implode('","', array_keys($globals_list)) . '")';
     $result = pmb_mysql_query($query);
     if (!pmb_mysql_error() && pmb_mysql_num_rows($result)) {
         while ($param = pmb_mysql_fetch_array($result, MYSQL_ASSOC)) {
             if (sizeof($globals_list[$param['type_param'] . '_' . $param['sstype_param']])) {
                 $globals_list[$param['type_param'] . '_' . $param['sstype_param']] += $param;
             }
         }
     }
     return $globals_list;
 }
예제 #19
0
 function show_expl_per_notice($no_notice, $link_expl = '', $expl_bulletin = 0)
 {
     global $msg, $dbh, $base_path, $class_path;
     global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises, $transferts_gestion_transferts;
     global $pmb_expl_list_display_comments;
     global $pmb_sur_location_activate;
     global $pmb_url_base, $pmb_expl_data, $charset;
     global $pmb_expl_display_location_without_expl;
     global $pmb_html_allow_expl_cote;
     // params :
     // $no_notice= id de la notice
     // $link_expl= lien associé à l'exemplaire avec !!expl_id!! et !!expl_cb!! à mettre à jour
     if (!$no_notice && !$expl_bulletin) {
         return;
     }
     $explr_tab_invis = explode(",", $explr_invisible);
     $explr_tab_unmod = explode(",", $explr_visible_unmod);
     $explr_tab_modif = explode(",", $explr_visible_mod);
     // récupération du nombre total d'exemplaires
     if ($expl_bulletin) {
         $requete = "SELECT COUNT(1) FROM exemplaires WHERE expl_bulletin='{$expl_bulletin}' ";
     } else {
         $requete = "SELECT COUNT(1) FROM exemplaires WHERE expl_notice='{$no_notice}' ";
     }
     $res = pmb_mysql_query($requete, $dbh);
     $nb_ex = pmb_mysql_result($res, 0, 0);
     if ($nb_ex) {
         // on récupère les données des exemplaires
         // visibilité des exemplaires:
         if ($pmb_droits_explr_localises && $explr_invisible) {
             $where_expl_localises = "and expl_location not in ({$explr_invisible})";
         } else {
             $where_expl_localises = "";
         }
         //Liste des champs d'exemplaires
         if ($pmb_sur_location_activate) {
             $surloc_field = "surloc_libelle,";
         }
         if (!$pmb_expl_data) {
             $pmb_expl_data = "expl_cb,expl_cote," . $surloc_field . "location_libelle,section_libelle,statut_libelle,tdoc_libelle";
         }
         $colonnesarray = explode(",", $pmb_expl_data);
         if (!in_array("expl_cb", $colonnesarray)) {
             array_unshift($colonnesarray, "expl_cb");
         }
         $total_columns = count($colonnesarray);
         //Présence de champs personnalisés
         if (strstr($pmb_expl_data, "#")) {
             require_once $class_path . "/parametres_perso.class.php";
             $cp = new parametres_perso("expl");
         }
         if ($expl_bulletin) {
             $where_expl_notice_expl_bulletin = " expl_bulletin='{$expl_bulletin}' ";
         } else {
             $where_expl_notice_expl_bulletin = " expl_notice='{$no_notice}' ";
         }
         $requete = "SELECT exemplaires.*, pret.*, docs_location.*, docs_section.*, docs_statut.*, docs_codestat.*, lenders.*, tdoc_libelle, ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= "sur_location.*, ";
         }
         $requete .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, ";
         $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, ";
         $requete .= " IF(pret_retour>sysdate(),0,1) as retard ";
         $requete .= " FROM exemplaires LEFT JOIN pret ON exemplaires.expl_id=pret.pret_idexpl ";
         $requete .= " left join docs_location on exemplaires.expl_location=docs_location.idlocation ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= " left join sur_location on docs_location.surloc_num=sur_location.surloc_id ";
         }
         $requete .= " left join docs_section on exemplaires.expl_section=docs_section.idsection ";
         $requete .= " left join docs_statut on exemplaires.expl_statut=docs_statut.idstatut ";
         $requete .= " left join docs_codestat on exemplaires.expl_codestat=docs_codestat.idcode ";
         $requete .= " left join lenders on exemplaires.expl_owner=lenders.idlender ";
         $requete .= " left join docs_type on exemplaires.expl_typdoc=docs_type.idtyp_doc  ";
         $requete .= " WHERE {$where_expl_notice_expl_bulletin} {$where_expl_localises} ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= " order by surloc_libelle,location_libelle, section_libelle, expl_cote, expl_cb ";
         } else {
             $requete .= " order by location_libelle, section_libelle, expl_cote, expl_cb ";
         }
         $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
         $nbr_expl = pmb_mysql_num_rows($result);
         if ($nbr_expl) {
             while ($expl = pmb_mysql_fetch_object($result)) {
                 //visibilité des exemplaires
                 if ($pmb_droits_explr_localises) {
                     $as_invis = array_search($expl->idlocation, $explr_tab_invis);
                     $as_unmod = array_search($expl->idlocation, $explr_tab_unmod);
                     $as_modif = array_search($expl->idlocation, $explr_tab_modif);
                 } else {
                     $as_invis = false;
                     $as_unmod = false;
                     $as_modif = true;
                 }
                 if ($link_expl) {
                     if ($expl_bulletin) {
                         $tlink = "./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=!!bull_id!!&expl_id=!!expl_id!!";
                         $tlink = str_replace('!!bull_id!!', $expl_bulletin, $tlink);
                         $tlink = str_replace('!!expl_id!!', $expl->expl_id, $tlink);
                         $tlink = str_replace('!!expl_cb!!', rawurlencode($expl->expl_cb), $tlink);
                     } else {
                         $tlink = str_replace('!!expl_id!!', $expl->expl_id, $link_expl);
                         $tlink = str_replace('!!expl_cb!!', rawurlencode($expl->expl_cb), $tlink);
                         $tlink = str_replace('!!notice_id!!', $expl->expl_notice, $tlink);
                     }
                 }
                 $expl_liste .= "<tr>";
                 for ($i = 0; $i < count($colonnesarray); $i++) {
                     if (!(substr($colonnesarray[$i], 0, 1) == "#")) {
                         eval("\$colencours=\$expl->" . $colonnesarray[$i] . ";");
                     }
                     if ($i == 0 && ($expl->expl_note || $expl->expl_comment) && $pmb_expl_list_display_comments) {
                         $expl_rowspan = "rowspan='2'";
                     } else {
                         $expl_rowspan = "";
                     }
                     $aff_column = "";
                     if (substr($colonnesarray[$i], 0, 1) == "#") {
                         //champs personnalisés
                         $id = substr($colonnesarray[$i], 1);
                         $cp->get_values($expl->expl_id);
                         if (!$cp->no_special_fields) {
                             $temp = $cp->get_formatted_output($cp->values[$id], $id);
                             if (!$temp) {
                                 $temp = "&nbsp;";
                             }
                             $aff_column .= $temp;
                         }
                     } else {
                         if ($colonnesarray[$i] == "expl_cb") {
                             if ($tlink && ($as_modif !== FALSE && $as_modif !== NULL)) {
                                 $aff_column .= "<a href='{$tlink}'>" . $colencours . "</a>";
                             } else {
                                 $aff_column .= $colencours;
                             }
                         } else {
                             if ($colonnesarray[$i] == "expl_cote") {
                                 if ($pmb_html_allow_expl_cote) {
                                     $aff_column .= "<strong>" . $colencours . "</strong>";
                                 } else {
                                     $aff_column .= "<strong>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</strong>";
                                 }
                             } else {
                                 if ($colonnesarray[$i] == "statut_libelle") {
                                     if ($expl->pret_retour) {
                                         // exemplaire sorti
                                         $rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='{$expl->pret_idempr}' ";
                                         $res_empr = pmb_mysql_query($rqt_empr, $dbh);
                                         $res_empr_obj = pmb_mysql_fetch_object($res_empr);
                                         $situation = "<strong>{$msg[358]} " . $expl->aff_pret_retour . "</strong>";
                                         global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
                                         if ($empr_show_caddie && SESSrights & CIRCULATION_AUTH) {
                                             $img_ajout_empr_caddie = "<img src='" . $base_path . "/images/basket_empr.gif' align='middle' alt='basket' title=\"{$msg[400]}\" onClick=\"openPopUp('" . $base_path . "/cart.php?object_type=EMPR&item=" . $expl->pret_idempr . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}')\">&nbsp;";
                                         } else {
                                             $img_ajout_empr_caddie = "";
                                         }
                                         switch ($this->print_mode) {
                                             case '2':
                                                 $situation .= "<br />{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}";
                                                 break;
                                             default:
                                                 $situation .= "<br />{$img_ajout_empr_caddie}<a href='" . $base_path . "/circ.php?categ=pret&form_cb=" . rawurlencode($res_empr_obj->empr_cb) . "'>{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}</a>";
                                                 break;
                                         }
                                     } else {
                                         // tester si réservé
                                         $result_resa = pmb_mysql_query("select 1 from resa where resa_cb='" . addslashes($expl->expl_cb) . "' ", $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                                         $reserve = pmb_mysql_num_rows($result_resa);
                                         // tester à ranger
                                         $result_aranger = pmb_mysql_query(" select 1 from resa_ranger where resa_cb='" . addslashes($expl->expl_cb) . "' ", $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                                         $aranger = pmb_mysql_num_rows($result_aranger);
                                         if ($reserve) {
                                             $situation = "<strong>" . $msg['expl_reserve'] . "</strong>";
                                         } elseif ($expl->expl_retloc) {
                                             $situation = $msg['resa_menu_a_traiter'];
                                         } elseif ($aranger) {
                                             $situation = "<strong>" . $msg['resa_menu_a_ranger'] . "</strong>";
                                         } elseif ($expl->pret_flag) {
                                             $situation = "<strong>{$msg[359]}</strong>";
                                         } else {
                                             $situation = "";
                                         }
                                     }
                                     $aff_column .= htmlentities($colencours, ENT_QUOTES, $charset);
                                     if ($situation) {
                                         $aff_column .= "<br />{$situation}";
                                     }
                                 } else {
                                     $aff_column = htmlentities($colencours, ENT_QUOTES, $charset);
                                 }
                             }
                         }
                     }
                     $expl_liste .= "<td {$expl_rowspan}>" . $aff_column . "</td>";
                 }
                 if ($this->print_mode) {
                     $expl_liste .= "<td>&nbsp;</td>";
                 } else {
                     if (SESSrights & CATALOGAGE_AUTH) {
                         //le panier d'exemplaire
                         $cart_click = "onClick=\"openPopUp('" . $base_path . "/cart.php?object_type=EXPL&item=" . $expl->expl_id . "', 'cart', 600, 700, -2, -2, 'toolbar=no, dependent=yes, width=500, height=400, resizable=yes, scrollbars=yes')\"";
                         $cart_link = "<a href='#' {$cart_click}><img src='" . $base_path . "/images/basket_small_20x20.gif' align='center' alt='basket' title=\"{$msg[400]}\"></a>";
                         //l'icon pour le drag&drop de panier
                         $drag_link = "<span onMouseOver='if(init_drag) init_drag();' id='EXPL_drag_" . $expl->expl_id . "'  dragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($expl->expl_cb, ENT_QUOTES, $charset) . "\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"" . $base_path . "/images/notice_drag.png\"/></span>";
                     } else {
                         $cart_click = "";
                         $cart_link = "";
                         $drag_link = "";
                     }
                     //l'impression de la fiche exemplaire
                     $fiche_click = "onClick=\"openPopUp('" . $base_path . "/pdf.php?pdfdoc=fiche_catalographique&expl_id=" . $expl->expl_id . "', 'Fiche', 500, 400, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes')\"";
                     $fiche_link = "<a href='#' {$fiche_click}><img src='" . $base_path . "/images/print.gif' align='center' alt='" . $msg['print_fiche_catalographique'] . "' title='" . $msg['print_fiche_catalographique'] . "'></a>";
                     global $pmb_transferts_actif;
                     //si les transferts sont activés
                     if ($pmb_transferts_actif) {
                         //si l'exemplaire n'est pas transferable on a une image vide
                         $transfer_link = "<img src='" . $base_path . "/images/spacer.gif' align='center' height=20 width=20>";
                         $dispo_pour_transfert = transfert::est_transferable($expl->expl_id);
                         if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert) {
                             //l'icon de demande de transfert
                             $transfer_link = "<a href=\"#\" onClick=\"openPopUp('" . $base_path . "/catalog/transferts/transferts_popup.php?expl=" . $expl->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\"><img src='" . $base_path . "/images/peb_in.png' align='center' border=0 alt=\"" . $msg["transferts_alt_libelle_icon"] . "\" title=\"" . $msg["transferts_alt_libelle_icon"] . "\"></a>";
                         }
                     }
                     //on met tout dans la colonne
                     $expl_liste .= "<td>{$fiche_link} {$cart_link} {$transfer_link} {$drag_link}</td>";
                 }
                 $expl_liste .= "</tr>";
                 if (($expl->expl_note || $expl->expl_comment) && $pmb_expl_list_display_comments) {
                     $notcom = array();
                     $expl_liste .= "<tr><td colspan='" . $total_columns . "'>";
                     if ($expl->expl_note && $pmb_expl_list_display_comments & 1) {
                         $notcom[] .= "<span class='erreur'>{$expl->expl_note}</span>";
                     }
                     if ($expl->expl_comment && $pmb_expl_list_display_comments & 2) {
                         $notcom[] .= "{$expl->expl_comment}";
                     }
                     $expl_liste .= implode("<br />", $notcom);
                     $expl_liste .= "</tr>";
                 }
             }
             // fin while
         }
         // fin il y a des expl visibles
         if ($expl_liste) {
             $entry = "<table border='0' class='expl-list'><tr>";
             for ($i = 0; $i < count($colonnesarray); $i++) {
                 if (substr($colonnesarray[$i], 0, 1) == "#") {
                     //champs personnalisés
                     if (!$cp->no_special_fields) {
                         $id = substr($colonnesarray[$i], 1);
                         $entry .= "<th>" . htmlentities($cp->t_fields[$id][TITRE], ENT_QUOTES, $charset) . "</th>";
                     }
                 } else {
                     eval("\$colencours=\$msg[expl_header_" . $colonnesarray[$i] . "];");
                     $entry .= "<th>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</th>";
                 }
             }
             $entry .= "<th>&nbsp;</th></tr>{$expl_liste}</table>";
         } else {
             $entry = "";
         }
         if ($pmb_expl_display_location_without_expl) {
             if ($pmb_sur_location_activate) {
                 $array_surloc = array();
                 $requete = "SELECT * FROM sur_location ORDER BY surloc_libelle";
                 $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                 $nb_surloc = pmb_mysql_num_rows($result);
                 if ($nb_surloc) {
                     while ($surloc = pmb_mysql_fetch_object($result)) {
                         $array_surloc[] = array("id" => $surloc->surloc_id, "libelle" => $surloc->surloc_libelle, "locations" => array());
                     }
                 }
                 if (count($array_surloc)) {
                     foreach ($array_surloc as $key => $surloc) {
                         $requete = "SELECT idlocation, location_libelle from docs_location where surloc_num=" . $surloc["id"] . " AND \n\t\t\t\t\t\tidlocation not in (SELECT expl_location from exemplaires WHERE expl_notice={$no_notice}) order by location_libelle";
                         $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                         $nb_loc = pmb_mysql_num_rows($result);
                         if ($nb_loc) {
                             while ($loc = pmb_mysql_fetch_object($result)) {
                                 $array_surloc[$key]["locations"][] = array("id" => $loc->idlocation, "libelle" => $loc->location_libelle);
                             }
                         } else {
                             unset($array_surloc[$key]);
                         }
                     }
                 }
                 //Au moins une surloc à afficher
                 if (count($array_surloc)) {
                     $tr_surloc = "";
                     foreach ($array_surloc as $key => $surloc) {
                         $tr_surloc .= "<tr><td>";
                         $tr_loc = "";
                         foreach ($surloc["locations"] as $keyloc => $loc) {
                             $tr_loc .= "<tr><td>" . $loc["libelle"] . "</td></tr>";
                         }
                         $tpl_surloc = "\n\t\t\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t\t\t{$tr_loc}\n\t\t\t\t\t\t\t</table>";
                         $tr_surloc .= gen_plus('surlocation_without_expl' . $key . '_' . $no_notice, $surloc["libelle"], $tpl_surloc, 0);
                         $tr_surloc .= "</td></tr>";
                     }
                     $tpl = "\n\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t{$tr_surloc}\n\t\t\t\t\t</table>";
                     $entry .= gen_plus('location_without_expl' . $no_notice, $msg['expl_surlocation_without_expl'], $tpl, 0);
                 }
             } else {
                 $requete = "SELECT location_libelle from docs_location where\n\t\t\t\tidlocation not in (SELECT expl_location from exemplaires WHERE expl_notice={$no_notice}) order by location_libelle";
                 $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                 $nb_loc = pmb_mysql_num_rows($result);
                 if ($nb_loc) {
                     $items = "";
                     while ($loc = pmb_mysql_fetch_object($result)) {
                         $items .= "<tr><td>" . $loc->location_libelle . "</td></tr>";
                     }
                     $tpl = "\n\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t{$items}\n\t\t\t\t\t</table>";
                     $tpl = gen_plus('location_without_expl' . $no_notice, $msg['expl_location_without_expl'], $tpl, 0);
                     $entry .= $tpl;
                 }
             }
         }
         $this->nb_expl = $nbr_expl;
         return $entry;
     } else {
         return "";
     }
 }
예제 #20
0
파일: export.class.php 프로젝트: hogsim/PMB
 function get_next_notice($lender = "", $td = array(), $sd = array(), $keep_expl = false, $params = array())
 {
     global $is_expl_caddie;
     global $include_path, $lang;
     global $opac_show_book_pics;
     global $dbh, $charset;
     if (!$is_expl_caddie) {
         $requete_panier = "select count(*) from expl_cart_id";
         $res_panier = @pmb_mysql_query($requete_panier);
         if ($res_panier) {
             $is_expl_caddie = 2;
         } else {
             $is_expl_caddie = 1;
         }
     }
     unset($this->xml_array);
     $this->xml_array = array();
     $this->notice = "";
     if ($this->current_notice != -1 && array_search($this->notice_list[$this->current_notice], $this->notice_exporte) !== false) {
         $this->current_notice++;
         if ($this->current_notice >= count($this->notice_list)) {
             $this->current_notice = -1;
         }
         return true;
     }
     if ($this->current_notice != -1) {
         //Recuperation des infos de la notice
         $requete = "select * from notices where notice_id=" . $this->notice_list[$this->current_notice];
         $resultat = pmb_mysql_query($requete);
         $res = pmb_mysql_fetch_object($resultat);
         if (!$res) {
             return false;
         }
         //Remplissage des champs immediats
         //Numero unique de la base
         $this->add_field("001", "", "", $res->notice_id);
         //Champ de traitement
         if ($charset == "utf-8") {
             $encodage = "50  ";
         } else {
             $encodage = "0103";
         }
         $c100 = substr($res->create_date, 0, 4) . substr($res->create_date, 5, 2) . substr($res->create_date, 8, 2) . "u        u  u0frey" . $encodage . "    ba";
         $this->add_field("100", "  ", array("a" => $c100), "");
         //Titre
         $titre[c] = "200";
         $titre[ind] = "1 ";
         $labels = array("a", "c", "d", "e");
         $subfields = array();
         for ($i = 1; $i < 5; $i++) {
             $v = "";
             eval("\$v=\$res->tit{$i};");
             $subfields[$labels[$i - 1]] = $v;
         }
         if ($res->niveau_biblio == 'b' && $res->niveau_hierar == '2') {
             $req_bulletin = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero from bulletins WHERE num_notice=" . $res->notice_id;
             $result_bull = pmb_mysql_query($req_bulletin);
             while ($bull = pmb_mysql_fetch_object($result_bull)) {
                 $subfields["h"] = $bull->bulletin_numero;
                 $subfields["i"] = $bull->bulletin_titre;
                 $subfields["9"] = "id:" . $bull->bulletin_id;
             }
         }
         $this->add_field("200", "1 ", $subfields);
         //Titres Uniformes
         $rqt_tu = "select * from notices_titres_uniformes,titres_uniformes where tu_id =ntu_num_tu and ntu_num_notice = '" . $this->notice_list[$this->current_notice] . "' order by ntu_ordre";
         $result_tu = pmb_mysql_query($rqt_tu);
         if (pmb_mysql_num_rows($result_tu)) {
             while ($row_tu = pmb_mysql_fetch_object($result_tu)) {
                 $subfields = array();
                 $subfields["9"] = "id:" . $row_tu->tu_id;
                 $subfields["a"] = $row_tu->tu_name;
                 $subfields["u"] = $row_tu->tu_tonalite;
                 $subfields["n"] = $row_tu->tu_comment;
                 $subfields["i"] = $row_tu->ntu_titr;
                 $subfields["k"] = $row_tu->ntu_date;
                 $subfields["l"] = $row_tu->ntu_sous_vedette;
                 $subfields["m"] = $row_tu->ntu_langue;
                 $subfields["q"] = $row_tu->ntu_version;
                 $subfields["w"] = $row_tu->ntu_mention;
                 $rqt_tucomp = "SELECT * FROM tu_distrib WHERE distrib_num_tu='" . $row_tu->tu_id . "' ORDER BY distrib_ordre,distrib_name";
                 $result_tucomp = pmb_mysql_query($rqt_tucomp);
                 if (pmb_mysql_num_rows($result_tucomp)) {
                     while ($row_tucomp = pmb_mysql_fetch_object($result_tucomp)) {
                         $subfields["r"][] = $row_tucomp->distrib_name;
                     }
                 }
                 $rqt_tucomp = "SELECT * FROM tu_ref WHERE ref_num_tu='" . $row_tu->tu_id . "' ORDER BY ref_ordre,ref_name";
                 $result_tucomp = pmb_mysql_query($rqt_tucomp);
                 if (pmb_mysql_num_rows($result_tucomp)) {
                     while ($row_tucomp = pmb_mysql_fetch_object($result_tucomp)) {
                         $subfields["s"][] = $row_tucomp->ref_name;
                     }
                 }
                 $rqt_tucomp = "SELECT * FROM tu_subdiv WHERE subdiv_num_tu='" . $row_tu->tu_id . "' ORDER BY subdiv_ordre,subdiv_name";
                 $result_tucomp = pmb_mysql_query($rqt_tucomp);
                 if (pmb_mysql_num_rows($result_tucomp)) {
                     while ($row_tucomp = pmb_mysql_fetch_object($result_tucomp)) {
                         $subfields["j"][] = $row_tucomp->subdiv_name;
                     }
                 }
                 $this->add_field("500", "10", $subfields);
             }
         }
         //Titre du pério pour les notices de bulletin
         $subfields = array();
         if ($res->niveau_biblio == 'b' && $res->niveau_hierar == '2') {
             $req_bulletin = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero, tit1 as titre from bulletins, notices WHERE bulletin_notice=notice_id AND num_notice=" . $res->notice_id;
             $result_bull = pmb_mysql_query($req_bulletin);
             while ($bull = pmb_mysql_fetch_object($result_bull)) {
                 $subfields["a"] = $bull->titre;
             }
         }
         $this->add_field("530", "  ", $subfields);
         //Date en 210 pour les notices de bulletin
         $subfields = array();
         if ($res->niveau_biblio == 'b' && $res->niveau_hierar == '2') {
             $req_bulletin = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero from bulletins WHERE num_notice=" . $res->notice_id;
             $result_bull = pmb_mysql_query($req_bulletin);
             while ($bull = pmb_mysql_fetch_object($result_bull)) {
                 $subfields["h"] = $bull->date_date;
                 $subfields["d"] = $bull->mention_date;
             }
         }
         $this->add_field("210", "  ", $subfields);
         //isbn
         $subfields = array();
         $subfields["a"] = $res->code;
         $subfields["d"] = $res->prix;
         $this->add_field("010", "  ", $subfields);
         // URL
         $subfields = array();
         $subfields["u"] = $res->lien;
         $subfields["q"] = $res->eformat;
         $this->add_field("856", "  ", $subfields);
         //Langage
         $rqttmp_lang = "select type_langue,code_langue from notices_langues where num_notice='{$res->notice_id}' order by ordre_langue ";
         $restmp_lang = pmb_mysql_query($rqttmp_lang);
         $ind = "0 ";
         $subfields_101 = array();
         while ($tmp_lang = pmb_mysql_fetch_object($restmp_lang)) {
             if ($tmp_lang->type_langue) {
                 $ind = "1 ";
                 $subfields_101['c'][] = $tmp_lang->code_langue;
             } else {
                 $subfields_101['a'][] = $tmp_lang->code_langue;
             }
         }
         $this->add_field('101', $ind, $subfields_101);
         //Mention d'edition
         $subfields = array();
         $subfields["a"] = $res->mention_edition;
         $this->add_field("205", "  ", $subfields);
         //Collation
         $subfields = array();
         $subfields["a"] = $res->npages;
         $subfields["c"] = $res->ill;
         $subfields["d"] = $res->size;
         $subfields["e"] = $res->accomp;
         $this->add_field("215", "  ", $subfields);
         //Notes
         $subfields = array();
         $subfields["a"] = $res->n_gen;
         $this->add_field("300", "  ", $subfields);
         $subfields["a"] = $res->n_contenu;
         $this->add_field("327", "  ", $subfields);
         $subfields["a"] = $res->n_resume;
         $this->add_field("330", "  ", $subfields);
         //Auteurs
         //Recherche des auteurs;
         $requete = "select author_id, author_type, author_name, author_rejete, author_date, responsability_fonction, responsability_type \n\t\t\t,author_subdivision, author_lieu,author_ville, author_pays,author_numero,author_web, author_comment\n\t\t\tfrom authors, responsability where responsability_notice=" . $res->notice_id . " and responsability_author=author_id order by responsability_ordre asc";
         $resultat = pmb_mysql_query($requete) or die(pmb_mysql_error() . "<br />" . $requete);
         while ($auth = pmb_mysql_fetch_object($resultat)) {
             //Si c'est un 70 (individuel) alors on l'exporte
             $subfields = array();
             $attrs = array();
             if ($params["include_authorite_ids"]) {
                 $attrs["id"] = $auth->author_id;
             }
             if ($auth->author_type == "70") {
                 // Personne physique
                 //Champ = author_type + responsability_type (70 + 0 pour auteur principal = 700 !)
                 $auth_code = $auth->author_type . $auth->responsability_type;
                 $subfields["a"] = $auth->author_name;
                 $subfields["b"] = $auth->author_rejete;
                 $subfields["c"] = $auth->author_comment;
                 //Fonction
                 $subfields["4"] = $auth->responsability_fonction;
                 //Dates
                 if ($auth->author_date != "") {
                     $subfields["f"] = $auth->author_date;
                 }
                 $subfields["N"] = $auth->author_web;
                 $subfields["9"] = "id:" . $auth->author_id;
                 $this->add_field($auth_code, " 1", $subfields, "", $attrs);
             } elseif ($auth->author_type == "71" || $auth->author_type == "72") {
                 //Collectivité
                 $auth_code = $auth->author_type . $auth->responsability_type;
                 $subfields["a"] = $auth->author_name;
                 $subfields["b"] = $auth->author_subdivision;
                 $subfields["c"] = $auth->author_comment;
                 $subfields["g"] = $auth->author_rejete;
                 $subfields["d"] = $auth->author_numero;
                 //Fonction
                 $subfields["4"] = $auth->responsability_fonction;
                 //Dates
                 if ($auth->author_date != "") {
                     $subfields["f"] = $auth->author_date;
                 }
                 $lieu = $auth->author_lieu;
                 if ($auth->author_ville) {
                     if ($lieu) {
                         $lieu .= "; ";
                     }
                     $lieu .= $auth->author_ville;
                 }
                 if ($auth->author_pays) {
                     if ($lieu) {
                         $lieu .= "; ";
                     }
                     $lieu .= $auth->author_pays;
                 }
                 $subfields["e"] = $lieu;
                 $subfields["K"] = $auth->author_lieu;
                 $subfields["L"] = $auth->author_ville;
                 $subfields["M"] = $auth->author_pays;
                 $subfields["N"] = $auth->author_web;
                 $subfields["9"] = "id:" . $auth->author_id;
                 if ($auth->author_type == "71") {
                     $auth_code = $auth->author_type . $auth->responsability_type;
                     $this->add_field($auth_code, "02", $subfields, "", $attrs);
                 } elseif ($auth->author_type == "72") {
                     $auth_code = "71" . $auth->responsability_type;
                     $this->add_field($auth_code, "12", $subfields, "", $attrs);
                 }
             }
         }
         //Editeurs et date de la notice
         $c102_export = false;
         //Le champ 102 n'est pas répétable
         $requete = "select * from publishers where ed_id =" . $res->ed1_id;
         $resultat = pmb_mysql_query($requete);
         $subfields = array();
         $attrs = array();
         if ($params["include_authorite_ids"]) {
             $attrs["id"] = $res->ed1_id;
         }
         if ($ed1 = pmb_mysql_fetch_object($resultat)) {
             $subfields["a"] = $ed1->ed_ville;
             $subfields["b"] = trim($ed1->ed_adr1 . "\n" . $ed1->ed_adr2 . "\n" . $ed1->ed_cp . "\n" . $ed1->ed_ville . "\n" . $ed1->ed_pays);
             $subfields["c"] = $ed1->ed_name;
             $subfields["d"] = $res->year;
             $subfields["z"] = $ed1->ed_pays;
             if (trim($ed1->ed_pays)) {
                 $parser = new XMLlist("{$include_path}/marc_tables/{$lang}/country.xml");
                 $parser->analyser();
                 if ($tmp = array_search(trim($ed1->ed_pays), $parser->table)) {
                     $subfields_102 = array();
                     $subfields_102["a"] = mb_strtolower($tmp);
                     $this->add_field("102", "  ", $subfields_102);
                     $c102_export = true;
                 }
             }
             $subfields["9"][] = "id:" . $ed1->ed_id;
             if (trim($ed1->ed_web)) {
                 $subfields["9"][] = "web:" . $ed1->ed_web;
             }
             if (trim($ed1->ed_comment)) {
                 $subfields["9"][] = "comment:" . $ed1->ed_comment;
             }
             if (trim($ed1->ed_cp)) {
                 $subfields["9"][] = "cp:" . $ed1->ed_cp;
             }
             if (trim($ed1->ed_adr1)) {
                 $subfields["9"][] = "adr1:" . $ed1->ed_adr1;
             }
             if (trim($ed1->ed_adr2)) {
                 $subfields["9"][] = "adr2:" . $ed1->ed_adr2;
             }
         } elseif ($res->year && $res->niveau_biblio != 'b') {
             $subfields["d"] = $res->year;
         }
         $this->add_field("210", "  ", $subfields, "", $attrs);
         $requete = "select * from publishers where ed_id =" . $res->ed2_id;
         $resultat = pmb_mysql_query($requete);
         $subfields = array();
         $attrs = array();
         if ($params["include_authorite_ids"]) {
             $attrs["id"] = $res->ed2_id;
         }
         if ($ed1 = pmb_mysql_fetch_object($resultat)) {
             $subfields["a"] = $ed1->ed_ville;
             $subfields["b"] = trim($ed1->ed_adr1 . "\n" . $ed1->ed_adr2 . "\n" . $ed1->ed_cp . "\n" . $ed1->ed_ville . "\n" . $ed1->ed_pays);
             $subfields["c"] = $ed1->ed_name;
             $subfields["d"] = $res->year;
             $subfields["z"] = $ed1->ed_pays;
             if (trim($ed1->ed_pays) && !$c102_export) {
                 $parser = new XMLlist("{$include_path}/marc_tables/{$lang}/country.xml");
                 $parser->analyser();
                 if ($tmp = array_search(trim($ed1->ed_pays), $parser->table)) {
                     $subfields_102 = array();
                     $subfields_102["a"] = mb_strtolower($tmp);
                     $this->add_field("102", "  ", $subfields_102);
                 }
             }
             $subfields["9"][] = "id:" . $ed1->ed_id;
             if (trim($ed1->ed_web)) {
                 $subfields["9"][] = "web:" . $ed1->ed_web;
             }
             if (trim($ed1->ed_comment)) {
                 $subfields["9"][] = "comment:" . $ed1->ed_comment;
             }
             if (trim($ed1->ed_cp)) {
                 $subfields["9"][] = "cp:" . $ed1->ed_cp;
             }
             if (trim($ed1->ed_adr1)) {
                 $subfields["9"][] = "adr1:" . $ed1->ed_adr1;
             }
             if (trim($ed1->ed_adr2)) {
                 $subfields["9"][] = "adr2:" . $ed1->ed_adr2;
             }
         }
         $this->add_field("210", "  ", $subfields, "", $attrs);
         //Collections
         $requete = "select * from collections where collection_id=" . $res->coll_id;
         $resultat = pmb_mysql_query($requete);
         $subfields = array();
         $subfields_410 = array();
         $subfields_411 = array();
         $subfields_s = array();
         $attrs = array();
         if ($params["include_authorite_ids"]) {
             $attrs["id"] = $res->coll_id;
         }
         if ($col = pmb_mysql_fetch_object($resultat)) {
             $subfields["a"] = $col->collection_name;
             $subfields_410["t"] = $col->collection_name;
             $subfields["v"] = $res->nocoll;
             $subfields_410["v"] = $res->nocoll;
             $subfields["x"] = $col->collection_issn;
             $subfields_410["x"] = $col->collection_issn;
             $subfields["9"] = "id:" . $res->coll_id;
             $subfields_410["9"] = "id:" . $res->coll_id;
         }
         //Recherche des sous collections
         $requete = "select * from sub_collections where sub_coll_id=" . $res->subcoll_id;
         $resultat = pmb_mysql_query($requete);
         if ($subcol = pmb_mysql_fetch_object($resultat)) {
             $subfields_s["i"] = $subcol->sub_coll_name;
             $subfields_411["t"] = $subcol->sub_coll_name;
             $subfields_s["x"] = $subcol->sub_coll_issn;
             $subfields_411["x"] = $subcol->sub_coll_issn;
             $subfields_s["9"] = "id:" . $res->subcoll_id;
             $subfields_411["9"] = "id:" . $res->subcoll_id;
         }
         $attrs2 = array();
         if ($params["include_authorite_ids"]) {
             $attrs2["id"] = $res->subcoll_id;
         }
         $this->add_field("225", "2 ", $subfields, "", $attrs);
         $this->add_field("410", " 0", $subfields_410, "", $attrs);
         $this->add_field("225", "2 ", $subfields_s, "", $attrs2);
         $this->add_field("411", " 0", $subfields_411, "", $attrs2);
         $requete = "select * from series where serie_id=" . $res->tparent_id;
         $resultat = pmb_mysql_query($requete);
         $subfields = array();
         $attrs = array();
         if ($serie = pmb_mysql_fetch_object($resultat)) {
             $subfields["t"] = $serie->serie_name;
             $subfields["v"] = $res->tnvol;
             if ($params["include_authorite_ids"]) {
                 $attrs["id"] = $serie->serie_id;
             }
         }
         $this->add_field("461", " 0", $subfields, '', $attrs);
         //dewey
         $subfields = array();
         //Recher du code dewey
         $requete = "select * from indexint where indexint_id=" . $res->indexint;
         $resultat = pmb_mysql_query($requete);
         if ($code_dewey = pmb_mysql_fetch_object($resultat)) {
             $subfields["a"] = $code_dewey->indexint_name;
             $subfields["l"] = $code_dewey->indexint_comment;
             $subfields["9"] = "id:" . $code_dewey->indexint_id;
             $this->add_field("676", "  ", $subfields);
         }
         //Vignette
         if ($opac_show_book_pics) {
             $vignette = get_vignette($this->notice_list[$this->current_notice]);
             if ($vignette) {
                 $this->add_field("896", "  ", array("a" => $vignette));
             }
         }
         if ($keep_expl) {
             if ($res->niveau_biblio == 'b' && $res->niveau_hierar == '2') {
                 //Si c'est une notice de bulletin
                 $requete = "SELECT bulletin_id FROM bulletins WHERE num_notice='" . $res->notice_id . "'";
                 $res_bull = pmb_mysql_query($requete);
                 if (pmb_mysql_num_rows($res_bull)) {
                     $id_bull = pmb_mysql_result($res_bull, 0, 0);
                     if (array_search($id_bull, $this->bulletins_exporte) === false && array_search($id_bull, $this->expl_bulletin_a_exporter) === false) {
                         //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires
                         $this->expl_bulletin_a_exporter[] = $id_bull;
                     }
                 }
             } else {
                 //Si non
                 //Traitement des exemplaires
                 $this->processing_expl($lender, $td, $sd, $params, $res->notice_id, 0);
             }
         }
         //Mots cles
         $subfields = array();
         $subfields["a"] = $res->index_l;
         $this->add_field("610", "0 ", $subfields);
         //Descripteurs
         $requete = "SELECT libelle_categorie,categories.num_noeud,categories.langue,categories.num_thesaurus FROM categories, notices_categories WHERE notcateg_notice=" . $res->notice_id . " and categories.num_noeud = notices_categories.num_noeud ORDER BY ordre_categorie";
         $resultat = pmb_mysql_query($requete);
         if (pmb_mysql_num_rows($resultat)) {
             for ($i = 0; $i < pmb_mysql_num_rows($resultat); $i++) {
                 $subfields = array();
                 $subfields["9"][] = "id:" . pmb_mysql_result($resultat, $i, 1);
                 $subfields["9"][] = "lang:" . pmb_mysql_result($resultat, $i, 2);
                 $subfields["9"][] = "idthes:" . pmb_mysql_result($resultat, $i, 3);
                 $subfields["a"] = pmb_mysql_result($resultat, $i, 0);
                 $this->add_field("606", " 1", $subfields);
             }
         }
         //Champs perso de notice traite par la table notice_custom
         $this->processing_cp("notices", $res->notice_id);
         //Notices liées, relations entre notices
         if ($params["genere_lien"]) {
             //On choisit d'exporter les notices mères
             if ($params["mere"]) {
                 $requete = "SELECT num_notice, linked_notice, relation_type, rank from notices_relations where num_notice=" . $res->notice_id . " order by num_notice, rank asc";
                 $resultat = pmb_mysql_query($requete);
                 while ($notice_fille = pmb_mysql_fetch_object($resultat)) {
                     $requete_mere = "SELECT * FROM notices WHERE notice_id=" . $notice_fille->linked_notice;
                     $resultat_mere = pmb_mysql_query($requete_mere);
                     while ($notice_mere = pmb_mysql_fetch_object($resultat_mere)) {
                         $subfields = array();
                         $list_titre = array();
                         $list_auteurs = array();
                         $list_options = array();
                         //On recopie les informations de la notice fille
                         if ($params["notice_mere"]) {
                             $subfields["0"] = $notice_mere->notice_id;
                         }
                         $list_titre[] = $notice_mere->tit1 ? $notice_mere->tit1 : " ";
                         //auteur
                         $rqt_aut = "select author_name, author_rejete from responsability join authors on author_id = responsability_author and responsability_notice=" . $notice_mere->notice_id . " where responsability_type != 2 order by responsability_type,responsability_ordre";
                         $res_aut = pmb_mysql_query($rqt_aut);
                         $mere_aut = array();
                         while ($mere_aut = pmb_mysql_fetch_object($res_aut)) {
                             $list_auteurs[] = $mere_aut->author_name . ($mere_aut->author_rejete ? ", " . $mere_aut->author_rejete : "");
                         }
                         $list_options[] = "bl:" . $notice_mere->niveau_biblio . $notice_mere->niveau_hierar;
                         $list_options[] = "id:" . $notice_mere->notice_id;
                         if ($notice_fille->rank) {
                             $list_options[] = "rank:" . $notice_fille->rank;
                         }
                         if ($notice_fille->relation_type) {
                             $list_options[] = "type_lnk:" . $notice_fille->relation_type;
                         }
                         $list_options[] = 'lnk:parent';
                         $subfields["9"] = $list_options;
                         //Relation avec mono = ISBN
                         if ($notice_mere->niveau_biblio == 'm' && $notice_mere->niveau_hierar == '0') {
                             if ($notice_mere->code) {
                                 $subfields["y"] = $notice_mere->code;
                             }
                             $subfields["t"] = $list_titre;
                             $subfields["a"] = $list_auteurs;
                         }
                         //Relation avec pério = ISSN
                         if ($notice_mere->niveau_biblio == 's' && $notice_mere->niveau_hierar == '1') {
                             if ($notice_mere->code) {
                                 $subfields["x"] = $notice_mere->code;
                             }
                             $subfields["t"] = $list_titre;
                         }
                         //Relation avec articles
                         if ($notice_mere->niveau_biblio == 'a' && $notice_mere->niveau_hierar == '2') {
                             $req_art = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero, tit1, code from analysis join bulletins on bulletin_id=analysis_bulletin join notices on bulletin_notice=notice_id where analysis_notice=" . $notice_mere->notice_id;
                             $result_art = pmb_mysql_query($req_art);
                             while ($notice_art = pmb_mysql_fetch_object($result_art)) {
                                 $subfields["d"] = $notice_art->date_date;
                                 $subfields["e"] = $notice_art->mention_date;
                                 $subfields["v"] = $notice_art->bulletin_numero;
                                 if ($notice_art->code) {
                                     $subfields["x"] = $notice_art->code;
                                 }
                                 $list_titre[] = $notice_art->bulletin_titre ? $notice_art->bulletin_titre : " ";
                                 $list_titre[] = $notice_art->tit1 ? $notice_art->tit1 : " ";
                                 $subfields["t"] = $list_titre;
                                 if ($keep_expl && array_search($notice_art->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_art->bulletin_id, $this->expl_bulletin_a_exporter) === false) {
                                     //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires
                                     $this->expl_bulletin_a_exporter[] = $notice_art->bulletin_id;
                                 }
                             }
                         }
                         //Relation avec bulletins
                         if ($notice_mere->niveau_biblio == 'b' && $notice_mere->niveau_hierar == '2') {
                             $req_bull = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero, tit1, code from bulletins join notices on bulletin_notice=notice_id  WHERE num_notice=" . $notice_mere->notice_id;
                             $result_bull = pmb_mysql_query($req_bull);
                             while ($notice_bull = pmb_mysql_fetch_object($result_bull)) {
                                 $subfields["d"] = $notice_bull->date_date;
                                 $subfields["e"] = $notice_bull->mention_date;
                                 $subfields["v"] = $notice_bull->bulletin_numero;
                                 if ($notice_bull->code) {
                                     $subfields["x"] = $notice_bull->code;
                                 }
                                 $list_titre[] = $notice_bull->bulletin_titre ? $notice_bull->bulletin_titre : " ";
                                 $list_titre[] = $notice_bull->tit1 ? $notice_bull->tit1 : " ";
                                 $subfields["t"] = $list_titre;
                                 if ($keep_expl && array_search($notice_bull->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_bull->bulletin_id, $this->expl_bulletin_a_exporter) === false) {
                                     //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires
                                     $this->expl_bulletin_a_exporter[] = $notice_bull->bulletin_id;
                                 }
                             }
                         }
                         $list_attribut = new XMLlist("{$include_path}/marc_tables/{$lang}/relationtypeup_unimarc.xml");
                         $list_attribut->analyser();
                         $table_attribut = $list_attribut->table;
                         //On teste si la relation est spéciale, de type contient dans une boite
                         if ($notice_fille->relation_type == 'd') {
                             $indicateur = "d0";
                         } else {
                             $indicateur = "  ";
                         }
                         $this->add_field($table_attribut[$notice_fille->relation_type], $indicateur, $subfields);
                         //On exporte les notices mères liées
                         if ($params["notice_mere"] && array_search($notice_mere->notice_id, $this->notice_exporte) === false) {
                             $this->notice_list[] = $notice_mere->notice_id;
                         }
                     }
                 }
             }
             //On choisit d'exporter les notices filles
             if ($params["fille"]) {
                 $requete = "SELECT num_notice, linked_notice, relation_type, rank from notices_relations where linked_notice=" . $res->notice_id . " order by num_notice, rank asc";
                 $resultat = pmb_mysql_query($requete);
                 while ($notice_mere = pmb_mysql_fetch_object($resultat)) {
                     $requete_fille = "SELECT * FROM notices WHERE notice_id=" . $notice_mere->num_notice;
                     $resultat_fille = pmb_mysql_query($requete_fille);
                     while ($notice_fille = pmb_mysql_fetch_object($resultat_fille)) {
                         $subfields = array();
                         $list_titre = array();
                         $list_options = array();
                         //On recopie les informations de la notice fille
                         if ($params["notice_fille"]) {
                             $subfields["0"] = $notice_fille->notice_id;
                         }
                         $list_titre[] = $notice_fille->tit1 ? $notice_fille->tit1 : " ";
                         $list_options[] = "bl:" . $notice_fille->niveau_biblio . $notice_fille->niveau_hierar;
                         $list_options[] = "id:" . $notice_fille->notice_id;
                         if ($notice_mere->rank) {
                             $list_options[] = "rank:" . $notice_mere->rank;
                         }
                         if ($notice_mere->relation_type) {
                             $list_options[] = "type_lnk:" . $notice_mere->relation_type;
                         }
                         $list_options[] = 'lnk:child';
                         $subfields["9"] = $list_options;
                         //Relation avec mono = ISBN
                         if ($notice_fille->niveau_biblio == 'm' && $notice_fille->niveau_hierar == '0') {
                             if ($notice_fille->code) {
                                 $subfields["y"] = $notice_fille->code;
                             }
                             $subfields["t"] = $list_titre;
                         }
                         //Relation avec pério = ISSN
                         if ($notice_fille->niveau_biblio == 's' && $notice_fille->niveau_hierar == '1') {
                             if ($notice_fille->code) {
                                 $subfields["x"] = $notice_fille->code;
                             }
                             $subfields["t"] = $list_titre;
                         }
                         //Relation avec articles
                         if ($notice_fille->niveau_biblio == 'a' && $notice_fille->niveau_hierar == '2') {
                             $req_art = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero, tit1, code from analysis join bulletins on bulletin_id=analysis_bulletin join notices on bulletin_notice=notice_id where analysis_notice=" . $notice_fille->notice_id;
                             $result_art = pmb_mysql_query($req_art);
                             while ($notice_art = pmb_mysql_fetch_object($result_art)) {
                                 $subfields["d"] = $notice_art->date_date;
                                 $subfields["e"] = $notice_art->mention_date;
                                 $subfields["v"] = $notice_art->bulletin_numero;
                                 if ($notice_art->code) {
                                     $subfields["x"] = $notice_art->code;
                                 }
                                 $list_titre[] = $notice_art->bulletin_titre ? $notice_art->bulletin_titre : " ";
                                 $list_titre[] = $notice_art->tit1 ? $notice_art->tit1 : " ";
                                 $subfields["t"] = $list_titre;
                                 if ($keep_expl && array_search($notice_art->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_art->bulletin_id, $this->expl_bulletin_a_exporter) === false) {
                                     //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires
                                     $this->expl_bulletin_a_exporter[] = $notice_art->bulletin_id;
                                 }
                             }
                         }
                         //Relation avec bulletins
                         if ($notice_fille->niveau_biblio == 'b' && $notice_fille->niveau_hierar == '2') {
                             $req_bull = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero, tit1, code from bulletins join notices on bulletin_notice=notice_id  WHERE num_notice=" . $notice_fille->notice_id;
                             $result_bull = pmb_mysql_query($req_bull);
                             while ($notice_bull = pmb_mysql_fetch_object($result_bull)) {
                                 $subfields["d"] = $notice_bull->date_date;
                                 $subfields["e"] = $notice_bull->mention_date;
                                 $subfields["v"] = $notice_bull->bulletin_numero;
                                 if ($notice_bull->code) {
                                     $subfields["x"] = $notice_bull->code;
                                 }
                                 $list_titre[] = $notice_bull->bulletin_titre ? $notice_bull->bulletin_titre : " ";
                                 $list_titre[] = $notice_bull->tit1 ? $notice_bull->tit1 : " ";
                                 $subfields["t"] = $list_titre;
                                 if ($keep_expl && array_search($notice_bull->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_bull->bulletin_id, $this->expl_bulletin_a_exporter) === false) {
                                     //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires
                                     $this->expl_bulletin_a_exporter[] = $notice_bull->bulletin_id;
                                 }
                             }
                         }
                         $list_attribut = new XMLlist("{$include_path}/marc_tables/{$lang}/relationtypedown_unimarc.xml");
                         $list_attribut->analyser();
                         $table_attribut = $list_attribut->table;
                         //On teste si la relation est spéciale, de type contient dans une boite
                         if ($notice_fille->relation_type == 'd') {
                             $indicateur = "d0";
                         } else {
                             $indicateur = "  ";
                         }
                         $this->add_field($table_attribut[$notice_mere->relation_type], $indicateur, $subfields);
                         //On exporte les notices filles liées
                         if ($params["notice_fille"] && array_search($notice_fille->notice_id, $this->notice_exporte) === false) {
                             $this->notice_list[] = $notice_fille->notice_id;
                         }
                     }
                 }
             }
             //On choisit d'exporter les liens vers les périodiques pour les notices d'article
             if ($params["perio_link"]) {
                 $req_perio_link = "SELECT notice_id, tit1, code from bulletins,analysis,notices WHERE bulletin_notice=notice_id and bulletin_id=analysis_bulletin and analysis_notice=" . $res->notice_id;
                 $result_perio_link = pmb_mysql_query($req_perio_link);
                 while ($notice_perio_link = pmb_mysql_fetch_object($result_perio_link)) {
                     $subfields_461 = array();
                     $list_options = array();
                     if ($params["notice_perio"]) {
                         $subfields_461["0"] = $notice_perio_link->notice_id;
                     }
                     $subfields_461["t"] = $notice_perio_link->tit1 ? $notice_perio_link->tit1 : " ";
                     if ($notice_perio_link->code) {
                         $subfields_461["x"] = $notice_perio_link->code;
                     }
                     $attrs = array("id" => $notice_perio_link->notice_id);
                     $list_options[] = "id:" . $notice_perio_link->notice_id;
                     $list_options[] = 'lnk:perio';
                     $subfields_461["9"] = $list_options;
                     $this->add_field("461", "  ", $subfields_461, '', $attrs);
                     //On exporte les notices de pério liées
                     if ($params["notice_perio"] && array_search($notice_perio_link->notice_id, $this->notice_exporte) === false) {
                         $this->notice_list[] = $notice_perio_link->notice_id;
                     }
                 }
             }
             //On génère le bulletinage pour les notices de pério
             if ($params["bulletinage"]) {
                 $req_bulletinage = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero from bulletins, notices WHERE bulletin_notice = notice_id AND notice_id=" . $res->notice_id;
                 $result_bulletinage = pmb_mysql_query($req_bulletinage);
                 while ($notice_bulletinage = pmb_mysql_fetch_object($result_bulletinage)) {
                     $subfields_462 = array();
                     $list_options = array();
                     $attrs = array("id" => $notice_bulletinage->bulletin_id);
                     $subfields_462["d"] = $notice_bulletinage->date_date;
                     $subfields_462["e"] = $notice_bulletinage->mention_date;
                     $subfields_462["v"] = $notice_bulletinage->bulletin_numero;
                     $subfields_462["t"] = $notice_bulletinage->bulletin_titre ? $notice_bulletinage->bulletin_titre : " ";
                     $list_options[] = "id:" . $notice_bulletinage->bulletin_id;
                     $list_options[] = 'lnk:bull';
                     $subfields_462["9"] = $list_options;
                     $this->add_field("462", "  ", $subfields_462, '', $attrs);
                     if ($keep_expl && array_search($notice_bulletinage->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_bulletinage->bulletin_id, $this->expl_bulletin_a_exporter) === false) {
                         //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires
                         $this->expl_bulletin_a_exporter[] = $notice_bulletinage->bulletin_id;
                     }
                 }
             }
             //On choisit d'exporter les liens vers les bulletins pour les notices d'article
             if ($params["bull_link"]) {
                 $req_bull_link = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero from bulletins, analysis WHERE bulletin_id=analysis_bulletin and analysis_notice=" . $res->notice_id;
                 $result_bull_link = pmb_mysql_query($req_bull_link);
                 while ($notice_bull_link = pmb_mysql_fetch_object($result_bull_link)) {
                     $subfields_463 = array();
                     $list_options = array();
                     $attrs = array("id" => $notice_bull_link->bulletin_id);
                     $subfields_463["d"] = $notice_bull_link->date_date;
                     $subfields_463["e"] = $notice_bull_link->mention_date;
                     $subfields_463["v"] = $notice_bull_link->bulletin_numero;
                     $subfields_463["t"] = $notice_bull_link->bulletin_titre ? $notice_bull_link->bulletin_titre : " ";
                     $list_options[] = "id:" . $notice_bull_link->bulletin_id;
                     $list_options[] = 'lnk:bull';
                     $subfields_463["9"] = $list_options;
                     $this->add_field("463", "  ", $subfields_463, '', $attrs);
                     if ($keep_expl && array_search($notice_bull_link->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_bull_link->bulletin_id, $this->expl_bulletin_a_exporter) === false) {
                         //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires
                         $this->expl_bulletin_a_exporter[] = $notice_bull_link->bulletin_id;
                     }
                 }
             }
             //On choisit d'exporter les liens vers les articles pour les notices de pério
             if ($params["art_link"]) {
                 $req_art_link = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, analysis_notice, a.tit1 as titre, a.npages as page from notices p left join bulletins on bulletin_notice=p.notice_id left join analysis on analysis_bulletin=bulletin_id join notices a on a.notice_id=analysis_notice WHERE p.notice_id=" . $res->notice_id;
                 $result_art_link = pmb_mysql_query($req_art_link);
                 while ($notice_art_link = pmb_mysql_fetch_object($result_art_link)) {
                     $subfields_464 = array();
                     $tab_titre = array();
                     $list_options = array();
                     $attrs = array("id" => $notice_art_link->analysis_notice);
                     $tab_titre[] = $notice_art_link->titre ? $notice_art_link->titre : " ";
                     $tab_titre[] = $notice_art_link->bulletin_titre ? $notice_art_link->bulletin_titre : " ";
                     if ($params["notice_art"]) {
                         $subfields_464["0"] = $notice_art_link->analysis_notice;
                     }
                     $subfields_464["t"] = $tab_titre;
                     $subfields_464["d"] = $notice_art_link->date_date;
                     $subfields_464["e"] = $notice_art_link->mention_date;
                     $subfields_464["v"] = $notice_art_link->bulletin_numero;
                     $list_options[] = "id:" . $notice_art_link->analysis_notice;
                     $list_options[] = "page:" . $notice_art_link->page;
                     $list_options[] = 'lnk:art';
                     $subfields_464["9"] = $list_options;
                     $this->add_field("464", "  ", $subfields_464, '', $attrs);
                     if ($keep_expl && array_search($notice_art_link->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_art_link->bulletin_id, $this->expl_bulletin_a_exporter) === false) {
                         //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires
                         $this->expl_bulletin_a_exporter[] = $notice_art_link->bulletin_id;
                     }
                     //On exporte les notices d'articles liées
                     if ($params["notice_art"] && array_search($notice_art_link->analysis_notice, $this->notice_exporte) === false) {
                         $this->notice_list[] = $notice_art_link->analysis_notice;
                     }
                 }
             }
         }
         //Etat de collection
         if ($res->niveau_biblio == 's' && $res->niveau_hierar == '1') {
             $req = "SELECT collections_state.*, archempla_libelle, archtype_libelle, archstatut_opac_libelle, archstatut_gestion_libelle, location_libelle FROM collections_state " . "LEFT JOIN arch_emplacement ON archempla_id=collstate_emplacement " . "LEFT JOIN arch_type ON archtype_id=collstate_type " . "LEFT JOIN arch_statut ON archstatut_id=collstate_statut " . "LEFT JOIN docs_location ON idlocation=location_id " . "WHERE id_serial='" . $res->notice_id . "'";
             $res_etat = pmb_mysql_query($req);
             if ($res_etat && pmb_mysql_num_rows($res_etat)) {
                 while ($etat = pmb_mysql_fetch_object($res_etat)) {
                     $subfields = array();
                     $attrs = array();
                     $subfields["9"] = "id:" . $etat->collstate_id;
                     $subfields["a"] = $etat->location_libelle;
                     $subfields["b"] = $etat->state_collections;
                     $subfields["c"] = $etat->archempla_libelle;
                     $subfields["d"] = $etat->archtype_libelle;
                     $subfields["e"] = $etat->collstate_origine;
                     $subfields["f"] = $etat->collstate_cote;
                     $subfields["g"] = $etat->collstate_archive;
                     $subfields["h"] = $etat->archstatut_opac_libelle;
                     $subfields["i"] = $etat->collstate_lacune;
                     $subfields["j"] = $etat->collstate_note;
                     $subfields["k"] = $etat->archstatut_gestion_libelle;
                     $this->add_field("950", "  ", $subfields, "", $attrs);
                     //Export des cp d'etat de collection
                     $this->processing_cp("collstate", $etat->collstate_id, $etat->collstate_id);
                 }
             }
         }
         //Documents numeriques
         if ($params['docnum']) {
             // recuperation des documents numeriques
             $q = "select explnum_id from explnum where explnum_notice='" . $res->notice_id . "' ";
             $q .= "union ";
             $q .= "select explnum_id from explnum, bulletins where bulletin_id = explnum_bulletin and bulletins.num_notice='" . $res->notice_id . "' ";
             $r = pmb_mysql_query($q, $dbh);
             if (pmb_mysql_num_rows($r)) {
                 while ($row = pmb_mysql_fetch_object($r)) {
                     $subfields_897 = array();
                     $dn = new explnum($row->explnum_id);
                     if ($dn->isURL()) {
                         //URL
                         $subfields_897['a'] = $dn->explnum_url;
                         $subfields_897['b'] = $dn->explnum_nom;
                         $subfields_897['f'] = '';
                         $subfields_897['p'] = '';
                     } elseif ($dn->isEnUpload() && $params['docnum_rep']) {
                         //Répertoire
                         $dest_file = $dn->copy_to($params['docnum_rep'], true);
                         if ($dest_file) {
                             $subfields_897['a'] = $dest_file;
                             $subfields_897['b'] = $dn->explnum_nom ? $dn->explnum_nom : $dn->explnum_nomfichier;
                             $subfields_897['f'] = $dn->explnum_nomfichier;
                             $subfields_897['p'] = '';
                         }
                     } elseif ($dn->isEnBase() && $params['docnum_rep']) {
                         //Base
                         $dest_file = $dn->copy_to($params['docnum_rep'], true);
                         if ($dest_file) {
                             $subfields_897['a'] = $dest_file;
                             $subfields_897['b'] = $dn->explnum_nom ? $dn->explnum_nom : $dn->explnum_nomfichier;
                             $subfields_897['f'] = $dn->explnum_nomfichier;
                             $subfields_897['p'] = '';
                         }
                     }
                     if (count($subfields_897)) {
                         $this->add_field('897', '  ', $subfields_897);
                     }
                 }
             }
         }
         //Record field
         $biblio = $res->niveau_biblio;
         $hierar = $res->niveau_hierar;
         if ($biblio == 'b' && $hierar == '2') {
             //si on a un bulletin on modifie b2 en s2
             $biblio = 's';
             $hierar = '2';
         }
         $this->xml_array['rs']['value'] = "n";
         $this->xml_array['dt']['value'] = $res->typdoc;
         $this->xml_array['bl']['value'] = $biblio;
         $this->xml_array['hl']['value'] = $hierar;
         $this->xml_array['el']['value'] = 1;
         $this->xml_array['ru']['value'] = "i";
         if (array_search($res->notice_id, $this->notice_exporte) === false) {
             $this->notice_exporte[] = $res->notice_id;
         }
         $this->toxml();
         $this->current_notice++;
         if ($this->current_notice >= count($this->notice_list)) {
             $this->current_notice = -1;
         }
         return true;
     } else {
         return false;
     }
 }
예제 #21
0
 static function search_form($id_pclass = 0)
 {
     global $user_query, $user_input;
     global $msg;
     global $dbh;
     global $thesaurus_classement_mode_pmb;
     global $charset;
     // Gestion Indexation décimale multiple
     if ($thesaurus_classement_mode_pmb != 0) {
         //la liste des pclassement n'est pas affichée en mode monopclassement
         $base_url = "./autorites.php?categ=indexint&sub=&id=";
         $sel_pclassement = '';
         $requete = "SELECT id_pclass, name_pclass,\ttypedoc FROM pclassement order by id_pclass";
         $result = pmb_mysql_query($requete, $dbh) or die($requete . "<br />" . pmb_mysql_error());
         $sel_pclassement = "<select class='saisie-30em' id='id_pclass' name='id_pclass' ";
         $sel_pclassement .= "onchange = \"document.location = '" . $base_url . "&id_pclass='+document.getElementById('id_pclass').value; \">";
         $sel_pclassement .= "<option value='0' ";
         if ($id_pclass == 0) {
             $sel_pclassement .= " selected";
         }
         $sel_pclassement .= ">" . htmlentities($msg["pclassement_select_index_standart"], ENT_QUOTES, $charset) . "</option>";
         while ($lue = pmb_mysql_fetch_object($result)) {
             $sel_pclassement .= "<option value='" . $lue->id_pclass . "' ";
             if ($lue->id_pclass == $id_pclass) {
                 $sel_pclassement .= " selected";
             }
             $sel_pclassement .= ">" . htmlentities($lue->name_pclass, ENT_QUOTES, $charset) . "</option>";
         }
         $sel_pclassement .= "</select>&nbsp;";
         $pclass_url = "&id_pclass=" . $id_pclass;
         $user_query = str_replace('<!-- sel_pclassement -->', $sel_pclassement, $user_query);
         $user_query = str_replace('<!-- lien_classement -->', "<a href='./autorites.php?categ=indexint&sub=pclass'>" . $msg['pclassement_link_edition'] . "</a> ", $user_query);
     }
     $user_query = str_replace('!!user_query_title!!', $msg[357] . " : " . $msg[indexint_menu_title], $user_query);
     $user_query = str_replace('!!action!!', './autorites.php?categ=indexint&sub=reach&id=', $user_query);
     $user_query = str_replace('!!add_auth_msg!!', $msg["indexint_create_button"], $user_query);
     $user_query = str_replace('!!add_auth_act!!', './autorites.php?categ=indexint&sub=indexint_form' . $pclass_url, $user_query);
     $user_query = str_replace('<!-- lien_derniers -->', "<a href='./autorites.php?categ=indexint&sub=indexint_last{$pclass_url}'>{$msg['indexint_last']}</a>", $user_query);
     $user_query = str_replace("!!user_input!!", htmlentities(stripslashes($user_input), ENT_QUOTES, $charset), $user_query);
     print pmb_bidi($user_query);
 }
예제 #22
0
function show_explnum_in_relation($no_notice, $link_expl = '', $param_aff = array())
{
    global $dbh;
    global $charset;
    global $base_path, $msg;
    global $_mimetypes_bymimetype_, $_mimetypes_byext_;
    global $prefix_url_image;
    if (!$no_notice) {
        return "";
    }
    create_tableau_mimetype();
    // recuperation du nombre d'exemplaires
    $requete = "SELECT explnum_id, explnum_notice, explnum_bulletin, explnum_nom, explnum_mimetype, explnum_url, explnum_vignette, explnum_nomfichier, explnum_extfichier, explnum_docnum_statut\n\t\t\tFROM explnum \n\t\t\tJOIN index_concept on index_concept.num_object = explnum_id AND index_concept.type_object=11\n\t\t\tJOIN vedette_link on vedette_link.num_object=index_concept.num_concept AND vedette_link.type_object=1\n\t\t\tJOIN vedette_object on vedette_object.num_vedette=vedette_link.num_vedette AND vedette_object.object_type=10 and vedette_object.object_id='{$no_notice}'\n\t\t\tORDER BY explnum_mimetype, explnum_id ";
    $res = pmb_mysql_query($requete, $dbh) or die($requete . " " . pmb_mysql_error());
    $nb_ex = pmb_mysql_num_rows($res);
    if ($nb_ex) {
        // on recupere les donnees des exemplaires
        $i = 1;
        while ($expl = pmb_mysql_fetch_object($res)) {
            // couleur de l'img en fonction du statut
            if ($expl->explnum_docnum_statut) {
                $rqt_st = "SELECT * FROM explnum_statut WHERE  id_explnum_statut='" . $expl->explnum_docnum_statut . "' ";
                $Query_statut = pmb_mysql_query($rqt_st, $dbh) or die($rqt_st . " " . pmb_mysql_error());
                $r_statut = pmb_mysql_fetch_object($Query_statut);
                $class_img = " class='docnum_" . $r_statut->class_html . "' ";
                if ($expl->explnum_docnum_statut > 1) {
                    $txt = $r_statut->opac_libelle;
                } else {
                    $txt = "";
                }
                $statut_libelle_div = "\n\t\t\t\t\t<div id='zoom_statut_docnum" . $expl->explnum_id . "' style='border: 2px solid rgb(85, 85, 85); background-color: rgb(255, 255, 255); position: absolute; z-index: 2000; display: none;'>\n\t\t\t\t\t<b>{$txt}</b>\n\t\t\t\t\t</div>\n\t\t\t\t\t";
            } else {
                $class_img = " class='docnum_statutnot1' ";
                $txt = "";
            }
            if ($i == 1) {
                $ligne = "<tr><td class='docnum' width='25%'>!!1!!</td><td class='docnum' width='25%'>!!2!!</td><td class='docnum' width='25%'>!!3!!</td><td class='docnum' width='25%'>!!4!!</td></tr>";
            }
            if ($link_expl) {
                $tlink = str_replace("!!explnum_id!!", $expl->explnum_id, $link_expl);
                $tlink = str_replace("!!notice_id!!", $expl->explnum_notice, $tlink);
                $tlink = str_replace("!!bulletin_id!!", $expl->explnum_bulletin, $tlink);
            }
            $alt = htmlentities($expl->explnum_nom . " - " . $expl->explnum_mimetype, ENT_QUOTES, $charset);
            if ($prefix_url_image) {
                $tmpprefix_url_image = $prefix_url_image;
            } else {
                $tmpprefix_url_image = "./";
            }
            if ($expl->explnum_vignette) {
                $obj = "<img src='" . $tmpprefix_url_image . "vig_num.php?explnum_id={$expl->explnum_id}' alt='{$alt}' title='{$alt}' border='0'>";
            } else {
                // trouver l'icone correspondant au mime_type
                $obj = "<img src='" . $tmpprefix_url_image . "images/mimetype/" . icone_mimetype($expl->explnum_mimetype, $expl->explnum_extfichier) . "' alt='{$alt}' title='{$alt}' border='0'>";
            }
            $obj_suite = "{$statut_libelle_div}\n\t\t\t<a  href='#' onmouseout=\"z=document.getElementById('zoom_statut_docnum" . $expl->explnum_id . "'); z.style.display='none'; \" onmouseover=\"z=document.getElementById('zoom_statut_docnum" . $expl->explnum_id . "'); z.style.display=''; \">\n\t\t\t<div class='vignette_doc_num' ><img {$class_img} width='10' height='10' src='./images/spacer.gif'></div>\n\t\t\t</a>\n\t\t\t";
            $expl_liste_obj = "<center>";
            $expl_liste_obj .= "<a href='" . $tmpprefix_url_image . "doc_num.php?explnum_id={$expl->explnum_id}' alt='{$alt}' title='{$alt}' target='_blank'>" . $obj . "</a>{$obj_suite}<br />";
            if ($_mimetypes_byext_[$expl->explnum_extfichier]["label"]) {
                $explmime_nom = $_mimetypes_byext_[$expl->explnum_extfichier]["label"];
            } elseif ($_mimetypes_bymimetype_[$expl->explnum_mimetype]["label"]) {
                $explmime_nom = $_mimetypes_bymimetype_[$expl->explnum_mimetype]["label"];
            } else {
                $explmime_nom = $expl->explnum_mimetype;
            }
            if ($param_aff["mine_type"]) {
                $explmime_nom = "";
            }
            if ($tlink) {
                $expl_liste_obj .= "<a href='{$tlink}'>";
                $expl_liste_obj .= htmlentities($expl->explnum_nom, ENT_QUOTES, $charset) . "</a><div class='explnum_type'>" . htmlentities($explmime_nom, ENT_QUOTES, $charset) . "</div>";
            } else {
                $expl_liste_obj .= htmlentities($expl->explnum_nom, ENT_QUOTES, $charset) . "<div class='explnum_type'>" . htmlentities($explmime_nom, ENT_QUOTES, $charset) . "</div>";
            }
            //recherche des concepts...
            $query = "select num_concept,value from index_concept join skos_fields_global_index on num_concept = id_item and code_champ = 1  where num_object = " . $expl->explnum_id . " and type_object = 11 order by order_concept";
            $result = pmb_mysql_query($query, $dbh);
            $concept = "";
            if (pmb_mysql_num_rows($result)) {
                while ($row = pmb_mysql_fetch_object($result)) {
                    if ($concept) {
                        $concept .= " / ";
                    }
                    if (SESSrights & AUTORITES_AUTH) {
                        $concept .= "<a href='" . $base_path . "/autorites.php?categ=see&sub=concept&id=" . $row->num_concept . "' title='" . addslashes($msg['concept_menu'] . ": " . htmlentities($row->value, ENT_QUOTES, $charset)) . "'>" . htmlentities($row->value, ENT_QUOTES, $charset) . "</a>";
                    } else {
                        $concept .= "<span title='" . addslashes($msg['concept_menu'] . ": " . htmlentities($row->value, ENT_QUOTES, $charset)) . "'>" . htmlentities($row->value, ENT_QUOTES, $charset) . "</span>";
                    }
                }
            }
            $expl_liste_obj .= $concept . "</center>";
            $ligne = str_replace("!!{$i}!!", $expl_liste_obj, $ligne);
            $i++;
            if ($i == 5) {
                $ligne_finale .= $ligne;
                $i = 1;
            }
        }
        if (!$ligne_finale) {
            $ligne_finale = $ligne;
        } elseif ($i != 1) {
            $ligne_finale .= $ligne;
        }
        $ligne_finale = str_replace('!!2!!', "&nbsp;", $ligne_finale);
        $ligne_finale = str_replace('!!3!!', "&nbsp;", $ligne_finale);
        $ligne_finale = str_replace('!!4!!', "&nbsp;", $ligne_finale);
    } else {
        return "";
    }
    $entry .= "<table class='docnum'>{$ligne_finale}</table>";
    return $entry;
}
예제 #23
0
eval("\$after_list=\"" . ${$var} . "\";");
// le texte avant la liste des ouvrges en retard
$var = "mailretard_" . $relance . "before_list";
eval("\$before_list=\"" . ${$var} . "\";");
// le "Madame, Monsieur," ou tout autre truc du genre "Cher adhérent,"
$var = "mailretard_" . $relance . "madame_monsieur";
eval("\$madame_monsieur=\"" . ${$var} . "\";");
if ($madame_monsieur) {
    $texte_mail .= $madame_monsieur . "\r\n\r\n";
}
if ($before_list) {
    $texte_mail .= $before_list . "\r\n\r\n";
}
//Récupération des exemplaires
$rqt = "select expl_cb from pret, exemplaires where pret_idempr='" . $id_empr . "' and pret_retour < curdate() and pret_idexpl=expl_id order by pret_date ";
$req = pmb_mysql_query($rqt) or die('Erreur SQL !<br />' . $rqt . '<br />' . pmb_mysql_error());
$i = 0;
while ($data = pmb_mysql_fetch_array($req)) {
    /* Récupération des infos exemplaires et prêt */
    $requete = "SELECT notices_m.notice_id as m_id, notices_s.notice_id as s_id, expl_cb, pret_date, pret_retour, tdoc_libelle, section_libelle, location_libelle, trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, ";
    $requete .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, ";
    $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, ";
    $requete .= " IF(pret_retour>sysdate(),0,1) as retard, notices_m.tparent_id, notices_m.tnvol ";
    $requete .= "FROM (((exemplaires LEFT JOIN notices AS notices_m ON expl_notice = notices_m.notice_id ) LEFT JOIN bulletins ON expl_bulletin = bulletins.bulletin_id) LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), docs_type, docs_section, docs_location, pret ";
    $requete .= "WHERE expl_cb='" . addslashes($data['expl_cb']) . "' and expl_typdoc = idtyp_doc and expl_section = idsection and expl_location = idlocation and pret_idexpl = expl_id  ";
    $res = pmb_mysql_query($requete);
    $expl = pmb_mysql_fetch_object($res);
    $responsabilites = array();
    $header_aut = "";
    $responsabilites = get_notice_authors($expl->m_id + $expl->s_id);
    $as = array_search("0", $responsabilites["responsabilites"]);
예제 #24
0
function add_pret($id_empr, $id_expl, $cb_doc)
{
    // le lien MySQL
    global $dbh;
    global $msg;
    global $pmb_quotas_avances;
    /* on prépare la date de début*/
    $pret_date = time();
    /* on cherche la durée du prêt */
    if ($pmb_quotas_avances) {
        //Initialisation de la classe
        $qt = new quota("LEND_TIME_QUOTA");
        $struct["READER"] = $id_empr;
        $struct["EXPL"] = $id_expl;
        $duree_pret = $qt->get_quota_value($struct);
        if ($duree_pret == -1) {
            $duree_pret = 0;
        }
    } else {
        $query = "SELECT duree_pret";
        $query .= " FROM exemplaires, docs_type";
        $query .= " WHERE expl_id='" . $id_expl;
        $query .= "' and idtyp_doc=expl_typdoc LIMIT 1";
        $result = @pmb_mysql_query($query, $dbh) or die("can't SELECT exemplaires " . $query);
        $expl_properties = pmb_mysql_fetch_object($result);
        $duree_pret = $expl_properties->duree_pret;
    }
    // calculer la date de retour prévue
    $pret_retour = $pret_date + 3600 * 24 * $duree_pret;
    // insérer le prêt
    $query = "INSERT INTO pret SET ";
    $query .= "pret_idempr = '" . $id_empr . "', ";
    $query .= "pret_idexpl = '" . $id_expl . "', ";
    $query .= "pret_date   = sysdate(), ";
    $query .= "pret_retour = '" . date("Y-m-d", $pret_retour) . "', ";
    $query .= "retour_initial = '" . date("Y-m-d", $pret_retour) . "' ";
    $result = @pmb_mysql_query($query, $dbh) or die(pmb_mysql_error() . "<br />can't INSERT into pret" . $query);
    // insérer la trace en stat, récupérer l'id et le mettre dans la table des prêts pour la maj ultérieure
    $stat_avant_pret = pret_construit_infos_stat($id_expl);
    $stat_id = stat_stuff($stat_avant_pret);
    $query = "update pret SET pret_arc_id='{$stat_id}' where ";
    $query .= "pret_idempr = '" . $id_empr . "' and ";
    $query .= "pret_idexpl = '" . $id_expl . "' ";
    $result = @pmb_mysql_query($query, $dbh) or die("can't update pret for stats " . $query);
    audit::insert_creation(AUDIT_PRET, $stat_id);
    //enregistrer les champs perso pret
    $p_perso = new pret_parametres_perso("pret");
    $p_perso->rec_fields_perso($stat_id);
    $query = "update exemplaires SET ";
    $query .= "last_loan_date = sysdate() ";
    $query .= "where expl_id= '" . $id_expl . "' ";
    $result = @pmb_mysql_query($query, $dbh) or die("can't update last_loan_date in exemplaires : " . $query);
    $query = "update empr SET ";
    $query .= "last_loan_date = sysdate() ";
    $query .= "where id_empr= '" . $id_empr . "' ";
    $result = @pmb_mysql_query($query, $dbh) or die("can't update last_loan_date in empr : " . $query);
}
예제 #25
0
 function fetch_serial_data()
 {
     global $dbh;
     global $fonction_auteur;
     $myQuery = pmb_mysql_query("SELECT * FROM notices WHERE notice_id='" . $this->serial_id . "' LIMIT 1", $dbh);
     $myPerio = pmb_mysql_fetch_object($myQuery);
     // type du document
     $this->typdoc = $myPerio->typdoc;
     // statut de la notice
     $this->statut = $myPerio->statut;
     $this->commentaire_gestion = $myPerio->commentaire_gestion;
     $this->thumbnail_url = $myPerio->thumbnail_url;
     // code-barre
     $this->code = $myPerio->code;
     // mentions de titre
     $this->tit1 = $myPerio->tit1;
     $this->tit3 = $myPerio->tit3;
     $this->tit4 = $myPerio->tit4;
     // libelle des auteurs
     $this->responsabilites = get_notice_authors($this->serial_id);
     // libelle des éditeurs
     if ($myPerio->ed1_id) {
         $this->ed1_id = $myPerio->ed1_id;
         $editeur = new editeur($this->ed1_id);
         $this->ed1 = $editeur->display;
     }
     if ($myPerio->ed2_id) {
         $this->ed2_id = $myPerio->ed2_id;
         $editeur = new editeur($this->ed2_id);
         $this->ed2 = $editeur->display;
     }
     // année d'édition
     $this->year = $myPerio->year;
     $this->date_parution_perio = serial::get_date_parution($this->year);
     // zone des notes
     $this->n_gen = $myPerio->n_gen;
     $this->n_contenu = $myPerio->n_contenu;
     $this->n_resume = $myPerio->n_resume;
     // mise à jour des catégories
     $this->categories = get_notice_categories($this->serial_id);
     // indexation interne
     if ($myPerio->indexint) {
         $this->indexint = $myPerio->indexint;
         $indexint = new indexint($this->indexint);
         if ($indexint->comment) {
             $this->indexint_lib = $indexint->name . " - " . $indexint->comment;
         } else {
             $this->indexint_lib = $indexint->name;
         }
     }
     // indexation libre
     $this->index_l = $myPerio->index_l;
     // libelle des langues
     $this->langues = get_notice_langues($this->serial_id, 0);
     // langues de la publication
     $this->languesorg = get_notice_langues($this->serial_id, 1);
     // langues originales
     // lien vers une ressource électronique
     $this->lien = $myPerio->lien;
     $this->eformat = $myPerio->eformat;
     $this->signature = $myPerio->signature;
     // Montrer ou pas le bulletinage en opac
     $this->opac_visible_bulletinage = $myPerio->opac_visible_bulletinage;
     // Autoriser la demande d'abonnement à l'OPAC
     $this->opac_serialcirc_demande = $myPerio->opac_serialcirc_demande;
     $this->indexation_lang = $myPerio->indexation_lang;
     $this->is_new = $myPerio->notice_is_new;
     $this->date_is_new = $myPerio->notice_date_is_new;
     $this->notice_link = array();
     //liens vers autres notices
     $requete = "\n\t\tSELECT notices_relations.* FROM notices_relations\n\t\tLEFT OUTER JOIN bulletins ON bulletins.num_notice=notices_relations.num_notice AND bulletins.bulletin_notice=notices_relations.linked_notice\n\t\tWHERE (notices_relations.num_notice=" . $this->serial_id . " OR notices_relations.linked_notice=" . $this->serial_id . ")\n\t\tAND (bulletin_notice IS NULL OR bulletins.bulletin_notice!=" . $this->serial_id . ")\n\t\tORDER BY rank";
     $result_rel = pmb_mysql_query($requete) or die(pmb_mysql_error());
     if (pmb_mysql_num_rows($result_rel)) {
         $i = 0;
         while ($r_rel = pmb_mysql_fetch_object($result_rel)) {
             if ($r_rel->linked_notice == $this->serial_id) {
                 //notice en cours est notice fille
                 $this->notice_link['down'][$i]['relation_direction'] = 'down';
                 $this->notice_link['down'][$i]['id_notice'] = $r_rel->num_notice;
                 $this->notice_link['down'][$i]['title_notice'] = $this->get_notice_title($r_rel->num_notice);
                 $this->notice_link['down'][$i]['rank'] = $r_rel->rank;
                 $this->notice_link['down'][$i]['relation_type'] = $r_rel->relation_type;
             } elseif ($r_rel->num_notice == $this->serial_id) {
                 //notice en cours est notice mere
                 $this->notice_link['up'][$i]['relation_direction'] = 'up';
                 $this->notice_link['up'][$i]['id_notice'] = $r_rel->linked_notice;
                 $this->notice_link['up'][$i]['title_notice'] = $this->get_notice_title($r_rel->linked_notice);
                 $this->notice_link['up'][$i]['rank'] = $r_rel->rank;
                 $this->notice_link['up'][$i]['relation_type'] = $r_rel->relation_type;
             }
             $i++;
         }
     }
     $this->create_date = $myPerio->create_date;
     $this->update_date = $myPerio->update_date;
     return $myQuery->nbr_rows;
 }
예제 #26
0
function get_expl($expl, $show_in_reception = 0, $return_count = false)
{
    global $msg, $dbh, $charset;
    global $base_path, $class_path;
    global $cart_link_non;
    global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises;
    global $pmb_transferts_actif;
    global $pmb_expl_list_display_comments;
    global $pmb_sur_location_activate;
    global $pmb_expl_data;
    // attention, $bul est un array
    if (!sizeof($expl) || !is_array($expl)) {
        return $msg["bull_no_expl"];
    }
    $explr_tab_invis = explode(",", $explr_invisible);
    $explr_tab_unmod = explode(",", $explr_visible_unmod);
    $explr_tab_modif = explode(",", $explr_visible_mod);
    //	$th_sur_location="";
    //	if($pmb_sur_location_activate)$th_sur_location="<th>".$msg["sur_location_expl"]."</th>";
    //
    //	$result  = "<table border=\"0\" cellspacing=\"1\">";
    //	$result .= "<tr><th>".$msg[293]."</th><th>".$msg[4016]."</th>$th_sur_location<th>".$msg[4017]."</th><th>".$msg[4018]."</th><th>".$msg[4019]."</th><th>".$msg[4015]."</th><th></th>";
    //	while(list($cle, $valeur) = each($expl)) {
    //		$requete = "SELECT pret_idempr, ";
    //		$requete .= " date_format(pret_retour, '".$msg["format_date"]."') as aff_pret_retour ";
    //		$requete .= " FROM pret ";
    //		$requete .= " WHERE pret_idexpl='$valeur->expl_id' ";
    //		$result_prets = pmb_mysql_query($requete, $dbh) or die ("<br />".pmb_mysql_error()."<br />".$requete);
    //		if (pmb_mysql_num_rows($result_prets)) $expl_pret = pmb_mysql_fetch_object($result_prets) ;
    //		else $expl_pret="";
    //		$situation = "";
    //		// prêtable ou pas s'il est prêté, on affiche son état
    //		if (is_object($expl_pret) && $expl_pret->pret_idempr) {
    //			// exemplaire sorti
    //			$rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='$expl_pret->pret_idempr' ";
    //			$res_empr = pmb_mysql_query($rqt_empr, $dbh) ;
    //			$res_empr_obj = pmb_mysql_fetch_object($res_empr) ;
    //			$situation = "<strong>${msg[358]} ".$expl_pret->aff_pret_retour."</strong>";
    //			global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
    //			if (!$show_in_reception && $empr_show_caddie && (SESSrights & CIRCULATION_AUTH)) {
    //				$img_ajout_empr_caddie="<img src='./images/basket_empr.gif' align='middle' alt='basket' title=\"${msg[400]}\" onClick=\"openPopUp('./cart.php?object_type=EMPR&item=".$expl->pret_idempr."', 'cart', 600, 700, -2, -2, '$selector_prop_ajout_caddie_empr')\">&nbsp;";
    //			} else {
    //				$img_ajout_empr_caddie="";
    //			}
    //			if (!$show_in_reception) {
    //				$situation .= "<br />$img_ajout_empr_caddie<a href='./circ.php?categ=pret&form_cb=".rawurlencode($res_empr_obj->empr_cb)."'>$res_empr_obj->empr_prenom $res_empr_obj->empr_nom</a>";
    //			} else {
    //				$situation .= "<br />$res_empr_obj->empr_prenom $res_empr_obj->empr_nom";
    //			}
    //		} else {
    //			// tester si réservé
    //			$result_resa = pmb_mysql_query("select 1 from resa where resa_cb='".addslashes($valeur->expl_cb)."' ", $dbh) or die ();
    //			$reserve = pmb_mysql_num_rows($result_resa);
    //			if ($reserve)
    //				$situation = "<strong>".$msg['expl_reserve']."</strong>"; // exemplaire réservé
    //			elseif ($valeur->pret_flag)
    //				$situation = "<strong>${msg[359]}</strong>"; // exemplaire disponible
    //			else
    //				$situation = "";
    //		}
    //
    //		if(!$show_in_reception && (SESSrights & CATALOGAGE_AUTH)){
    //			$selector_prop = "toolbar=no, dependent=yes, resizable=yes, scrollbars=yes";
    //			$cart_click_expl = "onClick=\"openPopUp('./cart.php?object_type=EXPL&item=!!item!!', 'cart', 600, 700, -2, -2, '$selector_prop')\"";
    //			$cart_link = "<img src='./images/basket_small_20x20.gif' align='center' alt='middle' title=\"${msg[400]}\" $cart_click_expl>";
    //			$ajout_expl_panier = str_replace('!!item!!', $valeur->expl_id, $cart_link) ;
    //		}else{
    //			$ajout_expl_panier ="";
    //		}
    //
    //		//si les transferts sont activés
    //		if (!$show_in_reception && $pmb_transferts_actif) {
    //			//si l'exemplaire n'est pas transferable on a une image vide
    //			$dispo_pour_transfert = transfert::est_transferable ( $valeur->expl_id );
    //			if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert)
    //				//l'icon de demande de transfert
    //				$ajout_expl_panier .= "<a href=\"#\" onClick=\"openPopUp('./catalog/transferts/transferts_popup.php?expl=" . $valeur->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\">" . "<img src='./images/peb_in.png' align='center' border=0 alt=\"" . $msg ["transferts_alt_libelle_icon"] . "\" title=\"" . $msg ["transferts_alt_libelle_icon"] . "\"></a>";
    //			else
    //				$ajout_expl_panier .= "<img src='./images/spacer.gif' align='center' height=20 width=20>";
    //
    //		}
    //
    //		$as_invis = false;
    //		$as_unmod = false;
    //		$as_modif = true;
    //		global $flag_no_delete_bulletin;
    //		$flag_no_delete_bulletin=0;
    //		//visibilité des exemplaires
    //		if ($pmb_droits_explr_localises) {
    //			$as_invis = in_array($valeur->expl_location,$explr_tab_invis);
    //			$as_unmod = in_array($valeur->expl_location,$explr_tab_unmod);
    //			//$as_modif = in_array($valeur->expl_location,$explr_tab_modif);
    //
    //			if(!($as_modif=in_array  ($valeur->expl_location,$explr_tab_modif) )) $flag_no_delete_bulletin=1;
    //
    //		}
    //		if ($show_in_reception || $cart_link_non || !(SESSrights & CATALOGAGE_AUTH))
    //			$link =  htmlentities($valeur->expl_cb,ENT_QUOTES, $charset);
    //		else {
    //			if ($as_modif) {
    //				$link = "<a href=\"./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=".$valeur->expl_bulletin."&expl_id=".$valeur->expl_id."\">".htmlentities($valeur->expl_cb,ENT_QUOTES, $charset)."</a>";
    //			} else {
    //				$link = htmlentities($valeur->expl_cb,ENT_QUOTES, $charset);
    //			}
    //		}
    //
    //		if ($situation) $situation="<br />".$situation;
    //		if(!$show_in_reception && SESSrights & CATALOGAGE_AUTH){
    //			$ajout_expl_panier.="<span id='EXPL_drag_".$valeur->expl_id."'  dragicon=\"$base_path/images/icone_drag_notice.png\" dragtext=\"".htmlentities($valeur->expl_cb,ENT_QUOTES, $charset)."\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"".$base_path."/images/notice_drag.png\"/></span>";
    //		}
    //
    //		$line = "<tr>";
    //		if (($valeur->expl_note || $valeur->expl_comment) && $pmb_expl_list_display_comments) $line .= "<td rowspan='2'>$link</td>";
    //		else $line .= "<td>$link</td>";
    //		$line .= "<td>$valeur->expl_cote</td>";
    //		if($pmb_sur_location_activate) $line .= "<td>$valeur->sur_loc_libelle</td>";
    //		$line .= "<td>$valeur->location_libelle</td>";
    //		$line .= "<td>$valeur->section_libelle</td>";
    //		$line .= "<td>$valeur->statut_libelle.$situation</td>";
    //		$line .= "<td>$valeur->tdoc_libelle</td>";
    //		$line .= "<td>$ajout_expl_panier</td>";
    //		if (($valeur->expl_note || $valeur->expl_comment) && $pmb_expl_list_display_comments) {
    //			$notcom=array();
    //			$line .= "<tr><td colspan='6'>";
    //			if ($valeur->expl_note && ($pmb_expl_list_display_comments & 1)) $notcom[] .= "<span class='erreur'>$valeur->expl_note</span>";
    //			if ($valeur->expl_comment && ($pmb_expl_list_display_comments & 2)) $notcom[] .= "$valeur->expl_comment";
    //			$line .= implode("<br />",$notcom);
    //			$line .= "</tr>";
    //		}
    //		$result .= $line;
    //	} //while(list($cle, $valeur) = each($expl))
    //
    //	$result .= "</table>";
    //
    //maintenant
    //Liste des champs d'exemplaires
    if ($pmb_sur_location_activate) {
        $surloc_field = "surloc_libelle,";
    }
    if (!$pmb_expl_data) {
        $pmb_expl_data = "expl_cb,expl_cote," . $surloc_field . "location_libelle,section_libelle,statut_libelle,tdoc_libelle";
    }
    $colonnesarray = explode(",", $pmb_expl_data);
    if (!in_array("expl_cb", $colonnesarray)) {
        array_unshift($colonnesarray, "expl_cb");
    }
    $total_columns = count($colonnesarray);
    //Présence de champs personnalisés
    if (strstr($pmb_expl_data, "#")) {
        require_once $class_path . "/parametres_perso.class.php";
        $cp = new parametres_perso("expl");
    }
    if ($return_count) {
        return count($expl);
    }
    if (count($expl)) {
        $result .= "<table border=\"0\" cellspacing=\"1\">";
        //un premier tour pour aller chercher les libellés...
        for ($i = 0; $i < count($colonnesarray); $i++) {
            if (substr($colonnesarray[$i], 0, 1) == "#") {
                //champs personnalisés
                if (!$cp->no_special_fields) {
                    $id = substr($colonnesarray[$i], 1);
                    $entry .= "<th>" . htmlentities($cp->t_fields[$id][TITRE], ENT_QUOTES, $charset) . "</th>";
                }
            } else {
                eval("\$colencours=\$msg['expl_header_" . $colonnesarray[$i] . "'];");
                $entry .= "<th>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</th>";
            }
        }
        $result .= "<tr>" . $entry . "<th>&nbsp;</th></tr>";
        foreach ($expl as $exemplaire) {
            $requete = "SELECT pret_idempr, ";
            $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour ";
            $requete .= " FROM pret ";
            $requete .= " WHERE pret_idexpl='{$exemplaire->expl_id}' ";
            $result_prets = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
            if (pmb_mysql_num_rows($result_prets)) {
                $expl_pret = pmb_mysql_fetch_object($result_prets);
            } else {
                $expl_pret = "";
            }
            $situation = "";
            // prêtable ou pas s'il est prêté, on affiche son état
            if (is_object($expl_pret) && $expl_pret->pret_idempr) {
                // exemplaire sorti
                $rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='{$expl_pret->pret_idempr}' ";
                $res_empr = pmb_mysql_query($rqt_empr, $dbh);
                $res_empr_obj = pmb_mysql_fetch_object($res_empr);
                $situation = "<strong>{$msg[358]} " . $expl_pret->aff_pret_retour . "</strong>";
                global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
                if (!$show_in_reception && $empr_show_caddie && SESSrights & CIRCULATION_AUTH) {
                    $img_ajout_empr_caddie = "<img src='./images/basket_empr.gif' align='middle' alt='basket' title=\"{$msg[400]}\" onClick=\"openPopUp('./cart.php?object_type=EMPR&item=" . $exemplaire->pret_idempr . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}')\">&nbsp;";
                } else {
                    $img_ajout_empr_caddie = "";
                }
                if (!$show_in_reception) {
                    $situation .= "<br />{$img_ajout_empr_caddie}<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($res_empr_obj->empr_cb) . "'>{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}</a>";
                } else {
                    $situation .= "<br />{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}";
                }
            } else {
                // tester si réservé
                $result_resa = pmb_mysql_query("select 1 from resa where resa_cb='" . addslashes($exemplaire->expl_cb) . "' ", $dbh) or die;
                $reserve = pmb_mysql_num_rows($result_resa);
                if ($reserve) {
                    $situation = "<strong>" . $msg['expl_reserve'] . "</strong>";
                    // exemplaire réservé
                } elseif ($exemplaire->pret_flag) {
                    $situation = "<strong>{$msg[359]}</strong>";
                    // exemplaire disponible
                } else {
                    $situation = "";
                }
            }
            if (!$show_in_reception && SESSrights & CATALOGAGE_AUTH) {
                $selector_prop = "toolbar=no, dependent=yes, resizable=yes, scrollbars=yes";
                $cart_click_expl = "onClick=\"openPopUp('./cart.php?object_type=EXPL&item=!!item!!', 'cart', 600, 700, -2, -2, '{$selector_prop}')\"";
                $cart_link = "<img src='./images/basket_small_20x20.gif' align='center' alt='middle' title=\"{$msg[400]}\" {$cart_click_expl}>";
                $ajout_expl_panier = str_replace('!!item!!', $exemplaire->expl_id, $cart_link);
            } else {
                $ajout_expl_panier = "";
            }
            //si les transferts sont activés
            if (!$show_in_reception && $pmb_transferts_actif) {
                //si l'exemplaire n'est pas transferable on a une image vide
                $dispo_pour_transfert = transfert::est_transferable($exemplaire->expl_id);
                if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert) {
                    //l'icon de demande de transfert
                    $ajout_expl_panier .= "<a href=\"#\" onClick=\"openPopUp('./catalog/transferts/transferts_popup.php?expl=" . $exemplaire->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\">" . "<img src='./images/peb_in.png' align='center' border=0 alt=\"" . $msg["transferts_alt_libelle_icon"] . "\" title=\"" . $msg["transferts_alt_libelle_icon"] . "\"></a>";
                } else {
                    $ajout_expl_panier .= "<img src='./images/spacer.gif' align='center' height=20 width=20>";
                }
            }
            $as_invis = false;
            $as_unmod = false;
            $as_modif = true;
            global $flag_no_delete_bulletin;
            $flag_no_delete_bulletin = 0;
            //visibilité des exemplaires
            if ($pmb_droits_explr_localises) {
                $as_invis = in_array($exemplaire->expl_location, $explr_tab_invis);
                $as_unmod = in_array($exemplaire->expl_location, $explr_tab_unmod);
                //$as_modif = in_array($exemplaire->expl_location,$explr_tab_modif);
                if (!($as_modif = in_array($exemplaire->expl_location, $explr_tab_modif))) {
                    $flag_no_delete_bulletin = 1;
                }
            }
            if ($show_in_reception || $cart_link_non || !(SESSrights & CATALOGAGE_AUTH)) {
                $link = htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset);
            } else {
                if ($as_modif) {
                    $link = "<a href=\"./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=" . $exemplaire->expl_bulletin . "&expl_id=" . $exemplaire->expl_id . "\">" . htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset) . "</a>";
                } else {
                    $link = htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset);
                }
            }
            if ($situation) {
                $situation = "<br />" . $situation;
            }
            if (!$show_in_reception && SESSrights & CATALOGAGE_AUTH) {
                $ajout_expl_panier .= "<span id='EXPL_drag_" . $exemplaire->expl_id . "'  dragicon=\"{$base_path}/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset) . "\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"" . $base_path . "/images/notice_drag.png\"/></span>";
            }
            global $pmb_serialcirc_subst;
            if ($pmb_serialcirc_subst) {
                $ajout_expl_panier .= "<img src='./images/print.gif' alt='Imprimer...' title='Imprimer...' align='middle' border='0'\tstyle='padding-left:7px' \t\t\t\n\t\t\t\t\tonclick=\"openPopUp('./ajax.php?module=circ&categ=periocirc&sub=print_cote&expl_id=" . $exemplaire->expl_id . "', 'circulation', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\"\n\t\t\t\t>";
            }
            $line = "<tr>";
            for ($i = 0; $i < count($colonnesarray); $i++) {
                if ($i == 0 && ($exemplaire->expl_note || $exemplaire->expl_comment) && $pmb_expl_list_display_comments) {
                    $expl_rowspan = "rowspan='2'";
                } else {
                    $expl_rowspan = "";
                }
                $aff_column = "";
                if (substr($colonnesarray[$i], 0, 1) == "#") {
                    //champs personnalisés
                    $id = substr($colonnesarray[$i], 1);
                    $cp->get_values($exemplaire->expl_id);
                    if (!$cp->no_special_fields) {
                        $temp = $cp->get_formatted_output($cp->values[$id], $id);
                        if (!$temp) {
                            $temp = "&nbsp;";
                        }
                        $aff_column .= $temp;
                    }
                } else {
                    eval("\$colencours=\$exemplaire->" . $colonnesarray[$i] . ";");
                    if ($colonnesarray[$i] == "expl_cb") {
                        $aff_column = $link;
                    } else {
                        if ($colonnesarray[$i] == "expl_cote") {
                            $aff_column = "<strong>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</strong>";
                        } else {
                            if ($colonnesarray[$i] == "surloc_libelle") {
                                $aff_column = htmlentities($exemplaire->sur_loc_libelle, ENT_QUOTES, $charset);
                            } else {
                                if ($colonnesarray[$i] == "statut_libelle") {
                                    $aff_column = htmlentities($colencours, ENT_QUOTES, $charset) . $situation;
                                } else {
                                    $aff_column = htmlentities($colencours, ENT_QUOTES, $charset);
                                }
                            }
                        }
                    }
                }
                $line .= "<td {$expl_rowspan}>" . $aff_column . "</td>";
            }
            $line .= "<td>{$ajout_expl_panier}</td>";
            $line .= "</tr>";
            if (($exemplaire->expl_note || $exemplaire->expl_comment) && $pmb_expl_list_display_comments) {
                $notcom = array();
                $line .= "<tr><td colspan='" . $total_columns . "'>";
                if ($exemplaire->expl_note && $pmb_expl_list_display_comments & 1) {
                    $notcom[] .= "<span class='erreur'>{$exemplaire->expl_note}</span>";
                }
                if ($exemplaire->expl_comment && $pmb_expl_list_display_comments & 2) {
                    $notcom[] .= "{$exemplaire->expl_comment}";
                }
                $line .= implode("<br />", $notcom);
                $line .= "</tr>";
            }
            $result .= $line;
        }
        $result .= "</table>";
    }
    return $result;
}
예제 #27
0
 public function _get_pert($with_explnum = false, $return_query = false)
 {
     global $opac_allow_term_troncat_search;
     global $empty_word;
     $with_explnum = false;
     $query_pert_explnum = "";
     $troncat = "";
     if ($opac_allow_term_troncat_search) {
         $troncat = "%";
     }
     $terms = $this->aq->get_positive_terms_obj($this->aq->tree);
     $words = array();
     $literals = array();
     $queries = array();
     if ($this->notices_ids) {
         foreach ($terms as $term) {
             if (!$term->literal) {
                 if (!in_array($term, $words)) {
                     $words[] = $term;
                 }
             } else {
                 $literals[] = $term;
             }
         }
         if ($this->aq->input !== "*") {
             $query_pert_explnum = "";
             if (count($words)) {
                 $pert_query_words = "";
                 $pert_query_words .= "select num_obj, sum(!!pert!!) as pert from cms_editorial_words_global_index join words on num_word = id_word where type='" . $this->type_obj . "' and ";
                 $where = "";
                 foreach ($words as $term) {
                     if ($where != "") {
                         $where .= " or ";
                     }
                     $crit = "word ";
                     if (strpos($term->word, "*") !== false || $opac_allow_term_troncat_search) {
                         if (strpos($term->word, "*") === false) {
                             //Si c'est un mot vide, on ne troncature pas
                             if (in_array($term->word, $empty_word) === false) {
                                 if ($term->not) {
                                     $crit .= "not ";
                                 }
                                 $crit .= "like '" . addslashes($term->word . $troncat) . "'";
                             } else {
                                 if ($term->not) {
                                     $crit .= "! ";
                                 }
                                 $crit .= "= '" . addslashes($term->word) . "'";
                             }
                         } else {
                             if ($term->not) {
                                 $crit .= "not ";
                             }
                             $crit .= "like '" . addslashes(str_replace("*", "%", $term->word)) . "'";
                         }
                     } else {
                         if ($term->not) {
                             $crit .= "!";
                         }
                         $crit .= "= '" . addslashes($term->word) . "'";
                     }
                     $where .= " " . $crit;
                     $pert_query_words = str_replace("!!pert!!", "((" . $crit . ") * pond *" . $term->pound . ")+!!pert!!", $pert_query_words);
                 }
                 $where .= count($restrict) > 0 ? " and " . $this->aq->get_field_restrict($restrict, $neg_restrict) : "";
                 $pert_query_words = str_replace("!!pert!!", 0, $pert_query_words);
                 if ($all_fields && $opac_exclude_fields != "") {
                     $where .= " and code_champ not in (" . $opac_exclude_fields . ")";
                 }
                 $queries[] = $pert_query_words . $where . " group by num_obj ";
             }
             if (count($literals)) {
                 $pert_query_literals = "select distinct num_obj, sum(!!pert!!) as pert from cms_editorial_fields_global_index where type='" . $this->type_obj . "' and ";
                 $where = "";
                 foreach ($literals as $term) {
                     //on n'ajoute pas une clause dans le where qui parcours toute la base...
                     if ($where != "") {
                         $where .= " or ";
                     }
                     $crit = "value ";
                     if ($term->not) {
                         $crit .= "not ";
                     }
                     $crit .= "like '" . ($term->start_with == 0 ? "%" : "") . addslashes(str_replace("*", "%", $term->word)) . "%'";
                     $where .= " " . $crit;
                     $crit = str_replace("%%", "%", $crit);
                     $pert_query_literals = str_replace("!!pert!!", "((" . $crit . ") * pond *" . $term->pound . ")+!!pert!!", $pert_query_literals);
                 }
                 $where .= count($restrict) > 0 ? " and " . $this->aq->get_field_restrict($restrict, $neg_restrict) : "";
                 $pert_query_literals = str_replace("!!pert!!", 0, $pert_query_literals);
                 if ($all_fields && $opac_exclude_fields != "") {
                     $where .= " and code_champ not in (" . $opac_exclude_fields . ")";
                 }
                 $queries[] = $pert_query_literals . $where . " group by num_obj ";
             }
             $query = "select distinct num_obj, sum(pert) as pert from ((" . implode(") union all (", $queries) . ")) as uni where num_obj in (" . $this->notices_ids . ") group by num_obj";
         } else {
             $query = "select id_" . $this->type_obj . " as num_obj, 100 as pert from cms_" . $this->type_obj . "s where id_" . $this->type_obj . " in (" . $this->notices_ids . ")";
         }
     }
     if ($return_query) {
         return $query;
     } else {
         $table = "search_result" . md5(microtime(true));
         $rqt = "create temporary table " . $table . " {$query}";
         $res = pmb_mysql_query($rqt) or die(pmb_mysql_error());
         pmb_mysql_query("alter table " . $table . " add index i_id(num_obj)");
         return $table;
     }
 }
예제 #28
0
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: save_notice_pos.php,v 1.9 2016-01-05 09:17:03 ngantier Exp $
$base_path = ".";
$base_noheader = 1;
$base_nobody = 1;
$base_auth = "ADMINISTRATION_AUTH";
require_once "includes/init.inc.php";
if (!$grille_typdoc) {
    $grille_typdoc = 'a';
}
if (!$grille_niveau_biblio) {
    $grille_niveau_biblio = 'm';
}
$requete = "delete from grilles where grille_niveau_biblio='{$grille_niveau_biblio}' and grille_typdoc='{$grille_typdoc}' " . ($grille_location ? "and grille_localisation='{$grille_location}' " : "");
$res = pmb_mysql_query($requete, $dbh) or die("Big problem: <br />" . pmb_mysql_error() . "<br />{$requete}");
$requete = "insert into grilles set grille_niveau_biblio='{$grille_niveau_biblio}', grille_typdoc='{$grille_typdoc}', " . ($grille_location ? "grille_localisation='{$grille_location}', " : "") . "descr_format='" . $datas . "' ";
$res = pmb_mysql_query($requete, $dbh) or die("Big problem: <br />" . pmb_mysql_error() . "<br />{$requete}");
echo "OK";
예제 #29
0
function identifiants_thesaurus($thesaurus_name, $langues_thesaurus = 'fr_FR')
{
    global $charset;
    $q = "select id_thesaurus from thesaurus where libelle_thesaurus='" . addslashes($thesaurus_name) . "'";
    $r = pmb_mysql_query($q);
    if ($o = pmb_mysql_fetch_object($r)) {
        $res[NUMTHESAURUS] = $o->id_thesaurus;
        $q = "select id_noeud, autorite from noeuds where num_thesaurus=" . $o->id_thesaurus . " and autorite in ('TOP','NONCLASSES','ORPHELINS') ";
        $r = pmb_mysql_query($q) or die(pmb_mysql_error() . "<br><br>{$q}<br><br>");
        while ($o = pmb_mysql_fetch_object($r)) {
            $res[$o->autorite] = $o->id_noeud;
        }
        return $res;
    } else {
        $q = "INSERT INTO thesaurus (id_thesaurus, libelle_thesaurus, langue_defaut, active, opac_active, num_noeud_racine) VALUES (0, '" . addslashes($thesaurus_name) . "', '{$langues_thesaurus}', '1', '1', 0)";
        $r = pmb_mysql_query($q) or die(pmb_mysql_error() . "<br><br>{$q}<br><br>");
        $res[NUMTHESAURUS] = pmb_mysql_insert_id();
        $q = "INSERT INTO noeuds (id_noeud, autorite, num_parent, num_renvoi_voir, visible, num_thesaurus) VALUES (0, 'TOP', 0, 0, '0', " . $res[NUMTHESAURUS] . ")";
        $r = pmb_mysql_query($q) or die(pmb_mysql_error() . "<br><br>{$q}<br><br>");
        $res[TOP] = pmb_mysql_insert_id();
        $q = "update thesaurus set num_noeud_racine=" . $res[TOP] . " where id_thesaurus=" . $res[NUMTHESAURUS] . " ";
        $r = pmb_mysql_query($q) or die(pmb_mysql_error() . "<br><br>{$q}<br><br>");
        $q = "INSERT INTO noeuds (id_noeud, autorite, num_parent, num_renvoi_voir, visible, num_thesaurus) VALUES (0, 'NONCLASSES', " . $res[TOP] . ", 0, '0', " . $res[NUMTHESAURUS] . ")";
        $r = pmb_mysql_query($q) or die(pmb_mysql_error() . "<br><br>{$q}<br><br>");
        $res[NONCLASSES] = pmb_mysql_insert_id();
        $q = "INSERT INTO noeuds (id_noeud, autorite, num_parent, num_renvoi_voir, visible, num_thesaurus) VALUES (0, 'ORPHELINS', " . $res[TOP] . ", 0, '0', " . $res[NUMTHESAURUS] . ")";
        $r = pmb_mysql_query($q) or die(pmb_mysql_error() . "<br><br>{$q}<br><br>");
        $res[ORPHELINS] = pmb_mysql_insert_id();
        $tmp = '~termes non classés';
        if ($charset == 'utf-8') {
            $tmp = utf8_encode($tmp);
        }
        $q = "INSERT INTO categories (num_thesaurus,num_noeud, langue, libelle_categorie, note_application, comment_public, comment_voir, index_categorie) VALUES (" . $res[NUMTHESAURUS] . ", " . $res[NONCLASSES] . ", 'fr_FR', '" . $tmp . "', '', '', '', ' termes non classes ')";
        $r = pmb_mysql_query($q) or die(pmb_mysql_error() . "<br><br>{$q}<br><br>");
        $q = "INSERT INTO categories (num_thesaurus,num_noeud, langue, libelle_categorie, note_application, comment_public, comment_voir, index_categorie) VALUES (" . $res[NUMTHESAURUS] . ", " . $res[ORPHELINS] . ", 'fr_FR', '~termes orphelins', '', '', '', ' termes orphelins ')";
        $r = pmb_mysql_query($q) or die(pmb_mysql_error() . "<br><br>{$q}<br><br>");
        return $res;
    }
}
예제 #30
0
function affecte_cb($cb, $id_resa = 0)
{
    global $dbh;
    global $pmb_utiliser_calendrier, $pmb_location_reservation, $pmb_transferts_actif, $transferts_choix_lieu_opac, $deflt_docs_location;
    // chercher s'il s'agit d'une notice ou d'un bulletin
    $rqt = "SELECT expl_notice, expl_bulletin FROM exemplaires WHERE expl_cb='" . $cb . "' ";
    $res = pmb_mysql_query($rqt, $dbh);
    $nb = pmb_mysql_num_rows($res);
    if (!$nb) {
        return 0;
    }
    $obj = pmb_mysql_fetch_object($res);
    if ($id_resa == 0) {
        if ($pmb_transferts_actif == "1") {
            switch ($transferts_choix_lieu_opac) {
                case "1":
                    //retrait de la resa sur lieu choisi par le lecteur
                    $where = " AND resa_loc_retrait=" . $deflt_docs_location;
                    break;
                case "2":
                    //retrait de la resa sur lieu fixé
                    $where = " AND resa_loc_retrait=" . $deflt_docs_location;
                    break;
                case "3":
                    //retrait de la resa sur lieu exemplaire
                    if (!$pmb_location_reservation) {
                        $from = " ,exemplaires ";
                        $where = " AND expl_cb='{$cb}' and expl_location=" . $deflt_docs_location;
                    } else {
                        $where = " and expl_location=" . $deflt_docs_location;
                    }
                    break;
                default:
                    //retrait de la resa sur lieu lecteur
                    if (!$pmb_location_reservation) {
                        $from = " ,empr ";
                    }
                    $where = " AND resa_idempr=id_empr and empr_location=" . $deflt_docs_location;
                    break;
            }
            //switch $transferts_choix_lieu_opac
        }
        if ($pmb_location_reservation) {
            $from_loc_resa = " ,empr, resa_loc, exemplaires ";
            $sql_loc_resa = " and resa_idempr=id_empr and empr_location=resa_emprloc and resa_loc='{$deflt_docs_location}' ";
            $sql_loc_resa .= " and expl_location=resa_loc AND expl_cb='{$cb}' ";
        }
        // chercher le premier (par ordre de rang, donc de date de début de résa, non validé
        $rqt = "SELECT id_resa, resa_idempr, resa_loc_retrait, resa_date_fin, resa_planning_id_resa\n\t\t\t\t\t\tFROM resa {$from} {$from_loc_resa}\n\t\t\t\tWHERE resa_idnotice='" . $obj->expl_notice . "'\n\t\t\t\t\tAND resa_idbulletin='" . $obj->expl_bulletin . "'\n\t\t\t\t\tAND resa_cb=''\n\t\t\t\t\t{$where}\n\t\t\t\t\t{$sql_loc_resa}\n\t\t\t\tORDER BY resa_date ";
    } else {
        //on sait de quelle resa on parle ...
        $rqt = "SELECT id_resa, resa_idempr,resa_loc_retrait, resa_date_fin, resa_planning_id_resa FROM resa WHERE id_resa='" . $id_resa . "'";
    }
    $res = pmb_mysql_query($rqt, $dbh);
    if (!pmb_mysql_num_rows($res)) {
        return 0;
    }
    $obj_resa = pmb_mysql_fetch_object($res);
    /*
    	$rqt_loc_retrait="";
    	if($pmb_transferts_actif) {
    $rqt = "SELECT empr_location FROM resa INNER JOIN empr ON resa_idempr = id_empr WHERE id_resa=".$obj_resa->id_resa;
    $res = pmb_mysql_query($rqt);
    $empr_location = pmb_mysql_result($res,0) ;
    if($obj_resa->resa_loc_retrait==$deflt_docs_location || $empr_location==$deflt_docs_location) {
    	$rqt_loc_retrait.= ", resa_loc_retrait='$deflt2docs_location' " ;
    } else return 0 ;
    	}
    */
    if ($obj_resa->resa_date_fin == '0000-00-00' || $obj_resa->resa_planning_id_resa == 0) {
        $nb_days = get_time($obj_resa->resa_idempr, $obj->expl_notice, $obj->expl_bulletin);
        $rqt_date = "select date_add(sysdate(), INTERVAL '{$nb_days}' DAY) as date_fin ";
        $resultatdate = pmb_mysql_query($rqt_date);
        $res = pmb_mysql_fetch_object($resultatdate);
        $date_fin = $res->date_fin;
    } else {
        $date_fin = $obj_resa->resa_date_fin;
    }
    if ($pmb_utiliser_calendrier) {
        $rqt_date = "select date_ouverture from ouvertures where ouvert=1 and num_location={$deflt_docs_location} and to_days(date_ouverture)>=to_days('{$date_fin}') order by date_ouverture ";
        $resultatdate = pmb_mysql_query($rqt_date);
        $res = @pmb_mysql_fetch_object($resultatdate);
        if ($res->date_ouverture) {
            $date_fin = $res->date_ouverture;
        }
    }
    // mettre resa_cb à jour pour cette resa
    $rqt = "update resa set resa_cb='" . $cb . "' ";
    $rqt .= ", resa_date_debut=sysdate() ";
    $rqt .= ", resa_date_fin='{$date_fin}', resa_loc_retrait='{$deflt_docs_location}' ";
    $rqt .= " where id_resa='" . $obj_resa->id_resa . "' ";
    $res = pmb_mysql_query($rqt, $dbh) or die(pmb_mysql_error() . " <br />{$rqt}");
    $rqt = "delete from resa_ranger where resa_cb='" . $cb . "' ";
    $res = pmb_mysql_query($rqt, $dbh);
    return $obj_resa->id_resa;
}