Exemple #1
0
function import_new_notice_suite()
{
    global $dbh;
    global $notice_id;
    global $info_464;
    global $info_606_a;
    global $info_900, $info_901, $info_902, $info_903, $info_904, $info_905, $info_906;
    global $pmb_keyword_sep;
    global $bulletin_ex;
    //Cas des périodiques
    if (is_array($info_464)) {
        $requete = "select * from notices where notice_id={$notice_id}";
        $resultat = mysql_query($requete);
        $r = mysql_fetch_object($resultat);
        //Notice chapeau existe-t-elle ?
        $requete = "select notice_id from notices where tit1='" . addslashes($info_464[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'";
        $resultat = mysql_query($requete);
        if (@mysql_num_rows($resultat)) {
            //Si oui, récupération id
            $chapeau_id = mysql_result($resultat, 0, 0);
            //Bulletin existe-t-il ?
            $requete = "select bulletin_id from bulletins where bulletin_numero='" . addslashes($info_464[0]['v']) . "' and  mention_date='" . addslashes($info_464[0]['d']) . "' and bulletin_notice={$chapeau_id}";
            $resultat = mysql_query($requete);
            if (@mysql_num_rows($resultat)) {
                //Si oui, récupération id bulletin
                $bulletin_id = mysql_result($resultat, 0, 0);
            } else {
                //Si non, création bulltin
                $info = array();
                $bulletin = new bulletinage("", $chapeau_id);
                $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']);
                $info['bul_no'] = addslashes($info_464[0]['v']);
                $info['bul_date'] = addslashes($info_464[0]['d']);
                if (!$info_464[0]['e']) {
                    if ($info_904[0]) {
                        $info['date_date'] = $info_904[0];
                    }
                } else {
                    $info['date_date'] = $info_464[0]['e'];
                }
                $bulletin_id = $bulletin->update($info);
            }
        } else {
            //Si non, création notice chapeau et bulletin
            $chapeau = new serial();
            $info = array();
            $info['tit1'] = addslashes($info_464[0]['t']);
            $info['niveau_biblio'] = 's';
            $info['niveau_hierar'] = '1';
            $info['typdoc'] = $r->typdoc;
            $chapeau->update($info);
            $chapeau_id = $chapeau->serial_id;
            $bulletin = new bulletinage("", $chapeau_id);
            $info = array();
            $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']);
            $info['bul_no'] = addslashes($info_464[0]['v']);
            $info['bul_date'] = addslashes($info_464[0]['d']);
            if (!$info_464[0]['e']) {
                if ($info_904[0]) {
                    $info['date_date'] = $info_904[0];
                }
            } else {
                $info['date_date'] = $info_464[0]['e'];
            }
            $bulletin_id = $bulletin->update($info);
        }
        //Notice objet ?
        if ($info_464[0]['z'] == 'objet') {
            //Supression de la notice
            $requete = "delete from notices where notice_id={$notice_id}";
            mysql_query($requete);
            $bulletin_ex = $bulletin_id;
        } else {
            //Passage de la notice en article
            $requete = "update notices set niveau_biblio='a', niveau_hierar='2', year='" . addslashes($info_464[0]['d']) . "', npages='" . addslashes($info_464[0]['p']) . "', date_parution='" . $info['date_date'] . "' where notice_id={$notice_id}";
            mysql_query($requete);
            $requete = "insert into analysis (analysis_bulletin,analysis_notice) values({$bulletin_id},{$notice_id})";
            mysql_query($requete);
            $bulletin_ex = $bulletin_id;
        }
    } else {
        $bulletin_ex = 0;
    }
    //Traitement du thésaurus
    $unknown_desc = array();
    $ordre_categ = 0;
    for ($i = 0; $i < count($info_606_a); $i++) {
        for ($j = 0; $j < count($info_606_a[$i]); $j++) {
            $descripteur = trim($info_606_a[$i][$j]);
            //Recherche du terme
            $requete = "SELECT id_noeud,num_renvoi_voir from noeuds JOIN categories ON (noeuds.id_noeud = categories.num_noeud) where categories.libelle_categorie = '" . addslashes($descripteur) . "' ";
            $resultat = mysql_query($requete);
            if (mysql_num_rows($resultat) == 1) {
                $categ_id = mysql_result($resultat, 0, 0);
                if (mysql_result($resultat, 0, 1)) {
                    $categ_id = mysql_result($resultat, 0, 1);
                }
                $requete = "INSERT IGNORE INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) VALUES({$notice_id},{$categ_id},{$ordre_categ})";
                mysql_query($requete);
                $ordre_categ++;
            } else {
                $unknown_desc[] = $descripteur;
            }
        }
    }
    if (count($unknown_desc)) {
        $mots_cles = implode($pmb_keyword_sep, $unknown_desc);
        $requete = "UPDATE notices SET index_l=IF(index_l != '',CONCAT(index_l,'" . $pmb_keyword_sep . "','" . addslashes($mots_cles) . "'),'" . addslashes($mots_cles) . "'), index_matieres=IF(index_matieres != '',CONCAT(index_matieres,' ','" . addslashes(strip_empty_words($mots_cles)) . "'),'" . addslashes(strip_empty_words($mots_cles)) . "') WHERE notice_id='" . $notice_id . "'";
        mysql_query($requete);
    }
    //Thème
    if (count($info_900)) {
        $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=1";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && mysql_result($res, 0, 1) == "list" && mysql_result($res, 0, 2) == "integer") {
            $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=1";
            $resultat = mysql_query($requete);
            $max = @mysql_result($resultat, 0, 0);
            $n = $max + 1;
            for ($i = 0; $i < count($info_900); $i++) {
                for ($j = 0; $j < count($info_900[$i]); $j++) {
                    $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_900[$i][$j]) . "' and notices_custom_champ=1";
                    $resultat = mysql_query($requete);
                    if (mysql_num_rows($resultat)) {
                        $value = mysql_result($resultat, 0, 0);
                    } else {
                        $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(1,{$n},'" . addslashes($info_900[$i][$j]) . "')";
                        mysql_query($requete);
                        $value = $n;
                        $n++;
                    }
                    $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(1,{$notice_id},{$value})";
                    mysql_query($requete);
                }
            }
        } else {
            mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=1 ou il n\\'est pas de type liste entier : le 900 n\\'est donc pas repris (Thème)') ");
        }
    }
    //Genres
    if (count($info_901)) {
        $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=2";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && mysql_result($res, 0, 1) == "list" && mysql_result($res, 0, 2) == "integer") {
            $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=2";
            $resultat = mysql_query($requete);
            $max = @mysql_result($resultat, 0, 0);
            $n = $max + 1;
            for ($i = 0; $i < count($info_901); $i++) {
                for ($j = 0; $j < count($info_901[$i]); $j++) {
                    $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_901[$i][$j]) . "' and notices_custom_champ=2";
                    $resultat = mysql_query($requete);
                    if (mysql_num_rows($resultat)) {
                        $value = mysql_result($resultat, 0, 0);
                    } else {
                        $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(2,{$n},'" . addslashes($info_901[$i][$j]) . "')";
                        mysql_query($requete);
                        $value = $n;
                        $n++;
                    }
                    $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(2,{$notice_id},{$value})";
                    mysql_query($requete);
                }
            }
        } else {
            mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=2 ou il n\\'est pas de type liste entier : le 901 n\\'est donc pas repris (Genres)') ");
        }
    }
    //Discipline
    if (count($info_902)) {
        $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=3";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && mysql_result($res, 0, 1) == "list" && mysql_result($res, 0, 2) == "integer") {
            $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=3";
            $resultat = mysql_query($requete);
            $max = @mysql_result($resultat, 0, 0);
            $n = $max + 1;
            for ($i = 0; $i < count($info_902); $i++) {
                for ($j = 0; $j < count($info_902[$i]); $j++) {
                    $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_902[$i][$j]) . "' and notices_custom_champ=3";
                    $resultat = mysql_query($requete);
                    if (mysql_num_rows($resultat)) {
                        $value = mysql_result($resultat, 0, 0);
                    } else {
                        $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(3,{$n},'" . addslashes($info_902[$i][$j]) . "')";
                        mysql_query($requete);
                        $value = $n;
                        $n++;
                    }
                    $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(3,{$notice_id},{$value})";
                    mysql_query($requete);
                }
            }
        } else {
            mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=3 ou il n\\'est pas de type liste entier : le 902 n\\'est donc pas repris (Discipline)') ");
        }
    }
    //Type de nature
    if ($info_905[0]) {
        $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=6";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && mysql_result($res, 0, 1) == "list" && mysql_result($res, 0, 2) == "integer") {
            $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=6";
            $resultat = mysql_query($requete);
            $max = @mysql_result($resultat, 0, 0);
            $n = $max + 1;
            $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[0]) . "' and notices_custom_champ=6";
            $resultat = mysql_query($requete);
            if (mysql_num_rows($resultat)) {
                $value = mysql_result($resultat, 0, 0);
            } else {
                $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(6,{$n},'" . addslashes($info_905[0]) . "')";
                mysql_query($requete);
                $value = $n;
                $n++;
            }
            $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(6,{$notice_id},{$value})";
            mysql_query($requete);
        } else {
            mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=6 ou il n\\'est pas de type liste entier : le 905 n\\'est donc pas repris (Type de nature)') ");
        }
    }
    //Niveau
    if (count($info_906)) {
        $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=7";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && mysql_result($res, 0, 1) == "list" && mysql_result($res, 0, 2) == "integer") {
            for ($i = 0; $i < count($info_906); $i++) {
                for ($j = 0; $j < count($info_906[$i]); $j++) {
                    $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=7";
                    $resultat = mysql_query($requete);
                    $max = @mysql_result($resultat, 0, 0);
                    $n = $max + 1;
                    $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_906[$i][$j]) . "' and notices_custom_champ=7";
                    $resultat = mysql_query($requete);
                    if (mysql_num_rows($resultat)) {
                        $value = mysql_result($resultat, 0, 0);
                    } else {
                        $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(7,{$n},'" . addslashes($info_906[$i][$j]) . "')";
                        mysql_query($requete);
                        $value = $n;
                        $n++;
                    }
                    $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(7,{$notice_id},{$value})";
                    mysql_query($requete);
                }
            }
        } else {
            mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=7 ou il n\\'est pas de type liste entier : le 906 n\\'est donc pas repris (Niveau)') ");
        }
    }
    //Année de péremption
    if ($info_903[0]) {
        $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=4";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && mysql_result($res, 0, 2) == "integer") {
            $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(4,{$notice_id},'" . addslashes($info_903[0]) . "')";
            mysql_query($requete);
        } else {
            mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=4 ou il n\\'est pas de type entier : le 903 n\\'est donc pas repris (Année de péremption)') ");
        }
    }
    //Date de saisie
    if ($info_904[0]) {
        $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=5";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && mysql_result($res, 0, 2) == "date") {
            $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_date) values(5,{$notice_id},'" . $info_904[0] . "')";
            mysql_query($requete);
        } else {
            mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=5 ou il n\\'est pas de type date : le 904 n\\'est donc pas repris (Date de saisie)') ");
        }
    }
}
 function insert_in_database($addslashes = false)
 {
     global $dbh;
     global $class_path;
     global $gestion_acces_active, $gestion_acces_user_notice, $gestion_acces_empr_notice;
     global $res_prf, $chk_rights;
     global $pmb_synchro_rdf;
     global $opac_url_base, $pmb_notice_img_folder_id;
     if ($this->bibliographic_level == "s" && $this->hierarchic_level == "2") {
         $this->bibliographic_level = "b";
     }
     $new_notice = 0;
     $notice_retour = 0;
     $long_maxi = pmb_mysql_field_len(pmb_mysql_query("SELECT code FROM notices limit 1"), 0);
     $isbn = rtrim(substr($this->isbn, 0, $long_maxi));
     if ($isbn != "") {
         if (isISBN($isbn)) {
             if (strlen($isbn) == 13) {
                 $isbn1 = formatISBN($isbn, 13);
             } else {
                 $isbn1 = formatISBN($isbn, 10);
             }
         }
         $sql_rech = "select notice_id from notices where code = '" . $isbn . "' ";
         if ($isbn1) {
             $sql_rech .= " or code='" . $isbn1 . "' ";
         }
         $sql_result_rech = pmb_mysql_query($sql_rech) or die("Couldn't select notice ! = " . $sql_rech);
         if (pmb_mysql_num_rows($sql_result_rech) == 0) {
             $new_notice = 1;
         } else {
             $new_notice = 0;
             $lu = pmb_mysql_fetch_array($sql_result_rech);
             $notice_retour = $lu['notice_id'];
         }
     } else {
         $new_notice = 1;
     }
     if ($new_notice == 0) {
         $retour = array($new_notice, $notice_retour);
         return $retour;
     }
     for ($i = 0; $i < 2; $i++) {
         if ($this->editors[$i]['id']) {
             $editor_ids[$i] = $this->editors[$i]['id'];
         } else {
             $editor_ids[$i] = editeur::import($this->editors[$i]);
         }
     }
     $this->collection['parent'] = $editor_ids[0];
     if ($this->collection["id"]) {
         $collection_id = $this->collection["id"];
     } else {
         $collection_id = collection::import($this->collection);
     }
     $this->subcollection['coll_parent'] = $collection_id;
     if ($this->subcollection["id"]) {
         $subcollection_id = $this->subcollection["id"];
     } else {
         $subcollection_id = subcollection::import($this->subcollection);
     }
     $serie_id = serie::import(stripslashes($this->serie));
     /* traitement de Dewey */
     if (!$this->internal_index) {
         if (!$this->dewey["new_comment"]) {
             $this->dewey["new_comment"] = "";
         }
         if (!$this->dewey["new_pclass"]) {
             $this->dewey["new_pclass"] = "";
         }
         $this->internal_index = indexint::import(clean_string($this->dewey[0]), clean_string($this->dewey["new_comment"]), clean_string($this->dewey["new_pclass"]));
     }
     $date_parution_z3950 = notice::get_date_parution($this->year);
     /* Origine de la notice */
     $this->orinot_id = origine_notice::import($this->origine_notice);
     if ($this->orinot_id == 0) {
         $this->orinot_id = 1;
     }
     if ($addslashes) {
         $this->document_type = addslashes($this->document_type);
         $this->isbn = addslashes($this->isbn);
         $this->titles[0] = addslashes($this->titles[0]);
         $this->titles[1] = addslashes($this->titles[1]);
         $this->titles[2] = addslashes($this->titles[2]);
         $this->titles[3] = addslashes($this->titles[3]);
         $this->nbr_in_serie = addslashes($this->nbr_in_serie);
         $this->year = addslashes($this->year);
         $this->page_nbr = addslashes($this->page_nbr);
         $this->illustration = addslashes($this->illustration);
         $this->size = addslashes($this->size);
         $this->accompagnement = addslashes($this->accompagnement);
         $this->nbr_in_collection = addslashes($this->nbr_in_collection);
         $this->mention_edition = addslashes($this->mention_edition);
         $this->general_note = addslashes($this->general_note);
         $this->content_note = addslashes($this->content_note);
         $this->abstract_note = addslashes($this->abstract_note);
         $this->commentaire_gestion = addslashes($this->commentaire_gestion);
         $this->indexation_lang = addslashes($this->indexation_lang);
         $this->thumbnail_url = addslashes($this->thumbnail_url);
         $this->free_index = addslashes($this->free_index);
         $this->link_url = addslashes($this->link_url);
         $this->link_format = addslashes($this->link_format);
         $this->prix = addslashes($this->prix);
         //les oubliés du premier tour
         $serie_id = addslashes($serie_id);
         $this->bibliographic_level = addslashes($this->bibliographic_level);
         $this->hierarchic_level = addslashes($this->hierarchic_level);
         $date_parution_z3950 = addslashes($date_parution_z3950);
     }
     $sql_ins = "insert into notices (\n\t\t\ttypdoc          ,\n\t\t\tcode        \t,\n\t\t\ttit1            ,\n\t\t\ttit2            ,\n\t\t\ttit3            ,\n\t\t\ttit4            ,\n\t\t\ttparent_id      ,\n\t\t\ttnvol           ,\n\t\t\ted1_id          ,\n\t\t\ted2_id          ,\n\t\t\tyear            ,\n\t\t\tnpages          ,\n\t\t\till             ,\n\t\t\tsize            ,\n\t\t\taccomp          ,\n\t\t\tcoll_id         ,\n\t\t\tsubcoll_id      ,\n\t\t\tnocoll          ,\n\t\t\tmention_edition ,\n\t\t\tn_gen           ,\n\t\t\tn_contenu       ,\n\t\t\tn_resume        ,\n\t\t\tindexint,\n\t\t\tstatut,\n\t\t\tcommentaire_gestion,\n\t\t\tsignature,\n\t\t\tthumbnail_url,\n\t\t\tindex_l,\n\t\t\tniveau_biblio,\n\t\t\tniveau_hierar,\n\t\t\tlien,\n\t\t\teformat,\n\t\t\torigine_catalogage,\n\t\t\tprix,\n\t\t\tcreate_date,\n\t\t\tdate_parution,\n\t\t\tindexation_lang\n\t\t\t) values (\n\t\t\t'" . $this->document_type . "',\t\n\t\t\t'" . $this->isbn . "',\t\n\t\t\t'" . $this->titles[0] . "',\n\t\t\t'" . $this->titles[1] . "',\n\t\t\t'" . $this->titles[2] . "',\n\t\t\t'" . $this->titles[3] . "',\n\t\t\t'" . $serie_id . "',\n\t\t\t'" . $this->nbr_in_serie . "',\n\t\t\t" . $editor_ids[0] . " ,\n\t\t\t" . $editor_ids[1] . " ,\n\t\t\t'" . $this->year . "',\n\t\t\t'" . $this->page_nbr . "',\n\t\t\t'" . $this->illustration . "',\n\t\t\t'" . $this->size . "',\n\t\t\t'" . $this->accompagnement . "',\n\t\t\t" . $collection_id . " ,\n\t\t\t" . $subcollection_id . " ,\n\t\t\t'" . $this->nbr_in_collection . "',\n\t\t\t'" . $this->mention_edition . "',\n\t\t\t'" . $this->general_note . "',\n\t\t\t'" . $this->content_note . "',\n\t\t\t'" . $this->abstract_note . "',\n\t\t\t'" . $this->internal_index . "',\n\t\t\t'" . $this->statut . "',\n\t\t\t'" . $this->commentaire_gestion . "',\n\t\t\t'" . $this->signature . "',\n\t\t\t'" . $this->thumbnail_url . "',\n\t\t\t'" . clean_tags($this->free_index) . "',\n\t\t\t'" . $this->bibliographic_level . "',\n\t\t\t'" . $this->hierarchic_level . "',\n\t\t\t'" . $this->link_url . "',\n\t\t\t'" . $this->link_format . "',\n\t\t\t'" . $this->orinot_id . "',\n\t\t\t'" . $this->prix . "',\n\t\t\tsysdate(),\n\t\t\t'" . $date_parution_z3950 . "',\n\t\t\t'" . $this->indexation_lang . "'\n\t\t )";
     $sql_result_ins = pmb_mysql_query($sql_ins) or die("Couldn't insert into table notices : " . $sql_ins);
     $notice_retour = pmb_mysql_insert_id();
     audit::insert_creation(AUDIT_NOTICE, $notice_retour);
     if ($gestion_acces_active == 1) {
         $ac = new acces();
         //traitement des droits acces user_notice
         if ($gestion_acces_user_notice == 1) {
             $dom_1 = $ac->setDomain(1);
             $dom_1->storeUserRights(0, $notice_retour);
         }
         //traitement des droits acces empr_notice
         if ($gestion_acces_empr_notice == 1) {
             $dom_2 = $ac->setDomain(2);
             $dom_2->storeUserRights(0, $notice_retour);
         }
     }
     // purge de la base des responsabilités de la notice intégrée...
     if ($notice_retour) {
         $rqt_del = "delete from responsability where responsability_notice='{$notice_retour}'";
         $sql_result_del = pmb_mysql_query($rqt_del) or die("Couldn't purge table responsability : " . $rqt_del);
     }
     $rqt_ins = "insert into responsability (responsability_author, responsability_notice, responsability_fonction, responsability_type, responsability_ordre ) VALUES ";
     for ($i = 0; $i < sizeof($this->aut_array); $i++) {
         $aut['id'] = clean_string($this->aut_array[$i]['id']);
         $aut['name'] = clean_string($this->aut_array[$i]['entree']);
         $aut['rejete'] = clean_string($this->aut_array[$i]['rejete']);
         $aut['date'] = clean_string($this->aut_array[$i]['date']);
         $aut['type'] = $this->aut_array[$i]['type_auteur'];
         $aut['subdivision'] = clean_string($this->aut_array[$i]['subdivision']);
         $aut['numero'] = clean_string($this->aut_array[$i]['numero']);
         $aut['lieu'] = clean_string($this->aut_array[$i]['lieu']);
         $aut['ville'] = clean_string($this->aut_array[$i]['ville']);
         $aut['pays'] = clean_string($this->aut_array[$i]['pays']);
         $aut['web'] = clean_string($this->aut_array[$i]['web']);
         $aut['author_comment'] = clean_string($this->aut_array[$i]['author_comment']);
         $aut['authority_number'] = clean_string($this->aut_array[$i]['authority_number']);
         /* Origine de l'autorité : on reprend les infos d'origine de la notice pour les attribuées aux origines des autorités */
         $id_origine_auth = 0;
         $id_origine_auth = origin_authorities::import($this->origine_notice);
         if ($id_origine_auth == 0) {
             $id_origine_auth = 1;
         }
         // import de l'autorité auteur si elle existe et conservation des infos sur l'origine de l'autorité
         if ($aut['authority_number'] != '' && $id_origine_auth) {
             $this->aut_array[$i]["id"] = $this->insert_authority_infos($aut['authority_number'], "author", $id_origine_auth, $aut);
         }
         if (!$this->aut_array[$i]["id"]) {
             $this->aut_array[$i]["id"] = auteur::import($aut);
         }
         if ($this->aut_array[$i]["id"]) {
             $rqt = $rqt_ins . " (" . $this->aut_array[$i]["id"] . "," . $notice_retour . ",'" . $this->aut_array[$i]['fonction'] . "'," . $this->aut_array[$i]['responsabilite'] . "," . $i . ") ";
             $res_ins = pmb_mysql_query($rqt, $dbh);
         }
     }
     // traitement des titres uniformes
     global $pmb_use_uniform_title;
     if ($pmb_use_uniform_title) {
         if (count($this->titres_uniformes)) {
             $ntu = new tu_notice($notice_retour);
             $ntu->update($this->titres_uniformes);
         }
     }
     // traitement des langues
     // langues de la publication
     $rqt_del = "delete from notices_langues where num_notice='{$notice_retour}' ";
     $res_del = pmb_mysql_query($rqt_del, $dbh);
     if (is_array($this->language_code) && count($this->language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',0, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @pmb_mysql_query($rqt, $dbh);
             }
         }
     }
     // langues originales
     if (is_array($this->original_language_code) && count($this->original_language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->original_language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',1, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @pmb_mysql_query($rqt, $dbh);
             }
         }
     }
     // traitement des categories
     if ($this->categorisation_type == "categorisation_auto") {
         traite_categories_enreg($notice_retour, $this->categories);
     } else {
         $rqt_del = "delete from notices_categories where notcateg_notice='{$notice_retour}' ";
         $res_del = @pmb_mysql_query($rqt_del, $dbh);
         $rqt_ins = "insert into notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ";
         $rqt_ins_values = array();
         foreach ($this->categories as $i => $category) {
             $id_categ = $category['categ_id'];
             if ($id_categ) {
                 $rqt_ins_values[] = " ('{$notice_retour}','{$id_categ}', {$i}) ";
             }
         }
         $rqt_ins .= implode(",", $rqt_ins_values);
         $res_ins = @pmb_mysql_query($rqt_ins, $dbh);
     }
     //Traitement des champs personnalisés (du formulaire !!!)
     $p_perso = new parametres_perso("notices");
     $nberrors = $p_perso->check_submited_fields();
     $p_perso->rec_fields_perso($notice_retour);
     //Traitement import perso
     global $notice_id, $notice_org, $notice_type_org;
     if (function_exists('z_recup_noticeunimarc_suite') && function_exists('z_import_new_notice_suite')) {
         $notice_id = $notice_retour;
         if (!$notice_org) {
             $notice_tmp = $this->notice;
         }
         z_recup_noticeunimarc_suite($notice_tmp ? $notice_tmp : $notice_org);
         z_import_new_notice_suite();
         $notice_tmp = "";
     }
     //Recherche du titre uniforme automatique
     //global $opac_enrichment_bnf_sparql;
     //$opac_enrichment_bnf_sparql=1;
     $titre_uniforme = notice::getAutomaticTu($notice_retour);
     //Traitement upload vignette
     if (trim($this->flag_upload_vignette)) {
         $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
         $res = pmb_mysql_query($req, $dbh);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
         }
         //le fichier
         if (file_exists($rep->repertoire_path . $this->flag_upload_vignette)) {
             rename($rep->repertoire_path . $this->flag_upload_vignette, $rep->repertoire_path . "img_" . $notice_retour);
         }
         //le champ
         $rqt_upd = "UPDATE notices SET thumbnail_url='" . addslashes($opac_url_base . "getimage.php?noticecode=&vigurl=&notice_id=" . $notice_retour) . "' WHERE notice_id=" . $notice_retour;
         $res_ins = @pmb_mysql_query($rqt_upd, $dbh);
     }
     // Mise à jour des index de la notice
     notice::majNotices($notice_retour);
     // Mise à jour de la table notices_global_index
     notice::majNoticesGlobalIndex($notice_retour);
     // Mise à jour de la table notices_mots_global_index
     notice::majNoticesMotsGlobalIndex($notice_retour);
     //Calcul de la signature
     $sign = new notice_doublon();
     $val = $sign->gen_signature($notice_retour);
     pmb_mysql_query("update notices set signature='{$val}' where notice_id=" . $notice_retour, $dbh);
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
     }
     //Si on catalogue un article on recrée l'arborescence
     global $biblio_notice;
     //TODO AR
     //gérer le cas du bulletin (revient à intégrer le pério uniquement)
     if ($biblio_notice == 'art') {
         //Perios
         if (!$this->perio_id) {
             $new_perio = new serial();
             $values = array();
             $values['tit1'] = $this->perio_titre;
             $values['code'] = $this->perio_issn;
             $values['niveau_biblio'] = "s";
             $values['niveau_hierar'] = "1";
             $this->perio_id = $new_perio->update($values);
             //synchro_rdf
             if ($pmb_synchro_rdf) {
                 $synchro_rdf->addRdf($this->perio_id, 0);
             }
         }
         //Bulletin
         if ($this->bull_id) {
             $req_art = "insert into analysis set analysis_bulletin='" . $this->bull_id . "',\n\t\t\t\t\tanalysis_notice='" . $notice_retour . "'";
             pmb_mysql_query($req_art, $dbh);
             $req = "update bulletins set bulletin_notice='" . $this->perio_id . "' where bulletin_id='" . $this->bull_id . "'";
             pmb_mysql_query($req, $dbh);
         } else {
             $new_bull = new bulletinage(0, $this->perio_id);
             $values = array();
             $values['bul_no'] = $this->bull_num;
             $values['bul_date'] = $this->bull_mention;
             $values['date_date'] = $this->bull_date;
             $values['bul_titre'] = $this->bull_titre;
             $new_bull->update($values);
             $this->bull_id = $new_bull->bulletin_id;
             $req_art = "insert into analysis set analysis_bulletin='" . $this->bull_id . "',\n\t\t\t\t\tanalysis_notice='" . $notice_retour . "'";
             pmb_mysql_query($req_art, $dbh);
             //synchro_rdf
             if ($pmb_synchro_rdf) {
                 $synchro_rdf->addRdf(0, $this->bull_id);
             }
         }
     } else {
         if ($biblio_notice == "bull") {
             //Perios
             if (!$this->perio_id) {
                 $new_perio = new serial();
                 $values = array();
                 $values['tit1'] = $this->perio_titre;
                 $values['code'] = $this->perio_issn;
                 $values['niveau_biblio'] = "s";
                 $values['niveau_hierar'] = "1";
                 $this->perio_id = $new_perio->update($values);
                 //synchro_rdf
                 if ($pmb_synchro_rdf) {
                     $synchro_rdf->addRdf($this->perio_id, 0);
                 }
             }
             if (!$this->bull_id) {
                 $new_bull = new bulletinage(0, $this->perio_id);
                 $values = array();
                 $values['bul_no'] = $this->bull_num;
                 $values['bul_date'] = $this->bull_mention;
                 $values['date_date'] = $this->bull_date;
                 $values['bul_titre'] = $this->bull_titre;
                 $new_bull->update($values);
                 $this->bull_id = $new_bull->bulletin_id;
                 //synchro_rdf
                 if ($pmb_synchro_rdf) {
                     $synchro_rdf->addRdf(0, $this->bull_id);
                 }
                 // 				$req = "update bulletins set bulletin_notice='".$this->perio_id."',num_notice='".$notice_retour."'  where bulletin_id='".$this->bull_id."'";
                 // 				pmb_mysql_query($req,$dbh);				//Faire un update en mettant l'id de la notice crée
                 //file_put_contents('php://stderr', print_r($this->bull_id, true));
             }
             if ($this->bull_notice) {
                 $notice_bulletin = new notice();
                 $notice_bulletin->del_notice($notice_retour);
                 $notice_retour = $this->bull_notice;
             }
             //Mise à jour de la table bulletins, ajout de la relation entre le bulletins et sa notice
             $req = "update bulletins set bulletin_notice='" . $this->perio_id . "',num_notice='" . $notice_retour . "'  where bulletin_id='" . $this->bull_id . "'";
             pmb_mysql_query($req, $dbh);
             //Insertion dans la table notices_relation, ajout de la relatioin entre la notice de bulletin et la notice de perio
             $req = "insert into notices_relations (num_notice, linked_notice, relation_type,rank) values('" . $notice_retour . "', '" . $this->perio_id . "', 'b','1')";
             pmb_mysql_query($req, $dbh);
         }
     }
     //file_put_contents('php://stderr', print_r($notice_retour."\n", true));
     //Exemplaires
     if (count($this->exemplaires)) {
         //			global $section_995, $typdoc_995, $codstatdoc_995;
         // 			, $nb_expl_ignores;
         $section_995_ = new marc_list("section_995");
         $section_995 = $section_995_->table;
         $typdoc_995_ = new marc_list("typdoc_995");
         $typdoc_995 = $typdoc_995_->table;
         $codstatdoc_995_ = new marc_list("codstatdoc_995");
         $codstatdoc_995 = $codstatdoc_995_->table;
         // 			$nb_expl_ignores=0;
         global $deflt_docs_statut, $deflt_docs_location, $deflt_lenders;
         foreach ($this->exemplaires as $info_expl) {
             /* RAZ expl */
             $expl = array();
             if ($notice_retour) {
                 /* préparation du tableau à passer à la méthode */
                 $expl['cb'] = $info_expl['f'];
                 //TODO AR
                 // les raccrocher au bulletin et non sa notice
                 // dans un second temps
                 if ($this->bibliographic_level == "s" && $this->hierarchic_level == "2") {
                     if ($this->bull_id) {
                         $expl['notice'] = 0;
                         $expl['bulletin'] = $this->bull_id;
                     } else {
                         if (!$this->bull_id && $notice_retour) {
                             $expl['notice'] = $notice_retour;
                             $expl['bulletin'] = 0;
                         }
                     }
                 } else {
                     $expl['notice'] = $notice_retour;
                     $expl['bulletin'] = 0;
                 }
                 //$expl['bulletin']	= 0;
                 // $expl['typdoc']     = $info_995['r']; à chercher dans docs_typdoc
                 $data_doc = array();
                 //$data_doc['tdoc_libelle'] = $info_995['r']." -Type doc importé (".$book_lender_id.")";
                 $data_doc['tdoc_libelle'] = $typdoc_995[$info_expl['r']];
                 if (!$data_doc['tdoc_libelle']) {
                     $data_doc['tdoc_libelle'] = "\$r non conforme -" . $info_expl['r'] . "-";
                 }
                 $data_doc['duree_pret'] = 0;
                 /* valeur par défaut */
                 $data_doc['tdoc_codage_import'] = $info_expl['r'];
                 if ($tdoc_codage) {
                     $data_doc['tdoc_owner'] = $deflt_lenders;
                 } else {
                     $data_doc['tdoc_owner'] = 0;
                 }
                 $expl['typdoc'] = docs_type::import($data_doc);
                 $expl['cote'] = $info_expl['k'];
                 // $expl['section']    = $info_995['q']; à chercher dans docs_section
                 $data_doc = array();
                 $info_expl['q'] = trim($info_expl['q']);
                 if (!$info_expl['q']) {
                     $info_expl['q'] = "u";
                 }
                 $data_doc['section_libelle'] = $section_995[$info_expl['q']];
                 $data_doc['sdoc_codage_import'] = $info_expl['q'];
                 if ($sdoc_codage) {
                     $data_doc['sdoc_owner'] = $deflt_lenders;
                 } else {
                     $data_doc['sdoc_owner'] = 0;
                 }
                 $expl['section'] = docs_section::import($data_doc);
                 $expl['statut'] = $deflt_docs_statut;
                 if ($info_expl['a']) {
                     $expl['location'] = $info_expl['a'];
                 } else {
                     $expl['location'] = $deflt_docs_location;
                 }
                 // $expl['codestat']   = $info_995['q']; 'q' utilisé, éventuellement à fixer par combo_box
                 $data_doc = array();
                 //$data_doc['codestat_libelle'] = $info_995['q']." -Pub visé importé (".$book_lender_id.")";
                 $data_doc['codestat_libelle'] = $codstatdoc_995[$info_expl['q']];
                 $data_doc['statisdoc_codage_import'] = $info_expl['q'];
                 if ($statisdoc_codage) {
                     $data_doc['statisdoc_owner'] = $deflt_lenders;
                 } else {
                     $data_doc['statisdoc_owner'] = 0;
                 }
                 $expl['codestat'] = docs_codestat::import($data_doc);
                 $expl['note'] = $info_expl['u'];
                 $expl['expl_owner'] = $deflt_lenders;
                 if ($info_expl['m']) {
                     $expl['date_depot'] = substr($info_expl['m'], 0, 4) . "-" . substr($info_expl['m'], 4, 2) . "-" . substr($info_expl['m'], 6, 2);
                 }
                 if ($info_expl['n']) {
                     $expl['date_retour'] = substr($info_expl['n'], 0, 4) . "-" . substr($info_expl['n'], 4, 2) . "-" . substr($info_expl['n'], 6, 2);
                 }
                 exemplaire::import($expl);
             }
         }
     }
     //Documents numériques
     global $deflt_explnum_statut;
     foreach ($this->doc_nums as $doc_num) {
         if (!$doc_num['a']) {
             continue;
         }
         if (!$doc_num['s']) {
             $doc_num['s'] = $deflt_explnum_statut;
         }
         if ($doc_num['__nodownload__']) {
             if ($this->bibliographic_level == "b" && $this->hierarchic_level == "2") {
                 explnum_add_url($notice_retour, $this->bull_id, $doc_num['b'], $doc_num['a'], $doc_num['s']);
             } else {
                 explnum_add_url($notice_retour, 0, $doc_num['b'], $doc_num['a'], $doc_num['s']);
             }
         } else {
             if ($this->bibliographic_level == "b" && $this->hierarchic_level == "2") {
                 explnum_add_from_url($notice_retour, $this->bull_id, $doc_num['b'], $doc_num['a'], true, $this->source_id, $doc_num['f'], $doc_num['p'], $doc_num['s']);
             } else {
                 explnum_add_from_url($notice_retour, 0, $doc_num['b'], $doc_num['a'], true, $this->source_id, $doc_num['f'], $doc_num['p'], $doc_num['s']);
             }
         }
     }
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf->addRdf($notice_retour, 0);
     }
     $retour = array($new_notice, $notice_retour);
     return $retour;
 }
Exemple #3
0
function import_new_notice_suite()
{
    global $dbh;
    global $notice_id;
    global $info_464;
    global $info_606_a;
    global $info_900, $info_901, $info_902, $info_903, $info_904, $info_905, $info_906, $info_610;
    global $pmb_keyword_sep;
    global $bulletin_ex;
    //Cas des périodiques
    if (is_array($info_464)) {
        $requete = "select * from notices where notice_id={$notice_id}";
        $resultat = mysql_query($requete);
        $r = mysql_fetch_object($resultat);
        //Notice chapeau existe-t-elle ?
        $requete = "select notice_id from notices where tit1='" . addslashes($info_464[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'";
        $resultat = mysql_query($requete);
        if (@mysql_num_rows($resultat)) {
            //Si oui, récupération id
            $chapeau_id = mysql_result($resultat, 0, 0);
            //Bulletin existe-t-il ?
            $requete = "select bulletin_id from bulletins where bulletin_numero='" . addslashes($info_464[0]['v']) . "' and  mention_date='" . addslashes($info_464[0]['d']) . "' and bulletin_notice={$chapeau_id}";
            //$requete="select bulletin_id from bulletins where bulletin_numero='".addslashes($info_464[0]['v'])."' and bulletin_notice=$chapeau_id";
            $resultat = mysql_query($requete);
            if (@mysql_num_rows($resultat)) {
                //Si oui, récupération id bulletin
                $bulletin_id = mysql_result($resultat, 0, 0);
            } else {
                //Si non, création bulltin
                $info = array();
                $bulletin = new bulletinage("", $chapeau_id);
                $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']);
                $info['bul_no'] = addslashes($info_464[0]['v']);
                $info['bul_date'] = addslashes($info_464[0]['d']);
                if (!$info_464[0]['e']) {
                    $date_date = explode("/", $info_464[0]['d']);
                    if (count($date_date)) {
                        if (count($date_date) == 1) {
                            $info['date_date'] = $date_date[0] . "-01-01";
                        }
                        if (count($date_date) == 2) {
                            $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01";
                        }
                        if (count($date_date) == 3) {
                            $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0];
                        }
                    } else {
                        if ($info_904[0]) {
                            $info['date_date'] = $info_904[0];
                        }
                    }
                } else {
                    $info['date_date'] = $info_464[0]['e'];
                }
                $bulletin_id = $bulletin->update($info);
            }
        } else {
            //Si non, création notice chapeau et bulletin
            $chapeau = new serial();
            $info = array();
            $info['tit1'] = addslashes($info_464[0]['t']);
            $info['niveau_biblio'] = 's';
            $info['niveau_hierar'] = '1';
            $info['typdoc'] = $r->typdoc;
            $chapeau->update($info);
            $chapeau_id = $chapeau->serial_id;
            $bulletin = new bulletinage("", $chapeau_id);
            $info = array();
            $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']);
            $info['bul_no'] = addslashes($info_464[0]['v']);
            $info['bul_date'] = addslashes($info_464[0]['d']);
            if (!$info_464[0]['e']) {
                $date_date = explode("/", $info_464[0]['d']);
                if (count($date_date)) {
                    if (count($date_date) == 1) {
                        $info['date_date'] = $date_date[0] . "-01-01";
                    }
                    if (count($date_date) == 2) {
                        $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01";
                    }
                    if (count($date_date) == 3) {
                        $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0];
                    }
                } else {
                    if ($info_904[0]) {
                        $info['date_date'] = $info_904[0];
                    }
                }
            } else {
                $info['date_date'] = $info_464[0]['e'];
            }
            $bulletin_id = $bulletin->update($info);
        }
        //Notice objet ?
        if ($info_464[0]['z'] == 'objet') {
            //Supression de la notice
            $requete = "delete from notices where notice_id={$notice_id}";
            mysql_query($requete);
            $bulletin_ex = $bulletin_id;
        } else {
            $annee = $info_464[0]['d'];
            $date_parution = $info['date_date'];
            //Récupère la date du bulletin (non disponible autrement si il existe déjà) pour l'article
            $select = "SELECT date_date FROM bulletins WHERE bulletin_id='" . $bulletin_id . "'";
            $res_date = mysql_query($select);
            if ($res_date && mysql_num_rows($res_date)) {
                $date_parution = mysql_result($res_date, 0, 0);
                $annee = substr($date_parution, 0, 4);
            }
            //Passage de la notice en article
            $requete = "update notices set niveau_biblio='a', niveau_hierar='2', year='" . addslashes($annee) . "', npages='" . addslashes($info_464[0]['p']) . "', date_parution='" . addslashes($date_parution) . "' where notice_id={$notice_id}";
            mysql_query($requete);
            $requete = "insert into analysis (analysis_bulletin,analysis_notice) values({$bulletin_id},{$notice_id})";
            mysql_query($requete);
            $bulletin_ex = $bulletin_id;
        }
    } else {
        $bulletin_ex = 0;
    }
    //Traitement du thésaurus
    $unknown_desc = array();
    $ordre_categ = 0;
    for ($i = 0; $i < count($info_606_a); $i++) {
        for ($j = 0; $j < count($info_606_a[$i]); $j++) {
            $descripteur = trim($info_606_a[$i][$j]);
            //Recherche du terme
            //dans le thesaurus par defaut et dans la langue de l'interface
            $libelle = addslashes($descripteur);
            $categ_id = categories::searchLibelle($libelle);
            if ($categ_id) {
                $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) VALUES({$notice_id},{$categ_id},{$ordre_categ})";
                mysql_query($requete);
                $ordre_categ++;
            } else {
                $unknown_desc[] = $descripteur;
            }
        }
    }
    if (count($info_610)) {
        for ($i = 0; $i < count($info_610); $i++) {
            $tmp = explode($pmb_keyword_sep, $info_610[$i]);
            if (count($tmp)) {
                foreach ($tmp as $value) {
                    if ($libelle = addslashes(trim($value))) {
                        $categ_id = categories::searchLibelle($libelle);
                        if ($categ_id) {
                            $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) VALUES({$notice_id},{$categ_id},{$ordre_categ})";
                            mysql_query($requete);
                            $ordre_categ++;
                        } else {
                            $unknown_desc[] = trim($value);
                        }
                    }
                }
            }
        }
    }
    if ($unknown_desc) {
        $mots_cles = implode($pmb_keyword_sep, $unknown_desc);
        $requete = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes(strip_empty_words($mots_cles)) . " ' where notice_id={$notice_id}";
        mysql_query($requete);
    }
    //Thème
    if (count($info_900)) {
        $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=1";
        $resultat = mysql_query($requete);
        $max = @mysql_result($resultat, 0, 0);
        $n = $max + 1;
        for ($i = 0; $i < count($info_900); $i++) {
            for ($j = 0; $j < count($info_900[$i]); $j++) {
                $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_900[$i][$j]) . "' and notices_custom_champ=1";
                $resultat = mysql_query($requete);
                if (mysql_num_rows($resultat)) {
                    $value = mysql_result($resultat, 0, 0);
                } else {
                    $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(1,{$n},'" . addslashes($info_900[$i][$j]) . "')";
                    mysql_query($requete);
                    $value = $n;
                    $n++;
                }
                $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(1,{$notice_id},{$value})";
                mysql_query($requete);
            }
        }
    }
    //Genres
    if (count($info_901)) {
        $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=2";
        $resultat = mysql_query($requete);
        $max = @mysql_result($resultat, 0, 0);
        $n = $max + 1;
        for ($i = 0; $i < count($info_901); $i++) {
            for ($j = 0; $j < count($info_901[$i]); $j++) {
                $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_901[$i][$j]) . "' and notices_custom_champ=2";
                $resultat = mysql_query($requete);
                if (mysql_num_rows($resultat)) {
                    $value = mysql_result($resultat, 0, 0);
                } else {
                    $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(2,{$n},'" . addslashes($info_901[$i][$j]) . "')";
                    mysql_query($requete);
                    $value = $n;
                    $n++;
                }
                $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(2,{$notice_id},{$value})";
                mysql_query($requete);
            }
        }
    }
    //Discipline
    if (count($info_902)) {
        $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=3";
        $resultat = mysql_query($requete);
        $max = @mysql_result($resultat, 0, 0);
        $n = $max + 1;
        for ($i = 0; $i < count($info_902); $i++) {
            for ($j = 0; $j < count($info_902[$i]); $j++) {
                $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_902[$i][$j]) . "' and notices_custom_champ=3";
                $resultat = mysql_query($requete);
                if (mysql_num_rows($resultat)) {
                    $value = mysql_result($resultat, 0, 0);
                } else {
                    $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(3,{$n},'" . addslashes($info_902[$i][$j]) . "')";
                    mysql_query($requete);
                    $value = $n;
                    $n++;
                }
                $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(3,{$notice_id},{$value})";
                mysql_query($requete);
            }
        }
    }
    //Type de nature
    if ($info_905[0]) {
        $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=6";
        $resultat = mysql_query($requete);
        $max = @mysql_result($resultat, 0, 0);
        $n = $max + 1;
        $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[0]) . "' and notices_custom_champ=6";
        $resultat = mysql_query($requete);
        if (mysql_num_rows($resultat)) {
            $value = mysql_result($resultat, 0, 0);
        } else {
            $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(6,{$n},'" . addslashes($info_905[0]) . "')";
            mysql_query($requete);
            $value = $n;
            $n++;
        }
        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(6,{$notice_id},{$value})";
        mysql_query($requete);
    }
    //Niveau
    if (count($info_906)) {
        for ($i = 0; $i < count($info_906); $i++) {
            for ($j = 0; $j < count($info_906[$i]); $j++) {
                $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=7";
                $resultat = mysql_query($requete);
                $max = @mysql_result($resultat, 0, 0);
                $n = $max + 1;
                $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_906[$i][$j]) . "' and notices_custom_champ=7";
                $resultat = mysql_query($requete);
                if (mysql_num_rows($resultat)) {
                    $value = mysql_result($resultat, 0, 0);
                } else {
                    $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(7,{$n},'" . addslashes($info_906[$i][$j]) . "')";
                    mysql_query($requete);
                    $value = $n;
                    $n++;
                }
                $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(7,{$notice_id},{$value})";
                mysql_query($requete);
            }
        }
    }
    //Année de péremption
    if ($info_903[0]) {
        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(4,{$notice_id},'" . addslashes($info_903[0]) . "')";
        mysql_query($requete);
    }
    //Date de saisie
    if ($info_904[0]) {
        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_date) values(5,{$notice_id},'" . $info_904[0] . "')";
        mysql_query($requete);
    }
}
}
//verification des droits de modification notice
$acces_m = 1;
if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1) {
    require_once "{$class_path}/acces.class.php";
    $ac = new acces();
    $dom_1 = $ac->setDomain(1);
    $acces_m = $dom_1->getRights($PMBuserid, $serial_id, 8);
}
if ($acces_m == 0) {
    error_message('', htmlentities($dom_1->getComment('mod_bull_error'), ENT_QUOTES, $charset), 1, '');
} else {
    print pmb_bidi("<h1>{$msg['catal_rep_bul_h1']}</h1>");
    if (!$by) {
        $myBul = new bulletinage($bul_id, $serial_id);
        $myBul->replace_form();
    } else {
        // routine de remplacement
        $bulletin_notice = $bull->bulletin_notice;
        $myBul = new bulletinage($bul_id);
        $rep_result = $myBul->replace($by, 1 - $del);
        if (!$rep_result) {
            print pmb_bidi("<div class='row'><div class='msg-perio'>" . $msg["maj_encours"] . "</div></div>\n\t\t\t<script type=\"text/javascript\">document.location='./catalog.php?categ=serials&sub=view&serial_id={$serial_id}&bul_id={$by}'</script>");
        } else {
            error_message($msg[132], $rep_result, 1, "./catalog.php?categ=serials&sub=view&serial_id={$serial_id}");
        }
    }
}
?>
		
Exemple #5
0
function import_new_notice_suite()
{
    global $dbh;
    global $notice_id, $bulletin_ex;
    global $info_461, $info_463, $info_464;
    global $info_606_a;
    global $info_900, $info_901, $info_902, $info_903, $info_904, $info_905, $info_906;
    global $pmb_keyword_sep;
    $bulletin_ex = 0;
    $is_object = false;
    //compatibilite avec import memonotices
    if (is_array($info_464)) {
        unset($info_461);
        unset($info_463);
        $info_461[0]['t'] = $info_464[0]['t'];
        $info_461[0]['9'] = 'lnk:perio';
        $info_463[0]['v'] = $info_464[0]['v'];
        $info_463[0]['e'] = $info_464[0]['d'];
        $info_463[0]['9'] = 'lnk:bull';
        if (strpos($info_904[0], "/") !== FALSE) {
            $dc = substr($info_904[0], 6, 4) . '-' . substr($info_904[0], 3, 2) . '-' . substr($info_904[0], 0, 2);
            $info_904[0] = $dc;
        }
    }
    //Si article
    if (is_array($info_461) && is_array($info_463)) {
        //recuperation infos notice
        $requete = "select * from notices where notice_id={$notice_id}";
        $resultat = mysql_query($requete);
        $r = mysql_fetch_object($resultat);
        //Notice chapeau existe-t-elle ?
        $requete = "select notice_id from notices where tit1='" . addslashes($info_461[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'";
        $resultat = mysql_query($requete);
        if (@mysql_num_rows($resultat)) {
            //Si oui, récupération id
            $chapeau_id = mysql_result($resultat, 0, 0);
            //Bulletin existe-t-il ?
            $requete = "select bulletin_id from bulletins where bulletin_numero='" . addslashes($info_463[0]['v']) . "' and  mention_date='" . addslashes($info_463[0]['e']) . "' and bulletin_notice={$chapeau_id} ";
            $resultat = mysql_query($requete);
            if (@mysql_num_rows($resultat)) {
                //Si oui, récupération id bulletin
                $bulletin_id = mysql_result($resultat, 0, 0);
            } else {
                //Si non, création bulletin
                $info = array();
                $bulletin = new bulletinage("", $chapeau_id);
                $info['bul_titre'] = "Bulletin " . $info_463[0]['v'];
                if ($info_463[0]['e']) {
                    $info['bul_titre'] .= " - " . $info_463[0]['e'];
                }
                $info['bul_titre'] = addslashes($info['bul_titre']);
                $info['bul_no'] = addslashes($info_463[0]['v']);
                $info['bul_date'] = addslashes($info_463[0]['e']);
                $date_date = explode("/", $info_463[0]['e']);
                if (count($date_date)) {
                    if (count($date_date) == 1) {
                        $info['date_date'] = $date_date[0] . "-01-01";
                    }
                    if (count($date_date) == 2) {
                        $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01";
                    }
                    if (count($date_date) == 3) {
                        $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0];
                    }
                } else {
                    if ($info_904[0]) {
                        $info['date_date'] = $info_904[0];
                    }
                }
                $bulletin_id = $bulletin->update($info);
            }
        } else {
            //Si non, création notice chapeau et bulletin
            $chapeau = new serial();
            $info = array();
            $info['tit1'] = addslashes($info_461[0]['t']);
            $info['niveau_biblio'] = 's';
            $info['niveau_hierar'] = '1';
            $info['typdoc'] = $r->typdoc;
            $chapeau->update($info);
            $chapeau_id = $chapeau->serial_id;
            $bulletin = new bulletinage("", $chapeau_id);
            $info = array();
            $info['bul_titre'] = "Bulletin " . $info_463[0]['v'];
            if ($info_463[0]['e']) {
                $info['bul_titre'] .= " - " . $info_463[0]['e'];
            }
            $info['bul_titre'] = addslashes($info['bul_titre']);
            $info['bul_no'] = addslashes($info_463[0]['v']);
            $info['bul_date'] = addslashes($info_463[0]['e']);
            $date_date = explode("/", $info_463[0]['e']);
            if (count($date_date)) {
                if (count($date_date) == 1) {
                    $info['date_date'] = $date_date[0] . "-01-01";
                }
                if (count($date_date) == 2) {
                    $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01";
                }
                if (count($date_date) == 3) {
                    $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0];
                }
            } else {
                if ($info_904[0]) {
                    $info['date_date'] = $info_904[0];
                }
            }
            $bulletin_id = $bulletin->update($info);
        }
        $bulletin_ex = $bulletin_id;
        if ($r->tit1 == '_OBJECT_BULLETIN_' || is_array($info_464) && $info_464[0]['z'] == 'objet') {
            //$info_464[0]['z']=='objet' >> Compatibilite import memonotices
            $is_object = true;
            //notice de bulletin a supprimer
            notice::del_notice($notice_id);
        } else {
            //Passage de la notice en article
            $np = '';
            if (is_array($info_464) && $info_464[0]['p'] != '') {
                $np = ", npages='" . addslashes($info_464[0]['p']) . "' ";
            }
            $requete = "update notices set niveau_biblio='a', niveau_hierar='2', year='" . addslashes($info_463[0]['e']) . "'" . $np . ", date_parution='" . $info['date_date'] . "' where notice_id={$notice_id}";
            mysql_query($requete);
            $requete = "insert into analysis (analysis_bulletin,analysis_notice) values({$bulletin_id},{$notice_id})";
            mysql_query($requete);
        }
    }
    if (!$is_object) {
        //Traitement du thésaurus
        $unknown_desc = array();
        $ordre_categ = 0;
        for ($i = 0; $i < count($info_606_a); $i++) {
            for ($j = 0; $j < count($info_606_a[$i]); $j++) {
                $descripteur = $info_606_a[$i][$j];
                //Recherche du terme
                //dans le thesaurus par defaut et dans la langue de l'interface
                $libelle = addslashes($descripteur);
                $categ_id = categories::searchLibelle($libelle);
                if ($categ_id) {
                    $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) values({$notice_id},{$categ_id},{$ordre_categ})";
                    mysql_query($requete, $dbh);
                    $ordre_categ++;
                } else {
                    $unknown_desc[] = $descripteur;
                }
            }
        }
        if ($unknown_desc) {
            $mots_cles = implode($pmb_keyword_sep, $unknown_desc);
            $il = '';
            $qil = "select index_l from notices where notice_id={$notice_id} ";
            $ril = mysql_query($qil, $dbh);
            $il = trim(mysql_result($ril, 0, 0));
            if ($il) {
                $mots_cles = $il . $pmb_keyword_sep . $mots_cles;
            }
            $requete = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes(strip_empty_words($mots_cles)) . " ' where notice_id={$notice_id}";
            mysql_query($requete, $dbh);
        }
        $notes = '';
        //Thème
        $qn = "select idchamp from notices_custom where name='theme' ";
        $rn = mysql_query($qn, $dbh);
        if (mysql_num_rows($rn)) {
            $idc_theme = mysql_result($rn, 0, 0);
        }
        if (count($info_900) && $idc_theme) {
            for ($i = 0; $i < count($info_900); $i++) {
                for ($j = 0; $j < count($info_900[$i]); $j++) {
                    $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_900[$i][$j]) . "' and notices_custom_champ={$idc_theme} ";
                    $resultat = mysql_query($requete, $dbh);
                    if (mysql_num_rows($resultat)) {
                        $value = mysql_result($resultat, 0, 0);
                        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_theme},{$notice_id},{$value})";
                        mysql_query($requete, $dbh);
                    } else {
                        //sinon dans notes
                        $notes .= 'thème : ' . $info_900[$i][$j];
                    }
                }
            }
        }
        //Genres
        $qn = "select idchamp from notices_custom where name='genre' ";
        $rn = mysql_query($qn, $dbh);
        if (mysql_num_rows($rn)) {
            $idc_genre = mysql_result($rn, 0, 0);
        }
        if (count($info_901) && $idc_genre) {
            for ($i = 0; $i < count($info_901); $i++) {
                for ($j = 0; $j < count($info_901[$i]); $j++) {
                    $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_901[$i][$j]) . "' and notices_custom_champ={$idc_genre} ";
                    $resultat = mysql_query($requete, $dbh);
                    if (mysql_num_rows($resultat)) {
                        $value = mysql_result($resultat, 0, 0);
                        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_genre},{$notice_id},{$value})";
                        mysql_query($requete, $dbh);
                    } else {
                        //sinon dans notes
                        if ($notes) {
                            $notes .= "\n";
                        }
                        $notes .= 'genre : ' . $info_901[$i][$j];
                    }
                }
            }
        }
        //Discipline
        $qn = "select idchamp from notices_custom where name='discipline' ";
        $rn = mysql_query($qn, $dbh);
        if (mysql_num_rows($rn)) {
            $idc_discipline = mysql_result($rn, 0, 0);
        }
        if (count($info_902) && $idc_discipline) {
            for ($i = 0; $i < count($info_902); $i++) {
                for ($j = 0; $j < count($info_902[$i]); $j++) {
                    $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_902[$i][$j]) . "' and notices_custom_champ={$idc_discipline} ";
                    $resultat = mysql_query($requete, $dbh);
                    if (mysql_num_rows($resultat)) {
                        $value = mysql_result($resultat, 0, 0);
                        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_discipline},{$notice_id},{$value})";
                        mysql_query($requete, $dbh);
                    } else {
                        //sinon dans notes
                        if ($notes) {
                            $notes .= "\n";
                        }
                        $notes .= 'discipline : ' . $info_902[$i][$j];
                    }
                }
            }
        }
        //Type de nature
        $qn = "select idchamp from notices_custom where name='type_nature' ";
        $rn = mysql_query($qn, $dbh);
        if (mysql_num_rows($rn)) {
            $idc_type_nature = mysql_result($rn, 0, 0);
        }
        $qn = "select idchamp from notices_custom where name='pays' ";
        $rn = mysql_query($qn, $dbh);
        if (mysql_num_rows($rn)) {
            $idc_pays = mysql_result($rn, 0, 0);
        }
        $qn = "select idchamp from notices_custom where name='periode' ";
        $rn = mysql_query($qn, $dbh);
        if (mysql_num_rows($rn)) {
            $idc_periode = mysql_result($rn, 0, 0);
        }
        if (count($info_905)) {
            for ($i = 0; $i < count($info_905); $i++) {
                for ($j = 0; $j < count($info_905[$i]); $j++) {
                    //essai dans type de nature
                    $done = FALSE;
                    if ($idc_type_nature) {
                        $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[$i][$j]) . "' and notices_custom_champ={$idc_type_nature} ";
                        $resultat = mysql_query($requete, $dbh);
                        if (mysql_num_rows($resultat)) {
                            $value = mysql_result($resultat, 0, 0);
                            $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_type_nature},{$notice_id},{$value})";
                            mysql_query($requete, $dbh);
                            $done = TRUE;
                        }
                    }
                    //essai dans genre
                    if (!$done && $idc_genre) {
                        $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[$i][$j]) . "' and notices_custom_champ={$idc_genre} ";
                        $resultat = mysql_query($requete, $dbh);
                        if (mysql_num_rows($resultat)) {
                            $value = mysql_result($resultat, 0, 0);
                            $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_genre},{$notice_id},{$value})";
                            mysql_query($requete, $dbh);
                            $done = TRUE;
                        }
                    }
                    //essai dans theme
                    if (!$done && $idc_theme) {
                        $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[$i][$j]) . "' and notices_custom_champ={$idc_theme} ";
                        $resultat = mysql_query($requete, $dbh);
                        if (mysql_num_rows($resultat)) {
                            $value = mysql_result($resultat, 0, 0);
                            $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_theme},{$notice_id},{$value})";
                            mysql_query($requete, $dbh);
                            $done = TRUE;
                        }
                    }
                    //essai dans discipline
                    if (!$done && $idc_discipline) {
                        $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[$i][$j]) . "' and notices_custom_champ={$idc_discipline} ";
                        $resultat = mysql_query($requete, $dbh);
                        if (mysql_num_rows($resultat)) {
                            $value = mysql_result($resultat, 0, 0);
                            $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_discipline},{$notice_id},{$value})";
                            mysql_query($requete, $dbh);
                            $done = TRUE;
                        }
                    }
                    //essai dans pays
                    if (!$done) {
                        $done_pa = FALSE;
                        if (!$done && $idc_pays) {
                            $i_pays = strip_empty_chars($info_905[$i][$j]);
                            $requete = "select notices_custom_list_value,notices_custom_list_lib from notices_custom_lists where notices_custom_champ={$idc_pays} ";
                            $resultat = mysql_query($requete, $dbh);
                            if (mysql_num_rows($resultat)) {
                                while ($row = mysql_fetch_object($resultat)) {
                                    $r_pays = strip_empty_chars($row->notices_custom_list_lib);
                                    if (strpos($i_pays, $r_pays) !== FALSE) {
                                        $value = $row->notices_custom_list_value;
                                        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_pays},{$notice_id},{$value})";
                                        mysql_query($requete, $dbh);
                                        $done_pa = TRUE;
                                        break;
                                    }
                                }
                            }
                        }
                        //essai dans periode
                        $done_pe = FALSE;
                        if (!$done && $idc_periode) {
                            $i_periode = strip_empty_chars($info_905[$i][$j]);
                            $requete = "select notices_custom_list_value,notices_custom_list_lib from notices_custom_lists where notices_custom_champ={$idc_periode} ";
                            $resultat = mysql_query($requete, $dbh);
                            if (mysql_num_rows($resultat)) {
                                while ($row = mysql_fetch_object($resultat)) {
                                    $r_periode = strip_empty_chars($row->notices_custom_list_lib);
                                    if (strpos($i_periode, $r_periode) !== FALSE) {
                                        $value = $row->notices_custom_list_value;
                                        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_periode},{$notice_id},{$value})";
                                        mysql_query($requete, $dbh);
                                        $done_pe = TRUE;
                                        break;
                                    }
                                }
                            }
                        }
                        if ($done_pa && $done_pe) {
                            $done = TRUE;
                        }
                    }
                    //sinon dans notes
                    if (!$done) {
                        if ($notes) {
                            $notes .= "\n";
                        }
                        $notes .= 'type de nature : ' . $info_905[$i][$j];
                    }
                }
            }
        }
        //Niveau
        if (count($info_906)) {
            $qn = "select idchamp from notices_custom where name='niveau' ";
            $rn = mysql_query($qn, $dbh);
            if (mysql_num_rows($rn)) {
                $idc_niveau = mysql_result($rn, 0, 0);
                for ($i = 0; $i < count($info_906); $i++) {
                    for ($j = 0; $j < count($info_906[$i]); $j++) {
                        $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_906[$i][$j]) . "' and notices_custom_champ={$idc_niveau} ";
                        $resultat = mysql_query($requete, $dbh);
                        if (mysql_num_rows($resultat)) {
                            $value = mysql_result($resultat, 0, 0);
                            $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_niveau},{$notice_id},{$value})";
                            mysql_query($requete, $dbh);
                        } else {
                            //sinon dans notes
                            if ($notes) {
                                $notes .= "\n";
                            }
                            $notes .= 'niveau : ' . $info_906[$i][$j];
                        }
                    }
                }
            }
        }
        //notes
        if ($notes) {
            $notes .= "\n";
            $notes = addslashes($notes);
            $q = "update notices set n_contenu=concat('" . $notes . "',n_contenu) where notice_id='" . $notice_id . "' ";
            mysql_query($q, $dbh);
        }
        //Année de péremption
        if ($info_903[0]) {
            $qn = "select idchamp from notices_custom where name='annee_peremption' ";
            $rn = mysql_query($qn, $dbh);
            if (mysql_num_rows($rn)) {
                $idc_ap = mysql_result($rn, 0, 0);
                $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$idc_ap},{$notice_id},'" . addslashes($info_903[0]) . "')";
                mysql_query($requete, $dbh);
            }
        }
        //Date de saisie
        if ($info_904[0]) {
            $qn = "select idchamp from notices_custom where name='date_creation' ";
            $rn = mysql_query($qn, $dbh);
            if (mysql_num_rows($rn)) {
                $idc_ds = mysql_result($rn, 0, 0);
                $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_date) values({$idc_ds},{$notice_id},'" . $info_904[0] . "')";
                mysql_query($requete, $dbh);
            }
        }
    }
}
                $acces_m = 0;
            }
        } else {
            $acces_m = 0;
        }
    }
}
if ($acces_m == 0) {
    if (!$bul_id) {
        error_message('', htmlentities($dom_1->getComment('mod_seri_error'), ENT_QUOTES, $charset), 1, '');
    } else {
        error_message('', htmlentities($dom_1->getComment('mod_bull_error'), ENT_QUOTES, $charset), 1, '');
    }
} else {
    // affichage d'un form pour création, modification d'un périodique
    // pas d'id, c'est une création
    if (!$bul_id) {
        echo str_replace('!!page_title!!', $msg[4000] . $msg[1003] . $msg[4005], $serial_header);
    } else {
        echo str_replace('!!page_title!!', $msg[4000] . $msg[1003] . $msg[4006], $serial_header);
    }
    // affichage de la notice chapeau
    // on instancie le bulletinage
    $myBulletinage = new bulletinage($bul_id, $serial_id);
    $perio = new serial_display($myBulletinage->serial_id, 1);
    $perio_header = $perio->header;
    // titre général du périodique
    print pmb_bidi("<div class='notice-perio'>\n\t\t<div class='row'>\n\t\t\t<h2>{$perio_header}</h2>\n\t\t\t</div>\n\t\t<div class='row'>\n\t\t\t{$perio->isbd}\n\t\t\t</div>\n\t\t</div>");
    // affichage du form
    print "<div class=\"row\">" . $myBulletinage->do_form() . '</div>';
}
function import_new_notice_suite()
{
    global $dbh;
    global $notice_id;
    global $info_464;
    global $info_606_a;
    global $info_900, $info_901, $info_902, $info_903, $info_904, $info_905, $info_906;
    global $pmb_keyword_sep;
    global $bulletin_ex;
    //Cas des périodiques
    if (is_array($info_464)) {
        $requete = "select * from notices where notice_id={$notice_id}";
        $resultat = pmb_mysql_query($requete);
        $r = pmb_mysql_fetch_object($resultat);
        //Notice chapeau existe-t-elle ?
        $requete = "select notice_id from notices where tit1='" . addslashes($info_464[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'";
        $resultat = pmb_mysql_query($requete);
        if (@pmb_mysql_num_rows($resultat)) {
            //Si oui, récupération id
            $chapeau_id = pmb_mysql_result($resultat, 0, 0);
            //Bulletin existe-t-il ?
            $requete = "select bulletin_id from bulletins where bulletin_numero='" . addslashes($info_464[0]['v']) . "' and  mention_date='" . addslashes($info_464[0]['d']) . "' and bulletin_notice={$chapeau_id}";
            //$requete="select bulletin_id from bulletins where bulletin_numero='".addslashes($info_464[0]['v'])."' and bulletin_notice=$chapeau_id";
            $resultat = pmb_mysql_query($requete);
            if (@pmb_mysql_num_rows($resultat)) {
                //Si oui, récupération id bulletin
                $bulletin_id = pmb_mysql_result($resultat, 0, 0);
            } else {
                //Si non, création bulltin
                $info = array();
                $bulletin = new bulletinage("", $chapeau_id);
                $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']);
                $info['bul_no'] = addslashes($info_464[0]['v']);
                $info['bul_date'] = addslashes($info_464[0]['d']);
                if (!$info_464[0]['e']) {
                    $date_date = explode("/", $info_464[0]['d']);
                    if (count($date_date)) {
                        if (count($date_date) == 1) {
                            $info['date_date'] = $date_date[0] . "-01-01";
                        }
                        if (count($date_date) == 2) {
                            $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01";
                        }
                        if (count($date_date) == 3) {
                            $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0];
                        }
                    } else {
                        if ($info_904[0]) {
                            $info['date_date'] = $info_904[0];
                        }
                    }
                } else {
                    $info['date_date'] = $info_464[0]['e'];
                }
                $bulletin_id = $bulletin->update($info);
            }
        } else {
            //Si non, création notice chapeau et bulletin
            $chapeau = new serial();
            $info = array();
            $info['tit1'] = addslashes($info_464[0]['t']);
            $info['niveau_biblio'] = 's';
            $info['niveau_hierar'] = '1';
            $info['typdoc'] = $r->typdoc;
            $chapeau->update($info);
            $chapeau_id = $chapeau->serial_id;
            $bulletin = new bulletinage("", $chapeau_id);
            $info = array();
            $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']);
            $info['bul_no'] = addslashes($info_464[0]['v']);
            $info['bul_date'] = addslashes($info_464[0]['d']);
            if (!$info_464[0]['e']) {
                $date_date = explode("/", $info_464[0]['d']);
                if (count($date_date)) {
                    if (count($date_date) == 1) {
                        $info['date_date'] = $date_date[0] . "-01-01";
                    }
                    if (count($date_date) == 2) {
                        $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01";
                    }
                    if (count($date_date) == 3) {
                        $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0];
                    }
                } else {
                    if ($info_904[0]) {
                        $info['date_date'] = $info_904[0];
                    }
                }
            } else {
                $info['date_date'] = $info_464[0]['e'];
            }
            $bulletin_id = $bulletin->update($info);
        }
        //Notice objet ?
        if ($info_464[0]['z'] == 'objet') {
            //Supression de la notice
            $requete = "delete from notices where notice_id={$notice_id}";
            pmb_mysql_query($requete);
            $bulletin_ex = $bulletin_id;
        } else {
            //Passage de la notice en article
            $requete = "update notices set niveau_biblio='a', niveau_hierar='2', year='" . addslashes($info_464[0]['d']) . "', npages='" . addslashes($info_464[0]['p']) . "', date_parution='" . $info['date_date'] . "' where notice_id={$notice_id}";
            pmb_mysql_query($requete);
            $requete = "insert into analysis (analysis_bulletin,analysis_notice) values({$bulletin_id},{$notice_id})";
            pmb_mysql_query($requete);
            $bulletin_ex = $bulletin_id;
        }
    } else {
        $bulletin_ex = 0;
    }
    //Traitement du thésaurus
    $unknown_desc = array();
    for ($i = 0; $i < count($info_606_a); $i++) {
        for ($j = 0; $j < count($info_606_a[$i]); $j++) {
            $descripteur = $info_606_a[$i][$j];
            //Recherche du terme
            //dans le thesaurus par defaut et dans la langue de l'interface
            $libelle = addslashes($descripteur);
            $categ_id = categories::searchLibelle($libelle);
            if ($categ_id) {
                $requete = "insert into notices_categories (notcateg_notice,num_noeud) values({$notice_id},{$categ_id})";
                pmb_mysql_query($requete);
            } else {
                $unknown_desc[] = $descripteur;
            }
        }
        if ($unknown_desc) {
            $mots_cles = implode($pmb_keyword_sep, $unknown_desc);
            $requete = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes(strip_empty_words($mots_cles)) . " ' where notice_id={$notice_id}";
            pmb_mysql_query($requete);
        }
    }
}
Exemple #8
0
 function del_item_base($item = 0, $forcage = array())
 {
     global $dbh;
     if (!$item) {
         return CADDIE_ITEM_NULL;
     }
     switch ($this->type) {
         case "EXPL":
             if (!$this->verif_expl_item($item)) {
                 if ($forcage['source_id']) {
                     exemplaire::save_to_agnostic_warehouse(array(0 => $item), $forcage['source_id']);
                 }
                 if (exemplaire::del_expl($item)) {
                     return CADDIE_ITEM_SUPPR_BASE_OK;
                 } else {
                     return 0;
                 }
             } else {
                 return CADDIE_ITEM_EXPL_PRET;
             }
             break;
         case "BULL":
             if (!$this->verif_bull_item($item, $forcage)) {
                 // aucun prêt d'exemplaire de ce bulletin en cours, on supprime :
                 $myBulletinage = new bulletinage($item);
                 $myBulletinage->delete();
                 return CADDIE_ITEM_SUPPR_BASE_OK;
             } else {
                 return CADDIE_ITEM_BULL_USED;
             }
             break;
         case "NOTI":
             if (!$this->verif_noti_item($item, $forcage)) {
                 if ($forcage['source_id']) {
                     notice::save_to_agnostic_warehouse(array(0 => $item), $forcage['source_id']);
                 }
                 $requete = "SELECT niveau_biblio, niveau_hierar FROM notices WHERE notice_id='" . $item . "'";
                 $res = pmb_mysql_query($requete, $dbh);
                 if (pmb_mysql_num_rows($res) && pmb_mysql_result($res, 0, 0) == "s" && pmb_mysql_result($res, 0, 1) == "1") {
                     $myBulletinage = new serial($item);
                     $myBulletinage->serial_delete();
                 } else {
                     notice::del_notice($item);
                 }
                 return CADDIE_ITEM_SUPPR_BASE_OK;
             } else {
                 return CADDIE_ITEM_NOTI_USED;
             }
             break;
     }
     return CADDIE_ITEM_OK;
 }
 function delete()
 {
     global $dbh;
     global $pmb_synchro_rdf;
     //suppression des notices de dépouillement
     $this->delete_analysis();
     //synchro rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf(0, $this->bulletin_id);
     }
     //suppression des exemplaires
     $req_expl = "select expl_id from exemplaires where expl_bulletin ='" . $this->bulletin_id . "' ";
     $result_expl = @pmb_mysql_query($req_expl, $dbh);
     while ($expl = pmb_mysql_fetch_object($result_expl)) {
         exemplaire::del_expl($expl->expl_id);
     }
     // expl numériques
     $req_explNum = "select explnum_id from explnum where explnum_bulletin=" . $this->bulletin_id . " ";
     $result_explNum = @pmb_mysql_query($req_explNum, $dbh);
     while ($explNum = pmb_mysql_fetch_object($result_explNum)) {
         $myExplNum = new explnum($explNum->explnum_id);
         $myExplNum->delete();
     }
     $requete = "delete from caddie_content using caddie, caddie_content where caddie_id=idcaddie and type='BULL' and object_id='" . $this->bulletin_id . "' ";
     @pmb_mysql_query($requete, $dbh);
     // Suppression des résas du bulletin
     $requete = "DELETE FROM resa WHERE resa_idbulletin=" . $this->bulletin_id;
     pmb_mysql_query($requete, $dbh);
     // Suppression des transferts_demande
     $requete = "DELETE FROM transferts_demande using transferts_demande, transferts WHERE num_transfert=id_transfert and num_bulletin=" . $this->bulletin_id;
     pmb_mysql_query($requete, $dbh);
     // Suppression des transferts
     $requete = "DELETE FROM transferts WHERE num_bulletin=" . $this->bulletin_id;
     pmb_mysql_query($requete, $dbh);
     //suppression de la notice du bulletin
     $requete = "select num_notice from bulletins where bulletin_id=" . $this->bulletin_id;
     $res_nbul = pmb_mysql_query($requete);
     if (pmb_mysql_num_rows($res_nbul)) {
         $num_notice = pmb_mysql_result($res_nbul, 0, 0);
         if ($num_notice) {
             // suppression des vedettes
             bulletinage::delete_vedette_links($this->bulletin_id);
             notice::del_notice($num_notice);
         }
     }
     // Suppression de ce bulletin
     $requete = "DELETE FROM bulletins WHERE bulletin_id=" . $this->bulletin_id;
     pmb_mysql_query($requete, $dbh);
     audit::delete_audit(AUDIT_BULLETIN, $this->bulletin_id);
 }
Exemple #10
0
 $p_perso = new parametres_perso("notices");
 $nberrors = $p_perso->check_submited_fields();
 $table['force_empty'] = $p_perso->presence_exclusion_fields();
 if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) {
     $table['force_empty'] = "f_img_load";
 }
 //Pour la synchro rdf
 if ($pmb_synchro_rdf) {
     require_once $class_path . "/synchro_rdf.class.php";
     $synchro_rdf = new synchro_rdf();
     if ($bul_id) {
         $synchro_rdf->delRdf(0, $bul_id);
     }
 }
 if (!$nberrors) {
     $myBulletinage = new bulletinage($bul_id, $serial_id);
     $req_notice_date_is_new = "";
     if ($myBulletinage->bull_num_notice) {
         $req_new = "select notice_is_new, notice_date_is_new from notices where notice_id=" . $myBulletinage->bull_num_notice;
         $res_new = pmb_mysql_query($req_new, $dbh);
         if (pmb_mysql_num_rows($res_new)) {
             if ($r = pmb_mysql_fetch_object($res_new)) {
                 if ($r->notice_is_new == $f_notice_is_new) {
                     // pas de changement du flag
                     $req_notice_date_is_new = "";
                 } elseif ($f_notice_is_new) {
                     // Changement du flag et affecté comme new
                     $req_notice_date_is_new = ", notice_date_is_new =now() ";
                 } else {
                     // raz date
                     $req_notice_date_is_new = ", notice_date_is_new ='' ";
Exemple #11
0
 $p_perso = new parametres_perso("notices");
 $nberrors = $p_perso->check_submited_fields();
 $table['force_empty'] = $p_perso->presence_exclusion_fields();
 if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) {
     $table['force_empty'] = "f_img_load";
 }
 //Pour la synchro rdf
 if ($pmb_synchro_rdf) {
     require_once $class_path . "/synchro_rdf.class.php";
     $synchro_rdf = new synchro_rdf();
     if ($bul_id) {
         $synchro_rdf->delRdf(0, $bul_id);
     }
 }
 if (!$nberrors) {
     $myBulletinage = new bulletinage($bul_id, $serial_id);
     $result = $myBulletinage->update($table);
 } else {
     error_message_history($msg["notice_champs_perso"], $p_perso->error_message, 1);
     exit;
 }
 // vignette de la notice uploadé dans un répertoire
 if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id && $myBulletinage->bull_num_notice) {
     $poids_fichier_max = 1024 * 1024;
     //Limite la taille de l'image à 1 Mo
     $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
     $res = mysql_query($req, $dbh);
     if (mysql_num_rows($res)) {
         $rep = mysql_fetch_object($res);
         $filename_output = $rep->repertoire_path . "img_" . $myBulletinage->bull_num_notice;
     }
Exemple #12
0
    $acces_j = $dom_1->getJoin($PMBuserid, 8, 'bulletin_notice');
    $q = "select count(1) from bulletins {$acces_j} where bulletin_id = {$bul_id} ";
    $r = mysql_query($q, $dbh);
    if (mysql_result($r, 0, 0) == 0) {
        $acces_m = 0;
    }
}
if ($acces_m == 0) {
    error_message('', htmlentities($dom_1->getComment('mod_bull_error'), ENT_QUOTES, $charset), 1, '');
} else {
    print "<div class=\"row\"><div class=\"msg-perio\">" . $msg['catalog_notices_suppression'] . "</div></div>";
    $sql_circ = mysql_query("select 1 from serialcirc_expl,exemplaires,bulletins where num_serialcirc_expl_id =expl_id and expl_bulletin=bulletin_id and bulletin_id={$bul_id} ");
    if (mysql_num_rows($sql_circ)) {
        // gestion erreur: circulation en cours
        error_message($msg[416], $msg["serialcirc_bull_no_del"], 1, "catalog.php?categ=serials&sub=bulletinage&action=view&bul_id={$bul_id}");
    } else {
        $requete = "select 1 from pret, exemplaires, bulletins where bulletin_id='{$bul_id}' ";
        $requete .= "and pret_idexpl=expl_id and expl_bulletin=bulletin_id ";
        $result = @mysql_query($requete);
        if (mysql_num_rows($result)) {
            // gestion erreur pret en cours
            error_message($msg[416], $msg[impossible_bull_del_pret], 1, "catalog.php?categ=serials&sub=bulletinage&action=view&bul_id={$bul_id}");
        } else {
            $myBulletinage = new bulletinage($bul_id);
            $myBulletinage->delete();
            $retour = "./catalog.php?categ=serials&sub=view&serial_id=" . $myBulletinage->bulletin_notice;
            // form de retour vers la page de gestion du periodique chapeau (auto-submit)
            print "\n\t\t\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"{$retour}\" style=\"display:none\">\n\t\t\t\t\t<input type=\"hidden\" name=\"id_form\" value=\"{$id_form}\">\n\t\t\t\t</form>\n\t\t\t\t<script type=\"text/javascript\">document.dummy.submit();</script>";
        }
    }
}
Exemple #13
0
 function insert_in_database($addslashes = false)
 {
     global $dbh;
     global $class_path;
     global $gestion_acces_active, $gestion_acces_user_notice, $gestion_acces_empr_notice;
     global $res_prf, $chk_rights;
     global $pmb_synchro_rdf;
     $new_notice = 0;
     $notice_retour = 0;
     $long_maxi = mysql_field_len(mysql_query("SELECT code FROM notices limit 1"), 0);
     $isbn = rtrim(substr($this->isbn, 0, $long_maxi));
     if ($isbn != "") {
         if (isISBN($isbn)) {
             if (strlen($isbn) == 13) {
                 $isbn1 = formatISBN($isbn, 13);
             } else {
                 $isbn1 = formatISBN($isbn, 10);
             }
         }
         $sql_rech = "select notice_id from notices where code = '" . $isbn . "' ";
         if ($isbn1) {
             $sql_rech .= " or code='" . $isbn1 . "' ";
         }
         $sql_result_rech = mysql_query($sql_rech) or die("Couldn't select notice ! = " . $sql_rech);
         if (mysql_num_rows($sql_result_rech) == 0) {
             $new_notice = 1;
         } else {
             $new_notice = 0;
             $lu = mysql_fetch_array($sql_result_rech);
             $notice_retour = $lu['notice_id'];
         }
     } else {
         $new_notice = 1;
     }
     if ($new_notice == 0) {
         $retour = array($new_notice, $notice_retour);
         return $retour;
     }
     for ($i = 0; $i < 2; $i++) {
         if ($this->editors[$i]['id']) {
             $editor_ids[$i] = $this->editors[$i]['id'];
         } else {
             $editor_ids[$i] = editeur::import($this->editors[$i]);
         }
     }
     $this->collection['parent'] = $editor_ids[0];
     if ($this->collection["id"]) {
         $collection_id = $this->collection["id"];
     } else {
         $collection_id = collection::import($this->collection);
     }
     $this->subcollection['coll_parent'] = $collection_id;
     if ($this->subcollection["id"]) {
         $subcollection_id = $this->subcollection["id"];
     } else {
         $subcollection_id = subcollection::import($this->subcollection);
     }
     $serie_id = serie::import(stripslashes($this->serie));
     /* traitement de Dewey */
     if (!$this->internal_index) {
         if (!$this->dewey["new_comment"]) {
             $this->dewey["new_comment"] = "";
         }
         if (!$this->dewey["new_pclass"]) {
             $this->dewey["new_pclass"] = "";
         }
         $this->internal_index = indexint::import(clean_string($this->dewey[0]), clean_string($this->dewey["new_comment"]), clean_string($this->dewey["new_pclass"]));
     }
     $date_parution_z3950 = notice::get_date_parution($this->year);
     /* Origine de la notice */
     $this->orinot_id = origine_notice::import($this->origine_notice);
     if ($this->orinot_id == 0) {
         $this->orinot_id = 1;
     }
     if ($addslashes) {
         $this->document_type = addslashes($this->document_type);
         $this->isbn = addslashes($this->isbn);
         $this->titles[0] = addslashes($this->titles[0]);
         $this->titles[1] = addslashes($this->titles[1]);
         $this->titles[2] = addslashes($this->titles[2]);
         $this->titles[3] = addslashes($this->titles[3]);
         $this->nbr_in_serie = addslashes($this->nbr_in_serie);
         $this->year = addslashes($this->year);
         $this->page_nbr = addslashes($this->page_nbr);
         $this->illustration = addslashes($this->illustration);
         $this->size = addslashes($this->size);
         $this->accompagnement = addslashes($this->accompagnement);
         $this->nbr_in_collection = addslashes($this->nbr_in_collection);
         $this->mention_edition = addslashes($this->mention_edition);
         $this->general_note = addslashes($this->general_note);
         $this->content_note = addslashes($this->content_note);
         $this->abstract_note = addslashes($this->abstract_note);
         $this->commentaire_gestion = addslashes($this->commentaire_gestion);
         $this->indexation_lang = addslashes($this->indexation_lang);
         $this->thumbnail_url = addslashes($this->thumbnail_url);
         $this->free_index = addslashes($this->free_index);
         $this->link_url = addslashes($this->link_url);
         $this->link_format = addslashes($this->link_format);
         $this->prix = addslashes($this->prix);
         //les oubliés du premier tour
         $serie_id = addslashes($serie_id);
         $this->bibliographic_level = addslashes($this->bibliographic_level);
         $this->hierarchic_level = addslashes($this->hierarchic_level);
         $date_parution_z3950 = addslashes($date_parution_z3950);
     }
     $sql_ins = "insert into notices (\n\t\t\ttypdoc          ,\n\t\t\tcode        \t,\n\t\t\ttit1            ,\n\t\t\ttit2            ,\n\t\t\ttit3            ,\n\t\t\ttit4            ,\n\t\t\ttparent_id      ,\n\t\t\ttnvol           ,\n\t\t\ted1_id          ,\n\t\t\ted2_id          ,\n\t\t\tyear            ,\n\t\t\tnpages          ,\n\t\t\till             ,\n\t\t\tsize            ,\n\t\t\taccomp          ,\n\t\t\tcoll_id         ,\n\t\t\tsubcoll_id      ,\n\t\t\tnocoll          ,\n\t\t\tmention_edition ,\n\t\t\tn_gen           ,\n\t\t\tn_contenu       ,\n\t\t\tn_resume        ,\n\t\t\tindexint,\n\t\t\tstatut,\n\t\t\tcommentaire_gestion,\n\t\t\tsignature,\n\t\t\tthumbnail_url,\n\t\t\tindex_l,\n\t\t\tniveau_biblio,\n\t\t\tniveau_hierar,\n\t\t\tlien,\n\t\t\teformat,\n\t\t\torigine_catalogage,\n\t\t\tprix,\n\t\t\tcreate_date,\n\t\t\tdate_parution,\n\t\t\tindexation_lang\n\t\t\t) values (\n\t\t\t'" . $this->document_type . "',\t\n\t\t\t'" . $this->isbn . "',\t\n\t\t\t'" . $this->titles[0] . "',\n\t\t\t'" . $this->titles[1] . "',\n\t\t\t'" . $this->titles[2] . "',\n\t\t\t'" . $this->titles[3] . "',\n\t\t\t'" . $serie_id . "',\n\t\t\t'" . $this->nbr_in_serie . "',\n\t\t\t" . $editor_ids[0] . " ,\n\t\t\t" . $editor_ids[1] . " ,\n\t\t\t'" . $this->year . "',\n\t\t\t'" . $this->page_nbr . "',\n\t\t\t'" . $this->illustration . "',\n\t\t\t'" . $this->size . "',\n\t\t\t'" . $this->accompagnement . "',\n\t\t\t" . $collection_id . " ,\n\t\t\t" . $subcollection_id . " ,\n\t\t\t'" . $this->nbr_in_collection . "',\n\t\t\t'" . $this->mention_edition . "',\n\t\t\t'" . $this->general_note . "',\n\t\t\t'" . $this->content_note . "',\n\t\t\t'" . $this->abstract_note . "',\n\t\t\t'" . $this->internal_index . "',\n\t\t\t'" . $this->statut . "',\n\t\t\t'" . $this->commentaire_gestion . "',\n\t\t\t'" . $this->signature . "',\n\t\t\t'" . $this->thumbnail_url . "',\n\t\t\t'" . clean_tags($this->free_index) . "',\n\t\t\t'" . $this->bibliographic_level . "',\n\t\t\t'" . $this->hierarchic_level . "',\n\t\t\t'" . $this->link_url . "',\n\t\t\t'" . $this->link_format . "',\n\t\t\t'" . $this->orinot_id . "',\n\t\t\t'" . $this->prix . "',\n\t\t\tsysdate(),\n\t\t\t'" . $date_parution_z3950 . "',\n\t\t\t'" . $this->indexation_lang . "'\n\t\t )";
     $sql_result_ins = mysql_query($sql_ins) or die("Couldn't insert into table notices : " . $sql_ins);
     $notice_retour = mysql_insert_id();
     audit::insert_creation(AUDIT_NOTICE, $notice_retour);
     if ($gestion_acces_active == 1) {
         $ac = new acces();
         //traitement des droits acces user_notice
         if ($gestion_acces_user_notice == 1) {
             $dom_1 = $ac->setDomain(1);
             $dom_1->storeUserRights(0, $notice_retour);
         }
         //traitement des droits acces empr_notice
         if ($gestion_acces_empr_notice == 1) {
             $dom_2 = $ac->setDomain(2);
             $dom_2->storeUserRights(0, $notice_retour);
         }
     }
     // purge de la base des responsabilités de la notice intégrée...
     if ($notice_retour) {
         $rqt_del = "delete from responsability where responsability_notice='{$notice_retour}'";
         $sql_result_del = mysql_query($rqt_del) or die("Couldn't purge table responsability : " . $rqt_del);
     }
     $rqt_ins = "insert into responsability (responsability_author, responsability_notice, responsability_fonction, responsability_type, responsability_ordre ) VALUES ";
     for ($i = 0; $i < sizeof($this->aut_array); $i++) {
         $aut['id'] = clean_string($this->aut_array[$i]['id']);
         $aut['name'] = clean_string($this->aut_array[$i]['entree']);
         $aut['rejete'] = clean_string($this->aut_array[$i]['rejete']);
         $aut['date'] = clean_string($this->aut_array[$i]['date']);
         $aut['type'] = $this->aut_array[$i]['type_auteur'];
         $aut['subdivision'] = clean_string($this->aut_array[$i]['subdivision']);
         $aut['numero'] = clean_string($this->aut_array[$i]['numero']);
         $aut['lieu'] = clean_string($this->aut_array[$i]['lieu']);
         $aut['ville'] = clean_string($this->aut_array[$i]['ville']);
         $aut['pays'] = clean_string($this->aut_array[$i]['pays']);
         $aut['web'] = clean_string($this->aut_array[$i]['web']);
         $aut['author_comment'] = clean_string($this->aut_array[$i]['author_comment']);
         $aut['authority_number'] = clean_string($this->aut_array[$i]['authority_number']);
         /* Origine de l'autorité : on reprend les infos d'origine de la notice pour les attribuées aux origines des autorités */
         $id_origine_auth = 0;
         $id_origine_auth = origin_authorities::import($this->origine_notice);
         if ($id_origine_auth == 0) {
             $id_origine_auth = 1;
         }
         // import de l'autorité auteur si elle existe et conservation des infos sur l'origine de l'autorité
         if ($aut['authority_number'] != '' && $id_origine_auth) {
             $this->aut_array[$i]["id"] = $this->insert_authority_infos($aut['authority_number'], "author", $id_origine_auth, $aut);
         }
         if (!$this->aut_array[$i]["id"]) {
             $this->aut_array[$i]["id"] = auteur::import($aut);
         }
         if ($this->aut_array[$i]["id"]) {
             $rqt = $rqt_ins . " (" . $this->aut_array[$i]["id"] . "," . $notice_retour . ",'" . $this->aut_array[$i]['fonction'] . "'," . $this->aut_array[$i]['responsabilite'] . "," . $i . ") ";
             $res_ins = mysql_query($rqt, $dbh);
         }
     }
     // traitement des titres uniformes
     global $pmb_use_uniform_title;
     if ($pmb_use_uniform_title) {
         if (count($this->titres_uniformes)) {
             $ntu = new tu_notice($notice_retour);
             $ntu->update($this->titres_uniformes);
         }
     }
     // traitement des langues
     // langues de la publication
     $rqt_del = "delete from notices_langues where num_notice='{$notice_retour}' ";
     $res_del = mysql_query($rqt_del, $dbh);
     if (is_array($this->language_code) && count($this->language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',0, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @mysql_query($rqt, $dbh);
             }
         }
     }
     // langues originales
     if (is_array($this->original_language_code) && count($this->original_language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->original_language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',1, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @mysql_query($rqt, $dbh);
             }
         }
     }
     // traitement des categories
     if ($this->categorisation_type == "categorisation_auto") {
         traite_categories_enreg($notice_retour, $this->categories);
     } else {
         $rqt_del = "delete from notices_categories where notcateg_notice='{$notice_retour}' ";
         $res_del = @mysql_query($rqt_del, $dbh);
         $rqt_ins = "insert into notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ";
         $rqt_ins_values = array();
         foreach ($this->categories as $i => $category) {
             $id_categ = $category['categ_id'];
             if ($id_categ) {
                 $rqt_ins_values[] = " ('{$notice_retour}','{$id_categ}', {$i}) ";
             }
         }
         $rqt_ins .= implode(",", $rqt_ins_values);
         $res_ins = @mysql_query($rqt_ins, $dbh);
     }
     //Traitement des champs personnalisés (du formulaire !!!)
     $p_perso = new parametres_perso("notices");
     $nberrors = $p_perso->check_submited_fields();
     $p_perso->rec_fields_perso($notice_retour);
     //Traitement import perso
     global $notice_id, $notice_org, $notice_type_org;
     if (function_exists('z_recup_noticeunimarc_suite') && function_exists('z_import_new_notice_suite')) {
         $notice_id = $notice_retour;
         if (!$notice_org) {
             $notice_tmp = $this->notice;
         }
         z_recup_noticeunimarc_suite($notice_tmp ? $notice_tmp : $notice_org);
         z_import_new_notice_suite();
         $notice_tmp = "";
     }
     // Mise à jour des index de la notice
     notice::majNotices($notice_retour);
     // Mise à jour de la table notices_global_index
     notice::majNoticesGlobalIndex($notice_retour);
     // Mise à jour de la table notices_mots_global_index
     notice::majNoticesMotsGlobalIndex($notice_retour);
     //Calcul de la signature
     $sign = new notice_doublon();
     $val = $sign->gen_signature($notice_retour);
     mysql_query("update notices set signature='{$val}' where notice_id=" . $notice_retour, $dbh);
     //Documents numériques
     foreach ($this->doc_nums as $doc_num) {
         if (!$doc_num['a']) {
             continue;
         }
         if ($doc_num['__nodownload__']) {
             explnum_add_url($notice_retour, $doc_num['b'], $doc_num['a']);
         } else {
             explnum_add_from_url($notice_retour, $doc_num['b'], $doc_num['a'], true, $this->source_id, $doc_num['f'], $doc_num['p']);
         }
     }
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
     }
     //Si on catalogue un article on recrée l'arborescence
     global $biblio_notice;
     if ($biblio_notice == 'art') {
         //Perios
         if (!$this->perio_id) {
             $new_perio = new serial();
             $values = array();
             $values['tit1'] = $this->perio_titre;
             $values['code'] = $this->perio_issn;
             $values['niveau_biblio'] = "s";
             $values['niveau_hierar'] = "1";
             $this->perio_id = $new_perio->update($values);
             //synchro_rdf
             if ($pmb_synchro_rdf) {
                 $synchro_rdf->addRdf($this->perio_id, 0);
             }
         }
         //Bulletin
         if ($this->bull_id) {
             $req_art = "insert into analysis set analysis_bulletin='" . $this->bull_id . "', \n\t\t\t\t\tanalysis_notice='" . $notice_retour . "'";
             mysql_query($req_art, $dbh);
             $req = "update bulletins set bulletin_notice='" . $this->perio_id . "' where bulletin_id='" . $this->bull_id . "'";
             mysql_query($req, $dbh);
         } else {
             $new_bull = new bulletinage(0, $this->perio_id);
             $values = array();
             $values['bul_no'] = $this->bull_num;
             $values['bul_date'] = $this->bull_mention;
             $values['date_date'] = $this->bull_date;
             $values['bul_titre'] = $this->bull_titre;
             $new_bull->update($values);
             $this->bull_id = $new_bull->bulletin_id;
             $req_art = "insert into analysis set analysis_bulletin='" . $this->bull_id . "', \n\t\t\t\t\tanalysis_notice='" . $notice_retour . "'";
             mysql_query($req_art, $dbh);
             //synchro_rdf
             if ($pmb_synchro_rdf) {
                 $synchro_rdf->addRdf(0, $this->bull_id);
             }
         }
     }
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf->addRdf($notice_retour, 0);
     }
     $retour = array($new_notice, $notice_retour);
     return $retour;
 }
function show_bulletinage_info_catalogage($bul_id, $show_in_receptions = false)
{
    global $dbh, $msg, $charset, $base_path;
    global $liste_script;
    global $liste_debut;
    global $liste_fin;
    global $bul_action_bar;
    global $bul_cb_form;
    global $cart_click_bull;
    global $pmb_droits_explr_localises;
    global $explr_visible_mod;
    global $flag_no_delete_bulletin;
    global $pmb_resa_planning;
    global $categ, $quoi, $action, $sub;
    $form = '';
    if ($bul_id) {
        if (!$show_in_receptions) {
            $myBul = new bulletinage($bul_id, 0, "./catalog.php?categ=serials&sub=bulletinage&action=explnum_form&bul_id={$bul_id}&explnum_id=!!explnum_id!!");
            $myBul->b_notice_show_expl = 0;
            $myBul->make_display();
            //Refait pour avoir la notice de bulletin sans ses exemplaires et ses docnums
            $affichage_expl = get_expl($myBul->expl);
            $cpt_expl = get_expl($myBul->expl, 0, true);
        } else {
            $myBul = new bulletinage($bul_id, 0, '');
            $myBul->b_notice_show_expl = 0;
            $myBul->make_display();
            //Refait pour avoir la notice de bulletin sans ses exemplaires et ses docnums
            $affichage_expl = get_expl($myBul->expl, 1);
            $cpt_expl = get_expl($myBul->expl, 1, true);
        }
        $bul_titre = $myBul->bulletin_titre;
        $bul_isbd = $myBul->display;
        $aff_expl_num = $myBul->explnum;
        $txt_drag = "";
        if ($myBul->bulletin_numero) {
            $txt_drag .= $myBul->bulletin_numero . " ";
        }
        if ($myBul->mention_date) {
            $txt_drag .= " (" . $myBul->mention_date . ") ";
        }
        $txt_drag .= "[" . $myBul->aff_date_date . "]";
        if (!$show_in_receptions) {
            // lien vers la notice chapeau
            $link_parent = "<a href=\"./catalog.php?categ=serials\">";
            $link_parent .= $msg[4010] . "</a>";
            $link_parent .= "<img src=\"./images/d.gif\" align=\"middle\" hspace=\"5\">";
            $link_parent .= "<a href=\"./catalog.php?categ=serials&sub=view&serial_id=";
            $link_parent .= $myBul->bulletin_notice . "\">" . $myBul->tit1 . '</a>';
            $link_parent .= "<img src=\"./images/d.gif\" align=\"middle\" hspace=\"5\">";
            $link_parent .= $txt_drag;
            if ($bul_titre) {
                $link_parent .= " : " . htmlentities($bul_titre, ENT_QUOTES, $charset);
            }
            $form .= "<div class='row'><div class='perio-barre'>" . $link_parent . "</div></div>";
            $cart_link = "<img src='./images/basket_small_20x20.gif' align='middle' alt='basket' title=\"{$msg[400]}\" {$cart_click_bull}>";
            $cart_link = str_replace('!!item!!', $bul_id, $cart_link);
            $cart_link .= "<span id='BULL_drag_" . $bul_id . "'  dragicon=\"{$base_path}/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($txt_drag, ENT_QUOTES, $charset) . "\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"" . $base_path . "/images/notice_drag.png\"/></span>";
            $bul_action_bar = str_replace('!!bul_id!!', $bul_id, $bul_action_bar);
            $bul_action_bar = str_replace('!!serial_id!!', $myBul->bulletin_notice, $bul_action_bar);
            $bul_action_bar = str_replace('!!nb_expl!!', sizeof($myBul->expl), $bul_action_bar);
            global $avis_quoifaire, $valid_id_avis;
            if ($myBul->bull_num_notice) {
                $bul_isbd = str_replace('<!-- !!avis_notice!! -->', avis_notice($myBul->bull_num_notice, $avis_quoifaire, $valid_id_avis), $bul_isbd);
            }
            if (!$flag_no_delete_bulletin) {
                $bul_action_bar = str_replace("!!bulletin_delete_button!!", "<input type='button' class='bouton' onclick=\"confirm_bul_delete();\" value='{$msg['63']}' />", $bul_action_bar);
            } else {
                $bul_action_bar = str_replace("!!bulletin_delete_button!!", "", $bul_action_bar);
            }
            if ($myBul->bull_num_notice) {
                $form .= $liste_script;
            }
            $form .= "\n\t\t\t<div class='bulletins-perio'>\n\t\t\t\t<div class='row'>\n\t\t\t\t\t<h2>{$cart_link} {$bul_isbd}</h2>\n\t\t\t\t\t</div>\n\t\t\t\t<div class='row'>\n\t\t\t\t\t{$bul_action_bar}\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
            // affichage des exemplaires associés
            $list_expl = "<div class='exemplaires-perio'>";
            $list_expl .= "<h3>" . $msg[4012] . " (" . $cpt_expl . ")</h3>";
            $list_expl .= "<div class='row'>" . $affichage_expl . "</div></div>";
            $form .= $list_expl;
            if ($aff_expl_num) {
                $list_expl = "<div class='exemplaires-perio'><h3>" . $msg[explnum_docs_associes] . " (" . $myBul->nbexplnum . ")</h3>";
                $list_expl .= "<div class='row'>" . $aff_expl_num . "</div></div>";
                $form .= $list_expl;
            }
            if (!$explr_visible_mod && $pmb_droits_explr_localises == 1) {
                $etiquette_expl = "";
                $btn_ajouter_expl = "";
                $saisie_num_expl = "<div class='colonne10'><img src='./images/error.png' /></div>";
                $saisie_num_expl .= "<div class='colonne-suite'><span class='erreur'>" . $msg["err_add_invis_expl"] . "</span></div>";
            } else {
                $etiquette_expl = "<div class='row'>\n\t\t\t\t\t\t\t<label class='etiquette' for='form_cb'>{$msg['291']}</label>\n\t\t\t\t\t\t\t</div>";
                $btn_ajouter_expl = "<input type='submit' class='bouton' value=' {$msg['expl_ajouter']} ' onClick=\"return test_form(this.form)\">";
                global $pmb_numero_exemplaire_auto, $pmb_numero_exemplaire_auto_script, $include_path;
                if ($pmb_numero_exemplaire_auto == 1 || $pmb_numero_exemplaire_auto == 3) {
                    $num_exemplaire_auto = " {$msg['option_num_auto']} <INPUT type=checkbox name='option_num_auto' value='num_auto'";
                    $checked = true;
                    if ($pmb_numero_exemplaire_auto_script) {
                        if (file_exists($include_path . "/{$pmb_numero_exemplaire_auto_script}")) {
                            require_once $include_path . "/{$pmb_numero_exemplaire_auto_script}";
                            if (function_exists('is_checked_by_default')) {
                                $checked = is_checked_by_default(0, $bul_id);
                            }
                        }
                    }
                    if ($checked) {
                        $num_exemplaire_auto .= " checked='checked'";
                    }
                    $num_exemplaire_auto .= " >";
                }
                $saisie_num_expl = "<input type='text' class='saisie-20em' name='noex' value=''>" . $num_exemplaire_auto;
            }
            $req = "select * from serialcirc_copy, bulletins where num_serialcirc_copy_bulletin=bulletin_id and bulletin_id= {$bul_id}";
            $resultat = pmb_mysql_query($req);
            $i = 0;
            if (pmb_mysql_num_rows($resultat)) {
                $btn_print_ask = "<input type='button' class='bouton' value=' " . $msg["serialcirc_circ_list_reproduction_isdone_bt"] . " ' onClick=\"document.location='./catalog.php?categ=serials&sub=bulletinage&action=copy_isdone&bul_id=" . $bul_id . "';\" />";
            }
            $bul_cb_form = str_replace('!!bul_id!!', $bul_id, $bul_cb_form);
            $bul_cb_form = str_replace('!!etiquette!!', $etiquette_expl, $bul_cb_form);
            $bul_cb_form = str_replace('!!saisie_num_expl!!', $saisie_num_expl, $bul_cb_form);
            $bul_cb_form = str_replace('!!btn_ajouter!!', $btn_ajouter_expl, $bul_cb_form);
            $bul_cb_form = str_replace('!!btn_print_ask!!', $btn_print_ask, $bul_cb_form);
            $form .= "<div class='row'>" . $bul_cb_form . "</div>";
            // zone d'affichage des dépouillements
            $liste = get_analysis($bul_id);
            if ($liste) {
                $icones_exp .= $liste_debut . "&nbsp;<img src='./images/basket_small_20x20.gif' align='middle' alt='basket' title='" . $msg[400] . "' onClick=\"openPopUp('./cart.php?object_type=BULL&item=" . $bul_id . "&what=DEP', 'cart', 500, 400, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes')\">";
                $liste_dep = $liste;
                $liste_dep .= $liste_fin;
                // inclusion du javascript inline
                $liste_dep .= !$myBul->bull_num_notice ? $liste_script : "";
            } else {
                $icones_exp .= "";
                $liste_dep .= "<div class='row'>" . $msg['bulletin_no_analysis'] . "</div>";
            }
            $link_new_dep = "<input type='button' class='bouton' value=' {$msg['4021']} ' onClick=\"document.location='./catalog.php?categ=serials&sub=analysis&action=analysis_form&bul_id={$bul_id}&analysis_id=0';\" />";
            $form .= "\n\t\t\t\t<div class='depouillements-perio'>\n\t\t\t\t\t<h3>" . $msg[4013] . $icones_exp . " {$link_new_dep}</h3>\n\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t{$liste_dep}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>";
            //reservations et previsions
            $rqt_nt = "select count(*) from exemplaires, bulletins, docs_statut where exemplaires.expl_statut=docs_statut.idstatut and bulletins.bulletin_id=exemplaires.expl_bulletin and pret_flag=1 and bulletins.bulletin_id=" . $bul_id;
            $result = pmb_mysql_query($rqt_nt, $dbh) or die($rqt_nt . " " . pmb_mysql_error());
            $nb_expl_reservables = pmb_mysql_result($result, 0, 0);
            $aff_resa = resa_list(0, $bul_id, 0);
            $ouvrir_reserv = "onclick=\"parent.location.href='./circ.php?categ=resa_from_catal&id_bulletin=" . $bul_id . "'; return(false) \"";
            if ($aff_resa) {
                $form .= "<b>" . $msg['resas'] . "</b><br />";
                if ($nb_expl_reservables) {
                    $form .= "<input type='button' class='bouton' value='" . $msg[351] . "' {$ouvrir_reserv}><br /><br />";
                }
                $form .= $aff_resa . "<br />";
            } else {
                if ($nb_expl_reservables) {
                    $form .= "<b>" . $msg['resas'] . "</b><br /><input type='button' class='bouton' value='" . $msg[351] . "' {$ouvrir_reserv}><br /><br />";
                }
            }
            if ($pmb_resa_planning) {
                $aff_resa_planning = planning_list(0, $bul_id, 0);
                //TODO
                $ouvrir_reserv = "onclick=\"parent.location.href='" . $base_path . "/circ.php?categ=resa_planning_from_catal&id_bulletin=" . $bul_id . "'; return(false) \"";
                if ($aff_resa_planning) {
                    $form .= "<b>" . $msg['resas_planning'] . "</b><br />";
                    if ($nb_expl_reservables) {
                        $form .= "<input type='button' class='bouton' value='" . $msg['resa_planning_add'] . "' {$ouvrir_reserv}><br /><br />";
                    }
                    $form .= $aff_resa_planning . "<br />";
                } else {
                    if ($nb_expl_reservables && !($categ == "resa_planning") && !$id_empr && $nb_expl_reservables) {
                        $form .= "<b>" . $msg['resas_planning'] . "</b><br /><input type='button' class='bouton' value='" . $msg['resa_planning_add'] . "' {$ouvrir_reserv}><br /><br />";
                    }
                }
            }
        } else {
            $form .= "<div class='notice-parent' id='_bull_'>\n\t\t\t\t\t\t<img hspace='3' border='0' onclick=\"expandBase('_bull_', true); return false;\" title='" . $msg['plus_detail'] . "' id='_bull_Img' name='imEx' class='img_plus' src='" . $base_path . "/images/minus.gif' />\n\t\t\t\t\t\t<span class='notice-heada'>" . htmlentities($myBul->tit1 . '.' . $txt_drag, ENT_QUOTES, $charset);
            if ($bul_titre) {
                $form .= " : " . htmlentities($bul_titre, ENT_QUOTES, $charset);
            }
            $form .= "\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div style='margin-bottom: 6px; display: none; width: 94%;' class='notice-child' id='_bull_Child'>\n\t\t\t\t\t\t<br /><b>" . htmlentities($msg[4012], ENT_QUOTES, $charset) . "</b>\n\t\t\t\t\t\t{$affichage_expl}\n\t\t\t\t\t\t<br ><b>" . htmlentities($msg['explnum_docs_associes'], ENT_QUOTES, $charset) . "</b>\n\t\t\t\t\t\t{$aff_expl_num};\n\t\t\t\t\t</div>";
        }
        /**
         * TODO : onglets 
         */
        if ($myBul->bull_num_notice) {
            $template_path_records_tabs = "./includes/templates/records/records_elements_tabs.html";
            if (file_exists("./includes/templates/records/records_elements_tabs_subst.html")) {
                $template_path_records_tabs = "./includes/templates/records/records_elements_tabs_subst.html";
            }
            if (file_exists($template_path_records_tabs)) {
                $h2o_record_tabs = new H2o($template_path_records_tabs);
                $records_tabs = new records_tabs(new notice($myBul->bull_num_notice));
                $records_list_ui = $records_tabs->get_record()->get_records_list_ui();
                if ($records_list_ui) {
                    $records_list_ui->set_current_url($pmb_url_base . 'catalog.php?categ=' . $categ . '&bul_id=' . $myBul->bulletin_id . '&sub=' . $sub . '&action=' . $action . '&quoi=' . $quoi);
                }
                $form .= $h2o_record_tabs->render(array('records_tabs' => $records_tabs, 'bulletin_id' => $myBul->bulletin_id));
            }
        }
    }
    return $form;
}
Exemple #15
0
function import_new_notice_suite()
{
    global $dbh;
    global $notice_id;
    global $info_464, $info_676;
    global $info_606_a, $info_606_x;
    global $info_900, $info_901, $info_902, $info_200, $info_903, $info_904, $info_910;
    global $rs, $bl, $dt;
    global $bulletin_ex;
    global $m_thess;
    //si on est en multi-thesaurus
    if (!$m_thess) {
        $rqt = "SELECT count(1) FROM thesaurus WHERE active=1";
        $m_thess = mysql_result(mysql_query($rqt), 0, 0);
    }
    //Cas des périodiques
    if (is_array($info_464)) {
        $requete = "SELECT * FROM notices WHERE notice_id={$notice_id}";
        $resultat = mysql_query($requete);
        $r = mysql_fetch_object($resultat);
        //Notice chapeau existe-t-elle ?
        $requete = "SELECT notice_id FROM notices WHERE tit1='" . addslashes($info_464[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'";
        $resultat = mysql_query($requete);
        if (@mysql_num_rows($resultat)) {
            //Si oui, récupération id
            $chapeau_id = mysql_result($resultat, 0, 0);
            //Mise à jour du champ commentaire de gestion si nécessaire
            if ($info_903[0]) {
                $requete = "UPDATE notices SET commentaire_gestion=concat(commentaire_gestion,' ','" . addslashes($info_903[0]) . "') WHERE notice_id={$chapeau_id}";
                mysql_query($requete);
            }
            //Bulletin existe-t-il ?
            $requete = "SELECT bulletin_id FROM bulletins WHERE bulletin_numero='" . addslashes($info_464[0]['v']) . "' AND mention_date='" . addslashes($info_464[0]['d']) . "' AND bulletin_notice={$chapeau_id}";
            $resultat = mysql_query($requete);
            if (@mysql_num_rows($resultat)) {
                //Si oui, récupération id bulletin
                $bulletin_id = mysql_result($resultat, 0, 0);
            } else {
                //Si non, création bulletin
                $info = array();
                $bulletin = new bulletinage("", $chapeau_id);
                if ($info_464[0]['u']) {
                    $info['bul_titre'] = addslashes($info_464[0]['u']);
                } else {
                    $info['bul_titre'] = addslashes("Bulletin " . $info_464[0]['v']);
                }
                $info['bul_no'] = addslashes($info_464[0]['v']);
                $info['bul_date'] = addslashes($info_464[0]['d']);
                if (!$info_464[0]['e']) {
                    if ($info_902[0]) {
                        $info['date_date'] = $info_902[0];
                    }
                } else {
                    $info['date_date'] = $info_464[0]['e'];
                }
                $bulletin_id = $bulletin->update($info);
            }
        } else {
            //Si non, création notice chapeau et bulletin
            $chapeau = new serial();
            $info = array();
            $info['tit1'] = addslashes($info_464[0]['t']);
            $info['niveau_biblio'] = 's';
            $info['niveau_hierar'] = '1';
            $info['typdoc'] = $r->typdoc;
            $chapeau->update($info);
            $chapeau_id = $chapeau->serial_id;
            //Mise à jour du champ commentaire de gestion si nécessaire
            if ($info_903[0]) {
                $requete = "UPDATE notices SET commentaire_gestion=concat(commentaire_gestion,' ','" . addslashes($info_903[0]) . "') WHERE notice_id={$chapeau_id}";
                mysql_query($requete);
            }
            $bulletin = new bulletinage("", $chapeau_id);
            $info = array();
            if ($info_464[0]['u']) {
                $info['bul_titre'] = addslashes($info_464[0]['u']);
            } else {
                $info['bul_titre'] = addslashes("Bulletin " . $info_464[0]['v']);
            }
            $info['bul_no'] = addslashes($info_464[0]['v']);
            $info['bul_date'] = addslashes($info_464[0]['d']);
            if (!$info_464[0]['e']) {
                if ($info_902[0]) {
                    $info['date_date'] = $info_902[0];
                }
            } else {
                $info['date_date'] = $info_464[0]['e'];
            }
            $bulletin_id = $bulletin->update($info);
        }
        //Passage de la notice en article
        $requete = "UPDATE notices SET niveau_biblio='a', niveau_hierar='2', npages='" . addslashes($info_464[0]['p']) . "' WHERE notice_id={$notice_id}";
        mysql_query($requete);
        $requete = "INSERT INTO analysis (analysis_bulletin,analysis_notice) VALUES({$bulletin_id},{$notice_id})";
        mysql_query($requete);
        $bulletin_ex = $bulletin_id;
    } else {
        $bulletin_ex = 0;
    }
    //Traitement du thésaurus
    if ($m_thess > 1) {
        //on est en multi-thesaurus
        for ($i = 0; $i < count($info_606_a); $i++) {
            for ($j = 0; $j < count($info_606_a[$i]); $j++) {
                $descripteur_tete = $info_606_a[$i][$j];
                $descripteur_fils = $info_606_x[$i][$j];
                //Recherche du thésaurus
                $thes_id = trouve_thesaurus($descripteur_tete);
                //Recherche du terme fils
                if ($thes_id > 0) {
                    $categ_id_fils = categories::searchLibelle(addslashes(trim($descripteur_fils)), $thes_id, "fr_FR");
                    if (!$categ_id_fils) {
                        //Création
                        $new_thes = $thes_id == 1 ? 4 : $thes_id;
                        //Choix du thesaurus Candidats descripteurs si descripteur inexistant
                        $categ_id_fils = categories::searchLibelle(addslashes(trim($descripteur_fils)), $new_thes, "fr_FR");
                        if (!$categ_id_fils) {
                            $noeud = new noeuds();
                            $noeud->num_thesaurus = $new_thes;
                            $thesau = new thesaurus($new_thes);
                            $noeud->num_parent = $thesau->num_noeud_racine;
                            $noeud->save();
                            $categ_id_fils = $noeud->id_noeud;
                            //Création du libellé
                            $categ = new categories($noeud->id_noeud, 'fr_FR');
                            $categ->libelle_categorie = $descripteur_fils;
                            $categ->index_categorie = " " . strip_empty_words($descripteur_fils) . " ";
                            $categ->save();
                        }
                    }
                    $requete = "INSERT INTO notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ({$notice_id},{$categ_id_fils}, " . ($i + 1) . ")";
                    mysql_query($requete);
                }
            }
        }
        //for($i
    } else {
        //Traitement du thésaurus unique
        for ($i = 0; $i < count($info_606_a); $i++) {
            for ($j = 0; $j < count($info_606_a[$i]); $j++) {
                $descripteur_tete = $info_606_a[$i][$j];
                $descripteur_fils = $info_606_x[$i][$j];
                //Recherche du terme de tête
                //$requete="SELECT num_noeud FROM categories WHERE libelle_categorie='".addslashes($descripteur_tete)."' AND langue='fr_FR'";
                $requete = "SELECT id_noeud FROM noeuds WHERE autorite='" . addslashes($descripteur_tete) . "'";
                $resultat = mysql_query($requete);
                if (@mysql_num_rows($resultat)) {
                    //la tête existe !
                    $categ_id_tete = mysql_result($resultat, 0, 0);
                } else {
                    //Création de la tête
                    //Nouveau Noeud !
                    $th = new thesaurus(1);
                    $noeud = new noeuds();
                    $noeud->num_thesaurus = $th->id_thesaurus;
                    $noeud->num_parent = $th->num_noeud_racine;
                    $noeud->autorite = $descripteur_tete;
                    $noeud->save();
                    $categ_id_tete = $noeud->id_noeud;
                    //Création du libellé
                    $categ = new categories($noeud->id_noeud, 'fr_FR');
                    $categ->libelle_categorie = $descripteur_tete;
                    $categ->index_categorie = " " . strip_empty_words($descripteur_tete) . " ";
                    $categ->save();
                }
                //Recherche du terme fils
                $categ_id_fils = categories::searchLibelle(addslashes($descripteur_fils), 1, "fr_FR");
                if (!$categ_id_fils) {
                    //Création
                    $noeud = new noeuds();
                    $noeud->num_thesaurus = 1;
                    $noeud->num_parent = $categ_id_tete;
                    $noeud->save();
                    $categ_id_fils = $noeud->id_noeud;
                    //Création du libellé
                    $categ = new categories($noeud->id_noeud, 'fr_FR');
                    $categ->libelle_categorie = $descripteur_fils;
                    $categ->index_categorie = " " . strip_empty_words($descripteur_fils) . " ";
                    $categ->save();
                }
                $requete = "INSERT INTO notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ({$notice_id}, {$categ_id_fils}, " . ($i + 1) . ")";
                mysql_query($requete);
            }
        }
    }
    //Indexation décimale
    if ($info_676[0]) {
        $requete = "select indexint_id from indexint where indexint_name='" . addslashes($info_676[0]) . "'";
        $resultat = mysql_query($requete);
        if (mysql_num_rows($resultat)) {
            $indexint = mysql_result($resultat, 0, 0);
        } else {
            $requete = "insert into indexint (indexint_name) values('" . addslashes($info_676[0]) . "')";
            mysql_query($requete);
            $indexint = mysql_insert_id();
        }
        $requete = "update notices set indexint=" . $indexint . " where notice_id=" . $notice_id;
        mysql_query($requete);
    }
    //Organisme
    if ($info_900[0]) {
        $no_champ = trouve_champ_perso("op");
        if ($no_champ > 0) {
            $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ;
            $resultat = mysql_query($requete);
            $max = @mysql_result($resultat, 0, 0);
            $n = $max + 1;
            $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_900[0]) . "' AND notices_custom_champ=" . $no_champ;
            $resultat = mysql_query($requete);
            if (mysql_num_rows($resultat)) {
                $value = mysql_result($resultat, 0, 0);
            } else {
                $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_900[0]) . "')";
                mysql_query($requete);
                $value = $n;
                $n++;
            }
            $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})";
            mysql_query($requete);
        }
    }
    //Genre
    if ($info_901[0]) {
        $no_champ = trouve_champ_perso("gen");
        if ($no_champ > 0) {
            $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ;
            $resultat = mysql_query($requete);
            $max = @mysql_result($resultat, 0, 0);
            $n = $max + 1;
            $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_901[0]) . "' AND notices_custom_champ=" . $no_champ;
            $resultat = mysql_query($requete);
            if (mysql_num_rows($resultat)) {
                $value = mysql_result($resultat, 0, 0);
            } else {
                $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_901[0]) . "')";
                mysql_query($requete);
                $value = $n;
                $n++;
            }
            $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})";
            mysql_query($requete);
        }
    }
    //Type de texte
    if (count($info_904)) {
        $no_champ = trouve_champ_perso("typtext");
        if ($no_champ > 0) {
            for ($i = 0; $i < count($info_904); $i++) {
                for ($j = 0; $j < count($info_904[$i]); $j++) {
                    $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ;
                    $resultat = mysql_query($requete);
                    $max = @mysql_result($resultat, 0, 0);
                    $n = $max + 1;
                    $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_904[$i][$j]) . "' AND notices_custom_champ=" . $no_champ;
                    $resultat = mysql_query($requete);
                    if (mysql_num_rows($resultat)) {
                        $value = mysql_result($resultat, 0, 0);
                    } else {
                        $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_904[$i][$j]) . "')";
                        mysql_query($requete);
                        $value = $n;
                        $n++;
                    }
                    $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})";
                    mysql_query($requete);
                }
            }
        }
    }
    //Date de saisie
    if ($info_902[0]) {
        $no_champ = trouve_champ_perso("ds");
        if ($no_champ > 0) {
            $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_date) VALUES({$no_champ},{$notice_id},'" . str_replace(".", "-", $info_902[0]) . "')";
            mysql_query($requete);
        }
    }
    //N° de lot
    if ($info_903[0]) {
        $requete = "UPDATE notices SET commentaire_gestion='" . addslashes($info_903[0]) . "' WHERE notice_id={$notice_id}";
        mysql_query($requete);
    }
    //Cas de la mise à jour des périodiques ou du champ bord (notices chapeau)
    if ($bl == "s") {
        //Si c'est un périodique
        if ($dt == "a") {
            //Passage de la notice en notice chapeau
            $requete = "UPDATE notices SET niveau_biblio='s', niveau_hierar='1' WHERE notice_id={$notice_id}";
            mysql_query($requete);
            //Recherche si la notice existe déjà par rapport au titre
            $requete = "select notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND niveau_biblio='s' AND niveau_hierar='1' AND notice_id!={$notice_id}";
            $resultat = mysql_query($requete);
            $update = false;
            if (mysql_num_rows($resultat)) {
                $update = true;
                $n_update = mysql_result($resultat, 0, 0);
                //Mise à jour de tous les bulletins
                $requete = "UPDATE bulletins SET bulletin_notice=" . $notice_id . " WHERE bulletin_notice=" . $n_update;
                mysql_query($requete);
                //Suppression de l'ancienne notice
                $requete = "DELETE FROM notices WHERE notice_id={$n_update}";
                mysql_query($requete);
                $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $n_update;
                mysql_query($requete);
                $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $n_update;
                mysql_query($requete);
                $requete = "DELETE FROM responsability WHERE responsability_author=" . $n_update;
                mysql_query($requete);
            }
            if (!$update && $rs != "n") {
                //Si il n'y a pas de création, on supprime la notice
                $requete = "DELETE FROM notices WHERE notice_id={$notice_id}";
                mysql_query($requete);
                $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $notice_id;
                mysql_query($requete);
                $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $notice_id;
                mysql_query($requete);
                $requete = "DELETE FROM responsability WHERE responsability_author=" . $notice_id;
                mysql_query($requete);
            }
        } else {
            if ($dt == "l") {
                //Recherche si la notice existe déjà par rapport au titre
                $requete = "select notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND typdoc='l' AND notice_id!={$notice_id}";
                $resultat = mysql_query($requete);
                $update = false;
                if (mysql_num_rows($resultat)) {
                    $update = true;
                    $n_update = mysql_result($resultat, 0, 0);
                    //Suppression de l'ancienne notice
                    $requete = "DELETE FROM notices WHERE notice_id={$n_update}";
                    mysql_query($requete);
                    $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $n_update;
                    mysql_query($requete);
                    $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $n_update;
                    mysql_query($requete);
                    $requete = "DELETE FROM responsability WHERE responsability_author=" . $n_update;
                    mysql_query($requete);
                }
            } else {
                if ($dt == "r") {
                    //Mise à jour du champ bord
                    if ($info_910[0]) {
                        $no_champ = trouve_champ_perso("bord");
                        if ($no_champ > 0) {
                            //Recherche si la notice existe déjà par rapport au titre
                            $requete = "SELECT notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND niveau_biblio='s' AND niveau_hierar='1' AND notice_id!={$notice_id}";
                            $resultat = mysql_query($requete);
                            if (mysql_num_rows($resultat)) {
                                $notice_update = mysql_result($resultat, 0, 0);
                                $requete = "UPDATE notices_custom_values SET notices_custom_text='" . addslashes(str_replace("##", "\n", $info_910[0])) . "' WHERE notices_custom_champ={$no_champ} AND notices_custom_origine=" . $notice_update;
                                mysql_query($requete);
                                if (!mysql_affected_rows()) {
                                    $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_text) VALUES({$no_champ},{$notice_update},'" . addslashes(str_replace("##", "\n", $info_910[0])) . "')";
                                    mysql_query($requete);
                                }
                            }
                        }
                    }
                    //Suppression de la nouvelle notice
                    $requete = "DELETE FROM notices WHERE notice_id=" . $notice_id;
                    mysql_query($requete);
                }
            }
        }
    }
}
    $abts = pmb_mysql_fetch_object($abtsQuery);
    $abt_numeric = $abts->abt_numeric;
    $exemp_auto = $abts->exemp_auto;
    $type_antivol = $abts->type_antivol;
    $date_debut = $abts->date_debut;
    $date_fin = $abts->date_fin;
}
$requete = "SELECT num_notice,format_periode FROM abts_modeles WHERE modele_id='{$modele_id}'";
$abtsQuery = pmb_mysql_query($requete, $dbh);
if (pmb_mysql_num_rows($abtsQuery)) {
    $abts = pmb_mysql_fetch_object($abtsQuery);
    $format_periode = $abts->format_periode;
    $serial_id = $abts->num_notice;
}
//Préparation nouveau bulletin
$myBulletinage = new bulletinage(0, $serial_id);
//Genération du libellé de période
$print_format = new parse_format();
$print_format->var_format['DATE'] = $value['date_date'];
$print_format->var_format['NUM'] = $nume;
$print_format->var_format['VOL'] = $vol;
$print_format->var_format['TOM'] = $tom;
$print_format->var_format['START_DATE'] = $date_debut;
$print_format->var_format['END_DATE'] = $date_fin;
$requete = "SELECT * FROM abts_abts_modeles WHERE modele_id='{$modele_id}' and abt_id='{$abt_id}' ";
$abtsabtsQuery = pmb_mysql_query($requete, $dbh);
if (pmb_mysql_num_rows($abtsabtsQuery)) {
    $abtsabts = pmb_mysql_fetch_object($abtsabtsQuery);
    $print_format->var_format['START_NUM'] = $abtsabts->num;
    $print_format->var_format['START_VOL'] = $abtsabts->vol;
    $print_format->var_format['START_TOM'] = $abtsabts->tome;
function import_new_notice_suite()
{
    global $dbh;
    global $notice_id;
    global $index_sujets;
    global $pmb_keyword_sep;
    global $id_notices_custom_opsys, $id_notices_custom_type_opsys;
    global $info_001, $info_464, $info_464_a, $info_464_e, $info_464_f, $info_461_3, $info_461_t, $info_200_a, $info_200_e, $info_210_d, $info_902_a, $info_686_a, $info_462_3, $info_462_t;
    global $num_thesaurus, $thes;
    global $info_675_a;
    global $info_600_a, $info_600_b, $info_600_j, $info_600_x, $info_600_y, $info_600_z;
    global $info_601_a, $info_601_b, $info_601_j, $info_601_x, $info_601_y, $info_601_z;
    global $info_602_a, $info_602_b, $info_602_j, $info_602_x, $info_602_y, $info_602_z;
    global $info_605_a, $info_605_b, $info_605_j, $info_605_x, $info_605_y, $info_605_z;
    global $info_606_a, $info_606_b, $info_606_j, $info_606_x, $info_606_y, $info_606_z;
    global $info_607_a, $info_607_b, $info_607_j, $info_607_x, $info_607_y, $info_607_z;
    global $info_610_a, $info_610_e, $info_610_b, $info_610_j, $info_610_x, $info_610_y, $info_610_z, $info_610_3, $info_610;
    global $bulletin_id;
    global $flag_titre_serie_recuperation;
    global $flag_depouillements_464, $flag_depouillements_464_doc_sonore, $flag_depouillements_464_doc_imprime;
    global $aut_700, $aut_701, $aut_702, $aut_710, $aut_711, $aut_712;
    global $accomp_345_c;
    global $table_responsability_function;
    global $lang, $include_path, $xml_changement;
    global $info_345_d;
    global $info_071_a, $info_071_b;
    global $thes_centre_interet, $num_thesaurus_centre_interet, $info_901;
    global $flag_import_610_in_mot_cles, $thes_610, $num_thesaurus_610;
    global $collection_225, $sous_coll;
    // prix dvd et video
    if ($info_345_d[0]) {
        $requete = "update notices set prix='" . addslashes($info_345_d[0]) . "' where notice_id='{$notice_id}' ";
        pmb_mysql_query($requete);
    }
    // EAN
    if ($info_071_a[0]) {
        $requete = "update notices set code='" . addslashes($info_071_a[0]) . "' where notice_id='{$notice_id}' ";
        pmb_mysql_query($requete);
    }
    // Producteur -> Editeur
    if ($info_071_b[0]) {
        $nom = $info_071_b[0];
        $requete = "select ed_id from publishers where ed_name='" . addslashes($nom) . "' ";
        $result = pmb_mysql_query($requete);
        if ($row = pmb_mysql_fetch_row($result)) {
            $ed_id = $row[0];
        } else {
            $requete = "insert into publishers SET ed_name='{$nom}', ";
            $requete .= "index_publisher=' " . strip_empty_words($nom) . " '";
            pmb_mysql_query($requete);
            $ed_id = pmb_mysql_insert_id();
        }
        $requete = "update notices set ed1_id='" . $ed_id . "' where notice_id='{$notice_id}' ";
        pmb_mysql_query($requete);
    }
    // 345_c Matériel d'accompagnement
    if ($accomp_345_c[0]) {
        $requete = "update notices set accomp='" . addslashes($accomp_345_c[0]) . "' where notice_id='{$notice_id}' ";
        pmb_mysql_query($requete);
    }
    update_authors_num_opsys($aut_700, 0);
    update_authors_num_opsys($aut_701, 1);
    update_authors_num_opsys($aut_702, 2);
    update_authors_num_opsys($aut_710, 2);
    update_authors_num_opsys($aut_711, 2);
    update_authors_num_opsys($aut_712, 2);
    if ($xml_changement) {
        xml_save_table("{$include_path}/marc_tables/{$lang}/function_subst.xml", $table_responsability_function);
    }
    //UDC
    if ($info_675_a[0]) {
        $indexint_id = indexint::import(clean_string($info_675_a[0]));
        $requete = "update notices set indexint='{$indexint_id}' where notice_id='{$notice_id}' ";
        pmb_mysql_query($requete);
    }
    if ($aut_700[0][a] != "") {
        if ($aut_700[0][3] != "") {
            $requete = "select author_id from authors where author_name='" . addslashes($aut_700[0][a]) . "' and author_rejete='" . addslashes($aut_700[0][b]) . "' ";
            $result = pmb_mysql_query($requete);
            if ($row = pmb_mysql_fetch_row($result)) {
                $author_id = $row[0];
                $requete = "update authors set author_comment='" . addslashes($aut_700[0][3]) . "' where author_id='{$author_id}' ";
                pmb_mysql_query($requete);
            }
        }
    }
    if ($sous_coll == '1' && $collection_225[0]['a'] != "" && $collection_225[1]['a'] != "") {
        $q = "select coll_id from notices where notice_id='{$notice_id}' ";
        $r = pmb_mysql_query($q, $dbh);
        $coll_id = pmb_mysql_result($r, 0, 0);
        if ($coll_id != '0') {
            /* sous collection */
            $subcollec['name'] = clean_string($collection_225[1]['a']);
            $subcollec['coll_parent'] = $coll_id;
            $subcoll_id = subcollection::import($subcollec);
            $requete = "update notices set subcoll_id='{$subcoll_id}' where notice_id='{$notice_id}' ";
            pmb_mysql_query($requete);
        }
    }
    $bulletin_id = 0;
    // Effacement de la notice temporaire eventuelle
    list($num_opsys, $type_opsys) = explode(" ", $info_001[0]);
    if ($type_opsys == 'UMO:13') {
        $requete = "update notices set niveau_biblio='b', niveau_hierar='2' where notice_id='{$notice_id}' ";
        //print "$requete <br />";
        pmb_mysql_query($requete);
    }
    if ($type_opsys == 'UMO:23' || $type_opsys == 'UMO:3') {
        // Titre de périodique
        $requete = "select * from notices_custom_values where notices_custom_small_text='" . $num_opsys . "'";
        //print "new $type_opsys:    $requete <br />";
        $resultat = pmb_mysql_query($requete);
        //Notice existe-t-elle comme notice temporaire?
        if (@pmb_mysql_num_rows($resultat)) {
            //Si oui, récupération id notice temporaire a supprimer
            $old_n = pmb_mysql_fetch_object($resultat);
            $notice_id_old = $old_n->notices_custom_origine;
            // modifie les anciennes relations sur la vrai notice
            $requete = "update notices_relations set linked_notice='{$notice_id}' where linked_notice='{$notice_id_old}' ";
            //print "$requete <br />";
            pmb_mysql_query($requete);
            $requete = "update bulletins set bulletin_notice='{$notice_id}' where bulletin_notice='{$notice_id_old}' ";
            //print "$requete <br />";
            pmb_mysql_query($requete);
            $requete = "update notices set niveau_biblio='s', niveau_hierar='1' where notice_id='{$notice_id}' ";
            //print "$requete <br />";
            pmb_mysql_query($requete);
            // suppression de la notice temporaire
            $requete = "delete from notices where notice_id=" . $notice_id_old;
            pmb_mysql_query($requete);
            $requete = "delete from notices_custom_values where notices_custom_origine='" . $notice_id_old . "'";
            pmb_mysql_query($requete);
            //print "$requete <br />";
        } else {
            $requete = "update notices set niveau_biblio='s', niveau_hierar='1' where notice_id='{$notice_id}' ";
            pmb_mysql_query($requete);
        }
    } else {
        if ($type_opsys == 'UMO:41' || $type_opsys == 'UMO:42') {
            // Dépouillement (hors article)
            //Rien
        } else {
            if ($type_opsys == 'UMO:43') {
                // Dépouillement article de périodique
                $requete = "select * from notices_custom_values where notices_custom_small_text='" . $num_opsys . "'";
                //print "new $type_opsys:    $requete <br />";
                $resultat = pmb_mysql_query($requete);
                //Notice existe-t-elle comme notice temporaire?
                if (@pmb_mysql_num_rows($resultat)) {
                    //Si oui, récupération id notice temporaire a supprimer
                    $old_n = pmb_mysql_fetch_object($resultat);
                    $notice_id_old = $old_n->notices_custom_origine;
                    // modifie les anciennes relations sur la vrai notice
                    $requete = "update analysis set analysis_notice='{$notice_id}' where analysis_notice='{$notice_id_old}' ";
                    //print "$requete <br />";
                    pmb_mysql_query($requete);
                    $requete = "update notices set niveau_biblio='a', niveau_hierar='2' where notice_id='{$notice_id}' ";
                    //print "$requete <br />";
                    pmb_mysql_query($requete);
                    // suppression de la notice temporaire
                    $requete = "delete from notices where notice_id=" . $notice_id_old;
                    pmb_mysql_query($requete);
                    $requete = "delete from notices_custom_values where notices_custom_origine='" . $notice_id_old . "'";
                    pmb_mysql_query($requete);
                } else {
                    $requete = "update notices set niveau_biblio='a', niveau_hierar='2' where notice_id='{$notice_id}' ";
                    pmb_mysql_query($requete);
                    //print "$requete <br />";
                }
            } else {
                // UMO 1 2 4 8 21 22 24 28
                $is_serie = $type_opsys == 'UMO:21' || $type_opsys == 'UMO:22' || $type_opsys == 'UMO:24' || $type_opsys == 'UMO:28';
                if ($flag_titre_serie_recuperation && $is_serie || !$is_serie) {
                    $requete = "select * from notices_custom_values where notices_custom_small_text='" . $num_opsys . "'";
                    //print "new $type_opsys:    $requete <br />";
                    $resultat = pmb_mysql_query($requete);
                    //Notice existe-t-elle comme notice temporaire?
                    if (@pmb_mysql_num_rows($resultat)) {
                        //Si oui, récupération id notice temporaire a supprimer
                        $old_n = pmb_mysql_fetch_object($resultat);
                        $notice_id_old = $old_n->notices_custom_origine;
                        // modifie les anciennes relations sur la vrai notice
                        $requete = "update notices_relations set linked_notice='{$notice_id}' where linked_notice='{$notice_id_old}' ";
                        //print "$requete <br />";
                        pmb_mysql_query($requete);
                        // suppression de la notice temporaire
                        $requete = "delete from notices where notice_id=" . $notice_id_old;
                        pmb_mysql_query($requete);
                        $requete = "delete from notices_custom_values where notices_custom_origine='" . $notice_id_old . "'";
                        pmb_mysql_query($requete);
                        //print "$requete <br />";
                    }
                } else {
                    if ($is_serie) {
                        // suprimer la notice car on en veut pas
                        del_notice($notice_id);
                        return;
                    }
                }
            }
        }
    }
    //Genre dans Thesaurus
    for ($i = 0; $i < count($info_902_a); $i++) {
        for ($j = 0; $j < count($info_902_a[$i]); $j++) {
            $resultat = categories::searchLibelle(addslashes($info_902_a[$i][$j]), $num_thesaurus, 'fr_FR');
            if (!$resultat) {
                /*vérification de l'existence des categs, sinon création */
                $resultat = create_categ($thes, $thes->num_noeud_racine, $info_902_a[$i][$j], ' ' . strip_empty_words($info_902_a[$i][$j]) . ' ');
            }
            /* ajout de l'indexation à la notice dans la table notices_categories*/
            $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "' ";
            $res_ajout = @pmb_mysql_query($rqt_ajout, $dbh);
        }
    }
    //centre interet dans Thesaurus
    for ($i = 0; $i < count($info_901); $i++) {
        $resultat = categories::searchLibelle(addslashes($info_901[$i]['a']), $num_thesaurus_centre_interet, 'fr_FR');
        if (!$resultat) {
            /*vérification de l'existence des categs, sinon création */
            $resultat = create_categ($thes_centre_interet, $thes_centre_interet->num_noeud_racine, $info_901[$i]['a'], ' ' . strip_empty_words($info_901[$i]['a']) . ' ', $info_901[$i][3]);
        }
        /* ajout de l'indexation à la notice dans la table notices_categories*/
        $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "' ";
        $res_ajout = @pmb_mysql_query($rqt_ajout, $dbh);
    }
    // Pcdm (686) dans le plan de classement
    //	print "<pre>";	print_r($info_686_a);print "</pre>";
    if (count($info_686_a)) {
        //vérification de l'existence des categs, sinon création
        $requete = "select indexint_id from indexint where indexint_name='" . addslashes($info_686_a[0]) . "' and num_pclass='2'";
        //print "$requete <br />";
        $result = pmb_mysql_query($requete);
        if ($row = pmb_mysql_fetch_row($result)) {
            $indexint_id = $row[0];
        } else {
            $requete = "insert into indexint SET indexint_name='" . addslashes($info_686_a[0]) . "', num_pclass='2' ";
            //print "$requete <br />";
            pmb_mysql_query($requete);
            $indexint_id = pmb_mysql_insert_id();
        }
        $requete = "update notices set indexint='{$indexint_id}' where notice_id='{$notice_id}' ";
        //	print "$requete <br />";
        @pmb_mysql_query($requete, $dbh);
    }
    //	if (is_array($index_sujets)) $mots_cles = implode (" $pmb_keyword_sep ",$index_sujets);
    //		else $mots_cles = $index_sujets;
    $mots_cles = '';
    for ($a = 0; $a < sizeof($info_600_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_600_a[$a][0];
        for ($j = 0; $j < sizeof($info_600_b[$a]); $j++) {
            $mots_cles .= " , " . $info_600_b[$a][0];
        }
        for ($j = 0; $j < sizeof($info_600_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_600_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_600_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_600_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_600_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_600_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_600_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_600_z[$a][$j];
        }
    }
    for ($a = 0; $a < sizeof($info_601_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_601_a[$a][0];
        for ($j = 0; $j < sizeof($info_601_b[$a]); $j++) {
            $mots_cles .= " , " . $info_601_b[$a][0];
        }
        for ($j = 0; $j < sizeof($info_601_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_601_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_601_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_601_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_601_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_601_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_601_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_601_z[$a][$j];
        }
    }
    for ($a = 0; $a < sizeof($info_602_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_602_a[$a][0];
        for ($j = 0; $j < sizeof($info_602_b[$a]); $j++) {
            $mots_cles .= " , " . $info_602_b[$a][0];
        }
        for ($j = 0; $j < sizeof($info_602_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_602_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_602_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_602_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_602_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_602_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_602_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_602_z[$a][$j];
        }
    }
    for ($a = 0; $a < sizeof($info_605_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_605_a[$a][0];
        for ($j = 0; $j < sizeof($info_605_b[$a]); $j++) {
            $mots_cles .= " , " . $info_605_b[$a][0];
        }
        for ($j = 0; $j < sizeof($info_605_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_605_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_605_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_605_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_605_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_605_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_605_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_605_z[$a][$j];
        }
    }
    for ($a = 0; $a < sizeof($info_606_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_606_a[$a][0];
        for ($j = 0; $j < sizeof($info_606_b[$a]); $j++) {
            $mots_cles .= " , " . $info_606_b[$a][0];
        }
        for ($j = 0; $j < sizeof($info_606_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_606_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_606_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_606_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_606_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_606_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_606_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_606_z[$a][$j];
        }
    }
    for ($a = 0; $a < sizeof($info_607_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_607_a[$a][0];
        for ($j = 0; $j < sizeof($info_607_b[$a]); $j++) {
            $mots_cles .= " , " . $info_607_b[$a][0];
        }
        for ($j = 0; $j < sizeof($info_607_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_607_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_607_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_607_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_607_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_607_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_607_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_607_z[$a][$j];
        }
    }
    if ($flag_import_610_in_mot_cles) {
        for ($a = 0; $a < sizeof($info_610_a); $a++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_610_a[$a][0];
            for ($j = 0; $j < sizeof($info_610_b[$a]); $j++) {
                $mots_cles .= " , " . $info_610_b[$a][0];
            }
            for ($j = 0; $j < sizeof($info_610_j[$a]); $j++) {
                $mots_cles .= " {$pmb_keyword_sep} " . $info_610_j[$a][$j];
            }
            for ($j = 0; $j < sizeof($info_610_x[$a]); $j++) {
                $mots_cles .= " {$pmb_keyword_sep} " . $info_610_x[$a][$j];
            }
            for ($j = 0; $j < sizeof($info_610_y[$a]); $j++) {
                $mots_cles .= " {$pmb_keyword_sep} " . $info_610_y[$a][$j];
            }
            for ($j = 0; $j < sizeof($info_610_z[$a]); $j++) {
                $mots_cles .= " {$pmb_keyword_sep} " . $info_610_z[$a][$j];
            }
            if (sizeof($info_610_e[$a])) {
                $mots_cles .= " ( ";
                for ($j = 0; $j < sizeof($info_610_e[$a]); $j++) {
                    if ($j) {
                        $mots_cles .= " , ";
                    }
                    $mots_cles .= $info_610_e[$a][$j];
                }
                $mots_cles .= " ) ";
            }
        }
    }
    //print"<pre>";print_r($info_610_a);print_r($info_610_e);print"</pre>";
    for ($a = 0; $a < sizeof($info_610_a); $a++) {
        $resultat = categories::searchLibelle(addslashes($info_610_a[$a][0]), $num_thesaurus_610, 'fr_FR', $thes_610->num_noeud_racine);
        if (!$resultat) {
            /*vérification de l'existence des categs, sinon création */
            $resultat = create_categ($thes_610, $thes_610->num_noeud_racine, $info_610_a[$a][0], ' ' . strip_empty_words($info_610_a[$a][0]) . ' ', $info_610_3[$a][0]);
        }
        for ($j = 0; $j < sizeof($info_610_e[$a]); $j++) {
            if ($info_610_e[$a][$j]) {
                $num_parent = $resultat;
                $resultat = categories::searchLibelle(addslashes($info_610_e[$a][$j]), $num_thesaurus_610, 'fr_FR', $num_parent);
                if (!$resultat) {
                    /*vérification de l'existence des categs, sinon création */
                    $resultat = create_categ($thes_610, $num_parent, $info_610_e[$a][$j], ' ' . strip_empty_words($info_610_e[$a][$j]) . ' ', $info_610_3[$a][0]);
                }
            }
        }
        /* ajout de l'indexation à la notice dans la table notices_categories*/
        $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "' ";
        $res_ajout = @pmb_mysql_query($rqt_ajout, $dbh);
    }
    if (substr($mots_cles, 0, 2) == ' ;') {
        $mots_cles = substr($mots_cles, 2);
    }
    $mots_cles ? $index_matieres = strip_empty_words($mots_cles) : ($index_matieres = '');
    $rqt_maj = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes($index_matieres) . " ' where notice_id='{$notice_id}' ";
    $res_ajout = pmb_mysql_query($rqt_maj, $dbh);
    // insert du param perso mémorisant le numero Opsys de la notice
    if (!$id_notices_custom_opsys) {
        $rqt = "select idchamp from notices_custom where name='num_opsys'";
        $res = pmb_mysql_query($rqt, $dbh);
        if ($res && ($r = pmb_mysql_fetch_object($res))) {
            $id_notices_custom_opsys = $r->idchamp;
        }
        $rqt = "select idchamp from notices_custom where name='type_opsys'";
        $res = pmb_mysql_query($rqt, $dbh);
        if ($res && ($r = pmb_mysql_fetch_object($res))) {
            $id_notices_custom_type_opsys = $r->idchamp;
        }
    }
    $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$notice_id},'" . addslashes($num_opsys) . "')";
    pmb_mysql_query($requete);
    $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_type_opsys},{$notice_id},'" . addslashes($type_opsys) . "')";
    pmb_mysql_query($requete);
    $requete = "select * from notices where notice_id={$notice_id}";
    $resultat = pmb_mysql_query($requete);
    $r = pmb_mysql_fetch_object($resultat);
    // $flag_depouillements_464_doc_sonore //	$flag_depouillements_464_doc_imprime=0;
    // Traiter les dépouillement du champ 464
    if ($flag_depouillements_464) {
        if (is_array($info_464)) {
            switch ($type_opsys) {
                case 'UMO:1':
                    // Documents imprimés Unimarc moyen
                    $niveau_biblio = 'm';
                    $niveau_hierar = '0';
                    break;
                case 'UMO:2':
                    // Documents sonores Unimarc moyen
                    $niveau_biblio = 'm';
                    $niveau_hierar = '0';
                    break;
                case 'UMO:13':
                    // bulletin
                    $niveau_biblio = 'a';
                    $niveau_hierar = '2';
                    break;
                case 'UMO:4':
                    // Documents audiovisuel Unimarc moyen
                    $niveau_biblio = 'm';
                    $niveau_hierar = '0';
                    break;
                case 'UMO:8':
                    // Logiciels - CDrom
                    $niveau_biblio = 'm';
                    $niveau_hierar = '0';
                    break;
                default:
                    $niveau_biblio = 'm';
                    $niveau_hierar = '0';
                    break;
            }
            //print "<pre>";print_r	($info_464);print "</pre>";
            for ($i = 0; $i < sizeof($info_464); $i++) {
                $a_464 = $e_464 = $_3_464 = array();
                $author_id = 0;
                for ($j = 0; $j < sizeof($info_464[$i]); $j++) {
                    if ($info_464[$i][$j]['label'] == 'a') {
                        $a_464[] = $info_464[$i][$j]['content'];
                    }
                    if ($info_464[$i][$j]['label'] == 'e') {
                        $e_464[] = $info_464[$i][$j]['content'];
                    }
                    // Complément du titre
                    if ($info_464[$i][$j]['label'] == '3') {
                        $_3_464[] = $info_464[$i][$j]['content'];
                    }
                    // Complément du titre
                }
                //print "<pre>";print_r	($_3_464);print "</pre>";
                for ($j = 0; $j < sizeof($a_464); $j++) {
                    if ($_3_464[$j]) {
                        $requete = "select author_id from authors where author_comment='" . addslashes($_3_464[$j]) . "' ";
                        $result = pmb_mysql_query($requete);
                        if ($row = pmb_mysql_fetch_row($result)) {
                            $author_id = $row[0];
                            //print $author_id."<br />";
                        }
                    }
                    if ($a_464[$j] != '...') {
                        $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($a_464[$j]) . "',tit2 ='" . addslashes($e_464[$j]) . "', niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}'  ";
                        //if ($type_opsys="UMO:2") print $requete ."<br />";
                        pmb_mysql_query($requete);
                        $depouille_id = pmb_mysql_insert_id();
                        if ($depouille_id) {
                            //link notice
                            $requete = "insert into notices_relations set num_notice='{$depouille_id}', linked_notice ='{$notice_id}', relation_type='a' ";
                            pmb_mysql_query($requete);
                            if ($author_id) {
                                $requete = "insert into responsability SET responsability_fonction='070' , responsability_notice='{$depouille_id}' , responsability_author = {$author_id}, responsability_type=0";
                                //print $requete."<br />";
                                $result = pmb_mysql_query($requete);
                            }
                        }
                    }
                }
            }
            /*
            for ($i=0; $i<sizeof($info_464); $i++) {	
            	$a_464='';	
            	$e_464='';
            	for ($j=0; $j<sizeof($info_464[$i]); $j++) {		
            		if($info_464[$i][$j]['label']=='a') $a_464=$info_464[$i][$j]['content'];
            		if($info_464[$i][$j]['label']=='e') $e_464=$info_464[$i][$j]['content'];
            	}	
            	$requete="insert into notices set typdoc='$r->typdoc', tit1 ='".addslashes($a_464)."',tit2 ='".addslashes($e_464)."', niveau_biblio='$niveau_biblio',niveau_hierar='$niveau_hierar'  ";
            	//if ($type_opsys="UMO:2") print $requete ."<br />";
            	pmb_mysql_query($requete);
            	$depouille_id=pmb_mysql_insert_id();
            	if ($depouille_id) {
            		//link notice
            		$requete="insert into notices_relations set num_notice='$depouille_id', linked_notice ='$notice_id', relation_type='a' ";
            		pmb_mysql_query($requete);
            	}
            } 	
            */
        }
    }
    // $info_461_3,$info_461_t : dépendance d'une notice chapeau
    for ($_3 = 0; $_3 < sizeof($info_461_3); $_3++) {
        switch ($type_opsys) {
            case 'UMO:1':
            case 'UMO:2':
            case 'UMO:4':
            case 'UMO:8':
                if ($flag_titre_serie_recuperation) {
                    // que si on veut
                    $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_461_3[$_3] . "'";
                    //print "$requete  <br />";
                    $resultat = pmb_mysql_query($requete);
                    //Notice chapeau existe-t-elle ?
                    if (@pmb_mysql_num_rows($resultat)) {
                        //Si oui, récupération id
                        $chapeau_id = pmb_mysql_result($resultat, 0, 0);
                    } else {
                        $niveau_biblio = 'm';
                        $niveau_hierar = '1';
                        // Création de la notice temporaire chapeau
                        $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_461_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}'  ";
                        //print "$requete  <br />";
                        pmb_mysql_query($requete);
                        $chapeau_id = pmb_mysql_insert_id();
                        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$chapeau_id},'" . addslashes($info_461_3[$_3]) . "')";
                        //print "$requete <br />";
                        pmb_mysql_query($requete);
                    }
                    if ($chapeau_id) {
                        //link notice
                        $requete = "insert into notices_relations set num_notice='{$notice_id}', linked_notice ='{$chapeau_id}', relation_type='a' ";
                        //print "$requete  <br />";
                        pmb_mysql_query($requete);
                    }
                }
                break;
            case 'UMO:13':
                // bulletin  de périodique
                $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_461_3[$_3] . "'";
                //print "$requete  <br />";
                $resultat = pmb_mysql_query($requete);
                //Notice chapeau existe-t-elle ?
                if (@pmb_mysql_num_rows($resultat)) {
                    //Si oui, récupération id
                    $chapeau_id = pmb_mysql_result($resultat, 0, 0);
                } else {
                    $niveau_biblio = 's';
                    $niveau_hierar = '1';
                    // Création de la notice temporaire chapeau
                    $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_461_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}'  ";
                    //print "$requete  <br />";
                    pmb_mysql_query($requete);
                    $chapeau_id = pmb_mysql_insert_id();
                    $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$chapeau_id},'" . addslashes($info_461_3[$_3]) . "')";
                    //print "$requete <br />";
                    pmb_mysql_query($requete);
                }
                if ($chapeau_id) {
                    //link notice
                    $requete = "insert into notices_relations set num_notice='{$notice_id}', linked_notice ='{$chapeau_id}', relation_type='b' , rank ='1'";
                    //print "$requete  <br />";
                    pmb_mysql_query($requete);
                    // création bulletin
                    $info = array();
                    $bulletin = new bulletinage("", $chapeau_id);
                    $info['bul_titre'] = addslashes($info_200_a[0]);
                    $info['bul_no'] = addslashes($info_200_e[0]);
                    $info['bul_date'] = addslashes($info_200_e[1]);
                    $info['date_date'] = gen_date($info_200_e[1], $info_210_d[0]);
                    $bulletin->bull_num_notice = $notice_id;
                    $bulletin_id = $bulletin->update($info, true);
                }
                break;
            default:
                break;
        }
    }
    // $info_462_3,$info_462_t : Dépouillement, article
    for ($_3 = 0; $_3 < sizeof($info_462_3); $_3++) {
        switch ($type_opsys) {
            case 'UMO:1':
            case 'UMO:2':
            case 'UMO:8':
                $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_462_3[$_3] . "'";
                //print "$requete  <br />";
                $resultat = pmb_mysql_query($requete);
                //Notice chapeau existe-t-elle ?
                if (@pmb_mysql_num_rows($resultat)) {
                    //Si oui, récupération id
                    $chapeau_id = pmb_mysql_result($resultat, 0, 0);
                } else {
                    $niveau_biblio = 'm';
                    $niveau_hierar = '0';
                    // Création de la notice temporaire chapeau
                    $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_462_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}'  ";
                    //print "$requete  <br />";
                    pmb_mysql_query($requete);
                    $chapeau_id = pmb_mysql_insert_id();
                    $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$chapeau_id},'" . addslashes($info_462_3[$_3]) . "')";
                    //print "$requete <br />";
                    pmb_mysql_query($requete);
                }
                if ($chapeau_id) {
                    //link notice
                    $requete = "insert into notices_relations set num_notice='{$notice_id}', linked_notice ='{$chapeau_id}', relation_type='a' ";
                    //print "$requete  <br />";
                    pmb_mysql_query($requete);
                }
                break;
            case 'UMO:13':
                // bulletin de périodique => création des articles
                $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_462_3[$_3] . "'";
                //print "$requete  <br />";
                $resultat = pmb_mysql_query($requete);
                //Notice article existe-t-elle ?
                if (@pmb_mysql_num_rows($resultat)) {
                    //Si oui, récupération id
                    $article_id = pmb_mysql_result($resultat, 0, 0);
                } else {
                    $niveau_biblio = 'a';
                    $niveau_hierar = '2';
                    // Création de la notice temporaire de l'article
                    $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_462_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}'  ";
                    //print "$requete  <br />";
                    pmb_mysql_query($requete);
                    $article_id = pmb_mysql_insert_id();
                    $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$article_id},'" . addslashes($info_462_3[$_3]) . "')";
                    //print "$requete <br />";
                    pmb_mysql_query($requete);
                }
                if ($article_id) {
                    //lien article de bulletin créé dans table analitique
                    $requete = "insert into analysis set analysis_bulletin='{$bulletin_id}', analysis_notice ='{$article_id}' ";
                    //print "$requete  <br />";
                    pmb_mysql_query($requete);
                }
                break;
            default:
                break;
        }
    }
}
Exemple #18
0
function import_new_notice_suite()
{
    global $dbh;
    global $notice_id;
    global $bibliographic_level_origine;
    global $hierarchic_level_origine;
    global $index_sujets;
    global $pmb_keyword_sep;
    global $info_600_a, $info_600_j, $info_600_x, $info_600_y, $info_600_z;
    global $info_601_a, $info_601_j, $info_601_x, $info_601_y, $info_601_z;
    global $info_602_a, $info_602_j, $info_602_x, $info_602_y, $info_602_z;
    global $info_605_a, $info_605_j, $info_605_x, $info_605_y, $info_605_z;
    global $info_606_a, $info_606_j, $info_606_x, $info_606_y, $info_606_z;
    global $info_607_a, $info_607_j, $info_607_x, $info_607_y, $info_607_z;
    global $issn_011;
    global $tit_200a;
    // pour reconstruire et chercher la notice chapeau du pério
    $tit[0]['a'] = implode(" ; ", $tit_200a);
    if (is_array($index_sujets)) {
        $mots_cles = implode(" {$pmb_keyword_sep} ", $index_sujets);
    } else {
        $mots_cles = $index_sujets;
    }
    for ($a = 0; $a < sizeof($info_600_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_600_a[$a][0];
        for ($j = 0; $j < sizeof($info_600_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_600_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_600_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_600_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_600_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_600_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_600_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_600_z[$a][$j];
        }
    }
    for ($a = 0; $a < sizeof($info_601_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_601_a[$a][0];
        for ($j = 0; $j < sizeof($info_601_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_601_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_601_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_601_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_601_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_601_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_601_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_601_z[$a][$j];
        }
    }
    for ($a = 0; $a < sizeof($info_602_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_602_a[$a][0];
        for ($j = 0; $j < sizeof($info_602_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_602_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_602_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_602_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_602_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_602_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_602_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_602_z[$a][$j];
        }
    }
    for ($a = 0; $a < sizeof($info_605_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_605_a[$a][0];
        for ($j = 0; $j < sizeof($info_605_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_605_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_605_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_605_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_605_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_605_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_605_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_605_z[$a][$j];
        }
    }
    for ($a = 0; $a < sizeof($info_606_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_606_a[$a][0];
        for ($j = 0; $j < sizeof($info_606_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_606_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_606_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_606_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_606_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_606_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_606_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_606_z[$a][$j];
        }
    }
    for ($a = 0; $a < sizeof($info_607_a); $a++) {
        $mots_cles .= " {$pmb_keyword_sep} " . $info_607_a[$a][0];
        for ($j = 0; $j < sizeof($info_607_j[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_607_j[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_607_x[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_607_x[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_607_y[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_607_y[$a][$j];
        }
        for ($j = 0; $j < sizeof($info_607_z[$a]); $j++) {
            $mots_cles .= " {$pmb_keyword_sep} " . $info_607_z[$a][$j];
        }
    }
    $mots_cles ? $index_matieres = strip_empty_words($mots_cles) : ($index_matieres = '');
    $rqt_maj = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes($index_matieres) . " ' where notice_id='{$notice_id}' ";
    $res_ajout = mysql_query($rqt_maj, $dbh);
    global $bulletin_ex, $info_207;
    //Cas des périodiques
    if ($bibliographic_level_origine == 's') {
        // c'est une notice de pério, elle a été insérée en monographie
        //Notice chapeau existe-t-elle déjà ?
        $requete = "select notice_id from notices where tit1='" . addslashes(clean_string($tit[0]['a'])) . "' and niveau_hierar='1' and niveau_biblio='s'";
        $resultat = mysql_query($requete);
        if (@mysql_num_rows($resultat)) {
            //Si oui, récupération id et destruction de la dite notice
            $chapeau_id = mysql_result($resultat, 0, 0);
            $requete = "delete from notices where notice_id='{$notice_id}' ";
            $resultat = mysql_query($requete);
            $requete = "delete from responsability where responsability_notice='{$notice_id}' ";
            $resultat = mysql_query($requete);
            $notice_id = $chapeau_id;
            //Bulletin existe-t-il ?
            if ($info_207[0]) {
                $num_bull = $info_207[0];
            } else {
                $num_bull = $tit[0]['a'];
            }
            $requete = "select bulletin_id from bulletins where bulletin_numero='" . addslashes($num_bull) . "' and bulletin_notice={$chapeau_id}";
            $resultat = mysql_query($requete);
            if (@mysql_num_rows($resultat)) {
                //Si oui, récupération id bulletin
                $bulletin_ex = mysql_result($resultat, 0, 0);
            } else {
                //Si non, création bulltin
                $info = array();
                $bulletin = new bulletinage("", $chapeau_id);
                $info['bul_titre'] = addslashes("Bulletin N° " . $num_bull);
                $info['bul_no'] = addslashes($num_bull);
                $info['bul_date'] = addslashes($num_bull);
                $bulletin_ex = $bulletin->update($info);
            }
        } else {
            //Si non, update notice chapeau et création bulletin
            $requete = "update notices set niveau_biblio='s', niveau_hierar='1' where notice_id='{$notice_id}' ";
            $resultat = mysql_query($requete);
            $info = array();
            $bulletin = new bulletinage("", $notice_id);
            $info['bul_titre'] = addslashes("Bulletin N° " . $num_bull);
            $info['bul_no'] = addslashes($num_bull);
            $info['bul_date'] = addslashes($num_bull);
            $bulletin_ex = $bulletin->update($info);
        }
    } else {
        $bulletin_ex = 0;
    }
}
Exemple #19
0
 //Ajout d'une prévision depuis une recherche catalogue
 if (!aff_entete($id_empr, $layout_begin)) {
     error_message($msg[350], $msg[54], 1, './circ.php');
     break;
 }
 print $layout_begin;
 if (!check_record($id_notice, $id_bulletin)) {
     error_message($msg[350], $msg['resa_unknown_record'], 1, './circ.php?');
     break;
 }
 if ($id_notice) {
     $display = new mono_display($id_notice, 6, '', 0, '', '', '', 0, 1, 1, 1);
     print $display->result;
 } else {
     if ($id_bulletin) {
         $bull = new bulletinage($id_bulletin);
         $bull->make_display();
         print $bull->display;
     }
 }
 print "<script type='text/javascript' src='./javascript/tablist.js'></script>\n";
 $form_resa_dates = str_replace('!!resa_date_debut!!', formatdate(today()), $form_resa_dates);
 $form_resa_dates = str_replace('!!resa_date_fin!!', formatdate(today()), $form_resa_dates);
 $form_resa_dates = str_replace('!!resa_deb!!', today(), $form_resa_dates);
 $form_resa_dates = str_replace('!!resa_fin!!', today(), $form_resa_dates);
 $tab_loc_retrait = resa_planning::get_available_locations($id_empr, $id_notice, $id_bulletin);
 if (count($tab_loc_retrait) >= 1) {
     $form_loc_retrait = '<table ><tbody><tr><th>' . $msg['resa_planning_loc_retrait'] . '</th><th>' . $msg['resa_planning_qty_requested'] . '</th></tr>';
     foreach ($tab_loc_retrait as $k => $v) {
         $form_loc_retrait .= '<tr><td width="50%">' . htmlentities($v['location_libelle'], ENT_QUOTES, $charset) . '</td>';
         $form_loc_retrait .= '<td><select name="location[' . $v['location_id'] . ']">';
function genere_bulletin($perio_info, $bull_info, $isbull = true)
{
    global $bl, $hl, $notice_id;
    //on récup et/ou génère le pério
    $perio_id = genere_perio($perio_info);
    $search = "select bulletin_id from bulletins where bulletin_numero LIKE '" . addslashes($bull_info['num']) . "' and bulletin_notice = {$perio_id}";
    $res = pmb_mysql_query($search);
    if (pmb_mysql_num_rows($res) == 0) {
        $bulletin = new bulletinage("", $perio_id);
        $info = array();
        $info['bul_titre'] = '';
        $info['bul_no'] = addslashes($bull_info['num']);
        $bull_id = $bulletin->update($info);
    } else {
        $bull_id = pmb_mysql_result($res, 0, 0);
        //on regarde si une notice n'existe pas déjà pour ce bulletin
        /*$req = "select num_notice from bulletins where bulletin_id = $bull_id and num_notice != 0";
        		$res = pmb_mysql_query($req);
        		//si oui on retire l'enregistrement en cours, et on continue sur la notice existante...
        		if(pmb_mysql_num_rows($res)>0) {
        			notice::del_notice($notice_id);
        			$notice_id = pmb_mysql_result($res,0,0);
        		}*/
    }
    return $bull_id;
}
Exemple #21
0
 function serial_delete()
 {
     global $dbh;
     global $pmb_synchro_rdf, $pmb_notice_img_folder_id;
     $requete = "SELECT bulletin_id,num_notice from bulletins WHERE bulletin_notice='" . $this->serial_id . "' ";
     $myQuery1 = pmb_mysql_query($requete, $dbh);
     if ($myQuery1 && pmb_mysql_num_rows($myQuery1)) {
         while ($bul = pmb_mysql_fetch_object($myQuery1)) {
             $bulletin = new bulletinage($bul->bulletin_id);
             $bulletin->delete();
         }
     }
     //Suppression de la vignette de la notice si il y en a une d'uploadée
     if ($pmb_notice_img_folder_id) {
         $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
         $res = pmb_mysql_query($req, $dbh);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
             $img = $rep->repertoire_path . "img_" . $this->serial_id;
             @unlink($img);
         }
     }
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf($this->serial_id, 0);
     }
     // élimination des docs numériques
     $req_explNum = "select explnum_id from explnum where explnum_notice='" . $this->serial_id . "' ";
     $result_explNum = @pmb_mysql_query($req_explNum, $dbh);
     while ($explNum = pmb_mysql_fetch_object($result_explNum)) {
         $myExplNum = new explnum($explNum->explnum_id);
         $myExplNum->delete();
     }
     $requete = "DELETE FROM responsability WHERE responsability_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($requete, $dbh);
     // suppression des entrées dans les caddies
     $requete = "delete from caddie_content using caddie, caddie_content where caddie_id=idcaddie and type='NOTI' and object_id='" . $this->serial_id . "' ";
     @pmb_mysql_query($requete, $dbh);
     //élimination des champs persos
     $p_perso = new parametres_perso("notices");
     $p_perso->delete_values($this->serial_id);
     // suppression des audits
     audit::delete_audit(AUDIT_NOTICE, $this->serial_id);
     // suppression des categories
     $rqt_del = "delete from notices_categories where notcateg_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     // suppression des bannettes
     $rqt_del = "delete from bannette_contenu where num_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     // suppression des tags
     $rqt_del = "delete from tags where num_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     // suppression des avis
     $rqt_del = "delete from avis where num_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     //suppression des langues
     $query = "delete from notices_langues where num_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($query, $dbh);
     // suppression index global
     $query = "delete from notices_global_index where num_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($query, $dbh);
     // Effacement des occurences de la notice ds la table notices_mots_global_index :
     $requete = "DELETE FROM notices_mots_global_index WHERE id_notice=" . $this->serial_id;
     @pmb_mysql_query($requete, $dbh);
     // Effacement des occurences de la notice ds la table notices_fields_global_index :
     $requete = "DELETE FROM notices_fields_global_index WHERE id_notice=" . $this->serial_id;
     @pmb_mysql_query($requete, $dbh);
     //Suppression de la reference a la notice dans la table suggestions
     $query = "UPDATE suggestions set num_notice = 0 where num_notice=" . $this->serial_id;
     @pmb_mysql_query($query, $dbh);
     //Suppression de la reference a la notice dans la table lignes_actes
     $requete = "UPDATE lignes_actes set num_produit=0, type_ligne=0 where num_produit='" . $this->serial_id . "' and type_ligne in ('1','5') ";
     @pmb_mysql_query($requete, $dbh);
     // liens entre notices
     $requete = "DELETE FROM notices_relations WHERE linked_notice='" . $this->serial_id . "' OR num_notice='" . $this->serial_id . "' ";
     pmb_mysql_query($requete, $dbh);
     //suppression des droits d'acces user_notice
     $requete = "delete from acces_res_1 where res_num=" . $this->serial_id;
     @pmb_mysql_query($requete, $dbh);
     //suppression des droits d'acces empr_notice
     $requete = "delete from acces_res_2 where res_num=" . $this->serial_id;
     @pmb_mysql_query($requete, $dbh);
     // suppression des modeles
     $requete = "SELECT modele_id from abts_modeles WHERE num_notice='" . $this->serial_id . "' ";
     $result_modele = pmb_mysql_query($requete, $dbh);
     while ($modele = pmb_mysql_fetch_object($result_modele)) {
         $mon_modele = new abts_modele($modele->modele_id);
         $mon_modele->delete();
     }
     // Suppression des etats de collections
     $collstate = new collstate(0, $this->serial_id);
     $collstate->delete();
     //si intégré depuis une source externe, on suprrime aussi la référence
     $query = "delete from notices_externes where num_notice=" . $this->serial_id;
     @pmb_mysql_query($query, $dbh);
     // on supprime la notice
     $requete = "DELETE FROM notices WHERE notice_id='" . $this->serial_id . "' ";
     pmb_mysql_query($requete, $dbh);
     $result = pmb_mysql_affected_rows($dbh);
     //Suppression dans les listes de lecture partagées
     $requete = "SELECT id_liste, notices_associees from opac_liste_lecture";
     $res = pmb_mysql_query($requete, $dbh);
     $id_tab = array();
     while ($notices = pmb_mysql_fetch_object($res)) {
         $id_tab = explode(',', $notices->notices_associees);
         for ($i = 0; $i < sizeof($id_tab); $i++) {
             if ($id_tab[$i] == $this->serial_id) {
                 unset($id_tab[$i]);
             }
         }
         $requete = "UPDATE opac_liste_lecture set notices_associees='" . addslashes(implode(',', $id_tab)) . "' where id_liste='" . $notices->id_liste . "'";
         pmb_mysql_query($requete, $dbh);
     }
     $req = "delete from notices_authperso where notice_authperso_notice_num=" . $this->serial_id;
     pmb_mysql_query($req, $dbh);
     return $result;
 }
function show_bulletinage_info($bul_id, $lien_cart_ajout = 1, $lien_cart_suppr = 0, $flag_pointe = 0, $lien_pointe = 0)
{
    global $dbh, $msg, $charset;
    global $base_path;
    global $liste_script;
    global $liste_debut;
    global $liste_fin;
    global $bul_action_bar;
    global $bul_cb_form;
    global $selector_prop;
    global $url_base_suppr_cart;
    global $page, $nbr_lignes, $nb_per_page;
    global $idcaddie;
    $cart_click_bull = "onClick=\"openPopUp('./cart.php?object_type=BULL&item=!!item!!', 'cart', 600, 700, -2, -2, '{$selector_prop}')\"";
    //Calcul des variables pour la suppression d'items
    if ($nb_per_page) {
        $modulo = $nbr_lignes % $nb_per_page;
        if ($modulo == 1) {
            $page_suppr = !$page ? 1 : $page - 1;
        } else {
            $page_suppr = $page;
        }
        $nb_after_suppr = $nbr_lignes ? $nbr_lignes - 1 : 0;
    }
    $affichage_final = '';
    if ($bul_id) {
        if (SESSrights & CATALOGAGE_AUTH) {
            $myBul = new bulletinage($bul_id, 0, "./catalog.php?categ=serials&sub=bulletinage&action=explnum_form&bul_id={$bul_id}&explnum_id=!!explnum_id!!", 0, false);
            $myBul->b_notice_show_expl = 0;
            $myBul->make_display();
            // lien vers la notice chapeau
            $link_parent = "<a href=\"./catalog.php?categ=serials\">" . $msg[4010] . "</a>";
            $link_parent .= "<img src=\"./images/d.gif\" align=\"middle\" hspace=\"5\">";
            $link_parent .= "<a href=\"./catalog.php?categ=serials&sub=view&serial_id=";
            $link_parent .= $myBul->bulletin_notice . "\">" . $myBul->tit1 . '</a>';
            $link_parent .= "<img src=\"./images/d.gif\" align=\"middle\" hspace=\"5\">";
            if ($myBul->bulletin_numero) {
                $link_bulletin = $myBul->bulletin_numero . " ";
            }
            // affichage de la mention de date utile : mention_date si existe, sinon date_date
            $date_affichee = '';
            if ($myBul->mention_date) {
                $date_affichee = " (" . $myBul->mention_date . ")";
            } else {
                if ($myBul->date_date) {
                    $date_affichee = " [" . formatdate($myBul->date_date) . "]";
                }
            }
            $link_bulletin .= $date_affichee;
            $link_parent .= "<a href='./catalog.php?categ=serials&sub=bulletinage&action=view&bul_id={$bul_id}'>{$link_bulletin}</a>";
            $affichage_final .= "<div class='row'><div class='perio-barre'>" . $link_parent . "</div></div>";
            if ($lien_cart_ajout) {
                $cart_link = "<img src='./images/basket_small_20x20.gif' align='middle' alt='basket' title=\"{$msg[400]}\" {$cart_click_bull}>";
                $cart_link = str_replace('!!item!!', $bul_id, $cart_link);
                $cart_link .= "<span id='BULL_drag_" . $bul_id . "'  dragicon=\"{$base_path}/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($link_bulletin, ENT_QUOTES, $charset) . "\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"" . $base_path . "/images/notice_drag.png\"/></span>";
            } else {
                $cart_link = "";
            }
            if ($lien_cart_suppr) {
                if ($lien_pointe) {
                    if ($flag_pointe) {
                        $marque_flag = "<img src='images/depointer.png' id='caddie_" . $idcaddie . "_item_" . $bul_id . "' title=\"" . $msg['caddie_item_depointer'] . "\" onClick='del_pointage_item(" . $idcaddie . "," . $bul_id . ");' style='cursor: pointer'/>";
                    } else {
                        $marque_flag = "<img src='images/pointer.png' id='caddie_" . $idcaddie . "_item_" . $bul_id . "' title=\"" . $msg['caddie_item_pointer'] . "\" onClick='add_pointage_item(" . $idcaddie . "," . $bul_id . ");' style='cursor: pointer'/>";
                    }
                } else {
                    if ($flag_pointe) {
                        $marque_flag = "<img src='images/tick.gif'/>";
                    } else {
                        $marque_flag = "";
                    }
                }
                $cart_link .= "<a href='{$url_base_suppr_cart}&action=del_item&object_type=BULL&item={$bul_id}&page={$page_suppr}&nbr_lignes={$nb_after_suppr}&nb_per_page={$nb_per_page}'><img src='./images/basket_empty_20x20.gif' alt='basket' title=\"" . $msg["caddie_icone_suppr_elt"] . "\" /></a> {$marque_flag}";
            }
        } else {
            $myBul = new bulletinage($bul_id, 0, '');
            $cart_link = '';
        }
        $bul_action_bar = str_replace('!!bul_id!!', $bul_id, $bul_action_bar);
        $bul_action_bar = str_replace('!!nb_expl!!', sizeof($myBul->expl), $bul_action_bar);
        $bul_isbd = $myBul->display;
        $javascript_template = "\n\t\t<div id=\"el!!id!!Parent\" class=\"notice-parent\">\n    \t\t<img src=\"./images/plus.gif\" class=\"img_plus\" name=\"imEx\" id=\"el!!id!!Img\" title=\"" . $msg['admin_param_detail'] . "\" border=\"0\" onClick=\"expandBase('el!!id!!', true); return false;\" hspace=\"3\" />\n    \t\t<span class=\"notice-heada\">!!heada!!</span>\n    \t\t<br />\n\t\t</div>\n\t\t<div id=\"el!!id!!Child\" class=\"notice-child\" style=\"margin-bottom:6px;display:none;\">\n           \t\t!!ISBD!!\n \t\t</div>";
        $aff_expandable = str_replace('!!id!!', $bul_id, $javascript_template);
        $aff_expandable = str_replace('!!heada!!', $cart_link . " " . $bul_isbd, $aff_expandable);
        // affichage des exemplaires associés
        $list_expl = "<div class='exemplaires-perio'>";
        $list_expl .= "<h3>" . $msg[4012] . "</h3>";
        $list_expl .= "<div class='row'>" . get_expl($myBul->expl) . "</div></div>";
        $affichage_final .= $list_expl;
        // affichage des documents numeriques
        $aff_expl_num = $myBul->explnum;
        if ($aff_expl_num) {
            $list_expl = "<div class='exemplaires-perio'><h3>" . $msg['explnum_docs_associes'] . "</h3>";
            $list_expl .= "<div class='row'>" . $aff_expl_num . "</div></div>";
            $affichage_final .= $list_expl;
        }
        //affichage des dépouillements
        $liste = get_analysis($bul_id);
        if ($liste) {
            $liste_dep = $liste;
            $liste_dep .= $liste_fin;
            // inclusion du javascript inline
            $liste_dep .= $liste_script;
        } else {
            $liste_dep .= "<div class='row'>" . htmlentities($msg['bull_no_item'], ENT_QUOTES, $charset) . "</div>";
        }
        $affichage_final .= "\n\t\t\t<div class='depouillements-perio'>\n\t\t\t\t<h3>" . $msg[4013] . "</h3>\n\t\t\t\t<div class='row'>\n\t\t\t\t\t{$liste_dep}\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
        // affichage des résas
        $aff_resa = resa_list(0, $bul_id, 0);
        if ($aff_resa) {
            $affichage_final .= "<h3>" . $msg['resas'] . "</h3>" . $aff_resa;
        }
    }
    $aff_expandable = str_replace('!!ISBD!!', $affichage_final, $aff_expandable);
    return $aff_expandable;
}