Пример #1
0
 function genSignatureNotice()
 {
     global $msg, $dbh, $charset, $PMBusername;
     if (SESSrights & ADMINISTRATION_AUTH) {
         $result .= "<h3>" . htmlentities($msg["gen_signature_notice"], ENT_QUOTES, $charset) . "</h3>";
         $sign = new notice_doublon();
         $query = mysql_query("SELECT notice_id FROM notices");
         if (mysql_num_rows($query)) {
             while ($row = mysql_fetch_row($query)) {
                 $val = $sign->gen_signature($row[0]);
                 mysql_query("update notices set signature='{$val}' where notice_id=" . $row[0], $dbh);
             }
             mysql_free_result($query);
         }
         $notices = mysql_query("SELECT count(1) FROM notices", $dbh);
         $count = mysql_result($notices, 0, 0);
         $result .= $count . " " . htmlentities($msg["gen_signature_notice_status_end"], ENT_QUOTES, $charset);
         $opt = mysql_query('OPTIMIZE TABLE notices');
     } else {
         $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername);
     }
     return $result;
 }
Пример #2
0
 function doSync($id_connector, $id_source, $auto_import = false, $id_tache = '', $callback_listen_command = NULL, $callback_deals_command = NULL)
 {
     global $base_path, $dbh, $PMBuserid, $PMBusername, $msg, $charset;
     if (!$id_connector || !$id_source) {
         return array();
     }
     if (SESSrights & ADMINISTRATION_AUTH) {
         $this->callback_listen_command = $callback_listen_command;
         $this->callback_deals_command = $callback_deals_command;
         $result = array();
         $this->id_source = $id_source;
         $this->id_tache = $id_tache;
         $contrs = new connecteurs();
         require_once $base_path . "/admin/connecteurs/in/" . $contrs->catalog[$id_connector]["PATH"] . "/" . $contrs->catalog[$id_connector]["NAME"] . ".class.php";
         eval("\$conn=new " . $contrs->catalog[$id_connector]["NAME"] . "(\"" . $base_path . "/admin/connecteurs/in/" . $contrs->catalog[$id_connector]["PATH"] . "\");");
         //Vérification qu'il n'y a pas de synchronisation en cours...
         $is_already_sync = false;
         $recover_env = "";
         $recover = false;
         $requete = "select * from source_sync where source_id={$id_source}";
         $resultat = mysql_query($requete, $dbh);
         if (mysql_num_rows($resultat)) {
             $rs_s = mysql_fetch_object($resultat);
             if (!$rs_s->cancel) {
                 $result[] = $conn->msg["connecteurs_sync_currentexists"];
                 $is_already_sync = true;
             } else {
                 $recover = true;
                 $recover_env = $rs_s->env;
                 $env = array();
             }
         } else {
             $env = $conn->get_maj_environnement($id_source);
         }
         if (!$is_already_sync) {
             if (!$recover) {
                 $requete = "insert into source_sync (source_id,nrecu,ntotal,date_sync) values({$id_source},0,0,now())";
                 $r = mysql_query($requete, $dbh);
             } else {
                 $requete = "update source_sync set cancel=0 where source_id={$id_source}";
                 $r = mysql_query($requete, $dbh);
             }
             if ($r) {
                 $n_maj = $conn->maj_entrepot($id_source, array(&$this, "callback_progress"), $recover, $recover_env);
                 $result[] = sprintf($msg["connecteurs_count_notices"], $n_maj);
                 $result[] = $conn->error_message;
                 if (!$conn->error) {
                     $this->callback_progress(1, $n_maj, $n_maj);
                     $percent = 1;
                     $requete = "update source_sync set percent=" . round($percent * 100) . " where source_id={$id_source}";
                     $r = mysql_query($requete, $dbh);
                     $requete = "delete from source_sync where source_id=" . $id_source;
                     mysql_query($requete);
                     $requete = "update connectors_sources set last_sync_date=now() where source_id=" . $id_source;
                     mysql_query($requete, $dbh);
                 } else {
                     if ($conn->break_maj($id_source)) {
                         $requete = "delete from source_sync where source_id=" . $id_source;
                     } else {
                         $requete = "update source_sync set cancel=2 where source_id=" . $id_source;
                     }
                     mysql_query($requete, $dbh);
                     $result[] = $conn->error_message;
                 }
             } else {
                 $result[] = mysql_error();
             }
         } else {
             $result[] = $msg["connecteurs_sync_currentexists"];
         }
         //si l'import automatique est activé
         if ($auto_import) {
             //on va chercher les notices non intégrées
             $query = "select distinct entrepot_source_" . $id_source . ".recid from entrepot_source_" . $id_source . " left join notices_externes on notices_externes.recid = concat(connector_id,' " . $id_source . " ',ref) where num_notice is null";
             $result = mysql_query($query);
             if (mysql_num_rows($result)) {
                 while ($row = mysql_fetch_object($result)) {
                     $infos = entrepot_to_unimarc($row->recid);
                     if ($infos['notice']) {
                         $z = new z3950_notice("unimarc", $infos['notice'], $infos['source_id']);
                         if ($pmb_notice_controle_doublons != 0) {
                             $sign = new notice_doublon(true, $infos['source_id']);
                             $signature = $sign->gen_signature($row->recid);
                         } else {
                             $signature = "";
                         }
                         $z->signature = $signature;
                         if ($infos['notice']) {
                             $z->notice = $infos['notice'];
                         }
                         if ($infos['source_id']) {
                             $z->source_id = $infos['source_id'];
                         }
                         $z->var_to_post();
                         $ret = $z->insert_in_database(false);
                         $id_notice = $ret[1];
                         $rqt = "select recid from external_count where rid = '{$row->recid}'";
                         $res = mysql_query($rqt);
                         if (mysql_num_rows($res)) {
                             $recid = mysql_result($res, 0, 0);
                         }
                         $req = "insert into notices_externes set num_notice = '" . $id_notice . "', recid = '" . $recid . "'";
                         mysql_query($req);
                     }
                 }
             }
         }
         return $result;
     } else {
         return array();
     }
 }
Пример #3
0
} else {
    require_once $base_path . "/catalog/z3950/func_other.inc.php";
}
print "<form class='form-{$current_module}' name='back' method=\"post\" action=\"catalog.php?categ=search&mode=7&sub=launch\">\n\t<input type='hidden' name='serialized_search' value='" . htmlentities(stripslashes($serialized_search), ENT_QUOTES, $charset) . "'/>\n\t<input type='submit' name='ok' class='bouton' value='" . $msg["connecteurs_back_to_list"] . "' />&nbsp;\n</form>\n<script type='text/javascript'>\n\tfunction force_integer(ext_id){\n\t\tvar ajax = new http_request();\n\t\tajax.request('" . $base_path . "/ajax.php?module=catalog&categ=force_integer&item='+ext_id,true,'&serialized_search=" . $sc->serialize_search() . "&page=" . $page . "',true,integer_callback);\n\t}\n\t\n\tfunction integer_callback(response){\n\t\tdata = eval('('+response+')');\n\t\tvar div = document.createElement('div');\n\t\tdiv.setAttribute('id','notice_externe_'+data.id);\n\t\tdiv.innerHTML = data.html;\n\t\tdocument.getElementById('notice_externe_'+data.id).parentNode.replaceChild(div,document.getElementById('notice_externe_'+data.id));\n\t}\n</script>\n";
if (is_array($external_notice_to_integer) && count($external_notice_to_integer)) {
    foreach ($external_notice_to_integer as $external_notice) {
        //Construction de la notice UNIMARC
        $infos = entrepot_to_unimarc($external_notice);
        $biblio_notice = "";
        if ($infos['notice']) {
            $z = new z3950_notice("unimarc", $infos['notice'], $infos['source_id']);
            if ($z->bibliographic_level == "a" && $z->hierarchic_level == "2") {
                $biblio_notice = "art";
            }
            if ($pmb_notice_controle_doublons != 0) {
                $sign = new notice_doublon(true, $infos['source_id']);
                $signature = $sign->gen_signature($external_notice);
                $requete = "select signature, niveau_biblio ,niveau_hierar ,notice_id from notices where signature='{$signature}'";
                $result = mysql_query($requete);
                if ($dbls = mysql_num_rows($result)) {
                    //affichage de l'erreur, en passant tous les param postes (serialise) pour l'eventuel forcage
                    require_once "{$class_path}/mono_display.class.php";
                    print "\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<div id='notice_externe_" . $external_notice . "'>\n\t\t\t\t\t\t<div class='erreur'>{$msg['540']}</div>\n\t\t\t\t\t\t<script type='text/javascript' src='./javascript/tablist.js'></script>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t<div class='colonne10'>\n\t\t\t\t\t\t\t\t<img src='./images/error.gif' align='left' />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class='colonne80'>\n\t\t\t\t\t\t\t\t<strong>" . $msg["gen_signature_erreur_similaire"] . "</strong>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t<input type='button' class='bouton' onclick='force_integer(" . $external_notice . ")' value=' " . htmlentities($msg["gen_signature_forcage"], ENT_QUOTES, $charset) . " '/>\n\t\t\t\t\t\t</div>";
                    if ($dbls < $nb_per_page_search) {
                        $maxAffiche = $dbls;
                        echo "<div class='row'><strong>" . sprintf($msg["gen_signature_erreur_similaire_nb"], $dbls, $dbls) . "</strong></div>";
                    } else {
                        $maxAffiche = $nb_per_page_search;
                        echo "<div class='row'><strong>" . sprintf($msg["gen_signature_erreur_similaire_nb"], $maxAffiche, $dbls) . "</strong></div>";
                    }
                    $enCours = 1;
Пример #4
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;
     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;
 }
Пример #5
0
}
require_once $class_path . "/search.class.php";
require_once $class_path . "/searcher.class.php";
require_once $class_path . "/mono_display_unimarc.class.php";
require_once $include_path . "/external.inc.php";
require_once $class_path . "/z3950_notice.class.php";
require_once $class_path . "/notice_doublon.class.php";
if ($item) {
    $infos = entrepot_to_unimarc($item);
}
//on regarde si la signature existe déjà..;
$signature = "";
$z = new z3950_notice("unimarc", $infos['notice'], $infos['source_id']);
//on reporte la signature de la notice calculée ou non...
if ($pmb_notice_controle_doublons != 0) {
    $sign = new notice_doublon(true, $infos['source_id']);
    $signature = $sign->gen_signature($item);
}
$z->signature = $signature;
if ($infos['notice']) {
    $z->notice = $infos['notice'];
}
if ($infos['source_id']) {
    $z->source_id = $infos['source_id'];
}
$z->var_to_post();
$ret = $z->insert_in_database(true);
//on conserve la trace de l'origine de la notice...
$id_notice = $ret[1];
$rqt = "select recid from external_count where rid = '{$item}'";
$res = pmb_mysql_query($rqt);
Пример #6
0
function import_new_notice()
{
    global $dbh;
    global $notice_id;
    global $bulletin_ex;
    //Identifiant du bulletin
    $bulletin_ex = 0;
    global $id_unimarc;
    global $notices_crees;
    global $bulletins_crees;
    global $notices_a_creer;
    global $bulletins_a_creer;
    global $base_path;
    global $pmb_keyword_sep;
    global $link_generate;
    global $doc_type;
    global $hierarchic_level;
    global $bibliographic_level;
    global $isbn_OK;
    global $prix;
    global $prix_cd;
    global $cb;
    global $tit_200a;
    global $tit_200c;
    global $tit_200d;
    global $tit_200e;
    global $tit_200v;
    global $serie_200;
    global $editor;
    global $editeur_lieu;
    global $editeur_adr;
    global $editeur_nom;
    global $editeur_date;
    global $editeur_pays;
    global $editeur_pmbfields;
    global $no_edition;
    global $npages;
    global $ill;
    global $size;
    global $accomp;
    global $collection_225;
    global $n_contenu;
    global $n_resume;
    global $n_gen;
    global $EAN;
    global $collection_410;
    global $collection_411;
    global $tu_500;
    global $tu_500_r;
    global $tu_500_s;
    global $tu_500_j;
    global $serie;
    global $index_sujets;
    global $dewey;
    global $dewey_l;
    global $aut_700;
    global $aut_701;
    global $aut_702;
    global $aut_710;
    global $aut_711;
    global $aut_712;
    global $origine_notice;
    global $lien;
    global $eformat;
    global $analytique;
    global $statutnot;
    global $indicateur;
    global $add_explnum;
    global $info_686;
    global $authorities_notices;
    global $authorities_default_origin;
    $origin_authority = $authorities_default_origin;
    $add_explnum = FALSE;
    /* traitement des éditeurs */
    $coll_id = 0;
    $subcoll_id = 0;
    $serie_id = 0;
    $tnvol_ins = "";
    $ed1_id = 0;
    $ed2_id = 0;
    $year = "";
    $date_parution = "0000-00-00";
    //On récupère le tableau des notices créées à partir du fichier temporaire (rechargement d'iframe)
    if ($link_generate && !isset($notices_crees)) {
        $tabimport_id = file_get_contents("{$base_path}/temp/liste_id" . SESSid . ".txt");
        if ($tabimport_id) {
            $tabimport_id = unserialize($tabimport_id);
            $notices_crees = $tabimport_id['notices_existantes'];
            $notices_a_creer = $tabimport_id['notices_a_creer'];
            $bulletins_crees = $tabimport_id['bulletins_crees'];
            $bulletins_a_creer = $tabimport_id['bulletins_a_creer'];
        }
    }
    if (!is_array($notices_crees)) {
        $notices_crees = array();
    }
    //Pour le cas ou on est sur une notice (bidon) d'article juste pour les exemplaires de bulletin
    if ($bibliographic_level == "a" && $tit_200d[0] == "Article_expl_bulletin") {
        //On importe rien
        return;
    } elseif ($tit_200d[0] == "Article_expl_bulletin") {
        //Pour le cas ou on import sans les liens un fichier exporter avec les exemplaires et les liens
        $tit_200d[0] = "";
    }
    if ($bibliographic_level != "a" && $bibliographic_level != "b") {
        //Pour les articles et les bulletins on ne garde pas les informations suivantes
        $year = clean_string($editeur_date[0]);
        $date_parution = notice::get_date_parution($year);
        //traitement des éditeurs
        $editor = array();
        foreach ($editeur_nom as $key_nom1 => $nom1) {
            foreach ($nom1 as $key_nom2 => $nom2) {
                $mon_ed = array();
                $mon_ed["c"] = $nom2;
                if ($editeur_adr[$key_nom1][$key_nom2]) {
                    $mon_ed["b"] = $editeur_adr[$key_nom1][$key_nom2];
                }
                if ($editeur_lieu[$key_nom1][$key_nom2]) {
                    $mon_ed["a"] = $editeur_lieu[$key_nom1][$key_nom2];
                }
                if ($editeur_pays[$key_nom1][$key_nom2]) {
                    $mon_ed["z"] = $editeur_pays[$key_nom1][$key_nom2];
                }
                if ($editeur_pmbfields[$key_nom1][$key_nom2]) {
                    //Si j'ai ces informations c'est un export PMB donc je n'ai pas deux editeurs dans le même 210
                    foreach ($editeur_pmbfields[$key_nom1] as $val9) {
                        if (preg_match("/^(.+?):(.+)\$/", $val9, $matches)) {
                            $mon_ed[trim($matches[1])] = $matches[2];
                        }
                    }
                }
                $editor[] = $mon_ed;
            }
        }
        $ed = array();
        $ed['name'] = clean_string($editor[0]['c']);
        $ed['adr'] = clean_string($editor[0]['b']);
        if ($editor[0]['adr1']) {
            $ed['adr'] = clean_string($editor[0]['adr1']);
        }
        //Si cela vient de PMB dans $b j'ai un concat
        $ed['ville'] = clean_string($editor[0]['a']);
        $ed['adr2'] = clean_string($editor[0]['adr2']);
        $ed['cp'] = clean_string($editor[0]['cp']);
        $ed['pays'] = clean_string($editor[0]['z']);
        $ed['web'] = clean_string($editor[0]['web']);
        $ed['ed_comment'] = clean_string($editor[0]['comment']);
        $ed1_id = editeur::import($ed);
        $ed = array();
        $ed['name'] = clean_string($editor[1]['c']);
        $ed['adr'] = clean_string($editor[1]['b']);
        if ($editor[1]['adr1']) {
            $ed['adr'] = clean_string($editor[1]['adr1']);
        }
        //Si cela vient de PMB dans $b j'ai un concat
        $ed['ville'] = clean_string($editor[1]['a']);
        $ed['adr2'] = clean_string($editor[1]['adr2']);
        $ed['cp'] = clean_string($editor[1]['cp']);
        $ed['pays'] = clean_string($editor[1]['z']);
        $ed['web'] = clean_string($editor[1]['web']);
        $ed['ed_comment'] = clean_string($editor[1]['comment']);
        $ed2_id = editeur::import($ed);
        if ($bibliographic_level != "s") {
            //Pour les periodiques on ne garde pas les informations suivantes
            /* traitement des collections */
            $coll_name = "";
            $subcoll_name = "";
            $coll_issn = "";
            $subcoll_issn = "";
            $nocoll_ins = "";
            /* traitement de 225$a, si rien alors 410$t pour la collection */
            if ($collection_225[0]['a'] != "") {
                $coll_name = $collection_225[0]['a'];
                $coll_issn = $collection_225[0]['x'];
            } elseif ($collection_410[0]['t'] != "") {
                $coll_name = $collection_410[0]['t'];
                $coll_issn = $collection_410[0]['x'];
                $coll_aut_number = $collection_410[0]['3'];
            }
            /* traitement de 225$i, si rien alors 411$t pour la sous-collection */
            if ($collection_225[0]['i'] != "") {
                $subcoll_name = $collection_225[0]['i'];
                $subcoll_issn = $collection_225[1]['x'];
            } elseif ($collection_411[0]['t'] != "") {
                $subcoll_name = $collection_411[0]['t'];
                $subcoll_issn = $collection_411[0]['x'];
                $coll_aut_number = $collection_411[0]['3'];
            }
            /* gaffe au nocoll, en principe en 225$v selon FL  sinon en 410$v ou 411$v*/
            if ($collection_225[0]['v'] != "") {
                $nocoll_ins = $collection_225[0]['v'];
            } elseif ($collection_410[0]['v'] != "") {
                $nocoll_ins = $collection_410[0]['v'];
            } elseif ($collection_411[0]['v'] != "") {
                $nocoll_ins = $collection_411[0]['v'];
            } else {
                $nocoll_ins = "";
            }
            $collec['name'] = clean_string($coll_name);
            $collec['parent'] = $ed1_id;
            $collec['issn'] = clean_string($coll_issn);
            $collec['authority_number'] = $coll_aut_number;
            if ($collec['authority_number']) {
                $coll_id = keep_authority_infos($collec['authority_number'], "collection", $origin_authority, 0, $collec);
            } else {
                $coll_id = collection::import($collec);
            }
            /* sous collection */
            $subcollec['name'] = clean_string($subcoll_name);
            $subcollec['coll_parent'] = $coll_id;
            $subcollec['issn'] = clean_string($subcoll_issn);
            $subcollec['authority_number'] = $subcoll_aut_number;
            if ($subcollec['authority_number']) {
                $subcoll_id = keep_authority_infos($subcollec['authority_number'], "subcollection", $origin_authority, 0, $subcollec);
            } else {
                $subcoll_id = collection::import($subcollec);
            }
            $subcoll_id = subcollection::import($subcollec);
            /* traitement des séries */
            $serie_id = serie::import(clean_string($serie[0]['t']));
            $tnvol_ins = $serie[0]['v'];
            if (!$serie_id) {
                $serie_id = serie::import(clean_string($serie_200[0]['i']));
                $serie[0]['t'] = $serie_200[0]['i'];
                //$tnvol_ins=$serie_200[0]['h'];
            }
            if (!$tnvol_ins) {
                $tnvol_ins = $serie_200[0]['h'];
            }
        }
    }
    /* traitement de Dewey */
    $indexint_id = indexint::import(clean_string($dewey[0]), $dewey_l[0]);
    if (!$indexint_id and count($info_686)) {
        $indexint_id = indexint::import(clean_string($info_686[0]["a"]), $info_686[0]["l"], 99);
    }
    /* Traitement des notes */
    $n_resume_total = "";
    $n_gen_total = "";
    $n_contenu_total = "";
    if (!$n_resume) {
        $n_resume = array();
    }
    $n_resume_total = implode("\n", $n_resume);
    if (!$n_gen) {
        $n_gen = array();
    }
    $n_gen_total = implode("\n", $n_gen);
    if (!$n_contenu) {
        $n_contenu = array();
    }
    $n_contenu_total = implode("\n", $n_contenu);
    // ajout : les 464$a sont ajouté aux notes de contenu à déporter éventuellement dans func_bdp41 si besoin
    for ($i = 0; $i < count($analytique); $i++) {
        $ana = array();
        for ($j = 0; $j < count($analytique[$i]); $j++) {
            $ana[$analytique[$i][$j]["label"]][] = $analytique[$i][$j]["content"];
        }
        if (count($ana["a"]) == 1) {
            //Selon la norme le $a n'est pas répétable dans le même champ 4XX
            $n_contenu_total .= $ana["a"][0] . (count($ana["e"]) ? " ; " . implode(" ; ", $ana["e"]) : "") . (count($ana["f"]) ? " / " . implode(" / ", $ana["f"]) : "") . (count($ana["g"]) ? " / " . implode(" / ", $ana["g"]) : "") . "\n";
        } else {
            //Au cas où
            for ($j = 0; $j < count($ana["a"]); $j++) {
                $n_contenu_total .= $ana["a"][$j] . ($ana["e"][$j] ? " ; " . $ana["e"][$j] : "") . ($ana["f"][$j] ? " / " . $ana["f"][$j] : "") . ($ana["g"][$j] ? " / " . $ana["g"][$j] : "") . "\n";
            }
        }
    }
    // Préparation des titres
    $tit[0]['a'] = implode(" ; ", $tit_200a);
    if ($bibliographic_level != "a" && $bibliographic_level != "b" && $bibliographic_level != "s") {
        //Pour les articles et les bulletins on ne garde pas les informations suivantes
        $tit[0]['c'] = implode(" ; ", $tit_200c);
    } else {
        $tit[0]['c'] = "";
    }
    $tit[0]['d'] = implode(" ; ", $tit_200d);
    $tit[0]['e'] = implode(" ; ", $tit_200e);
    if (is_array($index_sujets)) {
        $index_l = implode(' ' . $pmb_keyword_sep . ' ', $index_sujets);
    } else {
        $index_l = $index_sujets;
    }
    // if (trim($n_resume_total)=="") $n_resume_total = $n_gen_total." ".$n_contenu_total ;
    /* Origine de la notice */
    $origine_not['nom'] = clean_string($origine_notice[0]['b']);
    $origine_not['pays'] = clean_string($origine_notice[0]['a']);
    $orinot_id = origine_notice::import($origine_not);
    if ($orinot_id == 0) {
        $orinot_id = 1;
    }
    if ($bibliographic_level != "a" && $bibliographic_level != "s") {
        //Pour les articles et les periodiques on ne garde pas les informations suivantes
        // prix
        $price = $prix[0];
        //Pour les CDs
        if (!$price) {
            $price = $prix_cd[0];
        }
        $illustration = implode(" : ", $ill);
        $taille = implode(" ; ", $size);
        $mat_accomp = implode(" + ", $accomp);
        if ($bibliographic_level != "b") {
            $mention_edit = implode(", ", $no_edition);
        } else {
            $mention_edit = "";
        }
    } else {
        $illustration = "";
        $taille = "";
        $mat_accomp = "";
    }
    if ($bibliographic_level != "s") {
        //Pour les periodiques on ne garde pas les informations suivantes
        $nbpages = implode(" - ", $npages);
    } else {
        $nbpages = "";
    }
    /* and at least, the insertion in notices table */
    $sql_ins = "insert into notices (\n\t\t\t\t\t\ttypdoc\t\t\t,\n\t\t\t\t\t\tcode        \t,\n\t\t\t\t\t\tstatut\t\t\t,\n\t\t                tit1            ,\n\t\t                tit2            ,\n\t\t                tit3            ,\n\t\t                tit4            ,\n\t\t                tparent_id      ,\n\t\t                tnvol           ,\n\t\t                ed1_id          ,\n\t\t                ed2_id          ,\n\t\t                year            ,\n\t\t                npages          ,\n\t\t                ill             ,\n\t\t                size            ,\n\t\t                accomp          ,\n\t\t                coll_id         ,\n\t\t                subcoll_id      ,\n\t\t                nocoll          ,\n\t\t                mention_edition\t,\n\t\t                n_gen           ,\n\t\t                n_contenu       ,\n\t\t                n_resume        ,\n\t\t                index_l,\n\t\t                indexint,\n\t\t                niveau_biblio,\n\t\t                niveau_hierar,\n\t\t                lien,\n\t\t                eformat,\n\t\t                origine_catalogage,\n\t\t                prix,\n\t\t\t\t\t\tcreate_date,\n\t\t\t\t\t\tdate_parution\n\t\t\t\t) values (\n\t\t\t\t\t\t'" . $doc_type . "',\t\n\t\t\t\t\t\t'" . addslashes($isbn_OK) . "',\t\n\t\t\t\t\t\t'" . $statutnot . "',\n\t\t                '" . addslashes(clean_string($tit[0]['a'])) . "',\n\t\t                '" . addslashes(clean_string($tit[0]['c'])) . "',\n\t\t                '" . addslashes(clean_string($tit[0]['d'])) . "',\n\t\t                '" . addslashes(clean_string($tit[0]['e'])) . "',\n\t\t                '" . $serie_id . "',\n\t\t                '" . addslashes($tnvol_ins) . "',\n\t\t                 " . $ed1_id . " ,\n\t\t                 " . $ed2_id . " ,\n\t\t                '" . addslashes($year) . "',\n\t\t                '" . addslashes($nbpages) . "',\n\t\t                '" . addslashes($illustration) . "',\n\t\t                '" . addslashes($taille) . "',\n\t\t                '" . addslashes($mat_accomp) . "',\n\t\t                 " . $coll_id . " ,\n\t\t                 " . $subcoll_id . " ,\n\t\t                '" . addslashes($nocoll_ins) . "',\n\t\t                '" . addslashes($mention_edit) . "',\n\t\t                '" . addslashes($n_gen_total) . "',\n\t\t             \t'" . addslashes($n_contenu_total) . "',\n\t\t             \t'" . addslashes($n_resume_total) . "',\n\t\t                '" . addslashes($index_l) . "',\n\t\t                '" . $indexint_id . "',\n\t\t                '" . $bibliographic_level . "',\n\t\t                '" . $hierarchic_level . "',\n\t\t                '" . addslashes($lien[0]) . "',\n\t\t                '" . addslashes($eformat[0]) . "',\n\t\t                '" . $orinot_id . "',\n\t\t                '" . addslashes($price) . "',\n\t\t\t\t\t\tsysdate(),\n\t\t\t\t\t\t'" . addslashes($date_parution) . "'\n\t\t\t\t\t\t)";
    mysql_query($sql_ins, $dbh) or die("Couldn't insert into notices ! = " . $sql_ins);
    $notice_id = mysql_insert_id($dbh);
    notice::majNotices($notice_id);
    audit::insert_creation(AUDIT_NOTICE, $notice_id);
    //calcul des droits d'accès s'ils sont activés
    calc_notice_acces_rights($notice_id);
    // on devait attendre que la notice soit intégrée pour faire l'association avec la notice..;
    if ($collec['authority_number']) {
        keep_authority_infos($collec['authority_number'], "scollection", $origin_authority, $notice_id, $collec);
    }
    if ($subcollec['authority_number']) {
        keep_authority_infos($subcollec['authority_number'], "subcollection", $origin_authority, $notice_id, $subcollec);
    }
    /* INSERT de la notice OK, on va traiter les auteurs
    		70# : personnal : type auteur 70                71# : collectivités : type auteur 71
    		1 seul en 700                                   idem pour les déclinaisons          
    		n en 701 n en 702
    		les 7#0 tombent en auteur principal : responsability_type = 0
    		les 7#1 tombent en autre auteur : responsability_type = 1
    		les 7#2 tombent en auteur secondaire : responsability_type = 2
    		*/
    $aut_array = array();
    /* on compte tout de suite le nbre d'enreg dans les répétables */
    $nb_repet_701 = sizeof($aut_701);
    $nb_repet_711 = sizeof($aut_711);
    $nb_repet_702 = sizeof($aut_702);
    $nb_repet_712 = sizeof($aut_712);
    //indicateur["710"];
    /* renseignement de aut0 */
    if ($aut_700[0][a] != "") {
        /* auteur principal en 700 ? */
        $aut_array[] = array("entree" => $aut_700[0]['a'], "rejete" => $aut_700[0]['b'], "author_comment" => $aut_700[0]['c'] . " " . $aut_700[0]['d'], "date" => $aut_700[0]['f'], "type_auteur" => "70", "fonction" => $aut_700[0][4], "id" => 0, "responsabilite" => 0, "ordre" => 0, 'authority_number' => $aut_700[0][3]);
    } elseif ($aut_710[0]['a'] != "") {
        /* auteur principal en 710 ? */
        if (substr($indicateur["710"][0], 0, 1) == "1") {
            $type_auteur = "72";
        } else {
            $type_auteur = "71";
        }
        $lieu = $aut_710[0]['e'];
        if (!$lieu) {
            $lieu = $aut_710[0]['k'];
        }
        $aut_array[] = array("entree" => $aut_710[0]['a'], "rejete" => $aut_710[0]['g'], "subdivision" => $aut_710[0]['b'], "author_comment" => $aut_710[0]['c'], "numero" => $aut_710[0]['d'], "lieu" => $lieu, "ville" => $aut_710[0]['l'], "pays" => $aut_710[0]['m'], "web" => $aut_710[0]['n'], "date" => $aut_710[0]['f'], "type_auteur" => $type_auteur, "fonction" => $aut_710[0][4], "id" => 0, "responsabilite" => 0, "ordre" => 0, 'authority_number' => $aut_710[0][3]);
    }
    /* renseignement de aut1 */
    for ($i = 0; $i < $nb_repet_701; $i++) {
        $aut_array[] = array("entree" => $aut_701[$i]['a'], "rejete" => $aut_701[$i]['b'], "author_comment" => $aut_701[$i]['c'] . " " . $aut_701[$i]['d'], "date" => $aut_701[$i]['f'], "type_auteur" => "70", "fonction" => $aut_701[$i][4], "id" => 0, "responsabilite" => 1, "ordre" => $i + 1, 'authority_number' => $aut_701[$i][3]);
    }
    for ($i = 0; $i < $nb_repet_711; $i++) {
        if (substr($indicateur["711"][$i], 0, 1) == "1") {
            $type_auteur = "72";
        } else {
            $type_auteur = "71";
        }
        $lieu = $aut_711[$i]['e'];
        if (!$lieu) {
            $lieu = $aut_711[$i]['k'];
        }
        $aut_array[] = array("entree" => $aut_711[$i]['a'], "rejete" => $aut_711[$i]['g'], "subdivision" => $aut_711[$i]['b'], "author_comment" => $aut_711[$i]['c'], "numero" => $aut_711[$i]['d'], "lieu" => $lieu, "ville" => $aut_711[$i]['l'], "pays" => $aut_711[$i]['m'], "web" => $aut_711[$i]['n'], "date" => $aut_711[$i]['f'], "type_auteur" => $type_auteur, "fonction" => $aut_711[$i][4], "id" => 0, "responsabilite" => 1, "ordre" => $i + 1, 'authority_number' => $aut_711[$i][3]);
    }
    /* renseignement de aut2 */
    for ($i = 0; $i < $nb_repet_702; $i++) {
        $aut_array[] = array("entree" => $aut_702[$i]['a'], "rejete" => $aut_702[$i]['b'], "author_comment" => $aut_702[$i]['c'] . " " . $aut_702[$i]['d'], "date" => $aut_702[$i]['f'], "type_auteur" => "70", "fonction" => $aut_702[$i][4], "id" => 0, "responsabilite" => 2, "ordre" => $i + 1, 'authority_number' => $aut_702[$i][3]);
    }
    for ($i = 0; $i < $nb_repet_712; $i++) {
        if (substr($indicateur["712"][$i], 0, 1) == "1") {
            $type_auteur = "72";
        } else {
            $type_auteur = "71";
        }
        $lieu = $aut_712[$i]['e'];
        if (!$lieu) {
            $lieu = $aut_712[$i]['k'];
        }
        $aut_array[] = array("entree" => $aut_712[$i]['a'], "rejete" => $aut_712[$i]['g'], "subdivision" => $aut_712[$i]['b'], "author_comment" => $aut_712[$i]['c'], "numero" => $aut_712[$i]['d'], "lieu" => $lieu, "ville" => $aut_712[$i]['l'], "pays" => $aut_712[$i]['m'], "web" => $aut_712[$i]['n'], "date" => $aut_712[$i]['f'], "type_auteur" => $type_auteur, "fonction" => $aut_712[$i][4], "id" => 0, "responsabilite" => 2, "ordre" => $i + 1, 'authority_number' => $aut_712[$i][3]);
    }
    // récup des infos auteurs et mise en tableau :
    // appel de la fonction membre d'importation et insertion en table
    $rqt_ins = "insert into responsability (responsability_author, responsability_notice, responsability_fonction, responsability_type, responsability_ordre) VALUES ";
    $values = "";
    if (count($aut_array)) {
        for ($i = 0; $i < sizeof($aut_array); $i++) {
            $aut = array();
            $aut['name'] = clean_string($aut_array[$i]['entree']);
            $aut['rejete'] = clean_string($aut_array[$i]['rejete']);
            $aut['type'] = $aut_array[$i]['type_auteur'];
            $aut['date'] = clean_string($aut_array[$i]['date']);
            $aut['subdivision'] = clean_string($aut_array[$i]['subdivision']);
            $aut['numero'] = clean_string($aut_array[$i]['numero']);
            $aut['lieu'] = clean_string($aut_array[$i]['lieu']);
            $aut['ville'] = clean_string($aut_array[$i]['ville']);
            $aut['pays'] = clean_string($aut_array[$i]['pays']);
            $aut['web'] = clean_string($aut_array[$i]['web']);
            $aut['author_comment'] = clean_string($aut_array[$i]['author_comment']);
            $aut['authority_number'] = clean_string($aut_array[$i]['authority_number']);
            //si on à demander la prise en compte des numéro d'autorités
            if ($authorities_notices && $aut['authority_number'] != "") {
                $aut_array[$i]["id"] = keep_authority_infos($aut['authority_number'], "author", $origin_authority, $notice_id, $aut);
            }
            if (!$aut_array[$i]["id"]) {
                $aut_array[$i]["id"] = auteur::import($aut);
            }
            $aut_array[$i]['fonction'] = trim($aut_array[$i]['fonction']);
            if ($aut_array[$i]["id"]) {
                if ($values != "") {
                    $values .= ",";
                }
                $values .= " ('" . $aut_array[$i]["id"] . "','" . $notice_id . "','" . addslashes($aut_array[$i]['fonction']) . "','" . $aut_array[$i]['responsabilite'] . "','" . $aut_array[$i]['ordre'] . "') ";
                //				$rqt = $rqt_ins . " ('".$aut_array[$i]["id"]."','".$notice_id."','".addslashes($aut_array[$i]['fonction'])."','".$aut_array[$i]['responsabilite']."','".$aut_array[$i]['ordre']."') " ;
                //				@mysql_query($rqt, $dbh);
            }
        }
        @mysql_query($rqt_ins . $values);
    }
    // Titres uniformes
    global $pmb_use_uniform_title;
    if ($pmb_use_uniform_title) {
        $nb_tu = sizeof($tu_500);
        for ($i = 0; $i < $nb_tu; $i++) {
            $value_tu[$i]['name'] = $tu_500[$i]['a'];
            $value_tu[$i]['tonalite'] = $tu_500[$i]['u'];
            $value_tu[$i]['comment'] = $tu_500[$i]['n'];
            $value_tu[$i]['authority_number'] = $tu_500[$i]['3'];
            for ($j = 0; $j < count($tu_500_r[$i]); $j++) {
                $value_tu[$i]['distrib'][$j] = $tu_500_r[$i][$j];
            }
            for ($j = 0; $j < count($tu_500_s[$i]); $j++) {
                $value_tu[$i]['ref'][$j] = $tu_500_s[$i][$j];
            }
            for ($j = 0; $j < count($tu_500_j[$i]); $j++) {
                $value_tu[$i]['subdiv'][$j] = $tu_500_j[$i][$j];
            }
            if ($authorities_notices && $aut['authority_number'] != "") {
                $tu_id = keep_authority_infos($value_tu[$i]['authority_number'], "uniform_title", $origin_authority, $notice_id, $value_tu[$i]);
            } else {
                $tu_id = titre_uniforme::import($value_tu[$i]);
            }
            if ($tu_id) {
                $requete = "INSERT INTO notices_titres_uniformes SET \n\t\t\t\t\tntu_num_notice='{$notice_id}', \n\t\t\t\t\tntu_num_tu='{$tu_id}', \n\t\t\t\t\tntu_titre='" . addslashes($tu_500[$i]['i']) . "', \n\t\t\t\t\tntu_date='" . addslashes($tu_500[$i]['k']) . "', \n\t\t\t\t\tntu_sous_vedette='" . addslashes($tu_500[$i]['l']) . "', \n\t\t\t\t\tntu_langue='" . addslashes($tu_500[$i]['m']) . "', \n\t\t\t\t\tntu_version='" . addslashes($tu_500[$i]['q']) . "', \n\t\t\t\t\tntu_mention='" . addslashes($tu_500[$i]['w']) . "',\n\t\t\t\t\tntu_ordre={$i} \t\t\t\t\n\t\t\t\t\t";
                mysql_query($requete, $dbh);
            }
        }
    }
    global $lang_code;
    global $org_lang_code;
    $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
    $values = "";
    for ($i = 0; $i < count($lang_code); $i++) {
        $lang_code[$i] = trim($lang_code[$i]);
        if ($values != "") {
            $values .= ",";
        }
        $values .= "('{$notice_id}',0, '" . addslashes($lang_code[$i]) . "','{$i}') ";
        //$rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue) VALUES ('$notice_id',0, '".addslashes($lang_code[$i])."') " ;
        //@mysql_query($rqt_ins, $dbh);
    }
    for ($i = 0; $i < count($org_lang_code); $i++) {
        $org_lang_code[$i] = trim($org_lang_code[$i]);
        if ($values != "") {
            $values .= ",";
        }
        $values .= "('{$notice_id}',1, '" . addslashes($org_lang_code[$i]) . "','" . $i . "') ";
        //$rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue) VALUES ('$notice_id',1, '".addslashes($org_lang_code[$i])."') " ;
        // 			@mysql_query($rqt_ins, $dbh);
    }
    @mysql_query($rqt_ins . $values, $dbh);
    //Import des catégories
    category_auto::save_info_categ();
    //Calcule de la signature
    $sign = new notice_doublon();
    $val = $sign->gen_signature($notice_id);
    mysql_query("update notices set signature='{$val}' where notice_id=" . $notice_id, $dbh);
    //Si on a un id de notice et qu'il n'est pas dans le tableau des notices créées, on l'ajoute
    if ($link_generate && trim($id_unimarc) !== "" && !$notices_crees[$id_unimarc]) {
        $notices_crees[$id_unimarc] = $notice_id;
    } elseif ($link_generate && trim($id_unimarc) !== "" && $notices_crees[$id_unimarc]) {
        //Si la notice a déjà été créé (Export des liens dans les notices liées) on remplace celle précédemment par celle en cour de traitement
        $niveau_biblio = $bibliographic_level . $hierarchic_level;
        switch ($niveau_biblio) {
            case 'm0':
                //On a une notice de monographie
                $notice_a_supp = $notices_crees[$id_unimarc];
                //On garde les liens
                $requete = "UPDATE notices_relations SET num_notice='" . $notice_id . "' WHERE num_notice='" . $notice_a_supp . "' ";
                @mysql_query($requete, $dbh);
                $requete = "UPDATE notices_relations SET linked_notice='" . $notice_id . "' WHERE linked_notice='" . $notice_a_supp . "' ";
                @mysql_query($requete, $dbh);
                $ma_notice = new notice($notice_a_supp);
                $ma_notice->replace($notice_id);
                break;
            case 's1':
                //On a une notice de periodique
                $notice_a_supp = $notices_crees[$id_unimarc];
                $ma_notice = new serial($notice_a_supp);
                $ma_notice->replace($notice_id);
                break;
            case 'b2':
                //On a une notice de bulletin
                $notice_a_supp = $notices_crees[$id_unimarc];
                //Dans les bulletins
                $requete = "update bulletins set num_notice='" . $notice_id . "' where num_notice='" . $notice_a_supp . "' ";
                mysql_query($requete, $dbh);
                //Dans les relations entre notice
                $requete = "update notices_relations set num_notice='" . $notice_id . "' where num_notice='" . $notice_a_supp . "'";
                mysql_query($requete, $dbh);
                $requete = "update notices_relations set linked_notice='" . $notice_id . "' where linked_notice='" . $notice_a_supp . "'";
                mysql_query($requete, $dbh);
                notice::del_notice($notice_a_supp);
                break;
            case 'a2':
                //On a une notice d'article
                $notice_a_supp = $notices_crees[$id_unimarc];
                //Dans les bulletins
                $requete = "update analysis set analysis_notice='" . $notice_id . "' where analysis_notice='" . $notice_a_supp . "' ";
                mysql_query($requete, $dbh);
                //Dans les relations entre notice
                $requete = "update notices_relations set num_notice='" . $notice_id . "' where num_notice='" . $notice_a_supp . "'";
                mysql_query($requete, $dbh);
                $requete = "update notices_relations set linked_notice='" . $notice_id . "' where linked_notice='" . $notice_a_supp . "'";
                mysql_query($requete, $dbh);
                notice::del_notice($notice_a_supp);
                break;
        }
        $notices_crees[$id_unimarc] = $notice_id;
    }
}
Пример #7
0
 //Pour les champs personnalises
 require_once $class_path . "/parametres_perso.class.php";
 require_once $class_path . "/notice.class.php";
 require_once $class_path . "/notice_doublon.class.php";
 require_once $class_path . "/authperso_notice.class.php";
 require_once $class_path . "/map/map_edition_controler.class.php";
 require_once $class_path . "/map_info.class.php";
 require_once $class_path . "/nomenclature/nomenclature_record_ui.class.php";
 //Pour la synchro rdf
 require_once $class_path . "/synchro_rdf.class.php";
 if ($pmb_synchro_rdf) {
     $synchro_rdf = new synchro_rdf();
 }
 // Pour l'indexation des concepts
 require_once $class_path . "/index_concept.class.php";
 $sign = new notice_doublon();
 $signature = $sign->gen_signature();
 if ($forcage == 1) {
     $tab = unserialize(stripslashes($ret_url));
     foreach ($tab->GET as $key => $val) {
         if (get_magic_quotes_gpc()) {
             $GLOBALS[$key] = $val;
         } else {
             add_sl($val);
             $GLOBALS[$key] = $val;
         }
     }
     foreach ($tab->POST as $key => $val) {
         if (get_magic_quotes_gpc()) {
             $GLOBALS[$key] = $val;
         } else {
Пример #8
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;
 }
Пример #9
0
 protected function dedoublonne($notice_id)
 {
     global $pmb_notice_controle_doublons;
     $sign = new \notice_doublon();
     $signature = $sign->gen_signature($notice_id);
     if ($pmb_notice_controle_doublons) {
         $q = "select notice_id from notices where signature='" . $signature . "' and notice_id != " . $notice_id . " limit 1";
         $res = pmb_mysql_query($q);
         if (pmb_mysql_num_rows($res)) {
             $r = pmb_mysql_fetch_object($res);
             // doublon existe, on supprime la notice créée
             \notice::del_notice($notice_id);
             return $r->notice_id;
         }
     }
     pmb_mysql_query("update notices set signature = '" . $signature . "' where notice_id = " . $notice_id);
     return $notice_id;
 }
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: gen_signature_notice.inc.php,v 1.3 2015-04-03 11:16:18 jpermanne Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . "/notice_doublon.class.php";
$sign = new notice_doublon();
// la taille d'un paquet de notices
$lot = NOEXPL_PAQUET_SIZE * 10;
// defini dans ./params.inc.php
// taille de la jauge pour affichage
$jauge_size = GAUGE_SIZE;
// initialisation de la borne de départ
if (!isset($start)) {
    $start = 0;
}
$v_state = urldecode($v_state);
if (!$count) {
    $notices = pmb_mysql_query("SELECT count(1) FROM notices", $dbh);
    $count = pmb_mysql_result($notices, 0, 0);
}
print "<br /><br /><h2 align='center'>" . htmlentities($msg["gen_signature_notice"], ENT_QUOTES, $charset) . "</h2>";
$query = pmb_mysql_query("SELECT notice_id FROM notices LIMIT {$start}, {$lot}");
if (pmb_mysql_num_rows($query)) {
    // définition de l'état de la jauge
    $state = floor($start / ($count / $jauge_size));
    // mise à jour de l'affichage de la jauge
Пример #11
0
function record()
{
    global $pmb_notice_controle_doublons;
    global $recept_cat_error_form;
    global $integre, $serialized_post, $existant_notice_id, $existant_b_level, $existant_h_level, $signature, $id_lig, $serialized_search;
    $recorded = false;
    switch ($integre) {
        case 'new':
            $unserialized_post = unserialize(rawurldecode(stripslashes($serialized_post)));
            foreach ($unserialized_post as $key => $val) {
                if (get_magic_quotes_gpc()) {
                    $GLOBALS[$key] = $val;
                } else {
                    add_sl($val);
                    $GLOBALS[$key] = $val;
                }
                global ${$key};
            }
            $z = new z3950_notice("form");
            $z->signature = $signature;
            $ret = $z->insert_in_database();
            $notice_id = $ret[1];
            $recorded = true;
            break;
        case 'existant':
            $notice_id = $existant_notice_id;
            $b_level = $existant_b_level;
            $h_level = $existant_h_level;
            $recorded = true;
            break;
        default:
            $duplicate = array();
            $signature = '';
            $r = object;
            if ($pmb_notice_controle_doublons != 0) {
                $sign = new notice_doublon(true);
                $signature = $sign->gen_signature();
                $r = $sign->getDuplicate();
            }
            if ($r->notice_id) {
                if ($r->niveau_biblio == 'a' && $r->niveau_hierar == 2) {
                    //article
                    $serial = new serial_display($r->notice_id, 6, '', '', '', '', '', 0, 2, 1, 0, 1, 0, 0, '', 0);
                    $notice_display = $serial->result;
                } elseif ($r->niveau_biblio == 'm' && $r->niveau_hierar == 0) {
                    //monographie
                    $display = new mono_display($r->notice_id, 6, '', 1, '', '', '', 0, 2, 1, 1, '', 0, 0, 1, 0);
                    $notice_display = $display->result;
                }
                $form = $recept_cat_error_form;
                $form = str_replace('!!serialized_post!!', rawurlencode(serialize($_POST)), $form);
                $form = str_replace('!!existant_notice_id!!', $r->notice_id, $form);
                $form = str_replace('!!existant_b_level!!', $r->niveau_biblio, $form);
                $form = str_replace('!!existant_h_level!!', $r->niveau_hierar, $form);
                $form = str_replace('!!signature!!', $signature, $form);
                $form = str_replace('!!id_lig!!', $id_lig, $form);
                $form = str_replace('!!serialized_search!!', stripslashes($serialized_search), $form);
                $form = str_replace('<!-- notice_display -->', $notice_display, $form);
                print $form;
                return false;
            } else {
                $z = new z3950_notice("form");
                $z->signature = $signature;
                $ret = $z->insert_in_database();
                $notice_id = $ret[1];
                $recorded = true;
            }
            break;
    }
    if ($recorded) {
        global $id_bibli, $id_exer, $f_fou_code, $f_dem_code, $t_dem, $f_rub_code, $cde_query, $all_query, $chk_dev, $lgstat_filter;
        $unserialized_search = unserialize(rawurldecode(stripslashes($serialized_search)));
        $id_bibli = $unserialized_search['id_bibli'];
        $id_exer = $unserialized_search['id_exer'];
        $f_fou_code = $unserialized_search['f_fou_code'];
        $f_dem_code = $unserialized_search['f_dem_code'];
        $t_dem = $unserialized_search['t_dem'];
        $f_rub_code = $unserialized_search['f_rub_code'];
        $cde_query = $unserialized_search['cde_query'];
        $all_query = $unserialized_search['all_query'];
        $chk_dev = $unserialized_search['chk_dev'];
        $lgstat_filter = $unserialized_search['lgstat_filter'];
        if ($notice_id) {
            $typ_lig = 1;
            if ($b_level == 'a' && $h_level == 2) {
                $typ_lig = 5;
            }
            lignes_actes::updateFields(array(0 => $id_lig), array('num_produit' => $notice_id, 'type_ligne' => $typ_lig));
        }
    }
    return $recorded;
}
Пример #12
0
 function get_notice_by_meta($name, $filename)
 {
     global $pmb_keyword_sep;
     global $pmb_type_audit;
     global $webdav_current_user_name, $webdav_current_user_id;
     \create_tableau_mimetype();
     $mimetype = \trouve_mimetype($filename, extension_fichier($name));
     $notice_id = 0;
     $title = $cplt = $code = $pages = $year = $keywords = $url = $thumbnail_content = "";
     //on commence avec la gymnatisque des métas...
     if ($mimetype == "application/epub+zip") {
         //pour les ebook, on gère ca directement ici !
         $epub = new \epubData(realpath($filename));
         $title = $epub->metas['title'][0];
         $authors = $epub->metas['creator'];
         $co_authors = $epub->metas['contributor'];
         if ($epub->metas['identifier']['isbn']) {
             $code = \formatISBN($epub->metas['identifier']['isbn'], 13);
         } else {
             if ($epub->metas['identifier']['ean']) {
                 $code = \EANtoISBN($epub->metas['identifier']['ean']);
                 $code = \formatISBN($code, 13);
             }
         }
         if ($epub->metas['identifier']['uri']) {
             $url = \clean_string($epub->metas['identifier']['uri']);
         }
         $publisher = $epub->metas['publisher'][0];
         $year = $epub->metas['date'][0]['value'];
         if (strlen($year) && strlen($year) != 4) {
             $year = \formatdate(detectFormatDate($year));
         }
         $lang = $epub->metas['language'];
         $resume = implode("\n", $epub->metas['description']);
         $keywords = implode($pmb_keyword_sep, $epub->metas['subject']);
         //jouons à et si on trouvait a vignette...
         $img = imagecreatefromstring($epub->getCoverContent());
         $file = tempnam(sys_get_temp_dir(), "vign");
         imagepng($img, $file);
         $thumbnail_content = file_get_contents($file);
         unlink($file);
     } else {
         $metas = \extract_metas(realpath($filename), $mimetype);
         if ($metas['Title'] && $metas['Author'] && $metas['Subject']) {
             $title = $metas['Title'];
             $author = $metas['Author'];
             $cplt = $metas['Subject'];
         } else {
             // métas non fiable, on regarde avec le titre...
             $title = $name;
         }
         //date de création...
         if ($metas["CreateDate"]) {
             $year = substr($metas["CreateDate"], 0, 4);
         }
         //pages
         if ($metas['PageCount']) {
             $pages = $metas['PageCount'];
         }
         //keywords
         if ($metas['Keywords']) {
             foreach ($metas['Keywords'] as $keyword) {
                 if ($keywords != "") {
                     $keywords .= $pmb_keyword_sep;
                 }
                 $keywords .= $keyword;
             }
         }
     }
     $query = "select notice_id from notices where tit1 = '" . addslashes($title) . "'";
     $result = mysql_query($query);
     if (mysql_num_rows($result)) {
         $notice_id = mysql_result($result, 0, 0);
     }
     if (!$notice_id) {
         //en cas d'une leture moyenne des infos, on s'assure d'avoir au moins un titre....
         if (!$title) {
             $title = $name;
         }
         if ($publisher) {
             $ed_1 = \editeur::import(array('name' => $publisher));
         } else {
             $ed_1 = 0;
         }
         $ind_wew = $title . " " . $cplt;
         $ind_sew = \strip_empty_words($ind_wew);
         $query = "insert into notices set \n\t\t\t\ttit1 = '" . addslashes($title) . "'," . ($code ? "code='" . $code . "'," : "") . "ed1_id = '" . $ed_1 . "'," . ($cplt ? "tit4 = '" . addslashes($cplt) . "'," : "") . ($pages ? "npages = '" . addslashes($pages) . "'," : "") . ($keywords ? "index_l = '" . addslashes($keywords) . "'," : "") . "\n\t\t\t\tyear = '" . $year . "',\n\t\t\t\tniveau_biblio='m', \n\t\t\t\tniveau_hierar='0',\n\t\t\t\tstatut = '" . $this->config['default_statut'] . "',\n\t\t\t\tindex_wew = '" . $ind_wew . "',\n\t\t\t\tindex_sew = '" . $ind_sew . "',\n\t\t\t\tn_resume = '" . addslashes($resume) . "',\n\t\t\t\tlien = '" . addslashes($url) . "',\n\t\t\t\tindex_n_resume = '" . \strip_empty_words($resume) . "'," . ($thumbnail_content ? "thumbnail_url = 'data:image/png;base64," . base64_encode($thumbnail_content) . "'," : "") . "create_date = sysdate(), \n\t\t\t\tupdate_date = sysdate()";
         mysql_query($query);
         $notice_id = mysql_insert_id();
         $sign = new \notice_doublon();
         mysql_query("update notices set signature = '" . $sign->gen_signature($notice_id) . "' where notice_id = " . $notice_id);
         //traitement audit
         if ($pmb_type_audit) {
             $query = "INSERT INTO audit SET ";
             $query .= "type_obj='1', ";
             $query .= "object_id='{$notice_id}', ";
             $query .= "user_id='{$webdav_current_user_id}', ";
             $query .= "user_name='{$webdav_current_user_name}', ";
             $query .= "type_modif=1 ";
             $result = @mysql_query($query);
         }
         if (count($authors)) {
             $i = 0;
             foreach ($authors as $author) {
                 $aut = array();
                 if ($author['file-as']) {
                     $infos = explode(",", $author['file-as']);
                     $aut = array('name' => $infos[0], 'rejete' => $infos[1], 'type' => 70);
                 }
                 if (!$aut['name']) {
                     $aut = array('name' => $author['value'], 'type' => 70);
                 }
                 $aut_id = \auteur::import($aut);
                 if ($aut_id) {
                     $query = "insert into responsability set \n\t\t\t\t\t\t\tresponsability_author = '" . $aut_id . "',\n\t\t\t\t\t\t\tresponsability_notice = '" . $notice_id . "',\n\t\t\t\t\t\t\tresponsability_type = '0'";
                     mysql_query($query);
                     $i++;
                 }
             }
         }
         if (count($co_authors)) {
             foreach ($co_authors as $author) {
                 $aut = array();
                 if ($author['file-as']) {
                     $infos = explode(",", $author['file-as']);
                     $aut = array('name' => $infos[0], 'rejete' => $infos[1], 'type' => 70);
                 }
                 if (!$aut['name']) {
                     $aut = array('name' => $author['value'], 'type' => 70);
                 }
                 $aut_id = \auteur::import($aut);
                 if ($aut_id) {
                     $query = "insert into responsability set \n\t\t\t\t\t\t\tresponsability_author = '" . $aut_id . "',\n\t\t\t\t\t\t\tresponsability_notice = '" . $notice_id . "',\n\t\t\t\t\t\t\tresponsability_type = '0',\n\t\t\t\t\t\t\trepsonsability_ordre = '" . $i . "'";
                     mysql_query($query);
                     $i++;
                 }
             }
         }
     }
     return $notice_id;
 }