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 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, $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 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, $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 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 genere_perio($perio_info) { $search = "select notice_id from notices where tit1 LIKE '" . addslashes($perio_info['titre']) . "' and niveau_biblio = 's' and niveau_hierar = '1'"; $res = pmb_mysql_query($search); if (pmb_mysql_num_rows($res) == 0) { //il existe pas, faut le créer $chapeau = new serial(); $info = array(); $info['tit1'] = addslashes($perio_info['titre']); $info['niveau_biblio'] = 's'; $info['niveau_hierar'] = '1'; $info['typdoc'] = 'p'; $chapeau->update($info); $perio_id = $chapeau->serial_id; } else { $perio_id = pmb_mysql_result($res, 0, 0); } return $perio_id; }
$val = 0x10; } $table['opac_visible_bulletinage'] = $opac_visible_bulletinage | $val; $p_perso = new parametres_perso("notices"); $nberrors = $p_perso->check_submited_fields(); if (!$nberrors) { //Pour la synchro rdf if ($pmb_synchro_rdf) { require_once $class_path . "/synchro_rdf.class.php"; $synchro_rdf = new synchro_rdf(); if ($serial_id) { $synchro_rdf->delRdf($serial_id, 0); } } $serial = new serial($serial_id); $update_result = $serial->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) { $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_" . $update_result; } if (($fp = @fopen($_FILES['f_img_load']['tmp_name'], "rb")) && $filename_output) {
} } $table['notice_is_new'] = $f_notice_is_new + 0; $p_perso = new parametres_perso("notices"); $nberrors = $p_perso->check_submited_fields(); if (!$nberrors) { //Pour la synchro rdf if ($pmb_synchro_rdf) { require_once $class_path . "/synchro_rdf.class.php"; $synchro_rdf = new synchro_rdf(); if ($serial_id) { $synchro_rdf->delRdf($serial_id, 0); } } $serial = new serial($serial_id); $update_result = $serial->update($table, $req_notice_date_is_new); } else { error_message_history($msg["notice_champs_perso"], $p_perso->error_message, 1); exit; } // autorité personnalisées $authperso = new authperso_notice($serial_id); $authperso->save_form(); // vignette de la notice uploadé dans un répertoire if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) { $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); if (pmb_mysql_num_rows($res)) { $rep = pmb_mysql_fetch_object($res);
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; }
$synchro_rdf->delRdf($analysis_id, 0); } } //Traitement des périos et bulletins global $perio_type, $bull_type; global $f_perio_new, $f_perio_new_issn; global $f_bull_new_num, $f_bull_new_date, $f_bull_new_mention, $f_bull_new_titre; //Perios if ($perio_type == 'insert_new' && !$serial_id) { $new_serial = new serial(); $values = array(); $values['tit1'] = $f_perio_new; $values['code'] = $f_perio_new_issn; $values['niveau_biblio'] = "s"; $values['niveau_hierar'] = "1"; $serial_id = $new_serial->update($values); if ($pmb_synchro_rdf) { $synchro_rdf->addRdf($serial_id, 0); } } //Bulletin if ($bull_type == 'insert_new' && !$bul_id) { $req = "insert into bulletins set bulletin_numero='" . $f_bull_new_num . "',\n\t\t\t mention_date='" . $f_bull_new_mention . "',\n\t\t\t date_date='" . $f_bull_new_date . "',\n\t\t\t bulletin_titre='" . $f_bull_new_titre . "',\n\t\t\t bulletin_notice='" . $serial_id . "'"; pmb_mysql_query($req, $dbh); $bul_id = pmb_mysql_insert_id(); if ($pmb_synchro_rdf) { $synchro_rdf->addRdf(0, $bul_id); } } $table['serial_id'] = $serial_id; $table['bul_id'] = $bul_id;