public function execute_ajax()
 {
     global $id_cp;
     $id_cp += 0;
     if ($id_cp) {
         $response['content'] .= "\r\n\t\t\t<div class='colonne3'>\r\n\t\t\t<label>" . $this->format_text($this->msg['cms_module_common_selector_record_cp_val_cp_val_label']) . "</label>\r\n\t\t\t</div>\r\n\t\t\t<div class='colonne_suite'>";
         //on regarde la nature du CP...
         $query = "select type from notices_custom where idchamp = '" . $id_cp . "'";
         $pp = new parametres_perso("notices");
         $pp->get_values(0);
         $response['content'] .= $pp->get_field_form($id_cp, $this->get_form_value_name("cp_val"), $this->parameters['cp_val']);
     } else {
         $response['content'] = "";
     }
     $response['content-type'] = "text/html";
     return $response;
 }
 function fetch_data()
 {
     global $dbh;
     global $msg;
     global $charset;
     global $val_list_empr;
     global $pmb_gestion_financiere, $pmb_gestion_abonnement, $pmb_gestion_tarif_prets, $pmb_gestion_amende;
     global $deflt_docs_location;
     if (!$this->id_empr || !$dbh) {
         return FALSE;
     }
     $requete = "SELECT e.*, c.libelle AS code1, s.libelle AS code2, es.statut_libelle AS empr_statut_libelle, allow_loan, allow_book, allow_opac, allow_dsi, allow_dsi_priv, allow_sugg, allow_prol, d.location_libelle as localisation, date_format(empr_date_adhesion, '" . $msg["format_date"] . "') as aff_empr_date_adhesion, date_format(empr_date_expiration, '" . $msg["format_date"] . "') as aff_empr_date_expiration FROM empr e left join docs_location as d on e.empr_location=d.idlocation, empr_categ c, empr_codestat s, empr_statut es ";
     $requete .= " WHERE e.id_empr='" . $this->id_empr . "' ";
     $requete .= " AND c.id_categ_empr=e.empr_categ";
     $requete .= " AND s.idcode=e.empr_codestat";
     $requete .= " AND es.idstatut=e.empr_statut";
     $requete .= " LIMIT 1";
     $result = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . " " . $requete);
     if (!pmb_mysql_num_rows($result)) {
         return FALSE;
     }
     $empr = pmb_mysql_fetch_object($result);
     // affectation des propriétés
     $this->empr_cb = $empr->empr_cb;
     // code barre emprunteur
     $this->empr_nom = $empr->empr_nom;
     // nom emprunteur
     $this->empr_prenom = $empr->empr_prenom;
     // prénom mprunteur
     $this->empr_adr1 = $empr->empr_adr1;
     // adresse ligne 1
     $this->empr_adr2 = $empr->empr_adr2;
     // adresse ligne 2
     $this->empr_cp = $empr->empr_cp;
     // code postal
     $this->empr_ville = $empr->empr_ville;
     // ville
     $this->empr_pays = $empr->empr_pays;
     // ville
     $this->empr_mail = $empr->empr_mail;
     // adresse email
     $this->empr_tel1 = $empr->empr_tel1;
     // téléphone 1
     $this->empr_tel2 = $empr->empr_tel2;
     // téléphone 2
     $this->empr_prof = $empr->empr_prof;
     // profession
     $this->empr_year = $empr->empr_year;
     // année de naissance
     $this->empr_categ = $empr->empr_categ;
     // catégorie emprunteur
     $this->empr_codestat = $empr->empr_codestat;
     // code statistique
     $this->empr_creation = $empr->empr_creation;
     // date de création
     $this->empr_modif = $empr->empr_modif;
     // date de modification
     $this->empr_sexe = $empr->empr_sexe;
     // sexe de l'emprunteur
     $this->empr_login = $empr->empr_login;
     // login pour services OPAC
     $this->empr_password = $empr->empr_password;
     // mot de passe OPAC
     $this->empr_ldap = $empr->empr_ldap;
     $this->type_abt = $empr->type_abt;
     // type d'abonnement
     $this->empr_location = $empr->empr_location;
     // localisation
     $this->empr_location_l = $empr->localisation;
     // localisation
     $this->date_fin_blocage = $empr->date_fin_blocage;
     // Date de fin de blocage de l'emprunteur
     $this->empr_statut = $empr->empr_statut;
     $this->empr_statut_l = $empr->empr_statut_libelle;
     $this->total_loans = $empr->total_loans;
     $this->date_adhesion = $empr->empr_date_adhesion;
     // début adhésion
     $this->date_expiration = $empr->empr_date_expiration;
     // fin adhésion
     $this->aff_date_adhesion = $empr->aff_empr_date_adhesion;
     // début adhésion
     $this->aff_date_expiration = $empr->aff_empr_date_expiration;
     // fin adhésion
     $this->empr_msg = $empr->empr_msg;
     // message emprunteur
     $this->cat_l = $empr->code1;
     // libellé catégorie emprunteur
     $this->cstat_l = $empr->code2;
     // libellé code statistique. voir ce bug avec Eric
     $this->allow_loan = $empr->allow_loan;
     $this->allow_book = $empr->allow_book;
     $this->allow_opac = $empr->allow_opac;
     $this->allow_dsi = $empr->allow_dsi;
     $this->allow_dsi_priv = $empr->allow_dsi_priv;
     $this->allow_sugg = $empr->allow_sugg;
     $this->allow_prol = $empr->allow_prol;
     global $selector_prop_ajout_caddie_empr, $empr_show_caddie;
     if ($empr_show_caddie) {
         $this->img_ajout_empr_caddie = "<img src='./images/basket_empr.gif' align='middle' alt='basket' title=\"{$msg[400]}\" onClick=\"openPopUp('./cart.php?object_type=EMPR&item=" . $this->id . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}')\">";
     } else {
         $this->img_ajout_empr_caddie = "";
     }
     $this->lien_nom_prenom = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($this->cb) . "'>{$this->nom},&nbsp;{$this->prenom}</a>";
     $date_blocage = array();
     $date_blocage = explode("-", $this->date_fin_blocage);
     if (mktime(0, 0, 0, $date_blocage[1], $date_blocage[2], $date_blocage[0]) > time()) {
         $this->blocage_active = true;
     }
     //Groupes
     $requete = "select id_groupe, libelle_groupe from groupe, empr_groupe where empr_id='" . $this->id . "' and id_groupe=groupe_id";
     $result = pmb_mysql_query($requete);
     if (pmb_mysql_num_rows($result)) {
         while ($grp_temp = pmb_mysql_fetch_object($result)) {
             $this->groupes[] = "<a href='./circ.php?categ=groups&action=showgroup&groupID=" . $grp_temp->id_groupe . "'>" . htmlentities($grp_temp->libelle_groupe, ENT_QUOTES, $charset) . "</a>";
         }
     } else {
         $this->groupes = array();
     }
     //Paramètres perso
     //Liste des champs
     $p_perso = new parametres_perso("empr");
     $perso_ = $p_perso->show_fields($this->id_empr);
     $perso = "";
     $class = "colonne3";
     $c = 0;
     if (count($perso_["FIELDS"])) {
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             $perso .= "<div class='{$class}'>";
             $perso .= "<div class='row'>" . $p["TITRE"];
             $perso .= $p["AFF"] . "</div>";
             $perso .= "</div>";
             if ($c == 0) {
                 $c = 1;
             } else {
                 if ($c == 1) {
                     $class = "colonne_suite";
                     $c = 2;
                 } else {
                     if ($c == 2) {
                         $class = "colonne3";
                         $c = 0;
                     }
                 }
             }
         }
         $reste = 2 - $c;
         if ($c != 0) {
             for ($i = 0; $i < $reste; $i++) {
                 $perso .= "<div class='colonne3'>&nbsp;</div>";
                 $c++;
             }
             $perso .= "<div class='colonne_suite'>&nbsp;</div>";
         }
     }
     $this->perso = $perso;
     //Comptes si gestion financiere
     if ($pmb_gestion_financiere) {
         $compte = "";
         $n_c = 0;
         $neg = "<span class='erreur'>%s</span>";
         $pos = "%s";
         $compte .= "<div class='row'><hr /></div><div class='row'>";
         if ($pmb_gestion_abonnement) {
             $cpt_id = comptes::get_compte_id_from_empr($this->id, 1);
             $cpt = new comptes($cpt_id);
             $solde = $cpt->update_solde();
             $novalid = $cpt->summarize_transactions("", "", 0, 0);
             if ($cpt_id) {
                 $compte .= "<div class='colonne3'><div><strong><a href='./circ.php?categ=pret&sub=compte&id=" . $this->id . "&typ_compte=1'>" . $msg["finance_solde_abt"] . "</a></strong> " . comptes::format($solde) . "</div>";
                 if ($novalid) {
                     $compte .= "<div>" . $msg["finance_not_validated"] . " : " . comptes::format($novalid) . "</div>";
                 }
                 $compte .= "</div>";
             }
             $n_c++;
         }
         if ($pmb_gestion_tarif_prets) {
             $cpt_id = comptes::get_compte_id_from_empr($this->id, 3);
             $cpt = new comptes($cpt_id);
             $solde = $cpt->update_solde();
             $novalid = $cpt->summarize_transactions("", "", 0, 0);
             if ($cpt_id) {
                 $compte .= "<div class='colonne3'><div><strong><a href='./circ.php?categ=pret&sub=compte&id=" . $this->id . "&typ_compte=3'>" . $msg["finance_solde_pret"] . "</a></strong> " . comptes::format($solde) . "</div>";
                 if ($novalid) {
                     $compte .= "<div>" . $msg["finance_not_validated"] . " : " . comptes::format($novalid) . "</div>";
                 }
                 $compte .= "</div>";
             }
             $n_c++;
         }
         if ($pmb_gestion_amende) {
             $cpt_id = comptes::get_compte_id_from_empr($this->id, 2);
             $cpt = new comptes($cpt_id);
             $solde = $cpt->update_solde();
             $novalid = $cpt->summarize_transactions("", "", 0, 0);
             if ($cpt_id) {
                 //Calcul des amendes
                 $amende = new amende($this->id);
                 $total_amende = $amende->get_total_amendes();
                 $compte .= "<div class='colonne3'><div><strong><a href='./circ.php?categ=pret&sub=compte&id=" . $this->id . "&typ_compte=2'>" . $msg["finance_solde_amende"] . "</a></strong> " . comptes::format($solde) . "</div>";
                 if ($novalid) {
                     $compte .= "<div>" . $msg["finance_not_validated"] . " : " . comptes::format($novalid) . "</div>";
                 }
                 if ($total_amende) {
                     $compte .= "<div> " . $msg["finance_pret_amende_en_cours"] . " : " . comptes::format($total_amende) . "</div>";
                 }
                 $compte .= "</div>";
             }
             $n_c++;
         }
         if ($n_c < 2) {
             for ($i = $n_c; $i < 3; $i++) {
                 $compte .= "<div class='colonne3'>&nbsp;</div>";
             }
         }
         $compte .= "</div><div class='row'></div>";
     }
     $this->compte = $compte;
 }
Example #3
0
 function processing_cp($type, $id, $val_f = "")
 {
     $mes_pp = new parametres_perso($type);
     $mes_pp->get_values($id);
     $values = $mes_pp->values;
     foreach ($values as $field_id => $vals) {
         //si on peut on exporte les infos du résolveur (DOI / PMID)
         if ($type == "notices" && $mes_pp->t_fields[$field_id]['TYPE'] == "resolve") {
             //les ids sont fixé en dur, on c'est traité : DOI = 2 , PMID = 1
             foreach ($vals as $value) {
                 $id_infos = explode('|', $value);
                 switch ($id_infos[1]) {
                     case "1":
                         $resolver = "PMID";
                         break;
                     case "2":
                         $resolver = "DOI";
                         break;
                     default:
                         $resolver = "";
                 }
                 if ($resolver != "") {
                     $subfields = array();
                     $subfields["a"] = $id_infos[0];
                     $subfields["b"] = $resolver;
                     $this->add_field("014", "  ", $subfields);
                 }
             }
         }
         if ($mes_pp->t_fields[$field_id]["EXPORT"]) {
             //champ exportable
             foreach ($vals as $value) {
                 $subfields = array();
                 switch ($mes_pp->t_fields[$field_id]['TYPE']) {
                     case "resolve":
                     case "url":
                         $subfields["c"] = $value;
                         $id_infos = explode('|', $value);
                         $link = $mes_pp->get_formatted_output(array($value), $field_id);
                         //Valeur
                         if (count($id_infos) == 2) {
                             $subfields["a"] = $id_infos[0];
                             $subfields["b"] = $link;
                         } else {
                             $subfields["a"] = $link;
                         }
                         break;
                     case "query_auth":
                     case "query_list":
                         $subfields["c"] = $value;
                         //break; C'est voulu
                     //break; C'est voulu
                     default:
                         $subfields["a"] = $mes_pp->get_formatted_output(array($value), $field_id);
                         //Val
                         break;
                 }
                 $subfields["l"] = $mes_pp->t_fields[$field_id]["TITRE"];
                 //Libelle du champ
                 $subfields["n"] = $mes_pp->t_fields[$field_id]["NAME"];
                 //Nom du champ
                 $subfields["t"] = $mes_pp->t_fields[$field_id]["TYPE"];
                 //Type du champ
                 if ($val_f) {
                     $subfields["f"] = $val_f;
                 }
                 switch ($type) {
                     case "notices":
                         $this->add_field("900", "  ", $subfields);
                         break;
                     case "expl":
                         $this->add_field("999", "  ", $subfields);
                         break;
                     case "collstate":
                         $this->add_field("951", "  ", $subfields);
                         break;
                     default:
                         break;
                 }
             }
         }
     }
 }
 // $id_form
 // $org_cb
 // $expl_id
 // $expl_bulletin
 // $expl_typdoc
 $expl_cote = clean_string($expl_cote);
 // $expl_section
 // $expl_statut
 // $expl_location
 // $expl_codestat
 $expl_note = clean_string($expl_note);
 $expl_comment = clean_string($f_ex_comment);
 $expl_prix = clean_string($expl_prix);
 // $expl_owner
 //Verification des champs personalises
 $p_perso = new parametres_perso("expl");
 $nberrors = $p_perso->check_submited_fields();
 if ($nberrors) {
     error_message_history($msg["notice_champs_perso"], $p_perso->error_message, 1);
     exit;
 }
 // controle sur le nouveau code barre si applicable :
 if ($org_cb != $f_ex_cb) {
     // si le nouveau code-barre est deja utilise, on reste sur l'ancien
     $requete = "SELECT expl_id FROM exemplaires WHERE expl_cb='{$f_ex_cb}'";
     $myQuery = pmb_mysql_query($requete, $dbh);
     if (!($result = pmb_mysql_result($myQuery, 0, 0))) {
         $expl_cb = $f_ex_cb;
     } else {
         // Verif si expl_id est celui poste
         if ($expl_id == $result[0]) {
Example #5
0
 function analysis_delete()
 {
     global $dbh;
     global $pmb_synchro_rdf, $pmb_notice_img_folder_id;
     //Suppression de la vignette de la notice si il y en a une d'uploadée
     if ($pmb_notice_img_folder_id) {
         $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
         $res = pmb_mysql_query($req, $dbh);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
             $img = $rep->repertoire_path . "img_" . $this->analysis_id;
             @unlink($img);
         }
     }
     //synchro rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf($this->analysis_id, 0);
     }
     //elimination des docs numeriques
     $req_explNum = "select explnum_id from explnum where explnum_notice=" . $this->analysis_id . " ";
     $result_explNum = @pmb_mysql_query($req_explNum, $dbh);
     while ($explNum = pmb_mysql_fetch_object($result_explNum)) {
         $myExplNum = new explnum($explNum->explnum_id);
         $myExplNum->delete();
     }
     // suppression des entrees dans les caddies
     $query_caddie = "select caddie_id from caddie_content, caddie where type='NOTI' and object_id in ({$this->analysis_id}) and caddie_id=idcaddie ";
     $result_caddie = @pmb_mysql_query($query_caddie, $dbh);
     while ($cad = pmb_mysql_fetch_object($result_caddie)) {
         $req_suppr_caddie = "delete from caddie_content where caddie_id = '{$cad->caddie_id}' and object_id in ({$this->analysis_id}) ";
         @pmb_mysql_query($req_suppr_caddie, $dbh);
     }
     //elimination des champs persos
     $p_perso = new parametres_perso("notices");
     $p_perso->delete_values($this->analysis_id);
     // on supprime l'entree dans la table 'analysis'
     $requete = "DELETE FROM analysis WHERE analysis_notice=" . $this->analysis_id;
     pmb_mysql_query($requete, $dbh);
     $result = pmb_mysql_affected_rows($dbh);
     // on supprime la notice du dépouillement
     $requete = "DELETE FROM notices WHERE notice_id='" . $this->analysis_id . "' ";
     pmb_mysql_query($requete, $dbh);
     $result += pmb_mysql_affected_rows($dbh);
     //suppression des droits d'acces user_notice
     $requete = "delete from acces_res_1 where res_num=" . $this->analysis_id;
     @pmb_mysql_query($requete, $dbh);
     //suppression des droits d'acces empr_notice
     $requete = "delete from acces_res_2 where res_num=" . $this->analysis_id;
     @pmb_mysql_query($requete, $dbh);
     // suppression des audits
     audit::delete_audit(AUDIT_NOTICE, $this->analysis_id);
     // suppression des categories
     $rqt_del = "delete from notices_categories where notcateg_notice='" . $this->analysis_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     // suppression des responsabilités
     $rqt_del = "delete from responsability where responsability_notice='" . $this->analysis_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     // suppression des liens
     $rqt_del = "delete from notices_relations where num_notice='" . $this->analysis_id . "' OR linked_notice='" . $this->analysis_id . "'";
     @pmb_mysql_query($rqt_del, $dbh);
     // suppression des bannettes
     $rqt_del = "delete from bannette_contenu where num_notice='" . $this->analysis_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     // suppression des tags
     $rqt_del = "delete from tags where num_notice='" . $this->analysis_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     // suppression des avis
     $rqt_del = "delete from avis where num_notice='" . $this->analysis_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     //suppression des langues
     $query = "delete from notices_langues where num_notice='" . $this->analysis_id . "' ";
     @pmb_mysql_query($query, $dbh);
     // suppression index global
     $query = "delete from notices_global_index where num_notice='" . $this->analysis_id . "' ";
     @pmb_mysql_query($query, $dbh);
     // suppression notices_mots_global_index
     $query = "delete from notices_mots_global_index where id_notice='" . $this->analysis_id . "' ";
     @pmb_mysql_query($query, $dbh);
     // suppression notices_fields_global_index
     $query = "delete from notices_fields_global_index where id_notice='" . $this->analysis_id . "' ";
     @pmb_mysql_query($query, $dbh);
     //Suppression de la reference a la notice dans la table suggestions
     $query = "UPDATE suggestions set num_notice = 0 where num_notice=" . $this->analysis_id;
     @pmb_mysql_query($query, $dbh);
     //Suppression de la reference a la notice dans la table lignes_actes
     $requete = "UPDATE lignes_actes set num_produit=0, type_ligne=0 where num_produit='" . $this->analysis_id . "' and type_ligne in ('1','5') ";
     @pmb_mysql_query($requete, $dbh);
     //Suppression de la référence de la source si exitante..
     $query = "delete from notices_externes where num_notice=" . $this->analysis_id;
     @pmb_mysql_query($query, $dbh);
     //Suppression dans les listes de lecture partagées
     $requete = "SELECT id_liste, notices_associees from opac_liste_lecture";
     $res = pmb_mysql_query($requete, $dbh);
     $id_tab = array();
     while ($notices = pmb_mysql_fetch_object($res)) {
         $id_tab = explode(',', $notices->notices_associees);
         for ($i = 0; $i < sizeof($id_tab); $i++) {
             if ($id_tab[$i] == $this->analysis_id) {
                 unset($id_tab[$i]);
             }
         }
         $requete = "UPDATE opac_liste_lecture set notices_associees='" . addslashes(implode(',', $id_tab)) . "' where id_liste='" . $notices->id_liste . "'";
         pmb_mysql_query($requete, $dbh);
     }
     $req = "delete from notices_authperso where notice_authperso_notice_num=" . $id;
     pmb_mysql_query($req, $dbh);
     return $result;
 }
 function read_field_database($field, $id)
 {
     global $dbh;
     if ($this->external) {
         $rqt = $this->fields[$field]["sql_ext"];
     } else {
         $rqt = $this->fields[$field]["sql"];
     }
     if (!$rqt) {
         // c'est surement un param perso
         $p_perso = new parametres_perso("notices");
         $chaine = $p_perso->read_base_fields_perso($field, $id);
         return '';
     } else {
         $rqt = str_replace('!!id!!', $id, $rqt);
         if ($this->external) {
             $rqt = str_replace('!!source_id!!', $this->source_id, $rqt);
         }
         $result = pmb_mysql_query($rqt, $dbh);
         if ($row = pmb_mysql_fetch_row($result)) {
             return $row[0];
         } else {
             // rien
             return '';
         }
     }
 }
Example #7
0
function _export_($id, $keep_expl = 0)
{
    global $charset;
    $requete = "select * from notices where notice_id={$id}";
    $resultat = pmb_mysql_query($requete);
    $rn = pmb_mysql_fetch_object($resultat);
    $dt = $rn->typdoc;
    $bl = $rn->niveau_biblio;
    $hl = $rn->niveau_hierar;
    $notice .= "<notice>\n";
    $notice .= "  <rs>n</rs>\n";
    $notice .= "  <dt>" . $dt . "</dt>\n";
    $notice .= "  <bl>" . $bl . "</bl>\n";
    $notice .= "  <hl>" . $hl . "</hl>\n";
    $notice .= "  <el>1</el>\n";
    $notice .= "  <ru>i</ru>\n";
    //ISBN
    if ($rn->code != '') {
        $notice .= "  <f c='010' ind=' '>\n";
        $notice .= "    <s c='a'>" . htmlspecialchars($rn->code, ENT_QUOTES, $charset) . "</s>\n";
        $notice .= "  </f>\n";
    }
    //Langage
    $rqttmp_lang = "select type_langue,code_langue from notices_langues where num_notice='{$id}' order by ordre_langue ";
    $restmp_lang = pmb_mysql_query($rqttmp_lang);
    if (pmb_mysql_num_rows($restmp_lang)) {
        $ind = "0 ";
        $notice_langue_temp = "";
        while ($tmp_lang = pmb_mysql_fetch_object($restmp_lang)) {
            if ($tmp_lang->type_langue) {
                $ind = "1 ";
                $notice_langue_temp .= "    <s c='c'>" . htmlspecialchars($tmp_lang->code_langue, ENT_QUOTES, $charset) . "</s>\n";
            } else {
                $notice_langue_temp .= "    <s c='a'>" . htmlspecialchars($tmp_lang->code_langue, ENT_QUOTES, $charset) . "</s>\n";
            }
        }
        $notice .= "  <f c='101' ind='" . $ind . "'>\n";
        $notice .= $notice_langue_temp;
        $notice .= "  </f>\n";
    }
    //Titre
    if ($rn->tit1 != '') {
        $notice .= "  <f c='200' ind='1 '>\n";
        $notice .= "    <s c='a'>" . htmlspecialchars($rn->tit1, ENT_QUOTES, $charset) . "</s>\n";
        if ($rn->tit2 != '') {
            $notice .= "    <s c='c'>" . htmlspecialchars($rn->tit2, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($rn->tit3 != '') {
            $notice .= "    <s c='d'>" . htmlspecialchars($rn->tit3, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($rn->tit4 != '') {
            $notice .= "    <s c='e'>" . htmlspecialchars($rn->tit4, ENT_QUOTES, $charset) . "</s>\n";
        }
        $notice .= "  </f>\n";
    }
    //Mention d'édition
    if ($rn->mention_edition) {
        $notice .= "  <f c='205' ind='  '>\n";
        $notice .= "    <s c='a'>" . htmlspecialchars($rn->mention_edition, ENT_QUOTES, $charset) . "</s>\n";
        $notice .= "  </f>\n";
    }
    //Editeurs
    if ($rn->ed1_id) {
        $requete = "select * from publishers where ed_id=" . $rn->ed1_id;
        $resultat = pmb_mysql_query($requete);
        $red = pmb_mysql_fetch_object($resultat);
        $notice .= "  <f c='210' ind='  '>\n";
        $notice .= "    <s c='c'>" . htmlspecialchars($red->ed_name, ENT_QUOTES, $charset) . "</s>\n";
        if ($red->ed_ville != '') {
            $notice .= "    <s c='a'>" . htmlspecialchars($red->ed_ville, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($rn->year != '') {
            $notice .= "    <s c='d'>" . htmlspecialchars($rn->year, ENT_QUOTES, $charset) . "</s>\n";
        }
        $notice .= "  </f>\n";
    }
    if ($rn->ed2_id) {
        $requete = "select * from publishers where ed_id=" . $rn->ed2_id;
        $resultat = pmb_mysql_query($requete);
        $red = pmb_mysql_fetch_object($resultat);
        $notice .= "  <f c='210' ind='  '>\n";
        $notice .= "    <s c='c'>" . htmlspecialchars($red->ed_name, ENT_QUOTES, $charset) . "</s>\n";
        if ($red->ed_ville != '') {
            $notice .= "    <s c='a'>" . htmlspecialchars($red->ed_ville, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($rn->year != '') {
            $notice .= "    <s c='d'>" . htmlspecialchars($rn->year, ENT_QUOTES, $charset) . "</s>\n";
        }
        $notice .= "  </f>\n";
    }
    //Collation
    if ($rn->npages || $rn->ill || $rn->size || $rn->accomp) {
        $notice .= "  <f c='215' ind='  '>\n";
        if ($rn->npages) {
            $notice .= "    <s c='a'>" . htmlspecialchars($rn->npages, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($rn->ill) {
            $notice .= "    <s c='c'>" . htmlspecialchars($rn->ill, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($rn->size) {
            $notice .= "    <s c='d'>" . htmlspecialchars($rn->size, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($rn->accomp) {
            $notice .= "    <s c='e'>" . htmlspecialchars($rn->accomp, ENT_QUOTES, $charset) . "</s>\n";
        }
        $notice .= "  </f>\n";
    }
    //Collection
    if ($rn->coll_id) {
        $requete = "select * from collections where collection_id=" . $rn->coll_id;
        $resultat = pmb_mysql_query($requete);
        if ($col = pmb_mysql_fetch_object($resultat)) {
            $notice .= "  <f c='225' ind='2 '>\n";
            $notice .= "    <s c='a'>" . htmlspecialchars($col->collection_name, ENT_QUOTES, $charset) . "</s>\n";
            if ($rn->nocoll != '') {
                $notice .= "    <s c='v'>" . htmlspecialchars($rn->nocoll, ENT_QUOTES, $charset) . "</s>\n";
            }
            if ($col->collection_issn != '') {
                $notice .= "    <s c='x'>" . htmlspecialchars($col->collection_issn, ENT_QUOTES, $charset) . "</s>\n";
            }
        }
        //sous-collection
        if ($rn->subcoll_id) {
            $requete = "select * from sub_collections where sub_coll_id=" . $rn->subcoll_id;
            $resultat = pmb_mysql_query($requete);
            if ($subcol = pmb_mysql_fetch_object($resultat)) {
                $notice .= "    <s c='i'>" . htmlspecialchars($subcol->sub_coll_name, ENT_QUOTES, $charset) . "</s>\n";
            }
        }
        $notice .= "  </f>\n";
    }
    //Notes
    //Générale
    if ($rn->n_gen) {
        $notice .= "  <f c='300' ind='  '>\n";
        $notice .= "    <s c='a'>" . htmlspecialchars($rn->n_gen, ENT_QUOTES, $charset) . "</s>\n";
        $notice .= "  </f>\n";
    }
    //de contenu
    if ($rn->n_contenu) {
        $notice .= "  <f c='327' ind='  '>\n";
        $notice .= "    <s c='a'>" . htmlspecialchars($rn->n_contenu, ENT_QUOTES, $charset) . "</s>\n";
        $notice .= "  </f>\n";
    }
    //Résumé
    if ($rn->n_resume) {
        $notice .= "  <f c='330' ind='  '>\n";
        $notice .= "    <s c='a'>" . htmlspecialchars($rn->n_resume, ENT_QUOTES, $charset) . "</s>\n";
        $notice .= "  </f>\n";
    }
    //Titre de série
    $serie = "";
    if ($rn->tparent_id != 0 || $rn->tnvol != '') {
        $requete = "select serie_name from series where serie_id=" . $rn->tparent_id;
        $resultat = pmb_mysql_query($requete);
        if (pmb_mysql_num_rows($resultat)) {
            $serie = pmb_mysql_result($resultat, 0, 0);
        }
        $notice .= "  <f c='461' ind=' 0'>\n";
        if ($serie != '') {
            $notice .= "    <s c='t'>" . htmlspecialchars($serie, ENT_QUOTES, $charset) . "</s>\n";
        }
        if ($rn->tnvol) {
            $notice .= "    <s c='v'>" . htmlspecialchars($rn->tnvol, ENT_QUOTES, $charset) . "</s>\n";
        }
        $notice .= "  </f>\n";
    }
    if ($bl == 'a') {
        //liens vers les périodiques et bulletins pour les notices d'article
        $req_link = "SELECT notice_id, tit1, code ";
        $req_link .= "bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero ";
        $req_link .= "from analysis,bulletins,notices WHERE analysis_notice=" . $id . " and bulletin_id=analysis_bulletin and bulletin_notice=notice_id ";
        $result_link = pmb_mysql_query($req_link);
        if (pmb_mysql_num_rows($result_link)) {
            $row = pmb_mysql_fetch_object($result_link);
            $notice .= "  <f c='461' ind='  '>\n";
            $notice .= "    <s c='t'>" . htmlspecialchars($row->tit1, ENT_QUOTES, $charset) . "</s>\n";
            $notice .= "    <s c='9'>lnk:perio</s>\n";
            $notice .= "  </f>\n";
            $notice .= "  <f c='463' ind='  '>\n";
            $notice .= "    <s c='d'>" . htmlspecialchars(formatdate($row->date_date), ENT_QUOTES, $charset) . "</s>\n";
            if ($row->mention_date) {
                $notice .= "    <s c='e'>" . htmlspecialchars($row->mention_date, ENT_QUOTES, $charset) . "</s>\n";
            }
            $notice .= "    <s c='v'>" . htmlspecialchars($row->bulletin_numero, ENT_QUOTES, $charset) . "</s>\n";
            if ($row->bulletin_titre != '') {
                $notice .= "    <s c='t'>" . htmlspecialchars($row->bulletin_titre, ENT_QUOTES, $charset) . "</s>\n";
            }
            $notice .= "    <s c='9'>lnk:bull</s>\n";
            $notice .= "  </f>\n";
        }
    }
    //Descripteurs
    $requete = "SELECT libelle_categorie FROM categories, notices_categories WHERE notcateg_notice=" . $id . " and categories.num_noeud = notices_categories.num_noeud ORDER BY ordre_categorie";
    $resultat = pmb_mysql_query($requete);
    if (pmb_mysql_num_rows($resultat)) {
        while ($row = pmb_mysql_fetch_object($resultat)) {
            $notice .= "  <f c='606' ind=' 1'>\n";
            $notice .= "    <s c='a'>" . htmlspecialchars($row->libelle_categorie, ENT_QUOTES, $charset) . "</s>\n";
            $notice .= "  </f>\n";
        }
    }
    //Auteurs
    //Recherche des auteurs;
    $requete = "select author_type, author_name, author_rejete, author_date, responsability_fonction, responsability_type \n\t,author_subdivision, author_lieu,author_ville, author_pays,author_numero,author_web\n\tfrom authors, responsability where responsability_notice=" . $id . " and responsability_author=author_id";
    $resultat = pmb_mysql_query($requete);
    while ($auth = pmb_mysql_fetch_object($resultat)) {
        //Si c'est un 70 (individuel) alors on l'exporte
        if ($auth->author_type == "70") {
            // Personne physique
            $notice .= "  <f c='" . $auth->author_type . $auth->responsability_type . "' ind=' 1'>\n";
            $notice .= "    <s c='a'>" . htmlspecialchars($auth->author_name, ENT_QUOTES, $charset) . "</s>\n";
            if ($auth->author_rejete != '') {
                $notice .= "    <s c='b'>" . htmlspecialchars($auth->author_rejete, ENT_QUOTES, $charset) . "</s>\n";
            }
            if ($auth->responsability_fonction != '') {
                $notice .= "    <s c='4'>" . $auth->responsability_fonction . "</s>\n";
            }
            if ($auth->author_date != "") {
                $notice .= "    <s c='f'>" . htmlspecialchars($auth->author_date, ENT_QUOTES, $charset) . "</s>\n";
            }
            if ($auth->author_web != '') {
                $notice .= "    <s c='N'>" . htmlspecialchars($auth->author_web, ENT_QUOTES, $charset) . "</s>\n";
            }
            $notice .= "  </f>\n";
        } elseif ($auth->author_type == "71" || $auth->author_type == "72") {
            //Collectivité
            $notice .= "  <f c='" . $auth->author_type . $auth->responsability_type;
            if ($auth->author_type == "71") {
                $notice .= "' ind='02'>\n";
            } elseif ($auth->author_type == "72") {
                $notice .= "' ind='12'>\n";
            }
            $notice .= "    <s c='a'>" . htmlspecialchars($auth->author_name, ENT_QUOTES, $charset) . "</s>\n";
            if ($auth->author_subdivision != '') {
                $notice .= "    <s c='b'>" . htmlspecialchars($auth->author_subdivision, ENT_QUOTES, $charset) . "</s>\n";
            }
            if ($auth->author_rejete != '') {
                $notice .= "    <s c='g'>" . htmlspecialchars($auth->author_rejete, ENT_QUOTES, $charset) . "</s>\n";
            }
            if ($auth->author_numero != '') {
                $notice .= "    <s c=d'>" . htmlspecialchars($auth->author_numero, ENT_QUOTES, $charset) . "</s>\n";
            }
            if ($auth->responsability_fonction != '') {
                $notice .= "    <s c='4'>" . $auth->responsability_fonction . "</s>\n";
            }
            if ($auth->author_date != "") {
                $notice .= "    <s c='f'>" . htmlspecialchars($auth->author_date, ENT_QUOTES, $charset) . "</s>\n";
            }
            $lieu = $auth->author_lieu;
            if ($auth->author_ville) {
                if ($lieu) {
                    $lieu .= "; ";
                }
                $lieu .= $auth->author_ville;
            }
            if ($auth->author_pays) {
                if ($lieu) {
                    $lieu .= "; ";
                }
                $lieu .= $auth->author_pays;
            }
            if ($lieu != '') {
                $notice .= "    <s c='e'>" . htmlspecialchars($lieu, ENT_QUOTES, $charset) . "</s>\n";
            }
            if ($auth->author_lieu != '') {
                $notice .= "    <s c='K'>" . htmlspecialchars($auth->author_lieu, ENT_QUOTES, $charset) . "</s>\n";
            }
            if ($auth->author_ville != '') {
                $notice .= "    <s c='L'>" . htmlspecialchars($auth->author_ville, ENT_QUOTES, $charset) . "</s>\n";
            }
            if ($auth->author_pays != '') {
                $notice .= "    <s c='M'>" . htmlspecialchars($auth->author_pays, ENT_QUOTES, $charset) . "</s>\n";
            }
            if ($auth->author_web != '') {
                $notice .= "    <s c='N'>" . htmlspecialchars($auth->author_web, ENT_QUOTES, $charset) . "</s>\n";
            }
            $notice .= "  </f>\n";
        }
    }
    //URL
    if ($rn->lien != '') {
        $notice .= "  <f c='856'>\n";
        $notice .= "    <s c='u'>" . htmlspecialchars($rn->lien, ENT_QUOTES, $charset) . "</s>\n";
        if ($rn->eformat != '') {
            $notice .= "    <s c='q'>" . htmlspecialchars($rn->eformat, ENT_QUOTES, $charset) . "</s>\n";
        }
        $notice .= "  </f>\n";
    }
    //Champs perso de notice traite par la table notice_custom
    $mes_pp = new parametres_perso("notices");
    $mes_pp->get_values($id);
    $values = $mes_pp->values;
    foreach ($values as $field_id => $vals) {
        if ($mes_pp->t_fields[$field_id]["EXPORT"]) {
            //champ exportable
            foreach ($vals as $value) {
                if ($value) {
                    $notice .= "  <f c='900' ind='  '>\n";
                    $notice .= "    <s c='a'>" . htmlspecialchars($mes_pp->get_formatted_output(array($value), $field_id), ENT_QUOTES, $charset) . "</s>\n";
                    $notice .= "    <s c='l'>" . htmlspecialchars($mes_pp->t_fields[$field_id]["TITRE"], ENT_QUOTES, $charset) . "</s>\n";
                    $notice .= "    <s c='n'>" . htmlspecialchars($mes_pp->t_fields[$field_id]["NAME"], ENT_QUOTES, $charset) . "</s>\n";
                    $notice .= "  </f>\n";
                }
            }
        }
    }
    $notice .= "</notice>\n";
    return $notice;
}
Example #8
0
function extrait_info_notice($sql = "", $entete = 1, $flag = "")
{
    global $dbh;
    global $dest;
    global $worksheet;
    global $myCart;
    global $entete_bloc;
    global $msg;
    global $debligne_excel;
    global $etat_table;
    // permet de savoir si les tag table sont ouverts ou fermés
    global $max_aut;
    // le nombre max de colonnes d'auteurs
    global $thesaurus_mode_pmb;
    global $thesaurus_defaut;
    global $lang;
    global $pmb_keyword_sep;
    global $max_perso;
    global $res_compte3;
    if (!$debligne_excel) {
        $debligne_excel = 0;
    }
    $res = @mysql_query($sql, $dbh);
    $nbr_lignes = @mysql_num_rows($res);
    $nbr_champs = @mysql_num_fields($res);
    if ($nbr_lignes) {
        // Pour les champs personnalisés
        $caddie_type = $myCart->type;
        switch ($caddie_type) {
            case 'EXPL':
                $libelle_caddie_type = "expl";
                break;
            case 'NOTI':
            default:
                $libelle_caddie_type = "notices";
                break;
        }
        switch ($dest) {
            case "TABLEAU":
                if ($entete) {
                    $worksheet->write_string(1 + $debligne_excel, 0, $msg["caddie_mess_edition_" . $entete_bloc]);
                    $debligne_excel++;
                    $worksheet->write_string(1 + $debligne_excel, 0, $msg['caddie_action_marque']);
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        // entête de colonnes
                        $fieldname = mysql_field_name($res, $i);
                        $worksheet->write_string(1 + $debligne_excel, $i + 1, $fieldname);
                    }
                    for ($i = 0; $i < $max_aut; $i++) {
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 1 + $nbr_champs, "aut_entree_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 2 + $nbr_champs, "aut_rejete_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 3 + $nbr_champs, "aut_dates_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 4 + $nbr_champs, "aut_fonction_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 5 + $nbr_champs, "aut_type_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 6 + $nbr_champs, "aut_resp_type_{$i}");
                    }
                    $worksheet->write_string(1 + $debligne_excel, $max_aut * 6 + $nbr_champs + 1, "DESCR");
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = mysql_fetch_object($res_compte3);
                        $worksheet->write_string(1 + $debligne_excel, $max_aut * 6 + $nbr_champs + 2 + $i, $perso->titre);
                    }
                    $debligne_excel++;
                }
                //Fonctions d'auteurs
                $codes_auteurs = get_functions_authors();
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $debligne_excel++;
                    $row = mysql_fetch_row($res);
                    switch ($caddie_type) {
                        case 'EXPL':
                            $id_notice = $row[2];
                            break;
                        case 'NOTI':
                        default:
                            $id_notice = $row[0];
                            break;
                    }
                    if ($flag) {
                        $worksheet->write_string($debligne_excel, 0, "X");
                    }
                    $j = 0;
                    foreach ($row as $dummykey => $col) {
                        if (!$col) {
                            $col = " ";
                        }
                        $worksheet->write_string($debligne_excel, $j + 1, $col);
                        $j++;
                    }
                    $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
                    $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
                    $rqt_aut .= "WHERE responsability_notice={$id_notice} ";
                    $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
                    $res_aut = @mysql_query($rqt_aut);
                    for ($iaut = 0; $iaut < $max_aut; $iaut++) {
                        $aut = @mysql_fetch_row($res_aut);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 1 + $nbr_champs, $aut[0]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 2 + $nbr_champs, $aut[1]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 3 + $nbr_champs, $aut[2]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 4 + $nbr_champs, $codes_auteurs[$aut[3]]);
                        if ($aut[4] == "70") {
                            $lib_type_aut = $msg[203];
                        } else {
                            if ($aut[4] == "71") {
                                $lib_type_aut = $msg[204];
                            } else {
                                if ($aut[4] == "72") {
                                    $lib_type_aut = $msg["congres_libelle"];
                                } else {
                                    $lib_type_aut = $aut[4];
                                }
                            }
                        }
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 5 + $nbr_champs, $lib_type_aut);
                        $lib_resp_type = "";
                        if ($aut[0]) {
                            if ($aut[5] == 0) {
                                $lib_resp_type = $msg["export_main_author"];
                            } else {
                                if ($aut[5] == 1) {
                                    $lib_resp_type = $msg["export_other_author"];
                                } else {
                                    if ($aut[5] == 2) {
                                        $lib_resp_type = $msg["export_secondary_author"];
                                    }
                                }
                            }
                        }
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 6 + $nbr_champs, $lib_resp_type);
                    }
                    $q = "drop table if exists catlg ";
                    $r = mysql_query($q, $dbh);
                    $q = "CREATE TEMPORARY TABLE catlg ENGINE=MyISAM as ";
                    $q .= "SELECT categories.num_noeud, categories.libelle_categorie ";
                    $q .= "FROM noeuds, categories, notices_categories ";
                    $q .= "WHERE notices_categories.notcateg_notice = '" . $id_notice . "' ";
                    $q .= "AND categories.langue = '" . $lang . "' ";
                    $q .= "AND categories.num_noeud = notices_categories.num_noeud ";
                    $q .= "AND categories.num_noeud = noeuds.id_noeud ";
                    $q .= "ORDER BY ordre_categorie";
                    $r = mysql_query($q, $dbh);
                    $q = "DROP TABLE IF EXISTS catdef ";
                    $r = mysql_query($q, $dbh);
                    $q = "CREATE TEMPORARY TABLE catdef ( ";
                    $q .= "num_noeud int(9) unsigned not null default '0', ";
                    $q .= "num_thesaurus int(3) unsigned not null default '0', ";
                    $q .= "libelle_categorie text not null ) ENGINE=MyISAM ";
                    $r = mysql_query($q, $dbh);
                    $thes_list = thesaurus::getThesaurusList();
                    $q = '';
                    foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) {
                        $thes = new thesaurus($id_thesaurus);
                        $q = "INSERT INTO catdef ";
                        $q .= "SELECT categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
                        $q .= "FROM noeuds, categories, notices_categories ";
                        $q .= "WHERE noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' ";
                        $q .= "AND categories.langue = '" . $thes->langue_defaut . "' ";
                        $q .= "AND categories.num_noeud = notices_categories.num_noeud ";
                        $q .= "AND categories.num_noeud = noeuds.id_noeud ";
                        $q .= "ORDER BY ordre_categorie";
                        $r = mysql_query($q, $dbh);
                    }
                    $q = "select catdef.num_thesaurus as num_thesaurus, ";
                    $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
                    $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
                    if (!$thesaurus_mode_pmb) {
                        $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' ";
                    }
                    $res_desc = mysql_query($q, $dbh);
                    $lib_desc = "";
                    while ($desc = mysql_fetch_object($res_desc)) {
                        $lib_desc .= $lib_desc ? $pmb_keyword_sep : "";
                        if ($thesaurus_mode_pmb) {
                            $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] ';
                        }
                        $lib_desc .= $desc->libelle_categorie;
                    }
                    $worksheet->write_string($debligne_excel, $max_aut * 6 + $nbr_champs + 1, "{$lib_desc}");
                    $p_perso = new parametres_perso($libelle_caddie_type);
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            $worksheet->write_string($debligne_excel, $max_aut * 6 + $nbr_champs + 2 + $i, html_entity_decode($p["AFF"], ENT_QUOTES | ENT_COMPAT, "iso-8859-15"));
                        }
                    }
                }
                break;
            case "TABLEAUHTML":
                if ($entete) {
                    if ($etat_table) {
                        echo "\n</table>";
                    }
                    echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>";
                    echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>";
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        $fieldname = mysql_field_name($res, $i);
                        print "<th align='left'>{$fieldname}</th>";
                    }
                    for ($i = 0; $i < $max_aut; $i++) {
                        print pmb_bidi("<th align='left'>aut_entree_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_rejete_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_dates_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_fonction_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_type_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_resp_type_{$i}</th>");
                    }
                    print "<th align='left'>DESCR</th>";
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = mysql_fetch_object($res_compte3);
                        print "<th align='left'>" . $perso->titre . "</th>";
                    }
                    $etat_table = 1;
                }
                //Fonctions d'auteurs
                $codes_auteurs = get_functions_authors();
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $row = mysql_fetch_row($res);
                    switch ($caddie_type) {
                        case 'EXPL':
                            $id_notice = $row[2];
                            break;
                        case 'NOTI':
                        default:
                            $id_notice = $row[0];
                            break;
                    }
                    echo "<tr>";
                    if ($flag) {
                        print "<td>X</td>";
                    } else {
                        print "<td>&nbsp;</td>";
                    }
                    foreach ($row as $dummykey => $col) {
                        if (is_numeric($col)) {
                            $col = "'" . $col;
                        }
                        if (!$col) {
                            $col = "&nbsp;";
                        }
                        print pmb_bidi("<td>{$col}</td>");
                    }
                    $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
                    $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
                    $rqt_aut .= "WHERE responsability_notice={$id_notice} ";
                    $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
                    $res_aut = @mysql_query($rqt_aut, $dbh);
                    for ($i = 0; $i < $max_aut; $i++) {
                        $aut = @mysql_fetch_row($res_aut);
                        print pmb_bidi("<td>{$aut['0']}</td>");
                        print pmb_bidi("<td>{$aut['1']}</td>");
                        print pmb_bidi("<td>{$aut['2']}</td>");
                        print pmb_bidi("<td>" . $codes_auteurs[$aut[3]] . "</td>");
                        if ($aut[4] == "70") {
                            $lib_type_aut = $msg[203];
                        } else {
                            if ($aut[4] == "71") {
                                $lib_type_aut = $msg[204];
                            } else {
                                if ($aut[4] == "72") {
                                    $lib_type_aut = $msg["congres_libelle"];
                                } else {
                                    $lib_type_aut = $aut[4];
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_type_aut}</td>");
                        $lib_resp_type = "";
                        if ($aut[0]) {
                            if ($aut[5] == 0) {
                                $lib_resp_type = $msg["export_main_author"];
                            } else {
                                if ($aut[5] == 1) {
                                    $lib_resp_type = $msg["export_other_author"];
                                } else {
                                    if ($aut[5] == 2) {
                                        $lib_resp_type = $msg["export_secondary_author"];
                                    }
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_resp_type}</td>");
                    }
                    $q = "drop table if exists catlg ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catlg ENGINE=MyISAM as ";
                    $q .= "select categories.num_noeud, categories.libelle_categorie ";
                    $q .= "from noeuds, categories, notices_categories ";
                    $q .= "where notices_categories.notcateg_notice = '" . $id_notice . "' ";
                    $q .= "and categories.langue = '" . $lang . "' ";
                    $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                    $q .= "and categories.num_noeud = noeuds.id_noeud ";
                    $q .= "ORDER BY ordre_categorie";
                    $r = mysql_query($q, $dbh);
                    $q = "drop table if exists catdef ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catdef ( ";
                    $q .= "num_noeud int(9) unsigned not null default '0', ";
                    $q .= "num_thesaurus int(3) unsigned not null default '0', ";
                    $q .= "libelle_categorie text not null ";
                    $q .= ") ENGINE=MyISAM ";
                    $r = mysql_query($q, $dbh);
                    $thes_list = thesaurus::getThesaurusList();
                    $q = '';
                    foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) {
                        $thes = new thesaurus($id_thesaurus);
                        $q = "insert into catdef ";
                        $q .= "select categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
                        $q .= "from noeuds, categories, notices_categories ";
                        $q .= "where noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' ";
                        $q .= "and categories.langue = '" . $thes->langue_defaut . "' ";
                        $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                        $q .= "and categories.num_noeud = noeuds.id_noeud ";
                        $q .= "ORDER BY ordre_categorie";
                        $r = mysql_query($q, $dbh);
                    }
                    $q = "select catdef.num_thesaurus as num_thesaurus, ";
                    $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
                    $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
                    if (!$thesaurus_mode_pmb) {
                        $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' ";
                    }
                    $res_desc = mysql_query($q, $dbh);
                    $lib_desc = "";
                    while ($desc = mysql_fetch_object($res_desc)) {
                        $lib_desc .= $lib_desc ? $pmb_keyword_sep : "";
                        if ($thesaurus_mode_pmb) {
                            $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] ';
                        }
                        $lib_desc .= $desc->libelle_categorie;
                    }
                    print pmb_bidi("<td>{$lib_desc}</td>");
                    $p_perso = new parametres_perso($libelle_caddie_type);
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            print "<td>" . $p["AFF"] . "</td>";
                        }
                    }
                    echo "</tr>";
                }
                break;
            default:
                if ($entete) {
                    if ($etat_table) {
                        echo "\n</table>";
                    }
                    echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>";
                    echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>";
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        $fieldname = mysql_field_name($res, $i);
                        print "<th align='left'>{$fieldname}</th>";
                    }
                    for ($i = 0; $i < $max_aut; $i++) {
                        print pmb_bidi("<th align='left'>aut_entree_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_rejete_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_dates_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_fonction_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_type_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_resp_type_{$i}</th>");
                    }
                    print "<th align='left'>DESCR</th>";
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = mysql_fetch_object($res_compte3);
                        print "<th align='left'>" . $perso->titre . "</th>";
                    }
                    $etat_table = 1;
                }
                //Fonctions d'auteurs
                $codes_auteurs = get_functions_authors();
                $odd_even = 0;
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $row = mysql_fetch_row($res);
                    switch ($caddie_type) {
                        case 'EXPL':
                            $id_notice = $row[2];
                            break;
                        case 'NOTI':
                        default:
                            $id_notice = $row[0];
                            break;
                    }
                    if ($odd_even == 0) {
                        echo "\t<tr class='odd'>";
                        $odd_even = 1;
                    } else {
                        if ($odd_even == 1) {
                            echo "\t<tr class='even'>";
                            $odd_even = 0;
                        }
                    }
                    if ($flag) {
                        print "<td>X</td>";
                    } else {
                        print "<td>&nbsp;</td>";
                    }
                    foreach ($row as $dummykey => $col) {
                        if (!$col) {
                            $col = "&nbsp;";
                        }
                        print pmb_bidi("<td>{$col}</td>");
                    }
                    $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
                    $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
                    $rqt_aut .= "WHERE responsability_notice={$id_notice} ";
                    $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
                    $res_aut = @mysql_query($rqt_aut, $dbh);
                    for ($i = 0; $i < $max_aut; $i++) {
                        $aut = @mysql_fetch_row($res_aut);
                        print pmb_bidi("<td>{$aut['0']}</td>");
                        print pmb_bidi("<td>{$aut['1']}</td>");
                        print pmb_bidi("<td>{$aut['2']}</td>");
                        print pmb_bidi("<td>" . $codes_auteurs[$aut[3]] . "</td>");
                        if ($aut[4] == "70") {
                            $lib_type_aut = $msg[203];
                        } else {
                            if ($aut[4] == "71") {
                                $lib_type_aut = $msg[204];
                            } else {
                                if ($aut[4] == "72") {
                                    $lib_type_aut = $msg["congres_libelle"];
                                } else {
                                    $lib_type_aut = $aut[4];
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_type_aut}</td>");
                        $lib_resp_type = "";
                        if ($aut[0]) {
                            if ($aut[5] == 0) {
                                $lib_resp_type = $msg["export_main_author"];
                            } else {
                                if ($aut[5] == 1) {
                                    $lib_resp_type = $msg["export_other_author"];
                                } else {
                                    if ($aut[5] == 2) {
                                        $lib_resp_type = $msg["export_secondary_author"];
                                    }
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_resp_type}</td>");
                    }
                    $q = "drop table if exists catlg ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catlg ENGINE=MyISAM as ";
                    $q .= "select categories.num_noeud, categories.libelle_categorie ";
                    $q .= "from noeuds, categories, notices_categories ";
                    $q .= "where notices_categories.notcateg_notice = '" . $id_notice . "' ";
                    $q .= "and categories.langue = '" . $lang . "' ";
                    $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                    $q .= "and categories.num_noeud = noeuds.id_noeud ";
                    $q .= "ORDER BY ordre_categorie";
                    $r = mysql_query($q, $dbh);
                    $q = "drop table if exists catdef ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catdef ( ";
                    $q .= "num_noeud int(9) unsigned not null default '0', ";
                    $q .= "num_thesaurus int(3) unsigned not null default '0', ";
                    $q .= "libelle_categorie text not null ";
                    $q .= ") ENGINE=MyISAM ";
                    $r = mysql_query($q, $dbh);
                    $thes_list = thesaurus::getThesaurusList();
                    $q = '';
                    foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) {
                        $thes = new thesaurus($id_thesaurus);
                        $q = "insert into catdef ";
                        $q .= "select categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
                        $q .= "from noeuds, categories, notices_categories ";
                        $q .= "where noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' ";
                        $q .= "and categories.langue = '" . $thes->langue_defaut . "' ";
                        $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                        $q .= "and categories.num_noeud = noeuds.id_noeud ";
                        $q .= "ORDER BY ordre_categorie";
                        $r = mysql_query($q, $dbh);
                    }
                    $q = "select catdef.num_thesaurus as num_thesaurus, ";
                    $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
                    $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
                    if (!$thesaurus_mode_pmb) {
                        $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' ";
                    }
                    $res_desc = mysql_query($q, $dbh);
                    $lib_desc = "";
                    while ($desc = mysql_fetch_object($res_desc)) {
                        $lib_desc .= $lib_desc ? $pmb_keyword_sep : "";
                        if ($thesaurus_mode_pmb) {
                            $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] ';
                        }
                        $lib_desc .= $desc->libelle_categorie;
                    }
                    print pmb_bidi("<td>{$lib_desc}</td>");
                    $p_perso = new parametres_perso($libelle_caddie_type);
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            print "<td>" . $p["AFF"] . "</td>";
                        }
                    }
                    echo "</tr>";
                }
                break;
        }
        // fin switch
    }
    // fin if nbr_lignes
}
Example #9
0
 function getEnrichment($notice_id, $source_id, $type = "", $enrich_params = array())
 {
     global $charset;
     $enrichment = array();
     $this->noticeToEnrich = $notice_id;
     // récupération du code sudoc (PPN) de la notice stocké dans le champ perso de type "resolve" avec pour label "SUDOC"
     $mes_pp = new parametres_perso("notices");
     $mes_pp->get_values($notice_id);
     $values = $mes_pp->values;
     foreach ($values as $field_id => $vals) {
         if ($mes_pp->t_fields[$field_id]['TYPE'] == "resolve") {
             $field_options = _parser_text_no_function_("<?xml version='1.0' encoding='" . $charset . "'?>\n" . $mes_pp->t_fields[$field_id]['OPTIONS'], "OPTIONS");
             foreach ($field_options['RESOLVE'] as $resolve) {
                 if (strtoupper($resolve['LABEL']) == "SUDOC") {
                     $infos = explode('|', $vals[0]);
                     $ppn = $infos[0];
                 }
             }
         }
     }
     if ($ppn == "") {
         return $this->build_error();
     }
     $url = "carmin.sudoc.abes.fr";
     $port = "210";
     $base = "abes-z39-public";
     $format = "unimarc";
     $term = "@attr 1=12 @attr 2=3 \"{$ppn}\" ";
     $id = yaz_connect("{$url}:{$port}/{$base}", array("piggyback" => false));
     yaz_range($id, 1, 1);
     yaz_syntax($id, strtolower($format));
     yaz_search($id, "rpn", $term);
     $options = array("timeout" => 45);
     //Override le timeout du serveur mysql, pour être sûr que le socket dure assez longtemps pour aller jusqu'aux ajouts des résultats dans la base.
     $sql = "set wait_timeout = 120";
     mysql_query($sql);
     yaz_wait($options);
     $error = yaz_error($id);
     $error_info = yaz_addinfo($id);
     if (!empty($error)) {
         yaz_close($id);
         return $this->build_error();
     } else {
         $hits = yaz_hits($id);
         $hits += 0;
         if ($hits) {
             $rec = yaz_record($id, 1, "raw");
             $record = new iso2709_record($rec);
             if (!$record->valid()) {
                 yaz_close($id);
                 return $this->build_error();
             }
             $lines = "";
             $document->document_type = $record->inner_guide[dt];
             $document->bibliographic_level = $record->inner_guide[bl];
             $document->hierarchic_level = $record->inner_guide[hl];
             if ($document->hierarchic_level == "") {
                 if ($document->bibliographic_level == "s") {
                     $document->hierarchic_level = "1";
                 }
                 if ($document->bibliographic_level == "m") {
                     $document->hierarchic_level = "0";
                 }
             }
             $indicateur = array();
             $cle_list = array();
             for ($i = 0; $i < count($record->inner_directory); $i++) {
                 $cle = $record->inner_directory[$i]['label'];
                 $indicateur[$cle][] = substr($record->inner_data[$i]['content'], 0, 2);
                 $field_array = $record->get_subfield_array_array($cle);
                 $line = "";
                 if (!$cle_list[$cle]) {
                     foreach ($field_array as $field) {
                         $line .= $cle . "  ";
                         foreach ($field as $ss_field) {
                             $line .= "\$" . $ss_field["label"] . $ss_field["content"];
                         }
                         $line .= "<br>";
                     }
                 }
                 $cle_list[$cle] = 1;
                 $lines .= $line;
             }
             if ($lines == "") {
                 yaz_close($id);
                 return $this->build_error();
             }
         } else {
             yaz_close($id);
             return $this->build_error();
         }
     }
     yaz_close($id);
     $enrichment['sudoc']['content'] = $lines;
     $enrichment['source_label'] = $this->msg['sudoc_enrichment_source'];
     return $enrichment;
 }
Example #10
0
    }
    // nettoyage doc. à ranger
    $requete_suppr = "delete from resa_ranger where resa_cb in (select expl_cb from exemplaires where expl_id='" . $expl_id . "') ";
    $result_suppr = pmb_mysql_query($requete_suppr, $dbh);
    $requete = "DELETE FROM exemplaires WHERE expl_cb='{$cb}' or expl_id='{$expl_id}'";
    $result = @pmb_mysql_query($requete, $dbh);
    audit::delete_audit(AUDIT_EXPL, $expl_id);
    $query_caddie = "select caddie_id from caddie_content, caddie where type='EXPL' and object_id ='{$expl_id}' and caddie_id=idcaddie ";
    $result_caddie = @pmb_mysql_query($query_caddie, $dbh);
    while ($cad = pmb_mysql_fetch_object($result_caddie)) {
        $req_suppr_caddie = "delete from caddie_content where caddie_id = '{$cad->caddie_id}' and object_id ='{$expl_id}' ";
        @pmb_mysql_query($req_suppr_caddie, $dbh);
    }
    //Supression des champs perso
    if ($expl_id) {
        $p_perso = new parametres_perso("expl");
        $p_perso->delete_values($expl_id);
    }
    // nettoyage transfert
    $requete_suppr = "delete from transferts_demande where num_expl='{$expl_id}'";
    $result_suppr = pmb_mysql_query($requete_suppr);
    // nettoyage indexation concepts
    if ($expl_id) {
        $index_concept = new index_concept($expl_id, TYPE_EXPL);
        $index_concept->delete();
    }
    print "<div class='row'><div class='msg-perio'>" . $msg[maj_encours] . "</div></div>";
    $id_form = md5(microtime());
    $retour = "./catalog.php?categ=isbd&id={$id}";
    print "<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"{$retour}\" style=\"display:none\">\n\t\t<input type=\"hidden\" name=\"id_form\" value=\"{$id_form}\">\n\t\t</form>\n\t\t<script type=\"text/javascript\">document.dummy.submit();</script>\n\t\t</div>";
}
function bul_do_form($obj)
{
    // $obj = objet contenant les propriétés de l'exemplaire associé
    global $bul_expl_form1, $expl_bulletinage_tpl;
    global $msg;
    // pour texte du bouton supprimer
    global $dbh, $charset;
    global $pmb_type_audit, $select_categ_prop, $pmb_antivol;
    global $id_bull, $bul_id, $serial_id, $numero, $pmb_rfid_activate, $pmb_rfid_serveur_url;
    global $deflt_explnum_statut;
    if (!$obj->abt_numeric) {
        $bul_expl_form1 = str_replace('!!expl_bulletinage_tpl!!', $expl_bulletinage_tpl, $bul_expl_form1);
    } else {
        $bul_expl_form1 = str_replace('!!expl_bulletinage_tpl!!', "", $bul_expl_form1);
    }
    $action = "./pointage_exemplarise.php?act=update&id_bull={$id_bull}&bul_id={$bul_id}";
    // statut
    $select_statut = gen_liste_multiple("select id_explnum_statut, gestion_libelle from explnum_statut order by 2", "id_explnum_statut", "gestion_libelle", "id_explnum_statut", "f_explnum_statut", "", $deflt_explnum_statut, "", "", "", "", 0);
    $bul_expl_form1 = str_replace('!!statut_list!!', $select_statut, $bul_expl_form1);
    // mise à jour des champs de gestion
    $bul_expl_form1 = str_replace('!!bul_id!!', $obj->expl_bulletin, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!id_form!!', md5(microtime()), $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!org_cb!!', $obj->expl_cb, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!expl_id!!', $obj->expl_id, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!action!!', $action, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!id!!', $obj->expl_notice, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!cb!!', $obj->expl_cb, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!note!!', $obj->expl_note, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!comment!!', $obj->expl_comment, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!cote!!', htmlentities($obj->expl_cote, ENT_QUOTES, $charset), $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!prix!!', $obj->expl_prix, $bul_expl_form1);
    if (!$obj->abt_numeric) {
        $bul_expl_form1 = str_replace('!!focus!!', $obj->focus, $bul_expl_form1);
    } else {
        $bul_expl_form1 = str_replace('!!focus!!', "", $bul_expl_form1);
    }
    // select "type document"
    $bul_expl_form1 = str_replace('!!type_doc!!', do_selector('docs_type', 'expl_typdoc', $obj->expl_typdoc), $bul_expl_form1);
    // select "section"
    $bul_expl_form1 = str_replace('!!section!!', do_selector_bul_section($obj->expl_section, $obj->expl_location), $bul_expl_form1);
    // select "statut"
    $bul_expl_form1 = str_replace('!!statut!!', do_selector('docs_statut', 'expl_statut', $obj->expl_statut), $bul_expl_form1);
    // select "localisation"
    $bul_expl_form1 = str_replace('!!localisation!!', gen_liste("select distinct idlocation, location_libelle from docs_location, docsloc_section where num_location=idlocation order by 2", "idlocation", "location_libelle", 'expl_location', "calcule_section(this);", $obj->expl_location, "", "", "", "", 0), $bul_expl_form1);
    // select "code statistique"
    $bul_expl_form1 = str_replace('!!codestat!!', do_selector('docs_codestat', 'expl_codestat', $obj->expl_codestat), $bul_expl_form1);
    // select "owner"
    $bul_expl_form1 = str_replace('!!owner!!', do_selector('lenders', 'expl_owner', $obj->expl_owner), $bul_expl_form1);
    $selector = "";
    if ($pmb_antivol > 0) {
        // select "type_antivol"
        $selector = "\n\t\t<div class='colonne3'>\n\t\t<!-- code stat -->\n\t\t<label class='etiquette' for='type_antivol'>{$msg['type_antivol']}</label>\n\t\t<div class='row'>\n\t\t<select name='type_antivol' id='type_antivol'>";
        $selector .= "<option value='0'";
        if ($obj->type_antivol == 0) {
            $selector .= ' SELECTED';
        }
        $selector .= '>';
        $selector .= $msg["type_antivol_aucun"] . '</option>';
        $selector .= "<option value='1'";
        if ($obj->type_antivol == 1) {
            $selector .= ' SELECTED';
        }
        $selector .= '>';
        $selector .= $msg["type_antivol_magnetique"] . '</option>';
        $selector .= "<option value='2'";
        if ($obj->type_antivol == 2) {
            $selector .= ' SELECTED';
        }
        $selector .= '>';
        $selector .= $msg["type_antivol_autre"] . '</option>';
        $selector .= '</select></div></div>';
    }
    $bul_expl_form1 = str_replace('!!type_antivol!!', $selector, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!bul_id!!', $bul_id, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!expl_id!!', $obj->expl_id, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!bul_no!!', htmlentities($obj->bul_no, ENT_QUOTES, $charset), $bul_expl_form1);
    $date_date_formatee = formatdate_input($obj->date_date);
    $date_clic = "onClick=\"openPopUp('./../../../select.php?what=calendrier&caller=expl&date_caller=" . str_replace('-', '', $obj->date_date) . "&param1=date_date&param2=date_date_lib&auto_submit=NO&date_anterieure=YES', 'date_date', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"  ";
    $date_date = "<input type='hidden' name='date_date' value='" . str_replace('-', '', $obj->date_date) . "' />\n\t\t<input class='saisie-10em' type='text' name='date_date_lib' value='" . $date_date_formatee . "' placeholder='" . $msg["format_date_input_placeholder"] . "'/>\n\t\t<input class='bouton_small' type='button' name='date_date_lib_bouton' value='" . $msg["bouton_calendrier"] . "' " . $date_clic . " />";
    $bul_expl_form1 = str_replace('!!date_date!!', $date_date, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!bul_date!!', htmlentities($obj->bul_date, ENT_QUOTES, $charset), $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!bul_titre!!', htmlentities($obj->bul_titre, ENT_QUOTES, $charset), $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!serial_id!!', $serial_id, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!numero!!', $obj->bul_titre, $bul_expl_form1);
    $bul_expl_form1 = str_replace('!!destinataire!!', $obj->destinataire, $bul_expl_form1);
    $p_perso = new parametres_perso("expl");
    if (!$p_perso->no_special_fields) {
        $c = 0;
        $perso = "";
        $perso_ = $p_perso->show_editable_fields($obj->expl_id);
        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
            $p = $perso_["FIELDS"][$i];
            if ($c == 0) {
                $perso .= "<div class='row'>\n";
            }
            $perso .= "<div class='colonne3'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . " </label>" . $p["COMMENT_DISPLAY"] . "<div class='row'>" . $p["AFF"] . "</div></div>\n";
            $c++;
            if ($c == 3) {
                $perso .= "</div>\n";
                $c = 0;
            }
        }
        if ($c == 1) {
            $perso .= "<div class='colonne2'>&nbsp;</div>\n</div>\n";
        }
        $perso = $perso_["CHECK_SCRIPTS"] . "\n" . $perso;
    } else {
        $perso = "\n<script>function check_form() { return true; }</script>\n";
    }
    $bul_expl_form1 = str_replace("!!champs_perso!!", $perso, $bul_expl_form1);
    if ($pmb_rfid_activate == 1 && $pmb_rfid_serveur_url && !$obj->abt_numeric) {
        $script_rfid_encode = "if(script_rfid_encode()==false) return false;";
        $bul_expl_form1 = str_replace('!!questionrfid!!', $script_rfid_encode, $bul_expl_form1);
    } else {
        $bul_expl_form1 = str_replace('!!questionrfid!!', '', $bul_expl_form1);
    }
    $bul_expl_form1 = str_replace('!!create_notice_bul!!', '<input type="checkbox" value="1" id="create_notice_bul" name="create_notice_bul">&nbsp;' . $msg['bulletinage_create_notice'], $bul_expl_form1);
    return $bul_expl_form1;
}
Example #12
0
 function show_consult_form($last_modified = 0)
 {
     global $idetat, $iduser, $idempr, $user_input;
     global $date_debut, $date_fin, $id_type, $id_theme, $dmde_loc;
     global $form_consult_dmde, $charset, $msg, $dbh, $demandes_init_workflow, $form_consult_linked_record;
     global $pmb_type_audit, $reponse_finale;
     $form_consult_dmde = str_replace('!!form_title!!', htmlentities($this->titre_demande, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!sujet_dmde!!', htmlentities($this->sujet_demande, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!etat_dmde!!', htmlentities($this->workflow->getStateCommentById($this->etat_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_dmde!!', htmlentities(formatdate($this->date_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_butoir_dmde!!', htmlentities(formatdate($this->deadline_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_prevue_dmde!!', htmlentities(formatdate($this->date_prevue), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!progression_dmde!!', htmlentities($this->progression . '%', ENT_QUOTES, $charset), $form_consult_dmde);
     $nom_user = '';
     if (sizeof($this->users)) {
         foreach ($this->users as $id => $user) {
             if ($user['statut'] == 1) {
                 if ($nom_user) {
                     $nom_user .= "/ ";
                 }
                 $nom_user .= $user['nom'];
             }
         }
     }
     $carac_empr = $this->getCaracEmpr($this->num_demandeur);
     $nom = $carac_empr['nom'];
     $cb = $carac_empr['empr_cb'];
     $nom_emprunteur = "";
     if (SESSrights & CIRCULATION_AUTH) {
         $nom_emprunteur = "<a href=\"circ.php?categ=pret&form_cb={$cb}\" >" . htmlentities($nom, ENT_QUOTES, $charset) . "</a>";
     }
     $form_consult_dmde = str_replace('!!demandeur!!', $nom_emprunteur ? $nom_emprunteur : $nom, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!attribution!!', $nom_user, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!iddemande!!', $this->id_demande, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!theme_dmde!!', htmlentities($this->theme_libelle, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!type_dmde!!', htmlentities($this->type_libelle, ENT_QUOTES, $charset), $form_consult_dmde);
     if ($this->num_linked_notice) {
         $display = new mono_display($this->num_linked_notice, 0, '', 0, '', '', '', 0, 0, 0, 0, "", 0, false, true);
         $form_consult_dmde = str_replace('!!form_linked_record!!', $form_consult_linked_record, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record!!', htmlentities($display->result, ENT_QUOTES, $charset), $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record_id!!', htmlentities($this->num_linked_notice, ENT_QUOTES, $charset), $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record_link!!', htmlentities($url_base . "catalog.php?categ=isbd&id=" . $this->num_linked_notice, ENT_QUOTES, $charset), $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!form_linked_record!!', "&nbsp;", $form_consult_dmde);
     }
     //Champs personalisés
     $perso_aff = "";
     $p_perso = new parametres_perso("demandes");
     if (!$p_perso->no_special_fields) {
         $perso_ = $p_perso->show_fields($this->id_demande);
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             if ($p["AFF"]) {
                 $perso_aff .= "<br />" . $p["TITRE"] . " " . nl2br($p["AFF"]);
             }
         }
     }
     if ($perso_aff) {
         $form_consult_dmde = str_replace("!!champs_perso!!", $perso_aff, $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace("!!champs_perso!!", "", $form_consult_dmde);
     }
     //afficher la liste des boutons de changement d'état
     if ($this->etat_demande && sizeof($this->users) || $demandes_init_workflow !== "2") {
         $states = $this->workflow->getStateList($this->etat_demande);
         $states_btn = $this->getDisplayStateBtn($states);
         $form_consult_dmde = str_replace('!!btn_etat!!', $states_btn, $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!btn_etat!!', "", $form_consult_dmde);
     }
     //afficher la liste des boutons de la notice
     if ($this->num_notice != 0) {
         $notice = "<a onclick=\"show_notice('" . $this->num_notice . "')\" href='#'><img border='0' align='top' src='./images/search.gif' alt='" . htmlentities($msg['demandes_see_notice'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['demandes_see_notice'], ENT_QUOTES, $charset) . "' /></a>";
     } else {
         $notice = "";
     }
     $form_consult_dmde = str_replace('!!icone!!', $notice, $form_consult_dmde);
     if (sizeof($this->users) || $demandes_init_workflow !== "2") {
         $req = "select count(1) as nb from demandes join demandes_actions on id_demande=num_demande join explnum_doc_actions on num_action=id_action where id_demande='" . $this->id_demande . "'";
         $res = pmb_mysql_query($req, $dbh);
         $docnum = pmb_mysql_fetch_object($res);
         // bouton doc num
         if ($docnum->nb) {
             $btn_attach = "&nbsp;<input type='submit' class='bouton' value='" . $msg['demandes_attach_docnum'] . "' onClick='this.form.act.value=\"attach\" ; ' />";
         } else {
             $btn_attach = "";
         }
         // boutons notice
         if ($this->num_notice != 0) {
             $btn_notices = "<input type='submit' class='bouton' value='" . $msg['demandes_complete_notice'] . "' onClick='this.form.act.value=\"notice\" ; ' />" . $btn_attach . "&nbsp;<input type='submit' class='bouton' value='" . $msg['demandes_generate_rapport'] . "' onClick='this.form.act.value=\"rapport\" ; ' />";
             $btn_suppr_notice = "<input type='submit' class='bouton' value='" . $msg['demandes_delete_notice'] . "' onClick='this.form.act.value=\"delete_notice\"  ; return confirm_delete(); ' />";
         } else {
             $btn_notices = "<input type='submit' class='bouton' value='" . $msg['demandes_create_notice'] . "' onClick='this.form.act.value=\"create_notice\" ; ' />" . $btn_attach . "&nbsp;<input type='hidden' class='bouton' value='" . $msg['demandes_generate_rapport'] . "' onClick='this.form.act.value=\"rapport\" ; ' />" . $btn_attach . "&nbsp;<input type='submit' class='bouton' value='" . $msg['demandes_generate_rapport'] . "' onClick='this.form.act.value=\"rapport\" ; ' />";
             $btn_suppr_notice = "";
         }
         // bouton audit
         if ($pmb_type_audit) {
             $btn_audit = "&nbsp;<input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=14&object_id={$this->id_demande}', 'audit_popup', 700, 500, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" title=\"" . $msg['audit_button'] . "\" value=\"" . $msg['audit_button'] . "\" />&nbsp;";
         } else {
             $btn_audit = "";
         }
         // affichage des boutons de création de la réponse finale
         $btn_repfinal = $btn_faq = "";
         if ($this->etat_demande == 4) {
             if (!$this->reponse_finale || $this->reponse_finale == '') {
                 $btn_repfinal = "&nbsp;<input type='submit' class='bouton' value='" . $msg['demandes_repfinale_creation'] . "' onclick='this.form.act.value=\"final_response\" ; ' />&nbsp;";
             }
         }
         if ($this->etat_demande == 4) {
             if (!$this->num_faq_question) {
                 $btn_faq = "&nbsp;<input type='button' class='bouton' value='" . $msg['demandes_creation_faq_question'] . "' onclick='document.location=\"./demandes.php?categ=faq&sub=question&action=new&num_demande=" . $this->id_demande . "\" ; ' />&nbsp;";
             } else {
                 $btn_faq = "&nbsp;<input type='button' class='bouton' value='" . $msg['demandes_edit_faq_question'] . "' onclick='document.location=\"./demandes.php?categ=faq&sub=question&action=edit&id=" . $this->num_faq_question . "\" ; ' />&nbsp;";
             }
         }
         $form_consult_dmde = str_replace('!!btns_notice!!', $btn_notices, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_suppr_notice!!', $btn_suppr_notice, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_audit!!', $btn_audit, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_repfinal!!', $btn_repfinal, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_faq!!', $btn_faq, $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!btns_notice!!', "", $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_suppr_notice!!', "", $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_audit!!', "", $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_repfinal!!', $btn_repfinal, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!btn_faq!!', "", $form_consult_dmde);
     }
     //construction de l'url de retour
     $params_retour = '';
     if ($idetat) {
         $params_retour .= "&idetat=" . $idetat;
     }
     if ($iduser) {
         $params_retour .= "&iduser="******"&idempr=" . $idempr;
     }
     if ($user_input) {
         $params_retour .= "&user_input=" . $user_input;
     }
     if ($date_debut) {
         $params_retour .= "&date_debut=" . $date_debut;
     }
     if ($date_fin) {
         $params_retour .= "&date_fin=" . $date_fin;
     }
     if ($id_type) {
         $params_retour .= "&id_type=" . $id_type;
     }
     if ($id_theme) {
         $params_retour .= "&id_theme=" . $id_theme;
     }
     if ($dmde_loc) {
         $params_retour .= "&dmde_loc=" . $dmde_loc;
     }
     if ($params_retour) {
         $form_consult_dmde = str_replace('!!params_retour!!', htmlentities(stripslashes($params_retour), ENT_QUOTES, $charset), $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!params_retour!!', "", $form_consult_dmde);
     }
     if (sizeof($this->users) || $demandes_init_workflow !== "2") {
         //Liste des actions
         $this->fetch_data($this->id_demande, false);
         if ($this->etat_demande == 4 || $this->etat_demande == 5) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande);
         } elseif ($last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $last_modified);
         } elseif ($this->last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $this->last_modified->id_action);
         } elseif ($this->last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $this->last_modified->id_action);
         } else {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande);
         }
     }
     if ($this->etat_demande == 4 && $this->reponse_finale != '') {
         $reponse_finale = str_replace('!!repfinale!!', $this->reponse_finale, $reponse_finale);
         $reponse_finale = str_replace('!!iddemande!!', htmlentities($this->id_demande, ENT_QUOTES, $charset), $reponse_finale);
         $act_form = "./demandes.php?categ=gestion";
         $reponse_finale = str_replace('!!form_action!!', htmlentities($act_form, ENT_QUOTES, $charset), $reponse_finale);
         $form_consult_dmde .= $reponse_finale;
     }
     if ($this->etat_demande == 1 && !sizeof($this->actions) && $this->dmde_read_gestion == 1) {
         demandes::demande_read($this->id_demande, true, "_gestion");
         $this->fetch_data($this->id_demande, false);
     }
     print $form_consult_dmde;
 }
Example #13
0
 function delete()
 {
     global $dbh;
     if ($this->id) {
         //On nettoye l'index
         if (!$this->serial_id) {
             $req = "SELECT id_serial FROM collections_state WHERE collstate_id='" . $this->id . "'";
             $res = pmb_mysql_query($req, $dbh);
             if ($res && pmb_mysql_num_rows($res)) {
                 $this->serial_id = pmb_mysql_result($res, 0, 0);
             }
         }
         //elimination des champs persos
         $p_perso = new parametres_perso("collstate");
         $p_perso->delete_values($this->id);
         pmb_mysql_query("DELETE from collections_state WHERE collstate_id='" . $this->id . "' ", $dbh);
     } else {
         if ($this->serial_id) {
             $myQuery = pmb_mysql_query("SELECT collstate_id FROM collections_state WHERE id_serial='" . $this->serial_id . "' ", $dbh);
             if (pmb_mysql_num_rows($myQuery)) {
                 while ($coll = pmb_mysql_fetch_object($myQuery)) {
                     $my_collstate = new collstate($coll->collstate_id);
                     $my_collstate->delete();
                 }
             }
         }
     }
     //On nettoye l'index
     notice::majNoticesMotsGlobalIndex($this->serial_id, 'collstate');
 }
Example #14
0
 $table['eformat'] = $f_eformat;
 $table['niveau_biblio'] = $b_level;
 $table['niveau_hierar'] = $h_level;
 $table['ill'] = $f_ill;
 $table['size'] = $f_size;
 $table['prix'] = $f_prix;
 $table['accomp'] = $f_accomp;
 $table['npages'] = $f_npages;
 $table['indexation_lang'] = $indexation_lang;
 if ($table['date_date'] == '0000-00-00' || !isset($date_date_lib)) {
     $table['year'] = "";
 } else {
     $table['year'] = substr($table['date_date'], 0, 4);
 }
 $table['date_parution'] = $table['date_date'];
 $p_perso = new parametres_perso("notices");
 $nberrors = $p_perso->check_submited_fields();
 $table['force_empty'] = $p_perso->presence_exclusion_fields();
 if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) {
     $table['force_empty'] = "f_img_load";
 }
 //Pour la synchro rdf
 if ($pmb_synchro_rdf) {
     require_once $class_path . "/synchro_rdf.class.php";
     $synchro_rdf = new synchro_rdf();
     if ($bul_id) {
         $synchro_rdf->delRdf(0, $bul_id);
     }
 }
 if (!$nberrors) {
     $myBulletinage = new bulletinage($bul_id, $serial_id);
function extrait_info_empr($sql = "", $entete = 1, $flag = "")
{
    global $dbh;
    global $dest;
    global $worksheet;
    global $entete_bloc;
    global $msg;
    global $charset;
    global $debligne_excel;
    global $etat_table;
    // permet de savoir si les tag table sont ouverts ou fermés
    global $max_perso;
    global $res_compte1;
    if (!$debligne_excel) {
        $debligne_excel = 0;
    }
    $res = @pmb_mysql_query($sql, $dbh);
    $nbr_lignes = @pmb_mysql_num_rows($res);
    $nbr_champs = @pmb_mysql_num_fields($res);
    if ($nbr_lignes) {
        switch ($dest) {
            case "TABLEAU":
                if ($entete) {
                    $worksheet->write_string(1 + $debligne_excel, 0, $msg["caddie_mess_edition_" . $entete_bloc]);
                    $debligne_excel++;
                }
                for ($i = 0; $i < $nbr_champs; $i++) {
                    // entête de colonnes
                    $fieldname = pmb_mysql_field_name($res, $i);
                    if ($entete) {
                        $worksheet->write_string(1 + $debligne_excel, 0, $msg['caddie_action_marque']);
                        $worksheet->write_string(1 + $debligne_excel, $i + 1, ${fieldname});
                    }
                }
                if ($entete) {
                    $worksheet->write_string(1 + $debligne_excel, $nbr_champs + 1, "DESCR");
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = pmb_mysql_fetch_object($res_compte1);
                        $worksheet->write_string(1 + $debligne_excel, $nbr_champs + 2 + $i, $perso->titre);
                    }
                }
                if ($entete) {
                    $debligne_excel++;
                }
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $debligne_excel++;
                    $row = pmb_mysql_fetch_row($res);
                    $id_notice = $row[0];
                    if ($flag) {
                        $worksheet->write_string($i + $debligne_excel, 0, "X");
                    }
                    $j = 0;
                    foreach ($row as $dummykey => $col) {
                        if (!$col) {
                            $col = " ";
                        }
                        $worksheet->write_string($i + $debligne_excel, $j + 1, $col);
                        $j++;
                    }
                    $p_perso = new parametres_perso("empr");
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            $worksheet->write_string($debligne_excel, $nbr_champs + 2 + $i, html_entity_decode($p["AFF"], ENT_QUOTES | ENT_COMPAT, $charset));
                        }
                    }
                }
                break;
            case "TABLEAUHTML":
                if ($entete) {
                    if ($etat_table) {
                        echo "\n</table>";
                    }
                    echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>";
                    echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>";
                    $etat_table = 1;
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        $fieldname = pmb_mysql_field_name($res, $i);
                        print "<th align='left'>{$fieldname}</th>";
                    }
                    print "<th align='left'>DESCR</th>";
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = pmb_mysql_fetch_object($res_compte1);
                        print "<th align='left'>" . $perso->titre . "</th>";
                    }
                }
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $row = pmb_mysql_fetch_row($res);
                    $id_notice = $row[0];
                    echo "<tr>";
                    if ($flag) {
                        print "<td>X</td>";
                    } else {
                        print "<td>&nbsp;</td>";
                    }
                    foreach ($row as $dummykey => $col) {
                        if (is_numeric($col)) {
                            $col = "'" . $col;
                        }
                        if (!$col) {
                            $col = "&nbsp;";
                        }
                        print pmb_bidi("<td>{$col}</td>");
                    }
                    print "<td>&nbsp;</td>";
                    $p_perso = new parametres_perso("empr");
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            print "<td>" . $p["AFF"] . "</td>";
                        }
                    }
                    echo "</tr>";
                }
                break;
            default:
                if ($entete) {
                    if ($etat_table) {
                        echo "\n</table>";
                    }
                    echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>";
                    echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>";
                    $etat_table = 1;
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        $fieldname = pmb_mysql_field_name($res, $i);
                        print "<th align='left'>{$fieldname}</th>";
                    }
                    print "<th align='left'>DESCR</th>";
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = pmb_mysql_fetch_object($res_compte1);
                        print "<th align='left'>" . $perso->titre . "</th>";
                    }
                }
                $odd_even = 0;
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $row = pmb_mysql_fetch_row($res);
                    $id_notice = $row[0];
                    if ($odd_even == 0) {
                        echo "\t<tr class='odd'>";
                        $odd_even = 1;
                    } else {
                        if ($odd_even == 1) {
                            echo "\t<tr class='even'>";
                            $odd_even = 0;
                        }
                    }
                    if ($flag) {
                        print "<td>X</td>";
                    } else {
                        print "<td>&nbsp;</td>";
                    }
                    foreach ($row as $dummykey => $col) {
                        if (!$col) {
                            $col = "&nbsp;";
                        }
                        print pmb_bidi("<td>{$col}</td>");
                    }
                    print "<td>&nbsp;</td>";
                    $p_perso = new parametres_perso("empr");
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            print "<td>" . $p["AFF"] . "</td>";
                        }
                    }
                    echo "</tr>";
                }
                break;
        }
        // fin switch
    }
    // fin if nbr_lignes
}
Example #16
0
    }
    $header_aut .= implode(", ", $aut1_libelle);
}
$header_aut ? $auteur = " / " . $header_aut : ($auteur = "");
// récupération du titre de série
if ($expl->tparent_id && $expl->m_id) {
    $parent = new serie($expl->tparent_id);
    $tit_serie = $parent->name;
    if ($expl->tnvol) {
        $tit_serie .= ', ' . $expl->tnvol;
    }
}
if ($tit_serie) {
    $expl->tit = $tit_serie . '. ' . $expl->tit;
}
// cote: soit param persio de notice, ou bien la vraie cote de l'exemplaire
$p_perso = new parametres_perso("notices");
$cote = $expl->expl_cote;
if (!$cote) {
    $cote = $p_perso->read_base_fields_perso("ancienne_cote", $expl->s_id);
}
$ourPDF->SetY(50);
add_line("Titre", $expl->tit);
add_line("No. exemplaire", $cote);
if ($expl->bulletin_numero) {
    add_line("Numéro", $numero);
}
add_line("Code", $cb_doc);
add_line("Date", $expl->aff_pret_date . ' ' . date("H:i"));
add_line("Emprunteur", $emprunteur);
$ourPDF->OutPut();
 function update_in_database($id_notice = 0)
 {
     global $dbh;
     global $pmb_synchro_rdf;
     $new_notice = 2;
     $notice_retour = $id_notice;
     if (!$id_notice) {
         $retour = array(2, 0);
         return $retour;
     }
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf($notice_retour, 0);
     }
     // traitement des titres uniformes
     global $pmb_use_uniform_title;
     if ($pmb_use_uniform_title) {
         if (count($this->titres_uniformes)) {
             $ntu = new tu_notice($id_notice);
             $ntu->update($this->titres_uniformes);
         }
     }
     for ($i = 0; $i < 2; $i++) {
         if ($this->editors[$i]['id']) {
             $editor_ids[$i] = $this->editors[$i]['id'];
         } else {
             $editor_ids[$i] = editeur::import($this->editors[$i]);
         }
     }
     if ($this->collection["id"]) {
         $collection_id = $this->collection["id"];
     } else {
         $this->collection['parent'] = $editor_ids[0];
         $collection_id = collection::import($this->collection);
     }
     if ($this->subcollection["id"]) {
         $subcollection_id = $this->subcollection["id"];
     } else {
         $this->subcollection['coll_parent'] = $collection_id;
         $subcollection_id = subcollection::import($this->subcollection);
         $serie_id = serie::import(stripslashes($this->serie));
     }
     /* traitement de Dewey */
     if (!$this->internal_index) {
         if (!$this->dewey["new_comment"]) {
             $this->dewey["new_comment"] = "";
         }
         if (!$this->dewey["new_pclass"]) {
             $this->dewey["new_pclass"] = "";
         }
         $this->internal_index = indexint::import(clean_string($this->dewey[0]), clean_string($this->dewey["new_comment"]), clean_string($this->dewey["new_pclass"]));
     }
     $date_parution_z3950 = notice::get_date_parution($this->year);
     /* Origine de la notice */
     $this->orinot_id = origine_notice::import($this->origine_notice);
     if ($this->orinot_id == 0) {
         $this->orinot_id = 1;
     }
     $sql_ins = "update notices set\n\t\t\ttypdoc           \t='" . $this->document_type . "',\n\t\t\tcode        \t        ='" . $this->isbn . "',\t            \n\t\t\ttit1                    ='" . $this->titles[0] . "',             \n\t\t\ttit2                    ='" . $this->titles[1] . "',             \n\t\t\ttit3                    ='" . $this->titles[2] . "',             \n\t\t\ttit4                    ='" . $this->titles[3] . "',             \n\t\t\ttparent_id              ='" . $serie_id . "',                    \n\t\t\ttnvol                   ='" . $this->nbr_in_serie . "',          \n\t\t\ted1_id                  =" . $editor_ids[0] . " ,                \n\t\t\ted2_id                  =" . $editor_ids[1] . " ,                \n\t\t\tyear                    ='" . $this->year . "',                  \n\t\t\tnpages                  ='" . $this->page_nbr . "',              \n\t\t\till                     ='" . $this->illustration . "',          \n\t\t\tsize                    ='" . $this->size . "',                  \n\t\t\taccomp                  ='" . $this->accompagnement . "',        \n\t\t\tcoll_id                 =" . $collection_id . " ,                \n\t\t\tsubcoll_id              =" . $subcollection_id . " ,             \n\t\t\tnocoll                  ='" . $this->nbr_in_collection . "',     \n\t\t\tmention_edition         ='" . $this->mention_edition . "',       \n\t\t\tn_gen                   ='" . $this->general_note . "',          \n\t\t\tn_contenu               ='" . $this->content_note . "',          \n\t\t\tn_resume                ='" . $this->abstract_note . "',         \n\t\t\tindexint                ='" . $this->internal_index . "',          \n\t\t\tstatut\t\t\t\t\t='" . $this->statut . "',\n\t\t\tcommentaire_gestion\t\t='" . $this->commentaire_gestion . "',\n\t\t\tindexation_lang\t\t\t='" . $this->indexation_lang . "',\n\t\t\tthumbnail_url\t\t\t='" . $this->thumbnail_url . "',\n\t\t\tindex_l                 ='" . clean_tags($this->free_index) . "',                \n\t\t\tniveau_biblio           ='" . $this->bibliographic_level . "',   \n\t\t\tniveau_hierar           ='" . $this->hierarchic_level . "',      \n\t\t\tlien                    ='" . $this->link_url . "',              \n\t\t\teformat                 ='" . $this->link_format . "',           \n\t\t\torigine_catalogage      ='" . $this->orinot_id . "',             \n\t\t\tprix                    ='" . $this->prix . "',\n\t\t\tdate_parution \t\t\t='" . $date_parution_z3950 . "'             \n\t\t\twhere notice_id='{$id_notice}' ";
     //echo "<pre>";
     //print_r($this->aut_array);
     //echo "</pre>";
     //echo $sql_ins."<br />";
     //echo "<pre>";
     //print_r($this->categories);
     //echo "</pre>";
     //exit;
     $sql_result_ins = pmb_mysql_query($sql_ins) or die("Couldn't update notices : " . $sql_ins);
     $notice_retour = $id_notice;
     audit::insert_modif(AUDIT_NOTICE, $id_notice);
     // purge de la base des responsabilités de la notice intégrée...
     if ($notice_retour) {
         $rqt_del = "delete from responsability where responsability_notice='{$notice_retour}'";
         $sql_result_del = pmb_mysql_query($rqt_del) or die("Couldn't purge table responsability : " . $rqt_del);
     }
     $rqt_ins = "insert into responsability (responsability_author, responsability_notice, responsability_fonction, responsability_type, responsability_ordre) VALUES ";
     for ($i = 0; $i < sizeof($this->aut_array); $i++) {
         $aut['id'] = clean_string($this->aut_array[$i]['id']);
         $aut['name'] = clean_string($this->aut_array[$i]['entree']);
         $aut['rejete'] = clean_string($this->aut_array[$i]['rejete']);
         $aut['date'] = clean_string($this->aut_array[$i]['date']);
         $aut['type'] = $this->aut_array[$i]['type_auteur'];
         $aut['subdivision'] = clean_string($this->aut_array[$i]['subdivision']);
         $aut['numero'] = clean_string($this->aut_array[$i]['numero']);
         $aut['lieu'] = clean_string($this->aut_array[$i]['lieu']);
         $aut['ville'] = clean_string($this->aut_array[$i]['ville']);
         $aut['pays'] = clean_string($this->aut_array[$i]['pays']);
         $aut['web'] = clean_string($this->aut_array[$i]['web']);
         $aut['author_comment'] = clean_string($this->aut_array[$i]['author_comment']);
         $aut['authority_number'] = clean_string($this->aut_array[$i]['authority_number']);
         /* Origine de l'autorité : on reprend les infos d'origine de la notice pour les attribuées aux origines des autorités */
         $id_origine_auth = 0;
         $id_origine_auth = origin_authorities::import($this->origine_notice);
         if ($id_origine_auth == 0) {
             $id_origine_auth = 1;
         }
         // import de l'autorité auteur si elle n'existe pas et conservation des infos sur l'origine de l'autorité
         if ($aut['authority_number'] != '' && $id_origine_auth) {
             $this->aut_array[$i]["id"] = $this->insert_authority_infos($aut['authority_number'], "author", $id_origine_auth, $aut);
         }
         if (!$this->aut_array[$i]["id"]) {
             $this->aut_array[$i]["id"] = auteur::import($aut);
         }
         if ($this->aut_array[$i]["id"]) {
             $rqt = $rqt_ins . " (" . $this->aut_array[$i]["id"] . "," . $notice_retour . ",'" . $this->aut_array[$i]['fonction'] . "'," . $this->aut_array[$i]['responsabilite'] . "," . $i . ") ";
             $res_ins = pmb_mysql_query($rqt, $dbh);
         }
     }
     // traitement des categories
     if ($this->categorisation_type == "categorisation_auto") {
         traite_categories_enreg($notice_retour, $this->categories);
     } else {
         $rqt_del = "delete from notices_categories where notcateg_notice='{$notice_retour}' ";
         $res_del = @pmb_mysql_query($rqt_del, $dbh);
         $rqt_ins = "insert into notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ";
         $rqt_ins_values = array();
         foreach ($this->categories as $i => $category) {
             $id_categ = $category['categ_id'];
             if ($id_categ) {
                 $rqt_ins_values[] = " ('{$notice_retour}','{$id_categ}', {$i}) ";
             }
         }
         $rqt_ins .= implode(",", $rqt_ins_values);
         $res_ins = @pmb_mysql_query($rqt_ins, $dbh);
     }
     // traitement des langues
     // langues de la publication
     $rqt_del = "delete from notices_langues where num_notice='{$notice_retour}' ";
     $res_del = pmb_mysql_query($rqt_del, $dbh);
     if (is_array($this->language_code) && count($this->language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',0, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @pmb_mysql_query($rqt, $dbh);
             }
         }
     }
     // langues originales
     if (is_array($this->original_language_code) && count($this->original_language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->original_language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',1, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @pmb_mysql_query($rqt, $dbh);
             }
         }
     }
     //Traitement des champs personnalisés (du formulaire !!!)
     $p_perso = new parametres_perso("notices");
     $nberrors = $p_perso->check_submited_fields();
     $p_perso->rec_fields_perso($notice_retour);
     //Traitement import perso
     global $notice_id, $notice_org, $notice_type_org;
     if (function_exists('z_recup_noticeunimarc_suite') && function_exists('recup_noticeunimarc_suite')) {
         //Suppression des champs persos
         $requete = "delete from notices_custom_values where notices_custom_origine=" . $notice_retour;
         @pmb_mysql_query($requete);
         $notice_id = $notice_retour;
         z_recup_noticeunimarc_suite($notice_org);
         z_import_new_notice_suite();
     }
     // Mise à jour des index de la notice
     notice::majNotices($notice_retour);
     // Mise à jour de la table notices_global_index
     notice::majNoticesGlobalIndex($notice_retour);
     // Mise à jour de la table notices_mots_global_index
     notice::majNoticesMotsGlobalIndex($notice_retour);
     //Documents numériques
     foreach ($this->doc_nums as $doc_num) {
         if (!$doc_num["a"]) {
             continue;
         }
         explnum_add_from_url($notice_retour, $this->bull_id, $doc_num["b"], $doc_num["a"], false, $this->source_id, $doc_num["f"], '', $doc_num["s"]);
     }
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf->addRdf($notice_retour, 0);
     }
     $retour = array($new_notice, $notice_retour);
     return $retour;
 }
Example #18
0
function show_empr_form($form_action, $form_cancel, $link, $id, $cb, $duplicate_empr_from_id = "")
{
    global $empr_form;
    global $dbh, $msg, $charset;
    global $biblio_email;
    global $aff_list_empr;
    global $deflt2docs_location;
    global $pmb_lecteurs_localises;
    global $pmb_gestion_abonnement, $pmb_gestion_financiere, $empr_abonnement_default_debit;
    global $empr_prolong_calc_date_adhes_depassee;
    global $database_window_title;
    global $lang;
    global $pmb_rfid_activate, $pmb_rfid_serveur_url;
    global $pmb_opac_view_activate;
    // si $id est fourni, il s'agit d'une modification. on recupere les donnees dans $link
    if ($id) {
        // modification
        echo window_title($database_window_title . $msg[55]);
        $entete = $msg[55];
        if ($pmb_rfid_activate == 1 && $pmb_rfid_serveur_url) {
            $script_rfid_encode = "if(script_rfid_encode()==false) return false;";
        } else {
            $script_rfid_encode = '';
        }
        $empr_form = str_replace("!!questionrfid!!", $script_rfid_encode, $empr_form);
        $requete = "SELECT * FROM empr WHERE id_empr='{$id}' ";
        $res = mysql_query($requete, $link);
        if ($res) {
            $empr = mysql_fetch_object($res);
        } else {
            error_message($msg[53], $msg[54], 0);
        }
    } else {
        // création
        $empr = new stdClass();
        $entete = $msg[15];
        $empr_form = str_replace("!!questionrfid!!", '', $empr_form);
    }
    if ($duplicate_empr_from_id) {
        $empr_form = str_replace("!!id!!", "", $empr_form);
        $empr_form = str_replace("!!entete!!", $msg["empr_duplicate"], $empr_form);
    } else {
        $empr_form = str_replace("!!id!!", $id, $empr_form);
        $empr_form = str_replace("!!entete!!", $entete, $empr_form);
    }
    $empr_form = str_replace("!!form_action!!", $form_action, $empr_form);
    if ($empr->empr_cb) {
        //Si il y a un code lecteur
        if (!$duplicate_empr_from_id) {
            $empr_form = str_replace("!!cb!!", $empr->empr_cb, $empr_form);
        } else {
            $empr_form = str_replace("!!cb!!", $cb, $empr_form);
        }
        $date_adhesion = !$duplicate_empr_from_id ? $empr->empr_date_adhesion : date('Y-m-d');
        $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=empr_form&date_caller=" . preg_replace('/-/', '', $date_adhesion) . "&param1=form_adhesion&param2=form_adhesion_lib&auto_submit=NO&date_anterieure=YES', 'date_adhesion', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"  ";
        $adhesion = "\n\t\t\t\t<input type='hidden' name='form_adhesion' value='" . preg_replace('/-/', '', $date_adhesion) . "' />\n\t\t\t\t<input class='bouton' type='button' name='form_adhesion_lib' value='" . formatdate($date_adhesion) . "' " . $date_clic . " />";
        $empr_form = str_replace("!!adhesion!!", $adhesion, $empr_form);
        $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=empr_form&date_caller=" . preg_replace('/-/', '', $empr->empr_date_expiration) . "&param1=form_expiration&param2=form_expiration_lib&auto_submit=NO&date_anterieure=YES', 'date_adhesion', 205, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"  ";
        $expiration = "\n\t\t\t\t<input type='hidden' id='form_expiration' name='form_expiration' value='" . preg_replace('/-/', '', $empr->empr_date_expiration) . "' />\n\t\t\t\t<input class='bouton' type='button' id='form_expiration_lib' name='form_expiration_lib' value='" . formatdate($empr->empr_date_expiration) . "' " . $date_clic . " />";
        $empr_form = str_replace("!!expiration!!", $expiration, $empr_form);
        // ajout ici des trucs sur la relance adhésion
        $empr_temp = new emprunteur($id, '', FALSE, 0);
        $aff_relance = "";
        if ($empr_temp->adhesion_renouv_proche() || $empr_temp->adhesion_depassee()) {
            if ($empr_temp->adhesion_depassee()) {
                $mess_relance = $msg[empr_date_depassee];
            } else {
                $mess_relance = $msg[empr_date_renouv_proche];
            }
            $rqt = "select duree_adhesion from empr_categ where id_categ_empr='{$empr_temp->categ}'";
            $res_dur_adhesion = mysql_query($rqt, $dbh);
            $row = mysql_fetch_row($res_dur_adhesion);
            $nb_jour_adhesion_categ = $row[0];
            if ($empr_prolong_calc_date_adhes_depassee && $empr_temp->adhesion_depassee()) {
                $rqt_date = "select date_add(curdate(),INTERVAL 1 DAY) as nouv_date_debut,\n\t\t\t\t\t\tdate_add(curdate(),INTERVAL {$nb_jour_adhesion_categ} DAY) as nouv_date_fin ";
            } else {
                $rqt_date = "select date_add('{$empr_temp->date_expiration}',INTERVAL 1 DAY) as nouv_date_debut,\n\t\t\t\t\t\tdate_add('{$empr_temp->date_expiration}',INTERVAL {$nb_jour_adhesion_categ} DAY) as nouv_date_fin ";
            }
            $resultatdate = mysql_query($rqt_date) or die("<br /> {$rqt_date} " . mysql_error());
            $resdate = mysql_fetch_object($resultatdate);
            $nouv_date_debut = $resdate->nouv_date_debut;
            $nouv_date_fin = $resdate->nouv_date_fin;
            $nouv_date_debut_formatee = formatdate($nouv_date_debut);
            $nouv_date_fin_formatee = formatdate($nouv_date_fin);
            // on conserve la date d'adhésion initiale
            $action_prolonger = "this.form.form_expiration.value = '{$nouv_date_fin}';\n\t\t\t\tthis.form.form_expiration_lib.value = '{$nouv_date_fin_formatee}';\n\t\t\t\t";
            $action_relance_courrier = "openPopUp('./pdf.php?pdfdoc=lettre_relance_adhesion&id_empr={$id}', 'lettre', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes'); return(false) ";
            $aff_relance = "<div class='row'>\n\t\t\t\t\t\t<span class='erreur'>{$mess_relance}</span><br />\n\t\t\t\t\t\t<input class='bouton' type='button' value=\"" . $msg[prolonger] . "\" onClick=\"{$action_prolonger}\" />&nbsp;\n\t\t\t\t\t\t<input class='bouton' type='button' value=\"" . $msg[prolong_courrier] . "\" onClick=\"{$action_relance_courrier}\" />";
            if ($empr_temp->mail && $biblio_email) {
                $action_relance_mail = "if (confirm('" . $msg["mail_retard_confirm"] . "')) {openPopUp('./mail.php?type_mail=mail_relance_adhesion&id_empr={$id}', 'mail', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes'); } return(false) ";
                $aff_relance .= "&nbsp;<input class='bouton' type='button' value=\"" . $msg['prolong_mail'] . "\" onClick=\"{$action_relance_mail}\" />";
            }
            $aff_relance .= "</div>";
            if ($pmb_gestion_financiere && $pmb_gestion_abonnement) {
                $aff_relance .= "<div class='row'><input type='radio' name='debit' value='0' id='debit_0' " . (!$empr_abonnement_default_debit ? "checked" : "") . " /><label for='debit_0'>" . $msg["finance_abt_no_debit"] . "</label>&nbsp;<input type='radio' name='debit' value='1' id='debit_1' " . ($empr_abonnement_default_debit == 1 ? "checked" : "") . " />";
                $aff_relance .= "<label for='debit_1'>" . $msg["finance_abt_debit_wo_caution"] . "</label>&nbsp;";
                if ($pmb_gestion_abonnement == 2) {
                    $aff_relance .= "<input type='radio' name='debit' value='2' id='debit_2' " . ($empr_abonnement_default_debit == 2 ? "checked" : "") . " /><label for='debit_2'>" . $msg["finance_abt_debit_wt_caution"] . "</label>";
                }
                $aff_relance .= "</div>";
            }
        }
        $empr_form = str_replace("!!adhesion_proche_depassee!!", $aff_relance, $empr_form);
        //Liste des types d'abonnement
        $list_type_abt = "";
        if ($pmb_gestion_abonnement == 2 && $pmb_gestion_financiere) {
            $requete = "select * from type_abts order by type_abt_libelle ";
            $resultat_abt = mysql_query($requete);
            $user_loc = $deflt2docs_location;
            $t_type_abt = array();
            while ($res_abt = mysql_fetch_object($resultat_abt)) {
                $locs = explode(",", $res_abt->localisations);
                $as = array_search($user_loc, $locs);
                if ($as !== false && $as !== null || !$res_abt->localisations) {
                    $t_type_abt[] = $res_abt;
                }
            }
            if (count($t_type_abt)) {
                $list_type_abt = "<div class='row'>\n<label for='type_abt'>" . $msg["finance_type_abt"] . "</label></div>\n<div class='row'>\n<select name='type_abt' id='type_abt'>\n";
                for ($i = 0; $i < count($t_type_abt); $i++) {
                    $list_type_abt .= "<option value='" . $t_type_abt[$i]->id_type_abt . "'";
                    if ($empr->type_abt == $t_type_abt[$i]->id_type_abt) {
                        $list_type_abt .= " selected";
                    }
                    $list_type_abt .= ">" . htmlentities($t_type_abt[$i]->type_abt_libelle, ENT_QUOTES, $charset) . "</option>\n";
                }
                $list_type_abt .= "</select></div>";
            }
        }
        $empr_form = str_replace("!!typ_abonnement!!", $list_type_abt, $empr_form);
    } else {
        // création de lecteur
        $empr->empr_date_adhesion = today();
        $empr_form = str_replace('!!cb!!', $cb, $empr_form);
        $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=empr_form&date_caller=" . preg_replace('/-/', '', $empr->empr_date_adhesion) . "&param1=form_adhesion&param2=form_adhesion_lib&auto_submit=NO&date_anterieure=YES', 'date_adhesion', 250, 260, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"  ";
        $adhesion = "{$msg['1401']}{$msg['1901']}\n\t\t\t\t<input type='hidden' name='form_adhesion' value='" . preg_replace('/-/', '', $empr->empr_date_adhesion) . "'>\n\t\t\t\t<input class='bouton' type='button' name='form_adhesion_lib' value='" . formatdate($empr->empr_date_adhesion) . "' " . $date_clic . " />";
        $empr_form = str_replace("!!adhesion!!", $adhesion, $empr_form);
        $empr_form = str_replace("!!adhesion_proche_depassee!!", "", $empr_form);
        $empr_form = str_replace("!!expiration!!", "<input type='hidden' name='form_expiration' value=''>", $empr_form);
        //Liste des types d'abonnement
        $list_type_abt = "";
        if ($pmb_gestion_abonnement == 2 && $pmb_gestion_financiere) {
            $requete = "select * from type_abts";
            $resultat_abt = mysql_query($requete);
            $user_loc = $deflt2docs_location;
            $t_type_abt = array();
            while ($res_abt = mysql_fetch_object($resultat_abt)) {
                $locs = explode(",", $res_abt->localisations);
                $as = array_search($user_loc, $locs);
                if ($as !== false && $as !== null || !$res_abt->localisations) {
                    $t_type_abt[] = $res_abt;
                }
            }
            if (count($t_type_abt)) {
                $list_type_abt = "<div class='row'>\n<label for='type_abt'>" . $msg["finance_type_abt"] . "</label></div>\n<div class='row'>\n<select name='type_abt' id='type_abt'>\n";
                for ($i = 0; $i < count($t_type_abt); $i++) {
                    $list_type_abt .= "<option value='" . $t_type_abt[$i]->id_type_abt . "'>" . htmlentities($t_type_abt[$i]->type_abt_libelle, ENT_QUOTES, $charset) . "</option>\n";
                }
                $list_type_abt .= "</select></div>";
            }
        }
        $empr_form = str_replace("!!typ_abonnement!!", $list_type_abt, $empr_form);
    }
    $empr_form = str_replace("!!nom!!", htmlentities($empr->empr_nom, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!prenom!!", htmlentities($empr->empr_prenom, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!adr1!!", htmlentities($empr->empr_adr1, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!adr2!!", htmlentities($empr->empr_adr2, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!cp!!", htmlentities($empr->empr_cp, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!ville!!", htmlentities($empr->empr_ville, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!pays!!", htmlentities($empr->empr_pays, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!mail!!", htmlentities($empr->empr_mail, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!tel1!!", htmlentities($empr->empr_tel1, ENT_QUOTES, $charset), $empr_form);
    if (!$empr->empr_sms) {
        $empr_sms_chk = '';
    } else {
        $empr_sms_chk = "checked='checked'";
    }
    $empr_form = str_replace('!!sms!!', $empr_sms_chk, $empr_form);
    $empr_form = str_replace("!!tel2!!", htmlentities($empr->empr_tel2, ENT_QUOTES, $charset), $empr_form);
    $empr_form = str_replace("!!prof!!", htmlentities($empr->empr_prof, ENT_QUOTES, $charset), $empr_form);
    if ($empr->empr_year != 0) {
        $empr_form = str_replace("!!year!!", htmlentities($empr->empr_year, ENT_QUOTES, $charset), $empr_form);
    } else {
        $empr_form = str_replace("!!year!!", "", $empr_form);
    }
    if (!$empr->empr_lang) {
        $empr->empr_lang = $lang;
    }
    $empr_form = str_replace('!!combo_empr_lang!!', make_empr_lang_combo($empr->empr_lang), $empr_form);
    if (!$duplicate_empr_from_id) {
        $empr_form = str_replace('!!empr_login!!', $empr->empr_login, $empr_form);
        $empr_form = str_replace("!!empr_msg!!", htmlentities($empr->empr_msg, ENT_QUOTES, $charset), $empr_form);
    } else {
        $empr_form = str_replace('!!empr_login!!', "", $empr_form);
        $empr_form = str_replace("!!empr_msg!!", "", $empr_form);
    }
    // on récupère le select catégorie
    $requete = "SELECT id_categ_empr, libelle, duree_adhesion FROM empr_categ ORDER BY libelle ";
    $res = mysql_query($requete, $link);
    $nbr_lignes = mysql_num_rows($res);
    $categ_content = '';
    $empr_grille_categ = "<select id='empr_grille_categ' style='display:none;'><option value='0' selected='selected' >" . $msg['all_categories_empr'] . "</value>";
    for ($i = 0; $i < $nbr_lignes; $i++) {
        $row = mysql_fetch_row($res);
        $categ_content .= "<option value='{$row['0']}'";
        if ($row[0] == $empr->empr_categ) {
            $categ_content .= " selected='selected'";
        }
        $categ_content .= ">{$row['1']}</option>";
        $empr_grille_categ .= "<option value='{$row['0']}'>{$row['1']}</option>";
    }
    $empr_grille_categ .= '</select>';
    $empr_form = str_replace("!!categ!!", $categ_content, $empr_form);
    // Ajout des categories et localisations pour edition des grilles
    $empr_form = str_replace("<!-- empr_grille_categ -->", $empr_grille_categ, $empr_form);
    if ($pmb_lecteurs_localises) {
        $empr_grille_location = docs_location::get_html_select(array(0), array('id' => 0, 'msg' => $msg['all_locations_empr']), array('id' => 'empr_grille_location', 'class' => 'saisie-20em', 'style' => 'display:none;'));
    } else {
        $empr_grille_location = "<input type='hidden' id='empr_grille_location' value='0' />";
    }
    $empr_form = str_replace("<!-- empr_grille_location -->", $empr_grille_location, $empr_form);
    $requete = "SELECT id_categ_empr, libelle, duree_adhesion FROM empr_categ ORDER BY libelle ";
    $res = mysql_query($requete, $link);
    $grille_categ = "<option value='0' selected='selected'>" . $msg['all_categories_empr'] . "</value>";
    for ($i = 0; $i < $nbr_lignes; $i++) {
        $row = mysql_fetch_row($res);
        $categ_content .= "<option value='{$row['0']}'";
        if ($row[0] == $empr->empr_categ) {
            $categ_content .= " selected='selected'";
        }
        $categ_content .= ">{$row['1']}</option>";
        $grille_categ .= "<option value='{$row['0']}'>{$row['1']}</option>";
    }
    $empr_form = str_replace("!!categ!!", $categ_content, $empr_form);
    // on récupère le select statut
    $requete = "SELECT idstatut, statut_libelle FROM empr_statut ORDER BY statut_libelle ";
    //Si il n'y a pas de statut on prend celui définit pour l'utilisateur
    if (!$empr->empr_statut) {
        global $deflt_empr_statut;
        $empr->empr_statut = $deflt_empr_statut;
    }
    $res = mysql_query($requete, $link);
    $nbr_lignes = mysql_num_rows($res);
    for ($i = 0; $i < $nbr_lignes; $i++) {
        $row = mysql_fetch_row($res);
        $statut_content .= "<option value='{$row['0']}'";
        if ($row[0] == $empr->empr_statut) {
            $statut_content .= " selected='selected'";
        }
        $statut_content .= ">{$row['1']}</option>";
    }
    $empr_form = str_replace("!!statut!!", $statut_content, $empr_form);
    // et le select code stat
    // on récupère le select cod stat
    $requete = "SELECT idcode, libelle FROM empr_codestat ORDER BY libelle ";
    $res = mysql_query($requete, $link);
    $nbr_lignes = mysql_num_rows($res);
    for ($i = 0; $i < $nbr_lignes; $i++) {
        $row = mysql_fetch_row($res);
        $cstat_content .= "<option value='{$row['0']}'";
        if ($row[0] == $empr->empr_codestat) {
            $cstat_content .= " selected='selected'";
        }
        $cstat_content .= ">{$row['1']}</option>";
    }
    // mise à jour du sexe
    switch ($empr->empr_sexe) {
        case 1:
            $empr_form = str_replace("sexe_select_1", 'selected', $empr_form);
            break;
        case 2:
            $empr_form = str_replace("sexe_select_2", 'selected', $empr_form);
            break;
        default:
            $empr_form = str_replace("sexe_select_0", 'selected', $empr_form);
            break;
    }
    $empr_form = preg_replace("/sexe_select_[0-2]/m", '', $empr_form);
    $empr_form = str_replace("!!cstat!!", $cstat_content, $empr_form);
    // mise à jour du groupe
    if ($id) {
        $requete = "SELECT id_groupe, libelle_groupe, ifnull(empr_id,0) as inscription FROM groupe left join empr_groupe on (id_groupe=groupe_id  and empr_id=" . $id . ")  ORDER BY libelle_groupe";
    } else {
        $requete = "SELECT id_groupe, libelle_groupe, 0 as inscription FROM groupe ORDER BY libelle_groupe";
    }
    $groupe_form_aff = gen_liste_multiple($requete, "id_groupe", "libelle_groupe", "inscription", "id_grp[]", "", $id, 0, $msg[empr_form_aucungroupe], 0, $msg[empr_form_nogroupe], 5);
    $empr_form = str_replace("!!groupe_ajout!!", $groupe_form_aff, $empr_form);
    $empr_form = str_replace('!!cancel!!', $form_cancel, $empr_form);
    // ldap MaxMan
    if ($empr->empr_ldap) {
        $form_ldap = "checked";
    } else {
        $form_ldap = "";
    }
    //$empr_form = str_replace('!!empr_password!!', $empr_password, $empr_form);
    $empr_form = str_replace("!!ldap!!", $form_ldap, $empr_form);
    $empr_form = str_replace('!!empr_password!!', '', $empr_form);
    if (!$empr->empr_location) {
        $empr->empr_location = $deflt2docs_location;
    }
    if ($pmb_lecteurs_localises) {
        $loc = "\n\t\t<div class='row' id='g2_r1' etirable='yes' recept='yes' recepttype='circrow' highlight='circrow_highlight' downlight='circrow_downlight' >\n\t\t\t<div class='colonne4' id='g2_r1_f0' movable='yes' draggable='yes' dragtype='circcell' recept='yes' recepttype='circcell' highlight='circcell_highlight' downlight='circcell_downlight' title='" . htmlentities($msg['empr_location'], ENT_QUOTES, $charset) . "'>\n\t\t\t\t<div class='row'>\n\t\t\t\t\t<label for='form_empr_location' class='etiquette'>" . $msg['empr_location'] . "</label>\n\t\t\t\t\t</div>\n\t\t\t\t<div class='row'>\n\t\t\t\t\t!!localisation!!\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t<div class='row'></div>\n\t\t</div>";
        //$loc = str_replace('!!localisation!!', docs_location::gen_combo_box_empr($empr->empr_location, 0), $loc);
        $loc = str_replace('!!localisation!!', docs_location::get_html_select(array($empr->empr_location), array(), array('id' => 'empr_location_id', 'name' => 'empr_location_id')), $loc);
    } else {
        $loc = "<input type='hidden' name='empr_location_id' id='empr_location_id' value='" . $empr->empr_location . "'>";
        $empr_form = str_replace('<!-- !!localisation!! -->', $loc, $empr_form);
    }
    $empr_form = str_replace('<!-- !!localisation!! -->', $loc, $empr_form);
    if ($pmb_opac_view_activate) {
        $opac_view_tpl = "\n\t\t\t<div class='row' id='g4_r1_f0' movable='yes' draggable='yes' dragtype='circcell' recept='yes' recepttype='circcell' highlight='circcell_highlight' downlight='circcell_downlight' title='" . htmlentities($msg['empr_form_opac_view'], ENT_QUOTES, $charset) . "'>\t\t\t\t\n\t\t\t\t\t!!opac_view!!\n\t\t\t</div>";
        $opac_view = new opac_view(0, $id);
        $opac_view_tpl = str_replace("!!opac_view!!", gen_plus("opac_view", $msg["empr_form_opac_view"], $opac_view->do_sel_list(), 0), $opac_view_tpl);
    }
    $empr_form = str_replace('<!-- !!opac_view!! -->', $opac_view_tpl, $empr_form);
    //Champs persos
    $p_perso = new parametres_perso("empr");
    $perso_ = $p_perso->show_editable_fields($id);
    if (count($perso_["FIELDS"])) {
        $perso = "<div class='row'></div>";
    } else {
        $perso = "";
    }
    $class = "colonne2";
    for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
        $p = $perso_["FIELDS"][$i];
        $perso .= "<div class='{$class}' id='g6_r0_f" . $i . "' movable='yes' draggable='yes' dragtype='circcell' recept='yes' recepttype='circcell' highlight='circcell_highlight' downlight='circcell_downlight' title='" . htmlentities($p['TITRE'], ENT_QUOTES, $charset) . "' >";
        $perso .= "<div class='row'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . "</label></div>\n";
        $perso .= "<div class='row'>";
        $perso .= $p["AFF"] . "</div>";
        $perso .= "</div>";
        if ($class == "colonne2") {
            $class = "colonne_suite";
        } else {
            $class = "colonne2";
        }
    }
    if ($class == "colonne_suite") {
        $perso .= "<div class='{$class}'>&nbsp;</div>";
    }
    $perso .= $perso_["CHECK_SCRIPTS"];
    $empr_form = str_replace("!!champs_perso!!", $perso, $empr_form);
    $empr_form = str_replace('!!empr_notice_override!!', get_rights_form($id), $empr_form);
    print pmb_bidi($empr_form);
}
Example #19
0
 function show_consult_form($last_modified = 0)
 {
     global $idetat, $iduser, $idempr, $user_input;
     global $date_debut, $date_fin, $id_type, $id_theme, $dmde_loc;
     global $form_consult_dmde, $charset, $msg, $dbh, $demandes_init_workflow, $form_consult_linked_record;
     global $pmb_type_audit, $opac_demandes_no_action, $opac_demandes_allow_from_record;
     $form_consult_dmde = str_replace('!!form_title!!', htmlentities($this->titre_demande, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!sujet_dmde!!', htmlentities($this->sujet_demande, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!etat_dmde!!', htmlentities($this->workflow->getStateCommentById($this->etat_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_dmde!!', htmlentities(formatdate($this->date_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_butoir_dmde!!', htmlentities(formatdate($this->deadline_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_prevue_dmde!!', htmlentities(formatdate($this->date_prevue), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!progression_dmde!!', htmlentities($this->progression . '%', ENT_QUOTES, $charset), $form_consult_dmde);
     for ($i = 0; $i < sizeof($this->users); $i++) {
         if ($i == sizeof($this->users) - 1) {
             $users .= htmlentities($this->users[$i]['nom'], ENT_QUOTES, $charset);
         } else {
             $users .= htmlentities($this->users[$i]['nom'], ENT_QUOTES, $charset) . " / ";
         }
     }
     $carac_empr = $this->getCaracEmpr($this->num_demandeur);
     $nom = $carac_empr['nom'];
     $cb = $carac_empr['empr_cb'];
     $nom_emprunteur = "";
     if (SESSrights & CIRCULATION_AUTH) {
         $nom_emprunteur = "<a href=\"circ.php?categ=pret&form_cb={$cb}\" >" . htmlentities($nom, ENT_QUOTES, $charset) . "</a>";
     }
     $form_consult_dmde = str_replace('!!demandeur!!', $nom_emprunteur ? $nom_emprunteur : $nom, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!attribution!!', $users, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!iddemande!!', $this->id_demande, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!theme_dmde!!', htmlentities($this->theme_libelle, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!type_dmde!!', htmlentities($this->type_libelle, ENT_QUOTES, $charset), $form_consult_dmde);
     if ($opac_demandes_allow_from_record && $this->num_linked_notice) {
         $record_datas = record_display::get_record_datas($this->num_linked_notice);
         $form_consult_dmde = str_replace('!!form_linked_record!!', $form_consult_linked_record, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record!!', htmlentities($record_datas->get_tit1(), ENT_QUOTES, $charset), $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record_id!!', htmlentities($this->num_linked_notice, ENT_QUOTES, $charset), $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record_link!!', htmlentities($record_datas->get_permalink(), ENT_QUOTES, $charset), $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!form_linked_record!!', "", $form_consult_dmde);
     }
     //Champs personalisés
     $perso_aff = "";
     $p_perso = new parametres_perso("demandes");
     if (!$p_perso->no_special_fields) {
         $perso_ = $p_perso->show_fields($this->id_demande);
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             if ($p["AFF"] && $p["OPAC_SHOW"]) {
                 $perso_aff .= "<br />" . $p["TITRE"] . " " . nl2br($p["AFF"]);
             }
         }
     }
     if ($perso_aff) {
         $form_consult_dmde = str_replace("!!champs_perso!!", $perso_aff, $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace("!!champs_perso!!", "", $form_consult_dmde);
     }
     if (self::is_notice_visible($this)) {
         $link_noti = "<a href='" . $opac_url_base . "index.php?lvl=notice_display&id=" . $this->num_notice . "' alt='" . $msg['demandes_see_notice'] . "' title='" . $msg['demandes_see_notice'] . "'><img src='{$base_path}/images/mois.gif' /></a>";
     } else {
         $link_noti = "";
     }
     $form_consult_dmde = str_replace('!!icone!!', $link_noti, $form_consult_dmde);
     //construction de l'url de retour
     $params_retour = '';
     if ($idetat) {
         $params_retour .= "&idetat=" . $idetat;
     }
     // 		if($iduser){
     // 			$params_retour.="&iduser="******"&idempr=".$idempr;
     // 		}
     if ($user_input) {
         $params_retour .= "&user_input=" . $user_input;
     }
     if ($date_debut) {
         $params_retour .= "&date_debut=" . $date_debut;
     }
     if ($date_fin) {
         $params_retour .= "&date_fin=" . $date_fin;
     }
     if ($id_type) {
         $params_retour .= "&id_type=" . $id_type;
     }
     if ($id_theme) {
         $params_retour .= "&id_theme=" . $id_theme;
     }
     if ($dmde_loc) {
         $params_retour .= "&dmde_loc=" . $dmde_loc;
     }
     if ($params_retour) {
         $form_consult_dmde = str_replace('!!params_retour!!', htmlentities(stripslashes($params_retour), ENT_QUOTES, $charset), $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!params_retour!!', "", $form_consult_dmde);
     }
     if (sizeof($this->users) && $demandes_init_workflow !== "2" && !$opac_demandes_no_action) {
         $listActionButton = '&nbsp;' . $msg['demandes_action_type_add'] . '&nbsp;';
         if (sizeof($this->allowed_actions)) {
             foreach ($this->allowed_actions as $key => $actionType) {
                 if ($actionType['active'] == 1) {
                     $listActionButton .= "<input type='button' class='bouton' value='" . htmlentities($actionType['comment'], ENT_QUOTES, $charset) . "' onClick=\"document.location='./empr.php?tab=request&lvl=list_dmde&sub=add_action&type_action=" . $actionType['id'] . "&iddemande={$this->id_demande}'\" />";
                 }
             }
         }
         if ($listActionButton) {
             $form_consult_dmde = str_replace('!!add_actions_list!!', $listActionButton, $form_consult_dmde);
         } else {
             $form_consult_dmde = str_replace('!!add_actions_list!!', "", $form_consult_dmde);
         }
     } else {
         $form_consult_dmde = str_replace('!!add_actions_list!!', "", $form_consult_dmde);
     }
     $modify_button = "";
     foreach ($this->workflow->object_states_by_id as $key => $value) {
         //id d'etat de demande par défaut
         if ($this->workflow->object_workflow['STARTSTATE'][0]['value'] == $value && $key == $this->etat_demande) {
             $modify_button = "<input type='button' class='bouton' value='" . $msg['demandes_modify'] . "' onClick=\"document.location='./empr.php?tab=request&lvl=list_dmde&sub=add_demande&iddemande={$this->id_demande}'\" />";
         }
     }
     $form_consult_dmde = str_replace('!!demande_modify!!', $modify_button, $form_consult_dmde);
     if (sizeof($this->users) && $demandes_init_workflow !== "2") {
         //Liste des actions
         $this->fetch_data($this->id_demande, false);
         if ($this->etat_demande == 4 || $this->etat_demande == 5) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande);
         } elseif ($last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $last_modified);
         } elseif ($this->last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $this->last_modified->id_action);
         } else {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande);
         }
     }
     if ($this->etat_demande == 1 && !sizeof($this->actions) && $this->dmde_read_opac == 1) {
         demandes::demande_read($this->id_demande, true, "_opac");
         $this->fetch_data($this->id_demande, false);
     }
     print $form_consult_dmde;
 }
Example #20
0
function renseigne_cp_agro($val, $notice_id, $type = "notices")
{
    $nom = $val["n"];
    $valeur = $val["a"];
    if (!trim($nom) || !trim($valeur) || !$notice_id) {
        return false;
    }
    //on va chercher les informations sur le champs
    $rqt = "SELECT idchamp, type, datatype FROM " . $type . "_custom WHERE name='" . addslashes(trim($nom)) . "'";
    $res = mysql_query($rqt);
    if (!mysql_num_rows($res)) {
        return false;
    }
    $cp = mysql_fetch_object($res);
    if ($cp->type != $val["t"]) {
        return false;
    }
    //On enregistre la valeur au bon endroit
    switch ($cp->type) {
        case "list":
            //On est sur une liste
            switch ($cp->datatype) {
                case "integer":
                    $requete = "select " . $type . "_custom_list_value from " . $type . "_custom_lists where " . $type . "_custom_list_lib='" . addslashes(trim($valeur)) . "' and " . $type . "_custom_champ='" . $cp->idchamp . "' ";
                    $resultat = mysql_query($requete);
                    if (mysql_num_rows($resultat)) {
                        $value2 = mysql_result($resultat, 0, 0);
                    } else {
                        $requete = "select max(" . $type . "_custom_list_value*1) from " . $type . "_custom_lists where " . $type . "_custom_champ='" . $cp->idchamp . "' ";
                        $resultat = mysql_query($requete);
                        $max = @mysql_result($resultat, 0, 0);
                        $n = $max + 1;
                        $requete = "insert into " . $type . "_custom_lists (" . $type . "_custom_champ," . $type . "_custom_list_value," . $type . "_custom_list_lib) values('" . $cp->idchamp . "',{$n},'" . addslashes(trim($valeur)) . "')";
                        if (!mysql_query($requete)) {
                            return false;
                        }
                        $value2 = $n;
                    }
                    $requete = "insert into " . $type . "_custom_values (" . $type . "_custom_champ," . $type . "_custom_origine," . $type . "_custom_integer) values('" . $cp->idchamp . "','" . $notice_id . "','" . $value2 . "')";
                    if (!mysql_query($requete)) {
                        return false;
                    }
                    break;
                default:
                    $requete = "select " . $type . "_custom_list_value from " . $type . "_custom_lists where " . $type . "_custom_list_lib='" . addslashes(trim($valeur)) . "' and " . $type . "_custom_champ='" . $cp->idchamp . "' ";
                    $resultat = mysql_query($requete);
                    if (mysql_num_rows($resultat)) {
                        $value2 = mysql_result($resultat, 0, 0);
                    } else {
                        $requete = "select " . $type . "_custom_list_value from " . $type . "_custom_lists where " . $type . "_custom_list_value='" . addslashes(trim($valeur)) . "' and " . $type . "_custom_champ='" . $cp->idchamp . "' ";
                        $resultat = mysql_query($requete);
                        if (mysql_num_rows($resultat)) {
                            $value2 = mysql_result($resultat, 0, 0);
                        } else {
                            $requete = "insert into " . $type . "_custom_lists (" . $type . "_custom_champ," . $type . "_custom_list_value," . $type . "_custom_list_lib) values('" . $cp->idchamp . "','" . addslashes(trim($valeur)) . "','" . addslashes($valeur) . "')";
                            if (!mysql_query($requete)) {
                                return false;
                            }
                            $value2 = trim($valeur);
                        }
                    }
                    $requete = "insert into " . $type . "_custom_values (" . $type . "_custom_champ," . $type . "_custom_origine," . $type . "_custom_" . $cp->datatype . ") values('" . $cp->idchamp . "','" . $notice_id . "','" . $value2 . "')";
                    if (!mysql_query($requete)) {
                        return false;
                    }
                    break;
            }
            break;
        case "url":
            $requete = "insert into " . $type . "_custom_values (" . $type . "_custom_champ," . $type . "_custom_origine," . $type . "_custom_" . $cp->datatype . ") values('" . $cp->idchamp . "','" . $notice_id . "','" . addslashes(trim($val["c"])) . "')";
            if (!mysql_query($requete)) {
                return false;
            }
            break;
        case "resolve":
            $mes_pp = new parametres_perso($type);
            if ($mes_pp->get_formatted_output(array($val["c"]), $cp->idchamp) == $val["b"]) {
                $requete = "insert into " . $type . "_custom_values (" . $type . "_custom_champ," . $type . "_custom_origine," . $type . "_custom_" . $cp->datatype . ") values('" . $cp->idchamp . "','" . $notice_id . "','" . addslashes($val["c"]) . "')";
                if (!mysql_query($requete)) {
                    return false;
                }
            } else {
                return false;
            }
            break;
        case "query_list":
        case "query_auth":
            $mes_pp = new parametres_perso($type);
            if ($mes_pp->get_formatted_output(array($val["c"]), $cp->idchamp) == $valeur) {
                $requete = "insert into " . $type . "_custom_values (" . $type . "_custom_champ," . $type . "_custom_origine," . $type . "_custom_" . $cp->datatype . ") values('" . $cp->idchamp . "','" . $notice_id . "','" . addslashes($val["c"]) . "')";
                if (!mysql_query($requete)) {
                    return false;
                }
            } else {
                return false;
            }
            break;
        default:
            switch ($cp->datatype) {
                case "small_text":
                    $requete = "insert into " . $type . "_custom_values (" . $type . "_custom_champ," . $type . "_custom_origine," . $type . "_custom_small_text) values('" . $cp->idchamp . "','" . $notice_id . "','" . addslashes(trim($valeur)) . "')";
                    if (!mysql_query($requete)) {
                        return false;
                    }
                    break;
                case "int":
                case "integer":
                    $requete = "insert into " . $type . "_custom_values (" . $type . "_custom_champ," . $type . "_custom_origine," . $type . "_custom_integer) values('" . $cp->idchamp . "','" . $notice_id . "','" . addslashes(trim($valeur)) . "')";
                    if (!mysql_query($requete)) {
                        return false;
                    }
                    break;
                case "text":
                    $requete = "insert into " . $type . "_custom_values (" . $type . "_custom_champ," . $type . "_custom_origine," . $type . "_custom_text) values('" . $cp->idchamp . "','" . $notice_id . "','" . addslashes(trim($valeur)) . "')";
                    if (!mysql_query($requete)) {
                        return false;
                    }
                    break;
                case "date":
                    $requete = "insert into " . $type . "_custom_values (" . $type . "_custom_champ," . $type . "_custom_origine," . $type . "_custom_date) values('" . $cp->idchamp . "','" . $notice_id . "','" . addslashes(decoupe_date(trim($valeur))) . "')";
                    if (!mysql_query($requete)) {
                        return false;
                    }
                    break;
            }
            break;
    }
    return true;
}
Example #21
0
 function fetch_collstate()
 {
     if ($this->niveau_biblio == 's' && $this->niveau_hierar == 1) {
         global $dbh;
         global $opac_sur_location_activate;
         //Traitement des exemplaires
         $this->memo_collstate = array();
         $q = "select collstate_id, id_serial, state_collections, collstate_origine, collstate_cote, collstate_archive, collstate_lacune, collstate_note, ";
         $q .= "idlocation, location_libelle, ";
         $q .= "archempla_id, archempla_libelle, ";
         $q .= "archtype_id, archtype_libelle, ";
         $q .= "archstatut_id, archstatut_opac_libelle ";
         if ($opac_sur_location_activate) {
             $q .= ", ifnull(surloc_id,0) as surloc_id, ifnull(surloc_libelle,'') as surloc_libelle ";
         }
         $q .= "from collections_state ";
         $q .= "join docs_location on location_id=idlocation ";
         if ($opac_sur_location_activate) {
             $q .= "left join sur_location on surloc_num=surloc_id ";
         }
         $q .= "join arch_emplacement on collstate_emplacement=archempla_id ";
         $q .= "join arch_type on collstate_type=archtype_id ";
         $q .= "join arch_statut on collstate_statut=archstatut_id ";
         $q .= "where id_serial = '" . $this->notice_id . "' ";
         //pour l'opac
         //$q.= "and ((archstatut_visible_opac=1 and archstatut_visible_opac_abon=0)".($_SESSION["user_code"]?" or (archstatut_visible_opac_abon=1 and archstatut_visible_opac=1)":"").")";
         $r = pmb_mysql_query($q, $dbh);
         if ($r) {
             while ($cs = pmb_mysql_fetch_object($r)) {
                 //Champs perso d'etats de collection
                 $parametres_perso = array();
                 $pp = new parametres_perso("collstate");
                 if (!$pp->no_special_fields) {
                     $pp->get_values($cs->expl_id);
                     $values = $pp->values;
                     foreach ($values as $field_id => $vals) {
                         foreach ($vals as $value) {
                             $parametres_perso[$pp->t_fields[$field_id]["NAME"]]["TITRE"] = $pp->t_fields[$field_id]["TITRE"];
                             $parametres_perso[$pp->t_fields[$field_id]["NAME"]]["VALUE"] = $pp->get_formatted_output(array($value), $field_id);
                         }
                     }
                 }
                 $cs->parametres_perso = $parametres_perso;
                 $this->memo_collstate[] = $cs;
             }
         }
     }
 }
Example #22
0
 static function del_expl($id = 0)
 {
     global $dbh;
     global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises;
     $sql_pret = pmb_mysql_query("select 1 from pret where pret_idexpl ='{$id}' ");
     if (pmb_mysql_num_rows($sql_pret)) {
         return 0;
     }
     // visibilite de l'exemplaire
     if ($pmb_droits_explr_localises) {
         $query = "select expl_location from exemplaires where expl_id='" . $id . "'";
         $result = pmb_mysql_query($query, $dbh);
         $location_id = pmb_mysql_result($result, 0, 0);
         $tab_mod = explode(",", $explr_visible_mod);
         $as_modif = array_search($location_id, $tab_mod);
         if ($as_modif === false) {
             return 0;
         }
     }
     $requete = "select idcaddie FROM caddie where type='EXPL' ";
     $result = pmb_mysql_query($requete, $dbh);
     for ($i = 0; $i < pmb_mysql_num_rows($result); $i++) {
         $temp = pmb_mysql_fetch_object($result);
         $requete_suppr = "delete from caddie_content where caddie_id='" . $temp->idcaddie . "' and object_id='" . $id . "' ";
         $result_suppr = pmb_mysql_query($requete_suppr, $dbh);
     }
     audit::delete_audit(AUDIT_EXPL, $id);
     $p_perso = new parametres_perso("expl");
     $p_perso->delete_values($id);
     // nettoyage transfert
     $requete_suppr = "delete from transferts_demande where num_expl='{$id}'";
     $result_suppr = pmb_mysql_query($requete_suppr);
     // nettoyage circulation des périodiques
     serialcirc::delete_expl($id);
     // nettoyage doc. à ranger
     $requete_suppr = "delete from resa_ranger where resa_cb in (select expl_cb from exemplaires where expl_id='" . $id . "') ";
     $result_suppr = pmb_mysql_query($requete_suppr, $dbh);
     // nettoyage indexation concepts
     $index_concept = new index_concept($id, TYPE_EXPL);
     $index_concept->delete();
     $sql_del = pmb_mysql_query("delete from exemplaires where expl_id='{$id}' ");
     return 1;
 }
Example #23
0
function get_expl($expl, $show_in_reception = 0, $return_count = false)
{
    global $msg, $dbh, $charset;
    global $base_path, $class_path;
    global $cart_link_non;
    global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises;
    global $pmb_transferts_actif;
    global $pmb_expl_list_display_comments;
    global $pmb_sur_location_activate;
    global $pmb_expl_data;
    // attention, $bul est un array
    if (!sizeof($expl) || !is_array($expl)) {
        return $msg["bull_no_expl"];
    }
    $explr_tab_invis = explode(",", $explr_invisible);
    $explr_tab_unmod = explode(",", $explr_visible_unmod);
    $explr_tab_modif = explode(",", $explr_visible_mod);
    //	$th_sur_location="";
    //	if($pmb_sur_location_activate)$th_sur_location="<th>".$msg["sur_location_expl"]."</th>";
    //
    //	$result  = "<table border=\"0\" cellspacing=\"1\">";
    //	$result .= "<tr><th>".$msg[293]."</th><th>".$msg[4016]."</th>$th_sur_location<th>".$msg[4017]."</th><th>".$msg[4018]."</th><th>".$msg[4019]."</th><th>".$msg[4015]."</th><th></th>";
    //	while(list($cle, $valeur) = each($expl)) {
    //		$requete = "SELECT pret_idempr, ";
    //		$requete .= " date_format(pret_retour, '".$msg["format_date"]."') as aff_pret_retour ";
    //		$requete .= " FROM pret ";
    //		$requete .= " WHERE pret_idexpl='$valeur->expl_id' ";
    //		$result_prets = pmb_mysql_query($requete, $dbh) or die ("<br />".pmb_mysql_error()."<br />".$requete);
    //		if (pmb_mysql_num_rows($result_prets)) $expl_pret = pmb_mysql_fetch_object($result_prets) ;
    //		else $expl_pret="";
    //		$situation = "";
    //		// prêtable ou pas s'il est prêté, on affiche son état
    //		if (is_object($expl_pret) && $expl_pret->pret_idempr) {
    //			// exemplaire sorti
    //			$rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='$expl_pret->pret_idempr' ";
    //			$res_empr = pmb_mysql_query($rqt_empr, $dbh) ;
    //			$res_empr_obj = pmb_mysql_fetch_object($res_empr) ;
    //			$situation = "<strong>${msg[358]} ".$expl_pret->aff_pret_retour."</strong>";
    //			global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
    //			if (!$show_in_reception && $empr_show_caddie && (SESSrights & CIRCULATION_AUTH)) {
    //				$img_ajout_empr_caddie="<img src='./images/basket_empr.gif' align='middle' alt='basket' title=\"${msg[400]}\" onClick=\"openPopUp('./cart.php?object_type=EMPR&item=".$expl->pret_idempr."', 'cart', 600, 700, -2, -2, '$selector_prop_ajout_caddie_empr')\">&nbsp;";
    //			} else {
    //				$img_ajout_empr_caddie="";
    //			}
    //			if (!$show_in_reception) {
    //				$situation .= "<br />$img_ajout_empr_caddie<a href='./circ.php?categ=pret&form_cb=".rawurlencode($res_empr_obj->empr_cb)."'>$res_empr_obj->empr_prenom $res_empr_obj->empr_nom</a>";
    //			} else {
    //				$situation .= "<br />$res_empr_obj->empr_prenom $res_empr_obj->empr_nom";
    //			}
    //		} else {
    //			// tester si réservé
    //			$result_resa = pmb_mysql_query("select 1 from resa where resa_cb='".addslashes($valeur->expl_cb)."' ", $dbh) or die ();
    //			$reserve = pmb_mysql_num_rows($result_resa);
    //			if ($reserve)
    //				$situation = "<strong>".$msg['expl_reserve']."</strong>"; // exemplaire réservé
    //			elseif ($valeur->pret_flag)
    //				$situation = "<strong>${msg[359]}</strong>"; // exemplaire disponible
    //			else
    //				$situation = "";
    //		}
    //
    //		if(!$show_in_reception && (SESSrights & CATALOGAGE_AUTH)){
    //			$selector_prop = "toolbar=no, dependent=yes, resizable=yes, scrollbars=yes";
    //			$cart_click_expl = "onClick=\"openPopUp('./cart.php?object_type=EXPL&item=!!item!!', 'cart', 600, 700, -2, -2, '$selector_prop')\"";
    //			$cart_link = "<img src='./images/basket_small_20x20.gif' align='center' alt='middle' title=\"${msg[400]}\" $cart_click_expl>";
    //			$ajout_expl_panier = str_replace('!!item!!', $valeur->expl_id, $cart_link) ;
    //		}else{
    //			$ajout_expl_panier ="";
    //		}
    //
    //		//si les transferts sont activés
    //		if (!$show_in_reception && $pmb_transferts_actif) {
    //			//si l'exemplaire n'est pas transferable on a une image vide
    //			$dispo_pour_transfert = transfert::est_transferable ( $valeur->expl_id );
    //			if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert)
    //				//l'icon de demande de transfert
    //				$ajout_expl_panier .= "<a href=\"#\" onClick=\"openPopUp('./catalog/transferts/transferts_popup.php?expl=" . $valeur->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\">" . "<img src='./images/peb_in.png' align='center' border=0 alt=\"" . $msg ["transferts_alt_libelle_icon"] . "\" title=\"" . $msg ["transferts_alt_libelle_icon"] . "\"></a>";
    //			else
    //				$ajout_expl_panier .= "<img src='./images/spacer.gif' align='center' height=20 width=20>";
    //
    //		}
    //
    //		$as_invis = false;
    //		$as_unmod = false;
    //		$as_modif = true;
    //		global $flag_no_delete_bulletin;
    //		$flag_no_delete_bulletin=0;
    //		//visibilité des exemplaires
    //		if ($pmb_droits_explr_localises) {
    //			$as_invis = in_array($valeur->expl_location,$explr_tab_invis);
    //			$as_unmod = in_array($valeur->expl_location,$explr_tab_unmod);
    //			//$as_modif = in_array($valeur->expl_location,$explr_tab_modif);
    //
    //			if(!($as_modif=in_array  ($valeur->expl_location,$explr_tab_modif) )) $flag_no_delete_bulletin=1;
    //
    //		}
    //		if ($show_in_reception || $cart_link_non || !(SESSrights & CATALOGAGE_AUTH))
    //			$link =  htmlentities($valeur->expl_cb,ENT_QUOTES, $charset);
    //		else {
    //			if ($as_modif) {
    //				$link = "<a href=\"./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=".$valeur->expl_bulletin."&expl_id=".$valeur->expl_id."\">".htmlentities($valeur->expl_cb,ENT_QUOTES, $charset)."</a>";
    //			} else {
    //				$link = htmlentities($valeur->expl_cb,ENT_QUOTES, $charset);
    //			}
    //		}
    //
    //		if ($situation) $situation="<br />".$situation;
    //		if(!$show_in_reception && SESSrights & CATALOGAGE_AUTH){
    //			$ajout_expl_panier.="<span id='EXPL_drag_".$valeur->expl_id."'  dragicon=\"$base_path/images/icone_drag_notice.png\" dragtext=\"".htmlentities($valeur->expl_cb,ENT_QUOTES, $charset)."\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"".$base_path."/images/notice_drag.png\"/></span>";
    //		}
    //
    //		$line = "<tr>";
    //		if (($valeur->expl_note || $valeur->expl_comment) && $pmb_expl_list_display_comments) $line .= "<td rowspan='2'>$link</td>";
    //		else $line .= "<td>$link</td>";
    //		$line .= "<td>$valeur->expl_cote</td>";
    //		if($pmb_sur_location_activate) $line .= "<td>$valeur->sur_loc_libelle</td>";
    //		$line .= "<td>$valeur->location_libelle</td>";
    //		$line .= "<td>$valeur->section_libelle</td>";
    //		$line .= "<td>$valeur->statut_libelle.$situation</td>";
    //		$line .= "<td>$valeur->tdoc_libelle</td>";
    //		$line .= "<td>$ajout_expl_panier</td>";
    //		if (($valeur->expl_note || $valeur->expl_comment) && $pmb_expl_list_display_comments) {
    //			$notcom=array();
    //			$line .= "<tr><td colspan='6'>";
    //			if ($valeur->expl_note && ($pmb_expl_list_display_comments & 1)) $notcom[] .= "<span class='erreur'>$valeur->expl_note</span>";
    //			if ($valeur->expl_comment && ($pmb_expl_list_display_comments & 2)) $notcom[] .= "$valeur->expl_comment";
    //			$line .= implode("<br />",$notcom);
    //			$line .= "</tr>";
    //		}
    //		$result .= $line;
    //	} //while(list($cle, $valeur) = each($expl))
    //
    //	$result .= "</table>";
    //
    //maintenant
    //Liste des champs d'exemplaires
    if ($pmb_sur_location_activate) {
        $surloc_field = "surloc_libelle,";
    }
    if (!$pmb_expl_data) {
        $pmb_expl_data = "expl_cb,expl_cote," . $surloc_field . "location_libelle,section_libelle,statut_libelle,tdoc_libelle";
    }
    $colonnesarray = explode(",", $pmb_expl_data);
    if (!in_array("expl_cb", $colonnesarray)) {
        array_unshift($colonnesarray, "expl_cb");
    }
    $total_columns = count($colonnesarray);
    //Présence de champs personnalisés
    if (strstr($pmb_expl_data, "#")) {
        require_once $class_path . "/parametres_perso.class.php";
        $cp = new parametres_perso("expl");
    }
    if ($return_count) {
        return count($expl);
    }
    if (count($expl)) {
        $result .= "<table border=\"0\" cellspacing=\"1\">";
        //un premier tour pour aller chercher les libellés...
        for ($i = 0; $i < count($colonnesarray); $i++) {
            if (substr($colonnesarray[$i], 0, 1) == "#") {
                //champs personnalisés
                if (!$cp->no_special_fields) {
                    $id = substr($colonnesarray[$i], 1);
                    $entry .= "<th>" . htmlentities($cp->t_fields[$id][TITRE], ENT_QUOTES, $charset) . "</th>";
                }
            } else {
                eval("\$colencours=\$msg['expl_header_" . $colonnesarray[$i] . "'];");
                $entry .= "<th>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</th>";
            }
        }
        $result .= "<tr>" . $entry . "<th>&nbsp;</th></tr>";
        foreach ($expl as $exemplaire) {
            $requete = "SELECT pret_idempr, ";
            $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour ";
            $requete .= " FROM pret ";
            $requete .= " WHERE pret_idexpl='{$exemplaire->expl_id}' ";
            $result_prets = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
            if (pmb_mysql_num_rows($result_prets)) {
                $expl_pret = pmb_mysql_fetch_object($result_prets);
            } else {
                $expl_pret = "";
            }
            $situation = "";
            // prêtable ou pas s'il est prêté, on affiche son état
            if (is_object($expl_pret) && $expl_pret->pret_idempr) {
                // exemplaire sorti
                $rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='{$expl_pret->pret_idempr}' ";
                $res_empr = pmb_mysql_query($rqt_empr, $dbh);
                $res_empr_obj = pmb_mysql_fetch_object($res_empr);
                $situation = "<strong>{$msg[358]} " . $expl_pret->aff_pret_retour . "</strong>";
                global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
                if (!$show_in_reception && $empr_show_caddie && SESSrights & CIRCULATION_AUTH) {
                    $img_ajout_empr_caddie = "<img src='./images/basket_empr.gif' align='middle' alt='basket' title=\"{$msg[400]}\" onClick=\"openPopUp('./cart.php?object_type=EMPR&item=" . $exemplaire->pret_idempr . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}')\">&nbsp;";
                } else {
                    $img_ajout_empr_caddie = "";
                }
                if (!$show_in_reception) {
                    $situation .= "<br />{$img_ajout_empr_caddie}<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($res_empr_obj->empr_cb) . "'>{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}</a>";
                } else {
                    $situation .= "<br />{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}";
                }
            } else {
                // tester si réservé
                $result_resa = pmb_mysql_query("select 1 from resa where resa_cb='" . addslashes($exemplaire->expl_cb) . "' ", $dbh) or die;
                $reserve = pmb_mysql_num_rows($result_resa);
                if ($reserve) {
                    $situation = "<strong>" . $msg['expl_reserve'] . "</strong>";
                    // exemplaire réservé
                } elseif ($exemplaire->pret_flag) {
                    $situation = "<strong>{$msg[359]}</strong>";
                    // exemplaire disponible
                } else {
                    $situation = "";
                }
            }
            if (!$show_in_reception && SESSrights & CATALOGAGE_AUTH) {
                $selector_prop = "toolbar=no, dependent=yes, resizable=yes, scrollbars=yes";
                $cart_click_expl = "onClick=\"openPopUp('./cart.php?object_type=EXPL&item=!!item!!', 'cart', 600, 700, -2, -2, '{$selector_prop}')\"";
                $cart_link = "<img src='./images/basket_small_20x20.gif' align='center' alt='middle' title=\"{$msg[400]}\" {$cart_click_expl}>";
                $ajout_expl_panier = str_replace('!!item!!', $exemplaire->expl_id, $cart_link);
            } else {
                $ajout_expl_panier = "";
            }
            //si les transferts sont activés
            if (!$show_in_reception && $pmb_transferts_actif) {
                //si l'exemplaire n'est pas transferable on a une image vide
                $dispo_pour_transfert = transfert::est_transferable($exemplaire->expl_id);
                if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert) {
                    //l'icon de demande de transfert
                    $ajout_expl_panier .= "<a href=\"#\" onClick=\"openPopUp('./catalog/transferts/transferts_popup.php?expl=" . $exemplaire->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\">" . "<img src='./images/peb_in.png' align='center' border=0 alt=\"" . $msg["transferts_alt_libelle_icon"] . "\" title=\"" . $msg["transferts_alt_libelle_icon"] . "\"></a>";
                } else {
                    $ajout_expl_panier .= "<img src='./images/spacer.gif' align='center' height=20 width=20>";
                }
            }
            $as_invis = false;
            $as_unmod = false;
            $as_modif = true;
            global $flag_no_delete_bulletin;
            $flag_no_delete_bulletin = 0;
            //visibilité des exemplaires
            if ($pmb_droits_explr_localises) {
                $as_invis = in_array($exemplaire->expl_location, $explr_tab_invis);
                $as_unmod = in_array($exemplaire->expl_location, $explr_tab_unmod);
                //$as_modif = in_array($exemplaire->expl_location,$explr_tab_modif);
                if (!($as_modif = in_array($exemplaire->expl_location, $explr_tab_modif))) {
                    $flag_no_delete_bulletin = 1;
                }
            }
            if ($show_in_reception || $cart_link_non || !(SESSrights & CATALOGAGE_AUTH)) {
                $link = htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset);
            } else {
                if ($as_modif) {
                    $link = "<a href=\"./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=" . $exemplaire->expl_bulletin . "&expl_id=" . $exemplaire->expl_id . "\">" . htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset) . "</a>";
                } else {
                    $link = htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset);
                }
            }
            if ($situation) {
                $situation = "<br />" . $situation;
            }
            if (!$show_in_reception && SESSrights & CATALOGAGE_AUTH) {
                $ajout_expl_panier .= "<span id='EXPL_drag_" . $exemplaire->expl_id . "'  dragicon=\"{$base_path}/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset) . "\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"" . $base_path . "/images/notice_drag.png\"/></span>";
            }
            global $pmb_serialcirc_subst;
            if ($pmb_serialcirc_subst) {
                $ajout_expl_panier .= "<img src='./images/print.gif' alt='Imprimer...' title='Imprimer...' align='middle' border='0'\tstyle='padding-left:7px' \t\t\t\n\t\t\t\t\tonclick=\"openPopUp('./ajax.php?module=circ&categ=periocirc&sub=print_cote&expl_id=" . $exemplaire->expl_id . "', 'circulation', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\"\n\t\t\t\t>";
            }
            $line = "<tr>";
            for ($i = 0; $i < count($colonnesarray); $i++) {
                if ($i == 0 && ($exemplaire->expl_note || $exemplaire->expl_comment) && $pmb_expl_list_display_comments) {
                    $expl_rowspan = "rowspan='2'";
                } else {
                    $expl_rowspan = "";
                }
                $aff_column = "";
                if (substr($colonnesarray[$i], 0, 1) == "#") {
                    //champs personnalisés
                    $id = substr($colonnesarray[$i], 1);
                    $cp->get_values($exemplaire->expl_id);
                    if (!$cp->no_special_fields) {
                        $temp = $cp->get_formatted_output($cp->values[$id], $id);
                        if (!$temp) {
                            $temp = "&nbsp;";
                        }
                        $aff_column .= $temp;
                    }
                } else {
                    eval("\$colencours=\$exemplaire->" . $colonnesarray[$i] . ";");
                    if ($colonnesarray[$i] == "expl_cb") {
                        $aff_column = $link;
                    } else {
                        if ($colonnesarray[$i] == "expl_cote") {
                            $aff_column = "<strong>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</strong>";
                        } else {
                            if ($colonnesarray[$i] == "surloc_libelle") {
                                $aff_column = htmlentities($exemplaire->sur_loc_libelle, ENT_QUOTES, $charset);
                            } else {
                                if ($colonnesarray[$i] == "statut_libelle") {
                                    $aff_column = htmlentities($colencours, ENT_QUOTES, $charset) . $situation;
                                } else {
                                    $aff_column = htmlentities($colencours, ENT_QUOTES, $charset);
                                }
                            }
                        }
                    }
                }
                $line .= "<td {$expl_rowspan}>" . $aff_column . "</td>";
            }
            $line .= "<td>{$ajout_expl_panier}</td>";
            $line .= "</tr>";
            if (($exemplaire->expl_note || $exemplaire->expl_comment) && $pmb_expl_list_display_comments) {
                $notcom = array();
                $line .= "<tr><td colspan='" . $total_columns . "'>";
                if ($exemplaire->expl_note && $pmb_expl_list_display_comments & 1) {
                    $notcom[] .= "<span class='erreur'>{$exemplaire->expl_note}</span>";
                }
                if ($exemplaire->expl_comment && $pmb_expl_list_display_comments & 2) {
                    $notcom[] .= "{$exemplaire->expl_comment}";
                }
                $line .= implode("<br />", $notcom);
                $line .= "</tr>";
            }
            $result .= $line;
        }
        $result .= "</table>";
    }
    return $result;
}
Example #24
0
 function update_empr($empr_cb = '', $empr_id = 0, $fields)
 {
     global $dbh, $lang;
     global $msg;
     global $charset;
     global $pmb_num_carte_auto, $deflt2docs_location, $pmb_gestion_abonnement, $pmb_gestion_financiere;
     object_to_array($fields);
     $empr_cb = $this->clean_field((string) $empr_cb);
     $empr_id += 0;
     if (!$empr_id && $empr_cb == '') {
         return $this->build_error("idempr et empr_cb vide.");
     }
     if ($empr_id) {
         $where = " id_empr = {$empr_id} ";
     } else {
         $where = " empr_cb = '" . addslashes($empr_cb) . "' ";
     }
     $sql = "SELECT id_empr, empr_cb FROM empr WHERE {$where}";
     $res = pmb_mysql_query($sql);
     if (!$res || !pmb_mysql_num_rows($res)) {
         return $this->build_error("Lecteur inconnu: 'empr_cb' = {$empr_cb} ou id_empr = {$empr_id} .");
     }
     $empr_res = pmb_mysql_fetch_object($res);
     $empr_id = $empr_res->id_empr;
     // clean des entrées
     $fields = $this->clean_fields($fields);
     /*
     		$fields['nom']=$this->clean_field($fields['nom']);
     		$fields['prenom']=$this->clean_field($fields['prenom']);
     		$fields['adr1']=$this->clean_field($fields['adr1']);
     		$fields['adr2']=$this->clean_field($fields['adr2']);
     		$fields['cp']=$this->clean_field($fields['cp']);
     		$fields['ville']=$this->clean_field($fields['ville']);
     		$fields['pays']=$this->clean_field($fields['pays']);
     		$fields['mail']=$this->clean_field($fields['mail']);
     		$fields['tel1']=$this->clean_field($fields['tel1']);
     		$fields['sms']=$this->clean_field($fields['sms'])+0;
     		$fields['tel2']=$this->clean_field($fields['tel2']);
     		$fields['prof']=$this->clean_field($fields['prof']);
     		$fields['birth']=$this->clean_field($fields['birth']);
     		$fields['sexe']=$this->clean_field($fields['sexe'])+0;
     		$fields['login']=$this->clean_field($fields['login']);
     		$fields['pwd']=$this->clean_field($fields['pwd']);
     		$fields['msg']=$this->clean_field($fields['msg']);
     		$fields['lang']=$this->clean_field($fields['lang']);
     		$fields['location']=$this->clean_field($fields['location']+0);
     		$fields['date_adhesion']=$this->clean_field($fields['date_adhesion']);
     		$fields['date_expiration']=$this->clean_field($fields['date_expiration']);
     		$fields['categ']=$this->clean_field($fields['categ'])+0;
     		$fields['statut']=$this->clean_field($fields['statut']+0);
     		$fields['lang']=$this->clean_field($fields['lang']);
     		$fields['cstat']=$this->clean_field($fields['cstat'])+0;
     		$fields['type_abt']=$this->clean_field($fields['type_abt']+0);
     		$fields['ldap']=$this->clean_field($fields['ldap'])+0;*/
     $fields['sexe'] += 0;
     $fields['location'] += 0;
     $fields['categ'] += 0;
     $fields['statut'] += 0;
     $fields['lang'] += 0;
     $fields['cstat'] += 0;
     $fields['type_abt'] += 0;
     $fields['ldap'] += 0;
     // vérification des champs obligatoires
     if (!$fields['nom']) {
         return $this->build_error("Le champ 'nom' n'est pas renseigne.");
     }
     if (!$fields['categ']) {
         return $this->build_error("Le champ 'categ' n'est pas renseigne.");
     }
     if (!$fields['statut']) {
         return $this->build_error("Le champ 'statut' n'est pas renseigne.");
     }
     if (!$fields['cstat']) {
         return $this->build_error("Le champ 'cstat' n'est pas renseigne.");
     }
     // vérification des relations
     $q = "select idstatut from empr_statut where idstatut='" . $fields['statut'] . "' limit 1";
     $r = pmb_mysql_query($q, $dbh);
     if (!pmb_mysql_num_rows($r)) {
         return $this->build_error("Le champ 'statut' = " . $fields['statut'] . " n'est pas un Id present dans la base de donnee.");
     }
     $q = "select idcode from empr_codestat where idcode='" . $fields['cstat'] . "' limit 1";
     $r = pmb_mysql_query($q, $dbh);
     if (!pmb_mysql_num_rows($r)) {
         return $this->build_error("Le champ 'cstat' = " . $fields['cstat'] . " n'est pas un Id present dans la base de donnee.");
     }
     $q = "select id_categ_empr from empr_categ where id_categ_empr='" . $fields['categ'] . "' limit 1";
     $r = pmb_mysql_query($q, $dbh);
     if (!pmb_mysql_num_rows($r)) {
         return $this->build_error("Le champ 'categ' = " . $fields['categ'] . " n'est pas un Id present dans la base de donnee.");
     }
     if ($fields['location']) {
         $q = "select idlocation from docs_location where idlocation='" . $fields['location'] . "' limit 1";
         $r = pmb_mysql_query($q, $dbh);
         if (!pmb_mysql_num_rows($r)) {
             $fields['location'] = 0;
         }
     }
     if (!$fields['location']) {
         $loca = pmb_mysql_query("select min(idlocation) as idlocation from docs_location", $dbh);
         $locaid = pmb_mysql_fetch_object($loca);
         $fields['location'] = $locaid->idlocation;
     }
     if ($fields['mail']) {
         if (!filter_var($fields['mail'], FILTER_VALIDATE_EMAIL)) {
             return $this->build_error("Le champ 'mail' = " . $fields['mail'] . " n'est pas un mail valide.");
         }
     }
     if (!$fields['sexe']) {
         $fields['sexe'] = 0;
     }
     if (!$fields['lang']) {
         $fields['lang'] = $lang;
     }
     $requete = "UPDATE empr SET ";
     $requete .= "empr_nom='" . addslashes($fields['nom']) . "', ";
     $requete .= "empr_prenom='" . addslashes($fields['prenom']) . "', ";
     $requete .= "empr_adr1='" . addslashes($fields['adr1']) . "', ";
     $requete .= "empr_adr2='" . addslashes($fields['adr2']) . "', ";
     $requete .= "empr_cp='" . addslashes($fields['cp']) . "', ";
     $requete .= "empr_ville='" . addslashes($fields['ville']) . "', ";
     $requete .= "empr_pays='" . addslashes($fields['pays']) . "', ";
     $requete .= "empr_mail='" . addslashes($fields['mail']) . "', ";
     $requete .= "empr_tel1='" . addslashes($fields['tel1']) . "', ";
     $requete .= "empr_sms='" . addslashes($fields['sms']) . "', ";
     $requete .= "empr_tel2='" . addslashes($fields['tel2']) . "', ";
     $requete .= "empr_prof='" . addslashes($fields['prof']) . "', ";
     $requete .= "empr_year='" . addslashes($fields['birth']) . "', ";
     $requete .= "empr_categ='" . $fields['categ'] . "', ";
     $requete .= "empr_statut='" . $fields['statut'] . "', ";
     $requete .= "empr_lang='" . addslashes($fields['lang']) . "', ";
     if ($fields['date_adhesion'] == "") {
         $requete .= "empr_date_adhesion=CURRENT_DATE(), ";
     } else {
         $requete .= "empr_date_adhesion='" . addslashes($fields['date_adhesion']) . "', ";
     }
     if ($fields['date_expiration'] == "" or $fields['date_expiration'] == $fields['date_adhesion']) {
         /* AJOUTER ICI LE CALCUL EN FONCTION DE LA CATEGORIE */
         $rqt_empr_categ = "select duree_adhesion from empr_categ where id_categ_empr = " . $fields['categ'] . " ";
         $res_empr_categ = pmb_mysql_query($rqt_empr_categ, $dbh);
         $empr_categ = pmb_mysql_fetch_object($res_empr_categ);
         if ($fields['date_adhesion']) {
             $rqt_date = "select date_add('" . addslashes($fields['date_adhesion']) . "', INTERVAL " . $empr_categ->duree_adhesion . " DAY) as date_expiration ";
         } else {
             $rqt_date = "select date_add(CURRENT_DATE(), INTERVAL " . $empr_categ->duree_adhesion . " DAY) as date_expiration ";
         }
         $resultatdate = pmb_mysql_query($rqt_date);
         $resdate = pmb_mysql_fetch_object($resultatdate);
         $requete .= "empr_date_expiration='" . $resdate->date_expiration . "', ";
     } else {
         $requete .= "empr_date_expiration='" . $fields['date_expiration'] . "', ";
     }
     $requete .= "empr_codestat=" . $fields['cstat'] . ", ";
     $requete .= "empr_modif=CURRENT_DATE(), ";
     $requete .= "empr_sexe='" . $fields['sexe'] . "', ";
     $requete .= "empr_msg='" . addslashes($fields['msg']) . "', ";
     $requete .= "empr_login='******'login']) . "', ";
     $requete .= "empr_location='" . $fields['location'] . "', ";
     // ldap - MaxMan
     if ($fields['ldap']) {
         $requete .= "empr_ldap='1', ";
         $fields['pwd'] = "";
     } else {
         $requete .= "empr_ldap='0', ";
     }
     //Gestion financière
     if ($pmb_gestion_abonnement == 2 && $pmb_gestion_financiere) {
         $requete .= "type_abt='" . $fields['type_abt'] . "', ";
     } else {
         $requete .= "type_abt=0, ";
     }
     if ($fields['pwd'] != "") {
         $requete .= "empr_password='******'pwd']) . "' ";
     } else {
         $requete .= "empr_password='******'birth']) . "' ";
     }
     $requete .= " WHERE id_empr=" . $empr_id . " limit 1";
     $res = pmb_mysql_query($requete, $dbh);
     if (!$res) {
         return $this->build_error("Impossible de modifier le lecteur: {$requete}");
     }
     if ($fields['pwd'] != "") {
         emprunteur::update_digest($fields['login'], $fields['pwd']);
         emprunteur::hash_password($fields['login'], $fields['pwd']);
     } else {
         emprunteur::update_digest($fields['login'], $fields['birth']);
         emprunteur::hash_password($fields['login'], $fields['birth']);
     }
     if (is_array($fields['pperso_list'])) {
         $p_perso = new parametres_perso("empr");
         foreach ($fields['pperso_list'] as $pp) {
             $name = $pp["name"];
             global ${$name};
             ${$name} = $pp["value_list"];
         }
         $p_perso->rec_fields_perso($empr_id);
     }
     if (is_array($fields['groupe_list'])) {
         emprunteur::rec_groupe_empr($empr_id, $fields['groupe_list']);
     }
     emprunteur::ins_lect_categ_dsi($empr_id, $fields['categ'], 0);
     if ($pmb_gestion_financiere && $pmb_gestion_abonnement) {
         emprunteur::rec_abonnement($empr_id, $type_abt, $fields['categ']);
     }
     return $this->build_ok();
 }
Example #25
0
function do_retour($stuff, $confirmed = 1)
{
    global $dbh;
    global $msg;
    global $alert_sound_list, $pmb_play_pret_sound;
    global $pmb_gestion_amende, $pmb_gestion_financiere, $pmb_blocage_retard, $pmb_blocage_max, $pmb_blocage_delai, $pmb_blocage_coef;
    global $deflt_docs_location;
    $erreur_affichage = '';
    if (!is_object($stuff)) {
        die("erreur dans le module ./circ/retour.inc [do_retour()]. Contactez l'admin");
    }
    // récupération localisation exemplaire
    $query = "SELECT t.tdoc_libelle as type_doc";
    $query .= ", l.location_libelle as location";
    $query .= ", s.section_libelle as section";
    $query .= " FROM docs_type t";
    $query .= ", docs_location l";
    $query .= ", docs_section s";
    $query .= " WHERE t.idtyp_doc=" . $stuff->expl_typdoc;
    $query .= " AND l.idlocation=" . $stuff->expl_location;
    $query .= " AND s.idsection=" . $stuff->expl_section;
    $query .= " LIMIT 1";
    $result = mysql_query($query, $dbh);
    $info_doc = mysql_fetch_object($result);
    print pmb_bidi("<br /><form><div class='row'><div class='left'><strong>" . $stuff->libelle . "</strong></div>");
    // flag confirm retour
    if (!$confirmed and $stuff->pret_idempr) {
        print "\n\t\t\t<div class='right'>\n\t\t\t<input type='button' class='bouton' \n\t\t\t\t\tname='confirm_ret' value='" . $msg['retour_confirm'] . "'\n\t\t\t\t\tonClick=\"document.location='./circ.php?categ=retour&cb_expl=" . $stuff->expl_cb . "'\">\n\t\t\t</div>";
    } elseif ($stuff->pret_idempr) {
        print "\n\t\t\t\t<div class='right'>\n\t\t\t\t\t<font color='RED'><b>{$msg['retour_ok']}</b></font>\n\t\t\t\t</div>";
    }
    print "</div>";
    print pmb_bidi("<br /><b>" . $stuff->expl_cb . "</b> " . $info_doc->type_doc);
    print pmb_bidi('.&nbsp;' . $info_doc->location);
    print pmb_bidi('.&nbsp;' . $info_doc->section);
    print pmb_bidi('.&nbsp;' . $stuff->expl_cote);
    print "&nbsp;&nbsp;<input class='bouton' type='button' value=\"" . $msg[375] . "\" onClick=\"document.location='circ.php?categ=visu_ex&form_cb_expl=" . $stuff->expl_cb . "';\" />";
    print "</form>";
    //Champs personalisés
    $p_perso = new parametres_perso("expl");
    $perso_aff = "";
    if (!$p_perso->no_special_fields) {
        $perso_ = $p_perso->show_fields($stuff->expl_id);
        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
            $p = $perso_["FIELDS"][$i];
            if ($p["AFF"]) {
                $perso_aff .= "<br />" . $p["TITRE"] . " " . $p["AFF"];
            }
        }
    }
    if ($perso_aff) {
        print "<div class='row'>" . $perso_aff . "</div>";
    }
    $script_magnetique = "\n<script language='javascript' type='text/javascript'>\nvar requete = null;\n\nfunction creerRequette(){\n\tif(window.XMLHttpRequest) // Firefox\n\t\trequete = new XMLHttpRequest();\n\telse if(window.ActiveXObject) // Internet Explorer\n  \t\trequete = new ActiveXObject('Microsoft.XMLHTTP');\n\telse { // XMLHttpRequest non supporté par le navigateur\n   \t\talert('Votre navigateur ne supporte pas les objets XMLHTTPRequest...');\n    \treturn;\n\t}\n}\n\nfunction magnetise(commande){\n\tcreerRequette();\n\tif(netscape.security.PrivilegeManager)netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');\t\n\trequete.open('GET', 'http://localhost:30000/?send_value='+commande+'&command=Send', false);\n\trequete.send(null);\n\tif(requete.readyState != 4) alert('Requête antivol non effectuée !');\n}\n\n";
    global $pmb_antivol;
    if ($pmb_antivol > 0) {
        if ($stuff->type_antivol == 1) {
            // c'est un support non magnétique (livre, revue...)
            print "{$script_magnetique}" . "magnetise('RRR');</script>";
        }
        if ($stuff->type_antivol == 2) {
            //c'est un support magnétique (cassette)
            print "{$script_magnetique}" . "magnetise('SSS');</script>";
        }
    }
    //si le retour se passe sur un site différent de ce lui de l'exemplaire
    global $pmb_transferts_actif;
    $transfert_mauvais_site = false;
    if ($stuff->expl_location != $deflt_docs_location) {
        $alert_sound_list[] = "critique";
        $html_erreur_site = "<hr /><div class='erreur'>";
        //on agit pour faire l'action par defaut
        //et que c'est un retour d'emprunt
        if ($pmb_transferts_actif && $stuff->pret_idempr) {
            global $transferts_retour_action_defaut;
            global $transferts_retour_action_autorise_autre;
            $trans = new transfert();
            //pour afficher le site de l'exemplaire
            $rqtSite = "SELECT location_libelle FROM docs_location WHERE idlocation=" . $stuff->expl_location;
            $resSite = mysql_result(mysql_query($rqtSite), 0);
            //si on propose une autre action
            if ($transferts_retour_action_autorise_autre == "1") {
                $texte_change_loc = str_replace("!!lbl_site!!", $resSite, $msg["transferts_circ_retour_lbl_change_localisation"]);
            }
            $texte_change_loc = str_replace("!!liste_sections!!", "<select onchange='enregLoc(this)'>!!liste!!</select>", $texte_change_loc);
            //on genere la liste des sections
            $rqt = "SELECT idsection, section_libelle FROM docs_section ORDER BY section_libelle";
            $res_section = mysql_query($rqt);
            $liste_section = "";
            while ($value = mysql_fetch_object($res_section)) {
                $liste_section .= "<option value='" . $value->idsection . "'";
                if ($value->idsection == $stuff->expl_section) {
                    $liste_section .= " selected";
                    $expl_section_libelle = $value->section_libelle;
                }
                $liste_section .= ">" . $value->section_libelle . "</option>";
            }
            $texte_change_loc = addslashes(str_replace("!!liste!!", $liste_section, $texte_change_loc));
            $html_erreur_site .= "\n<form name='actionTrans'>\n<input type='hidden' name='typeTrans' value='" . $transferts_retour_action_defaut . "'>\n<input type='hidden' name='explTrans' value='" . $stuff->expl_id . "'>\n<script language='javascript'>\nmsg_inf_loc = '" . $texte_change_loc . "';\nmsg_bt_loc = '" . str_replace("'", "\\'", $msg["transferts_circ_retour_bt_retour_mauvaise_localisation"]) . "';\nmsg_inf_trans = '" . str_replace("'", "\\'", str_replace("!!lbl_site!!", $resSite, $msg["transferts_circ_retour_lbl_transfert"])) . "';\nmsg_bt_trans = '" . str_replace("'", "\\'", $msg["transferts_circ_retour_bt_changement_localisation"]) . "';\n\nfunction changeAction() {\n\n\tvar actionTrans = new http_request();\n\tvar url= './ajax.php?module=circ&categ=transferts&idexpl=' + document.actionTrans.explTrans.value + '&action=';\n\t\t\t\t\n\tswitch (document.actionTrans.typeTrans.value) {\n\t\tcase '0':\n\t\t\t//il y a eu un changement localisation\n\t\t\t//on propose un transfert\n\t\t\tif (confirm('" . addslashes($msg["transferts_circ_retour_confirm_gen_transfert"]) . "')) {\n\n\t\t\t\turl = url + 'gen_transfert&param=' + document.actionTrans.paramTrans.value ;\n\t\t\t\n\t\t\t\tif (actionTrans.request(url)) {\n\t\t\t\t\t// Il y a une erreur. Afficher le message retourné\n\t\t\t\t\talert ( '" . addslashes($msg["540"]) . " : ' + actionTrans.get_text() );\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t//tout c'est bien passe\n\t\t\t\t\t\n\t\t\t\t\t//on recupere les infos\n\t\t\t\t\tdocument.actionTrans.typeTrans.value = '1';\n\t\t\t\t\tdocument.actionTrans.paramTrans.value = actionTrans.get_text();\n\t\t\t\t\t\n\t\t\t\t\t//on change les textes\n\t\t\t\t\tdocument.actionTrans.btActionTrans.value = msg_bt_trans;\n\t\t\t\t\tdocument.getElementById('libInfoTransfert').innerHTML = msg_inf_trans; \n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t\t}//if confirm\n\t\t\t\n\t\t\t\n\t\t\tbreak;\n\t\n\t\tcase '1':\n\t\t\t//il y a eu un transfert\n\t\t\t//on propose un changement de localisation\n\t\t\tif (confirm('" . addslashes($msg["transferts_circ_retour_confirm_change_loc"]) . "')) {\n\n\t\t\t\turl = url + 'change_loc&param=' + document.actionTrans.paramTrans.value ;\n\t\t\t\n\t\t\t\tif (actionTrans.request(url)) {\n\t\t\t\t\t// Il y a une erreur. Afficher le message retourné\n\t\t\t\t\talert ( '" . addslashes($msg["540"]) . " : ' + actionTrans.get_text() );\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t//tout c'est bien passe\n\t\t\t\t\t\n\t\t\t\t\t//on recupere les infos\n\t\t\t\t\tdocument.actionTrans.typeTrans.value = '0';\n\t\t\t\t\tdocument.actionTrans.paramTrans.value = actionTrans.get_text();\n\t\t\t\t\t\n\t\t\t\t\t//on change les textes\n\t\t\t\t\tdocument.actionTrans.btActionTrans.value = msg_bt_loc;\n\t\t\t\t\tdocument.getElementById('libInfoTransfert').innerHTML = msg_inf_loc; \n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t\t} //if confirm\n\t\t\tbreak;\n\t} //switch\n\t\t\n}\n\nfunction enregLoc(obj) {\n\tval = obj.options[obj.selectedIndex].value;\n\t\n\tvar actionTrans = new http_request();\n\tvar url= './ajax.php?module=circ&categ=transferts&idexpl=' + document.actionTrans.explTrans.value + '&action=change_section&param='+val;\n\t\n\tif (actionTrans.request(url)) {\n\t\t// Il y a une erreur. Afficher le message retourné\n\t\talert ( '" . addslashes($msg["540"]) . " : ' + actionTrans.get_text() );\t\t\t\n\t}\n}\n</script>";
            if ($stuff->resa_idempr) {
                // le doc en retour peut servir à valider une résa suivante
                if (!verif_cb_utilise($stuff->expl_cb)) {
                    $affect = affecte_cb($stuff->expl_cb);
                }
            }
            if (!$affect) {
                switch ($transferts_retour_action_defaut) {
                    case "0":
                        //change la localisation d'origine
                        $param = $trans->retour_exemplaire_change_localisation($stuff->expl_id);
                        //le message a l'ecran
                        $html_erreur_site .= "<div id='libInfoTransfert'>" . str_replace("!!lbl_site!!", $resSite, $msg["transferts_circ_retour_lbl_change_localisation"]) . "</div>";
                        if ($transferts_retour_action_autorise_autre == "1") {
                            //on propose de générer le transfert
                            $html_erreur_site .= "&nbsp;<input class='bouton' name='btActionTrans' type='button' value=\"" . $msg["transferts_circ_retour_bt_retour_mauvaise_localisation"] . "\" " . " onclick=\"changeAction();\"" . ">";
                        }
                        break;
                    case "1":
                        //genere le transfert automatique de l'exemplaire
                        $param = $trans->retour_exemplaire_genere_transfert_retour($stuff->expl_id);
                        //le message a l'ecran
                        $html_erreur_site .= "<div id='libInfoTransfert'>" . $msg["transferts_circ_retour_lbl_transfert"] . "</div>";
                        if ($transferts_retour_action_autorise_autre == "1") {
                            //on propose de changer la localisation
                            $html_erreur_site .= "&nbsp;<input class='bouton' name='btActionTrans' type='button' value=\"" . $msg["transferts_circ_retour_bt_changement_localisation"] . "\" " . " onclick=\"changeAction();\"" . ">";
                        }
                        break;
                }
                //switch
            }
            if ($transferts_retour_action_autorise_autre == "1") {
                $html_erreur_site .= "<input type='hidden' name='paramTrans' value='" . $param . "'></form>";
            }
            $html_erreur_site = str_replace("!!lbl_site!!", $resSite, $html_erreur_site);
            $html_erreur_site = str_replace("!!liste_sections!!", $expl_section_libelle, $html_erreur_site);
            $transfert_mauvais_site = true;
        } else {
            //if (($pmb_transferts_actif)&&($stuff->pret_idempr))
            //le message à l'écran
            $html_erreur_site .= $msg[expl_retour_bad_location];
        }
        $html_erreur_site .= "</div>";
        print pmb_bidi($html_erreur_site);
        // fin de if ($stuff->expl_location != $deflt_docs_location)
    }
    if ($stuff->expl_note) {
        $alert_sound_list[] = "critique";
        print pmb_bidi("<hr /><div class='erreur'>{$msg[377]} :</div><div class='message_important'>" . $stuff->expl_note . "</div>");
    } elseif ($pmb_play_pret_sound) {
        $alert_sound_list[] = "information";
    }
    // zone du dernier emrunteur
    if ($stuff->expl_lastempr) {
        $dernier_empr = "<hr /><div class='row'>{$msg['expl_prev_empr']} ";
        $link = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($stuff->lastempr_cb) . "'>";
        $dernier_empr .= $link . $stuff->lastempr_prenom . ' ' . $stuff->lastempr_nom . ' (' . $stuff->lastempr_cb . ')</a>';
        $dernier_empr .= "</div><hr />";
    }
    if ($stuff->pret_idempr) {
        // l'exemplaire était effectivement emprunté
        // calcul du retard éventuel
        $rqt_date = "select ((TO_DAYS(CURDATE()) - TO_DAYS('{$stuff->pret_retour}'))) as retard ";
        $resultatdate = mysql_query($rqt_date);
        $resdate = mysql_fetch_object($resultatdate);
        $retard = $resdate->retard;
        if ($retard > 0) {
            //Calcul du vrai nombre de jours
            $date_debut = explode("-", $stuff->pret_retour);
            $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
            if ($ndays > 0) {
                $retard = (int) $ndays;
                print "<br /><div class='erreur'>" . $msg[369] . "&nbsp;: " . $retard . " " . $msg[370] . "</div>";
                $alert_sound_list[] = "critique";
            }
        }
        //Calcul du blocage
        if ($pmb_blocage_retard) {
            $date_debut = explode("-", $stuff->pret_retour);
            $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
            if ($ndays > $pmb_blocage_delai) {
                $ndays = $ndays * $pmb_blocage_coef;
                if ($ndays > $pmb_blocage_max && $pmb_blocage_max != 0) {
                    $ndays = $pmb_blocage_max;
                }
            } else {
                $ndays = 0;
            }
            if ($ndays > 0) {
                //Le lecteur est-il déjà bloqué ?
                $date_fin_blocage_empr = mysql_result(mysql_query("select date_fin_blocage from empr where id_empr='" . $stuff->pret_idempr . "'"), 0, 0);
                //Calcul de la date de fin
                $date_fin = calendar::add_days(date("d"), date("m"), date("Y"), $ndays);
                if ($date_fin > $date_fin_blocage_empr) {
                    //Mise à jour
                    mysql_query("update empr set date_fin_blocage='" . $date_fin . "' where id_empr='" . $stuff->pret_idempr . "'");
                    print "<br /><div class='erreur'>" . sprintf($msg["blocage_retard_pret"], formatdate($date_fin)) . "</div>";
                    $alertsound_list[] = "critique";
                } else {
                    print "<br /><div class='erreur'>" . sprintf($msg["blocage_already_retard_pret"], formatdate($date_fin_blocage_empr)) . "</div>";
                    $alertsound_list[] = "critique";
                }
            }
        }
        //Vérification des amendes
        if ($pmb_gestion_financiere && $pmb_gestion_amende) {
            $amende = new amende($stuff->pret_idempr);
            $amende_t = $amende->get_amende($stuff->pret_idexpl);
            //Si il y a une amende, je la débite
            if ($amende_t["valeur"]) {
                print pmb_bidi("<br /><div class='erreur'>" . $msg["finance_retour_amende"] . "&nbsp;: " . comptes::format($amende_t["valeur"]));
                $alert_sound_list[] = "critique";
                $compte_id = comptes::get_compte_id_from_empr($stuff->pret_idempr, 2);
                if ($compte_id) {
                    $cpte = new comptes($compte_id);
                    if ($cpte->id_compte) {
                        $cpte->record_transaction("", $amende_t["valeur"], -1, sprintf($msg["finance_retour_amende_expl"], $stuff->pret_idexpl), 0);
                        print " " . $msg["finance_retour_amende_recorded"];
                    }
                }
                print "</div>";
            }
        }
        // zone du dernier emrunteur
        print pmb_bidi($dernier_empr);
        // code de suppression prêt et la mise en table de stat
        if ($confirmed) {
            if (del_pret($stuff)) {
                if (!maj_stat_pret($stuff)) {
                    // impossible de maj en table stat
                    print "<div class='erreur'>{$msg[371]}</div>";
                }
            } else {
                // impossible de supprimer en table pret
                print "<div class='erreur'>{$msg[372]}</div>";
            }
            // traitement de l'éventuelle réservation
            if ($stuff->resa_idempr) {
                // le doc en retour peut servir à valider une résa suivante
                if (!verif_cb_utilise($stuff->expl_cb) || $affect) {
                    if (!$affect) {
                        $affect = affecte_cb($stuff->expl_cb);
                    }
                    // affichage message de réservation
                    if ($affect) {
                        $trans_en_cours = false;
                        $msg_trans = "";
                        if ($pmb_transferts_actif == "1" && !$transfert_mauvais_site) {
                            //si le transfert est actif et qu'un transfert n'est pas deja fait
                            $res_transfert = resa_transfert($affect, $stuff->expl_cb);
                            if ($res_transfert != 0) {
                                $rqt = "SELECT location_libelle FROM docs_location WHERE idlocation=" . $res_transfert;
                                $lib_loc = mysql_result(mysql_query($rqt), 0);
                                $msg_trans = "<strong>" . str_replace("!!site_dest!!", $lib_loc, $msg["transferts_circ_resa_validation_alerte"]) . "</strong><br />";
                                $trans_en_cours = true;
                            }
                        }
                        $query = "select distinct ";
                        $query .= "empr_prenom, empr_nom, empr_cb ";
                        $query .= "from (((resa LEFT JOIN notices AS notices_m ON resa_idnotice = notices_m.notice_id ) LEFT JOIN bulletins ON resa_idbulletin = bulletins.bulletin_id) LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), empr ";
                        $query .= "where id_resa in (" . $affect . ") and resa_idempr=id_empr";
                        $result = mysql_query($query, $dbh);
                        $empr = @mysql_fetch_object($result);
                        print pmb_bidi("<div class='message_important'>{$msg['352']}</div>\n\t\t\t\t\t\t\t<div class='row'>{$msg_trans}\n\t\t\t\t\t\t\t{$msg[373]}\n\t\t\t\t\t\t\t<strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode($empr->empr_cb) . "'>" . $empr->empr_prenom . "&nbsp;" . $empr->empr_nom . "</a></strong>\n\t\t\t\t\t\t\t&nbsp;({$empr->empr_cb} )\n\t\t\t\t\t\t\t</div>");
                        $alert_sound_list[] = "critique";
                        if (!$trans_en_cours) {
                            alert_empr_resa($affect);
                        }
                    }
                    // fin if affect
                }
                // fin if !verif_cb_utilise
            }
            // fin if resa
        }
        // fin confirmed
        $empr = new emprunteur($stuff->pret_idempr, $erreur_affichage, FALSE, 2);
        print pmb_bidi($empr->fiche_affichage);
    } else {
        print "<div class='erreur'>{$msg[605]}</div>";
        $alert_sound_list[] = "critique";
    }
    // show_report($stuff); // this stands for debugging
}
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . "/parametres_perso.class.php";
require_once $class_path . "/fiche.class.php";
switch ($mode) {
    case 'champs':
        print "<h1>" . htmlentities($msg['fichier_gestion_champs_title'], ENT_QUOTES, $charset) . "</h1>";
        $option_visibilite = array();
        $option_visibilite["multiple"] = "block";
        $option_visibilite["obligatoire"] = "block";
        $option_visibilite["search"] = "block";
        $option_visibilite["export"] = "none";
        $option_visibilite["exclusion"] = "none";
        $option_visibilite["opac_sort"] = "none";
        $p_perso = new parametres_perso($prefix, "./fichier.php?categ=gerer&mode=champs", $option_visibilite);
        $p_perso->proceed();
        break;
    case 'reindex':
        $fiche = new fiche();
        switch ($act) {
            case 'run':
                $fiche->reindex_all();
                break;
            default:
                $fiche->show_reindex_form();
                break;
        }
        break;
    case 'display':
        $fiche = new fiche();
Example #27
0
function aff_authors_by_type_with_tpl($param)
{
    global $fonction_auteur;
    // $param[0] = 0=principal seul, 1=principal+autres, 2=tous, 3=autres, 4=secondaires, 5=autres+secondaires
    // $param[1] = nombre maxi d'auteurs à afficher
    // $param[2] = séparateur entre auteurs
    // $param[3] = séparateur entre principal/autres/secondaires
    // $param[4] = afficher la fonction : 0=non, 1=toujours
    // $param[5] = afficher "et al." si plus d'auteurs que le maxi
    // $param[6] = 70=physique, 71=collectivités, 72=congrès (séparé parune virgule...)
    // $param[7] = template d'affichage de l'autorité
    // $param[8] = filtre sur code fonction
    global $parser_environnement, $dbh;
    if (!$parser_environnement['id_notice']) {
        return "";
    }
    $notice = gere_global();
    $param[6] = explode(",", $param[6]);
    $param[6] = implode("','", $param[6]);
    if ($param[8]) {
        $filtre_fonctions = " and responsability_fonction='" . addslashes($param[8]) . "'";
    } else {
        $filtre_fonctions = "";
    }
    $rqt_count = "select count(*) as nb from responsability, authors \n\t\t\twhere responsability_notice='" . $parser_environnement['id_notice'] . "' \n\t\t\t\tand responsability_author=author_id\n\t\t\t\tand author_type in('" . $param[6] . "')";
    if ($param[0] <= 2) {
        $rqt_count .= " and responsability_type<='" . $param[0] . "'";
    } else {
        if ($param[0] == 3) {
            $rqt_count .= " and responsability_type='1'";
        } else {
            if ($param[0] == 4) {
                $rqt_count .= " and responsability_type='2'";
            } else {
                if ($param[0] == 5) {
                    $rqt_count .= " and responsability_type in('1','2')";
                }
            }
        }
    }
    $rqt_count .= $filtre_fonctions;
    $res_sql_count = pmb_mysql_query($rqt_count, $dbh);
    $res_count = pmb_mysql_fetch_object($res_sql_count);
    $rqt = "select author_id, responsability_fonction, responsability_type \n\t\t\tfrom responsability, authors \n\t\t\twhere responsability_notice='" . $parser_environnement['id_notice'] . "' \n\t\t\t\tand responsability_author=author_id\n\t\t\t\tand author_type in('" . $param[6] . "')";
    if ($param[0] <= 2) {
        $rqt .= " and responsability_type<='" . $param[0] . "' ";
    } else {
        if ($param[0] == 3) {
            $rqt .= " and responsability_type='1' ";
        } else {
            if ($param[0] == 4) {
                $rqt .= " and responsability_type='2' ";
            } else {
                if ($param[0] == 5) {
                    $rqt .= " and responsability_type in('1','2') ";
                }
            }
        }
    }
    $rqt .= $filtre_fonctions;
    $rqt .= " order by responsability_type, responsability_ordre ";
    if ($param[1] > 0) {
        $rqt .= " limit 0," . $param[1];
    }
    $res_sql = pmb_mysql_query($rqt, $dbh);
    while ($authors = pmb_mysql_fetch_object($res_sql)) {
        $aut_detail = new auteur($authors->author_id);
        $aut_pp = new parametres_perso("author");
        $aut_pp->get_values($authors->author_id);
        $values_pp = $aut_pp->values;
        $aut_detail->parametres_perso = array();
        foreach ($values_pp as $field_id => $vals) {
            $aut_detail->parametres_perso[$aut_pp->t_fields[$field_id]["NAME"]]["TITRE"] = $aut_pp->t_fields[$field_id]["TITRE"];
            foreach ($vals as $value) {
                $aut_detail->parametres_perso[$aut_pp->t_fields[$field_id]["NAME"]]["VALUE"][] = $aut_pp->get_formatted_output(array($value), $field_id);
            }
        }
        if ($authors->responsability_fonction && $param[4] == 1) {
            $aut_detail->function = $fonction_auteur[$authors->responsability_fonction];
        }
        if ($authors->responsability_type == 0) {
            $aut[] = _get_aut_infos($aut_detail, $param[7]);
        }
        if ($authors->responsability_type == 1) {
            $aut1[] = _get_aut_infos($aut_detail, $param[7]);
        }
        if ($authors->responsability_type == 2) {
            $aut2[] = _get_aut_infos($aut_detail, $param[7]);
        }
    }
    if (count($aut1)) {
        $aut[] = implode($param[2], $aut1);
    }
    if (count($aut2)) {
        $aut[] = implode($param[2], $aut2);
    }
    if ($param[1] != 0 && $param[5] && $res_count->nb > $param[1]) {
        $aut[] = "et al.";
    }
    if (count($aut)) {
        return implode($param[3], $aut);
    }
    return "";
}
Example #28
0
 /**
  * Retourne les paramètres persos
  * @return array
  */
 public function get_p_perso()
 {
     if (!$this->p_perso) {
         global $memo_p_perso_notices;
         $this->p_perso = array();
         if (!$memo_p_perso_notices) {
             $memo_p_perso_notices = new parametres_perso("notices");
         }
         $ppersos = $memo_p_perso_notices->show_fields($this->id);
         // Filtre ceux qui ne sont pas visibles à l'OPAC ou qui n'ont pas de valeur
         foreach ($ppersos['FIELDS'] as $pperso) {
             if ($pperso['OPAC_SHOW'] && $pperso['AFF']) {
                 $this->p_perso[] = $pperso;
             }
         }
     }
     return $this->p_perso;
 }
Example #29
0
 function show_expl_per_notice($no_notice, $link_expl = '', $expl_bulletin = 0)
 {
     global $msg, $dbh, $base_path, $class_path;
     global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises, $transferts_gestion_transferts;
     global $pmb_expl_list_display_comments;
     global $pmb_sur_location_activate;
     global $pmb_url_base, $pmb_expl_data, $charset;
     global $pmb_expl_display_location_without_expl;
     global $pmb_html_allow_expl_cote;
     // params :
     // $no_notice= id de la notice
     // $link_expl= lien associé à l'exemplaire avec !!expl_id!! et !!expl_cb!! à mettre à jour
     if (!$no_notice && !$expl_bulletin) {
         return;
     }
     $explr_tab_invis = explode(",", $explr_invisible);
     $explr_tab_unmod = explode(",", $explr_visible_unmod);
     $explr_tab_modif = explode(",", $explr_visible_mod);
     // récupération du nombre total d'exemplaires
     if ($expl_bulletin) {
         $requete = "SELECT COUNT(1) FROM exemplaires WHERE expl_bulletin='{$expl_bulletin}' ";
     } else {
         $requete = "SELECT COUNT(1) FROM exemplaires WHERE expl_notice='{$no_notice}' ";
     }
     $res = pmb_mysql_query($requete, $dbh);
     $nb_ex = pmb_mysql_result($res, 0, 0);
     if ($nb_ex) {
         // on récupère les données des exemplaires
         // visibilité des exemplaires:
         if ($pmb_droits_explr_localises && $explr_invisible) {
             $where_expl_localises = "and expl_location not in ({$explr_invisible})";
         } else {
             $where_expl_localises = "";
         }
         //Liste des champs d'exemplaires
         if ($pmb_sur_location_activate) {
             $surloc_field = "surloc_libelle,";
         }
         if (!$pmb_expl_data) {
             $pmb_expl_data = "expl_cb,expl_cote," . $surloc_field . "location_libelle,section_libelle,statut_libelle,tdoc_libelle";
         }
         $colonnesarray = explode(",", $pmb_expl_data);
         if (!in_array("expl_cb", $colonnesarray)) {
             array_unshift($colonnesarray, "expl_cb");
         }
         $total_columns = count($colonnesarray);
         //Présence de champs personnalisés
         if (strstr($pmb_expl_data, "#")) {
             require_once $class_path . "/parametres_perso.class.php";
             $cp = new parametres_perso("expl");
         }
         if ($expl_bulletin) {
             $where_expl_notice_expl_bulletin = " expl_bulletin='{$expl_bulletin}' ";
         } else {
             $where_expl_notice_expl_bulletin = " expl_notice='{$no_notice}' ";
         }
         $requete = "SELECT exemplaires.*, pret.*, docs_location.*, docs_section.*, docs_statut.*, docs_codestat.*, lenders.*, tdoc_libelle, ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= "sur_location.*, ";
         }
         $requete .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, ";
         $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, ";
         $requete .= " IF(pret_retour>sysdate(),0,1) as retard ";
         $requete .= " FROM exemplaires LEFT JOIN pret ON exemplaires.expl_id=pret.pret_idexpl ";
         $requete .= " left join docs_location on exemplaires.expl_location=docs_location.idlocation ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= " left join sur_location on docs_location.surloc_num=sur_location.surloc_id ";
         }
         $requete .= " left join docs_section on exemplaires.expl_section=docs_section.idsection ";
         $requete .= " left join docs_statut on exemplaires.expl_statut=docs_statut.idstatut ";
         $requete .= " left join docs_codestat on exemplaires.expl_codestat=docs_codestat.idcode ";
         $requete .= " left join lenders on exemplaires.expl_owner=lenders.idlender ";
         $requete .= " left join docs_type on exemplaires.expl_typdoc=docs_type.idtyp_doc  ";
         $requete .= " WHERE {$where_expl_notice_expl_bulletin} {$where_expl_localises} ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= " order by surloc_libelle,location_libelle, section_libelle, expl_cote, expl_cb ";
         } else {
             $requete .= " order by location_libelle, section_libelle, expl_cote, expl_cb ";
         }
         $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
         $nbr_expl = pmb_mysql_num_rows($result);
         if ($nbr_expl) {
             while ($expl = pmb_mysql_fetch_object($result)) {
                 //visibilité des exemplaires
                 if ($pmb_droits_explr_localises) {
                     $as_invis = array_search($expl->idlocation, $explr_tab_invis);
                     $as_unmod = array_search($expl->idlocation, $explr_tab_unmod);
                     $as_modif = array_search($expl->idlocation, $explr_tab_modif);
                 } else {
                     $as_invis = false;
                     $as_unmod = false;
                     $as_modif = true;
                 }
                 if ($link_expl) {
                     if ($expl_bulletin) {
                         $tlink = "./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=!!bull_id!!&expl_id=!!expl_id!!";
                         $tlink = str_replace('!!bull_id!!', $expl_bulletin, $tlink);
                         $tlink = str_replace('!!expl_id!!', $expl->expl_id, $tlink);
                         $tlink = str_replace('!!expl_cb!!', rawurlencode($expl->expl_cb), $tlink);
                     } else {
                         $tlink = str_replace('!!expl_id!!', $expl->expl_id, $link_expl);
                         $tlink = str_replace('!!expl_cb!!', rawurlencode($expl->expl_cb), $tlink);
                         $tlink = str_replace('!!notice_id!!', $expl->expl_notice, $tlink);
                     }
                 }
                 $expl_liste .= "<tr>";
                 for ($i = 0; $i < count($colonnesarray); $i++) {
                     if (!(substr($colonnesarray[$i], 0, 1) == "#")) {
                         eval("\$colencours=\$expl->" . $colonnesarray[$i] . ";");
                     }
                     if ($i == 0 && ($expl->expl_note || $expl->expl_comment) && $pmb_expl_list_display_comments) {
                         $expl_rowspan = "rowspan='2'";
                     } else {
                         $expl_rowspan = "";
                     }
                     $aff_column = "";
                     if (substr($colonnesarray[$i], 0, 1) == "#") {
                         //champs personnalisés
                         $id = substr($colonnesarray[$i], 1);
                         $cp->get_values($expl->expl_id);
                         if (!$cp->no_special_fields) {
                             $temp = $cp->get_formatted_output($cp->values[$id], $id);
                             if (!$temp) {
                                 $temp = "&nbsp;";
                             }
                             $aff_column .= $temp;
                         }
                     } else {
                         if ($colonnesarray[$i] == "expl_cb") {
                             if ($tlink && ($as_modif !== FALSE && $as_modif !== NULL)) {
                                 $aff_column .= "<a href='{$tlink}'>" . $colencours . "</a>";
                             } else {
                                 $aff_column .= $colencours;
                             }
                         } else {
                             if ($colonnesarray[$i] == "expl_cote") {
                                 if ($pmb_html_allow_expl_cote) {
                                     $aff_column .= "<strong>" . $colencours . "</strong>";
                                 } else {
                                     $aff_column .= "<strong>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</strong>";
                                 }
                             } else {
                                 if ($colonnesarray[$i] == "statut_libelle") {
                                     if ($expl->pret_retour) {
                                         // exemplaire sorti
                                         $rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='{$expl->pret_idempr}' ";
                                         $res_empr = pmb_mysql_query($rqt_empr, $dbh);
                                         $res_empr_obj = pmb_mysql_fetch_object($res_empr);
                                         $situation = "<strong>{$msg[358]} " . $expl->aff_pret_retour . "</strong>";
                                         global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
                                         if ($empr_show_caddie && SESSrights & CIRCULATION_AUTH) {
                                             $img_ajout_empr_caddie = "<img src='" . $base_path . "/images/basket_empr.gif' align='middle' alt='basket' title=\"{$msg[400]}\" onClick=\"openPopUp('" . $base_path . "/cart.php?object_type=EMPR&item=" . $expl->pret_idempr . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}')\">&nbsp;";
                                         } else {
                                             $img_ajout_empr_caddie = "";
                                         }
                                         switch ($this->print_mode) {
                                             case '2':
                                                 $situation .= "<br />{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}";
                                                 break;
                                             default:
                                                 $situation .= "<br />{$img_ajout_empr_caddie}<a href='" . $base_path . "/circ.php?categ=pret&form_cb=" . rawurlencode($res_empr_obj->empr_cb) . "'>{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}</a>";
                                                 break;
                                         }
                                     } else {
                                         // tester si réservé
                                         $result_resa = pmb_mysql_query("select 1 from resa where resa_cb='" . addslashes($expl->expl_cb) . "' ", $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                                         $reserve = pmb_mysql_num_rows($result_resa);
                                         // tester à ranger
                                         $result_aranger = pmb_mysql_query(" select 1 from resa_ranger where resa_cb='" . addslashes($expl->expl_cb) . "' ", $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                                         $aranger = pmb_mysql_num_rows($result_aranger);
                                         if ($reserve) {
                                             $situation = "<strong>" . $msg['expl_reserve'] . "</strong>";
                                         } elseif ($expl->expl_retloc) {
                                             $situation = $msg['resa_menu_a_traiter'];
                                         } elseif ($aranger) {
                                             $situation = "<strong>" . $msg['resa_menu_a_ranger'] . "</strong>";
                                         } elseif ($expl->pret_flag) {
                                             $situation = "<strong>{$msg[359]}</strong>";
                                         } else {
                                             $situation = "";
                                         }
                                     }
                                     $aff_column .= htmlentities($colencours, ENT_QUOTES, $charset);
                                     if ($situation) {
                                         $aff_column .= "<br />{$situation}";
                                     }
                                 } else {
                                     $aff_column = htmlentities($colencours, ENT_QUOTES, $charset);
                                 }
                             }
                         }
                     }
                     $expl_liste .= "<td {$expl_rowspan}>" . $aff_column . "</td>";
                 }
                 if ($this->print_mode) {
                     $expl_liste .= "<td>&nbsp;</td>";
                 } else {
                     if (SESSrights & CATALOGAGE_AUTH) {
                         //le panier d'exemplaire
                         $cart_click = "onClick=\"openPopUp('" . $base_path . "/cart.php?object_type=EXPL&item=" . $expl->expl_id . "', 'cart', 600, 700, -2, -2, 'toolbar=no, dependent=yes, width=500, height=400, resizable=yes, scrollbars=yes')\"";
                         $cart_link = "<a href='#' {$cart_click}><img src='" . $base_path . "/images/basket_small_20x20.gif' align='center' alt='basket' title=\"{$msg[400]}\"></a>";
                         //l'icon pour le drag&drop de panier
                         $drag_link = "<span onMouseOver='if(init_drag) init_drag();' id='EXPL_drag_" . $expl->expl_id . "'  dragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($expl->expl_cb, ENT_QUOTES, $charset) . "\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"" . $base_path . "/images/notice_drag.png\"/></span>";
                     } else {
                         $cart_click = "";
                         $cart_link = "";
                         $drag_link = "";
                     }
                     //l'impression de la fiche exemplaire
                     $fiche_click = "onClick=\"openPopUp('" . $base_path . "/pdf.php?pdfdoc=fiche_catalographique&expl_id=" . $expl->expl_id . "', 'Fiche', 500, 400, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes')\"";
                     $fiche_link = "<a href='#' {$fiche_click}><img src='" . $base_path . "/images/print.gif' align='center' alt='" . $msg['print_fiche_catalographique'] . "' title='" . $msg['print_fiche_catalographique'] . "'></a>";
                     global $pmb_transferts_actif;
                     //si les transferts sont activés
                     if ($pmb_transferts_actif) {
                         //si l'exemplaire n'est pas transferable on a une image vide
                         $transfer_link = "<img src='" . $base_path . "/images/spacer.gif' align='center' height=20 width=20>";
                         $dispo_pour_transfert = transfert::est_transferable($expl->expl_id);
                         if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert) {
                             //l'icon de demande de transfert
                             $transfer_link = "<a href=\"#\" onClick=\"openPopUp('" . $base_path . "/catalog/transferts/transferts_popup.php?expl=" . $expl->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\"><img src='" . $base_path . "/images/peb_in.png' align='center' border=0 alt=\"" . $msg["transferts_alt_libelle_icon"] . "\" title=\"" . $msg["transferts_alt_libelle_icon"] . "\"></a>";
                         }
                     }
                     //on met tout dans la colonne
                     $expl_liste .= "<td>{$fiche_link} {$cart_link} {$transfer_link} {$drag_link}</td>";
                 }
                 $expl_liste .= "</tr>";
                 if (($expl->expl_note || $expl->expl_comment) && $pmb_expl_list_display_comments) {
                     $notcom = array();
                     $expl_liste .= "<tr><td colspan='" . $total_columns . "'>";
                     if ($expl->expl_note && $pmb_expl_list_display_comments & 1) {
                         $notcom[] .= "<span class='erreur'>{$expl->expl_note}</span>";
                     }
                     if ($expl->expl_comment && $pmb_expl_list_display_comments & 2) {
                         $notcom[] .= "{$expl->expl_comment}";
                     }
                     $expl_liste .= implode("<br />", $notcom);
                     $expl_liste .= "</tr>";
                 }
             }
             // fin while
         }
         // fin il y a des expl visibles
         if ($expl_liste) {
             $entry = "<table border='0' class='expl-list'><tr>";
             for ($i = 0; $i < count($colonnesarray); $i++) {
                 if (substr($colonnesarray[$i], 0, 1) == "#") {
                     //champs personnalisés
                     if (!$cp->no_special_fields) {
                         $id = substr($colonnesarray[$i], 1);
                         $entry .= "<th>" . htmlentities($cp->t_fields[$id][TITRE], ENT_QUOTES, $charset) . "</th>";
                     }
                 } else {
                     eval("\$colencours=\$msg[expl_header_" . $colonnesarray[$i] . "];");
                     $entry .= "<th>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</th>";
                 }
             }
             $entry .= "<th>&nbsp;</th></tr>{$expl_liste}</table>";
         } else {
             $entry = "";
         }
         if ($pmb_expl_display_location_without_expl) {
             if ($pmb_sur_location_activate) {
                 $array_surloc = array();
                 $requete = "SELECT * FROM sur_location ORDER BY surloc_libelle";
                 $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                 $nb_surloc = pmb_mysql_num_rows($result);
                 if ($nb_surloc) {
                     while ($surloc = pmb_mysql_fetch_object($result)) {
                         $array_surloc[] = array("id" => $surloc->surloc_id, "libelle" => $surloc->surloc_libelle, "locations" => array());
                     }
                 }
                 if (count($array_surloc)) {
                     foreach ($array_surloc as $key => $surloc) {
                         $requete = "SELECT idlocation, location_libelle from docs_location where surloc_num=" . $surloc["id"] . " AND \n\t\t\t\t\t\tidlocation not in (SELECT expl_location from exemplaires WHERE expl_notice={$no_notice}) order by location_libelle";
                         $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                         $nb_loc = pmb_mysql_num_rows($result);
                         if ($nb_loc) {
                             while ($loc = pmb_mysql_fetch_object($result)) {
                                 $array_surloc[$key]["locations"][] = array("id" => $loc->idlocation, "libelle" => $loc->location_libelle);
                             }
                         } else {
                             unset($array_surloc[$key]);
                         }
                     }
                 }
                 //Au moins une surloc à afficher
                 if (count($array_surloc)) {
                     $tr_surloc = "";
                     foreach ($array_surloc as $key => $surloc) {
                         $tr_surloc .= "<tr><td>";
                         $tr_loc = "";
                         foreach ($surloc["locations"] as $keyloc => $loc) {
                             $tr_loc .= "<tr><td>" . $loc["libelle"] . "</td></tr>";
                         }
                         $tpl_surloc = "\n\t\t\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t\t\t{$tr_loc}\n\t\t\t\t\t\t\t</table>";
                         $tr_surloc .= gen_plus('surlocation_without_expl' . $key . '_' . $no_notice, $surloc["libelle"], $tpl_surloc, 0);
                         $tr_surloc .= "</td></tr>";
                     }
                     $tpl = "\n\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t{$tr_surloc}\n\t\t\t\t\t</table>";
                     $entry .= gen_plus('location_without_expl' . $no_notice, $msg['expl_surlocation_without_expl'], $tpl, 0);
                 }
             } else {
                 $requete = "SELECT location_libelle from docs_location where\n\t\t\t\tidlocation not in (SELECT expl_location from exemplaires WHERE expl_notice={$no_notice}) order by location_libelle";
                 $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                 $nb_loc = pmb_mysql_num_rows($result);
                 if ($nb_loc) {
                     $items = "";
                     while ($loc = pmb_mysql_fetch_object($result)) {
                         $items .= "<tr><td>" . $loc->location_libelle . "</td></tr>";
                     }
                     $tpl = "\n\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t{$items}\n\t\t\t\t\t</table>";
                     $tpl = gen_plus('location_without_expl' . $no_notice, $msg['expl_location_without_expl'], $tpl, 0);
                     $entry .= $tpl;
                 }
             }
         }
         $this->nb_expl = $nbr_expl;
         return $entry;
     } else {
         return "";
     }
 }
Example #30
0
 }
 $table['indexint'] = $f_indexint_id;
 $table['index_l'] = clean_tags($f_indexation);
 $table['lien'] = $f_lien;
 $table['eformat'] = $f_eformat;
 $table['niveau_biblio'] = $b_level;
 $table['niveau_hierar'] = $h_level;
 $table['signature'] = $signature;
 $table['indexation_lang'] = $indexation_lang;
 if ($a2z_opac_show) {
     $val = 0;
 } else {
     $val = 0x10;
 }
 $table['opac_visible_bulletinage'] = $opac_visible_bulletinage | $val;
 $p_perso = new parametres_perso("notices");
 $nberrors = $p_perso->check_submited_fields();
 if (!$nberrors) {
     //Pour la synchro rdf
     if ($pmb_synchro_rdf) {
         require_once $class_path . "/synchro_rdf.class.php";
         $synchro_rdf = new synchro_rdf();
         if ($serial_id) {
             $synchro_rdf->delRdf($serial_id, 0);
         }
     }
     $serial = new serial($serial_id);
     $update_result = $serial->update($table);
 } else {
     error_message_history($msg["notice_champs_perso"], $p_perso->error_message, 1);
     exit;