Пример #1
0
 static function browse_category($subfield, $tabl_categ_recovered, $name_field, $counter_field, $id_thes, $root_node_number, &$tabl_categ_lib, $create_node)
 {
     global $incr_categ, $notice_id, $tabl_id_categ_link;
     $creation = 0;
     $id_noeud = $root_node_number;
     foreach ($subfield as $key => $subfield_root) {
         //Je parcours les sous-champs
         for ($_2 = 0; $_2 < sizeof($tabl_categ_recovered[$name_field . $subfield_root["CODE"]][$counter_field]); $_2++) {
             if ($tmp = trim($tabl_categ_recovered[$name_field . $subfield_root["CODE"]][$counter_field][$_2])) {
                 if ($creation) {
                     //Si j'ai dans un même champ plusieurs fois le même sous champ je lie la notice à tous sauf le dernier si il a des enfants
                     if (!is_array($tabl_categ_lib)) {
                         if ($notice_id && $id_noeud) {
                             $incr_categ++;
                             $rqt_add = "insert IGNORE into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $id_noeud . "', ordre_categorie='" . $incr_categ . "' ";
                             pmb_mysql_query($rqt_add);
                             if (!in_array($id_noeud, $tabl_id_categ_link)) {
                                 $tabl_id_categ_link[] = $id_noeud;
                             }
                         }
                     } else {
                         $tmp_build = array();
                         $tmp_build["wording"] = $id_noeud;
                         $tmp_build["id_thes"] = $id_thes;
                         $tmp_build["create_node"] = $create_node;
                         $tmp_build["link"] = 1;
                         $tabl_categ_lib[] = $tmp_build;
                     }
                 }
                 if (!is_array($tabl_categ_lib)) {
                     $id_noeud = category_auto::build_categ($tmp, $id_thes, $root_node_number, false, $create_node);
                 } else {
                     $id_noeud = $tmp;
                     $tmp_build = array();
                     $tmp_build["wording"] = $tmp;
                     $tmp_build["id_thes"] = $id_thes;
                     $tmp_build["create_node"] = $create_node;
                     $tmp_build["word_parent"] = $root_node_number;
                     $tmp_build["link"] = 0;
                     $tabl_categ_lib[] = $tmp_build;
                 }
                 $creation++;
             }
         }
         if ($subfield_root["SUBFIELD"]) {
             $nb_creation = category_auto::browse_category($subfield_root["SUBFIELD"], $tabl_categ_recovered, $name_field, $counter_field, $id_thes, $id_noeud, $tabl_categ_lib, $create_node);
             if (!$nb_creation) {
                 //Si je n'ai trouvé aucun fils je fait le lien avec le père
                 if (!is_array($tabl_categ_lib)) {
                     if ($notice_id && $id_noeud) {
                         $incr_categ++;
                         $rqt_add = "insert IGNORE into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $id_noeud . "', ordre_categorie='" . $incr_categ . "' ";
                         pmb_mysql_query($rqt_add);
                         if (!in_array($id_noeud, $tabl_id_categ_link)) {
                             $tabl_id_categ_link[] = $id_noeud;
                         }
                     }
                 } else {
                     $tmp_build = array();
                     $tmp_build["wording"] = $id_noeud;
                     $tmp_build["id_thes"] = $id_thes;
                     $tmp_build["create_node"] = $create_node;
                     $tmp_build["link"] = 1;
                     $tabl_categ_lib[] = $tmp_build;
                 }
             } else {
                 $creation += $nb_creation;
             }
         } elseif ($id_noeud) {
             //Si je n'ai pas de sous champs à reprendre je lie la notice
             if (!is_array($tabl_categ_lib)) {
                 if ($notice_id && $id_noeud) {
                     $incr_categ++;
                     $rqt_add = "insert IGNORE into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $id_noeud . "', ordre_categorie='" . $incr_categ . "' ";
                     pmb_mysql_query($rqt_add);
                     if (!in_array($id_noeud, $tabl_id_categ_link)) {
                         $tabl_id_categ_link[] = $id_noeud;
                     }
                 }
             } else {
                 $tmp_build = array();
                 $tmp_build["wording"] = $id_noeud;
                 $tmp_build["id_thes"] = $id_thes;
                 $tmp_build["create_node"] = $create_node;
                 $tmp_build["link"] = 1;
                 $tabl_categ_lib[] = $tmp_build;
             }
         }
     }
     return $creation;
 }
Пример #2
0
 function from_unimarc($record)
 {
     $this->document_type = $record->inner_guide[dt];
     $this->bibliographic_level = $record->inner_guide[bl];
     $this->hierarchic_level = $record->inner_guide[hl];
     if ($this->hierarchic_level == "") {
         if ($this->bibliographic_level == "s") {
             $this->hierarchic_level = "1";
         }
         if ($this->bibliographic_level == "m") {
             $this->hierarchic_level = "0";
         }
     }
     if (function_exists("param_perso_prepare")) {
         param_perso_prepare($record);
     }
     $indicateur = array();
     for ($i = 0; $i < count($record->inner_directory); $i++) {
         $cle = $record->inner_directory[$i]['label'];
         $indicateur[$cle][] = substr($record->inner_data[$i]['content'], 0, 2);
         switch ($cle) {
             case "010":
                 /* isbn */
                 $isbn = $record->get_subfield($cle, 'a');
                 $subfield = $record->get_subfield($cle, "d");
                 $this->prix = $subfield[0];
             case "011":
                 /* isbn */
                 $isbn = $record->get_subfield($cle, 'a');
                 break;
             case "014":
                 /* isbn */
                 $this->others_ids = $record->get_subfield($cle, 'a', 'b');
                 break;
             case "071":
                 /* barcode */
                 $cb = $record->get_subfield($cle, "a");
                 break;
             case "101":
                 /* language */
                 //martizva NOTE: some server send language in UPCASE!!!
                 // $subfield = $record->get_subfield($cle,"a");
                 // $this->language_code = strtolower($subfield[0]);
                 // $subfield = $record->get_subfield($cle,"c");
                 // $this->original_language_code = strtolower($subfield[0]);
                 $this->language_code = $record->get_subfield_array($cle, "a");
                 $this->original_language_code = $record->get_subfield_array($cle, "c");
                 break;
             case "200":
                 /* titles */
                 $tit = $record->get_subfield($cle, 'a', 'c', 'd', 'e', 'v');
                 $tit_200a = $record->get_subfield_array($cle, 'a');
                 $tit_200c = $record->get_subfield_array($cle, 'c');
                 $tit_200d = $record->get_subfield_array($cle, 'd');
                 $tit_200e = $record->get_subfield_array($cle, 'e');
                 $tit_200v = $record->get_subfield_array($cle, 'v');
                 $this->serie_200 = $record->get_subfield($cle, 'h', 'i');
                 break;
             case "205":
                 /* mention_edition */
                 $subfield = $record->get_subfield($cle, "a");
                 $this->mention_edition = $subfield[0];
                 break;
             case "210":
                 /* publisher */
                 $editeur_lieu = $record->get_subfield_array_array($cle, "a");
                 $editeur_nom = $record->get_subfield_array_array($cle, "c");
                 $editeur_date = $record->get_subfield_array($cle, "d");
                 $editeur_date_machine = $record->get_subfield_array($cle, "h");
                 break;
             case "215":
                 /* description */
                 $subfield = $record->get_subfield($cle, "a");
                 $this->page_nbr = $subfield[0];
                 $subfield = $record->get_subfield($cle, "c");
                 $this->illustration = $subfield[0];
                 $subfield = $record->get_subfield($cle, "d");
                 $this->size = $subfield[0];
                 $subfield = $record->get_subfield($cle, "e");
                 $this->accompagnement = $subfield[0];
                 break;
             case "225":
                 /* collection */
                 $collection_225 = $record->get_subfield($cle, "a", "i", "v", "x");
                 break;
             case "300":
                 /* inside */
                 $general_note = $record->get_subfield($cle, "a");
                 break;
             case "327":
                 /* inside */
                 $content_note = $record->get_subfield_array($cle, "a");
                 break;
             case "330":
                 /* abstract */
                 $abstract_note = $record->get_subfield($cle, "a");
                 break;
             case "345":
                 /* EAN */
                 $EAN = $record->get_subfield($cle, "b");
                 break;
             case "410":
                 /* collection */
                 $collection_410 = $record->get_subfield($cle, "t", "v", "x");
                 break;
             case "411":
                 /* sub-collection */
                 $collection_411 = $record->get_subfield($cle, "t", "v", "x");
                 break;
             case "461":
                 /* series ou perios*/
                 if (($this->bibliographic_level == 'a' || $this->bibliographic_level == 'b' || $this->bibliographic_level == 's') && $this->hierarchic_level == '2') {
                     $perio = $record->get_subfield($cle, "t", "x", "v", "d", "e");
                     $this->perio_titre = $record->get_subfield_array($cle, "t");
                     $this->perio_issn = $record->get_subfield_array($cle, "x");
                     if ($record->get_subfield_array($cle, "v")) {
                         $this->bull_num = $record->get_subfield_array($cle, "v");
                     }
                     if ($record->get_subfield_array($cle, "d")) {
                         $this->bull_date = $record->get_subfield_array($cle, "d");
                     }
                     if ($record->get_subfield_array($cle, "e")) {
                         $this->bull_mention = $record->get_subfield_array($cle, "e");
                     }
                 } else {
                     $serie = $record->get_subfield($cle, "t", "v");
                 }
                 break;
             case "463":
                 /* Bulletins */
                 $bulletin_463 = $record->get_subfield($cle, "t", "v", "d", "e");
                 $this->bull_num = $record->get_subfield_array($cle, "v");
                 $this->bull_date = $record->get_subfield_array($cle, "d");
                 $this->bull_mention = $record->get_subfield_array($cle, "e");
                 $this->bull_titre = $record->get_subfield_array($cle, "t");
                 break;
             case "500":
                 /* Titres uniformes */
                 $this->tu_500 = $record->get_subfield($cle, "a", "k", "m", "q", "u", "v", "w");
                 $this->tu_500_i = $record->get_subfield_array_array($cle, "i");
                 $this->tu_500_j = $record->get_subfield_array_array($cle, "j");
                 $this->tu_500_l = $record->get_subfield_array_array($cle, "l");
                 $this->tu_500_n = $record->get_subfield_array_array($cle, "n");
                 $this->tu_500_r = $record->get_subfield_array_array($cle, "r");
                 $this->tu_500_s = $record->get_subfield_array_array($cle, "s");
                 break;
             case "503":
                 /* Titres de forme */
                 $this->info_503 = $record->get_subfield($cle, "a", "e", "f", "h", "m", "n");
                 $this->info_503_d = $record->get_subfield_array_array($cle, "d");
                 $this->info_503_j = $record->get_subfield_array_array($cle, "j");
                 break;
             case "530":
                 $perio530a = $record->get_subfield_array($cle, 'a');
                 break;
                 //TODO AR
                 //recup 530 (voir import_unimarc_lien)
             //TODO AR
             //recup 530 (voir import_unimarc_lien)
             case "600":
                 // 600 PERSONAL NAME USED AS SUBJECT
                 $this->info_600_3 = $record->get_subfield_array_array($cle, "3");
                 $this->info_600_a = $record->get_subfield_array_array($cle, "a");
                 $this->info_600_b = $record->get_subfield_array_array($cle, "b");
                 $this->info_600_c = $record->get_subfield_array_array($cle, "c");
                 $this->info_600_d = $record->get_subfield_array_array($cle, "d");
                 $this->info_600_f = $record->get_subfield_array_array($cle, "f");
                 $this->info_600_g = $record->get_subfield_array_array($cle, "g");
                 $this->info_600_j = $record->get_subfield_array_array($cle, "j");
                 $this->info_600_p = $record->get_subfield_array_array($cle, "p");
                 $this->info_600_t = $record->get_subfield_array_array($cle, "t");
                 $this->info_600_x = $record->get_subfield_array_array($cle, "x");
                 $this->info_600_y = $record->get_subfield_array_array($cle, "y");
                 $this->info_600_z = $record->get_subfield_array_array($cle, "z");
                 break;
             case "601":
                 // 601 CORPORATE BODY NAME USED AS SUBJECT
                 $this->info_601_3 = $record->get_subfield_array_array($cle, "3");
                 $this->info_601_a = $record->get_subfield_array_array($cle, "a");
                 $this->info_601_b = $record->get_subfield_array_array($cle, "b");
                 $this->info_601_c = $record->get_subfield_array_array($cle, "c");
                 $this->info_601_d = $record->get_subfield_array_array($cle, "d");
                 $this->info_601_e = $record->get_subfield_array_array($cle, "e");
                 $this->info_601_f = $record->get_subfield_array_array($cle, "f");
                 $this->info_601_g = $record->get_subfield_array_array($cle, "g");
                 $this->info_601_h = $record->get_subfield_array_array($cle, "h");
                 $this->info_601_t = $record->get_subfield_array_array($cle, "t");
                 $this->info_601_j = $record->get_subfield_array_array($cle, "j");
                 $this->info_601_x = $record->get_subfield_array_array($cle, "x");
                 $this->info_601_y = $record->get_subfield_array_array($cle, "y");
                 $this->info_601_z = $record->get_subfield_array_array($cle, "z");
                 break;
             case "602":
                 // 602 FAMILY NAME USED AS SUBJECT
                 $this->info_602_3 = $record->get_subfield_array_array($cle, "3");
                 $this->info_602_a = $record->get_subfield_array_array($cle, "a");
                 $this->info_602_f = $record->get_subfield_array_array($cle, "f");
                 $this->info_602_t = $record->get_subfield_array_array($cle, "t");
                 $this->info_602_j = $record->get_subfield_array_array($cle, "j");
                 $this->info_602_x = $record->get_subfield_array_array($cle, "x");
                 $this->info_602_y = $record->get_subfield_array_array($cle, "y");
                 $this->info_602_z = $record->get_subfield_array_array($cle, "z");
                 break;
             case "604":
                 // 604 AUTEUR-TITRE USED AS SUBJECT
                 $this->info_604_a = $record->get_subfield_array_array($cle, "a");
                 $this->info_604_h = $record->get_subfield_array_array($cle, "h");
                 $this->info_604_i = $record->get_subfield_array_array($cle, "i");
                 $this->info_604_j = $record->get_subfield_array_array($cle, "j");
                 $this->info_604_k = $record->get_subfield_array_array($cle, "k");
                 $this->info_604_l = $record->get_subfield_array_array($cle, "l");
                 $this->info_604_x = $record->get_subfield_array_array($cle, "x");
                 $this->info_604_y = $record->get_subfield_array_array($cle, "y");
                 $this->info_604_z = $record->get_subfield_array_array($cle, "z");
                 break;
             case "605":
                 // 605 TITLE USED AS SUBJECT
                 $this->info_605_3 = $record->get_subfield_array_array($cle, "3");
                 $this->info_605_a = $record->get_subfield_array_array($cle, "a");
                 $this->info_605_h = $record->get_subfield_array_array($cle, "h");
                 $this->info_605_i = $record->get_subfield_array_array($cle, "i");
                 $this->info_605_j = $record->get_subfield_array_array($cle, "j");
                 $this->info_605_k = $record->get_subfield_array_array($cle, "k");
                 $this->info_605_l = $record->get_subfield_array_array($cle, "l");
                 $this->info_605_m = $record->get_subfield_array_array($cle, "m");
                 $this->info_605_n = $record->get_subfield_array_array($cle, "n");
                 $this->info_605_q = $record->get_subfield_array_array($cle, "q");
                 $this->info_605_r = $record->get_subfield_array_array($cle, "r");
                 $this->info_605_s = $record->get_subfield_array_array($cle, "s");
                 $this->info_605_u = $record->get_subfield_array_array($cle, "u");
                 $this->info_605_w = $record->get_subfield_array_array($cle, "w");
                 $this->info_605_j = $record->get_subfield_array_array($cle, "j");
                 $this->info_605_x = $record->get_subfield_array_array($cle, "x");
                 $this->info_605_y = $record->get_subfield_array_array($cle, "y");
                 $this->info_605_z = $record->get_subfield_array_array($cle, "z");
                 break;
             case "606":
                 // RAMEAU / TOPICAL NAME USED AS SUBJECT
                 $this->info_606_3 = $record->get_subfield_array_array($cle, "3");
                 $this->info_606_a = $record->get_subfield_array_array($cle, "a");
                 $this->info_606_j = $record->get_subfield_array_array($cle, "j");
                 $this->info_606_x = $record->get_subfield_array_array($cle, "x");
                 $this->info_606_y = $record->get_subfield_array_array($cle, "y");
                 $this->info_606_z = $record->get_subfield_array_array($cle, "z");
                 break;
             case "607":
                 // 607 GEOGRAPHICAL NAME USED AS SUBJECT
                 $this->info_607_3 = $record->get_subfield_array_array($cle, "3");
                 $this->info_607_a = $record->get_subfield_array_array($cle, "a");
                 $this->info_607_j = $record->get_subfield_array_array($cle, "j");
                 $this->info_607_x = $record->get_subfield_array_array($cle, "x");
                 $this->info_607_y = $record->get_subfield_array_array($cle, "y");
                 $this->info_607_z = $record->get_subfield_array_array($cle, "z");
                 break;
             case "608":
                 // 608 Vedette matière de forme, de genre ou des caractéristiques physiques
                 $this->info_608_3 = $record->get_subfield_array_array($cle, "3");
                 $this->info_608_a = $record->get_subfield_array_array($cle, "a");
                 $this->info_608_j = $record->get_subfield_array_array($cle, "j");
                 $this->info_608_x = $record->get_subfield_array_array($cle, "x");
                 $this->info_608_y = $record->get_subfield_array_array($cle, "y");
                 $this->info_608_z = $record->get_subfield_array_array($cle, "z");
                 break;
             case "610":
                 /* mots clé */
                 $index_sujets = $record->get_subfield($cle, "a");
                 break;
             case "676":
                 /* Dewey */
                 $this->dewey = $record->get_subfield($cle, "a");
                 break;
             case "686":
                 /* PCDM */
                 if (!$this->dewey) {
                     $this->dewey = $record->get_subfield($cle, "a");
                 }
                 break;
             case "700":
                 $aut_700 = $record->get_subfield($cle, "a", "b", "c", "d", "4", "f", "N", "3");
                 break;
             case "701":
                 $aut_701 = $record->get_subfield($cle, "a", "b", "c", "d", "4", "f", "N", "3");
                 break;
             case "702":
                 $aut_702 = $record->get_subfield($cle, "a", "b", "c", "d", "4", "f", "N", "3");
                 break;
             case "710":
                 $aut_710 = $record->get_subfield($cle, "a", "b", "c", "g", "d", "4", "f", "e", "k", "l", "m", "n", "3");
                 break;
             case "711":
                 $aut_711 = $record->get_subfield($cle, "a", "b", "c", "g", "d", "4", "f", "e", "k", "l", "m", "n", "3");
                 break;
             case "712":
                 $aut_712 = $record->get_subfield($cle, "a", "b", "c", "g", "d", "4", "f", "e", "k", "l", "m", "n", "3");
                 break;
             case "801":
                 /* origine du catalogage */
                 $origine_notice = $record->get_subfield($cle, "a", "b");
                 break;
             case "856":
                 $ressource = $record->get_subfield($cle, "u", "q");
                 break;
             case "995":
                 /* infos de la BDP */
                 $info_995 = $record->get_subfield($cle, "a", "b", "c", "d", "f", "k", "m", "n", "o", "r", "u");
                 $this->exemplaires = $info_995;
                 break;
             case "896":
                 /* Thumbnail */
                 $this->thumbnail_url = $record->get_subfield($cle, "a");
                 $this->thumbnail_url = $this->thumbnail_url[0];
                 break;
                 //Documents numériques
             //Documents numériques
             case "897":
                 $this->doc_nums = $record->get_subfield($cle, "a", "b", "f", "p");
                 break;
             default:
                 break;
         }
         /* end of switch */
     }
     /* end of for */
     //Récupération des catégories en lien avec le fichier xml
     category_auto::get_info_categ($record);
     $this->isbn = $this->process_isbn($isbn[0]);
     if (function_exists("traite_categories_from_unimarc")) {
         $this->categories = traite_categories_from_unimarc($this);
     }
     /* 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
     		*/
     $this->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);
     /* renseignement de aut0 */
     if ($aut_700[0][a] != "") {
         /* auteur principal en 700 ? */
         $this->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'];
         }
         $this->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'], "ville" => $aut_710[0]['l'], "web" => $aut_710[0]['n'], "date" => $aut_710[0]['f'], "type_auteur" => $type_auteur * 1, "fonction" => $aut_710[0][4], "id" => 0, "responsabilite" => 0, "ordre" => 0, "lieu" => $lieu, "pays" => $aut_710[0]['m'], "authority_number" => $aut_710[0][3]);
     }
     /* renseignement de aut1 */
     for ($i = 0; $i < $nb_repet_701; $i++) {
         $this->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'];
         }
         $this->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'], "ville" => $aut_711[$i]['l'], "web" => $aut_711[$i]['n'], "date" => $aut_711[$i]['f'], "type_auteur" => $type_auteur * 1, "fonction" => $aut_711[$i][4], "id" => 0, "responsabilite" => 1, "lieu" => $lieu, "pays" => $aut_711[$i]['m'], "ordre" => $i + 1, "authority_number" => $aut_711[$i][3]);
     }
     /* renseignement de aut2 */
     for ($i = 0; $i < $nb_repet_702; $i++) {
         $this->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'];
         }
         $this->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'], "ville" => $aut_712[$i]['l'], "web" => $aut_712[$i]['n'], "date" => $aut_712[$i]['f'], "type_auteur" => $type_auteur * 1, "fonction" => $aut_712[$i][4], "id" => 0, "responsabilite" => 2, "lieu" => $lieu, "pays" => $aut_712[$i]['m'], "ordre" => $i + 1, "authority_number" => $aut_712[$i][3]);
     }
     /*  Added for some italian z39.50 server 
     		Some adjustment to clean the values from symbol like << and others */
     for ($i = 0; $i < $nb_repet_701 + $nb_repet_711 + $nb_repet_702 + $nb_repet_712 + 1; $i++) {
         $this->aut_array[$i]['entree'] = del_more_garbage($this->aut_array[$i]['entree']);
         $this->aut_array[$i]['rejete'] = del_more_garbage($this->aut_array[$i]['rejete']);
     }
     /* traitement des éditeurs */
     $editor = array();
     if (is_array($editeur_nom)) {
         foreach ($editeur_nom as $key_nom1 => $nom1) {
             foreach ($nom1 as $key_nom2 => $nom2) {
                 $mon_ed = array();
                 $mon_ed["c"] = $nom2;
                 if ($editeur_lieu[$key_nom1][$key_nom2]) {
                     $mon_ed["a"] = $editeur_lieu[$key_nom1][$key_nom2];
                 }
                 $editor[] = $mon_ed;
             }
         }
     }
     $this->year = clean_string($editeur_date[0]);
     $this->editors[0]['name'] = clean_string($editor[0][c]);
     $this->editors[0]['ville'] = clean_string($editor[0][a]);
     $this->editors[1]['name'] = clean_string($editor[1][c]);
     $this->editors[1]['ville'] = clean_string($editor[1][a]);
     /*  Added for some italian z39.50 server 
     		Some adjustment to clean the values from symbol like << and others */
     $this->editors[0]['name'] = del_more_garbage($this->editors[0]['name']);
     $this->editors[1]['name'] = del_more_garbage($this->editors[1]['name']);
     /* traitement des collections */
     $coll_name = "";
     $subcoll_name = "";
     $coll_issn = "";
     $subcoll_issn = "";
     $nocoll_ins = "";
     // Collection : traitement de 225 et 410, préférence donnée au 410
     if ($collection_410[0][t]) {
         $coll_name = $collection_410[0][t];
     } elseif ($collection_225[0][a] != "") {
         $coll_name = $collection_225[0][a];
     }
     if ($collection_410[0][x]) {
         $coll_issn = $collection_410[0][x];
     } elseif ($collection_225[0][x] != "") {
         $coll_issn = $collection_225[0][x];
     }
     // Sous-collection : traitement de 225$i et 411, préférence donnée au 411
     if ($collection_411[0][t]) {
         $subcoll_name = $collection_411[0][t];
     } elseif ($collection_225[0][i] != "") {
         $subcoll_name = $collection_225[0][i];
     }
     if ($collection_411[0][x]) {
         $subcoll_issn = $collection_411[0][x];
     }
     // Numéro dans la collection, présent en 411$v, sinon en 410$v et enfin en 225$v
     if ($collection_411[0][v] != "") {
         $this->nbr_in_collection = $collection_411[0][v];
     } elseif ($collection_410[0][v] != "") {
         $this->nbr_in_collection = $collection_410[0][v];
     } elseif ($collection_225[0][v] != "") {
         $this->nbr_in_collection = $collection_225[0][v];
     } else {
         $this->nbr_in_collection = "";
     }
     $this->collection['name'] = clean_string($coll_name);
     $this->collection['issn'] = clean_string($coll_issn);
     $this->subcollection['name'] = clean_string($subcoll_name);
     $this->subcollection['issn'] = clean_string($subcoll_issn);
     /*  Added for some italian z39.50 server 
     		Some adjustment to clean the values from symbol like << and others */
     $this->collection['name'] = del_more_garbage($this->collection['name']);
     $this->subcollection['name'] = del_more_garbage($this->subcollection['name']);
     //TODO AR
     //nettoyage si notice de bulletin (voir import_unimarc_lien)
     //TEST si perio_titre vide -> recup 530
     if ($this->bibliographic_level == "s" && $this->hierarchic_level == "2") {
         if (!$this->perio_titre && $perio530a) {
             $this->perio_titre = $perio530a;
         }
         if (!$this->bull_titre && $tit_200a) {
             $this->bull_titre = array(clean_string($tit_200a[0]));
         }
         //file_put_contents('php://stderr', print_r($tit_200a[0], true));
         if (!$this->bull_num && $this->serie_200) {
             $this->bull_num = array(clean_string($this->serie_200[0]['h']));
         }
         if (!$this->bull_date && $editeur_date_machine) {
             $this->bull_date = array($editeur_date_machine[0]);
         }
         if (!$this->bull_mention && $editeur_date) {
             $this->bull_mention = array(clean_string($editeur_date[0]));
         }
         //file_put_contents('php://stderr', print_r($this->bull_mention, true));
         //file_put_contents('php://stderr', print_r($this->bull_date, true));
         $this->serie_200 = array();
     }
     /* Series  TODO: Check if it's Ok */
     $this->serie = clean_string($serie[0]['t']);
     if ($this->serie) {
         $this->nbr_in_serie = $serie[0]['v'];
     } else {
         $this->serie = clean_string($this->serie_200[0]['i']);
         if ($this->serie) {
             $this->nbr_in_serie = $this->serie_200[0]['h'];
         } else {
             $this->nbr_in_serie = "";
         }
     }
     /* Traitement des notes */
     $this->general_note = "";
     $this->content_note = "";
     $this->abstract_note = "";
     if (!$abstract_note) {
         $abstract_note = array();
     }
     $this->abstract_note = implode("\n", $abstract_note);
     if (!$general_note) {
         $general_note = array();
     }
     $this->general_note = implode("\n", $general_note);
     if (!$content_note) {
         $content_note = array();
     }
     $this->content_note = implode("\n", $content_note);
     /* traitement ressources */
     $this->link_url = $ressource[0]["u"];
     $this->link_format = $ressource[0]["q"];
     /* Titles processing */
     if (!$tit_200a) {
         $tit_200a = array();
     }
     if (!$tit_200c) {
         $tit_200c = array();
     }
     if (!$tit_200d) {
         $tit_200d = array();
     }
     if (!$tit_200e) {
         $tit_200e = array();
     }
     $tit[0]['a'] = implode(" ; ", $tit_200a);
     $tit[0]['c'] = implode(" ; ", $tit_200c);
     $tit[0]['d'] = implode(" ; ", $tit_200d);
     $tit[0]['e'] = implode(" ; ", $tit_200e);
     $this->titles[0] = clean_string($tit[0][a]);
     $this->titles[1] = clean_string($tit[0][c]);
     $this->titles[2] = clean_string($tit[0][d]);
     $this->titles[3] = clean_string($tit[0][e]);
     /*  Added for some italian z39.50 server 
     		Some adjustment to clean the values from symbol like << and others */
     $this->titles[0] = del_more_garbage($this->titles[0]);
     $this->titles[1] = del_more_garbage($this->titles[1]);
     $this->titles[2] = del_more_garbage($this->titles[2]);
     $this->titles[3] = del_more_garbage($this->titles[3]);
     global $pmb_keyword_sep;
     if (!$pmb_keyword_sep) {
         $pmb_keyword_sep = " ";
     }
     if (is_array($index_sujets)) {
         $this->free_index = implode($pmb_keyword_sep, $index_sujets);
     } else {
         $this->free_index = $index_sujets;
     }
     $this->origine_notice['nom'] = clean_string($origine_notice[0]['b']);
     $this->origine_notice['pays'] = clean_string($origine_notice[0]['a']);
 }
function traite_categories_for_form($tableau_600 = "", $tableau_601 = "", $tableau_602 = "", $tableau_605 = "", $tableau_606 = "", $tableau_607 = "", $tableau_608 = "")
{
    global $charset, $rameau, $lang, $msg;
    $tabl_categ_lib = array();
    category_auto::save_info_categ($tabl_categ_lib);
    $list_rameau = array();
    $pile = array();
    $tabl_build = array();
    $incr = 0;
    $id_parent = $id_thes = 0;
    foreach ($tabl_categ_lib as $key => $value) {
        if (array_key_exists("link", $value)) {
            if ($value["id_thes"] && !$value["link"] && !$value["word_parent"]) {
                $id_parent = $value["id_parent"];
                $id_thes = $value["id_thes"];
                $thes_temp = new thesaurus($value["id_thes"]);
                $lib = "[" . $thes_temp->libelle_thesaurus . "]";
                $pile = array();
                if ($value["id_parent"] && ($lib_hierar = trim(categories::listAncestorNames($value["id_parent"], $lang)))) {
                    $pile[] = $lib . " " . $lib_hierar . ":";
                } else {
                    $pile[] = $lib . " ";
                }
                $pile[] = $value["wording"];
            } else {
                if ($value["link"] == 1) {
                    $lib_temp = implode("", $pile);
                    $list_rameau[$lib_temp] = htmlentities($lib_temp, ENT_QUOTES, $charset);
                    if (!$value["create_node"]) {
                        $list_rameau[$lib_temp] .= "</b>" . htmlentities($msg["func_category_auto_reprise"], ENT_QUOTES, $charset) . "<b>";
                    }
                    $tabl_build[$incr]["wording"] = $pile;
                    $tabl_build[$incr]["id_thes"] = $id_thes;
                    $tabl_build[$incr]["id_parent"] = $id_parent;
                    $tabl_build[$incr]["create_node"] = $value["create_node"];
                    $incr++;
                } else {
                    while ($pile[count($pile) - 1] != $value["word_parent"] && count($pile)) {
                        array_pop($pile);
                    }
                    array_push($pile, ":");
                    array_push($pile, $value["wording"]);
                }
            }
        } else {
            if ($value["id_thes"] && $value["wording"]) {
                $thes_temp = new thesaurus($value["id_thes"]);
                $lib = "[" . $thes_temp->libelle_thesaurus . "]";
                $lib_hierar = "";
                if ($value["id_parent"]) {
                    $lib_hierar = " " . categories::listAncestorNames($value["id_parent"], $lang);
                }
                if (trim($lib_hierar)) {
                    $lib .= $lib_hierar . ":" . $value["wording"];
                } else {
                    $lib .= " " . $value["wording"];
                }
                $list_rameau[$lib] = htmlentities($lib, ENT_QUOTES, $charset);
                if (!$value["id_parent"]) {
                    $list_rameau[$lib] .= "</b>" . htmlentities($msg["func_category_auto_reprise"], ENT_QUOTES, $charset) . "<b>";
                }
                $tabl_build[$incr]["wording"] = $value["wording"];
                $tabl_build[$incr]["id_thes"] = $value["id_thes"];
                $tabl_build[$incr]["id_parent"] = $value["id_parent"];
                $incr++;
            }
        }
    }
    $champ_rameau = "";
    $champ_rameau .= implode("<br/>", $list_rameau);
    //$champ_rameau.="<pre>".print_r($tabl_categ_lib,true)."</pre>";
    $rameau_form = serialize($tabl_build);
    // $rameau est la variable traitée par la fonction traite_categories_from_form,
    // $rameau est normalement POSTée, afin de pouvoir être traitée en lot, donc hors
    // formulaire, il faut l'affecter.
    $rameau = addslashes(serialize($tabl_build));
    return array("form" => "<input type='hidden' name='rameau' value='" . htmlentities($rameau_form, ENT_QUOTES, $charset) . "' />", "message" => htmlentities($msg["func_category_auto_reprise_suivante"], ENT_QUOTES, $charset) . "<br/><b>" . $champ_rameau . "</b>");
}
Пример #4
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;
    }
}