function format_date_input($value)
{
    if ($value == "") {
        return "";
    }
    return formatdate_input($value);
}
Exemple #2
0
 function do_form()
 {
     global $serial_bul_form;
     global $msg;
     global $charset;
     global $pmb_type_audit, $select_categ_prop;
     global $thesaurus_concepts_active;
     global $pmb_notices_show_dates;
     //Notice
     global $ptab, $ptab_bul;
     global $fonction_auteur;
     global $include_path, $class_path;
     global $pmb_type_audit, $select_categ_prop;
     global $value_deflt_fonction;
     global $value_deflt_relation_bulletin;
     global $thesaurus_mode_pmb, $thesaurus_classement_mode_pmb;
     require_once "{$class_path}/author.class.php";
     $fonction = new marc_list('function');
     // mise à jour des flags de niveau hiérarchique
     //if ($this->serial_id) $serial_bul_form = str_replace('!!form_title!!', $msg[4004], $serial_bul_form);
     //	else $serial_bul_form = str_replace('!!form_title!!', $msg[4003], $serial_bul_form);
     $serial_bul_form = str_replace('!!b_level!!', $this->b_biblio_level, $serial_bul_form);
     $serial_bul_form = str_replace('!!h_level!!', $this->b_hierar_level, $serial_bul_form);
     $serial_bul_form = str_replace('!!id!!', $this->bull_num_notice, $serial_bul_form);
     // mise à jour de l'onglet 0
     //$ptab[0] = str_replace('!!tit1!!',	htmlentities($this->tit1,ENT_QUOTES, $charset)	, $ptab[0]);
     $ptab_bul[0] = str_replace('!!tit3!!', htmlentities($this->b_tit3, ENT_QUOTES, $charset), $ptab_bul[0]);
     $ptab_bul[0] = str_replace('!!tit4!!', htmlentities($this->b_tit4, ENT_QUOTES, $charset), $ptab_bul[0]);
     $serial_bul_form = str_replace('!!tab0!!', $ptab_bul[0], $serial_bul_form);
     // initialisation avec les paramètres du user :
     if (!$this->b_langues) {
         global $value_deflt_lang;
         if ($value_deflt_lang) {
             $lang = new marc_list('lang');
             $this->b_langues[] = array('lang_code' => $value_deflt_lang, 'langue' => $lang->table[$value_deflt_lang]);
         }
     }
     if (!$this->b_statut) {
         $this->b_statut = $this->statut;
     }
     if (!$this->b_typdoc) {
         global $xmlta_doctype_bulletin;
         if ($xmlta_doctype_bulletin) {
             $this->b_typdoc = $xmlta_doctype_bulletin;
         } else {
             global $xmlta_doctype_serial;
             $this->b_typdoc = $xmlta_doctype_serial;
         }
     }
     // ajout des selecteurs
     $select_doc = new marc_select('doctype', 'typdoc', $this->b_typdoc, "get_pos(); initIt(); ajax_parse_dom();");
     $serial_bul_form = str_replace('!!doc_type!!', $select_doc->display, $serial_bul_form);
     // Ajout des localisations pour édition
     $select_loc = "";
     global $PMBuserid, $pmb_form_editables;
     if ($PMBuserid == 1 && $pmb_form_editables == 1) {
         $req_loc = "select idlocation,location_libelle from docs_location";
         $res_loc = pmb_mysql_query($req_loc);
         if (pmb_mysql_num_rows($res_loc) > 1) {
             $select_loc = "<select name='grille_location' id='grille_location' style='display:none' onChange=\"get_pos();initIt(); if (inedit) move_parse_dom(relative);\">\n";
             $select_loc .= "<option value='0'>" . $msg['notice_grille_all_location'] . "</option>\n";
             while ($r = pmb_mysql_fetch_object($res_loc)) {
                 $select_loc .= "<option value='" . $r->idlocation . "'>" . $r->location_libelle . "</option>\n";
             }
             $select_loc .= "</select>\n";
         }
     }
     $serial_bul_form = str_replace("!!location!!", $select_loc, $serial_bul_form);
     // mise à jour de l'onglet 1
     // constitution de la mention de responsabilité
     //$this->responsabilites
     $as = array_search("0", $this->b_responsabilites["responsabilites"]);
     if ($as !== FALSE && $as !== NULL) {
         $auteur_0 = $this->b_responsabilites["auteurs"][$as];
         $auteur = new auteur($auteur_0["id"]);
     }
     if ($value_deflt_fonction && $auteur_0["id"] == 0) {
         $auteur_0["fonction"] = $value_deflt_fonction;
     }
     $ptab[1] = str_replace('!!aut0_id!!', $auteur_0["id"], $ptab[1]);
     $ptab[1] = str_replace('!!aut0!!', htmlentities($auteur->display, ENT_QUOTES, $charset), $ptab[1]);
     $ptab[1] = str_replace('!!f0_code!!', $auteur_0["fonction"], $ptab[1]);
     $ptab[1] = str_replace('!!f0!!', $fonction->table[$auteur_0["fonction"]], $ptab[1]);
     $as = array_keys($this->b_responsabilites["responsabilites"], "1");
     $max_aut1 = count($as);
     if ($max_aut1 == 0) {
         $max_aut1 = 1;
     }
     for ($i = 0; $i < $max_aut1; $i++) {
         $indice = $as[$i];
         $auteur_1 = $this->b_responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_1["id"]);
         if ($value_deflt_fonction && $auteur_1["id"] == 0 && $i == 0) {
             $auteur_1["fonction"] = $value_deflt_fonction;
         }
         $ptab_aut_autres = str_replace('!!iaut!!', $i, $ptab[11]);
         $ptab_aut_autres = str_replace('!!aut1_id!!', $auteur_1["id"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut1!!', htmlentities($auteur->display, ENT_QUOTES, $charset), $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f1_code!!', $auteur_1["fonction"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f1!!', $fonction->table[$auteur_1["fonction"]], $ptab_aut_autres);
         $autres_auteurs .= $ptab_aut_autres;
     }
     $ptab[1] = str_replace('!!max_aut1!!', $max_aut1, $ptab[1]);
     $as = array_keys($this->b_responsabilites["responsabilites"], "2");
     $max_aut2 = count($as);
     if ($max_aut2 == 0) {
         $max_aut2 = 1;
     }
     for ($i = 0; $i < $max_aut2; $i++) {
         $indice = $as[$i];
         $auteur_2 = $this->b_responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_2["id"]);
         if ($value_deflt_fonction && $auteur_2["id"] == 0 && $i == 0) {
             $auteur_2["fonction"] = $value_deflt_fonction;
         }
         $ptab_aut_autres = str_replace('!!iaut!!', $i, $ptab[12]);
         $ptab_aut_autres = str_replace('!!aut2_id!!', $auteur_2["id"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut2!!', htmlentities($auteur->display, ENT_QUOTES, $charset), $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f2_code!!', $auteur_2["fonction"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f2!!', $fonction->table[$auteur_2["fonction"]], $ptab_aut_autres);
         $auteurs_secondaires .= $ptab_aut_autres;
     }
     $ptab[1] = str_replace('!!max_aut2!!', $max_aut2, $ptab[1]);
     $ptab[1] = str_replace('!!autres_auteurs!!', $autres_auteurs, $ptab[1]);
     $ptab[1] = str_replace('!!auteurs_secondaires!!', $auteurs_secondaires, $ptab[1]);
     $serial_bul_form = str_replace('!!tab1!!', $ptab[1], $serial_bul_form);
     // mise à jour de l'onglet 2
     /*$ptab[2] = str_replace('!!ed1_id!!',	$this->ed1_id	, $ptab[2]);
     		$ptab[2] = str_replace('!!ed1!!',		htmlentities($this->ed1,ENT_QUOTES, $charset)	, $ptab[2]);
     		$ptab[2] = str_replace('!!ed2_id!!',	$this->ed2_id	, $ptab[2]);
     		$ptab[2] = str_replace('!!ed2!!',		htmlentities($this->ed2,ENT_QUOTES, $charset)	, $ptab[2]);
     		
     		$serial_bul_form = str_replace('!!tab2!!', $ptab[2], $serial_bul_form);*/
     // mise à jour de l'onglet 30 (code)
     $ptab[30] = str_replace('!!cb!!', htmlentities($this->b_code, ENT_QUOTES, $charset), $ptab[30]);
     $serial_bul_form = str_replace('!!tab30!!', $ptab[30], $serial_bul_form);
     // mise à jour de l'onglet 3 (notes)
     $ptab[3] = str_replace('!!n_gen!!', htmlentities($this->b_n_gen, ENT_QUOTES, $charset), $ptab[3]);
     $ptab[3] = str_replace('!!n_contenu!!', htmlentities($this->b_n_contenu, ENT_QUOTES, $charset), $ptab[3]);
     $ptab[3] = str_replace('!!n_resume!!', htmlentities($this->b_n_resume, ENT_QUOTES, $charset), $ptab[3]);
     $serial_bul_form = str_replace('!!tab3!!', $ptab[3], $serial_bul_form);
     // mise à jour de l'onglet 4
     // catégories
     if (sizeof($this->b_categories) == 0) {
         $max_categ = 1;
     } else {
         $max_categ = sizeof($this->b_categories);
     }
     $tab_categ_order = "";
     for ($i = 0; $i < $max_categ; $i++) {
         $categ_id = $this->b_categories[$i]["categ_id"];
         $categ = new category($categ_id);
         if ($i == 0) {
             $ptab_categ = str_replace('!!icateg!!', $i, $ptab[40]);
         } else {
             $ptab_categ = str_replace('!!icateg!!', $i, $ptab[401]);
         }
         if ($thesaurus_mode_pmb && $categ->id) {
             $nom_thesaurus = '[' . $categ->thes->getLibelle() . '] ';
         } else {
             $nom_thesaurus = '';
         }
         $ptab_categ = str_replace('!!categ_id!!', $categ_id, $ptab_categ);
         $ptab_categ = str_replace('!!categ_libelle!!', htmlentities($nom_thesaurus . $categ->catalog_form, ENT_QUOTES, $charset), $ptab_categ);
         $categ_repetables .= $ptab_categ;
         if (sizeof($this->b_categories) > 0) {
             if ($tab_categ_order != "") {
                 $tab_categ_order .= ",";
             }
             $tab_categ_order .= $i;
         }
     }
     $ptab[4] = str_replace('!!max_categ!!', $max_categ, $ptab[4]);
     $ptab[4] = str_replace('!!categories_repetables!!', $categ_repetables, $ptab[4]);
     $ptab[4] = str_replace('!!tab_categ_order!!', $tab_categ_order, $ptab[4]);
     // Concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->bull_num_notice, TYPE_NOTICE);
         $ptab[4] = str_replace('!!concept_form!!', $index_concept->get_form('notice'), $ptab[4]);
     } else {
         $ptab[4] = str_replace('!!concept_form!!', "", $ptab[4]);
     }
     // indexation interne
     $ptab[4] = str_replace('!!indexint_id!!', $this->b_indexint, $ptab[4]);
     $ptab[4] = str_replace('!!indexint!!', htmlentities($this->b_indexint_lib, ENT_QUOTES, $charset), $ptab[4]);
     if ($this->indexint) {
         $indexint = new indexint($this->indexint);
         if ($indexint->comment) {
             $disp_indexint = $indexint->name . " - " . $indexint->comment;
         } else {
             $disp_indexint = $indexint->name;
         }
         if ($thesaurus_classement_mode_pmb) {
             // plusieurs classements/indexations décimales autorisés en parametrage
             if ($indexint->name_pclass) {
                 $disp_indexint = "[" . $indexint->name_pclass . "] " . $disp_indexint;
             }
         }
         $ptab[4] = str_replace('!!indexint!!', htmlentities($disp_indexint, ENT_QUOTES, $charset), $ptab[4]);
         $ptab[4] = str_replace('!!num_pclass!!', $indexint->id_pclass, $ptab[4]);
     } else {
         $ptab[4] = str_replace('!!indexint!!', '', $ptab[4]);
         $ptab[4] = str_replace('!!num_pclass!!', '', $ptab[4]);
     }
     // indexation libre
     $ptab[4] = str_replace('!!f_indexation!!', htmlentities($this->b_index_l, ENT_QUOTES, $charset), $ptab[4]);
     global $pmb_keyword_sep;
     $sep = "'{$pmb_keyword_sep}'";
     if (!$pmb_keyword_sep) {
         $sep = "' '";
     }
     if (ord($pmb_keyword_sep) == 0xa || ord($pmb_keyword_sep) == 0xd) {
         $sep = $msg['catalogue_saut_de_ligne'];
     }
     $ptab[4] = str_replace("!!sep!!", htmlentities($sep, ENT_QUOTES, $charset), $ptab[4]);
     $serial_bul_form = str_replace('!!tab4!!', $ptab[4], $serial_bul_form);
     // Collation
     $ptab[41] = str_replace("!!npages!!", htmlentities($this->b_npages, ENT_QUOTES, $charset), $ptab[41]);
     $ptab[41] = str_replace("!!ill!!", htmlentities($this->b_ill, ENT_QUOTES, $charset), $ptab[41]);
     $ptab[41] = str_replace("!!size!!", htmlentities($this->b_size, ENT_QUOTES, $charset), $ptab[41]);
     $ptab[41] = str_replace("!!accomp!!", htmlentities($this->b_accomp, ENT_QUOTES, $charset), $ptab[41]);
     $ptab[41] = str_replace("!!prix!!", htmlentities($this->b_prix, ENT_QUOTES, $charset), $ptab[41]);
     $serial_bul_form = str_replace('!!tab41!!', $ptab[41], $serial_bul_form);
     // mise à jour de l'onglet 5 : langues
     // langues répétables
     if (sizeof($this->b_langues) == 0) {
         $max_lang = 1;
     } else {
         $max_lang = sizeof($this->b_langues);
     }
     for ($i = 0; $i < $max_lang; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilang!!', $i, $ptab[501]);
         } else {
             $ptab_lang = str_replace('!!ilang!!', $i, $ptab[50]);
         }
         if (sizeof($this->b_langues) == 0) {
             $ptab_lang = str_replace('!!lang_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!lang_code!!', $this->b_langues[$i]["lang_code"], $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', htmlentities($this->b_langues[$i]["langue"], ENT_QUOTES, $charset), $ptab_lang);
         }
         $lang_repetables .= $ptab_lang;
     }
     $ptab[5] = str_replace('!!max_lang!!', $max_lang, $ptab[5]);
     $ptab[5] = str_replace('!!langues_repetables!!', $lang_repetables, $ptab[5]);
     // langues originales répétables
     if (sizeof($this->b_languesorg) == 0) {
         $max_langorg = 1;
     } else {
         $max_langorg = sizeof($this->b_languesorg);
     }
     for ($i = 0; $i < $max_langorg; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[511]);
         } else {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[51]);
         }
         if (sizeof($this->b_languesorg) == 0) {
             $ptab_lang = str_replace('!!langorg_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!langorg_code!!', $this->b_languesorg[$i]["lang_code"], $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', htmlentities($this->b_languesorg[$i]["langue"], ENT_QUOTES, $charset), $ptab_lang);
         }
         $langorg_repetables .= $ptab_lang;
     }
     $ptab[5] = str_replace('!!max_langorg!!', $max_langorg, $ptab[5]);
     $ptab[5] = str_replace('!!languesorg_repetables!!', $langorg_repetables, $ptab[5]);
     $serial_bul_form = str_replace('!!tab5!!', $ptab[5], $serial_bul_form);
     // mise à jour de l'onglet 6
     global $pmb_curl_timeout;
     $ptab[6] = str_replace('!!lien!!', htmlentities($this->b_lien, ENT_QUOTES, $charset), $ptab[6]);
     $ptab[6] = str_replace('!!eformat!!', htmlentities($this->b_eformat, ENT_QUOTES, $charset), $ptab[6]);
     $ptab[6] = str_replace('!!pmb_curl_timeout!!', $pmb_curl_timeout, $ptab[6]);
     $serial_bul_form = str_replace('!!tab6!!', $ptab[6], $serial_bul_form);
     //Mise à jour de l'onglet 7
     $p_perso = new parametres_perso("notices");
     if (!$p_perso->no_special_fields) {
         $perso_ = $p_perso->show_editable_fields($this->bull_num_notice);
         $perso = "";
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             $perso .= "<div id='move_" . $p["NAME"] . "' movable='yes' title=\"" . htmlentities($p["TITRE"], ENT_QUOTES, $charset) . "\">\n\t\t\t\t\t\t<div class='row'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . "</label></div>\n\t\t\t\t\t\t<div class='row'>" . $p["AFF"] . "</div>\n\t\t\t\t\t\t</div>";
         }
         $perso .= $perso_["CHECK_SCRIPTS"];
         $ptab[7] = str_replace("!!champs_perso!!", $perso, $ptab[7]);
     } else {
         $ptab[7] = "\n<script>function check_form() { return true; }</script>\n";
     }
     $serial_bul_form = str_replace('!!tab7!!', $ptab[7], $serial_bul_form);
     //Liens vers d'autres notices
     $string_relations = "";
     $n_rel = 0;
     foreach ($this->notice_link as $direction => $relations) {
         foreach ($relations as $relation) {
             //Selection du template
             if ($n_rel == 0) {
                 $pattern_rel = $ptab[130];
             } else {
                 $pattern_rel = $ptab[131];
             }
             //Construction du textbox
             $pattern_rel = str_replace("!!notice_relations_id!!", $relation['id_notice'], $pattern_rel);
             $pattern_rel = str_replace("!!notice_relations_libelle!!", htmlentities($relation['title_notice'], ENT_QUOTES, $charset), $pattern_rel);
             $pattern_rel = str_replace("!!notice_relations_rank!!", $relation['rank'], $pattern_rel);
             $pattern_rel = str_replace("!!n_rel!!", $n_rel, $pattern_rel);
             //Construction du combobox de type de lien
             $pattern_rel = str_replace("!!f_notice_type_relations_name!!", "f_rel_type_{$n_rel}", $pattern_rel);
             //Recuperation des types de relation
             $liste_type_relation_up = new marc_list("relationtypeup");
             $liste_type_relation_down = new marc_list("relationtypedown");
             $liste_type_relation_both = array();
             $corresp_relation_up_down = array();
             foreach ($liste_type_relation_up->table as $key_up => $val_up) {
                 foreach ($liste_type_relation_down->table as $key_down => $val_down) {
                     if ($val_up == $val_down) {
                         $liste_type_relation_both['down'][$key_down] = $val_down;
                         $liste_type_relation_both['up'][$key_up] = $val_up;
                         $corresp_relation_up_down[$key_up] = $key_down;
                         unset($liste_type_relation_down->table[$key_down]);
                         unset($liste_type_relation_up->table[$key_up]);
                     }
                 }
             }
             $opts = '';
             foreach ($liste_type_relation_up->table as $key => $val) {
                 if (preg_match('/^' . $key . '/', $relation['relation_type']) && $direction == 'up') {
                     $opts .= '<option  style="color:#000000" value="' . $key . '-up" selected="selected" >' . $val . '</option>';
                 } else {
                     $opts .= '<option  style="color:#000000" value="' . $key . '-up">' . $val . '</option>';
                 }
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_up!!", $opts, $pattern_rel);
             $opts = '';
             foreach ($liste_type_relation_down->table as $key => $val) {
                 if (preg_match('/^' . $key . '/', $relation['relation_type']) && $direction == 'down') {
                     $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
                 } else {
                     $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                 }
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_down!!", $opts, $pattern_rel);
             $opts = '';
             if (array_key_exists($relation['relation_type'], $liste_type_relation_both['up']) || array_key_exists($relation['relation_type'], $liste_type_relation_both['down'])) {
                 $opts .= '<option  style="color:#000000" value="' . $relation['relation_type'] . '-' . $direction . '" selected="selected" >' . $liste_type_relation_both[$direction][$relation['relation_type']] . '</option>';
                 if ($direction == "up") {
                     $notDirection = "down";
                 } else {
                     $notDirection = "up";
                     $corresp_relation_up_down = array_flip($corresp_relation_up_down);
                 }
                 $notRelationType = $corresp_relation_up_down[$relation['relation_type']];
                 unset($liste_type_relation_both[$direction][$relation['relation_type']]);
                 unset($liste_type_relation_both[$notDirection][$notRelationType]);
             }
             foreach ($liste_type_relation_both['down'] as $key => $val) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_both!!", $opts, $pattern_rel);
             $string_relations .= $pattern_rel;
             $n_rel++;
         }
     }
     if (!$n_rel) {
         $pattern_rel = $ptab[130];
         $pattern_rel = str_replace("!!notice_relations_id!!", "", $pattern_rel);
         $pattern_rel = str_replace("!!notice_relations_libelle!!", "", $pattern_rel);
         $pattern_rel = str_replace("!!notice_relations_rank!!", "0", $pattern_rel);
         $pattern_rel = str_replace("!!n_rel!!", $n_rel, $pattern_rel);
         $pattern_rel = str_replace("!!f_notice_type_relations_name!!", "f_rel_type_0", $pattern_rel);
         //Recuperation des types de relation
         $liste_type_relation_up = new marc_list("relationtypeup");
         $liste_type_relation_down = new marc_list("relationtypedown");
         $liste_type_relation_both = array();
         foreach ($liste_type_relation_up->table as $key_up => $val_up) {
             foreach ($liste_type_relation_down->table as $key_down => $val_down) {
                 if ($val_up == $val_down) {
                     $liste_type_relation_both[$key_down] = $val_down;
                     unset($liste_type_relation_down->table[$key_down]);
                     unset($liste_type_relation_up->table[$key_up]);
                 }
             }
         }
         $opts = '';
         foreach ($liste_type_relation_up->table as $key => $val) {
             if ($key . '-up' == $value_deflt_relation_bulletin) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-up" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-up">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_up!!", $opts, $pattern_rel);
         $opts = '';
         foreach ($liste_type_relation_down->table as $key => $val) {
             if ($key . '-down' == $value_deflt_relation_bulletin) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_down!!", $opts, $pattern_rel);
         $opts = '';
         foreach ($liste_type_relation_both as $key => $val) {
             if ($key . '-down' == $value_deflt_relation_bulletin) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_both!!", $opts, $pattern_rel);
         $string_relations .= $pattern_rel;
         $n_rel++;
     }
     //Type de relation par défaut
     $ptab[13] = str_replace("!!value_deflt_relation!!", $value_deflt_relation_bulletin, $ptab[13]);
     //Nombre de relations
     $ptab[13] = str_replace("!!max_rel!!", $n_rel, $ptab[13]);
     //Liens multiples
     $ptab[13] = str_replace("!!notice_relations!!", $string_relations, $ptab[13]);
     $serial_bul_form = str_replace('!!tab13!!', $ptab[13], $serial_bul_form);
     // champs de gestion
     $select_statut = gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "form_notice_statut", "", $this->b_statut, "", "", "", "", 0);
     $ptab[8] = str_replace('!!notice_statut!!', $select_statut, $ptab[8]);
     $ptab[8] = str_replace('!!commentaire_gestion!!', htmlentities($this->b_commentaire_gestion, ENT_QUOTES, $charset), $ptab[8]);
     $ptab[8] = str_replace('!!thumbnail_url!!', htmlentities($this->b_thumbnail_url, ENT_QUOTES, $charset), $ptab[8]);
     if ($this->b_is_new) {
         $ptab[8] = str_replace('!!checked_yes!!', "checked", $ptab[8]);
         $ptab[8] = str_replace('!!checked_no!!', "", $ptab[8]);
     } else {
         $ptab[8] = str_replace('!!checked_no!!', "checked", $ptab[8]);
         $ptab[8] = str_replace('!!checked_yes!!', "", $ptab[8]);
     }
     global $pmb_notice_img_folder_id;
     $message_folder = "";
     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);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
             if (!is_dir($rep->repertoire_path)) {
                 $notice_img_folder_error = 1;
             }
         } else {
             $notice_img_folder_error = 1;
         }
         if ($notice_img_folder_error) {
             if (SESSrights & ADMINISTRATION_AUTH) {
                 $requete = "select * from parametres where gestion=0 and type_param='pmb' and sstype_param='notice_img_folder_id' ";
                 $res = pmb_mysql_query($requete);
                 $i = 0;
                 if ($param = pmb_mysql_fetch_object($res)) {
                     $message_folder = " <a class='erreur' href='./admin.php?categ=param&action=modif&id_param=" . $param->id_param . "' >" . $msg['notice_img_folder_admin_no_access'] . "</a> ";
                 }
             } else {
                 $message_folder = $msg['notice_img_folder_no_access'];
             }
         }
     }
     $ptab[8] = str_replace('!!message_folder!!', $message_folder, $ptab[8]);
     $display_opac_bulletinage = " style='display:none' ";
     $ptab[8] = str_replace('!!display_bulletinage!!', $display_opac_bulletinage, $ptab[8]);
     //dates de la notice de bulletin
     if ($this->bulletin_id && $this->bull_num_notice && $pmb_notices_show_dates) {
         $create_date = new DateTime($this->b_notice_create_date);
         $update_date = new DateTime($this->b_notice_update_date);
         $dates_notices = "<br>\n\t\t\t\t\t\t<label for='notice_date_crea' class='etiquette'>" . $msg["noti_crea_date"] . "</label>&nbsp;" . $create_date->format('d/m/Y H:i:s') . "\n\t\t\t    \t\t<br>\n\t\t\t    \t\t<label for='notice_date_mod' class='etiquette'>" . $msg["noti_mod_date"] . "</label>&nbsp;" . $update_date->format('d/m/Y H:i:s');
         $ptab[8] = str_replace('!!dates_notice!!', $dates_notices, $ptab[8]);
     } else {
         $ptab[8] = str_replace('!!dates_notice!!', "", $ptab[8]);
     }
     $serial_bul_form = str_replace('!!tab14!!', $ptab[14], $serial_bul_form);
     //affichage des formulaires des droits d'acces
     $rights_form = $this->get_rights_form();
     $ptab[8] = str_replace('<!-- rights_form -->', $rights_form, $ptab[8]);
     global $lang, $xmlta_indexation_lang;
     $user_lang = $this->bull_indexation_lang;
     if (!$user_lang) {
         $user_lang = $xmlta_indexation_lang;
     }
     $langues = new XMLlist("{$include_path}/messages/languages.xml");
     $langues->analyser();
     $clang = $langues->table;
     $combo = "<select name='indexation_lang' id='indexation_lang' class='saisie-20em' >";
     if (!$user_lang) {
         $combo .= "<option value='' selected>--</option>";
     } else {
         $combo .= "<option value='' >--</option>";
     }
     while (list($cle, $value) = each($clang)) {
         // arabe seulement si on est en utf-8
         if ($charset != 'utf-8' and $user_lang != 'ar' or $charset == 'utf-8') {
             if (strcmp($cle, $user_lang) != 0) {
                 $combo .= "<option value='{$cle}'>{$value} ({$cle})</option>";
             } else {
                 $combo .= "<option value='{$cle}' selected>{$value} ({$cle})</option>";
             }
         }
     }
     $combo .= "</select>";
     $ptab[8] = str_replace('!!indexation_lang!!', $combo, $ptab[8]);
     $serial_bul_form = str_replace('!!tab8!!', $ptab[8], $serial_bul_form);
     // autorité personnalisées
     $authperso = new authperso_notice($this->bull_num_notice);
     $authperso_tpl = $authperso->get_form();
     $serial_bul_form = str_replace('!!authperso!!', $authperso_tpl, $serial_bul_form);
     /*if($this->serial_id) {
     			$link_annul = "./catalog.php?categ=serials&sub=view&serial_id=".$this->serial_id;
     			if ($pmb_type_audit) $link_audit =  "<input class='bouton' type='button' onClick=\"window.open('./audit.php?type_obj=1&object_id=$this->serial_id', 'audit_popup', '$select_categ_prop')\" title='$msg[audit_button]' value='$msg[audit_button]' />";
     				else $link_audit = "" ;
     		} else {
     			$link_annul = "./catalog.php?categ=serials";
     			$link_audit = "" ;
     		}*/
     //Bulletin
     if ($this->bulletin_id) {
         $link_annul = './catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=!!bul_id!!';
         $serial_bul_form = str_replace('!!form_title!!', $msg[4006], $serial_bul_form);
         $date_date_formatee = formatdate_input($this->date_date);
         if ($pmb_type_audit) {
             $link_audit = "<input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=3&object_id={$this->bulletin_id}', 'audit_popup', 700, 500, -2, -2, '{$select_categ_prop}')\" title='{$msg['audit_button']}' value='{$msg['audit_button']}' />";
         } else {
             $link_audit = "";
         }
         $link_duplicate = "<input type='button' class='bouton' value='{$msg['bulletin_duplicate_bouton']}' onclick='document.location=\"./catalog.php?categ=serials&sub=bulletinage&action=bul_duplicate&bul_id={$this->bulletin_id}\"' />";
     } else {
         $link_annul = './catalog.php?categ=serials&sub=view&serial_id=!!serial_id!!';
         $serial_bul_form = str_replace('!!form_title!!', $msg[4005], $serial_bul_form);
         $this->date_date = today();
         $date_date_formatee = "";
         $link_audit = "";
         $link_duplicate = "";
     }
     $serial_bul_form = str_replace('!!annul!!', $link_annul, $serial_bul_form);
     $serial_bul_form = str_replace('!!serial_id!!', $this->serial_id, $serial_bul_form);
     $serial_bul_form = str_replace('!!bul_id!!', $this->bulletin_id, $serial_bul_form);
     $serial_bul_form = str_replace('!!bul_titre!!', htmlentities($this->bulletin_titre, ENT_QUOTES, $charset), $serial_bul_form);
     $serial_bul_form = str_replace('!!bul_no!!', htmlentities($this->bulletin_numero, ENT_QUOTES, $charset), $serial_bul_form);
     $serial_bul_form = str_replace('!!bul_date!!', htmlentities($this->mention_date, ENT_QUOTES, $charset), $serial_bul_form);
     $serial_bul_form = str_replace('!!bul_cb!!', $this->bulletin_cb, $serial_bul_form);
     $serial_bul_form = str_replace('!!notice_id_no_replace!!', $this->bull_num_notice, $serial_bul_form);
     $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=notice&date_caller=" . str_replace('-', '', $this->date_date) . "&param1=date_date&param2=date_date_lib&auto_submit=NO&date_anterieure=YES&format_return=IN', 'date_date', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"  ";
     $date_date = "<input type='hidden' name='date_date' value='" . str_replace('-', '', $this->date_date) . "' />\n\t\t\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\t\t<input class='bouton' type='button' name='date_date_lib_bouton' value='" . $msg["bouton_calendrier"] . "' " . $date_clic . " />";
     $serial_bul_form = str_replace('!!date_date!!', $date_date, $serial_bul_form);
     $serial_bul_form = str_replace('!!link_audit!!', $link_audit, $serial_bul_form);
     $serial_bul_form = str_replace('!!link_duplicate!!', $link_duplicate, $serial_bul_form);
     //$serial_bul_form = str_replace('caller=notice',"caller=serial_bul_form",$serial_bul_form);
     //$serial_bul_form = str_replace('document.notice',"document.serial_bul_form",$serial_bul_form);
     return $serial_bul_form;
 }
function calendar($date = '')
{
    global $link_on_day, $params, $base_url, $caller, $msg, $date_caller, $format_return, $PHP_SELF;
    global $dbh;
    global $msg;
    // Default Params
    $param_d['calendar_id'] = 1;
    // Calendar ID
    $param_d['calendar_columns'] = 5;
    // Nb of columns
    $param_d['show_day'] = 1;
    // Show the day bar
    $param_d['show_month'] = 1;
    // Show the month bar
    $param_d['nav_link'] = 1;
    // Add a nav bar below
    $param_d['link_after_date'] = 0;
    // Enable link on days after the current day
    $param_d['link_before_date'] = 0;
    // Enable link on days before the current day
    $param_d['link_on_day'] = $PHP_SELF . '?date=';
    // Link to put on each day
    $param_d['font_face'] = 'Verdana, Arial, Helvetica';
    // Default font to use
    $param_d['font_size'] = 10;
    // Font size in px
    $param_d['bg_color'] = '#FFFFFF';
    $param_d['today_bg_color'] = '#A0C0C0';
    $param_d['font_today_color'] = '#990000';
    $param_d['font_color'] = '#000000';
    $param_d['font_nav_bg_color'] = '#A9B4B3';
    $param_d['font_nav_color'] = '#FFFFFF';
    $param_d['font_header_color'] = '#FFFFFF';
    $param_d['border_color'] = '#3f6551';
    $param_d['use_img'] = 1;
    // Use gif for nav bar on the bottom
    // Params
    $monthes_name = array('', $msg[1006], $msg[1007], $msg[1008], $msg[1009], $msg[1010], $msg[1011], $msg[1012], $msg[1013], $msg[1014], $msg[1015], $msg[1016], $msg[1017]);
    $days_name = array('', $msg[1018], $msg[1019], $msg[1020], $msg[1021], $msg[1022], $msg[1023], $msg[1024]);
    while (list($key, $val) = each($param_d)) {
        if (isset($params[$key])) {
            $param[$key] = $params[$key];
        } else {
            $param[$key] = $param_d[$key];
        }
    }
    $param['calendar_columns'] = $param['show_day'] ? 7 : $param['calendar_columns'];
    if ($date == '') {
        $date_MySQL = " CURDATE() ";
    } else {
        $month = substr($date, 4, 2);
        $day = substr($date, 6, 2);
        $year = substr($date, 0, 4);
        $date_MySQL = "'{$year}-{$month}-{$day}'";
    }
    $rqt_date = "select date_format(" . $date_MySQL . ", '%d') as current_day, date_format(" . $date_MySQL . ", '%m') as current_month_2, date_format(" . $date_MySQL . ", '%c') as current_month, date_format(" . $date_MySQL . ", '%Y') as current_year ";
    $resultatdate = pmb_mysql_query($rqt_date);
    $resdate = pmb_mysql_fetch_object($resultatdate);
    $current_day = $resdate->current_day;
    $current_month = $resdate->current_month;
    $current_month_2 = $resdate->current_month_2;
    $current_year = $resdate->current_year;
    $date_MySQL_firstday = "'{$year}-{$current_month_2}-01'";
    $rqt_date = "select date_format(" . $date_MySQL_firstday . ", '%w') as first_day_pos,\n\t\t\t\tdate_format(DATE_SUB(DATE_ADD(" . $date_MySQL_firstday . ", INTERVAL 1 MONTH),INTERVAL 1 DAY), '%d') as nb_days_month ";
    $resultatdate = pmb_mysql_query($rqt_date);
    $resdate = pmb_mysql_fetch_object($resultatdate);
    $first_day_pos = $resdate->first_day_pos;
    $first_day_pos = $first_day_pos == 0 ? 7 : $first_day_pos;
    $nb_days_month = $resdate->nb_days_month;
    $current_month_name = $monthes_name[$current_month];
    /* Ajout ER : détection si date en cours du calendrier correspond ou pas à la date de l'appelant 
    		Sans ce test, le lien sur tous les jours identiques d'un autre mois n'étaient pas affichés, exemple :
    			appelant avec date au 04/10/2003 >> lien du 04/11/2003 absent */
    $date_MySQL_caller = "'" . substr($date_caller, 0, 4) . "-" . substr($date_caller, 4, 2) . "-" . substr($date_caller, 6, 2) . "'";
    $rqt_date = "select date_format(" . $date_MySQL_caller . ", '%d') as current_day, date_format(" . $date_MySQL_caller . ", '%c') as current_month, date_format(" . $date_MySQL_caller . ", '%Y') as current_year ";
    $resultatdate = pmb_mysql_query($rqt_date);
    $resdate = pmb_mysql_fetch_object($resultatdate);
    $caller_day = $resdate->current_day;
    $caller_month = $resdate->current_month;
    $caller_year = $resdate->current_year;
    if ($caller_month == $current_month && $caller_year == $current_year && $caller_day == $current_day) {
        $same_date = 1;
    } else {
        $same_date = 0;
    }
    $output = '<style type="text/css">
		<!--
		.calendarNav' . $param['calendar_id'] . ' 	{  font-family: ' . $param['font_face'] . '; font-size: ' . ($param['font_size'] - 1) . 'px; font-style: normal; background-color: ' . $param['border_color'] . '}
		.calendarTop' . $param['calendar_id'] . ' 	{  font-family: ' . $param['font_face'] . '; font-size: ' . ($param['font_size'] + 1) . 'px; font-style: normal; color: ' . $param['font_header_color'] . '; font-weight: bold;  background-color: ' . $param['border_color'] . '}
		.calendarToday' . $param['calendar_id'] . ' {  font-family: ' . $param['font_face'] . '; font-size: ' . $param['font_size'] . 'px; font-weight: bold; color: ' . $param['font_today_color'] . '; background-color: ' . $param_d['today_bg_color'] . ';}
		.calendarDays' . $param['calendar_id'] . ' 	{  font-family: ' . $param['font_face'] . '; font-size: ' . $param['font_size'] . 'px; font-style: normal; color: ' . $param['font_color'] . '; background-color: ' . $param['bg_color'] . '; text-align: center}
		.calendarHeader' . $param['calendar_id'] . '{  font-family: ' . $param['font_face'] . '; font-size: ' . ($param['font_size'] - 1) . 'px; background-color: ' . $param['font_nav_bg_color'] . '; color: ' . $param['font_nav_color'] . ';}
		.calendarTable' . $param['calendar_id'] . ' {  background-color: ' . $param['border_color'] . '; border: 1px ' . $param['border_color'] . ' solid}
		-->
		</style>';
    $output .= '<TABLE border="0" width="180" class="calendarTable' . $param['calendar_id'] . '" cellpadding="2" cellspacing="1">' . "\n";
    $output .= '!!fleches!!';
    // Displaying the current month/year
    if ($param['show_month'] == 1) {
        $output .= '<TR>' . "\n";
        $output .= '	<TD colspan="' . $param['calendar_columns'] . '" align="center" class="calendarTop' . $param['calendar_id'] . '">' . "\n";
        ### Insert an img at will
        if ($param['use_img']) {
            $output .= '<IMG src="./images/mois.gif">';
        }
        $output .= '		' . $current_month_name . ' ' . $current_year . "\n";
        $output .= '	</TD>' . "\n";
        $output .= '</TR>' . "\n";
    }
    // Building the table row with the days
    if ($param['show_day'] == 1) {
        $output .= '<TR align="center">' . "\n";
        $output .= '	<TD class="calendarHeader' . $param['calendar_id'] . '"><B>' . $msg[1018] . '</B></TD>' . "\n";
        $output .= '	<TD class="calendarHeader' . $param['calendar_id'] . '"><B>' . $msg[1019] . '</B></TD>' . "\n";
        $output .= '	<TD class="calendarHeader' . $param['calendar_id'] . '"><B>' . $msg[1020] . '</B></TD>' . "\n";
        $output .= '	<TD class="calendarHeader' . $param['calendar_id'] . '"><B>' . $msg[1021] . '</B></TD>' . "\n";
        $output .= '	<TD class="calendarHeader' . $param['calendar_id'] . '"><B>' . $msg[1022] . '</B></TD>' . "\n";
        $output .= '	<TD class="calendarHeader' . $param['calendar_id'] . '"><B>' . $msg[1023] . '</B></TD>' . "\n";
        $output .= '	<TD class="calendarHeader' . $param['calendar_id'] . '"><B>' . $msg[1024] . '</B></TD>' . "\n";
        $output .= '</TR>' . "\n";
    } else {
        $first_day_pos = 1;
    }
    $output .= '<TR align="center">';
    $int_counter = 0;
    for ($i = 1; $i < $first_day_pos; $i++) {
        $output .= '<TD class="calendarDays' . $param['calendar_id'] . '">&nbsp;</TD>' . "\n";
        $int_counter++;
    }
    // Building the table
    for ($i = 1; $i <= $nb_days_month; $i++) {
        $i_2 = $i < 10 ? '0' . $i : $i;
        ### Row start
        if (($i + $first_day_pos - 1) % $param['calendar_columns'] == 1 && $i != 1) {
            $output .= '<TR align="center">' . "\n";
            $int_counter = 0;
        }
        if ($i == $current_day && $same_date == 1) {
            if ($format_return == "IN") {
                $output .= '<TD class="calendarToday' . $param['calendar_id'] . '" align="center"><A href="#" onclick="set_parent(\'' . $caller . '\', \'' . $current_year . '-' . $current_month_2 . '-' . $i_2 . '\', \'' . formatdate_input($current_year . '-' . $current_month_2 . '-' . $i_2) . '\')">' . $i . '</A></TD>' . "\n";
            } else {
                $output .= '<TD class="calendarToday' . $param['calendar_id'] . '" align="center"><A href="#" onclick="set_parent(\'' . $caller . '\', \'' . $current_year . '-' . $current_month_2 . '-' . $i_2 . '\', \'' . formatdate($current_year . '-' . $current_month_2 . '-' . $i_2) . '\')">' . $i . '</A></TD>' . "\n";
            }
        } elseif ($param['link_on_day'] != '') {
            $date_MySQL_loop = "'" . $current_year . "-" . $current_month . "-" . $i . "'";
            $rqt_date = "select case when CURDATE() < " . $date_MySQL_loop . " then 1 ELSE 0 END as test_loop ";
            $resultatdate = pmb_mysql_query($rqt_date);
            $resdate = pmb_mysql_fetch_object($resultatdate);
            $test_loop = $resdate->test_loop;
            if ($test_loop) {
                if ($param['link_after_date'] == 0) {
                    $output .= '<TD class="calendarDays' . $param['calendar_id'] . '">' . $i . '</TD>' . "\n";
                } else {
                    if ($format_return == "IN") {
                        $output .= '<TD class="calendarDays' . $param['calendar_id'] . '"><A href="#" onclick="set_parent(\'' . $caller . '\', \'' . $current_year . '-' . $current_month_2 . '-' . $i_2 . '\', \'' . formatdate_input($current_year . '-' . $current_month_2 . '-' . $i_2) . '\')">' . $i . '</A></TD>' . "\n";
                    } else {
                        $output .= '<TD class="calendarDays' . $param['calendar_id'] . '"><A href="#" onclick="set_parent(\'' . $caller . '\', \'' . $current_year . '-' . $current_month_2 . '-' . $i_2 . '\', \'' . formatdate($current_year . '-' . $current_month_2 . '-' . $i_2) . '\')">' . $i . '</A></TD>' . "\n";
                    }
                }
            } else {
                if ($param['link_before_date'] == 0) {
                    $output .= '<TD class="calendarDays' . $param['calendar_id'] . '">' . $i . '</TD>' . "\n";
                } else {
                    if ($format_return == "IN") {
                        $output .= '<TD class="calendarDays' . $param['calendar_id'] . '"><A href="#" onclick="set_parent(\'' . $caller . '\', \'' . $current_year . '-' . $current_month_2 . '-' . $i_2 . '\', \'' . formatdate_input($current_year . '-' . $current_month_2 . '-' . $i_2) . '\')">' . $i . '</A></TD>' . "\n";
                    } else {
                        $output .= '<TD class="calendarDays' . $param['calendar_id'] . '"><A href="#" onclick="set_parent(\'' . $caller . '\', \'' . $current_year . '-' . $current_month_2 . '-' . $i_2 . '\', \'' . formatdate($current_year . '-' . $current_month_2 . '-' . $i_2) . '\')">' . $i . '</A></TD>' . "\n";
                    }
                }
            }
        } else {
            $output .= '<TD class="calendarDays' . $param['calendar_id'] . '">' . $i . '</TD>' . "\n";
        }
        $int_counter++;
        // Row end
        if (($i + $first_day_pos - 1) % $param['calendar_columns'] == 0) {
            $output .= '</TR>' . "\n";
        }
    }
    $cell_missing = $param['calendar_columns'] - $int_counter;
    for ($i = 0; $i < $cell_missing; $i++) {
        $output .= '<TD class="calendarDays' . $param['calendar_id'] . '">&nbsp;</TD>' . "\n";
    }
    $output .= '</TR>' . "\n";
    // Display the nav links on the bottom of the table
    if ($param['nav_link'] == 1) {
        $date_MySQL = "'{$current_year}-{$current_month}-{$current_day}'";
        $rqt_date = "select \n\t\t\tdate_format(DATE_SUB(" . $date_MySQL . ", INTERVAL 1 YEAR),'%Y%m%d') as previous_month, \n\t\t\tdate_format(DATE_SUB(" . $date_MySQL . ", INTERVAL 1 MONTH),'%Y%m%d') as previous_day, \n\t\t\tdate_format(DATE_ADD(" . $date_MySQL . ", INTERVAL 1 YEAR),'%Y%m%d') as next_month, \n\t\t\tdate_format(DATE_ADD(" . $date_MySQL . ", INTERVAL 1 MONTH),'%Y%m%d') as next_day, \n\t\t\tcase when CURDATE() < date_format(DATE_ADD(" . $date_MySQL . ", INTERVAL 1 YEAR),'%Y%m%d') then 1 else 0 END as test_next_year, \n\t\t\tcase when CURDATE() < date_format(DATE_ADD(" . $date_MySQL . ", INTERVAL 1 MONTH),'%Y%m%d') then 1 else 0 END as test_next_month ";
        $resultatdate = pmb_mysql_query($rqt_date);
        $resdate = pmb_mysql_fetch_object($resultatdate);
        $previous_month = $resdate->previous_month;
        $next_month = $resdate->next_month;
        $previous_day = $resdate->previous_day;
        $next_day = $resdate->next_day;
        $test_next_month = $resdate->test_next_month;
        $test_next_year = $resdate->test_next_year;
        if ($param['use_img']) {
            $g = '<IMG src="./images/g.gif" border="0" title="' . $msg['calendrier_mois_prececent'] . '">';
            $gg = '<IMG src="./images/gg.gif" border="0" title="' . $msg['calendrier_annee_prececente'] . '">';
            $d = '<IMG src="./images/d.gif" border="0" title="' . $msg['calendrier_mois_suivant'] . '">';
            $dd = '<IMG src="./images/dd.gif" border="0" title="' . $msg['calendrier_annee_suivante'] . '">';
        } else {
            $g = '&lt;';
            $gg = '&lt;&lt;';
            $d = '&gt;';
            $dd = '&gt;&gt;';
        }
        if ($param['link_after_date'] == 0 && $test_next_month) {
            $next_day_link = '&nbsp;';
        } else {
            $next_day_link = '<A href="' . $base_url . '&date=' . $next_day . '">' . $d . '</A>' . "\n";
        }
        if ($param['link_after_date'] == 0 && $test_next_year) {
            $next_month_link = '&nbsp;';
        } else {
            $next_month_link = '<A href="' . $base_url . '&date=' . $next_month . '">' . $dd . '</A>' . "\n";
        }
        $output_fleches = '<TR>' . "\n";
        $output_fleches .= '	<TD colspan="' . $param['calendar_columns'] . '" class="calendarDays' . $param['calendar_id'] . '">' . "\n";
        $output_fleches .= "\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne4'>\n\t\t\t\t\t<A href='" . $base_url . "&date=" . $previous_month . "'>" . $gg . "</A>\n\t\t\t\t\t</div>\n\t\t\t\t<div class='colonne4'>\n\t\t\t\t\t<A href='" . $base_url . "&date=" . $previous_day . "'>" . $g . "</A>\n\t\t\t\t\t</div>\n\t\t\t\t<div class='colonne4'>\n\t\t\t\t\t{$next_day_link}\n\t\t\t\t\t</div>\n\t\t\t\t<div class='colonne4'>\n\t\t\t\t\t{$next_month_link}\n\t\t\t\t\t</div>\n\t\t\t</div>";
        $output_fleches .= '	</TD>' . "\n";
        $output_fleches .= '</TR>' . "\n";
    }
    $output .= '</TABLE>' . "\n";
    $output = str_replace("!!fleches!!", $output_fleches, $output);
    return $output;
}
 function get_form($action, $id_notice = 0, $retour = 'link', $article = false)
 {
     // construit le formulaire de catalogage pré-rempli
     global $msg, $dbh, $charset, $current_module;
     global $include_path;
     global $base_path;
     global $znotices_id;
     global $item;
     $fonction = new marc_list('function');
     $this->action = $action;
     include "{$include_path}/templates/z3950_form.tpl.php";
     global $bt_undo;
     // mise à jour de l'entête du formulaire
     $form_notice = str_replace('!!libelle_form!!', $this->libelle_form, $form_notice);
     // mise à jour des flags de niveau hiérarchique
     $form_notice = str_replace('!!b_level!!', $this->bibliographic_level, $form_notice);
     $form_notice = str_replace('!!h_level!!', $this->hierarchic_level, $form_notice);
     for ($i = 0; $i < 4; $i++) {
         z3950_notice::substitute("title_{$i}", $this->titles[$i], $ptab[0]);
     }
     z3950_notice::substitute("serie", $this->serie, $ptab[0]);
     z3950_notice::substitute("nbr_in_serie", $this->nbr_in_serie, $ptab[0]);
     $form_notice = str_replace('!!tab0!!', $ptab[0], $form_notice);
     // mise à jour de l'onglet 1
     // constitution de la mention de responsabilité
     $nb_autres_auteurs = 0;
     $nb_auteurs_secondaires = 0;
     //print "<pre>";print_r($this->aut_array);print "</pre>";
     for ($as = 0; $as < sizeof($this->aut_array); $as++) {
         if ($this->aut_array[$as]["responsabilite"] === 0) {
             $numrows = 0;
             if ($this->aut_array[$as]["date"]) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "' AND author_date ='" . addslashes($this->aut_array[$as]["date"]) . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if (!$numrows) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if ($numrows == 1) {
                 $existing_author = pmb_mysql_fetch_array($res);
                 $existing_author_id = $existing_author["author_id"];
             } else {
                 $existing_author_id = 0;
             }
             z3950_notice::substitute("author0_type_use_existing", $existing_author_id ? "checked" : "", $ptab[1]);
             z3950_notice::substitute("author0_type_insert_new", $existing_author_id ? "" : "checked", $ptab[1]);
             if ($existing_author_id) {
                 z3950_notice::substitute("f_author_name_0_existing", $existing_author["author_name"] . ", " . $existing_author["author_rejete"] . ($existing_author["author_date"] ? " (" . $existing_author["author_date"] . ")" : ""), $ptab[1]);
                 z3950_notice::substitute("f_aut0_existing_id", $existing_author_id, $ptab[1]);
             } else {
                 z3950_notice::substitute("f_author_name_0_existing", '', $ptab[1]);
                 z3950_notice::substitute("f_aut0_existing_id", 0, $ptab[1]);
             }
             z3950_notice::substitute("author_name_0", $this->aut_array[$as]["entree"], $ptab[1]);
             z3950_notice::substitute("author_rejete_0", $this->aut_array[$as]["rejete"], $ptab[1]);
             z3950_notice::substitute("author_date_0", $this->aut_array[$as]["date"], $ptab[1]);
             z3950_notice::substitute("author_function_0", $this->aut_array[$as]["fonction"], $ptab[1]);
             z3950_notice::substitute("author_function_label_0", $fonction->table[$this->aut_array[$as]["fonction"]], $ptab[1]);
             z3950_notice::substitute("author_lieu_0", $this->aut_array[$as]["lieu"], $ptab[1]);
             z3950_notice::substitute("author_pays_0", $this->aut_array[$as]["pays"], $ptab[1]);
             z3950_notice::substitute("author_comment_0", $this->aut_array[$as]["author_comment"], $ptab[1]);
             z3950_notice::substitute("author_ville_0", $this->aut_array[$as]["ville"], $ptab[1]);
             z3950_notice::substitute("author_subdivision_0", $this->aut_array[$as]["subdivision"], $ptab[1]);
             z3950_notice::substitute("author_numero_0", $this->aut_array[$as]["numero"], $ptab[1]);
             z3950_notice::substitute("author_web_0", $this->aut_array[$as]["web"], $ptab[1]);
             z3950_notice::substitute("authority_number_0", $this->aut_array[$as]["authority_number"], $ptab[1]);
             for ($type = 70; $type <= 72; $type++) {
                 if ($this->aut_array[$as]["type_auteur"] == $type) {
                     $sel = " selected";
                 } else {
                     $sel = "";
                 }
                 z3950_notice::substitute("author_type_" . $type . "_0", $sel, $ptab[1]);
                 if ($this->aut_array[$as]["type_auteur"] == '70') {
                     z3950_notice::substitute('display_0', 'none', $ptab[1]);
                 } else {
                     z3950_notice::substitute('display_0', '', $ptab[1]);
                 }
             }
         }
         if ($this->aut_array[$as]["responsabilite"] == 1) {
             if ($this->aut_array[$as]["entree"] == "") {
                 continue;
             }
             $ptab_aut_autres = str_replace('!!iaut!!', $nb_autres_auteurs, $ptab[11]);
             $numrows = 0;
             if ($this->aut_array[$as]["date"]) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "' AND author_date ='" . addslashes($this->aut_array[$as]["date"]) . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if (!$numrows) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if ($numrows == 1) {
                 $existing_author = pmb_mysql_fetch_array($res);
                 $existing_author_id = $existing_author["author_id"];
             } else {
                 $existing_author_id = 0;
             }
             z3950_notice::substitute("author1_type_use_existing_", $existing_author_id ? "checked" : "", $ptab_aut_autres);
             z3950_notice::substitute("author1_type_insert_new_", $existing_author_id ? "" : "checked", $ptab_aut_autres);
             if ($existing_author_id) {
                 z3950_notice::substitute("f_aut1", $existing_author["author_name"] . ", " . $existing_author["author_rejete"] . ($existing_author["author_date"] ? " (" . $existing_author["author_date"] . ")" : ""), $ptab_aut_autres);
                 z3950_notice::substitute("f_aut1_id", $existing_author_id, $ptab_aut_autres);
             } else {
                 z3950_notice::substitute("f_aut1", '', $ptab_aut_autres);
                 z3950_notice::substitute("f_aut1_id", '', $ptab_aut_autres);
             }
             z3950_notice::substitute("author_name_1", $this->aut_array[$as]["entree"], $ptab_aut_autres);
             z3950_notice::substitute("author_rejete_1", $this->aut_array[$as]["rejete"], $ptab_aut_autres);
             z3950_notice::substitute("author_date_1", $this->aut_array[$as]["date"], $ptab_aut_autres);
             z3950_notice::substitute("author_function_1", $this->aut_array[$as]["fonction"], $ptab_aut_autres);
             z3950_notice::substitute("author_function_label_1", $fonction->table[$this->aut_array[$as]["fonction"]], $ptab_aut_autres);
             z3950_notice::substitute("author_lieu_1", $this->aut_array[$as]["lieu"], $ptab_aut_autres);
             z3950_notice::substitute("author_pays_1", $this->aut_array[$as]["pays"], $ptab_aut_autres);
             z3950_notice::substitute("author_comment_1", $this->aut_array[$as]["author_comment"], $ptab_aut_autres);
             z3950_notice::substitute("author_ville_1", $this->aut_array[$as]["ville"], $ptab_aut_autres);
             z3950_notice::substitute("author_subdivision_1", $this->aut_array[$as]["subdivision"], $ptab_aut_autres);
             z3950_notice::substitute("author_numero_1", $this->aut_array[$as]["numero"], $ptab_aut_autres);
             z3950_notice::substitute("author_web_1", $this->aut_array[$as]["web"], $ptab_aut_autres);
             z3950_notice::substitute("authority_number_1", $this->aut_array[$as]["authority_number"], $ptab_aut_autres);
             for ($type = 70; $type <= 72; $type++) {
                 if ($this->aut_array[$as]["type_auteur"] == $type) {
                     $sel = " selected";
                 } else {
                     $sel = "";
                 }
                 z3950_notice::substitute("author_type_" . $type . "_1", $sel, $ptab_aut_autres);
                 if ($this->aut_array[$as]["type_auteur"] == '70') {
                     z3950_notice::substitute('display_1' . $nb_autres_auteurs, 'none', $ptab_aut_autres);
                 } else {
                     z3950_notice::substitute('display_1' . $nb_autres_auteurs, '', $ptab_aut_autres);
                 }
             }
             $autres_auteurs .= $ptab_aut_autres;
             $nb_autres_auteurs++;
         }
         if ($this->aut_array[$as]["responsabilite"] == 2) {
             if ($this->aut_array[$as]["entree"] == "") {
                 continue;
             }
             $ptab_aut_autres = str_replace('!!iaut!!', $nb_auteurs_secondaires, $ptab[12]);
             $numrows = 0;
             if ($this->aut_array[$as]["date"]) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "' AND author_date ='" . addslashes($this->aut_array[$as]["date"]) . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if (!$numrows) {
                 $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "'";
                 $res = pmb_mysql_query($sql_author_find);
                 $numrows = pmb_mysql_num_rows($res);
             }
             if ($numrows == 1) {
                 $existing_author = pmb_mysql_fetch_array($res);
                 $existing_author_id = $existing_author["author_id"];
             } else {
                 $existing_author_id = 0;
             }
             z3950_notice::substitute("author2_type_use_existing_", $existing_author_id ? "checked" : "", $ptab_aut_autres);
             z3950_notice::substitute("author2_type_insert_new_", $existing_author_id ? "" : "checked", $ptab_aut_autres);
             if ($existing_author_id) {
                 z3950_notice::substitute("f_aut2", $existing_author["author_name"] . ", " . $existing_author["author_rejete"] . ($existing_author["author_date"] ? " (" . $existing_author["author_date"] . ")" : ""), $ptab_aut_autres);
                 z3950_notice::substitute("f_aut2_id", $existing_author_id, $ptab_aut_autres);
             } else {
                 z3950_notice::substitute("f_aut2", '', $ptab_aut_autres);
                 z3950_notice::substitute("f_aut2_id", 0, $ptab_aut_autres);
             }
             z3950_notice::substitute("author_name_2", $this->aut_array[$as]["entree"], $ptab_aut_autres);
             z3950_notice::substitute("author_rejete_2", $this->aut_array[$as]["rejete"], $ptab_aut_autres);
             z3950_notice::substitute("author_date_2", $this->aut_array[$as]["date"], $ptab_aut_autres);
             z3950_notice::substitute("author_function_2", $this->aut_array[$as]["fonction"], $ptab_aut_autres);
             z3950_notice::substitute("author_function_label_2", $fonction->table[$this->aut_array[$as]["fonction"]], $ptab_aut_autres);
             z3950_notice::substitute("author_lieu_2", $this->aut_array[$as]["lieu"], $ptab_aut_autres);
             z3950_notice::substitute("author_pays_2", $this->aut_array[$as]["pays"], $ptab_aut_autres);
             z3950_notice::substitute("author_comment_2", $this->aut_array[$as]["author_comment"], $ptab_aut_autres);
             z3950_notice::substitute("author_ville_2", $this->aut_array[$as]["ville"], $ptab_aut_autres);
             z3950_notice::substitute("author_subdivision_2", $this->aut_array[$as]["subdivision"], $ptab_aut_autres);
             z3950_notice::substitute("author_numero_2", $this->aut_array[$as]["numero"], $ptab_aut_autres);
             z3950_notice::substitute("author_web_2", $this->aut_array[$as]["web"], $ptab_aut_autres);
             z3950_notice::substitute("authority_number_2", $this->aut_array[$as]["authority_number"], $ptab_aut_autres);
             for ($type = 70; $type <= 72; $type++) {
                 if ($this->aut_array[$as]["type_auteur"] == $type) {
                     $sel = " selected";
                 } else {
                     $sel = "";
                 }
                 z3950_notice::substitute("author_type_" . $type . "_2", $sel, $ptab_aut_autres);
                 if ($this->aut_array[$as]["type_auteur"] == '70') {
                     z3950_notice::substitute('display_2' . $nb_auteurs_secondaires, 'none', $ptab_aut_autres);
                 } else {
                     z3950_notice::substitute('display_2' . $nb_auteurs_secondaires, '', $ptab_aut_autres);
                 }
             }
             $auteurs_secondaires .= $ptab_aut_autres;
             $nb_auteurs_secondaires++;
         }
     }
     // au cas ou pas d'auteur principal : on fait le ménage dans le formulaire
     z3950_notice::substitute("author_name_0", "", $ptab[1]);
     z3950_notice::substitute("author_rejete_0", "", $ptab[1]);
     z3950_notice::substitute("author_date_0", "", $ptab[1]);
     z3950_notice::substitute("author_function_0", "", $ptab[1]);
     z3950_notice::substitute("author_function_label_0", "", $ptab[1]);
     z3950_notice::substitute("f_author_name_0_existing", "", $ptab[1]);
     z3950_notice::substitute("f_aut0_existing_id", "", $ptab[1]);
     z3950_notice::substitute("author0_type_use_existing", "", $ptab[1]);
     z3950_notice::substitute("author0_type_insert_new", "checked", $ptab[1]);
     z3950_notice::substitute("author_lieu_0", "", $ptab[1]);
     z3950_notice::substitute("author_pays_0", "", $ptab[1]);
     z3950_notice::substitute("author_comment_0", "", $ptab[1]);
     z3950_notice::substitute("author_ville_0", "", $ptab[1]);
     z3950_notice::substitute("author_subdivision_0", "", $ptab[1]);
     z3950_notice::substitute("author_numero_0", "", $ptab[1]);
     z3950_notice::substitute("author_web_0", "", $ptab[1]);
     z3950_notice::substitute("authority_number_0", "", $ptab[1]);
     z3950_notice::substitute('display_0', 'none', $ptab[1]);
     $ptab[1] = str_replace('!!max_aut1!!', $nb_autres_auteurs + 1, $ptab[1]);
     $ptab[1] = str_replace('!!iaut_added1!!', $nb_autres_auteurs, $ptab[1]);
     $ptab[1] = str_replace('!!max_aut2!!', $nb_auteurs_secondaires + 1, $ptab[1]);
     $ptab[1] = str_replace('!!iaut_added2!!', $nb_auteurs_secondaires, $ptab[1]);
     $ptab[1] = str_replace('!!autres_auteurs!!', $autres_auteurs, $ptab[1]);
     $ptab[1] = str_replace('!!auteurs_secondaires!!', $auteurs_secondaires, $ptab[1]);
     $form_notice = str_replace('!!tab1!!', $ptab[1], $form_notice);
     //Editeur 1
     //On tente avec toutes les infos
     if ($this->editors[0]['name'] && $this->editors[0]['ville']) {
         $sql_find_publisher = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[0]['name']) . "' AND ed_ville = '" . addslashes($this->editors[0]['ville']) . "'";
         $res = pmb_mysql_query($sql_find_publisher);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher = pmb_mysql_fetch_array($res);
             $existing_publisher_id = $existing_publisher["ed_id"];
         }
     }
     //Non? Le nom sans ville peut être alors?
     if (!$existing_publisher_id && $this->editors[0]['name']) {
         $sql_find_publisher = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[0]['name']) . "' AND ed_ville = ''";
         $res = pmb_mysql_query($sql_find_publisher);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher = pmb_mysql_fetch_array($res);
             $existing_publisher_id = $existing_publisher["ed_id"];
         }
     }
     //Juste le nom alors?
     if (!$existing_publisher_id && $this->editors[0]['name'] && !$this->editors[0]['ville']) {
         $sql_find_publisher = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[0]['name']) . "'";
         $res = pmb_mysql_query($sql_find_publisher);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher = pmb_mysql_fetch_array($res);
             $existing_publisher_id = $existing_publisher["ed_id"];
         }
     }
     if (!$existing_publisher_id) {
         $existing_publisher_id = 0;
     }
     z3950_notice::substitute("editor_type_use_existing", $existing_publisher_id ? 'checked' : '', $ptab[2]);
     z3950_notice::substitute("editor_type_insert_new", $existing_publisher_id ? '' : 'checked', $ptab[2]);
     if ($existing_publisher_id) {
         $editor = new editeur($existing_publisher_id);
         $editor_display = $editor->display;
         if (!$editor_display) {
             $info_ville = $existing_publisher["ed_ville"] ? ' (' . $existing_publisher["ed_ville"] . ')' : "";
             $editor_display = $existing_publisher["ed_name"] . $info_ville;
         }
         z3950_notice::substitute("f_ed1", $editor_display, $ptab[2]);
         z3950_notice::substitute("f_ed1_id", $existing_publisher_id, $ptab[2]);
     } else {
         z3950_notice::substitute("f_ed1", '', $ptab[2]);
         z3950_notice::substitute("f_ed1_id", '', $ptab[2]);
     }
     z3950_notice::substitute("editor_name_0", $this->editors[0]['name'], $ptab[2]);
     z3950_notice::substitute("editor_ville_0", $this->editors[0]['ville'], $ptab[2]);
     //Editeur 2
     //On tente avec toutes les infos
     if ($this->editors[1]['name'] && $this->editors[1]['ville']) {
         $sql_find_publisher2 = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[1]['name']) . "' AND ed_ville = '" . addslashes($this->editors[1]['ville']) . "'";
         $res = pmb_mysql_query($sql_find_publisher2);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher2 = pmb_mysql_fetch_array($res);
             $existing_publisher_id2 = $existing_publisher2["ed_id"];
         }
     }
     //Non? Le nom sans ville peut être alors?
     if (!$existing_publisher_id2 && $this->editors[1]['name']) {
         $sql_find_publisher2 = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[1]['name']) . "' AND ed_ville = ''";
         $res = pmb_mysql_query($sql_find_publisher2);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher2 = pmb_mysql_fetch_array($res);
             $existing_publisher_id2 = $existing_publisher2["ed_id"];
         }
     }
     //Juste le nom alors?
     if (!$existing_publisher_id2 && $this->editors[1]['name'] && !$this->editors[1]['ville']) {
         $sql_find_publisher2 = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[1]['name']) . "'";
         $res = pmb_mysql_query($sql_find_publisher2);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_publisher2 = pmb_mysql_fetch_array($res);
             $existing_publisher_id2 = $existing_publisher2["ed_id"];
         }
     }
     if (!$existing_publisher_id2) {
         $existing_publisher_id2 = 0;
     }
     z3950_notice::substitute("editor1_type_use_existing", $existing_publisher_id2 ? 'checked' : '', $ptab[2]);
     z3950_notice::substitute("editor1_type_insert_new", $existing_publisher_id2 ? '' : 'checked', $ptab[2]);
     if ($existing_publisher_id2) {
         $editor = new editeur($existing_publisher_id2);
         $editor_display = $editor->display;
         if (!$editor_display) {
             $info_ville = $existing_publisher2["ed_ville"] ? ' (' . $existing_publisher2["ed_ville"] . ')' : "";
             $editor_display = $existing_publisher2["ed_name"] . $info_ville;
         }
         z3950_notice::substitute("f_ed11", $editor_display, $ptab[2]);
         z3950_notice::substitute("f_ed11_id", $existing_publisher_id2, $ptab[2]);
     } else {
         z3950_notice::substitute("f_ed11", '', $ptab[2]);
         z3950_notice::substitute("f_ed11_id", '', $ptab[2]);
     }
     z3950_notice::substitute("editor_name_1", $this->editors[1]['name'], $ptab[2]);
     z3950_notice::substitute("editor_ville_1", $this->editors[1]['ville'], $ptab[2]);
     //Collection
     if ($existing_publisher_id && $this->collection['name']) {
         $sql_collection_find = "SELECT collection_id, collection_name FROM collections WHERE collection_name = '" . addslashes($this->collection['name']) . "' AND collection_parent = '" . $existing_publisher_id . "'";
         $res = pmb_mysql_query($sql_collection_find);
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_collection = pmb_mysql_fetch_array($res);
             $existing_collection_id = $existing_collection["collection_id"];
         } else {
             $existing_collection_id = 0;
         }
     } else {
         $existing_collection_id = 0;
     }
     z3950_notice::substitute("collection_type_use_existing", $existing_collection_id ? 'checked' : '', $ptab[2]);
     z3950_notice::substitute("collection_type_insert_new", $existing_collection_id ? '' : 'checked', $ptab[2]);
     if ($existing_collection_id) {
         z3950_notice::substitute("f_coll_existing", $existing_collection["collection_name"], $ptab[2]);
         z3950_notice::substitute("f_coll_existing_id", $existing_collection_id, $ptab[2]);
     } else {
         z3950_notice::substitute("f_coll_existing", '', $ptab[2]);
         z3950_notice::substitute("f_coll_existing_id", '0', $ptab[2]);
     }
     z3950_notice::substitute("collection_name", $this->collection['name'], $ptab[2]);
     z3950_notice::substitute("collection_issn", $this->collection['issn'], $ptab[2]);
     //Sous Collection
     if ($existing_collection_id && $this->subcollection['name']) {
         $sql_subcollection_find = "SELECT sub_coll_id, sub_coll_name FROM sub_collections WHERE sub_coll_name = '" . addslashes($this->subcollection['name']) . "' AND sub_coll_parent = '" . $existing_collection_id . "'";
         $res = pmb_mysql_query($sql_subcollection_find) or die(pmb_mysql_error() . "<br />{$sql_subcollection_find}");
         if (pmb_mysql_num_rows($res) == 1) {
             $existing_subcollection = pmb_mysql_fetch_array($res);
             $existing_subcollection_id = $existing_subcollection["sub_coll_id"];
         } else {
             $existing_subcollection_id = 0;
         }
     } else {
         $existing_subcollection_id = 0;
     }
     z3950_notice::substitute("subcollection_type_use_existing", $existing_subcollection_id ? 'checked' : '', $ptab[2]);
     z3950_notice::substitute("subcollection_type_insert_new", $existing_subcollection_id ? '' : 'checked', $ptab[2]);
     if ($existing_subcollection_id) {
         z3950_notice::substitute("f_subcoll_existing", $existing_subcollection["sub_coll_name"], $ptab[2]);
         z3950_notice::substitute("f_subcoll_existing_id", $existing_subcollection_id, $ptab[2]);
     } else {
         z3950_notice::substitute("f_subcoll_existing", '', $ptab[2]);
         z3950_notice::substitute("f_subcoll_existing_id", '0', $ptab[2]);
     }
     z3950_notice::substitute("subcollection_name", $this->subcollection['name'], $ptab[2]);
     z3950_notice::substitute("subcollection_issn", $this->subcollection['issn'], $ptab[2]);
     z3950_notice::substitute("nbr_in_collection", $this->nbr_in_collection, $ptab[2]);
     z3950_notice::substitute("year", $this->year, $ptab[2]);
     z3950_notice::substitute("mention_edition", $this->mention_edition, $ptab[2]);
     $form_notice = str_replace('!!tab2!!', $ptab[2], $form_notice);
     z3950_notice::substitute("isbn", $this->isbn, $ptab[3]);
     $form_notice = str_replace('!!tab3!!', $ptab[3], $form_notice);
     z3950_notice::substitute("page_nbr", $this->page_nbr, $ptab[4]);
     z3950_notice::substitute("illustration", $this->illustration, $ptab[4]);
     z3950_notice::substitute("prix", $this->prix, $ptab[4]);
     z3950_notice::substitute("accompagnement", $this->accompagnement, $ptab[4]);
     z3950_notice::substitute("size", $this->size, $ptab[4]);
     $form_notice = str_replace('!!tab4!!', $ptab[4], $form_notice);
     z3950_notice::substitute("general_note", $this->general_note, $ptab[5]);
     z3950_notice::substitute("content_note", $this->content_note, $ptab[5]);
     z3950_notice::substitute("abstract_note", $this->abstract_note, $ptab[5]);
     $form_notice = str_replace('!!tab5!!', $ptab[5], $form_notice);
     // indexation interne
     $pclassement_sql = "SELECT * FROM pclassement";
     $res = pmb_mysql_query($pclassement_sql);
     $pclassement_count = pmb_mysql_num_rows($res);
     if (!$pclassement_count) {
         $pclassement_count = 1;
     }
     if ($pclassement_count > 1) {
         $pclassements = array();
         while ($row = pmb_mysql_fetch_assoc($res)) {
             $pclassements[] = array("id" => $row["id_pclass"], "name" => $row["name_pclass"]);
         }
         $pclassement_combobox = '<select name="f_indexint_new_pclass">';
         foreach ($pclassements as $pclassement) {
             $pclassement_combobox .= '<option value="' . $pclassement["id"] . '">' . $pclassement["name"] . '</option>';
         }
         $pclassement_combobox .= '</select>';
     } else {
         $pclassement_combobox = "";
     }
     $ptab[6] = str_replace("!!multiple_pclass_combo_box!!", $pclassement_combobox, $ptab[6]);
     $index_int_sql = "SELECT indexint_name, indexint_comment, indexint_id, name_pclass FROM indexint LEFT JOIN pclassement ON (pclassement.id_pclass = indexint.num_pclass) WHERE indexint_name = '" . addslashes($this->dewey[0]) . "'";
     $res = pmb_mysql_query($index_int_sql, $dbh);
     $num_rows = pmb_mysql_num_rows($res);
     if ($num_rows == 1) {
         $the_row = pmb_mysql_fetch_assoc($res);
         z3950_notice::substitute("indexint", $the_row["indexint_name"] . ': ' . $the_row["indexint_comment"], $ptab[6]);
         z3950_notice::substitute("indexint_id", $the_row["indexint_id"], $ptab[6]);
         z3950_notice::substitute("indexint_type_use_existing", 'checked', $ptab[6]);
         z3950_notice::substitute("indexint_type_insert_new", '', $ptab[6]);
         z3950_notice::substitute("multiple_index_int_propositions", '', $ptab[6]);
     } else {
         if ($num_rows > 1) {
             $index_ints = array();
             while ($row = pmb_mysql_fetch_assoc($res)) {
                 $index_ints[] = array("id" => $row["indexint_id"], "name" => $row["indexint_name"], "comment" => $row["indexint_comment"], "pclass" => $row["name_pclass"]);
             }
             $form_indexint_proposition = "<ul>";
             foreach ($index_ints as $index_int) {
                 $form_indexint_proposition .= "<li><b>[" . $index_int["pclass"] . "]</b> " . $index_int["name"] . ": " . $index_int["comment"] . '&nbsp;';
                 $jsaction = "document.getElementById('indexint_type_use_existing').checked=1; document.getElementById('f_indexint').value='" . addslashes($index_int["name"] . ' - ' . $index_int["comment"]) . "'; document.getElementById('f_indexint_id').value='" . addslashes($index_int["id"]) . "'";
                 $form_indexint_proposition .= '<input type="button" class="bouton" value="' . $msg["notice_integre_indexint_use"] . '" onclick="' . $jsaction . '">';
                 $form_indexint_proposition .= '</li>';
             }
             $form_indexint_proposition .= "</ul>";
             $ptab[6] = str_replace("!!multiple_index_int_propositions!!", $form_indexint_proposition, $ptab[6]);
             z3950_notice::substitute("indexint", "", $ptab[6]);
             z3950_notice::substitute("indexint_id", "", $ptab[6]);
             z3950_notice::substitute("indexint_type_use_existing", 'checked', $ptab[6]);
             z3950_notice::substitute("indexint_type_insert_new", '', $ptab[6]);
         } else {
             z3950_notice::substitute("indexint", "", $ptab[6]);
             z3950_notice::substitute("indexint_id", "", $ptab[6]);
             z3950_notice::substitute("indexint_type_use_existing", '', $ptab[6]);
             z3950_notice::substitute("indexint_type_insert_new", 'checked', $ptab[6]);
             z3950_notice::substitute("multiple_index_int_propositions", '', $ptab[6]);
         }
     }
     z3950_notice::substitute("indexint_new_name", $this->dewey[0], $ptab[6]);
     z3950_notice::substitute("indexint_new_comment", "", $ptab[6]);
     // indexation libre
     z3950_notice::substitute("f_free_index", $this->free_index, $ptab[6]);
     global $pmb_keyword_sep;
     $sep = "'{$pmb_keyword_sep}'";
     if (!$pmb_keyword_sep) {
         $sep = "' '";
     }
     if (ord($pmb_keyword_sep) == 0xa || ord($pmb_keyword_sep) == 0xd) {
         $sep = $msg['catalogue_saut_de_ligne'];
     }
     $ptab[6] = str_replace("!!sep!!", htmlentities($sep, ENT_QUOTES, $charset), $ptab[6]);
     $form_notice = str_replace('!!tab6!!', $ptab[6], $form_notice);
     // Gestion des titres uniformes
     $nb_tu = sizeof($this->tu_500);
     for ($i = 0; $i < $nb_tu; $i++) {
         $value_tu[$i]['name'] = $this->tu_500[$i]['a'];
         $ntu_data[$i]->tu->name = $this->tu_500[$i]['a'];
         $value_tu[$i]['tonalite'] = $this->tu_500[$i]['u'];
         for ($j = 0; $j < count($this->tu_500_r[$i]); $j++) {
             $value_tu[$i]['distrib'][$j] = $this->tu_500_r[$i][$j];
         }
         for ($j = 0; $j < count($this->tu_500_s[$i]); $j++) {
             $value_tu[$i]['ref'][$j] = $this->tu_500_s[$i][$j];
         }
         if ($tu_id = titre_uniforme::import_tu_exist($value_tu, 1)) {
             // 	le titre uniforme est déjà existant
             $ntu_data[$i]->num_tu = $tu_id;
         } else {
             // le titre uniforme n'est pas existant
             for ($j = 0; $j < count($this->tu_500_n[$i]); $j++) {
                 $value_tu[$i]['comment'] .= $this->tu_500_r[$i][$j];
                 if ($j + 1 < count($this->tu_500_n[$i])) {
                     $value_tu[$i]['comment'] .= "\n";
                 }
             }
             for ($j = 0; $j < count($this->tu_500_j[$i]); $j++) {
                 $value_tu[$i]['subdiv'][$j] = $this->tu_500_j[$i][$j];
             }
         }
         // memorisation du niveau biblio de ce titre uniforme
         for ($j = 0; $j < count($this->tu_500_i[$i]); $j++) {
             $ntu_data[$i]->titre .= $this->tu_500_i[$i][$j];
             if ($j + 1 < count($this->tu_500_i[$i])) {
                 $ntu_data[$i]->titre .= "; ";
             }
         }
         $ntu_data[$i]->date = $this->tu_500[$i]['k'];
         for ($j = 0; $j < count($this->tu_500_l[$i]); $j++) {
             $ntu_data[$i]->sous_vedette .= $this->tu_500_l[$i][$j];
             if ($j + 1 < count($this->tu_500_l[$i])) {
                 $ntu_data[$i]->sous_vedette .= "; ";
             }
         }
         $ntu_data[$i]->langue = $this->tu_500[$i]['m'];
         $ntu_data[$i]->version = $this->tu_500[$i]['q'];
         $ntu_data[$i]->mention = $this->tu_500[$i]['w'];
     }
     // serialisation des champs de l'autorité titre uniforme
     global $pmb_use_uniform_title;
     if ($pmb_use_uniform_title) {
         $memo_value_tu = "<input type='hidden' name='memo_value_tu' value=\"" . rawurlencode(serialize($value_tu)) . "\">";
         $ptab[230] = str_replace("!!titres_uniformes!!", $memo_value_tu . tu_notice::get_form_import("notice", $ntu_data), $ptab[230]);
         $form_notice = str_replace('!!tab230!!', $ptab[230], $form_notice);
     }
     // mise à jour de l'onglet 7 : langues
     // langues répétables
     $lang = new marc_list('lang');
     if (sizeof($this->language_code) == 0) {
         $max_lang = 1;
     } else {
         $max_lang = sizeof($this->language_code);
     }
     for ($i = 0; $i < $max_lang; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilang!!', $i, $ptab[701]);
         } else {
             $ptab_lang = str_replace('!!ilang!!', $i, $ptab[70]);
         }
         if (sizeof($this->language_code) == 0) {
             $ptab_lang = str_replace('!!lang_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!lang_code!!', $this->language_code[$i], $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', htmlentities($lang->table[$this->language_code[$i]], ENT_QUOTES, $charset), $ptab_lang);
         }
         $lang_repetables .= $ptab_lang;
     }
     $ptab[7] = str_replace('!!max_lang!!', $max_lang, $ptab[7]);
     $ptab[7] = str_replace('!!langues_repetables!!', $lang_repetables, $ptab[7]);
     // langues originales répétables
     if (sizeof($this->original_language_code) == 0) {
         $max_langorg = 1;
     } else {
         $max_langorg = sizeof($this->original_language_code);
     }
     for ($i = 0; $i < $max_langorg; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[711]);
         } else {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[71]);
         }
         if (sizeof($this->original_language_code) == 0) {
             $ptab_lang = str_replace('!!langorg_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!langorg_code!!', $this->original_language_code[$i], $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', htmlentities($lang->table[$this->original_language_code[$i]], ENT_QUOTES, $charset), $ptab_lang);
         }
         $langorg_repetables .= $ptab_lang;
     }
     $ptab[7] = str_replace('!!max_langorg!!', $max_langorg, $ptab[7]);
     $ptab[7] = str_replace('!!languesorg_repetables!!', $langorg_repetables, $ptab[7]);
     $form_notice = str_replace('!!tab7!!', $ptab[7], $form_notice);
     z3950_notice::substitute("link_url", $this->link_url, $ptab[8]);
     z3950_notice::substitute("link_format", $this->link_format, $ptab[8]);
     $form_notice = str_replace('!!tab8!!', $ptab[8], $form_notice);
     // définition de la page cible du form
     $form_notice = str_replace('!!action!!', $this->action, $form_notice);
     // ajout des selecteurs
     $select_doc = new marc_select('doctype', 'typdoc', $this->document_type);
     $form_notice = str_replace('!!document_type!!', $select_doc->display, $form_notice);
     if ($article) {
         $form_notice = str_replace('!!checked_mono!!', "", $form_notice);
         $form_notice = str_replace('!!checked_perio!!', "", $form_notice);
         $form_notice = str_replace('!!checked_art!!', "selected=\"selected\"", $form_notice);
     } else {
         if ($this->bibliographic_level == 's') {
             $form_notice = str_replace('!!checked_mono!!', "", $form_notice);
             $form_notice = str_replace('!!checked_perio!!', "selected=\"selected\"", $form_notice);
             $form_notice = str_replace('!!checked_art!!', "", $form_notice);
         } else {
             $form_notice = str_replace('!!checked_mono!!', "selected=\"selected\"", $form_notice);
             $form_notice = str_replace('!!checked_perio!!', "", $form_notice);
             $form_notice = str_replace('!!checked_art!!', "", $form_notice);
         }
     }
     //Zone des perios et des bulletins pour les articles
     $zone_article_form = str_replace("!!perio_titre!!", $this->perio_titre[0], $zone_article_form);
     $zone_article_form = str_replace("!!perio_issn!!", $this->perio_issn[0], $zone_article_form);
     $zone_article_form = str_replace("!!bull_date!!", $this->bull_mention[0], $zone_article_form);
     $zone_article_form = str_replace("!!bull_titre!!", $this->bull_titre[0], $zone_article_form);
     $zone_article_form = str_replace("!!bull_num!!", $this->bull_num[0], $zone_article_form);
     if ($this->bull_date[0]) {
         $date_date_formatee = formatdate_input($this->bull_date[0]);
         $date_date_hid = $this->bull_date[0];
     } else {
         $date_date_formatee = '';
         $date_date_hid = '';
     }
     $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=notice&date_caller=&param1=f_bull_new_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' id='f_bull_new_date' name='f_bull_new_date' value='{$date_date_hid}' />\n\t\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\t<input class='bouton' type='button' name='date_date_lib_bouton' value='" . $msg["bouton_calendrier"] . "' " . $date_clic . " />";
     $zone_article_form = str_replace("!!date_date!!", $date_date, $zone_article_form);
     //On cherche si le perio existe
     if ($this->perio_titre[0] && $this->perio_issn[0]) {
         $req = "select notice_id, tit1 from notices where niveau_biblio='s' and niveau_hierar='1' \n\t\t\t\t\tand tit1='" . addslashes($this->perio_titre[0]) . "'\n\t\t\t\t\tand code='" . addslashes($this->perio_issn[0]) . "' limit 1";
         $res_perio = pmb_mysql_query($req, $dbh);
         $num_rows_perio = pmb_mysql_num_rows($res_perio);
     }
     if (!$num_rows_perio) {
         if ($this->perio_titre[0]) {
             $req = "select notice_id, tit1 from notices where niveau_biblio='s' and niveau_hierar='1' \n\t\t\t\t\tand tit1='" . addslashes($this->perio_titre[0]) . "'\n\t\t\t\t\tlimit 1";
             $res_perio = pmb_mysql_query($req, $dbh);
             $num_rows_perio = pmb_mysql_num_rows($res_perio);
         }
     }
     if (!$num_rows_perio) {
         if ($this->perio_issn[0]) {
             $req = "select notice_id, tit1 from notices where niveau_biblio='s' and niveau_hierar='1' \n\t\t\t\t\t\tand code='" . addslashes($this->perio_issn[0]) . "' limit 1";
             $res_perio = pmb_mysql_query($req, $dbh);
             $num_rows_perio = pmb_mysql_num_rows($res_perio);
         }
     }
     if ($num_rows_perio == 1) {
         $perio_found = pmb_mysql_fetch_object($res_perio);
         $idperio = $perio_found->notice_id;
         $zone_article_form = str_replace("!!f_perio_existing!!", htmlentities($perio_found->tit1, ENT_QUOTES, $charset), $zone_article_form);
         $zone_article_form = str_replace("!!f_perio_existing_id!!", $perio_found->notice_id, $zone_article_form);
         $zone_article_form = str_replace("!!perio_type_new!!", "", $zone_article_form);
         $zone_article_form = str_replace("!!perio_type_use_existing!!", "checked", $zone_article_form);
     } else {
         $idperio = 0;
         $zone_article_form = str_replace("!!f_perio_existing!!", "", $zone_article_form);
         $zone_article_form = str_replace("!!f_perio_existing_id!!", "", $zone_article_form);
         $zone_article_form = str_replace("!!perio_type_new!!", "checked", $zone_article_form);
         $zone_article_form = str_replace("!!perio_type_use_existing!!", "", $zone_article_form);
     }
     //On cherche si le bulletin existe
     $num_rows_bull = 0;
     if ($this->bull_num[0] && $idperio) {
         $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and  bulletin_numero like '%" . addslashes($this->bull_num[0]) . "%' ";
         $res_bull = pmb_mysql_query($req, $dbh);
         $num_rows_bull = pmb_mysql_num_rows($res_bull);
     }
     if (!$num_rows_bull && $this->bull_date[0] && $idperio) {
         $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and date_date='" . addslashes($this->bull_date[0]) . "' ";
         $res_bull = pmb_mysql_query($req, $dbh);
         $num_rows_bull = pmb_mysql_num_rows($res_bull);
     } elseif ($num_rows_bull > 1 && $this->bull_date[0] && $idperio) {
         $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and date_date='" . addslashes($this->bull_date[0]) . "' and  bulletin_numero like '%" . addslashes($this->bull_num[0]) . "%' ";
         $res_bull = pmb_mysql_query($req, $dbh);
         $num_rows_bull = pmb_mysql_num_rows($res_bull);
     }
     if (!$num_rows_bull && $this->bull_mention[0] && $idperio) {
         $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and mention_date='" . addslashes($this->bull_mention[0]) . "' ";
         $res_bull = pmb_mysql_query($req, $dbh);
         $num_rows_bull = pmb_mysql_num_rows($res_bull);
     } elseif ($num_rows_bull > 1 && $this->bull_mention[0] && $idperio) {
         if ($this->bull_date[0]) {
             $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and date_date='" . addslashes($this->bull_date[0]) . "' and mention_date='" . addslashes($this->bull_mention[0]) . "' ";
         } else {
             $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and mention_date='" . addslashes($this->bull_mention[0]) . "' and  bulletin_numero like '%" . addslashes($this->bull_num[0]) . "%' ";
         }
         $res_bull = pmb_mysql_query($req, $dbh);
         $num_rows_bull = pmb_mysql_num_rows($res_bull);
     }
     if ($num_rows_bull) {
         $bull_found = pmb_mysql_fetch_object($res_bull);
         $f_bull_existing = trim($bull_found->bulletin_numero);
         if (!$f_bull_existing && trim($bull_found->date_date)) {
             $f_bull_existing = "[" . trim($bull_found->date_date) . "]";
         } elseif (!$f_bull_existing && trim($bull_found->mention_date)) {
             $f_bull_existing = "(" . trim($bull_found->mention_date) . ")";
         }
         $zone_article_form = str_replace("!!f_bull_existing!!", htmlentities($f_bull_existing, ENT_QUOTES, $charset), $zone_article_form);
         $zone_article_form = str_replace("!!f_bull_existing_id!!", $bull_found->bulletin_id, $zone_article_form);
         $zone_article_form = str_replace("!!bull_type_new!!", $num_rows_bull ? '' : "checked='checked'", $zone_article_form);
         $zone_article_form = str_replace("!!bull_type_use_existing!!", $num_rows_bull ? "checked='checked'" : '', $zone_article_form);
     } else {
         $zone_article_form = str_replace("!!f_bull_existing!!", "", $zone_article_form);
         $zone_article_form = str_replace("!!f_bull_existing_id!!", "", $zone_article_form);
         $zone_article_form = str_replace("!!bull_type_new!!", "checked='checked'", $zone_article_form);
         $zone_article_form = str_replace("!!bull_type_use_existing!!", "", $zone_article_form);
     }
     $form_notice = str_replace("!!zone_article!!", $zone_article_form, $form_notice);
     if ($article) {
         $form_notice = str_replace("!!display_zone_article!!", "", $form_notice);
     } else {
         $form_notice = str_replace("!!display_zone_article!!", "none", $form_notice);
     }
     if ($item) {
         $form_notice = str_replace('!!notice_entrepot!!', "<input type='hidden' name='item' value='{$item}' />", $form_notice);
     } else {
         $form_notice = str_replace('!!notice_entrepot!!', "", $form_notice);
     }
     $form_notice = str_replace('!!orinot_nom!!', $this->origine_notice[nom], $form_notice);
     $form_notice = str_replace('!!orinot_pays!!', $this->origine_notice[pays], $form_notice);
     //Traitement du 503 "titre de forme" pour le Musée des beaux arts de Nantes
     global $tableau_503;
     $tableau_503 = array("info_503" => $this->info_503, "info_503_d" => $this->info_503_d, "info_503_j" => $this->info_503_j);
     // traitement des catégories : affichage dans le formulaire
     $tableau_600 = array("info_600_3" => $this->info_600_3, "info_600_a" => $this->info_600_a, "info_600_b" => $this->info_600_b, "info_600_c" => $this->info_600_c, "info_600_d" => $this->info_600_d, "info_600_f" => $this->info_600_f, "info_600_g" => $this->info_600_g, "info_600_j" => $this->info_600_j, "info_600_p" => $this->info_600_p, "info_600_t" => $this->info_600_t, "info_600_x" => $this->info_600_x, "info_600_y" => $this->info_600_y, "info_600_z" => $this->info_600_z);
     $tableau_601 = array("info_601_3" => $this->info_601_3, "info_601_a" => $this->info_601_a, "info_601_b" => $this->info_601_b, "info_601_c" => $this->info_601_c, "info_601_d" => $this->info_601_d, "info_601_e" => $this->info_601_e, "info_601_f" => $this->info_601_f, "info_601_g" => $this->info_601_g, "info_601_h" => $this->info_601_h, "info_601_j" => $this->info_601_j, "info_601_t" => $this->info_601_t, "info_601_x" => $this->info_601_x, "info_601_y" => $this->info_601_y, "info_601_z" => $this->info_601_z);
     $tableau_602 = array("info_602_3" => $this->info_602_3, "info_602_a" => $this->info_602_a, "info_602_f" => $this->info_602_f, "info_602_j" => $this->info_602_j, "info_602_t" => $this->info_602_t, "info_602_x" => $this->info_602_x, "info_602_y" => $this->info_602_y, "info_602_z" => $this->info_602_z);
     $tableau_604 = array("info_604_3" => $this->info_604_3, "info_604_a" => $this->info_604_a, "info_604_h" => $this->info_604_h, "info_604_i" => $this->info_604_i, "info_604_j" => $this->info_604_j, "info_604_k" => $this->info_604_k, "info_604_l" => $this->info_604_l, "info_604_x" => $this->info_604_x, "info_604_y" => $this->info_604_y, "info_604_z" => $this->info_604_z);
     $tableau_605 = array("info_605_3" => $this->info_605_3, "info_605_a" => $this->info_605_a, "info_605_h" => $this->info_605_h, "info_605_i" => $this->info_605_i, "info_605_k" => $this->info_605_k, "info_605_l" => $this->info_605_l, "info_605_m" => $this->info_605_m, "info_605_n" => $this->info_605_n, "info_605_q" => $this->info_605_q, "info_605_r" => $this->info_605_r, "info_605_s" => $this->info_605_s, "info_605_u" => $this->info_605_u, "info_605_w" => $this->info_605_w, "info_605_j" => $this->info_605_j, "info_605_x" => $this->info_605_x, "info_605_y" => $this->info_605_y, "info_605_z" => $this->info_605_z);
     $tableau_606 = array("info_606_3" => $this->info_606_3, "info_606_a" => $this->info_606_a, "info_606_j" => $this->info_606_j, "info_606_x" => $this->info_606_x, "info_606_y" => $this->info_606_y, "info_606_z" => $this->info_606_z);
     $tableau_607 = array("info_607_3" => $this->info_607_3, "info_607_a" => $this->info_607_a, "info_607_j" => $this->info_607_j, "info_607_x" => $this->info_607_x, "info_607_y" => $this->info_607_y, "info_607_z" => $this->info_607_z);
     $tableau_608 = array("info_608_3" => $this->info_608_3, "info_608_a" => $this->info_608_a, "info_608_j" => $this->info_608_j, "info_608_x" => $this->info_608_x, "info_608_y" => $this->info_608_y, "info_608_z" => $this->info_608_z);
     // catégories
     $max_categ = 1;
     $ptab_categ = str_replace('!!icateg!!', 0, $ptab[60]);
     $ptab_categ = str_replace('!!categ_id!!', 0, $ptab_categ);
     $ptab_categ = str_replace('!!categ_libelle!!', '', $ptab_categ);
     $ptab[6] = str_replace("!!categories_repetables!!", $ptab_categ, $ptab[6]);
     $ptab[6] = str_replace('!!tab_categ_order!!', "", $ptab[6]);
     $traitement_rameau = traite_categories_for_form($tableau_600, $tableau_601, $tableau_602, $tableau_605, $tableau_606, $tableau_607, $tableau_608);
     if (!is_array($traitement_rameau)) {
         $traitement_rameau = array("form" => $traitement_rameau, "message" => "");
     }
     $form_notice = str_replace('!!message_rameau!!', $traitement_rameau["message"], $form_notice);
     $form_notice = str_replace('!!traitement_rameau!!', $traitement_rameau["form"], $form_notice);
     $manual_categorisation_form = get_manual_categorisation_form($tableau_600, $tableau_601, $tableau_602, $tableau_604, $tableau_605, $tableau_606, $tableau_607, $tableau_608);
     $form_notice = str_replace('!!manual_categorisation!!', $manual_categorisation_form, $form_notice);
     //Mise à jour de l'onglet 9
     $p_perso = new parametres_perso("notices");
     if (function_exists("param_perso_form")) {
         param_perso_form($p_perso);
     }
     //pour Pubmed et DOI, on regarde si on peut remplir un champ résolveur...
     if (count($this->others_ids) > 0) {
         foreach ($p_perso->t_fields as $key => $t_field) {
             if ($t_field['TYPE'] == "resolve") {
                 $field_options = _parser_text_no_function_("<?xml version='1.0' encoding='" . $charset . "'?>\n" . $t_field['OPTIONS'], "OPTIONS");
                 foreach ($field_options['RESOLVE'] as $resolve) {
                     //pubmed = 1 | DOI = 2
                     foreach ($this->others_ids as $other_id) {
                         if ($other_id['b'] == "PMID" && $resolve['ID'] == "1") {
                             //on a le champ perso résolveur PubMed
                             $p_perso->values[$key][] = $other_id['a'] . "|1";
                         } else {
                             if ($other_id['b'] == "DOI" && $resolve['ID'] == "2") {
                                 //on a le champ perso résolveur DOI
                                 $p_perso->values[$key][] = $other_id['a'] . "|2";
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$p_perso->no_special_fields) {
         $perso_ = $p_perso->show_editable_fields($id_notice, true);
         $perso = "";
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             $perso .= "<div class='row'>\n\t\t\t\t\t<label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . " </label>" . $p["COMMENT_DISPLAY"] . "\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='row'>\n\t\t\t\t\t" . $p["AFF"] . "\n\t\t\t\t\t</div>\n\t\t\t\t\t";
         }
         $perso .= $perso_["CHECK_SCRIPTS"];
         $ptab[9] = str_replace("!!champs_perso!!", $perso, $ptab[9]);
     } else {
         $ptab[9] = "\n<script type='text/javascript' >function check_form() { return true; }</script>\n";
     }
     $form_notice = str_replace('!!tab9!!', $ptab[9], $form_notice);
     // champs de gestion
     global $pmb_notice_img_folder_id;
     $message_folder = "";
     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);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
             if (!is_dir($rep->repertoire_path)) {
                 $notice_img_folder_error = 1;
             }
         } else {
             $notice_img_folder_error = 1;
         }
         if ($notice_img_folder_error) {
             if (SESSrights & ADMINISTRATION_AUTH) {
                 $requete = "select * from parametres where gestion=0 and type_param='pmb' and sstype_param='notice_img_folder_id' ";
                 $res = pmb_mysql_query($requete);
                 $i = 0;
                 if ($param = pmb_mysql_fetch_object($res)) {
                     $message_folder = " <a class='erreur' href='./admin.php?categ=param&action=modif&id_param=" . $param->id_param . "' >" . $msg['notice_img_folder_admin_no_access'] . "</a> ";
                 }
             } else {
                 $message_folder = $msg['notice_img_folder_no_access'];
             }
         }
     }
     $ptab[10] = str_replace('!!message_folder!!', $message_folder, $ptab[10]);
     // langue de la notice
     global $lang, $xmlta_indexation_lang;
     $user_lang = $this->indexation_lang;
     if (!$user_lang) {
         $user_lang = $xmlta_indexation_lang;
     }
     //	if(!$user_lang) $user_lang="fr_FR";
     $langues = new XMLlist("{$include_path}/messages/languages.xml");
     $langues->analyser();
     $clang = $langues->table;
     $combo = "<select name='indexation_lang' id='indexation_lang' class='saisie-20em' >";
     if (!$user_lang) {
         $combo .= "<option value='' selected>--</option>";
     } else {
         $combo .= "<option value='' >--</option>";
     }
     while (list($cle, $value) = each($clang)) {
         // arabe seulement si on est en utf-8
         if ($charset != 'utf-8' and $user_lang != 'ar' or $charset == 'utf-8') {
             if (strcmp($cle, $user_lang) != 0) {
                 $combo .= "<option value='{$cle}'>{$value} ({$cle})</option>";
             } else {
                 $combo .= "<option value='{$cle}' selected>{$value} ({$cle})</option>";
             }
         }
     }
     $combo .= "</select>";
     $ptab[10] = str_replace('!!indexation_lang!!', $combo, $ptab[10]);
     $form_notice = str_replace('!!indexation_lang_sel!!', $user_lang, $form_notice);
     global $deflt_integration_notice_statut;
     if ($id_notice) {
         $rqt_statut = "select statut from notices where notice_id='{$id_notice}' ";
         $res_statut = pmb_mysql_query($rqt_statut);
         $stat = pmb_mysql_fetch_object($res_statut);
         $select_statut = gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "form_notice_statut", "", $stat->statut, "", "", "", "", 0);
     } else {
         $select_statut = gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "form_notice_statut", "", $deflt_integration_notice_statut, "", "", "", "", 0);
     }
     $ptab[10] = str_replace('!!notice_statut!!', $select_statut, $ptab[10]);
     $ptab[10] = str_replace('!!commentaire_gestion!!', htmlentities($this->commentaire_gestion, ENT_QUOTES, $charset), $ptab[10]);
     $ptab[10] = str_replace('!!thumbnail_url!!', htmlentities($this->thumbnail_url, ENT_QUOTES, $charset), $ptab[10]);
     $form_notice = str_replace('!!tab10!!', $ptab[10], $form_notice);
     // Documents Numériques
     $docnum_infos = "";
     $count = 0;
     $upload_doc_num = "";
     if ($this->source_id) {
         $requete = "select * from connectors_sources where source_id=" . $this->source_id . "";
         $resultat = pmb_mysql_query($requete);
         if (pmb_mysql_num_rows($resultat)) {
             $r = pmb_mysql_fetch_object($resultat);
             if (!$r->upload_doc_num) {
                 $upload_doc_num = "checked";
             }
         }
     }
     if (count($this->doc_nums)) {
         global $deflt_explnum_statut;
         $statutlist = gen_liste_multiple("select id_explnum_statut, gestion_libelle from explnum_statut order by 2", "id_explnum_statut", "gestion_libelle", "id_explnum_statut", "doc_num_statut!!docnumid!!", "", $deflt_explnum_statut, "", "", "", "", 0);
         foreach ($this->doc_nums as $doc_num) {
             $docnum_info = $ptab[1111];
             // 				$alink = '<a target="_blank" href="'.htmlspecialchars($doc_num["a"]).'">'.htmlspecialchars($doc_num["a"]).'</a>';
             $docnum_info = str_replace('!!docnum_url!!', htmlspecialchars($doc_num["a"], ENT_QUOTES, $charset), $docnum_info);
             $docnum_info = str_replace('!!docnum_caption!!', htmlspecialchars($doc_num["b"], ENT_QUOTES, $charset), $docnum_info);
             $docnum_info = str_replace('!!docnum_filename!!', htmlspecialchars($doc_num["f"], ENT_QUOTES, $charset), $docnum_info);
             $docnum_info = str_replace('!!docnum_statutlist!!', $statutlist, $docnum_info);
             $docnum_info = str_replace('!!docnumid!!', $count, $docnum_info);
             $docnum_info = str_replace('!!upload_doc_num!!', $upload_doc_num, $docnum_info);
             $docnum_infos .= $docnum_info;
             $count++;
         }
     }
     if (!$docnum_infos) {
         $docnum_infos = $msg["noticeintegre_nodocnum"];
     }
     $ptab[1110] = str_replace('!!docnum_count!!', $count, $ptab[1110]);
     $ptab[1110] = str_replace('!!docnums!!', $docnum_infos, $ptab[1110]);
     $form_notice = str_replace('!!tab11!!', $ptab[1110], $form_notice);
     $aac = explode('&', $action);
     $retact = '&' . $aac[2] . '&' . $aac[5] . '&' . $aac[6];
     global $force;
     $retares = '';
     switch ($retour) {
         case 'button':
             if ($this->message_retour) {
                 $retares = "<input type='button' class='bouton' onclick='history.go(-1);' value='" . $this->message_retour . "' />";
             } else {
                 if ($force == 1) {
                     $retares = "<a href='javascript:history.go(-2);'>" . $msg['z3950_retour_a_resultats'] . "</a>";
                 } else {
                     $retares = "<a href='javascript:history.go(-1);'>" . $msg['z3950_retour_a_resultats'] . "</a>";
                 }
             }
             break;
         case 'link':
             $retares = "<a href='./catalog.php?categ=z3950&action=display" . $retact . "'>" . $msg['z3950_retour_a_resultats'] . "</a>";
             break;
         default:
             break;
     }
     $form_notice = str_replace('!!retour_a_resultats!!', $retares, $form_notice);
     if (!$this->bt_integr_value) {
         if (!$id_notice) {
             $form_notice = str_replace('!!bouton_integration!!', $msg['z3950_integr_not_seule'], $form_notice);
         } else {
             $form_notice = str_replace('!!bouton_integration!!', $msg['notice_z3950_remplace_catal'], $form_notice);
         }
     } else {
         $form_notice = str_replace('!!bouton_integration!!', $this->bt_integr_value, $form_notice);
     }
     if ($this->bt_undo_value && $this->bt_undo_action) {
         $bt_undo = str_replace('!!value!!', $this->bt_undo_value, $bt_undo);
         $bt_undo = str_replace('!!action!!', $this->bt_undo_action, $bt_undo);
         $form_notice = str_replace('<!-- bt_undo -->', $bt_undo, $form_notice);
     }
     $form_notice = str_replace('!!id_notice!!', $id_notice, $form_notice);
     $form_notice = str_replace('!!notice!!', $znotices_id, $form_notice);
     $form_notice = str_replace('!!notice_type!!', $this->notice_type, $form_notice);
     return $form_notice;
 }
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;
}