function import_new_notice_suite() { global $dbh; global $notice_id; global $index_sujets; global $pmb_keyword_sep; global $id_notices_custom_opsys, $id_notices_custom_type_opsys; global $info_001, $info_464, $info_464_a, $info_464_e, $info_464_f, $info_461_3, $info_461_t, $info_200_a, $info_200_e, $info_210_d, $info_902_a, $info_686_a, $info_462_3, $info_462_t; global $num_thesaurus, $thes; global $info_675_a; global $info_600_a, $info_600_b, $info_600_j, $info_600_x, $info_600_y, $info_600_z; global $info_601_a, $info_601_b, $info_601_j, $info_601_x, $info_601_y, $info_601_z; global $info_602_a, $info_602_b, $info_602_j, $info_602_x, $info_602_y, $info_602_z; global $info_605_a, $info_605_b, $info_605_j, $info_605_x, $info_605_y, $info_605_z; global $info_606_a, $info_606_b, $info_606_j, $info_606_x, $info_606_y, $info_606_z; global $info_607_a, $info_607_b, $info_607_j, $info_607_x, $info_607_y, $info_607_z; global $info_610_a, $info_610_e, $info_610_b, $info_610_j, $info_610_x, $info_610_y, $info_610_z, $info_610_3, $info_610; global $bulletin_id; global $flag_titre_serie_recuperation; global $flag_depouillements_464, $flag_depouillements_464_doc_sonore, $flag_depouillements_464_doc_imprime; global $aut_700, $aut_701, $aut_702, $aut_710, $aut_711, $aut_712; global $accomp_345_c; global $table_responsability_function; global $lang, $include_path, $xml_changement; global $info_345_d; global $info_071_a, $info_071_b; global $thes_centre_interet, $num_thesaurus_centre_interet, $info_901; global $flag_import_610_in_mot_cles, $thes_610, $num_thesaurus_610; global $collection_225, $sous_coll; // prix dvd et video if ($info_345_d[0]) { $requete = "update notices set prix='" . addslashes($info_345_d[0]) . "' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } // EAN if ($info_071_a[0]) { $requete = "update notices set code='" . addslashes($info_071_a[0]) . "' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } // Producteur -> Editeur if ($info_071_b[0]) { $nom = $info_071_b[0]; $requete = "select ed_id from publishers where ed_name='" . addslashes($nom) . "' "; $result = pmb_mysql_query($requete); if ($row = pmb_mysql_fetch_row($result)) { $ed_id = $row[0]; } else { $requete = "insert into publishers SET ed_name='{$nom}', "; $requete .= "index_publisher=' " . strip_empty_words($nom) . " '"; pmb_mysql_query($requete); $ed_id = pmb_mysql_insert_id(); } $requete = "update notices set ed1_id='" . $ed_id . "' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } // 345_c Matériel d'accompagnement if ($accomp_345_c[0]) { $requete = "update notices set accomp='" . addslashes($accomp_345_c[0]) . "' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } update_authors_num_opsys($aut_700, 0); update_authors_num_opsys($aut_701, 1); update_authors_num_opsys($aut_702, 2); update_authors_num_opsys($aut_710, 2); update_authors_num_opsys($aut_711, 2); update_authors_num_opsys($aut_712, 2); if ($xml_changement) { xml_save_table("{$include_path}/marc_tables/{$lang}/function_subst.xml", $table_responsability_function); } //UDC if ($info_675_a[0]) { $indexint_id = indexint::import(clean_string($info_675_a[0])); $requete = "update notices set indexint='{$indexint_id}' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } if ($aut_700[0][a] != "") { if ($aut_700[0][3] != "") { $requete = "select author_id from authors where author_name='" . addslashes($aut_700[0][a]) . "' and author_rejete='" . addslashes($aut_700[0][b]) . "' "; $result = pmb_mysql_query($requete); if ($row = pmb_mysql_fetch_row($result)) { $author_id = $row[0]; $requete = "update authors set author_comment='" . addslashes($aut_700[0][3]) . "' where author_id='{$author_id}' "; pmb_mysql_query($requete); } } } if ($sous_coll == '1' && $collection_225[0]['a'] != "" && $collection_225[1]['a'] != "") { $q = "select coll_id from notices where notice_id='{$notice_id}' "; $r = pmb_mysql_query($q, $dbh); $coll_id = pmb_mysql_result($r, 0, 0); if ($coll_id != '0') { /* sous collection */ $subcollec['name'] = clean_string($collection_225[1]['a']); $subcollec['coll_parent'] = $coll_id; $subcoll_id = subcollection::import($subcollec); $requete = "update notices set subcoll_id='{$subcoll_id}' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } } $bulletin_id = 0; // Effacement de la notice temporaire eventuelle list($num_opsys, $type_opsys) = explode(" ", $info_001[0]); if ($type_opsys == 'UMO:13') { $requete = "update notices set niveau_biblio='b', niveau_hierar='2' where notice_id='{$notice_id}' "; //print "$requete <br />"; pmb_mysql_query($requete); } if ($type_opsys == 'UMO:23' || $type_opsys == 'UMO:3') { // Titre de périodique $requete = "select * from notices_custom_values where notices_custom_small_text='" . $num_opsys . "'"; //print "new $type_opsys: $requete <br />"; $resultat = pmb_mysql_query($requete); //Notice existe-t-elle comme notice temporaire? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id notice temporaire a supprimer $old_n = pmb_mysql_fetch_object($resultat); $notice_id_old = $old_n->notices_custom_origine; // modifie les anciennes relations sur la vrai notice $requete = "update notices_relations set linked_notice='{$notice_id}' where linked_notice='{$notice_id_old}' "; //print "$requete <br />"; pmb_mysql_query($requete); $requete = "update bulletins set bulletin_notice='{$notice_id}' where bulletin_notice='{$notice_id_old}' "; //print "$requete <br />"; pmb_mysql_query($requete); $requete = "update notices set niveau_biblio='s', niveau_hierar='1' where notice_id='{$notice_id}' "; //print "$requete <br />"; pmb_mysql_query($requete); // suppression de la notice temporaire $requete = "delete from notices where notice_id=" . $notice_id_old; pmb_mysql_query($requete); $requete = "delete from notices_custom_values where notices_custom_origine='" . $notice_id_old . "'"; pmb_mysql_query($requete); //print "$requete <br />"; } else { $requete = "update notices set niveau_biblio='s', niveau_hierar='1' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } } else { if ($type_opsys == 'UMO:41' || $type_opsys == 'UMO:42') { // Dépouillement (hors article) //Rien } else { if ($type_opsys == 'UMO:43') { // Dépouillement article de périodique $requete = "select * from notices_custom_values where notices_custom_small_text='" . $num_opsys . "'"; //print "new $type_opsys: $requete <br />"; $resultat = pmb_mysql_query($requete); //Notice existe-t-elle comme notice temporaire? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id notice temporaire a supprimer $old_n = pmb_mysql_fetch_object($resultat); $notice_id_old = $old_n->notices_custom_origine; // modifie les anciennes relations sur la vrai notice $requete = "update analysis set analysis_notice='{$notice_id}' where analysis_notice='{$notice_id_old}' "; //print "$requete <br />"; pmb_mysql_query($requete); $requete = "update notices set niveau_biblio='a', niveau_hierar='2' where notice_id='{$notice_id}' "; //print "$requete <br />"; pmb_mysql_query($requete); // suppression de la notice temporaire $requete = "delete from notices where notice_id=" . $notice_id_old; pmb_mysql_query($requete); $requete = "delete from notices_custom_values where notices_custom_origine='" . $notice_id_old . "'"; pmb_mysql_query($requete); } else { $requete = "update notices set niveau_biblio='a', niveau_hierar='2' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); //print "$requete <br />"; } } else { // UMO 1 2 4 8 21 22 24 28 $is_serie = $type_opsys == 'UMO:21' || $type_opsys == 'UMO:22' || $type_opsys == 'UMO:24' || $type_opsys == 'UMO:28'; if ($flag_titre_serie_recuperation && $is_serie || !$is_serie) { $requete = "select * from notices_custom_values where notices_custom_small_text='" . $num_opsys . "'"; //print "new $type_opsys: $requete <br />"; $resultat = pmb_mysql_query($requete); //Notice existe-t-elle comme notice temporaire? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id notice temporaire a supprimer $old_n = pmb_mysql_fetch_object($resultat); $notice_id_old = $old_n->notices_custom_origine; // modifie les anciennes relations sur la vrai notice $requete = "update notices_relations set linked_notice='{$notice_id}' where linked_notice='{$notice_id_old}' "; //print "$requete <br />"; pmb_mysql_query($requete); // suppression de la notice temporaire $requete = "delete from notices where notice_id=" . $notice_id_old; pmb_mysql_query($requete); $requete = "delete from notices_custom_values where notices_custom_origine='" . $notice_id_old . "'"; pmb_mysql_query($requete); //print "$requete <br />"; } } else { if ($is_serie) { // suprimer la notice car on en veut pas del_notice($notice_id); return; } } } } } //Genre dans Thesaurus for ($i = 0; $i < count($info_902_a); $i++) { for ($j = 0; $j < count($info_902_a[$i]); $j++) { $resultat = categories::searchLibelle(addslashes($info_902_a[$i][$j]), $num_thesaurus, 'fr_FR'); if (!$resultat) { /*vérification de l'existence des categs, sinon création */ $resultat = create_categ($thes, $thes->num_noeud_racine, $info_902_a[$i][$j], ' ' . strip_empty_words($info_902_a[$i][$j]) . ' '); } /* ajout de l'indexation à la notice dans la table notices_categories*/ $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "' "; $res_ajout = @pmb_mysql_query($rqt_ajout, $dbh); } } //centre interet dans Thesaurus for ($i = 0; $i < count($info_901); $i++) { $resultat = categories::searchLibelle(addslashes($info_901[$i]['a']), $num_thesaurus_centre_interet, 'fr_FR'); if (!$resultat) { /*vérification de l'existence des categs, sinon création */ $resultat = create_categ($thes_centre_interet, $thes_centre_interet->num_noeud_racine, $info_901[$i]['a'], ' ' . strip_empty_words($info_901[$i]['a']) . ' ', $info_901[$i][3]); } /* ajout de l'indexation à la notice dans la table notices_categories*/ $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "' "; $res_ajout = @pmb_mysql_query($rqt_ajout, $dbh); } // Pcdm (686) dans le plan de classement // print "<pre>"; print_r($info_686_a);print "</pre>"; if (count($info_686_a)) { //vérification de l'existence des categs, sinon création $requete = "select indexint_id from indexint where indexint_name='" . addslashes($info_686_a[0]) . "' and num_pclass='2'"; //print "$requete <br />"; $result = pmb_mysql_query($requete); if ($row = pmb_mysql_fetch_row($result)) { $indexint_id = $row[0]; } else { $requete = "insert into indexint SET indexint_name='" . addslashes($info_686_a[0]) . "', num_pclass='2' "; //print "$requete <br />"; pmb_mysql_query($requete); $indexint_id = pmb_mysql_insert_id(); } $requete = "update notices set indexint='{$indexint_id}' where notice_id='{$notice_id}' "; // print "$requete <br />"; @pmb_mysql_query($requete, $dbh); } // if (is_array($index_sujets)) $mots_cles = implode (" $pmb_keyword_sep ",$index_sujets); // else $mots_cles = $index_sujets; $mots_cles = ''; for ($a = 0; $a < sizeof($info_600_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_a[$a][0]; for ($j = 0; $j < sizeof($info_600_b[$a]); $j++) { $mots_cles .= " , " . $info_600_b[$a][0]; } for ($j = 0; $j < sizeof($info_600_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_j[$a][$j]; } for ($j = 0; $j < sizeof($info_600_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_x[$a][$j]; } for ($j = 0; $j < sizeof($info_600_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_y[$a][$j]; } for ($j = 0; $j < sizeof($info_600_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_601_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_a[$a][0]; for ($j = 0; $j < sizeof($info_601_b[$a]); $j++) { $mots_cles .= " , " . $info_601_b[$a][0]; } for ($j = 0; $j < sizeof($info_601_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_j[$a][$j]; } for ($j = 0; $j < sizeof($info_601_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_x[$a][$j]; } for ($j = 0; $j < sizeof($info_601_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_y[$a][$j]; } for ($j = 0; $j < sizeof($info_601_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_602_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_a[$a][0]; for ($j = 0; $j < sizeof($info_602_b[$a]); $j++) { $mots_cles .= " , " . $info_602_b[$a][0]; } for ($j = 0; $j < sizeof($info_602_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_j[$a][$j]; } for ($j = 0; $j < sizeof($info_602_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_x[$a][$j]; } for ($j = 0; $j < sizeof($info_602_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_y[$a][$j]; } for ($j = 0; $j < sizeof($info_602_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_605_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_a[$a][0]; for ($j = 0; $j < sizeof($info_605_b[$a]); $j++) { $mots_cles .= " , " . $info_605_b[$a][0]; } for ($j = 0; $j < sizeof($info_605_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_j[$a][$j]; } for ($j = 0; $j < sizeof($info_605_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_x[$a][$j]; } for ($j = 0; $j < sizeof($info_605_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_y[$a][$j]; } for ($j = 0; $j < sizeof($info_605_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_606_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_a[$a][0]; for ($j = 0; $j < sizeof($info_606_b[$a]); $j++) { $mots_cles .= " , " . $info_606_b[$a][0]; } for ($j = 0; $j < sizeof($info_606_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_j[$a][$j]; } for ($j = 0; $j < sizeof($info_606_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_x[$a][$j]; } for ($j = 0; $j < sizeof($info_606_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_y[$a][$j]; } for ($j = 0; $j < sizeof($info_606_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_607_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_a[$a][0]; for ($j = 0; $j < sizeof($info_607_b[$a]); $j++) { $mots_cles .= " , " . $info_607_b[$a][0]; } for ($j = 0; $j < sizeof($info_607_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_j[$a][$j]; } for ($j = 0; $j < sizeof($info_607_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_x[$a][$j]; } for ($j = 0; $j < sizeof($info_607_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_y[$a][$j]; } for ($j = 0; $j < sizeof($info_607_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_z[$a][$j]; } } if ($flag_import_610_in_mot_cles) { for ($a = 0; $a < sizeof($info_610_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_610_a[$a][0]; for ($j = 0; $j < sizeof($info_610_b[$a]); $j++) { $mots_cles .= " , " . $info_610_b[$a][0]; } for ($j = 0; $j < sizeof($info_610_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_610_j[$a][$j]; } for ($j = 0; $j < sizeof($info_610_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_610_x[$a][$j]; } for ($j = 0; $j < sizeof($info_610_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_610_y[$a][$j]; } for ($j = 0; $j < sizeof($info_610_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_610_z[$a][$j]; } if (sizeof($info_610_e[$a])) { $mots_cles .= " ( "; for ($j = 0; $j < sizeof($info_610_e[$a]); $j++) { if ($j) { $mots_cles .= " , "; } $mots_cles .= $info_610_e[$a][$j]; } $mots_cles .= " ) "; } } } //print"<pre>";print_r($info_610_a);print_r($info_610_e);print"</pre>"; for ($a = 0; $a < sizeof($info_610_a); $a++) { $resultat = categories::searchLibelle(addslashes($info_610_a[$a][0]), $num_thesaurus_610, 'fr_FR', $thes_610->num_noeud_racine); if (!$resultat) { /*vérification de l'existence des categs, sinon création */ $resultat = create_categ($thes_610, $thes_610->num_noeud_racine, $info_610_a[$a][0], ' ' . strip_empty_words($info_610_a[$a][0]) . ' ', $info_610_3[$a][0]); } for ($j = 0; $j < sizeof($info_610_e[$a]); $j++) { if ($info_610_e[$a][$j]) { $num_parent = $resultat; $resultat = categories::searchLibelle(addslashes($info_610_e[$a][$j]), $num_thesaurus_610, 'fr_FR', $num_parent); if (!$resultat) { /*vérification de l'existence des categs, sinon création */ $resultat = create_categ($thes_610, $num_parent, $info_610_e[$a][$j], ' ' . strip_empty_words($info_610_e[$a][$j]) . ' ', $info_610_3[$a][0]); } } } /* ajout de l'indexation à la notice dans la table notices_categories*/ $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "' "; $res_ajout = @pmb_mysql_query($rqt_ajout, $dbh); } if (substr($mots_cles, 0, 2) == ' ;') { $mots_cles = substr($mots_cles, 2); } $mots_cles ? $index_matieres = strip_empty_words($mots_cles) : ($index_matieres = ''); $rqt_maj = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes($index_matieres) . " ' where notice_id='{$notice_id}' "; $res_ajout = pmb_mysql_query($rqt_maj, $dbh); // insert du param perso mémorisant le numero Opsys de la notice if (!$id_notices_custom_opsys) { $rqt = "select idchamp from notices_custom where name='num_opsys'"; $res = pmb_mysql_query($rqt, $dbh); if ($res && ($r = pmb_mysql_fetch_object($res))) { $id_notices_custom_opsys = $r->idchamp; } $rqt = "select idchamp from notices_custom where name='type_opsys'"; $res = pmb_mysql_query($rqt, $dbh); if ($res && ($r = pmb_mysql_fetch_object($res))) { $id_notices_custom_type_opsys = $r->idchamp; } } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$notice_id},'" . addslashes($num_opsys) . "')"; pmb_mysql_query($requete); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_type_opsys},{$notice_id},'" . addslashes($type_opsys) . "')"; pmb_mysql_query($requete); $requete = "select * from notices where notice_id={$notice_id}"; $resultat = pmb_mysql_query($requete); $r = pmb_mysql_fetch_object($resultat); // $flag_depouillements_464_doc_sonore // $flag_depouillements_464_doc_imprime=0; // Traiter les dépouillement du champ 464 if ($flag_depouillements_464) { if (is_array($info_464)) { switch ($type_opsys) { case 'UMO:1': // Documents imprimés Unimarc moyen $niveau_biblio = 'm'; $niveau_hierar = '0'; break; case 'UMO:2': // Documents sonores Unimarc moyen $niveau_biblio = 'm'; $niveau_hierar = '0'; break; case 'UMO:13': // bulletin $niveau_biblio = 'a'; $niveau_hierar = '2'; break; case 'UMO:4': // Documents audiovisuel Unimarc moyen $niveau_biblio = 'm'; $niveau_hierar = '0'; break; case 'UMO:8': // Logiciels - CDrom $niveau_biblio = 'm'; $niveau_hierar = '0'; break; default: $niveau_biblio = 'm'; $niveau_hierar = '0'; break; } //print "<pre>";print_r ($info_464);print "</pre>"; for ($i = 0; $i < sizeof($info_464); $i++) { $a_464 = $e_464 = $_3_464 = array(); $author_id = 0; for ($j = 0; $j < sizeof($info_464[$i]); $j++) { if ($info_464[$i][$j]['label'] == 'a') { $a_464[] = $info_464[$i][$j]['content']; } if ($info_464[$i][$j]['label'] == 'e') { $e_464[] = $info_464[$i][$j]['content']; } // Complément du titre if ($info_464[$i][$j]['label'] == '3') { $_3_464[] = $info_464[$i][$j]['content']; } // Complément du titre } //print "<pre>";print_r ($_3_464);print "</pre>"; for ($j = 0; $j < sizeof($a_464); $j++) { if ($_3_464[$j]) { $requete = "select author_id from authors where author_comment='" . addslashes($_3_464[$j]) . "' "; $result = pmb_mysql_query($requete); if ($row = pmb_mysql_fetch_row($result)) { $author_id = $row[0]; //print $author_id."<br />"; } } if ($a_464[$j] != '...') { $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($a_464[$j]) . "',tit2 ='" . addslashes($e_464[$j]) . "', niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}' "; //if ($type_opsys="UMO:2") print $requete ."<br />"; pmb_mysql_query($requete); $depouille_id = pmb_mysql_insert_id(); if ($depouille_id) { //link notice $requete = "insert into notices_relations set num_notice='{$depouille_id}', linked_notice ='{$notice_id}', relation_type='a' "; pmb_mysql_query($requete); if ($author_id) { $requete = "insert into responsability SET responsability_fonction='070' , responsability_notice='{$depouille_id}' , responsability_author = {$author_id}, responsability_type=0"; //print $requete."<br />"; $result = pmb_mysql_query($requete); } } } } } /* for ($i=0; $i<sizeof($info_464); $i++) { $a_464=''; $e_464=''; for ($j=0; $j<sizeof($info_464[$i]); $j++) { if($info_464[$i][$j]['label']=='a') $a_464=$info_464[$i][$j]['content']; if($info_464[$i][$j]['label']=='e') $e_464=$info_464[$i][$j]['content']; } $requete="insert into notices set typdoc='$r->typdoc', tit1 ='".addslashes($a_464)."',tit2 ='".addslashes($e_464)."', niveau_biblio='$niveau_biblio',niveau_hierar='$niveau_hierar' "; //if ($type_opsys="UMO:2") print $requete ."<br />"; pmb_mysql_query($requete); $depouille_id=pmb_mysql_insert_id(); if ($depouille_id) { //link notice $requete="insert into notices_relations set num_notice='$depouille_id', linked_notice ='$notice_id', relation_type='a' "; pmb_mysql_query($requete); } } */ } } // $info_461_3,$info_461_t : dépendance d'une notice chapeau for ($_3 = 0; $_3 < sizeof($info_461_3); $_3++) { switch ($type_opsys) { case 'UMO:1': case 'UMO:2': case 'UMO:4': case 'UMO:8': if ($flag_titre_serie_recuperation) { // que si on veut $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_461_3[$_3] . "'"; //print "$requete <br />"; $resultat = pmb_mysql_query($requete); //Notice chapeau existe-t-elle ? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = pmb_mysql_result($resultat, 0, 0); } else { $niveau_biblio = 'm'; $niveau_hierar = '1'; // Création de la notice temporaire chapeau $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_461_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}' "; //print "$requete <br />"; pmb_mysql_query($requete); $chapeau_id = pmb_mysql_insert_id(); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$chapeau_id},'" . addslashes($info_461_3[$_3]) . "')"; //print "$requete <br />"; pmb_mysql_query($requete); } if ($chapeau_id) { //link notice $requete = "insert into notices_relations set num_notice='{$notice_id}', linked_notice ='{$chapeau_id}', relation_type='a' "; //print "$requete <br />"; pmb_mysql_query($requete); } } break; case 'UMO:13': // bulletin de périodique $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_461_3[$_3] . "'"; //print "$requete <br />"; $resultat = pmb_mysql_query($requete); //Notice chapeau existe-t-elle ? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = pmb_mysql_result($resultat, 0, 0); } else { $niveau_biblio = 's'; $niveau_hierar = '1'; // Création de la notice temporaire chapeau $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_461_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}' "; //print "$requete <br />"; pmb_mysql_query($requete); $chapeau_id = pmb_mysql_insert_id(); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$chapeau_id},'" . addslashes($info_461_3[$_3]) . "')"; //print "$requete <br />"; pmb_mysql_query($requete); } if ($chapeau_id) { //link notice $requete = "insert into notices_relations set num_notice='{$notice_id}', linked_notice ='{$chapeau_id}', relation_type='b' , rank ='1'"; //print "$requete <br />"; pmb_mysql_query($requete); // création bulletin $info = array(); $bulletin = new bulletinage("", $chapeau_id); $info['bul_titre'] = addslashes($info_200_a[0]); $info['bul_no'] = addslashes($info_200_e[0]); $info['bul_date'] = addslashes($info_200_e[1]); $info['date_date'] = gen_date($info_200_e[1], $info_210_d[0]); $bulletin->bull_num_notice = $notice_id; $bulletin_id = $bulletin->update($info, true); } break; default: break; } } // $info_462_3,$info_462_t : Dépouillement, article for ($_3 = 0; $_3 < sizeof($info_462_3); $_3++) { switch ($type_opsys) { case 'UMO:1': case 'UMO:2': case 'UMO:8': $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_462_3[$_3] . "'"; //print "$requete <br />"; $resultat = pmb_mysql_query($requete); //Notice chapeau existe-t-elle ? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = pmb_mysql_result($resultat, 0, 0); } else { $niveau_biblio = 'm'; $niveau_hierar = '0'; // Création de la notice temporaire chapeau $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_462_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}' "; //print "$requete <br />"; pmb_mysql_query($requete); $chapeau_id = pmb_mysql_insert_id(); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$chapeau_id},'" . addslashes($info_462_3[$_3]) . "')"; //print "$requete <br />"; pmb_mysql_query($requete); } if ($chapeau_id) { //link notice $requete = "insert into notices_relations set num_notice='{$notice_id}', linked_notice ='{$chapeau_id}', relation_type='a' "; //print "$requete <br />"; pmb_mysql_query($requete); } break; case 'UMO:13': // bulletin de périodique => création des articles $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_462_3[$_3] . "'"; //print "$requete <br />"; $resultat = pmb_mysql_query($requete); //Notice article existe-t-elle ? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id $article_id = pmb_mysql_result($resultat, 0, 0); } else { $niveau_biblio = 'a'; $niveau_hierar = '2'; // Création de la notice temporaire de l'article $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_462_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}' "; //print "$requete <br />"; pmb_mysql_query($requete); $article_id = pmb_mysql_insert_id(); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$article_id},'" . addslashes($info_462_3[$_3]) . "')"; //print "$requete <br />"; pmb_mysql_query($requete); } if ($article_id) { //lien article de bulletin créé dans table analitique $requete = "insert into analysis set analysis_bulletin='{$bulletin_id}', analysis_notice ='{$article_id}' "; //print "$requete <br />"; pmb_mysql_query($requete); } break; default: break; } } }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_464; global $info_606_a; global $info_900, $info_901, $info_902, $info_903, $info_904, $info_905, $info_906; global $pmb_keyword_sep; global $bulletin_ex; //Cas des périodiques if (is_array($info_464)) { $requete = "select * from notices where notice_id={$notice_id}"; $resultat = pmb_mysql_query($requete); $r = pmb_mysql_fetch_object($resultat); //Notice chapeau existe-t-elle ? $requete = "select notice_id from notices where tit1='" . addslashes($info_464[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'"; $resultat = pmb_mysql_query($requete); if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = pmb_mysql_result($resultat, 0, 0); //Bulletin existe-t-il ? $requete = "select bulletin_id from bulletins where bulletin_numero='" . addslashes($info_464[0]['v']) . "' and mention_date='" . addslashes($info_464[0]['d']) . "' and bulletin_notice={$chapeau_id}"; //$requete="select bulletin_id from bulletins where bulletin_numero='".addslashes($info_464[0]['v'])."' and bulletin_notice=$chapeau_id"; $resultat = pmb_mysql_query($requete); if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id bulletin $bulletin_id = pmb_mysql_result($resultat, 0, 0); } else { //Si non, création bulltin $info = array(); $bulletin = new bulletinage("", $chapeau_id); $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']); $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { $date_date = explode("/", $info_464[0]['d']); if (count($date_date)) { if (count($date_date) == 1) { $info['date_date'] = $date_date[0] . "-01-01"; } if (count($date_date) == 2) { $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01"; } if (count($date_date) == 3) { $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0]; } } else { if ($info_904[0]) { $info['date_date'] = $info_904[0]; } } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } } else { //Si non, création notice chapeau et bulletin $chapeau = new serial(); $info = array(); $info['tit1'] = addslashes($info_464[0]['t']); $info['niveau_biblio'] = 's'; $info['niveau_hierar'] = '1'; $info['typdoc'] = $r->typdoc; $chapeau->update($info); $chapeau_id = $chapeau->serial_id; $bulletin = new bulletinage("", $chapeau_id); $info = array(); $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']); $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { $date_date = explode("/", $info_464[0]['d']); if (count($date_date)) { if (count($date_date) == 1) { $info['date_date'] = $date_date[0] . "-01-01"; } if (count($date_date) == 2) { $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01"; } if (count($date_date) == 3) { $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0]; } } else { if ($info_904[0]) { $info['date_date'] = $info_904[0]; } } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } //Notice objet ? if ($info_464[0]['z'] == 'objet') { //Supression de la notice $requete = "delete from notices where notice_id={$notice_id}"; pmb_mysql_query($requete); $bulletin_ex = $bulletin_id; } else { //Passage de la notice en article $requete = "update notices set niveau_biblio='a', niveau_hierar='2', year='" . addslashes($info_464[0]['d']) . "', npages='" . addslashes($info_464[0]['p']) . "', date_parution='" . $info['date_date'] . "' where notice_id={$notice_id}"; pmb_mysql_query($requete); $requete = "insert into analysis (analysis_bulletin,analysis_notice) values({$bulletin_id},{$notice_id})"; pmb_mysql_query($requete); $bulletin_ex = $bulletin_id; } } else { $bulletin_ex = 0; } //Traitement du thésaurus $unknown_desc = array(); for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur = $info_606_a[$i][$j]; //Recherche du terme //dans le thesaurus par defaut et dans la langue de l'interface $libelle = addslashes($descripteur); $categ_id = categories::searchLibelle($libelle); if ($categ_id) { $requete = "insert into notices_categories (notcateg_notice,num_noeud) values({$notice_id},{$categ_id})"; pmb_mysql_query($requete); } else { $unknown_desc[] = $descripteur; } } if ($unknown_desc) { $mots_cles = implode($pmb_keyword_sep, $unknown_desc); $requete = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes(strip_empty_words($mots_cles)) . " ' where notice_id={$notice_id}"; pmb_mysql_query($requete); } } }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_464; global $info_606_a; global $info_900, $info_901, $info_902, $info_903, $info_904, $info_905, $info_906; global $pmb_keyword_sep; global $bulletin_ex; //Cas des périodiques if (is_array($info_464)) { $requete = "select * from notices where notice_id={$notice_id}"; $resultat = mysql_query($requete); $r = mysql_fetch_object($resultat); //Notice chapeau existe-t-elle ? $requete = "select notice_id from notices where tit1='" . addslashes($info_464[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = mysql_result($resultat, 0, 0); //Bulletin existe-t-il ? $requete = "select bulletin_id from bulletins where bulletin_numero='" . addslashes($info_464[0]['v']) . "' and mention_date='" . addslashes($info_464[0]['d']) . "' and bulletin_notice={$chapeau_id}"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id bulletin $bulletin_id = mysql_result($resultat, 0, 0); } else { //Si non, création bulltin $info = array(); $bulletin = new bulletinage("", $chapeau_id); $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']); $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { if ($info_904[0]) { $info['date_date'] = $info_904[0]; } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } } else { //Si non, création notice chapeau et bulletin $chapeau = new serial(); $info = array(); $info['tit1'] = addslashes($info_464[0]['t']); $info['niveau_biblio'] = 's'; $info['niveau_hierar'] = '1'; $info['typdoc'] = $r->typdoc; $chapeau->update($info); $chapeau_id = $chapeau->serial_id; $bulletin = new bulletinage("", $chapeau_id); $info = array(); $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']); $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { if ($info_904[0]) { $info['date_date'] = $info_904[0]; } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } //Notice objet ? if ($info_464[0]['z'] == 'objet') { //Supression de la notice $requete = "delete from notices where notice_id={$notice_id}"; mysql_query($requete); $bulletin_ex = $bulletin_id; } else { //Passage de la notice en article $requete = "update notices set niveau_biblio='a', niveau_hierar='2', year='" . addslashes($info_464[0]['d']) . "', npages='" . addslashes($info_464[0]['p']) . "', date_parution='" . $info['date_date'] . "' where notice_id={$notice_id}"; mysql_query($requete); $requete = "insert into analysis (analysis_bulletin,analysis_notice) values({$bulletin_id},{$notice_id})"; mysql_query($requete); $bulletin_ex = $bulletin_id; } } else { $bulletin_ex = 0; } //Traitement du thésaurus $unknown_desc = array(); $ordre_categ = 0; for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur = trim($info_606_a[$i][$j]); //Recherche du terme $requete = "SELECT id_noeud,num_renvoi_voir from noeuds JOIN categories ON (noeuds.id_noeud = categories.num_noeud) where categories.libelle_categorie = '" . addslashes($descripteur) . "' "; $resultat = mysql_query($requete); if (mysql_num_rows($resultat) == 1) { $categ_id = mysql_result($resultat, 0, 0); if (mysql_result($resultat, 0, 1)) { $categ_id = mysql_result($resultat, 0, 1); } $requete = "INSERT IGNORE INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) VALUES({$notice_id},{$categ_id},{$ordre_categ})"; mysql_query($requete); $ordre_categ++; } else { $unknown_desc[] = $descripteur; } } } if (count($unknown_desc)) { $mots_cles = implode($pmb_keyword_sep, $unknown_desc); $requete = "UPDATE notices SET index_l=IF(index_l != '',CONCAT(index_l,'" . $pmb_keyword_sep . "','" . addslashes($mots_cles) . "'),'" . addslashes($mots_cles) . "'), index_matieres=IF(index_matieres != '',CONCAT(index_matieres,' ','" . addslashes(strip_empty_words($mots_cles)) . "'),'" . addslashes(strip_empty_words($mots_cles)) . "') WHERE notice_id='" . $notice_id . "'"; mysql_query($requete); } //Thème if (count($info_900)) { $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=1"; $res = mysql_query($requete); if (mysql_num_rows($res) && mysql_result($res, 0, 1) == "list" && mysql_result($res, 0, 2) == "integer") { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=1"; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; for ($i = 0; $i < count($info_900); $i++) { for ($j = 0; $j < count($info_900[$i]); $j++) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_900[$i][$j]) . "' and notices_custom_champ=1"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(1,{$n},'" . addslashes($info_900[$i][$j]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(1,{$notice_id},{$value})"; mysql_query($requete); } } } else { mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=1 ou il n\\'est pas de type liste entier : le 900 n\\'est donc pas repris (Thème)') "); } } //Genres if (count($info_901)) { $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=2"; $res = mysql_query($requete); if (mysql_num_rows($res) && mysql_result($res, 0, 1) == "list" && mysql_result($res, 0, 2) == "integer") { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=2"; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; for ($i = 0; $i < count($info_901); $i++) { for ($j = 0; $j < count($info_901[$i]); $j++) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_901[$i][$j]) . "' and notices_custom_champ=2"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(2,{$n},'" . addslashes($info_901[$i][$j]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(2,{$notice_id},{$value})"; mysql_query($requete); } } } else { mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=2 ou il n\\'est pas de type liste entier : le 901 n\\'est donc pas repris (Genres)') "); } } //Discipline if (count($info_902)) { $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=3"; $res = mysql_query($requete); if (mysql_num_rows($res) && mysql_result($res, 0, 1) == "list" && mysql_result($res, 0, 2) == "integer") { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=3"; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; for ($i = 0; $i < count($info_902); $i++) { for ($j = 0; $j < count($info_902[$i]); $j++) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_902[$i][$j]) . "' and notices_custom_champ=3"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(3,{$n},'" . addslashes($info_902[$i][$j]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(3,{$notice_id},{$value})"; mysql_query($requete); } } } else { mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=3 ou il n\\'est pas de type liste entier : le 902 n\\'est donc pas repris (Discipline)') "); } } //Type de nature if ($info_905[0]) { $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=6"; $res = mysql_query($requete); if (mysql_num_rows($res) && mysql_result($res, 0, 1) == "list" && mysql_result($res, 0, 2) == "integer") { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=6"; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[0]) . "' and notices_custom_champ=6"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(6,{$n},'" . addslashes($info_905[0]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(6,{$notice_id},{$value})"; mysql_query($requete); } else { mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=6 ou il n\\'est pas de type liste entier : le 905 n\\'est donc pas repris (Type de nature)') "); } } //Niveau if (count($info_906)) { $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=7"; $res = mysql_query($requete); if (mysql_num_rows($res) && mysql_result($res, 0, 1) == "list" && mysql_result($res, 0, 2) == "integer") { for ($i = 0; $i < count($info_906); $i++) { for ($j = 0; $j < count($info_906[$i]); $j++) { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=7"; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_906[$i][$j]) . "' and notices_custom_champ=7"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(7,{$n},'" . addslashes($info_906[$i][$j]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(7,{$notice_id},{$value})"; mysql_query($requete); } } } else { mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=7 ou il n\\'est pas de type liste entier : le 906 n\\'est donc pas repris (Niveau)') "); } } //Année de péremption if ($info_903[0]) { $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=4"; $res = mysql_query($requete); if (mysql_num_rows($res) && mysql_result($res, 0, 2) == "integer") { $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(4,{$notice_id},'" . addslashes($info_903[0]) . "')"; mysql_query($requete); } else { mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=4 ou il n\\'est pas de type entier : le 903 n\\'est donc pas repris (Année de péremption)') "); } } //Date de saisie if ($info_904[0]) { $requete = "SELECT name,type,datatype FROM notices_custom WHERE idchamp=5"; $res = mysql_query($requete); if (mysql_num_rows($res) && mysql_result($res, 0, 2) == "date") { $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_date) values(5,{$notice_id},'" . $info_904[0] . "')"; mysql_query($requete); } else { mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', 'Il n\\'y a pas de CP de notice avec l\\'identifiant=5 ou il n\\'est pas de type date : le 904 n\\'est donc pas repris (Date de saisie)') "); } } }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_464, $info_676; global $info_606_a, $info_606_x; global $info_900, $info_901, $info_902, $info_200, $info_903, $info_904, $info_910; global $rs, $bl, $dt; global $bulletin_ex; global $m_thess; //si on est en multi-thesaurus if (!$m_thess) { $rqt = "SELECT count(1) FROM thesaurus WHERE active=1"; $m_thess = mysql_result(mysql_query($rqt), 0, 0); } //Cas des périodiques if (is_array($info_464)) { $requete = "SELECT * FROM notices WHERE notice_id={$notice_id}"; $resultat = mysql_query($requete); $r = mysql_fetch_object($resultat); //Notice chapeau existe-t-elle ? $requete = "SELECT notice_id FROM notices WHERE tit1='" . addslashes($info_464[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = mysql_result($resultat, 0, 0); //Mise à jour du champ commentaire de gestion si nécessaire if ($info_903[0]) { $requete = "UPDATE notices SET commentaire_gestion=concat(commentaire_gestion,' ','" . addslashes($info_903[0]) . "') WHERE notice_id={$chapeau_id}"; mysql_query($requete); } //Bulletin existe-t-il ? $requete = "SELECT bulletin_id FROM bulletins WHERE bulletin_numero='" . addslashes($info_464[0]['v']) . "' AND mention_date='" . addslashes($info_464[0]['d']) . "' AND bulletin_notice={$chapeau_id}"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id bulletin $bulletin_id = mysql_result($resultat, 0, 0); } else { //Si non, création bulletin $info = array(); $bulletin = new bulletinage("", $chapeau_id); if ($info_464[0]['u']) { $info['bul_titre'] = addslashes($info_464[0]['u']); } else { $info['bul_titre'] = addslashes("Bulletin " . $info_464[0]['v']); } $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { if ($info_902[0]) { $info['date_date'] = $info_902[0]; } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } } else { //Si non, création notice chapeau et bulletin $chapeau = new serial(); $info = array(); $info['tit1'] = addslashes($info_464[0]['t']); $info['niveau_biblio'] = 's'; $info['niveau_hierar'] = '1'; $info['typdoc'] = $r->typdoc; $chapeau->update($info); $chapeau_id = $chapeau->serial_id; //Mise à jour du champ commentaire de gestion si nécessaire if ($info_903[0]) { $requete = "UPDATE notices SET commentaire_gestion=concat(commentaire_gestion,' ','" . addslashes($info_903[0]) . "') WHERE notice_id={$chapeau_id}"; mysql_query($requete); } $bulletin = new bulletinage("", $chapeau_id); $info = array(); if ($info_464[0]['u']) { $info['bul_titre'] = addslashes($info_464[0]['u']); } else { $info['bul_titre'] = addslashes("Bulletin " . $info_464[0]['v']); } $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { if ($info_902[0]) { $info['date_date'] = $info_902[0]; } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } //Passage de la notice en article $requete = "UPDATE notices SET niveau_biblio='a', niveau_hierar='2', npages='" . addslashes($info_464[0]['p']) . "' WHERE notice_id={$notice_id}"; mysql_query($requete); $requete = "INSERT INTO analysis (analysis_bulletin,analysis_notice) VALUES({$bulletin_id},{$notice_id})"; mysql_query($requete); $bulletin_ex = $bulletin_id; } else { $bulletin_ex = 0; } //Traitement du thésaurus if ($m_thess > 1) { //on est en multi-thesaurus for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur_tete = $info_606_a[$i][$j]; $descripteur_fils = $info_606_x[$i][$j]; //Recherche du thésaurus $thes_id = trouve_thesaurus($descripteur_tete); //Recherche du terme fils if ($thes_id > 0) { $categ_id_fils = categories::searchLibelle(addslashes(trim($descripteur_fils)), $thes_id, "fr_FR"); if (!$categ_id_fils) { //Création $new_thes = $thes_id == 1 ? 4 : $thes_id; //Choix du thesaurus Candidats descripteurs si descripteur inexistant $categ_id_fils = categories::searchLibelle(addslashes(trim($descripteur_fils)), $new_thes, "fr_FR"); if (!$categ_id_fils) { $noeud = new noeuds(); $noeud->num_thesaurus = $new_thes; $thesau = new thesaurus($new_thes); $noeud->num_parent = $thesau->num_noeud_racine; $noeud->save(); $categ_id_fils = $noeud->id_noeud; //Création du libellé $categ = new categories($noeud->id_noeud, 'fr_FR'); $categ->libelle_categorie = $descripteur_fils; $categ->index_categorie = " " . strip_empty_words($descripteur_fils) . " "; $categ->save(); } } $requete = "INSERT INTO notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ({$notice_id},{$categ_id_fils}, " . ($i + 1) . ")"; mysql_query($requete); } } } //for($i } else { //Traitement du thésaurus unique for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur_tete = $info_606_a[$i][$j]; $descripteur_fils = $info_606_x[$i][$j]; //Recherche du terme de tête //$requete="SELECT num_noeud FROM categories WHERE libelle_categorie='".addslashes($descripteur_tete)."' AND langue='fr_FR'"; $requete = "SELECT id_noeud FROM noeuds WHERE autorite='" . addslashes($descripteur_tete) . "'"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //la tête existe ! $categ_id_tete = mysql_result($resultat, 0, 0); } else { //Création de la tête //Nouveau Noeud ! $th = new thesaurus(1); $noeud = new noeuds(); $noeud->num_thesaurus = $th->id_thesaurus; $noeud->num_parent = $th->num_noeud_racine; $noeud->autorite = $descripteur_tete; $noeud->save(); $categ_id_tete = $noeud->id_noeud; //Création du libellé $categ = new categories($noeud->id_noeud, 'fr_FR'); $categ->libelle_categorie = $descripteur_tete; $categ->index_categorie = " " . strip_empty_words($descripteur_tete) . " "; $categ->save(); } //Recherche du terme fils $categ_id_fils = categories::searchLibelle(addslashes($descripteur_fils), 1, "fr_FR"); if (!$categ_id_fils) { //Création $noeud = new noeuds(); $noeud->num_thesaurus = 1; $noeud->num_parent = $categ_id_tete; $noeud->save(); $categ_id_fils = $noeud->id_noeud; //Création du libellé $categ = new categories($noeud->id_noeud, 'fr_FR'); $categ->libelle_categorie = $descripteur_fils; $categ->index_categorie = " " . strip_empty_words($descripteur_fils) . " "; $categ->save(); } $requete = "INSERT INTO notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ({$notice_id}, {$categ_id_fils}, " . ($i + 1) . ")"; mysql_query($requete); } } } //Indexation décimale if ($info_676[0]) { $requete = "select indexint_id from indexint where indexint_name='" . addslashes($info_676[0]) . "'"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $indexint = mysql_result($resultat, 0, 0); } else { $requete = "insert into indexint (indexint_name) values('" . addslashes($info_676[0]) . "')"; mysql_query($requete); $indexint = mysql_insert_id(); } $requete = "update notices set indexint=" . $indexint . " where notice_id=" . $notice_id; mysql_query($requete); } //Organisme if ($info_900[0]) { $no_champ = trouve_champ_perso("op"); if ($no_champ > 0) { $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_900[0]) . "' AND notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_900[0]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})"; mysql_query($requete); } } //Genre if ($info_901[0]) { $no_champ = trouve_champ_perso("gen"); if ($no_champ > 0) { $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_901[0]) . "' AND notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_901[0]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})"; mysql_query($requete); } } //Type de texte if (count($info_904)) { $no_champ = trouve_champ_perso("typtext"); if ($no_champ > 0) { for ($i = 0; $i < count($info_904); $i++) { for ($j = 0; $j < count($info_904[$i]); $j++) { $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_904[$i][$j]) . "' AND notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_904[$i][$j]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})"; mysql_query($requete); } } } } //Date de saisie if ($info_902[0]) { $no_champ = trouve_champ_perso("ds"); if ($no_champ > 0) { $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_date) VALUES({$no_champ},{$notice_id},'" . str_replace(".", "-", $info_902[0]) . "')"; mysql_query($requete); } } //N° de lot if ($info_903[0]) { $requete = "UPDATE notices SET commentaire_gestion='" . addslashes($info_903[0]) . "' WHERE notice_id={$notice_id}"; mysql_query($requete); } //Cas de la mise à jour des périodiques ou du champ bord (notices chapeau) if ($bl == "s") { //Si c'est un périodique if ($dt == "a") { //Passage de la notice en notice chapeau $requete = "UPDATE notices SET niveau_biblio='s', niveau_hierar='1' WHERE notice_id={$notice_id}"; mysql_query($requete); //Recherche si la notice existe déjà par rapport au titre $requete = "select notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND niveau_biblio='s' AND niveau_hierar='1' AND notice_id!={$notice_id}"; $resultat = mysql_query($requete); $update = false; if (mysql_num_rows($resultat)) { $update = true; $n_update = mysql_result($resultat, 0, 0); //Mise à jour de tous les bulletins $requete = "UPDATE bulletins SET bulletin_notice=" . $notice_id . " WHERE bulletin_notice=" . $n_update; mysql_query($requete); //Suppression de l'ancienne notice $requete = "DELETE FROM notices WHERE notice_id={$n_update}"; mysql_query($requete); $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $n_update; mysql_query($requete); $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $n_update; mysql_query($requete); $requete = "DELETE FROM responsability WHERE responsability_author=" . $n_update; mysql_query($requete); } if (!$update && $rs != "n") { //Si il n'y a pas de création, on supprime la notice $requete = "DELETE FROM notices WHERE notice_id={$notice_id}"; mysql_query($requete); $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $notice_id; mysql_query($requete); $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $notice_id; mysql_query($requete); $requete = "DELETE FROM responsability WHERE responsability_author=" . $notice_id; mysql_query($requete); } } else { if ($dt == "l") { //Recherche si la notice existe déjà par rapport au titre $requete = "select notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND typdoc='l' AND notice_id!={$notice_id}"; $resultat = mysql_query($requete); $update = false; if (mysql_num_rows($resultat)) { $update = true; $n_update = mysql_result($resultat, 0, 0); //Suppression de l'ancienne notice $requete = "DELETE FROM notices WHERE notice_id={$n_update}"; mysql_query($requete); $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $n_update; mysql_query($requete); $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $n_update; mysql_query($requete); $requete = "DELETE FROM responsability WHERE responsability_author=" . $n_update; mysql_query($requete); } } else { if ($dt == "r") { //Mise à jour du champ bord if ($info_910[0]) { $no_champ = trouve_champ_perso("bord"); if ($no_champ > 0) { //Recherche si la notice existe déjà par rapport au titre $requete = "SELECT notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND niveau_biblio='s' AND niveau_hierar='1' AND notice_id!={$notice_id}"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $notice_update = mysql_result($resultat, 0, 0); $requete = "UPDATE notices_custom_values SET notices_custom_text='" . addslashes(str_replace("##", "\n", $info_910[0])) . "' WHERE notices_custom_champ={$no_champ} AND notices_custom_origine=" . $notice_update; mysql_query($requete); if (!mysql_affected_rows()) { $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_text) VALUES({$no_champ},{$notice_update},'" . addslashes(str_replace("##", "\n", $info_910[0])) . "')"; mysql_query($requete); } } } } //Suppression de la nouvelle notice $requete = "DELETE FROM notices WHERE notice_id=" . $notice_id; mysql_query($requete); } } } } }
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=¬ice_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; }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_464; global $info_606_a; global $info_900, $info_901, $info_902, $info_903, $info_904, $info_905, $info_906, $info_610; global $pmb_keyword_sep; global $bulletin_ex; //Cas des périodiques if (is_array($info_464)) { $requete = "select * from notices where notice_id={$notice_id}"; $resultat = mysql_query($requete); $r = mysql_fetch_object($resultat); //Notice chapeau existe-t-elle ? $requete = "select notice_id from notices where tit1='" . addslashes($info_464[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = mysql_result($resultat, 0, 0); //Bulletin existe-t-il ? $requete = "select bulletin_id from bulletins where bulletin_numero='" . addslashes($info_464[0]['v']) . "' and mention_date='" . addslashes($info_464[0]['d']) . "' and bulletin_notice={$chapeau_id}"; //$requete="select bulletin_id from bulletins where bulletin_numero='".addslashes($info_464[0]['v'])."' and bulletin_notice=$chapeau_id"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id bulletin $bulletin_id = mysql_result($resultat, 0, 0); } else { //Si non, création bulltin $info = array(); $bulletin = new bulletinage("", $chapeau_id); $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']); $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { $date_date = explode("/", $info_464[0]['d']); if (count($date_date)) { if (count($date_date) == 1) { $info['date_date'] = $date_date[0] . "-01-01"; } if (count($date_date) == 2) { $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01"; } if (count($date_date) == 3) { $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0]; } } else { if ($info_904[0]) { $info['date_date'] = $info_904[0]; } } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } } else { //Si non, création notice chapeau et bulletin $chapeau = new serial(); $info = array(); $info['tit1'] = addslashes($info_464[0]['t']); $info['niveau_biblio'] = 's'; $info['niveau_hierar'] = '1'; $info['typdoc'] = $r->typdoc; $chapeau->update($info); $chapeau_id = $chapeau->serial_id; $bulletin = new bulletinage("", $chapeau_id); $info = array(); $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']); $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { $date_date = explode("/", $info_464[0]['d']); if (count($date_date)) { if (count($date_date) == 1) { $info['date_date'] = $date_date[0] . "-01-01"; } if (count($date_date) == 2) { $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01"; } if (count($date_date) == 3) { $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0]; } } else { if ($info_904[0]) { $info['date_date'] = $info_904[0]; } } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } //Notice objet ? if ($info_464[0]['z'] == 'objet') { //Supression de la notice $requete = "delete from notices where notice_id={$notice_id}"; mysql_query($requete); $bulletin_ex = $bulletin_id; } else { $annee = $info_464[0]['d']; $date_parution = $info['date_date']; //Récupère la date du bulletin (non disponible autrement si il existe déjà) pour l'article $select = "SELECT date_date FROM bulletins WHERE bulletin_id='" . $bulletin_id . "'"; $res_date = mysql_query($select); if ($res_date && mysql_num_rows($res_date)) { $date_parution = mysql_result($res_date, 0, 0); $annee = substr($date_parution, 0, 4); } //Passage de la notice en article $requete = "update notices set niveau_biblio='a', niveau_hierar='2', year='" . addslashes($annee) . "', npages='" . addslashes($info_464[0]['p']) . "', date_parution='" . addslashes($date_parution) . "' where notice_id={$notice_id}"; mysql_query($requete); $requete = "insert into analysis (analysis_bulletin,analysis_notice) values({$bulletin_id},{$notice_id})"; mysql_query($requete); $bulletin_ex = $bulletin_id; } } else { $bulletin_ex = 0; } //Traitement du thésaurus $unknown_desc = array(); $ordre_categ = 0; for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur = trim($info_606_a[$i][$j]); //Recherche du terme //dans le thesaurus par defaut et dans la langue de l'interface $libelle = addslashes($descripteur); $categ_id = categories::searchLibelle($libelle); if ($categ_id) { $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) VALUES({$notice_id},{$categ_id},{$ordre_categ})"; mysql_query($requete); $ordre_categ++; } else { $unknown_desc[] = $descripteur; } } } if (count($info_610)) { for ($i = 0; $i < count($info_610); $i++) { $tmp = explode($pmb_keyword_sep, $info_610[$i]); if (count($tmp)) { foreach ($tmp as $value) { if ($libelle = addslashes(trim($value))) { $categ_id = categories::searchLibelle($libelle); if ($categ_id) { $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) VALUES({$notice_id},{$categ_id},{$ordre_categ})"; mysql_query($requete); $ordre_categ++; } else { $unknown_desc[] = trim($value); } } } } } } if ($unknown_desc) { $mots_cles = implode($pmb_keyword_sep, $unknown_desc); $requete = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes(strip_empty_words($mots_cles)) . " ' where notice_id={$notice_id}"; mysql_query($requete); } //Thème if (count($info_900)) { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=1"; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; for ($i = 0; $i < count($info_900); $i++) { for ($j = 0; $j < count($info_900[$i]); $j++) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_900[$i][$j]) . "' and notices_custom_champ=1"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(1,{$n},'" . addslashes($info_900[$i][$j]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(1,{$notice_id},{$value})"; mysql_query($requete); } } } //Genres if (count($info_901)) { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=2"; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; for ($i = 0; $i < count($info_901); $i++) { for ($j = 0; $j < count($info_901[$i]); $j++) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_901[$i][$j]) . "' and notices_custom_champ=2"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(2,{$n},'" . addslashes($info_901[$i][$j]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(2,{$notice_id},{$value})"; mysql_query($requete); } } } //Discipline if (count($info_902)) { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=3"; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; for ($i = 0; $i < count($info_902); $i++) { for ($j = 0; $j < count($info_902[$i]); $j++) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_902[$i][$j]) . "' and notices_custom_champ=3"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(3,{$n},'" . addslashes($info_902[$i][$j]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(3,{$notice_id},{$value})"; mysql_query($requete); } } } //Type de nature if ($info_905[0]) { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=6"; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[0]) . "' and notices_custom_champ=6"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(6,{$n},'" . addslashes($info_905[0]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(6,{$notice_id},{$value})"; mysql_query($requete); } //Niveau if (count($info_906)) { for ($i = 0; $i < count($info_906); $i++) { for ($j = 0; $j < count($info_906[$i]); $j++) { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=7"; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_906[$i][$j]) . "' and notices_custom_champ=7"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values(7,{$n},'" . addslashes($info_906[$i][$j]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(7,{$notice_id},{$value})"; mysql_query($requete); } } } //Année de péremption if ($info_903[0]) { $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values(4,{$notice_id},'" . addslashes($info_903[0]) . "')"; mysql_query($requete); } //Date de saisie if ($info_904[0]) { $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_date) values(5,{$notice_id},'" . $info_904[0] . "')"; mysql_query($requete); } }
function genere_bulletin($perio_info, $bull_info, $isbull = true) { global $bl, $hl, $notice_id; //on récup et/ou génère le pério $perio_id = genere_perio($perio_info); $search = "select bulletin_id from bulletins where bulletin_numero LIKE '" . addslashes($bull_info['num']) . "' and bulletin_notice = {$perio_id}"; $res = pmb_mysql_query($search); if (pmb_mysql_num_rows($res) == 0) { $bulletin = new bulletinage("", $perio_id); $info = array(); $info['bul_titre'] = ''; $info['bul_no'] = addslashes($bull_info['num']); $bull_id = $bulletin->update($info); } else { $bull_id = pmb_mysql_result($res, 0, 0); //on regarde si une notice n'existe pas déjà pour ce bulletin /*$req = "select num_notice from bulletins where bulletin_id = $bull_id and num_notice != 0"; $res = pmb_mysql_query($req); //si oui on retire l'enregistrement en cours, et on continue sur la notice existante... if(pmb_mysql_num_rows($res)>0) { notice::del_notice($notice_id); $notice_id = pmb_mysql_result($res,0,0); }*/ } return $bull_id; }
function import_new_notice_suite() { global $dbh; global $notice_id, $bulletin_ex; global $info_461, $info_463, $info_464; global $info_606_a; global $info_900, $info_901, $info_902, $info_903, $info_904, $info_905, $info_906; global $pmb_keyword_sep; $bulletin_ex = 0; $is_object = false; //compatibilite avec import memonotices if (is_array($info_464)) { unset($info_461); unset($info_463); $info_461[0]['t'] = $info_464[0]['t']; $info_461[0]['9'] = 'lnk:perio'; $info_463[0]['v'] = $info_464[0]['v']; $info_463[0]['e'] = $info_464[0]['d']; $info_463[0]['9'] = 'lnk:bull'; if (strpos($info_904[0], "/") !== FALSE) { $dc = substr($info_904[0], 6, 4) . '-' . substr($info_904[0], 3, 2) . '-' . substr($info_904[0], 0, 2); $info_904[0] = $dc; } } //Si article if (is_array($info_461) && is_array($info_463)) { //recuperation infos notice $requete = "select * from notices where notice_id={$notice_id}"; $resultat = mysql_query($requete); $r = mysql_fetch_object($resultat); //Notice chapeau existe-t-elle ? $requete = "select notice_id from notices where tit1='" . addslashes($info_461[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = mysql_result($resultat, 0, 0); //Bulletin existe-t-il ? $requete = "select bulletin_id from bulletins where bulletin_numero='" . addslashes($info_463[0]['v']) . "' and mention_date='" . addslashes($info_463[0]['e']) . "' and bulletin_notice={$chapeau_id} "; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id bulletin $bulletin_id = mysql_result($resultat, 0, 0); } else { //Si non, création bulletin $info = array(); $bulletin = new bulletinage("", $chapeau_id); $info['bul_titre'] = "Bulletin " . $info_463[0]['v']; if ($info_463[0]['e']) { $info['bul_titre'] .= " - " . $info_463[0]['e']; } $info['bul_titre'] = addslashes($info['bul_titre']); $info['bul_no'] = addslashes($info_463[0]['v']); $info['bul_date'] = addslashes($info_463[0]['e']); $date_date = explode("/", $info_463[0]['e']); if (count($date_date)) { if (count($date_date) == 1) { $info['date_date'] = $date_date[0] . "-01-01"; } if (count($date_date) == 2) { $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01"; } if (count($date_date) == 3) { $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0]; } } else { if ($info_904[0]) { $info['date_date'] = $info_904[0]; } } $bulletin_id = $bulletin->update($info); } } else { //Si non, création notice chapeau et bulletin $chapeau = new serial(); $info = array(); $info['tit1'] = addslashes($info_461[0]['t']); $info['niveau_biblio'] = 's'; $info['niveau_hierar'] = '1'; $info['typdoc'] = $r->typdoc; $chapeau->update($info); $chapeau_id = $chapeau->serial_id; $bulletin = new bulletinage("", $chapeau_id); $info = array(); $info['bul_titre'] = "Bulletin " . $info_463[0]['v']; if ($info_463[0]['e']) { $info['bul_titre'] .= " - " . $info_463[0]['e']; } $info['bul_titre'] = addslashes($info['bul_titre']); $info['bul_no'] = addslashes($info_463[0]['v']); $info['bul_date'] = addslashes($info_463[0]['e']); $date_date = explode("/", $info_463[0]['e']); if (count($date_date)) { if (count($date_date) == 1) { $info['date_date'] = $date_date[0] . "-01-01"; } if (count($date_date) == 2) { $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01"; } if (count($date_date) == 3) { $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0]; } } else { if ($info_904[0]) { $info['date_date'] = $info_904[0]; } } $bulletin_id = $bulletin->update($info); } $bulletin_ex = $bulletin_id; if ($r->tit1 == '_OBJECT_BULLETIN_' || is_array($info_464) && $info_464[0]['z'] == 'objet') { //$info_464[0]['z']=='objet' >> Compatibilite import memonotices $is_object = true; //notice de bulletin a supprimer notice::del_notice($notice_id); } else { //Passage de la notice en article $np = ''; if (is_array($info_464) && $info_464[0]['p'] != '') { $np = ", npages='" . addslashes($info_464[0]['p']) . "' "; } $requete = "update notices set niveau_biblio='a', niveau_hierar='2', year='" . addslashes($info_463[0]['e']) . "'" . $np . ", date_parution='" . $info['date_date'] . "' where notice_id={$notice_id}"; mysql_query($requete); $requete = "insert into analysis (analysis_bulletin,analysis_notice) values({$bulletin_id},{$notice_id})"; mysql_query($requete); } } if (!$is_object) { //Traitement du thésaurus $unknown_desc = array(); $ordre_categ = 0; for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur = $info_606_a[$i][$j]; //Recherche du terme //dans le thesaurus par defaut et dans la langue de l'interface $libelle = addslashes($descripteur); $categ_id = categories::searchLibelle($libelle); if ($categ_id) { $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) values({$notice_id},{$categ_id},{$ordre_categ})"; mysql_query($requete, $dbh); $ordre_categ++; } else { $unknown_desc[] = $descripteur; } } } if ($unknown_desc) { $mots_cles = implode($pmb_keyword_sep, $unknown_desc); $il = ''; $qil = "select index_l from notices where notice_id={$notice_id} "; $ril = mysql_query($qil, $dbh); $il = trim(mysql_result($ril, 0, 0)); if ($il) { $mots_cles = $il . $pmb_keyword_sep . $mots_cles; } $requete = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes(strip_empty_words($mots_cles)) . " ' where notice_id={$notice_id}"; mysql_query($requete, $dbh); } $notes = ''; //Thème $qn = "select idchamp from notices_custom where name='theme' "; $rn = mysql_query($qn, $dbh); if (mysql_num_rows($rn)) { $idc_theme = mysql_result($rn, 0, 0); } if (count($info_900) && $idc_theme) { for ($i = 0; $i < count($info_900); $i++) { for ($j = 0; $j < count($info_900[$i]); $j++) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_900[$i][$j]) . "' and notices_custom_champ={$idc_theme} "; $resultat = mysql_query($requete, $dbh); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_theme},{$notice_id},{$value})"; mysql_query($requete, $dbh); } else { //sinon dans notes $notes .= 'thème : ' . $info_900[$i][$j]; } } } } //Genres $qn = "select idchamp from notices_custom where name='genre' "; $rn = mysql_query($qn, $dbh); if (mysql_num_rows($rn)) { $idc_genre = mysql_result($rn, 0, 0); } if (count($info_901) && $idc_genre) { for ($i = 0; $i < count($info_901); $i++) { for ($j = 0; $j < count($info_901[$i]); $j++) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_901[$i][$j]) . "' and notices_custom_champ={$idc_genre} "; $resultat = mysql_query($requete, $dbh); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_genre},{$notice_id},{$value})"; mysql_query($requete, $dbh); } else { //sinon dans notes if ($notes) { $notes .= "\n"; } $notes .= 'genre : ' . $info_901[$i][$j]; } } } } //Discipline $qn = "select idchamp from notices_custom where name='discipline' "; $rn = mysql_query($qn, $dbh); if (mysql_num_rows($rn)) { $idc_discipline = mysql_result($rn, 0, 0); } if (count($info_902) && $idc_discipline) { for ($i = 0; $i < count($info_902); $i++) { for ($j = 0; $j < count($info_902[$i]); $j++) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_902[$i][$j]) . "' and notices_custom_champ={$idc_discipline} "; $resultat = mysql_query($requete, $dbh); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_discipline},{$notice_id},{$value})"; mysql_query($requete, $dbh); } else { //sinon dans notes if ($notes) { $notes .= "\n"; } $notes .= 'discipline : ' . $info_902[$i][$j]; } } } } //Type de nature $qn = "select idchamp from notices_custom where name='type_nature' "; $rn = mysql_query($qn, $dbh); if (mysql_num_rows($rn)) { $idc_type_nature = mysql_result($rn, 0, 0); } $qn = "select idchamp from notices_custom where name='pays' "; $rn = mysql_query($qn, $dbh); if (mysql_num_rows($rn)) { $idc_pays = mysql_result($rn, 0, 0); } $qn = "select idchamp from notices_custom where name='periode' "; $rn = mysql_query($qn, $dbh); if (mysql_num_rows($rn)) { $idc_periode = mysql_result($rn, 0, 0); } if (count($info_905)) { for ($i = 0; $i < count($info_905); $i++) { for ($j = 0; $j < count($info_905[$i]); $j++) { //essai dans type de nature $done = FALSE; if ($idc_type_nature) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[$i][$j]) . "' and notices_custom_champ={$idc_type_nature} "; $resultat = mysql_query($requete, $dbh); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_type_nature},{$notice_id},{$value})"; mysql_query($requete, $dbh); $done = TRUE; } } //essai dans genre if (!$done && $idc_genre) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[$i][$j]) . "' and notices_custom_champ={$idc_genre} "; $resultat = mysql_query($requete, $dbh); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_genre},{$notice_id},{$value})"; mysql_query($requete, $dbh); $done = TRUE; } } //essai dans theme if (!$done && $idc_theme) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[$i][$j]) . "' and notices_custom_champ={$idc_theme} "; $resultat = mysql_query($requete, $dbh); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_theme},{$notice_id},{$value})"; mysql_query($requete, $dbh); $done = TRUE; } } //essai dans discipline if (!$done && $idc_discipline) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_905[$i][$j]) . "' and notices_custom_champ={$idc_discipline} "; $resultat = mysql_query($requete, $dbh); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_discipline},{$notice_id},{$value})"; mysql_query($requete, $dbh); $done = TRUE; } } //essai dans pays if (!$done) { $done_pa = FALSE; if (!$done && $idc_pays) { $i_pays = strip_empty_chars($info_905[$i][$j]); $requete = "select notices_custom_list_value,notices_custom_list_lib from notices_custom_lists where notices_custom_champ={$idc_pays} "; $resultat = mysql_query($requete, $dbh); if (mysql_num_rows($resultat)) { while ($row = mysql_fetch_object($resultat)) { $r_pays = strip_empty_chars($row->notices_custom_list_lib); if (strpos($i_pays, $r_pays) !== FALSE) { $value = $row->notices_custom_list_value; $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_pays},{$notice_id},{$value})"; mysql_query($requete, $dbh); $done_pa = TRUE; break; } } } } //essai dans periode $done_pe = FALSE; if (!$done && $idc_periode) { $i_periode = strip_empty_chars($info_905[$i][$j]); $requete = "select notices_custom_list_value,notices_custom_list_lib from notices_custom_lists where notices_custom_champ={$idc_periode} "; $resultat = mysql_query($requete, $dbh); if (mysql_num_rows($resultat)) { while ($row = mysql_fetch_object($resultat)) { $r_periode = strip_empty_chars($row->notices_custom_list_lib); if (strpos($i_periode, $r_periode) !== FALSE) { $value = $row->notices_custom_list_value; $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_periode},{$notice_id},{$value})"; mysql_query($requete, $dbh); $done_pe = TRUE; break; } } } } if ($done_pa && $done_pe) { $done = TRUE; } } //sinon dans notes if (!$done) { if ($notes) { $notes .= "\n"; } $notes .= 'type de nature : ' . $info_905[$i][$j]; } } } } //Niveau if (count($info_906)) { $qn = "select idchamp from notices_custom where name='niveau' "; $rn = mysql_query($qn, $dbh); if (mysql_num_rows($rn)) { $idc_niveau = mysql_result($rn, 0, 0); for ($i = 0; $i < count($info_906); $i++) { for ($j = 0; $j < count($info_906[$i]); $j++) { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_906[$i][$j]) . "' and notices_custom_champ={$idc_niveau} "; $resultat = mysql_query($requete, $dbh); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$idc_niveau},{$notice_id},{$value})"; mysql_query($requete, $dbh); } else { //sinon dans notes if ($notes) { $notes .= "\n"; } $notes .= 'niveau : ' . $info_906[$i][$j]; } } } } } //notes if ($notes) { $notes .= "\n"; $notes = addslashes($notes); $q = "update notices set n_contenu=concat('" . $notes . "',n_contenu) where notice_id='" . $notice_id . "' "; mysql_query($q, $dbh); } //Année de péremption if ($info_903[0]) { $qn = "select idchamp from notices_custom where name='annee_peremption' "; $rn = mysql_query($qn, $dbh); if (mysql_num_rows($rn)) { $idc_ap = mysql_result($rn, 0, 0); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$idc_ap},{$notice_id},'" . addslashes($info_903[0]) . "')"; mysql_query($requete, $dbh); } } //Date de saisie if ($info_904[0]) { $qn = "select idchamp from notices_custom where name='date_creation' "; $rn = mysql_query($qn, $dbh); if (mysql_num_rows($rn)) { $idc_ds = mysql_result($rn, 0, 0); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_date) values({$idc_ds},{$notice_id},'" . $info_904[0] . "')"; mysql_query($requete, $dbh); } } } }
function import_new_notice_suite() { global $dbh; global $notice_id; global $bibliographic_level_origine; global $hierarchic_level_origine; global $index_sujets; global $pmb_keyword_sep; global $info_600_a, $info_600_j, $info_600_x, $info_600_y, $info_600_z; global $info_601_a, $info_601_j, $info_601_x, $info_601_y, $info_601_z; global $info_602_a, $info_602_j, $info_602_x, $info_602_y, $info_602_z; global $info_605_a, $info_605_j, $info_605_x, $info_605_y, $info_605_z; global $info_606_a, $info_606_j, $info_606_x, $info_606_y, $info_606_z; global $info_607_a, $info_607_j, $info_607_x, $info_607_y, $info_607_z; global $issn_011; global $tit_200a; // pour reconstruire et chercher la notice chapeau du pério $tit[0]['a'] = implode(" ; ", $tit_200a); if (is_array($index_sujets)) { $mots_cles = implode(" {$pmb_keyword_sep} ", $index_sujets); } else { $mots_cles = $index_sujets; } for ($a = 0; $a < sizeof($info_600_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_a[$a][0]; for ($j = 0; $j < sizeof($info_600_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_j[$a][$j]; } for ($j = 0; $j < sizeof($info_600_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_x[$a][$j]; } for ($j = 0; $j < sizeof($info_600_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_y[$a][$j]; } for ($j = 0; $j < sizeof($info_600_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_601_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_a[$a][0]; for ($j = 0; $j < sizeof($info_601_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_j[$a][$j]; } for ($j = 0; $j < sizeof($info_601_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_x[$a][$j]; } for ($j = 0; $j < sizeof($info_601_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_y[$a][$j]; } for ($j = 0; $j < sizeof($info_601_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_602_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_a[$a][0]; for ($j = 0; $j < sizeof($info_602_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_j[$a][$j]; } for ($j = 0; $j < sizeof($info_602_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_x[$a][$j]; } for ($j = 0; $j < sizeof($info_602_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_y[$a][$j]; } for ($j = 0; $j < sizeof($info_602_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_605_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_a[$a][0]; for ($j = 0; $j < sizeof($info_605_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_j[$a][$j]; } for ($j = 0; $j < sizeof($info_605_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_x[$a][$j]; } for ($j = 0; $j < sizeof($info_605_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_y[$a][$j]; } for ($j = 0; $j < sizeof($info_605_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_606_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_a[$a][0]; for ($j = 0; $j < sizeof($info_606_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_j[$a][$j]; } for ($j = 0; $j < sizeof($info_606_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_x[$a][$j]; } for ($j = 0; $j < sizeof($info_606_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_y[$a][$j]; } for ($j = 0; $j < sizeof($info_606_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_607_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_a[$a][0]; for ($j = 0; $j < sizeof($info_607_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_j[$a][$j]; } for ($j = 0; $j < sizeof($info_607_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_x[$a][$j]; } for ($j = 0; $j < sizeof($info_607_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_y[$a][$j]; } for ($j = 0; $j < sizeof($info_607_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_z[$a][$j]; } } $mots_cles ? $index_matieres = strip_empty_words($mots_cles) : ($index_matieres = ''); $rqt_maj = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes($index_matieres) . " ' where notice_id='{$notice_id}' "; $res_ajout = mysql_query($rqt_maj, $dbh); global $bulletin_ex, $info_207; //Cas des périodiques if ($bibliographic_level_origine == 's') { // c'est une notice de pério, elle a été insérée en monographie //Notice chapeau existe-t-elle déjà ? $requete = "select notice_id from notices where tit1='" . addslashes(clean_string($tit[0]['a'])) . "' and niveau_hierar='1' and niveau_biblio='s'"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id et destruction de la dite notice $chapeau_id = mysql_result($resultat, 0, 0); $requete = "delete from notices where notice_id='{$notice_id}' "; $resultat = mysql_query($requete); $requete = "delete from responsability where responsability_notice='{$notice_id}' "; $resultat = mysql_query($requete); $notice_id = $chapeau_id; //Bulletin existe-t-il ? if ($info_207[0]) { $num_bull = $info_207[0]; } else { $num_bull = $tit[0]['a']; } $requete = "select bulletin_id from bulletins where bulletin_numero='" . addslashes($num_bull) . "' and bulletin_notice={$chapeau_id}"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id bulletin $bulletin_ex = mysql_result($resultat, 0, 0); } else { //Si non, création bulltin $info = array(); $bulletin = new bulletinage("", $chapeau_id); $info['bul_titre'] = addslashes("Bulletin N° " . $num_bull); $info['bul_no'] = addslashes($num_bull); $info['bul_date'] = addslashes($num_bull); $bulletin_ex = $bulletin->update($info); } } else { //Si non, update notice chapeau et création bulletin $requete = "update notices set niveau_biblio='s', niveau_hierar='1' where notice_id='{$notice_id}' "; $resultat = mysql_query($requete); $info = array(); $bulletin = new bulletinage("", $notice_id); $info['bul_titre'] = addslashes("Bulletin N° " . $num_bull); $info['bul_no'] = addslashes($num_bull); $info['bul_date'] = addslashes($num_bull); $bulletin_ex = $bulletin->update($info); } } else { $bulletin_ex = 0; } }
if (!($bul_id = sql_value("SELECT bulletin_id FROM bulletins where bulletin_numero='{$bul_no}' and date_date='" . $value['date_date'] . "' and bulletin_notice='{$serial_id}'"))) { //création de notice de bulletin si case à cocher if ($create_notice_bul) { $value['create_notice_bul'] = true; $value['tit1'] = $value["bul_no"] . ($value["bul_date"] ? " - " . $value["bul_date"] : "") . ($bul_titre ? " - " . $bul_titre : ""); $value['typdoc'] = $xmlta_doctype_bulletin; $value['statut'] = $deflt_notice_statut; if ($value['date_date'] == '0000-00-00' || !isset($value['bul_date'])) { $value['year'] = ""; } else { $value['year'] = substr($value['date_date'], 0, 4); } $value['date_parution'] = $value['date_date']; } //Création du bulletin si pas déjà présent $bul_id = $myBulletinage->update($value); } } if (!$abt_numeric) { // c'est un abonnement qui n'est pas exclusivement numérique. On crée l'exemplaire de bulletin $expl_cote = clean_string($expl_cote); $expl_note = clean_string($expl_note); $expl_comment = clean_string($expl_comment); $expl_prix = clean_string($expl_prix); $formlocid = "f_ex_section" . $expl_location; $expl_section = ${$formlocid}; // si le code-barre saisi est vide, on affiche une erreur if (trim($f_ex_cb) == "") { print "<script>alert('" . addslashes($msg['pointage_message_code_vide']) . "'); history.go(-1);</script>"; exit; }
$nberrors = $p_perso->check_submited_fields(); $table['force_empty'] = $p_perso->presence_exclusion_fields(); if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) { $table['force_empty'] = "f_img_load"; } //Pour la synchro rdf if ($pmb_synchro_rdf) { require_once $class_path . "/synchro_rdf.class.php"; $synchro_rdf = new synchro_rdf(); if ($bul_id) { $synchro_rdf->delRdf(0, $bul_id); } } if (!$nberrors) { $myBulletinage = new bulletinage($bul_id, $serial_id); $result = $myBulletinage->update($table); } else { error_message_history($msg["notice_champs_perso"], $p_perso->error_message, 1); exit; } // vignette de la notice uploadé dans un répertoire if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id && $myBulletinage->bull_num_notice) { $poids_fichier_max = 1024 * 1024; //Limite la taille de l'image à 1 Mo $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'"; $res = mysql_query($req, $dbh); if (mysql_num_rows($res)) { $rep = mysql_fetch_object($res); $filename_output = $rep->repertoire_path . "img_" . $myBulletinage->bull_num_notice; } if (($fp = @fopen($_FILES['f_img_load']['tmp_name'], "rb")) && $filename_output) {
} elseif ($f_notice_is_new) { // Changement du flag et affecté comme new $req_notice_date_is_new = ", notice_date_is_new =now() "; } else { // raz date $req_notice_date_is_new = ", notice_date_is_new ='' "; } } } } else { if ($f_notice_is_new) { // flag affecté comme new en création $req_notice_date_is_new = ", notice_date_is_new =now(), notice_is_new=" . ($f_notice_is_new + 0); } } $result = $myBulletinage->update($table, false, $req_notice_date_is_new); } else { error_message_history($msg["notice_champs_perso"], $p_perso->error_message, 1); exit; } // autorité personnalisées if ($myBulletinage->bull_num_notice) { $authperso = new authperso_notice($myBulletinage->bull_num_notice); $authperso->save_form(); } // vignette de la notice uploadé dans un répertoire if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id && $myBulletinage->bull_num_notice) { $poids_fichier_max = 1024 * 1024; //Limite la taille de l'image à 1 Mo $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'"; $res = pmb_mysql_query($req, $dbh);
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; }