Esempio n. 1
0
function get_info_expl_old($cb_expl)
{
    global $dbh, $msg;
    if ($cb_expl) {
        $query = "select * from exemplaires  left join docs_type on exemplaires.expl_typdoc=docs_type.idtyp_doc where expl_cb='{$cb_expl}' ";
        $result = pmb_mysql_query($query, $dbh);
        if ($r = pmb_mysql_fetch_array($result)) {
            $info_expl->error_message = "";
            // empr ok
            $info_expl->id_expl = $r['expl_id'];
            $info_expl->cb_expl = $r['expl_cb'];
            $info_expl->tdoc_libelle = $r['tdoc_libelle'];
            $info_expl->expl_notice = $r['expl_notice'];
            if ($info_expl->expl_notice) {
                $notice = new mono_display($info_expl->expl_notice, 0);
                $info_expl->libelle = $notice->header;
            } else {
                $bulletin = new bulletinage_display($r['expl_bulletin']);
                $info_expl->libelle = $bulletin->display;
                $info_expl->expl_notice = $r['expl_bulletin'];
            }
            $pos = strpos($info_expl->libelle, '<a');
            if ($pos) {
                $info_expl->libelle = substr($info_expl->libelle, 0, strpos($info_expl->libelle, '<a'));
            }
        } else {
            $info_expl->error_message = $msg[367];
        }
    } else {
        $info_expl->error_message = $msg[367];
    }
    return $info_expl;
}
Esempio n. 2
0
function _get_footer_($output_params)
{
    $export = new synchro_rdf(session_id());
    $contenuRdf = $export->exportStoreXml();
    //Suppression des tables temporaires
    $res = pmb_mysql_query("SHOW TABLES LIKE '" . session_id() . "%'");
    while ($row = pmb_mysql_fetch_array($res)) {
        pmb_mysql_query("DROP TABLE " . $row[0]);
    }
    return $contenuRdf;
}
 function get_values($id)
 {
     //Récupération des valeurs stockées
     if (!$this->no_special_fields && $id) {
         $this->values = array();
         $requete = "select " . $this->prefix . "_custom_champ," . $this->prefix . "_custom_origine," . $this->prefix . "_custom_small_text, " . $this->prefix . "_custom_text, " . $this->prefix . "_custom_integer, " . $this->prefix . "_custom_date, " . $this->prefix . "_custom_float from " . $this->prefix . "_custom_values where " . $this->prefix . "_custom_origine=" . $id;
         $resultat = pmb_mysql_query($requete);
         while ($r = pmb_mysql_fetch_array($resultat)) {
             $this->values[$r[$this->prefix . "_custom_champ"]][] = $r[$this->prefix . "_custom_" . $this->t_fields[$r[$this->prefix . "_custom_champ"]]["DATATYPE"]];
         }
     } else {
         $this->values = array();
     }
 }
Esempio n. 4
0
 function addTaskCron($id)
 {
     global $dbh;
     $requete = "select id_planificateur, num_type_tache, libelle_tache, desc_tache, calc_next_date_deb, calc_next_heure_deb \n\t\t\tfrom planificateur \n\t\t\twhere statut='1' \n\t\t\tand id_planificateur= '" . $id . "'";
     $res = pmb_mysql_query($requete, $dbh);
     while ($row = pmb_mysql_fetch_array($res)) {
         $oldCrontab = array();
         /* récupère les informations de l'ancien crontab */
         $newCrontab = array();
         /* ajoute le nouveau crontab */
         exec('crontab -l', $oldCrontab);
         /* on récupère l'ancienne crontab dans $oldCrontab */
         $calc_next_date_deb = explode("-", $row["calc_next_date_deb"]);
         $calc_next_heure_deb = explode(":", $row["calc_next_heure_deb"]);
         $ident = "pmb_" . $row["id_planificateur"] . "." . $row["num_type_tache"];
         if ($row["desc_tache"] != '') {
             $comment = $row["desc_tache"];
         } else {
             $comment = ' Aucun commentaire';
         }
         $chpCommande = "/rep/le fichier php";
         $trouve = false;
         //on vérifie si cette tâche est déjà dans le cron
         foreach ($oldCrontab as $index => $ligne) {
             if (preg_match("/^# " . $ident . "/", $oldCrontab[$index], $matches, PREG_OFFSET_CAPTURE) == "1") {
                 $oldCrontab[$index] = "# " . $ident . " : " . $comment;
                 $oldCrontab[$index + 1] = $calc_next_heure_deb[0] . ' ' . $calc_next_heure_deb[1] . ' ' . $calc_next_date_deb[2] . ' ' . $calc_next_date_deb[1] . ' * ' . $chpCommande;
                 $trouve = true;
             }
             $newCrontab[] = $oldCrontab[$index];
         }
         //si la tâche n'est pas trouvée, on l'ajoute
         if (!$trouve) {
             $newCrontab[] = "# " . $ident . " : " . $comment;
             $newCrontab[] = $calc_next_heure_deb[0] . ' ' . $calc_next_heure_deb[1] . ' ' . $calc_next_date_deb[2] . ' ' . $calc_next_date_deb[1] . ' * ' . $chpCommande;
         }
         $f = fopen('/var/spool/cron/apache', 'w');
         /* on crée le fichier s'il n'existe pas */
         fwrite($f, implode(chr(10), $newCrontab));
         fclose($f);
         exec('crontab /var/spool/cron/apache');
         /* on le soumet comme crontab */
     }
 }
Esempio n. 5
0
function create_expl($f_ex_cb, $id, $f_ex_typdoc, $f_ex_cote, $f_ex_section, $f_ex_statut, $f_ex_location, $f_ex_cstat, $f_ex_note, $f_ex_prix, $f_ex_owner, $f_ex_comment = '')
{
    global $dbh;
    $new_expl = 0;
    $expl_retour = 0;
    $requete = "SELECT expl_id FROM exemplaires WHERE expl_cb='{$f_ex_cb}' ";
    $res = pmb_mysql_query($requete, $dbh);
    $nbr_lignes = @pmb_mysql_num_rows($res);
    if ($nbr_lignes) {
        $valid_requete = 0;
        $lu = pmb_mysql_fetch_array($res);
        $expl_retour = $lu['expl_id'];
    } else {
        $valid_requete = 1;
    }
    if ($valid_requete) {
        $requete = 'INSERT INTO exemplaires SET create_date=sysdate(), ';
        $requete .= "expl_cb='{$f_ex_cb}'";
        $requete .= ", expl_notice={$id}";
        $requete .= ", expl_typdoc={$f_ex_typdoc}";
        $requete .= ", expl_cote='{$f_ex_cote}'";
        $requete .= ", expl_section={$f_ex_section}";
        $requete .= ", expl_statut={$f_ex_statut}";
        $requete .= ", expl_location={$f_ex_location}";
        $requete .= ", expl_codestat={$f_ex_cstat}";
        $requete .= ", expl_note='" . ${f_ex_note} . "'";
        $requete .= ", expl_comment='" . ${f_ex_comment} . "'";
        $requete .= ", expl_prix='{$f_ex_prix}'";
        $requete .= ", expl_owner='{$f_ex_owner}'";
        $result = pmb_mysql_query($requete, $dbh);
        $expl_retour = pmb_mysql_insert_id();
        audit::insert_creation(AUDIT_EXPL, $expl_retour);
        $new_expl = 1;
    }
    $retour = array($new_expl, $expl_retour);
    return $retour;
}
Esempio n. 6
0
/**
 * Récupère les infos du document numérique
 */
function recup_explnum_infos($id_explnum)
{
    global $infos_explnum, $dbh;
    $rqt_explnum = "SELECT explnum_id, explnum_notice, explnum_bulletin, IF(location_libelle IS null, '', location_libelle) AS location_libelle, explnum_nom, explnum_mimetype, explnum_url, explnum_extfichier, IF(explnum_nomfichier IS null, '', explnum_nomfichier) AS nomfichier, explnum_path, IF(rep.repertoire_nom IS null, '', rep.repertoire_nom) AS nomrepertoire\n\t\tfrom explnum ex_n\n\t\tLEFT JOIN explnum_location ex_l ON ex_n.explnum_id= ex_l.num_explnum\n\t\tLEFT JOIN docs_location dl ON ex_l.num_location= dl.idlocation\n\t\tLEFT JOIN upload_repertoire rep ON ex_n.explnum_repertoire= rep.repertoire_id\n\t\twhere explnum_id='" . $id_explnum . "'";
    $res_explnum = pmb_mysql_query($rqt_explnum, $dbh);
    while ($explnum = pmb_mysql_fetch_array($res_explnum, MYSQL_ASSOC)) {
        $infos_explnum[] = $explnum;
    }
}
Esempio n. 7
0
function explnum_test_rights_per_id($id_explnum)
{
    global $gestion_acces_active, $gestion_acces_empr_docnum;
    //droits d'acces emprunteur/document numérique
    if ($gestion_acces_active == 1 && $gestion_acces_empr_docnum == 1) {
        $ac = new acces();
        $dom_3 = $ac->setDomain(3);
        $rights = $dom_3->getRights($_SESSION['id_empr_session'], $id_explnum);
    }
    //Accessibilité du document numérique aux abonnés en opac
    $req_restriction_abo = "SELECT explnum_visible_opac, explnum_visible_opac_abon FROM explnum,explnum_statut WHERE explnum_id='" . $id_explnum . "' AND explnum_docnum_statut=id_explnum_statut ";
    $result = pmb_mysql_query($req_restriction_abo);
    if ($result && pmb_mysql_num_rows($result)) {
        $expl_num = pmb_mysql_fetch_array($result, MYSQL_ASSOC);
        if ($rights & 16 || is_null($dom_3) && $expl_num["explnum_visible_opac"] && (!$expl_num["explnum_visible_opac_abon"] || $expl_num["explnum_visible_opac_abon"] && $_SESSION["user_code"])) {
            return true;
        }
    }
    return false;
}
Esempio n. 8
0
 function show_consultation_form()
 {
     global $form_consult_action, $form_see_docnum, $msg, $charset, $pmb_gestion_devise, $dbh, $pmb_type_audit;
     $form_consult_action = str_replace('!!form_title!!', htmlentities($this->sujet_action, ENT_QUOTES, $charset), $form_consult_action);
     $form_consult_action = str_replace('!!idstatut!!', htmlentities($this->statut_action, ENT_QUOTES, $charset), $form_consult_action);
     $form_consult_action = str_replace('!!type_action!!', htmlentities($this->workflow->getTypeCommentById($this->type_action), ENT_QUOTES, $charset), $form_consult_action);
     $form_consult_action = str_replace('!!statut_action!!', htmlentities($this->workflow->getStateCommentById($this->statut_action), ENT_QUOTES, $charset), $form_consult_action);
     $form_consult_action = str_replace('!!detail_action!!', htmlentities($this->detail_action, ENT_QUOTES, $charset), $form_consult_action);
     $form_consult_action = str_replace('!!date_action!!', htmlentities(formatdate($this->date_action), ENT_QUOTES, $charset), $form_consult_action);
     $form_consult_action = str_replace('!!date_butoir_action!!', htmlentities(formatdate($this->deadline_action), ENT_QUOTES, $charset), $form_consult_action);
     $form_consult_action = str_replace('!!time_action!!', htmlentities($this->time_elapsed . $msg['demandes_action_time_unit'], ENT_QUOTES, $charset), $form_consult_action);
     $form_consult_action = str_replace('!!cout_action!!', htmlentities($this->cout, ENT_QUOTES, $charset) . $pmb_gestion_devise, $form_consult_action);
     $form_consult_action = str_replace('!!progression_action!!', htmlentities($this->progression_action, ENT_QUOTES, $charset) . '%', $form_consult_action);
     $form_consult_action = str_replace('!!idaction!!', htmlentities($this->id_action, ENT_QUOTES, $charset), $form_consult_action);
     $form_consult_action = str_replace('!!iddemande!!', htmlentities($this->num_demande, ENT_QUOTES, $charset), $form_consult_action);
     $form_consult_action = str_replace('!!createur!!', htmlentities($this->getCreateur($this->actions_num_user, $this->actions_type_user), ENT_QUOTES, $charset), $form_consult_action);
     $form_consult_action = str_replace('!!prive_action!!', htmlentities($this->prive_action ? $msg[40] : $msg[39], ENT_QUOTES, $charset), $form_consult_action);
     $path = "<a href=./demandes.php?categ=gestion&act=see_dmde&iddemande={$this->num_demande}>" . htmlentities($this->libelle_demande, ENT_QUOTES, $charset) . "</a>";
     $form_consult_action = str_replace('!!path!!', $path, $form_consult_action);
     $act_cancel = "document.location='./demandes.php?categ=gestion&act=see_dmde&iddemande={$this->num_demande}'";
     $form_consult_action = str_replace('!!cancel_action!!', $act_cancel, $form_consult_action);
     $states_btn = $this->getDisplayStateBtn($this->workflow->getStateList($this->statut_action));
     $form_consult_action = str_replace('!!btn_etat!!', $states_btn, $form_consult_action);
     // bouton audit
     if ($pmb_type_audit) {
         $btn_audit = "&nbsp;<input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=15&object_id={$this->id_action}', 'audit_popup', 700, 500, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" title=\"" . $msg['audit_button'] . "\" value=\"" . $msg['audit_button'] . "\" />&nbsp;";
     } else {
         $btn_audit = "";
     }
     $form_consult_action = str_replace('!!btn_audit!!', $btn_audit, $form_consult_action);
     print $form_consult_action;
     //Notes
     print demandes_notes::show_dialog($this->notes, $this->id_action, $this->num_demande);
     //Documents Numériques
     $req = "select * from explnum_doc join explnum_doc_actions on num_explnum_doc=id_explnum_doc \n\t\twhere num_action='" . $this->id_action . "'";
     $res = pmb_mysql_query($req, $dbh);
     if (pmb_mysql_num_rows($res)) {
         $tab_docnum = array();
         while ($docnums = pmb_mysql_fetch_array($res)) {
             $tab_docnum[] = $docnums;
         }
         $explnum_doc = new explnum_doc();
         $liste_docnum = $explnum_doc->show_docnum_table($tab_docnum, './demandes.php?categ=action&act=modif_docnum&idaction=' . $this->id_action);
         $form_see_docnum = str_replace('!!list_docnum!!', $liste_docnum, $form_see_docnum);
     } else {
         $form_see_docnum = str_replace('!!list_docnum!!', htmlentities($msg['demandes_action_no_docnum'], ENT_QUOTES, $charset), $form_see_docnum);
     }
     $form_see_docnum = str_replace('!!idaction!!', $this->id_action, $form_see_docnum);
     print $form_see_docnum;
     // Annulation de l'alerte sur l'action en cours après lecture des nouvelles notes si c'est la personne à laquelle est affectée l'action qui la lit
     $this->actions_read_gestion = demandes_actions::action_read($this->id_action, true, "_gestion");
     // Mise à jour de la demande dont est issue l'action
     demandes_actions::action_majParentEnfant($this->id_action, $this->num_demande, "_gestion");
 }
Esempio n. 9
0
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: log.inc.php,v 1.1.2.1 2015-08-13 07:30:45 jpermanne Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
global $log, $infos_notice, $infos_expl;
$rqt = " select empr_prof,empr_cp, empr_ville as ville, empr_year, empr_sexe, empr_login,  empr_date_adhesion, empr_date_expiration, count(pret_idexpl) as nbprets, count(resa.id_resa) as nbresa, code.libelle as codestat, es.statut_libelle as statut, categ.libelle as categ, gr.libelle_groupe as groupe,dl.location_libelle as location\n\t\t\tfrom empr e\n\t\t\tleft join empr_codestat code on code.idcode=e.empr_codestat\n\t\t\tleft join empr_statut es on e.empr_statut=es.idstatut\n\t\t\tleft join empr_categ categ on categ.id_categ_empr=e.empr_categ\n\t\t\tleft join empr_groupe eg on eg.empr_id=e.id_empr\n\t\t\tleft join groupe gr on eg.groupe_id=gr.id_groupe\n\t\t\tleft join docs_location dl on e.empr_location=dl.idlocation\n\t\t\tleft join resa on e.id_empr=resa_idempr\n\t\t\tleft join pret on e.id_empr=pret_idempr\n\t\t\twhere e.empr_login='******'\n\t\t\tgroup by resa_idempr, pret_idempr";
$res = pmb_mysql_query($rqt);
if ($res) {
    $empr_carac = pmb_mysql_fetch_array($res);
    $log->add_log('empr', $empr_carac);
}
$log->add_log('num_session', session_id());
$log->save();
Esempio n. 10
0
function resa_ranger_list()
{
    global $base_path, $dbh;
    global $msg;
    global $current_module;
    global $begin_result_liste;
    global $end_result_liste;
    global $deflt_docs_location;
    global $pmb_lecteurs_localises;
    global $f_loc;
    $aff_final = "";
    if ($pmb_lecteurs_localises) {
        if ($f_loc == "") {
            $f_loc = $deflt_docs_location;
        }
        if ($f_loc) {
            $sql_expl_loc = " where expl_location='" . $f_loc . "' ";
        }
    }
    if ($pmb_lecteurs_localises) {
        //la liste de sélection de la localisation
        $aff_final .= "<form class='form-{$current_module}' name='check_docranger' action='" . $base_path . "/circ.php?categ=listeresa&sub=docranger' method='post'>";
        $aff_final .= "<br />" . $msg["transferts_circ_resa_lib_localisation"];
        $aff_final .= "<select name='f_loc' onchange='document.check_docranger.submit();'>";
        $res = pmb_mysql_query("SELECT idlocation, location_libelle FROM docs_location order by location_libelle");
        $aff_final .= "<option value='0'>" . $msg["all_location"] . "</option>";
        //on parcours la liste des options
        while ($value = pmb_mysql_fetch_array($res)) {
            //debut de l'option
            $aff_final .= "<option value='" . $value[0] . "'";
            if ($value[0] == $f_loc) {
                $aff_final .= " selected";
            }
            //c'est l'option par défaut
            $aff_final .= ">" . $value[1] . "</option>";
        }
        $aff_final .= "</select></form>";
    }
    $sql = "SELECT resa_cb, expl_id from resa_ranger left join exemplaires on resa_cb=expl_cb " . $sql_expl_loc;
    $res = pmb_mysql_query($sql, $dbh);
    while ($ranger = pmb_mysql_fetch_object($res)) {
        if ($ranger->expl_id) {
            if ($stuff = get_expl_info($ranger->expl_id)) {
                $stuff = check_pret($stuff);
                $aff_final .= print_info($stuff, 0, 0, 0);
            } else {
                $aff_final .= "<strong>" . $ranger->resa_cb . "&nbsp;: {$msg[395]}</strong><br>";
            }
        } else {
            $aff_final .= "<strong>" . $ranger->resa_cb . "&nbsp;: {$msg[395]}</strong><br>";
        }
    }
    if ($aff_final) {
        return $begin_result_liste . $aff_final . $end_result_liste;
    } else {
        return $msg['resa_liste_docranger_nodoc'];
    }
}
Esempio n. 11
0
            break;
        default:
            break;
    }
    $i++;
}
//visibilité des exemplaires
if ($pmb_droits_explr_localises) {
    $explr_tab_invis = explode(",", $explr_invisible);
    $explr_tab_unmod = explode(",", $explr_visible_unmod);
    $explr_tab_modif = explode(",", $explr_visible_mod);
    $visibilite_expl_user = "******" . $msg["expl_visibilite"] . "&nbsp;:&nbsp;</div>\n\t\t\t<div class='colonne_suite'>&nbsp;</div>\n\t\t</div>\n";
    $requete_droits_expl = "select idlocation, location_libelle from docs_location order by location_libelle";
    $resultat_droits_expl = pmb_mysql_query($requete_droits_expl);
    $temp = "";
    while ($j = pmb_mysql_fetch_array($resultat_droits_expl)) {
        $temp .= $j["idlocation"] . ",";
        $visibilite_expl_user .= "\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne3' align='right'>" . $j["location_libelle"] . " : </div>\n\t\t\t\t<div class='colonne_suite'>&nbsp;<select name=\"form_expl_visibilite_" . $j["idlocation"] . "\">\n\t\t\t";
        $as_invis = array_search($j["idlocation"], $explr_tab_invis);
        $as_unmod = array_search($j["idlocation"], $explr_tab_unmod);
        $as_mod = array_search($j["idlocation"], $explr_tab_modif);
        $visibilite_expl_user .= "\n<option value='explr_invisible' " . ($as_invis !== FALSE && $as_invis !== NULL ? "selected='selected' " : "") . ">" . $msg["explr_invisible"] . "</option>";
        if ($as_mod !== FALSE && $as_mod !== NULL || $as_unmod !== FALSE && $as_unmod !== NULL || $as_invis !== FALSE && $as_invis !== NULL) {
            $visibilite_expl_user .= "\n<option value='explr_visible_unmod' " . ($as_unmod !== FALSE && $as_unmod !== NULL ? "selected='selected' " : "") . ">" . $msg["explr_visible_unmod"] . "</option>";
        } else {
            $visibilite_expl_user .= "\n<option value='explr_visible_unmod' selected='selected' >" . $msg["explr_visible_unmod"] . "</option>";
        }
        $visibilite_expl_user .= "\n<option value='explr_visible_mod' " . ($as_mod !== FALSE && $as_mod !== NULL ? "selected='selected' " : "") . ">" . $msg["explr_visible_mod"] . "</option>";
        $visibilite_expl_user .= "</select></div></div>\n";
    }
    pmb_mysql_free_result($resultat_droits_expl);
Esempio n. 12
0
 public function maj_indexation($datatype = 'all')
 {
     global $include_path;
     global $dbh, $champ_base;
     //recuperation du fichier xml de configuration
     if (!count($champ_base)) {
         $file = $include_path . "/indexation/editorial_content/" . $this->type . "_subst.xml";
         if (!file_exists($file)) {
             $file = $include_path . "/indexation/editorial_content/" . $this->type . ".xml";
         }
         $fp = fopen($file, "r");
         if ($fp) {
             $xml = fread($fp, filesize($file));
         }
         fclose($fp);
         $champ_base = _parser_text_no_function_($xml, "INDEXATION");
     }
     $tableau = $champ_base;
     //analyse des donnees des tables
     $temp_not = array();
     $temp_not['t'][0][0] = $tableau['REFERENCE'][0][value];
     $temp_ext = array();
     $temp_marc = array();
     $champ_trouve = false;
     $tab_code_champ = array();
     $tab_languages = array();
     $tab_keep_empty = array();
     $tab_pp = array();
     for ($i = 0; $i < count($tableau['FIELD']); $i++) {
         //pour chacun des champs decrits
         //recuperation de la liste des informations a mettre a jour
         if ($datatype == 'all' || $datatype == $tableau['FIELD'][$i]['DATATYPE']) {
             //conservation des mots vides
             if ($tableau['FIELD'][$i]['KEEPEMPTYWORD'] == "yes") {
                 $tab_keep_empty[] = $tableau['FIELD'][$i]['ID'];
             }
             //champ perso
             if ($tableau['FIELD'][$i]['DATATYPE'] == "custom_field") {
                 $tab_pp[$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i]['TABLE'][0]['value'];
             } else {
                 if ($tableau['FIELD'][$i]['EXTERNAL'] == "yes") {
                     //champ externe à la table notice
                     //Stockage de la structure pour un accès plus facile
                     $temp_ext[$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i];
                 } else {
                     //champ de la table notice
                     $temp_not['f'][0][$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value'];
                     $tab_code_champ[0][$tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value']] = array('champ' => $tableau['FIELD'][$i]['ID'], 'ss_champ' => 0, 'pond' => $tableau['FIELD'][$i]['POND'], 'no_words' => $tableau['FIELD'][$i]['DATATYPE'] == "marclist" ? true : false);
                     if ($tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['MARCTYPE']) {
                         $tab_code_champ[0][$tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value']]['marctype'] = $tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['MARCTYPE'];
                     }
                 }
             }
             $champ_trouve = true;
         }
     }
     if ($champ_trouve) {
         $tab_req = array();
         //Recherche des champs directs
         if ($datatype == 'all') {
             $tab_req[0]["rqt"] = "select " . implode(',', $temp_not['f'][0]) . " from " . $temp_not['t'][0][0];
             $tab_req[0]["rqt"] .= " where " . $tableau['REFERENCEKEY'][0][value] . "='" . $this->id . "'";
             $tab_req[0]["table"] = $temp_not['t'][0][0];
         }
         foreach ($temp_ext as $k => $v) {
             //Construction de la requete
             //Champs pour le select
             $select = array();
             //on harmonise les fichiers XML décrivant des requetes...
             for ($i = 0; $i < count($v["TABLE"]); $i++) {
                 $table = $v['TABLE'][$i];
                 $select = array();
                 for ($j = 0; $j < count($table['TABLEFIELD']); $j++) {
                     $select[] = ($table['ALIAS'] ? $table['ALIAS'] . "." : "") . $table['TABLEFIELD'][$j]["value"];
                     if ($table['LANGUAGE']) {
                         $select[] = $table['LANGUAGE'][0]['value'];
                         $tab_languages[$k] = $table['LANGUAGE'][0]['value'];
                     }
                     $field_name = $table['TABLEFIELD'][$j]["value"];
                     if (strpos($table['TABLEFIELD'][$j]["value"], ".") !== false) {
                         $field_name = substr($table['TABLEFIELD'][$j]["value"], strpos($table['TABLEFIELD'][$j]["value"], ".") + 1);
                     }
                     $tab_code_champ[$v['ID']][$field_name] = array('champ' => $v['ID'], 'ss_champ' => $table['TABLEFIELD'][$j]["ID"], 'pond' => $table['TABLEFIELD'][$j]['POND'], 'no_words' => $tableau['FIELD'][$i]['DATATYPE'] == "marclist" ? true : false);
                     if ($v['TABLEFIELD'][$j]['marclist']) {
                         $tab_code_champ[$v['ID']][$v['TABLEFIELD'][$j]["value"]]['marctype'] = $v['TABLEFIELD'][$j]['marctype'];
                     }
                 }
                 $query = "select " . implode(",", $select) . " from " . $tableau['REFERENCE'][0]['value'];
                 $jointure = "";
                 for ($j = 0; $j < count($table['LINK']); $j++) {
                     $link = $table['LINK'][$j];
                     if ($link["TABLE"][0]['ALIAS']) {
                         $alias = $link["TABLE"][0]['ALIAS'];
                     } else {
                         $alias = $link["TABLE"][0]['value'];
                     }
                     switch ($link["TYPE"]) {
                         case "n1":
                             if ($link["TABLEKEY"][0]['value']) {
                                 $jointure .= " JOIN " . $link["TABLE"][0]['value'] . ($link["TABLE"][0]['value'] != $alias ? " AS " . $alias : "");
                                 if ($link["EXTERNALTABLE"][0]['value']) {
                                     $jointure .= " ON " . $link["EXTERNALTABLE"][0]['value'] . "." . $link["EXTERNALFIELD"][0]['value'];
                                 } else {
                                     $jointure .= " ON " . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value'];
                                 }
                                 $jointure .= "=" . $alias . "." . $link["TABLEKEY"][0]['value'];
                             } else {
                                 $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : "");
                                 $jointure .= " ON " . $tableau['REFERENCE'][0]['value'] . "." . $tableau['REFERENCEKEY'][0]['value'];
                                 $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value'];
                             }
                             break;
                         case "1n":
                             $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : "");
                             $jointure .= " ON (" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $table["TABLEKEY"][0]['value'];
                             $jointure .= "=" . $tableau['REFERENCE'][0]['value'] . "." . $link["REFERENCEFIELD"][0]['value'] . ") ";
                             break;
                         case "nn":
                             $jointure .= " JOIN " . $link["TABLE"][0]['value'] . ($link["TABLE"][0]['value'] != $alias ? " AS " . $alias : "");
                             $jointure .= " ON (" . $tableau['REFERENCE'][0]['value'] . "." . $tableau['REFERENCEKEY'][0]['value'];
                             $jointure .= "=" . $alias . "." . $link["REFERENCEFIELD"][0]['value'] . ") ";
                             if ($link["TABLEKEY"][0]['value']) {
                                 $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : "");
                                 $jointure .= " ON (" . $alias . "." . $link["TABLEKEY"][0]['value'];
                                 $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value'] . ") ";
                             } else {
                                 $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : "");
                                 $jointure .= " ON (" . $alias . "." . $link["EXTERNALFIELD"][0]['value'];
                                 $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $table["TABLEKEY"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value'] . ") ";
                             }
                             break;
                     }
                 }
                 if ($table['LANGUAGE']) {
                     $tab_req_lang[$k] = "select " . $table['LANGUAGE'][0]['value'] . " from ";
                 }
                 $query .= $jointure . " where " . $temp_not['t'][0][0] . "." . $tableau['REFERENCEKEY'][0][value] . "=" . $this->id;
                 if ($table['LANGUAGE']) {
                     $tab_req_lang[$k] .= $jointure . " where " . $temp_not['t'][0][0] . "." . $tableau['REFERENCEKEY'][0][value] . "=" . $this->id;
                 }
                 $tab_req[$k]["new_rqt"]['rqt'][] = $query;
             }
             $tab_req[$k]["rqt"] = implode(" union ", $tab_req[$k]["new_rqt"]['rqt']);
         }
         //qu'est-ce qu'on efface?
         if ($datatype == "all") {
             $req_del = "delete from cms_editorial_words_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "'";
             pmb_mysql_query($req_del, $dbh);
             //la table pour les recherche exacte
             $req_del = "delete from cms_editorial_fields_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "'";
             pmb_mysql_query($req_del, $dbh);
         } else {
             foreach ($tab_code_champ as $subfields) {
                 foreach ($subfields as $subfield) {
                     $req_del = "delete from cms_editorial_words_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $subfield['champ'] . "'";
                     pmb_mysql_query($req_del, $dbh);
                     //la table pour les recherche exacte
                     $req_del = "delete from cms_editorial_fields_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $subfield['champ'] . "'";
                     pmb_mysql_query($req_del, $dbh);
                     break;
                 }
             }
             //Les champs perso
             if (count($tab_pp)) {
                 foreach ($tab_pp as $id) {
                     $req_del = "delete from cms_editorial_words_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $id . "' ";
                     pmb_mysql_query($req_del, $dbh);
                     //la table pour les recherche exacte
                     $req_del = "delete from cms_editorial_fields_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $id . "' ";
                     pmb_mysql_query($req_del, $dbh);
                 }
             }
         }
         //qu'est-ce qu'on met a jour ?
         $tab_insert = array();
         $tab_field_insert = array();
         foreach ($tab_req as $k => $v) {
             $r = pmb_mysql_query($v["rqt"], $dbh);
             $tab_mots = array();
             $tab_fields = array();
             if (pmb_mysql_num_rows($r)) {
                 while ($tab_row = pmb_mysql_fetch_array($r, MYSQL_ASSOC)) {
                     if (isset($tab_row[$tab_languages[$k]])) {
                         $lang = $tab_row[$tab_languages[$k]];
                         unset($tab_row[$tab_languages[$k]]);
                     } else {
                         $lang = "";
                     }
                     foreach ($tab_row as $nom_champ => $liste_mots) {
                         if ($tab_code_champ[$k][$nom_champ]['marctype']) {
                             $marclist = new marc_list($tab_code_champ[$k][$nom_champ]['marctype']);
                             $liste_mots = $marclist->table[$liste_mots];
                         }
                         if ($liste_mots != '') {
                             $liste_mots = strip_tags($liste_mots);
                             $tab_tmp = array();
                             if (!in_array($k, $tab_keep_empty)) {
                                 $tab_tmp = explode(' ', strip_empty_words($liste_mots));
                             } else {
                                 $tab_tmp = explode(' ', strip_empty_chars(clean_string($liste_mots)));
                             }
                             //	if($lang!="") $tab_tmp[]=$lang;
                             //la table pour les recherche exacte
                             if (!$tab_fields[$nom_champ]) {
                                 $tab_fields[$nom_champ] = array();
                             }
                             $tab_fields[$nom_champ][] = array('value' => trim($liste_mots), 'lang' => $lang);
                             if (!$tab_code_champ[$k][$nom_champ]['no_words']) {
                                 foreach ($tab_tmp as $mot) {
                                     if (trim($mot)) {
                                         $tab_mots[$nom_champ][$mot] = $lang;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             foreach ($tab_mots as $nom_champ => $tab) {
                 $pos = 1;
                 foreach ($tab as $mot => $lang) {
                     //on cherche le mot dans la table de mot...
                     $num_word = 0;
                     $query = "select id_word from words where word = '" . $mot . "' and lang = '" . $lang . "'";
                     $result = pmb_mysql_query($query);
                     if (pmb_mysql_num_rows($result)) {
                         $num_word = pmb_mysql_result($result, 0, 0);
                     } else {
                         $dmeta = new DoubleMetaPhone($mot);
                         $stemming = new stemming($mot);
                         $element_to_update = "";
                         if ($dmeta->primary || $dmeta->secondary) {
                             $element_to_update .= "\n\t\t\t\t\t\t\t\tdouble_metaphone = '" . $dmeta->primary . " " . $dmeta->secondary . "'";
                         }
                         if ($element_to_update) {
                             $element_to_update .= ",";
                         }
                         $element_to_update .= "stem = '" . $stemming->stem . "'";
                         $query = "insert into words set word = '" . $mot . "', lang = '" . $langage . "'" . ($element_to_update ? ", " . $element_to_update : "");
                         pmb_mysql_query($query);
                         $num_word = pmb_mysql_insert_id();
                     }
                     if ($num_word != 0) {
                         $tab_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $tab_code_champ[$k][$nom_champ]['champ'] . "," . $tab_code_champ[$k][$nom_champ]['ss_champ'] . "," . $num_word . "," . $tab_code_champ[$k][$nom_champ]['pond'] . ",{$pos})";
                         $pos++;
                     }
                 }
             }
             //la table pour les recherche exacte
             foreach ($tab_fields as $nom_champ => $tab) {
                 foreach ($tab as $order => $values) {
                     //$tab_field_insert[]="(".$this->id.",".$tab_code_champ[$v["table"]][$nom_champ][0].",".$tab_code_champ[$v["table"]][$nom_champ][1].",".$order.",'".addslashes($values['value'])."','".addslashes($values['lang'])."',".$tab_code_champ[$v["table"]][$nom_champ][2].")";
                     $tab_field_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $tab_code_champ[$k][$nom_champ]['champ'] . "," . $tab_code_champ[$k][$nom_champ]['ss_champ'] . "," . $order . ",'" . addslashes($values['value']) . "','" . addslashes($values['lang']) . "'," . $tab_code_champ[$k][$nom_champ]['pond'] . ")";
                 }
             }
         }
         //Les champs perso
         if (count($tab_pp)) {
             foreach ($tab_pp as $code_champ => $table) {
                 $p_perso = new cms_editorial_parametres_perso($this->num_type);
                 $data = $p_perso->get_fields_recherche_mot($this->id);
                 $j = 0;
                 foreach ($data as $code_ss_champ => $value) {
                     $tab_mots = array();
                     $tab_tmp = explode(' ', strip_empty_words($value));
                     //la table pour les recherche exacte
                     $tab_field_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $code_champ . "," . $code_ss_champ . "," . $j . ",'" . addslashes(trim($value)) . "',''," . $p_perso->get_pond($code_ss_champ) . ")";
                     $j++;
                     foreach ($tab_tmp as $mot) {
                         if (trim($mot)) {
                             $tab_mots[$mot] = "";
                         }
                     }
                     $pos = 1;
                     foreach ($tab_mots as $mot => $lang) {
                         //on cherche le mot dans la table de mot...
                         $query = "select id_word from words where word = '" . $mot . "' and lang = '" . $lang . "'";
                         $result = pmb_mysql_query($query);
                         if (pmb_mysql_num_rows($result)) {
                             $num_word = pmb_mysql_result($result, 0, 0);
                         } else {
                             $query = "insert into words set word = '" . $mot . "', lang = '" . $lang . "'";
                             pmb_mysql_query($query);
                             $num_word = pmb_mysql_insert_id();
                         }
                         $tab_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $code_champ . "," . $code_ss_champ . "," . $num_word . "," . $p_perso->get_pond($code_ss_champ) . ",{$pos})";
                         $pos++;
                     }
                 }
             }
         }
         $req_insert = "insert into cms_editorial_words_global_index(num_obj,type,code_champ,code_ss_champ,num_word,pond,position) values " . implode(',', $tab_insert);
         pmb_mysql_query($req_insert, $dbh);
         //la table pour les recherche exacte
         $req_insert = "insert into cms_editorial_fields_global_index(num_obj,type,code_champ,code_ss_champ,ordre,value,lang,pond) values " . implode(',', $tab_field_insert);
         pmb_mysql_query($req_insert, $dbh);
     }
 }
Esempio n. 13
0
/**
 * Récupère les infos de la notice
 */
function recup_notice_infos($id_notice)
{
    global $infos_notice, $infos_expl;
    $rqt = "select notice_id, typdoc, niveau_biblio, index_l, libelle_categorie, name_pclass, indexint_name \n\t\tfrom notices n \n\t\tleft join notices_categories nc on nc.notcateg_notice=n.notice_id \n\t\tleft join categories c on nc.num_noeud=c.num_noeud \n\t\tleft join indexint i on n.indexint=i.indexint_id \n\t\tleft join pclassement pc on i.num_pclass=pc.id_pclass\n\t\twhere notice_id='" . $id_notice . "'";
    $res_noti = pmb_mysql_query($rqt);
    while ($noti = pmb_mysql_fetch_array($res_noti)) {
        $infos_notice = $noti;
        $rqt_expl = " select section_libelle, location_libelle, statut_libelle, codestat_libelle, expl_date_depot, expl_date_retour, tdoc_libelle \n\t\t\t\t\tfrom exemplaires e\n\t\t\t\t\tleft join docs_codestat co on e.expl_codestat = co.idcode\n\t\t\t\t\tleft join docs_location dl on e.expl_location=dl.idlocation\n\t\t\t\t\tleft join docs_section ds on ds.idsection=e.expl_section\n\t\t\t\t\tleft join docs_statut dst on e.expl_statut=dst.idstatut \n\t\t\t\t\tleft join docs_type dt on dt.idtyp_doc=e.expl_typdoc\n\t\t\t\t\twhere expl_notice='" . $id_notice . "'";
        $res_expl = pmb_mysql_query($rqt_expl);
        while ($expl = pmb_mysql_fetch_array($res_expl)) {
            $infos_expl[] = $expl;
        }
    }
}
function import_profs($separateur, $dbh, $type_import)
{
    //La structure du fichier texte doit être la suivante :
    //nom, prénom (le cb est généré automatiquement)
    $prof = array("Numéro auto", "Nom", "Prénom");
    $date_auj = date("Y-m-d", time());
    $date_an_proch = date("Y-m-d", time() + 3600 * 24 * 30.42 * 12);
    //Upload du fichier
    if (!$_FILES['import_lec']['tmp_name']) {
        print "Cliquez sur Pr&eacute;c&eacute;dent et choisissez un fichier";
    } elseif (!move_uploaded_file($_FILES['import_lec']['tmp_name'], "./temp/" . basename($_FILES['import_lec']['tmp_name']))) {
        print "Le fichier n'a pas pu être téléchargé. Voici plus d'informations :<br />";
        print_r($_FILES) . "<p>";
    }
    $fichier = @fopen("./temp/" . basename($_FILES['import_lec']['tmp_name']), "r");
    if ($fichier) {
        if ($type_import == 'maj_complete') {
            //Vide la table empr_groupe
            pmb_mysql_query("DELETE FROM empr_groupe", $dbh);
            echo $type_import;
            //Supprime les profs qui n'ont pas de prêts en cours
            $req_select_verif_pret = "SELECT id_empr FROM empr left join pret on id_empr=pret_idempr WHERE pret_idempr is null and empr_cb NOT LIKE 'P%'";
            $select_verif_pret = pmb_mysql_query($req_select_verif_pret, $dbh);
            while ($verif_pret = pmb_mysql_fetch_array($select_verif_pret)) {
                //pour tous les emprunteurs qui n'ont pas de pret en cours
                emprunteur::del_empr($verif_pret["id_empr"]);
            }
        }
        //Récupération dans la table 'empr' du 'empr_cb' maximum
        $req = pmb_mysql_query("SELECT MAX(empr_cb) AS cbmax FROM empr WHERE empr_categ=2 and empr_codestat=1", $dbh);
        $cb = pmb_mysql_result($req, 0, "cbmax");
        if (!$cb) {
            $numeroP = "000";
        } else {
            $numeroP = substr($cb, 1, 3);
        }
        while (!feof($fichier)) {
            $buffer = fgets($fichier, 4096);
            $buffer = pmb_mysql_escape_string($buffer);
            $tab = explode($separateur, $buffer);
            $buf_prenom = explode("\\", $tab[1]);
            $prenom = $buf_prenom[0];
            // Traitement du prof
            $select = pmb_mysql_query("SELECT id_empr FROM empr WHERE empr_nom = '" . $tab[0] . "' AND empr_prenom = '" . $prenom . "'", $dbh);
            $nb_enreg = pmb_mysql_num_rows($select);
            if (!$tab[0] || $tab[0] == "") {
                print "<b> Professeur non pris en compte car \"Nom\" non renseigné : </b><br />";
                for ($i = 1; $i < 3; $i++) {
                    print $prof[$i] . " : " . $tab[$i - 1] . ", ";
                }
                print "<br />";
                $nb_enreg = 2;
            }
            //Gestion du sexe
            switch ($tab[8][0]) {
                case M:
                    $sexe = 1;
                    break;
                case F:
                    $sexe = 2;
                    break;
                default:
                    $sexe = 0;
                    break;
            }
            //Génération du code-barre
            $numeroP = $numeroP + 1;
            if ($numeroP < 10) {
                $prof_cb = "P00" . $numeroP;
            } elseif ($numeroP < 100) {
                $prof_cb = "P0" . $numeroP;
            } elseif ($numeroP < 1000) {
                $prof_cb = "P" . $numeroP;
            }
            //Génération du login
            $login = cre_login($tab[0], $prenom, $dbh);
            //Pour l'instant login = mdp car lors de l'import des profs, aucune date de naissance n'est fournie
            switch ($nb_enreg) {
                case 0:
                    //Ce prof n'est pas enregistré
                    $req_insert = "INSERT INTO empr(empr_cb, empr_nom, empr_prenom, empr_adr1, empr_adr2, empr_cp, empr_ville, ";
                    $req_insert .= "empr_mail, empr_tel1, empr_year, empr_categ, empr_codestat, empr_creation, empr_sexe,  ";
                    $req_insert .= "empr_login, empr_password, empr_date_adhesion, empr_date_expiration) ";
                    $req_insert .= "VALUES ('{$prof_cb}','{$tab['0']}','{$prenom}', '{$tab['2']}', '{$tab['3']}', '{$tab['4']}', '{$tab['5']}', '{$tab['9']}', '{$tab['6']}', '{$tab['7']}', ";
                    $req_insert .= "2, 1, '{$date_auj}', {$sexe}, '{$login}', replace(replace('" . $tab[7] . "','\n',''),'\r',''), '{$date_auj}', '{$date_an_proch}' )";
                    $insert = pmb_mysql_query($req_insert, $dbh);
                    if (!$insert) {
                        print "<b>Echec de la création du professeur suivant (Erreur : " . pmb_mysql_error() . ") : </b><br />";
                        for ($i = 1; $i < 3; $i++) {
                            print $prof[$i] . " : " . $tab[$i - 1] . ", ";
                        }
                        print "<br />";
                    } else {
                        emprunteur::update_digest($login, str_replace(array("\n", "\r"), "", $tab[7]));
                        emprunteur::hash_password($login, str_replace(array("\n", "\r"), "", $tab[7]));
                        $cpt_insert++;
                    }
                    $j++;
                    break;
                case 1:
                    //Ce prof est déja enregistré
                    $req_update = "UPDATE empr SET empr_nom = '{$tab['0']}', empr_prenom = '{$tab['1']}', empr_adr1 = '{$tab['2']}', ";
                    $req_update .= "empr_adr2 = '{$tab['3']}', empr_cp = '{$tab['4']}', empr_ville = '{$tab['5']}', empr_mail = '{$tab['9']}', ";
                    $req_update .= "empr_tel1 = '{$tab['6']}', empr_year = '{$tab['7']}', empr_categ = '2', empr_codestat = '1', empr_modif = '{$date_auj}', empr_sexe = '{$sexe}', ";
                    $req_update .= "empr_login = '******', empr_password= replace(replace('" . $tab[7] . "','\n',''),'\r',''), ";
                    $req_update .= "empr_date_adhesion = '{$date_auj}', empr_date_expiration = '{$date_an_proch}' ";
                    $req_update .= "WHERE empr_nom = '{$tb['0']}' AND empr_prenom = '{$prenom}'";
                    $update = pmb_mysql_query($req_update, $dbh);
                    if (!$update) {
                        print "<b>Echec de la modification du professeur suivant (Erreur : " . pmb_mysql_error() . ") : </b><br />";
                        for ($i = 1; $i < 3; $i++) {
                            print $prof[$i] . " : " . $tab[$i - 1] . ", ";
                        }
                        print "<br />";
                    } else {
                        emprunteur::update_digest($login, str_replace(array("\n", "\r"), "", $tab[7]));
                        emprunteur::hash_password($login, str_replace(array("\n", "\r"), "", $tab[7]));
                        $cpt_maj++;
                    }
                    $j++;
                    break;
                case 2:
                    break;
                default:
                    print "<b>Echec pour le professeur suivant (Erreur : " . pmb_mysql_error() . ") : </b><br />";
                    for ($i = 0; $i < 3; $i++) {
                        print $prof[$i] . " : " . $tab[$i] . ", ";
                    }
                    print "<br />";
                    break;
            }
        }
        //Affichage des insert et update
        print "<br />_____________________<br />";
        if ($cpt_insert) {
            print $cpt_insert . " Professeurs créés. <br />";
        }
        if ($cpt_maj) {
            print $cpt_maj . " Professeurs modifiés. <br />";
        }
        fclose($fichier);
    }
}
Esempio n. 15
0
 static function getRelancesBySupplier($id_fou = 0)
 {
     global $dbh, $msg;
     $tab = array();
     if ($id_fou) {
         $q = "select id_acte, type_acte, date_format(date_acte, '" . $msg["format_date"] . "') as date_acte, numero as numero, ";
         $q .= "num_ligne, date_format(date_relance, '" . $msg["format_date"] . "') as date_rel , type_ligne, num_acquisition, num_rubrique, num_produit, num_type, ";
         $q .= "libelle, code, prix, tva, nb, lignes_actes_relances.statut as statut, remise, debit_tva, commentaires_gestion, commentaires_opac ";
         $q .= "from actes join lignes_actes_relances on num_acte=id_acte where num_fournisseur ='" . $id_fou . "' ";
         $q .= "order by date_relance desc, num_acte ";
         $r = pmb_mysql_query($q, $dbh);
         if (pmb_mysql_num_rows($r)) {
             while ($row = pmb_mysql_fetch_array($r, MYSQL_ASSOC)) {
                 $tab[] = $row;
             }
         }
     }
     return $tab;
 }
Esempio n. 16
0
function aff_pret_groupes()
{
    global $msg, $id_empr, $lvl, $dbh;
    global $opac_pret_prolongation, $opac_pret_duree_prolongation, $allow_prol;
    global $dest, $worksheet, $line;
    global $heading_blue, $heading_10, $heading_12;
    $req_groupes = "SELECT * from groupe where resp_groupe={$id_empr} order by libelle_groupe";
    $res = pmb_mysql_query($req_groupes);
    while ($r_goupe = pmb_mysql_fetch_object($res)) {
        if ($lvl == "late") {
            $titre_goup = sprintf($msg['empr_group_late'], $r_goupe->libelle_groupe);
            $class_aff_expl = "class='liste-expl-empr-late'";
            $critere_requete = " AND pret_retour < '" . date('Y-m-d') . "' ORDER BY location_libelle, empr_nom, empr_prenom, pret_retour";
        } else {
            $titre_goup = sprintf($msg['empr_group_loans'], $r_goupe->libelle_groupe);
            $class_aff_expl = "class='liste-expl-empr-all'";
            $critere_requete = " ORDER BY location_libelle, empr_nom, empr_prenom, pret_retour";
        }
        $sql = "SELECT notices_m.notice_id as num_notice_mono, bulletin_id, IF(pret_retour>sysdate(),0,1) as retard, expl_id, empr.id_empr as emprunteur, ";
        $sql .= "date_format(pret_retour, '" . $msg["format_date_sql"] . "') as aff_pret_retour, pret_retour, ";
        $sql .= "date_format(pret_date, '" . $msg["format_date_sql"] . "') as aff_pret_date, ";
        $sql .= "trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if(mention_date, concat(' (',mention_date,')') ,if (date_date, concat(' (',date_format(date_date, '" . $msg["format_date_sql"] . "'),')') ,'')))) as tit, if(notices_m.notice_id, notices_m.notice_id, notices_s.notice_id) as not_id, tdoc_libelle, location_libelle ";
        $sql .= "FROM (((exemplaires LEFT JOIN notices AS notices_m ON expl_notice = notices_m.notice_id ) ";
        $sql .= "        LEFT JOIN bulletins ON expl_bulletin = bulletins.bulletin_id) ";
        $sql .= "        LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), ";
        $sql .= "        docs_type, docs_location , pret, empr,empr_groupe  ";
        $sql .= "WHERE expl_typdoc = idtyp_doc and pret_idexpl = expl_id  and empr.id_empr = pret.pret_idempr and empr_groupe.empr_id = empr.id_empr and expl_location = idlocation and groupe_id=" . $r_goupe->id_groupe;
        $sql .= $critere_requete;
        $req = pmb_mysql_query($sql) or die("Erreur SQL !<br />" . $sql . "<br />" . pmb_mysql_error());
        $nb_elements = pmb_mysql_num_rows($req);
        if ($nb_elements) {
            if (!$dest) {
                echo "<br>";
                echo "<h3><span>" . $titre_goup . "</span></h3>";
                echo "<table {$class_aff_expl} width='100%'>";
                echo "<tr>";
                if ($lvl != "late") {
                    echo "<th><center>" . $msg["empr_late"] . "</center></th>";
                }
                echo " <th>" . $msg["extexpl_emprunteur"] . "</th>\n\t\t\t\t\t  <th>" . $msg["title"] . "</th>\t\t\t\t\t\n\t\t\t\t\t  <th>" . $msg["typdoc_support"] . "</th>\t\t\t\t\t \n\t\t\t\t\t  <th><center>" . $msg["date_loan"] . "</center></th>\n\t\t\t\t\t  <th><center>" . $msg["date_back"] . "</center></th>";
                echo "</tr>";
                $odd_even = 1;
                $loc_cours = "";
                while ($data = pmb_mysql_fetch_array($req)) {
                    if ($loc_cours != $data['location_libelle']) {
                        $loc_cours = $data['location_libelle'];
                        echo "<tr class='tb_pret_location_row'>\n\t\t\t\t\t\t\t\t<td colspan='" . ($lvl != "late" ? "6" : "5") . "'>" . $msg["expl_header_location_libelle"] . " : " . $loc_cours . "</td>\n\t\t\t\t\t\t\t</tr>";
                    }
                    $id_expl = $data['expl_cb'];
                    // on affiche les résultats
                    if ($odd_even == 0) {
                        $pair_impair = "odd";
                        $odd_even = 1;
                    } else {
                        if ($odd_even == 1) {
                            $pair_impair = "even";
                            $odd_even = 0;
                        }
                    }
                    if ($data['num_notice_mono']) {
                        $tr_javascript = " class='{$pair_impair}' onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./index.php?lvl=notice_display&id=" . $data['num_notice_mono'] . "&seule=1';\" style='cursor: pointer' ";
                    } else {
                        $tr_javascript = " class='{$pair_impair}' onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./index.php?lvl=bulletin_display&id=" . $data['bulletin_id'] . "';\" style='cursor: pointer' ";
                    }
                    $deb_ligne = "<tr {$tr_javascript}>";
                    echo $deb_ligne;
                    /* test de date de retour dépassée */
                    if ($lvl != "late") {
                        if ($data['retard']) {
                            echo "<td class='expl-empr-retard'><center><b>&times;</b></center></td>";
                        } else {
                            echo "<td>&nbsp;</td>";
                        }
                    }
                    $empr = get_info_empr($data['emprunteur']);
                    echo "<td>" . $empr['nom'] . " " . $empr['prenom'] . "</td>";
                    echo "<td>" . $data['tit'] . "</td>";
                    echo "<td>" . $data["tdoc_libelle"] . "</td>";
                    echo "<td><center>" . $data['aff_pret_date'] . "</center></td>";
                    if ($data['retard']) {
                        echo "<td class='expl-empr-retard'><center>" . $data['aff_pret_retour'] . "</center></td>";
                    } else {
                        echo "<td><center>" . $data['aff_pret_retour'] . "</center></td>";
                    }
                    echo "</tr>\n";
                }
                // fin du while
                echo "</table>";
            } else {
                $line += 2;
                $x = 0;
                //Titre
                $worksheet->write($line, $x, $titre_goup, $heading_blue);
                $worksheet->merge_cells($line, $x, $line, $x + 6);
                //Entêtes
                $line += 2;
                $x = 0;
                if ($lvl != "late") {
                    $worksheet->write($line, $x, $msg["empr_late"], $heading_10);
                    $x++;
                }
                $worksheet->write($line, $x, $msg["extexpl_emprunteur"], $heading_10);
                $worksheet->write($line, $x + 1, $msg["title"], $heading_10);
                $worksheet->write($line, $x + 2, $msg["typdoc_support"], $heading_10);
                $worksheet->write($line, $x + 3, $msg["date_loan"], $heading_10);
                $worksheet->write($line, $x + 4, $msg["date_back"], $heading_10);
                //Valeurs
                $loc_cours = "";
                while ($data = pmb_mysql_fetch_array($req)) {
                    $x = 0;
                    $line++;
                    if ($loc_cours != $data['location_libelle']) {
                        $loc_cours = $data['location_libelle'];
                        $worksheet->write($line, $x, $msg["expl_header_location_libelle"] . " : " . $loc_cours, $heading_12);
                        $line++;
                    }
                    if ($lvl != "late") {
                        if ($data['retard']) {
                            $worksheet->write($line, $x, "x");
                        }
                        $x++;
                    }
                    $empr = get_info_empr($data['emprunteur']);
                    $worksheet->write($line, $x, $empr['nom'] . " " . $empr['prenom']);
                    $worksheet->write($line, $x + 1, $data['tit']);
                    $worksheet->write($line, $x + 2, $data["tdoc_libelle"]);
                    $worksheet->write($line, $x + 3, $data['aff_pret_date']);
                    $worksheet->write($line, $x + 4, $data['aff_pret_retour']);
                }
            }
        }
    }
}
Esempio n. 17
0
function resa_planning($deb = TRUE)
{
    global $dbh, $msg, $charset;
    global $id_notice, $id_bulletin;
    global $liens_opac;
    global $form_resa_dates, $form_resa_ok;
    global $popup_resa, $opac_max_resa;
    global $resa_deb, $resa_fin;
    print "<h3><span>" . $msg['resa_resa_titre_add'] . "</span></h3>";
    if ($deb) {
        // test au cas où tentative de passer une résa hors URL de résa autorisée...
        $requete_resa = "SELECT count(1) FROM resa_planning WHERE resa_idnotice='{$id_notice}' and resa_idbulletin='{$id_bulletin}'";
        $result_resa = pmb_mysql_query($requete_resa, $dbh);
        if ($result_resa) {
            $nb_resa_encours = pmb_mysql_result($result_resa, 0, 0);
        } else {
            $nb_resa_encours = 0;
        }
        if ($opac_max_resa && $nb_resa_encours >= $opac_max_resa) {
            $id_notice = 0;
            $id_bulletin = 0;
        }
    }
    if (!$id_notice && !$id_bulletin) {
        return $msg['resa_planning_unknown_record'];
    }
    $tab_loc_retrait = resa_planning::get_available_locations($_SESSION['id_empr_session'], $id_notice, $id_bulletin);
    if (count($tab_loc_retrait) >= 1) {
        $form_loc_retrait = '<table ><tbody><tr><th>' . $msg['resa_planning_loc_retrait'] . '</th><th>' . $msg['resa_planning_qty_requested'] . '</th></tr>';
        foreach ($tab_loc_retrait as $k => $v) {
            $form_loc_retrait .= '<tr><td width="50%">' . htmlentities($v['location_libelle'], ENT_QUOTES, $charset) . '</td>';
            $form_loc_retrait .= '<td><select name="location[' . $v['location_id'] . ']">';
            for ($i = 0; $i < $v['location_nb'] * 1 + 1; $i++) {
                $form_loc_retrait .= '<option value=' . $i . '>' . $i . '</option>';
            }
            $form_loc_retrait .= '</select></td>';
            $form_loc_retrait .= '</tr>';
        }
        $form_loc_retrait .= '</tbody></table>';
    } else {
        return $msg['resa_planning_no_item_available'];
    }
    $form_resa_dates = str_replace('!!resa_loc_retrait!!', $form_loc_retrait, $form_resa_dates);
    print $form_resa_dates;
    if ($id_notice) {
        $opac_notices_depliable = 0;
        $liens_opac = array();
        $ouvrage_resa = aff_notice($id_notice, 1);
    } else {
        $ouvrage_resa = bulletin_affichage_reduit($id_bulletin, 1);
    }
    if (!$deb) {
        $form_resa_ok = str_replace('!!date_deb!!', formatdate($resa_deb), $form_resa_ok);
        $form_resa_ok = str_replace('!!date_fin!!', formatdate($resa_fin), $form_resa_ok);
        print $form_resa_ok;
    }
    print $ouvrage_resa;
    //Affichage des previsions sur le document courant par le lecteur courant
    $q3 = "SELECT id_resa, resa_idnotice, resa_idbulletin, resa_date_debut, resa_date_fin, ";
    $q3 .= "if(resa_date_fin < sysdate() or resa_date_fin='0000-00-00',1,0) as resa_perimee, resa_validee, resa_confirmee, ";
    $q3 .= "resa_qty, resa_loc_retrait, location_libelle ";
    $q3 .= "FROM resa_planning left join docs_location on resa_loc_retrait=idlocation ";
    $q3 .= "WHERE id_resa not in (select resa_planning_id_resa from resa where resa_idempr=" . $_SESSION['id_empr_session'] . ") ";
    $q3 .= "and resa_idempr='" . $_SESSION['id_empr_session'] . "' and resa_idnotice={$id_notice} and resa_idbulletin={$id_bulletin} ";
    $q3 .= "ORDER by resa_date_debut asc, resa_date_fin asc";
    $r3 = @pmb_mysql_query($q3, $dbh);
    if (pmb_mysql_num_rows($r3)) {
        $tableau_resa = '<h3>' . $msg['resa_planning_current'] . '</h3>';
        $tableau_resa .= '<table class="tab_resa_planning">';
        $tableau_resa .= '<tr><th>' . $msg['resa_planning_dates'] . '</th>
							<th>' . $msg['resa_planning_qty'] . '</th><th>' . $msg['resa_planning_loc_retrait'] . '</th></tr>';
        while ($resa = pmb_mysql_fetch_array($r3)) {
            $id_resa = $resa['id_resa'];
            $resa_idnotice = $resa['resa_idnotice'];
            $resa_idbulletin = $resa['resa_idbulletin'];
            $resa_date_debut = formatdate($resa['resa_date_debut']);
            $resa_date_fin = formatdate($resa['resa_date_fin']);
            $resa_qty = $resa['resa_qty'];
            $resa_loc_retrait = $resa['location_libelle'];
            $txt_dates = $msg['resa_planning_date_debut'] . $resa_date_debut . '<br />';
            $txt_dates .= $msg['resa_planning_date_fin'] . $resa_date_fin . '<br />';
            if ($resa['resa_perimee']) {
                $txt_dates .= $msg['resa_planning_overtime'];
            } else {
                $txt_dates .= $msg['resa_planning_attente_validation'];
            }
            if ($parity++ % 2) {
                $pair_impair = "even";
            } else {
                $pair_impair = "odd";
            }
            $tableau_resa .= "<tr class='{$pair_impair}'>\n\t\t\t\t<td>{$txt_dates}</td><td>{$resa_qty}</td>\n\t\t\t\t<td>" . htmlentities($resa_loc_retrait, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t</tr>";
        }
        $tableau_resa .= "</table>";
        print $tableau_resa;
    }
}
Esempio n. 18
0
 function get_explnum($champ = '')
 {
     global $dbh;
     $req = "select * from explnum_doc join explnum_doc_sugg on num_explnum_doc=id_explnum_doc where num_suggestion='" . $this->id_suggestion . "'";
     $res = pmb_mysql_query($req, $dbh);
     if (pmb_mysql_num_rows($res)) {
         $tab = pmb_mysql_fetch_array($res);
         switch ($champ) {
             case 'id':
                 return $tab['id_explnum_doc'];
                 break;
             case 'nom':
                 return $tab['explnum_doc_nomfichier'];
                 break;
             case 'ext':
                 return $tab['explnum_doc_extfichier'];
                 break;
             case 'mime':
                 return $tab['explnum_doc_mimetype'];
                 break;
         }
     }
     return 0;
 }
 static function get_connector_id($source_id)
 {
     global $dbh;
     $sql = "SELECT connectors_out_sources_connectornum FROM connectors_out_sources WHERE connectors_out_source_id = " . ($source_id + 0);
     $res = pmb_mysql_query($sql, $dbh);
     $row = pmb_mysql_fetch_array($res);
     return $row["connectors_out_sources_connectornum"];
 }
Esempio n. 20
0
    $xml_expl .= "<text style=\"p1\"></text>";
    $titre = substr($expl->tit, 0, 25);
    $xml_expl .= "<text style=\"t1_s\">" . htmlspecialchars($titre, ENT_QUOTES, $charset) . "</text>";
    $xml_expl .= "<text style=\"t1\" x=\"360\">" . htmlspecialchars($expl->aff_pret_retour, ENT_QUOTES, $charset) . "</text>";
    $xml_expl .= "<text style=\"p1\">" . htmlspecialchars($expl->expl_cb . ". " . $msg['fpdf_date_pret'] . " " . $expl->aff_pret_date, ENT_QUOTES, $charset) . "</text>";
    $xml_expl .= "<text style=\"ps1\">" . htmlspecialchars($expl->location_libelle . " / " . $expl->section_libelle . " / " . $expl->expl_cote, ENT_QUOTES, $charset) . "</text>";
    return $xml_expl;
}
//En fonction de $sub, inclure les fichiers correspondants
switch ($sub) {
    case 'one':
        $xml_bibli .= "<text style=\"t1\">" . htmlspecialchars($msg["ticket_de_pret"], ENT_QUOTES, $charset) . "</text>";
        $xml_bibli .= print_expl($cb_doc);
        $xml_bibli .= "<text style=\"t1\"></text>";
        break;
    case 'all':
        $xml_bibli .= "<text style=\"t1\">" . htmlspecialchars("Liste des prêts:", ENT_QUOTES, $charset) . "</text>";
        $query = "select expl_cb from pret,exemplaires  where pret_idempr={$id_empr} and expl_id=pret_idexpl ";
        $result = pmb_mysql_query($query, $dbh);
        while ($r = pmb_mysql_fetch_array($result)) {
            $xml_bibli .= print_expl($r['expl_cb']);
        }
        $xml_bibli .= "<text style=\"t1\"></text>";
        break;
    default:
        ajax_http_send_error('400', "commande inconnue");
        break;
}
$xml = file_get_contents($base_path . "/includes/printer/ticket_pret.xml");
$xml = str_replace("!!document-contents!!", $xml_bibli, $xml);
ajax_http_send_response($xml, "text/xml");
Esempio n. 21
0
 function make_serialized_human_query($serialized)
 {
     //global $search;
     global $msg;
     global $charset;
     global $include_path;
     $to_unserialize = unserialize($serialized);
     $search = $to_unserialize["SEARCH"];
     for ($i = 0; $i < count($search); $i++) {
         $op = "op_" . $i . "_" . $search[$i];
         $field_ = "field_" . $i . "_" . $search[$i];
         $inter = "inter_" . $i . "_" . $search[$i];
         $fieldvar = "fieldvar_" . $i . "_" . $search[$i];
         if (!isset($GLOBALS[${$op}])) {
             global ${$op};
         }
         if (!isset($GLOBALS[${$field_}])) {
             global ${$field_};
         }
         if (!isset($GLOBALS[${$inter}])) {
             global ${$inter};
         }
         if (!isset($GLOBALS[${$fieldvar}])) {
             global ${$fieldvar};
         }
         ${$op} = $to_unserialize[$i]["OP"];
         ${$field_} = $to_unserialize[$i]["FIELD"];
         ${$inter} = $to_unserialize[$i]["INTER"];
         ${$fieldvar} = $to_unserialize[$i]["FIELDVAR"];
     }
     $r = "";
     for ($i = 0; $i < count($search); $i++) {
         $s = explode("_", $search[$i]);
         if ($s[0] == "f") {
             $title = $this->fixedfields[$s[1]]["TITLE"];
         } elseif (array_key_exists($s[0], $this->pp)) {
             $title = $this->pp[$s[0]]->t_fields[$s[1]]["TITRE"];
         } elseif ($s[0] == "s") {
             $title = $this->specialfields[$s[1]]["TITLE"];
         }
         $op = "op_" . $i . "_" . $search[$i];
         $operator = $this->operators[${$op}];
         $field_ = "field_" . $i . "_" . $search[$i];
         $field = ${$field_};
         //Recuperation des variables auxiliaires
         $fieldvar_ = "fieldvar_" . $i . "_" . $search[$i];
         $fieldvar = ${$fieldvar_};
         if (!is_array($fieldvar)) {
             $fieldvar = array();
         }
         $field_aff = array();
         if (array_key_exists($s[0], $this->pp)) {
             $datatype = $this->pp[$s[0]]->t_fields[$s[1]]["DATATYPE"];
             $df = $this->dynamicfields[$s[0]]["FIELD"][$this->get_id_from_datatype($datatype, $s[0])];
             $q_index = $df["QUERIES_INDEX"];
             $q = $df["QUERIES"][$q_index[${$op}]];
             if ($q["DEFAULT_OPERATOR"]) {
                 $operator_multi = $q["DEFAULT_OPERATOR"];
             }
             for ($j = 0; $j < count($field); $j++) {
                 $field_aff[$j] = $this->pp[$s[0]]->get_formatted_output(array(0 => $field[$j]), $s[1]);
             }
         } elseif ($s[0] == "f") {
             $ff = $this->fixedfields[$s[1]];
             $q_index = $ff["QUERIES_INDEX"];
             $q = $ff["QUERIES"][$q_index[${$op}]];
             if ($fieldvar["operator_between_multiple_authorities"]) {
                 $operator_multi = $fieldvar["operator_between_multiple_authorities"][0];
             } else {
                 if ($q["DEFAULT_OPERATOR"]) {
                     $operator_multi = $q["DEFAULT_OPERATOR"];
                 }
             }
             switch ($this->fixedfields[$s[1]]["INPUT_TYPE"]) {
                 case "list":
                     $options = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["OPTIONS"][0];
                     $opt = array();
                     for ($j = 0; $j < count($options["OPTION"]); $j++) {
                         if (substr($options["OPTION"][$j]["value"], 0, 4) == "msg:") {
                             $opt[$options["OPTION"][$j]["VALUE"]] = $msg[substr($options["OPTION"][$j]["value"], 4, strlen($options["OPTION"][$j]["value"]) - 4)];
                         } else {
                             $opt[$options["OPTION"][$j]["VALUE"]] = $options["OPTION"][$j]["value"];
                         }
                     }
                     for ($j = 0; $j < count($field); $j++) {
                         $field_aff[$j] = $opt[$field[$j]];
                     }
                     break;
                 case "query_list":
                     $requete = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["value"];
                     if ($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["FILTERING"] == "yes") {
                         $requete = str_replace("!!acces_j!!", "", $requete);
                         $requete = str_replace("!!statut_j!!", "", $requete);
                         $requete = str_replace("!!statut_r!!", "", $requete);
                     }
                     if ($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]) {
                         $use_global = explode(",", $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]);
                         for ($j = 0; $j < count($use_global); $j++) {
                             $var_global = $use_global[$j];
                             global ${$var_global};
                             $requete = str_replace("!!" . $var_global . "!!", ${$var_global}, $requete);
                         }
                     }
                     $resultat = pmb_mysql_query($requete);
                     $opt = array();
                     while ($r_ = @pmb_mysql_fetch_row($resultat)) {
                         $opt[$r_[0]] = $r_[1];
                     }
                     for ($j = 0; $j < count($field); $j++) {
                         $field_aff[$j] = $opt[$field[$j]];
                     }
                     break;
                 case "marc_list":
                     $opt = new marc_list($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["NAME"][0]["value"]);
                     for ($j = 0; $j < count($field); $j++) {
                         $field_aff[$j] = $opt->table[$field[$j]];
                     }
                     break;
                 case "date":
                     $field_aff[0] = format_date($field[0]);
                     break;
                 case "authoritie":
                     for ($j = 0; $j < sizeof($field); $j++) {
                         if (is_numeric($field[$j]) && ${$op} == "AUTHORITY") {
                             switch ($ff['INPUT_OPTIONS']['SELECTOR']) {
                                 case "categorie":
                                     $field[$j] = categories::getlibelle($field[$j], $lang);
                                     break;
                                 case "auteur":
                                     $aut = new auteur($field[$j]);
                                     if ($aut->rejete) {
                                         $field[$j] = $aut->name . ', ' . $aut->rejete;
                                     } else {
                                         $field[$j] = $aut->name;
                                     }
                                     if ($aut->date) {
                                         $field[$j] .= " ({$aut->date})";
                                     }
                                     break;
                                 case "editeur":
                                     $ed = new editeur($field[$j]);
                                     $field[$j] = $ed->name;
                                     if ($ed->ville) {
                                         if ($ed->pays) {
                                             $field[$j] .= " ({$ed->ville} - {$ed->pays})";
                                         } else {
                                             $field[$j] .= " ({$ed->ville})";
                                         }
                                     }
                                     break;
                                 case "collection":
                                     $coll = new collection($field[$j]);
                                     $field[$j] = $coll->name;
                                     break;
                                 case "subcollection":
                                     $coll = new subcollection($field[$j]);
                                     $field[$j] = $coll->name;
                                     break;
                                 case "serie":
                                     $serie = new serie($field[$j]);
                                     $field[$j] = $serie->name;
                                     break;
                                 case "indexint":
                                     $indexint = new indexint($field[$j]);
                                     if ($indexint->comment) {
                                         $field[$j] = $indexint->name . " - " . $indexint->comment;
                                     } else {
                                         $field[$j] = $indexint->name;
                                     }
                                     if ($thesaurus_classement_mode_pmb != 0) {
                                         $field[$j] = "[" . $indexint->name_pclass . "] " . $field[$j];
                                     }
                                     break;
                                 case "titre_uniforme":
                                     $tu = new titre_uniforme($field[$j]);
                                     $field[$j] = $tu->name;
                                     break;
                                 case "notice":
                                     $requete = "select if(serie_name is not null,if(tnvol is not null,concat(serie_name,', ',tnvol,'. ',tit1),concat(serie_name,'. ',tit1)),tit1) AS tit from notices left join series on serie_id=tparent_id where notice_id='" . $field[$j] . "' ";
                                     $res = pmb_mysql_query($requete);
                                     if ($res && pmb_mysql_num_rows($res)) {
                                         $field[$j] = pmb_mysql_result($res, 0, 0);
                                     }
                                     break;
                             }
                         }
                     }
                     $field_aff = $field;
                     break;
                 default:
                     $field_aff = $field;
                     break;
             }
         } elseif ($s[0] == "s") {
             //appel de la fonction make_human_query de la classe du champ special
             //Recherche du type
             $type = $this->specialfields[$s[1]]["TYPE"];
             for ($is = 0; $is < count($this->tableau_speciaux["TYPE"]); $is++) {
                 if ($this->tableau_speciaux["TYPE"][$is]["NAME"] == $type) {
                     $sf = $this->specialfields[$s[1]];
                     require_once $include_path . "/search_queries/specials/" . $this->tableau_speciaux["TYPE"][$is]["PATH"] . "/search.class.php";
                     $specialclass = new $this->tableau_speciaux["TYPE"][$is]["CLASS"]($s[1], $i, $sf, $this);
                     $field_aff = $specialclass->make_human_query();
                     $field_aff[0] = html_entity_decode(strip_tags($field_aff[0]), ENT_QUOTES, $charset);
                     break;
                 }
             }
         }
         //Ajout des variables si necessaire
         reset($fieldvar);
         $fieldvar_aff = array();
         while (list($var_name, $var_value) = each($fieldvar)) {
             //Recherche de la variable par son nom
             $vvar = $this->fixedfields[$s[1]]["VAR"];
             for ($j = 0; $j < count($vvar); $j++) {
                 if ($vvar[$j]["TYPE"] == "input" && $vvar[$j]["NAME"] == $var_name) {
                     //Calcul de la visibilite
                     $varname = $vvar[$j]["NAME"];
                     $visibility = 1;
                     $vis = $vvar[$j]["OPTIONS"]["VAR"][0];
                     if ($vis["NAME"]) {
                         $vis_name = $vis["NAME"];
                         global ${$vis_name};
                         if ($vis["VISIBILITY"] == "no") {
                             $visibility = 0;
                         }
                         for ($k = 0; $k < count($vis["VALUE"]); $k++) {
                             if ($vis["VALUE"][$k]["value"] == ${$vis_name}) {
                                 if ($vis["VALUE"][$k]["VISIBILITY"] == "no") {
                                     $sub_vis = 0;
                                 } else {
                                     $sub_vis = 1;
                                 }
                                 if ($vis["VISIBILITY"] == "no") {
                                     $visibility |= $sub_vis;
                                 } else {
                                     $visibility &= $sub_vis;
                                 }
                                 break;
                             }
                         }
                     }
                     $var_list_aff = array();
                     $flag_aff = false;
                     if ($visibility) {
                         switch ($vvar[$j]["OPTIONS"]["INPUT"][0]["TYPE"]) {
                             case "query_list":
                                 $query_list = $vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["value"];
                                 $r_list = pmb_mysql_query($query_list);
                                 while ($line = pmb_mysql_fetch_array($r_list)) {
                                     $as = array_search($line[0], $var_value);
                                     if ($as !== false && $as !== NULL) {
                                         $var_list_aff[] = $line[1];
                                     }
                                 }
                                 if ($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["ALLCHOICE"] == "yes" && count($var_list_aff) == 0) {
                                     $var_list_aff[] = $msg[substr($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["TITLEALLCHOICE"], 4, strlen($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["TITLEALLCHOICE"]) - 4)];
                                 }
                                 $fieldvar_aff[] = implode(" " . $msg["search_or"] . " ", $var_list_aff);
                                 $flag_aff = true;
                                 break;
                             case "checkbox":
                                 $value = $var_value[0];
                                 $label_list = $vvar[$j]["OPTIONS"]["INPUT"][0]["COMMENTS"][0]["LABEL"];
                                 for ($indice = 0; $indice < count($label_list); $indice++) {
                                     if ($value == $label_list[$indice]["VALUE"]) {
                                         $libelle = $label_list[$indice]["value"];
                                         break;
                                     }
                                 }
                                 $fieldvar_aff[] = $libelle;
                                 $flag_aff = true;
                                 break;
                         }
                         if ($flag_aff) {
                             $fieldvar_aff[count($fieldvar_aff) - 1] = $vvar[$j]["COMMENT"] . " : " . $fieldvar_aff[count($fieldvar_aff) - 1];
                         }
                     }
                 }
             }
         }
         switch ($operator_multi) {
             case "and":
                 $op_list = $msg["search_and"];
                 break;
             case "or":
                 $op_list = $msg["search_or"];
                 break;
             default:
                 $op_list = $msg["search_or"];
                 break;
         }
         $texte = implode(" " . $op_list . " ", $field_aff);
         //$texte=implode(" ".$msg["search_or"]." ",$field_aff);
         if (count($fieldvar_aff)) {
             $texte .= " [" . implode(" ; ", $fieldvar_aff) . "]";
         }
         $inter = "inter_" . $i . "_" . $search[$i];
         switch (${$inter}) {
             case "and":
                 $inter_op = $msg["search_and"];
                 break;
             case "or":
                 $inter_op = $msg["search_or"];
                 break;
             case "ex":
                 $inter_op = $msg["search_exept"];
                 break;
             default:
                 $inter_op = "";
                 break;
         }
         if ($inter_op) {
             $inter_op = "<strong>" . htmlentities($inter_op, ENT_QUOTES, $charset) . "</strong>";
         }
         $r .= $inter_op . " <i><strong>" . htmlentities($title, ENT_QUOTES, $charset) . "</strong> " . htmlentities($operator, ENT_QUOTES, $charset) . " (" . htmlentities($texte, ENT_QUOTES, $charset) . ")</i> ";
     }
     return $r;
 }
}
$rq_bib_z3950 = pmb_mysql_query("select * from z_bib {$selection_bib} order by bib_nom, bib_id ");
while ($ligne = pmb_mysql_fetch_array($rq_bib_z3950)) {
    $bib_id = $ligne["bib_id"];
    $url = $ligne["url"];
    $port = $ligne["port"];
    $base = $ligne["base"];
    $format = $ligne["format"];
    $auth_user = $ligne["auth_user"];
    $auth_pass = $ligne["auth_pass"];
    $sutrs_lang = $ligne["sutrs_lang"];
    $auth = $auth_user . $auth_pass;
    $formato[$bib_id] = $format;
    // chargement des attributs de la bib sélectionnée
    $rqt_bib_attr = pmb_mysql_query("select * from z_attr where attr_bib_id='{$bib_id}'");
    while ($linea = pmb_mysql_fetch_array($rqt_bib_attr)) {
        $attr_libelle = $linea["attr_libelle"];
        $attr_attr = $linea["attr_attr"];
        $var = "attr_" . strtolower($attr_libelle);
        ${$var} = $attr_attr;
    }
    // On détermine la requête à envoyer
    $booleen = "";
    $critere1 = "";
    $critere2 = "";
    $troncature = "";
    if ($bool1 == "ET") {
        $booleen = "@and ";
    } elseif ($bool1 == "OU") {
        $booleen = "@or ";
    } elseif ($bool1 == "SAUF") {
Esempio n. 23
0
$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"]);
    if ($as !== FALSE && $as !== NULL) {
        $auteur_0 = $responsabilites["auteurs"][$as];
Esempio n. 24
0
 function get_etat_periodique()
 {
     global $dbh;
     $bulletins = 0;
     $nb_expl = 0;
     $nb_notices = 0;
     if ($this->notice->niveau_biblio == "s") {
         $requete = "SELECT * FROM bulletins WHERE bulletin_notice=" . $this->notice_id;
         $Query = pmb_mysql_query($requete, $dbh);
         $bulletins = pmb_mysql_num_rows($Query);
         while ($row = pmb_mysql_fetch_array($Query)) {
             $requete2 = "SELECT count( * )  AS nb_notices FROM  analysis WHERE analysis_bulletin =" . $row['bulletin_id'];
             $Query2 = pmb_mysql_query($requete2, $dbh);
             $analysis_array = pmb_mysql_fetch_array($Query2);
             $nb_notices += $analysis_array['nb_notices'];
             $requete3 = "SELECT count( expL_id )  AS nb_expl FROM  exemplaires WHERE expl_bulletin =" . $row['bulletin_id'];
             $Query3 = pmb_mysql_query($requete3, $dbh);
             $expl_array = pmb_mysql_fetch_array($Query3);
             $nb_expl += $expl_array['nb_expl'];
         }
         $requete = "SELECT COUNT(collstate_id) FROM collections_state WHERE id_serial='" . $this->notice_id . "'";
         $Query = pmb_mysql_query($requete, $dbh);
         if ($Query && pmb_mysql_num_rows($Query)) {
             $this->serial_nb_etats_collection = pmb_mysql_result($Query, 0, 0);
         }
         $requete = "SELECT COUNT(abt_id) FROM abts_abts WHERE num_notice='" . $this->notice_id . "' AND date_fin > CURDATE()";
         $Query = pmb_mysql_query($requete, $dbh);
         if ($Query && pmb_mysql_num_rows($Query)) {
             $this->serial_nb_abo_actif = pmb_mysql_result($Query, 0, 0);
         }
         $this->serial_nb_bulletins = $bulletins;
         $this->serial_nb_exemplaires = $nb_expl;
         $this->serial_nb_articles = $nb_notices;
     }
 }
Esempio n. 25
0
if ($bt_ajouter == "no") {
    $bouton_ajouter = "";
} else {
    $bouton_ajouter = "<input type='button' class='bouton_small' onclick=\"document.location='{$base_url}&action=add&deb_rech='+this.form.f_user_input.value\" value=\"" . $msg["groupexpl_create_button"] . "\" />";
}
switch ($action) {
    case 'add':
        $groupexpl_form = str_replace("!!deb_saisie!!", htmlentities(stripslashes($f_user_input), ENT_QUOTES, $charset), $groupexpl_form);
        $groupexpl_form = str_replace('!!statut_principal!!', do_selector('docs_statut', 'statut_principal', ""), $groupexpl_form);
        $groupexpl_form = str_replace('!!statut_others!!', do_selector('docs_statut', 'statut_others', ""), $groupexpl_form);
        if ($pmb_lecteurs_localises) {
            $f_loc = $deflt_docs_location;
            $loc_select .= "\n\t\t\t<div class='row'>\n\t\t\t\t<label class='etiquette' for='name'>" . $msg['groupexpl_form_location'] . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t<select name='f_loc' >";
            $res = pmb_mysql_query("SELECT idlocation, location_libelle FROM docs_location order by location_libelle", $dbh);
            $loc_select .= "<option value='0'>" . $msg["all_location"] . "</option>";
            while ($value = pmb_mysql_fetch_array($res)) {
                $loc_select .= "<option value='" . $value[0] . "'";
                if ($value[0] == $f_loc) {
                    $loc_select .= " selected ";
                }
                $loc_select .= ">" . htmlentities($value[1], ENT_QUOTES, $charset) . "</option>";
            }
            $loc_select .= "\n\t\t\t\t</select>\n\t\t\t</div>";
        }
        $groupexpl_form = str_replace('!!location!!', $loc_select, $groupexpl_form);
        print $groupexpl_form;
        break;
    case 'update':
        require_once "{$class_path}/groupexpl.class.php";
        $groupexpl = new groupexpl();
        $value['name'] = $name;
Esempio n. 26
0
 function do_stat_opac($id_explnum)
 {
     global $pmb_logs_activate;
     if ($pmb_logs_activate) {
         global $infos_explnum, $log;
         $rqt_explnum = "SELECT explnum_id, explnum_notice, explnum_bulletin, IF(location_libelle IS null, '', location_libelle) AS location_libelle, explnum_nom, explnum_mimetype, explnum_url, explnum_extfichier, IF(explnum_nomfichier IS null, '', explnum_nomfichier) AS nomfichier, explnum_path, IF(rep.repertoire_nom IS null, '', rep.repertoire_nom) AS nomrepertoire\n\t\t\t\tfrom explnum ex_n\n\t\t\t\tLEFT JOIN explnum_location ex_l ON ex_n.explnum_id= ex_l.num_explnum\n\t\t\t\tLEFT JOIN docs_location dl ON ex_l.num_location= dl.idlocation\n\t\t\t\tLEFT JOIN upload_repertoire rep ON ex_n.explnum_repertoire= rep.repertoire_id\n\t\t\t\twhere explnum_id='" . $id_explnum . "'";
         $res_explnum = pmb_mysql_query($rqt_explnum);
         while ($explnum = pmb_mysql_fetch_array($res_explnum, MYSQL_ASSOC)) {
             $infos_explnum[] = $explnum;
         }
         $rqt = " select empr_prof,empr_cp, empr_ville as ville, empr_year, empr_sexe, empr_login,  empr_date_adhesion, empr_date_expiration, count(pret_idexpl) as nbprets, count(resa.id_resa) as nbresa, code.libelle as codestat, es.statut_libelle as statut, categ.libelle as categ, gr.libelle_groupe as groupe,dl.location_libelle as location \n\t\t\t\t\tfrom empr e\n\t\t\t\t\tleft join empr_codestat code on code.idcode=e.empr_codestat\n\t\t\t\t\tleft join empr_statut es on e.empr_statut=es.idstatut\n\t\t\t\t\tleft join empr_categ categ on categ.id_categ_empr=e.empr_categ\n\t\t\t\t\tleft join empr_groupe eg on eg.empr_id=e.id_empr\n\t\t\t\t\tleft join groupe gr on eg.groupe_id=gr.id_groupe\n\t\t\t\t\tleft join docs_location dl on e.empr_location=dl.idlocation\n\t\t\t\t\tleft join resa on e.id_empr=resa_idempr\n\t\t\t\t\tleft join pret on e.id_empr=pret_idempr\n\t\t\t\t\twhere e.empr_login='******'user_code']) . "'\n\t\t\t\t\tgroup by resa_idempr, pret_idempr";
         $res = pmb_mysql_query($rqt);
         if ($res) {
             $empr_carac = pmb_mysql_fetch_array($res);
             $log->add_log('empr', $empr_carac);
         }
         $log->add_log('num_session', session_id());
         $log->add_log('explnum', $infos_explnum);
         //Accessibilité des documents numériques aux abonnés en opac
         $id_notice_droit = 0;
         if ($infos_explnum[0]["explnum_notice"]) {
             $id_notice_droit = $infos_explnum[0]["explnum_notice"];
         } else {
             $requete = "SELECT bulletin_notice, num_notice FROM bulletins WHERE bulletin_id='" . $infos_explnum[0]["explnum_bulletin"] . "'";
             $res = pmb_mysql_query($requete);
             if ($res && pmb_mysql_num_rows($res)) {
                 if ($id_noti_bull = pmb_mysql_result($res, 0, 1)) {
                     $id_notice_droit = $id_noti_bull;
                 } else {
                     $id_notice_droit = pmb_mysql_result($res, 0, 0);
                 }
             }
         }
         if ($id_notice_droit) {
             $req_restriction_abo = "SELECT explnum_visible_opac, explnum_visible_opac_abon FROM notices,notice_statut WHERE notice_id='" . $id_notice_droit . "' AND statut=id_notice_statut ";
             $result = pmb_mysql_query($req_restriction_abo);
             $expl_num = pmb_mysql_fetch_array($result, MYSQL_ASSOC);
             $infos_restriction_abo = array();
             foreach ($expl_num as $key => $value) {
                 $infos_restriction_abo[$key] = $value;
             }
             $log->add_log('restriction_abo', $infos_restriction_abo);
         }
         $log->save();
     }
 }
Esempio n. 27
0
$dbh = connection_mysql();
// on checke si l'utilisateur existe et si le mot de passe est OK
$query = "SELECT count(1) FROM users WHERE username='******' AND pwd=password('{$password}') ";
$result = pmb_mysql_query($query, $dbh);
$valid_user = pmb_mysql_result($result, 0, 0);
if (!$valid_user) {
    die("Interdit : utilisateur invalide ");
}
if (!$dsi_auto) {
    die("DSI Auto pas activée sur base {$database} (user={$user}) Version noyau: {$pmb_bdd_version} ");
}
/* param par défaut */
$requete_param = "SELECT * FROM users WHERE username='******' LIMIT 1 ";
$res_param = pmb_mysql_query($requete_param, $dbh);
$field_values = pmb_mysql_fetch_row($res_param);
$array_values = pmb_mysql_fetch_array($res_param);
$i = 0;
while ($i < pmb_mysql_num_fields($res_param)) {
    $field = pmb_mysql_field_name($res_param, $i);
    $field_deb = substr($field, 0, 6);
    switch ($field_deb) {
        case "deflt_":
            global ${$field};
            ${$field} = $field_values[$i];
            break;
        case "deflt2":
            global ${$field};
            ${$field} = $field_values[$i];
            break;
        case "param_":
            global ${$field};
Esempio n. 28
0
                    break;
                case 'aucun':
                    print $msg_crea_29;
                    break;
            }
        }
    }
    //Mise à jour du mot de passe admin
    @pmb_mysql_query("UPDATE users SET pwd=PASSWORD('admin'), user_digest = '" . md5("admin" . ":" . md5("http://SERVER/DIRECTORY/") . ":" . "admin") . "' WHERE username='******'", $link);
    @rename("./install.php", "./noinstall.php");
    @rename("./install_rep.php", "./noinstall_rep.php");
    echo $msg_crea_30;
    echo $msg_crea_31;
    $query = "select valeur_param from parametres where type_param='pmb' and sstype_param='bdd_version' ";
    $req = pmb_mysql_query($query, $link);
    $data = pmb_mysql_fetch_array($req);
    $version_pmb_bdd = $data['valeur_param'];
    if ($version_pmb_bdd != $pmb_version_database_as_it_should_be) {
        echo str_replace("!!pmb_version!!", $version_pmb_bdd, $msg_crea_control_version);
    }
    pmb_mysql_close($link);
} else {
    print $msg_crea_32;
}
function del_fic_temp($dir)
{
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if (file_exists($dir . $file) && preg_match("/^XML.*?\\.tmp\$/i", $file)) {
                @unlink($dir . $file);
            }
 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;
 }
Esempio n. 30
0
 function replace($by = 0, $link_save = 0)
 {
     global $msg, $dbh;
     global $pmb_synchro_rdf;
     if ($this->id_noeud == $by || !$this->id_noeud || !$by) {
         return $msg["categ_imposible_remplace_elle_meme"];
     }
     $aut_link = new aut_link(AUT_TABLE_CATEG, $this->id_noeud);
     // "Conserver les liens entre autorités" est demandé
     if ($link_save) {
         // liens entre autorités
         $aut_link->add_link_to(AUT_TABLE_CATEG, $by);
     }
     $aut_link->delete();
     //synchro_rdf : on empile les noeuds impactés pour les traiter plus loin
     if ($pmb_synchro_rdf) {
         $arrayIdImpactes = array();
         $arrayThesImpactes = array();
         $thes = thesaurus::getByEltId($this->id_noeud);
         $arrayThesImpactes[] = $thes->id_thesaurus;
         //parent
         if ($this->num_parent != $thes->num_noeud_racine) {
             $arrayIdImpactes[] = $this->num_parent;
         }
         //enfants
         $res = noeuds::listChilds($this->id_noeud, 1);
         if (pmb_mysql_num_rows($res)) {
             while ($row = pmb_mysql_fetch_array($res)) {
                 $arrayIdImpactes[] = $row[0];
             }
         }
         //renvoi_voir
         if ($this->num_renvoi_voir) {
             $arrayIdImpactes[] = $this->num_renvoi_voir;
         }
     }
     $noeuds_a_garder = new noeuds($by);
     //Si les noeuds sont du même thésaurus
     if ($noeuds_a_garder->num_thesaurus == $this->num_thesaurus) {
         //On déplace les catégories qui renvoi vers l'ancien noeuds pour qu'elle renvoie vers le nouveau
         if (noeuds::isTarget($this->id_noeud)) {
             $requete = "UPDATE noeuds SET num_renvoi_voir='" . $by . "' WHERE num_renvoi_voir='" . $this->id_noeud . "' and id_noeud!='" . $by . "' ";
             @pmb_mysql_query($requete, $dbh);
         }
         //On garde les liens voir_aussi
         $requete = "UPDATE ignore voir_aussi SET num_noeud_orig='" . $by . "' WHERE num_noeud_orig='" . $this->id_noeud . "' and num_noeud_dest!='" . $by . "' ";
         @pmb_mysql_query($requete, $dbh);
         $requete = "UPDATE ignore voir_aussi SET num_noeud_dest='" . $by . "' WHERE num_noeud_dest='" . $this->id_noeud . "' and num_noeud_orig!='" . $by . "'";
         @pmb_mysql_query($requete, $dbh);
     }
     if (noeuds::isTarget($this->id_noeud)) {
         //Si le noeuds à supprimé est utilisé pour des renvois et qu'il reste des liens on les supprime
         //On supprime les renvoies
         $requete = "UPDATE noeuds SET num_renvoi_voir='0' WHERE num_renvoi_voir='" . $this->id_noeud . "'";
         @pmb_mysql_query($requete, $dbh);
     }
     //On déplace les notices liées
     $requete = "UPDATE ignore notices_categories SET num_noeud='" . $by . "' where num_noeud = '" . $this->id_noeud . "' ";
     @pmb_mysql_query($requete, $dbh);
     //nettoyage d'autorities_sources
     $query = "select * from authorities_sources where num_authority = " . $this->id_noeud . " and authority_type = 'category'";
     $result = pmb_mysql_query($query);
     if (pmb_mysql_num_rows($result)) {
         while ($row = pmb_mysql_fetch_object($result)) {
             if ($row->authority_favorite == 1) {
                 //on suprime les références si l'autorité a été importée...
                 $query = "delete from notices_authorities_sources where num_authority_source = " . $row->id_authority_source;
                 pmb_mysql_result($query);
                 $query = "delete from authorities_sources where id_authority_source = " . $row->id_authority_source;
                 pmb_mysql_result($query);
             } else {
                 //on fait suivre le reste
                 $query = "update authorities_sources set num_authority = " . $by . " where num_authority_source = " . $row->id_authority_source;
                 pmb_mysql_query($query);
             }
         }
     }
     //On supprime le noeuds
     $this->delete();
     // effacement de l'identifiant unique d'autorité
     $authority = new authority(0, $this->id_noeud, AUT_TABLE_CATEG);
     $authority->delete();
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         //on ajoute les noeuds impactés par le $by
         $thesBy = thesaurus::getByEltId($by);
         if (!in_array($thesBy->id_thesaurus, $arrayThesImpactes)) {
             $arrayThesImpactes[] = $thesBy->id_thesaurus;
         }
         $arrayIdImpactes[] = $by;
         //parent
         if ($noeuds_a_garder->num_parent != $thesBy->num_noeud_racine) {
             $arrayIdImpactes[] = $noeuds_a_garder->num_parent;
         }
         //enfants
         $res = noeuds::listChilds($noeuds_a_garder->id_noeud, 1);
         if (pmb_mysql_num_rows($res)) {
             while ($row = pmb_mysql_fetch_array($res)) {
                 $arrayIdImpactes[] = $row[0];
             }
         }
         //renvoi_voir
         if ($noeuds_a_garder->num_renvoi_voir) {
             $arrayIdImpactes[] = $noeuds_a_garder->num_renvoi_voir;
         }
         //On met le tout à jour
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delConcept($this->id_noeud);
         if (count($arrayIdImpactes)) {
             foreach ($arrayIdImpactes as $idNoeud) {
                 $synchro_rdf->delConcept($idNoeud);
                 $synchro_rdf->storeConcept($idNoeud);
             }
         }
         if (count($arrayThesImpactes)) {
             foreach ($arrayThesImpactes as $idThes) {
                 $synchro_rdf->updateAuthority($idThes, 'thesaurus');
             }
         }
     }
     return "";
 }