function import_new_notice_suite() { global $dbh; global $notice_id; global $info_606_a; global $info_900; $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})"; pmb_mysql_query($requete, $dbh); $ordre_categ++; } } } for ($i = 0; $i < count($info_900); $i++) { $req = " select idchamp, type, datatype from notices_custom where name='" . $info_900[$i]['n'] . "'"; $res = pmb_mysql_query($req, $dbh); if (pmb_mysql_num_rows($res)) { $perso = pmb_mysql_fetch_object($res); if ($perso->idchamp) { if ($perso->type == 'list') { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_900[$i]['a']) . "' and notices_custom_champ={$perso->idchamp}"; $resultat = pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat)) { $value = pmb_mysql_result($resultat, 0, 0); } else { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ={$perso->idchamp}"; $resultat = pmb_mysql_query($requete); $max = @pmb_mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values({$perso->idchamp},{$n},'" . addslashes($info_900[$i]['a']) . "')"; pmb_mysql_query($requete); $value = $n; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_" . $perso->datatype . ") values({$perso->idchamp},{$notice_id},'" . $value . "')"; pmb_mysql_query($requete); } else { $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_" . $perso->datatype . ") values({$perso->idchamp},{$notice_id},'" . addslashes($info_900[$i]['a']) . "')"; pmb_mysql_query($requete); } } } } }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_606; $ordre_categ = 0; foreach ($info_606 as $categorie) { $libelle = $categorie["a"]; $lang = $categorie["z"]; // Recherche du terme // dans le thesaurus par defaut et dans la langue de l'interface $libelle = addslashes($libelle); $categ_id = categories::searchLibelle($libelle, 0, $lang); if ($categ_id) { $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) values({$notice_id},{$categ_id},{$ordre_categ})"; pmb_mysql_query($requete, $dbh); $ordre_categ++; } } }
function create_categ($tab_categ, $id_thes, $id_parent, $create_node = true) { global $lang; if (trim($tab_categ)) { $resultat = categories::searchLibelle(addslashes($tab_categ), $id_thes, $lang, $id_parent); if (!$resultat && $id_parent && $create_node) { // création de la catégorie $n = new noeuds(); $n->num_parent = $id_parent; $n->num_thesaurus = $id_thes; $n->save(); $resultat = $id_n = $n->id_noeud; $c = new categories($id_n, $lang); $c->libelle_categorie = $tab_categ; $c->save(); } return $resultat; } return 0; }
function traite_categories_from_form() { global $rameau, $categ_pas_trouvee; global $dbh; global $thes; $tableau_606 = unserialize(stripslashes($rameau)); $info_606_a = $tableau_606["info_606_a"]; $info_606_j = $tableau_606["info_606_j"]; $info_606_x = $tableau_606["info_606_x"]; $info_606_y = $tableau_606["info_606_y"]; $info_606_z = $tableau_606["info_606_z"]; $categ_pas_trouvee = array(); for ($a = 0; $a < sizeof($info_606_a); $a++) { $libelle_final = trim($info_606_a[$a][0]); if (!$libelle_final) { break; } $res_a = categories::searchLibelle(addslashes($libelle_final), $thes->id_thesaurus, 'fr_FR', ''); if ($res_a) { $categ_retour[]['categ_id'] = $res_a; } else { $categ_pas_trouvee[] = $libelle_final; } // récup des sous-categ $j for ($j = 0; $j < sizeof($info_606_j[$a]); $j++) { $res_j = categories::searchLibelle(addslashes(trim($info_606_j[$a][$j])), $thes->id_thesaurus, 'fr_FR', ''); if ($res_j) { $categ_retour[]['categ_id'] = $res_j; } else { $categ_pas_trouvee[] = trim($info_606_j[$a][$j]); } } // récup des sous-categ $x for ($x = 0; $x < sizeof($info_606_x[$a]); $x++) { $res_x = categories::searchLibelle(addslashes(trim($info_606_x[$a][$x])), $thes->id_thesaurus, 'fr_FR', ''); if ($res_x) { $categ_retour[]['categ_id'] = $res_x; } else { $categ_pas_trouvee[] = trim($info_606_x[$a][$x]); } } for ($y = 0; $y < sizeof($info_606_y[$a]); $y++) { $res_y = categories::searchLibelle(addslashes(trim($info_606_y[$a][$y])), $thes->id_thesaurus, 'fr_FR', ''); if ($res_y) { $categ_retour[]['categ_id'] = $res_y; } else { $categ_pas_trouvee[] = trim($info_606_y[$a][$y]); } } for ($z = 0; $z < sizeof($info_606_z[$a]); $z++) { $res_z = categories::searchLibelle(addslashes(trim($info_606_z[$a][$z])), $thes->id_thesaurus, 'fr_FR', ''); if ($res_z) { $categ_retour[]['categ_id'] = $res_z; } else { $categ_pas_trouvee[] = trim($info_606_z[$a][$z]); } } } // DEBUG echo "<pre>"; print_r($categ_retour) ; echo "</pre>"; exit ; return $categ_retour; }
function find_categ($term, $id_thesaurus, $lang) { $categ_id = categories::searchLibelle(addslashes($term), $id_thesaurus, $lang); if ($categ_id) { //le terme existe $noeud = new noeuds($categ_id); if ($noeud->num_renvoi_voir) { $categ_to_index = $noeud->num_renvoi_voir; } else { $categ_to_index = $categ_id; } } else { $categ_to_index = 0; } return $categ_to_index; }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_606_a, $info_606_j, $info_606_x, $info_606_y, $info_606_z; global $id_rech_theme; global $thesaurus_defaut; global $thes; /* echo "<pre>"; print_r ($info_949); print_r ($info_997); echo "</pre>"; */ // les champs $606 sont stockés dans les catégories // $a >> en sous catégories de $id_rech_theme // $j en complément de $a // $x en sous catégories de $a // $y >> en sous catégories de $id_rech_geo // $z >> en sous catégories de $id_rech_chrono // TRAITEMENT : // pour $a=0 à size_of $info_606_a // pour $j=0 à size_of $info_606_j[$a] // concaténer $libelle_j .= $info_606_j[$a][$j] // $libelle_final = $info_606_a[0]." ** ".$libelle_j // Rechercher si l'enregistrement existe déjà dans categories = // $categid = categories::searchLibelle(addslashes($libelle_final), $thesaurus_defaut, 'fr_FR', $id_rech_theme) // Créer si besoin et récupérer l'id $categid_a // $categid_parent = $categid_a // pour $x=0 à size_of $info_606_x[$a] // Rechercher si l'enregistrement existe déjà dans categories = // $categid = categories::searchLibelle(addslashes($info_606_x[$a][$x]), $thesaurus_defaut, 'fr_FR', $categ_parent) // Créer si besoin et récupérer l'id $categid_parent // // $categid_parent = $id_rech_geo // pour $y=0 à size_of $info_606_y[$a] // Rechercher si l'enregistrement existe déjà dans categories = // $categid = categories::searchLibelle(addslashes($info_606_y[$a][$y]), $thesaurus_defaut, 'fr_FR', $categ_parent) // Créer si besoin et récupérer l'id $categid_parent // // $categid_parent = $id_rech_chrono // pour $y=0 à size_of $info_606_z[$a] // Rechercher si l'enregistrement existe déjà dans categories = // $categid = categories::searchLibelle(addslashes($info_606_z[$a][$y]]), $thesaurus_defaut, 'fr_FR', $categ_parent) // Créer si besoin et récupérer l'id $categid_parent // $libelle_j = ""; for ($a = 0; $a < sizeof($info_606_a); $a++) { for ($j = 0; $j < sizeof($info_606_j[$a]); $j++) { if (!$libelle_j) { $libelle_j .= trim($info_606_j[$a][$j]); } else { $libelle_j .= " ** " . trim($info_606_j[$a][$j]); } } if (!$libelle_j) { $libelle_final = trim($info_606_a[$a][0]); } else { $libelle_final = trim($info_606_a[$a][0]) . " ** " . $libelle_j; } if (!$libelle_final) { break; } $res_a = categories::searchLibelle(addslashes($libelle_final), $thesaurus_defaut, 'fr_FR', $id_rech_theme); if ($res_a) { $categid_a = $res_a; } else { $categid_a = create_categ($id_rech_theme, $libelle_final, strip_empty_words($libelle_final, 'fr_FR')); } // récup des sous-categ en cascade sous $a $categ_parent = $categid_a; for ($x = 0; $x < sizeof($info_606_x[$a]); $x++) { $res_x = categories::searchLibelle(addslashes(trim($info_606_x[$a][$x])), $thesaurus_defaut, 'fr_FR', $categ_parent); if ($res_x) { $categ_parent = $res_x; } else { $categ_parent = create_categ($categ_parent, trim($info_606_x[$a][$x]), strip_empty_words($info_606_x[$a][$x], 'fr_FR')); } } // fin récup des $x en cascade sous l'id de la catégorie 606$a if ($categ_parent != $id_rech_theme) { // insertion dans la table notices_categories $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $categ_parent . "' "; $res_ajout = @mysql_query($rqt_ajout, $dbh); } // récup TOUT EN CASCADE $id_rech_geo = $categ_parent; // récup des categ géo à loger sous la categ géo principale $categ_parent = $id_rech_geo; for ($y = 0; $y < sizeof($info_606_y[$a]); $y++) { $res_y = categories::searchLibelle(addslashes(trim($info_606_y[$a][$y])), $thesaurus_defaut, 'fr_FR', $categ_parent); if ($res_y) { $categ_parent = $res_y; } else { $categ_parent = create_categ($categ_parent, trim($info_606_y[$a][$y]), strip_empty_words($info_606_y[$a][$y], 'fr_FR')); } } // fin récup des $y en cascade sous l'id de la catégorie principale thème géo if ($categ_parent != $id_rech_geo) { // insertion dans la table notices_categories $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $categ_parent . "' "; $res_ajout = @mysql_query($rqt_ajout, $dbh); } // récup TOUT EN CASCADE $id_rech_chrono = $categ_parent; // récup des categ chrono à loger sous la categ chrono principale $categ_parent = $id_rech_chrono; for ($z = 0; $z < sizeof($info_606_z[$a]); $z++) { $res_z = categories::searchLibelle(addslashes(trim($info_606_z[$a][$z])), $thesaurus_defaut, 'fr_FR', $categ_parent); if ($res_z) { $categ_parent = $res_z; } else { $categ_parent = create_categ($categ_parent, trim($info_606_z[$a][$z]), strip_empty_words($info_606_z[$a][$z], 'fr_FR')); } } // fin récup des $z en cascade sous l'id de la catégorie principale thème chrono if ($categ_parent != $id_rech_chrono) { // insertion dans la table notices_categories $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $categ_parent . "' "; $res_ajout = @mysql_query($rqt_ajout, $dbh); } } }
function import_new_notice_suite() { global $dbh; global $notice_id; global $index_sujets; global $pmb_keyword_sep; global $id_notices_custom_opsys, $id_notices_custom_type_opsys; global $info_001, $info_464, $info_464_a, $info_464_e, $info_464_f, $info_461_3, $info_461_t, $info_200_a, $info_200_e, $info_210_d, $info_902_a, $info_686_a, $info_462_3, $info_462_t; global $num_thesaurus, $thes; global $info_675_a; global $info_600_a, $info_600_b, $info_600_j, $info_600_x, $info_600_y, $info_600_z; global $info_601_a, $info_601_b, $info_601_j, $info_601_x, $info_601_y, $info_601_z; global $info_602_a, $info_602_b, $info_602_j, $info_602_x, $info_602_y, $info_602_z; global $info_605_a, $info_605_b, $info_605_j, $info_605_x, $info_605_y, $info_605_z; global $info_606_a, $info_606_b, $info_606_j, $info_606_x, $info_606_y, $info_606_z; global $info_607_a, $info_607_b, $info_607_j, $info_607_x, $info_607_y, $info_607_z; global $info_610_a, $info_610_e, $info_610_b, $info_610_j, $info_610_x, $info_610_y, $info_610_z, $info_610_3, $info_610; global $bulletin_id; global $flag_titre_serie_recuperation; global $flag_depouillements_464, $flag_depouillements_464_doc_sonore, $flag_depouillements_464_doc_imprime; global $aut_700, $aut_701, $aut_702, $aut_710, $aut_711, $aut_712; global $accomp_345_c; global $table_responsability_function; global $lang, $include_path, $xml_changement; global $info_345_d; global $info_071_a, $info_071_b; global $thes_centre_interet, $num_thesaurus_centre_interet, $info_901; global $flag_import_610_in_mot_cles, $thes_610, $num_thesaurus_610; global $collection_225, $sous_coll; // prix dvd et video if ($info_345_d[0]) { $requete = "update notices set prix='" . addslashes($info_345_d[0]) . "' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } // EAN if ($info_071_a[0]) { $requete = "update notices set code='" . addslashes($info_071_a[0]) . "' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } // Producteur -> Editeur if ($info_071_b[0]) { $nom = $info_071_b[0]; $requete = "select ed_id from publishers where ed_name='" . addslashes($nom) . "' "; $result = pmb_mysql_query($requete); if ($row = pmb_mysql_fetch_row($result)) { $ed_id = $row[0]; } else { $requete = "insert into publishers SET ed_name='{$nom}', "; $requete .= "index_publisher=' " . strip_empty_words($nom) . " '"; pmb_mysql_query($requete); $ed_id = pmb_mysql_insert_id(); } $requete = "update notices set ed1_id='" . $ed_id . "' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } // 345_c Matériel d'accompagnement if ($accomp_345_c[0]) { $requete = "update notices set accomp='" . addslashes($accomp_345_c[0]) . "' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } update_authors_num_opsys($aut_700, 0); update_authors_num_opsys($aut_701, 1); update_authors_num_opsys($aut_702, 2); update_authors_num_opsys($aut_710, 2); update_authors_num_opsys($aut_711, 2); update_authors_num_opsys($aut_712, 2); if ($xml_changement) { xml_save_table("{$include_path}/marc_tables/{$lang}/function_subst.xml", $table_responsability_function); } //UDC if ($info_675_a[0]) { $indexint_id = indexint::import(clean_string($info_675_a[0])); $requete = "update notices set indexint='{$indexint_id}' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } if ($aut_700[0][a] != "") { if ($aut_700[0][3] != "") { $requete = "select author_id from authors where author_name='" . addslashes($aut_700[0][a]) . "' and author_rejete='" . addslashes($aut_700[0][b]) . "' "; $result = pmb_mysql_query($requete); if ($row = pmb_mysql_fetch_row($result)) { $author_id = $row[0]; $requete = "update authors set author_comment='" . addslashes($aut_700[0][3]) . "' where author_id='{$author_id}' "; pmb_mysql_query($requete); } } } if ($sous_coll == '1' && $collection_225[0]['a'] != "" && $collection_225[1]['a'] != "") { $q = "select coll_id from notices where notice_id='{$notice_id}' "; $r = pmb_mysql_query($q, $dbh); $coll_id = pmb_mysql_result($r, 0, 0); if ($coll_id != '0') { /* sous collection */ $subcollec['name'] = clean_string($collection_225[1]['a']); $subcollec['coll_parent'] = $coll_id; $subcoll_id = subcollection::import($subcollec); $requete = "update notices set subcoll_id='{$subcoll_id}' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } } $bulletin_id = 0; // Effacement de la notice temporaire eventuelle list($num_opsys, $type_opsys) = explode(" ", $info_001[0]); if ($type_opsys == 'UMO:13') { $requete = "update notices set niveau_biblio='b', niveau_hierar='2' where notice_id='{$notice_id}' "; //print "$requete <br />"; pmb_mysql_query($requete); } if ($type_opsys == 'UMO:23' || $type_opsys == 'UMO:3') { // Titre de périodique $requete = "select * from notices_custom_values where notices_custom_small_text='" . $num_opsys . "'"; //print "new $type_opsys: $requete <br />"; $resultat = pmb_mysql_query($requete); //Notice existe-t-elle comme notice temporaire? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id notice temporaire a supprimer $old_n = pmb_mysql_fetch_object($resultat); $notice_id_old = $old_n->notices_custom_origine; // modifie les anciennes relations sur la vrai notice $requete = "update notices_relations set linked_notice='{$notice_id}' where linked_notice='{$notice_id_old}' "; //print "$requete <br />"; pmb_mysql_query($requete); $requete = "update bulletins set bulletin_notice='{$notice_id}' where bulletin_notice='{$notice_id_old}' "; //print "$requete <br />"; pmb_mysql_query($requete); $requete = "update notices set niveau_biblio='s', niveau_hierar='1' where notice_id='{$notice_id}' "; //print "$requete <br />"; pmb_mysql_query($requete); // suppression de la notice temporaire $requete = "delete from notices where notice_id=" . $notice_id_old; pmb_mysql_query($requete); $requete = "delete from notices_custom_values where notices_custom_origine='" . $notice_id_old . "'"; pmb_mysql_query($requete); //print "$requete <br />"; } else { $requete = "update notices set niveau_biblio='s', niveau_hierar='1' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); } } else { if ($type_opsys == 'UMO:41' || $type_opsys == 'UMO:42') { // Dépouillement (hors article) //Rien } else { if ($type_opsys == 'UMO:43') { // Dépouillement article de périodique $requete = "select * from notices_custom_values where notices_custom_small_text='" . $num_opsys . "'"; //print "new $type_opsys: $requete <br />"; $resultat = pmb_mysql_query($requete); //Notice existe-t-elle comme notice temporaire? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id notice temporaire a supprimer $old_n = pmb_mysql_fetch_object($resultat); $notice_id_old = $old_n->notices_custom_origine; // modifie les anciennes relations sur la vrai notice $requete = "update analysis set analysis_notice='{$notice_id}' where analysis_notice='{$notice_id_old}' "; //print "$requete <br />"; pmb_mysql_query($requete); $requete = "update notices set niveau_biblio='a', niveau_hierar='2' where notice_id='{$notice_id}' "; //print "$requete <br />"; pmb_mysql_query($requete); // suppression de la notice temporaire $requete = "delete from notices where notice_id=" . $notice_id_old; pmb_mysql_query($requete); $requete = "delete from notices_custom_values where notices_custom_origine='" . $notice_id_old . "'"; pmb_mysql_query($requete); } else { $requete = "update notices set niveau_biblio='a', niveau_hierar='2' where notice_id='{$notice_id}' "; pmb_mysql_query($requete); //print "$requete <br />"; } } else { // UMO 1 2 4 8 21 22 24 28 $is_serie = $type_opsys == 'UMO:21' || $type_opsys == 'UMO:22' || $type_opsys == 'UMO:24' || $type_opsys == 'UMO:28'; if ($flag_titre_serie_recuperation && $is_serie || !$is_serie) { $requete = "select * from notices_custom_values where notices_custom_small_text='" . $num_opsys . "'"; //print "new $type_opsys: $requete <br />"; $resultat = pmb_mysql_query($requete); //Notice existe-t-elle comme notice temporaire? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id notice temporaire a supprimer $old_n = pmb_mysql_fetch_object($resultat); $notice_id_old = $old_n->notices_custom_origine; // modifie les anciennes relations sur la vrai notice $requete = "update notices_relations set linked_notice='{$notice_id}' where linked_notice='{$notice_id_old}' "; //print "$requete <br />"; pmb_mysql_query($requete); // suppression de la notice temporaire $requete = "delete from notices where notice_id=" . $notice_id_old; pmb_mysql_query($requete); $requete = "delete from notices_custom_values where notices_custom_origine='" . $notice_id_old . "'"; pmb_mysql_query($requete); //print "$requete <br />"; } } else { if ($is_serie) { // suprimer la notice car on en veut pas del_notice($notice_id); return; } } } } } //Genre dans Thesaurus for ($i = 0; $i < count($info_902_a); $i++) { for ($j = 0; $j < count($info_902_a[$i]); $j++) { $resultat = categories::searchLibelle(addslashes($info_902_a[$i][$j]), $num_thesaurus, 'fr_FR'); if (!$resultat) { /*vérification de l'existence des categs, sinon création */ $resultat = create_categ($thes, $thes->num_noeud_racine, $info_902_a[$i][$j], ' ' . strip_empty_words($info_902_a[$i][$j]) . ' '); } /* ajout de l'indexation à la notice dans la table notices_categories*/ $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "' "; $res_ajout = @pmb_mysql_query($rqt_ajout, $dbh); } } //centre interet dans Thesaurus for ($i = 0; $i < count($info_901); $i++) { $resultat = categories::searchLibelle(addslashes($info_901[$i]['a']), $num_thesaurus_centre_interet, 'fr_FR'); if (!$resultat) { /*vérification de l'existence des categs, sinon création */ $resultat = create_categ($thes_centre_interet, $thes_centre_interet->num_noeud_racine, $info_901[$i]['a'], ' ' . strip_empty_words($info_901[$i]['a']) . ' ', $info_901[$i][3]); } /* ajout de l'indexation à la notice dans la table notices_categories*/ $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "' "; $res_ajout = @pmb_mysql_query($rqt_ajout, $dbh); } // Pcdm (686) dans le plan de classement // print "<pre>"; print_r($info_686_a);print "</pre>"; if (count($info_686_a)) { //vérification de l'existence des categs, sinon création $requete = "select indexint_id from indexint where indexint_name='" . addslashes($info_686_a[0]) . "' and num_pclass='2'"; //print "$requete <br />"; $result = pmb_mysql_query($requete); if ($row = pmb_mysql_fetch_row($result)) { $indexint_id = $row[0]; } else { $requete = "insert into indexint SET indexint_name='" . addslashes($info_686_a[0]) . "', num_pclass='2' "; //print "$requete <br />"; pmb_mysql_query($requete); $indexint_id = pmb_mysql_insert_id(); } $requete = "update notices set indexint='{$indexint_id}' where notice_id='{$notice_id}' "; // print "$requete <br />"; @pmb_mysql_query($requete, $dbh); } // if (is_array($index_sujets)) $mots_cles = implode (" $pmb_keyword_sep ",$index_sujets); // else $mots_cles = $index_sujets; $mots_cles = ''; for ($a = 0; $a < sizeof($info_600_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_a[$a][0]; for ($j = 0; $j < sizeof($info_600_b[$a]); $j++) { $mots_cles .= " , " . $info_600_b[$a][0]; } for ($j = 0; $j < sizeof($info_600_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_j[$a][$j]; } for ($j = 0; $j < sizeof($info_600_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_x[$a][$j]; } for ($j = 0; $j < sizeof($info_600_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_y[$a][$j]; } for ($j = 0; $j < sizeof($info_600_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_600_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_601_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_a[$a][0]; for ($j = 0; $j < sizeof($info_601_b[$a]); $j++) { $mots_cles .= " , " . $info_601_b[$a][0]; } for ($j = 0; $j < sizeof($info_601_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_j[$a][$j]; } for ($j = 0; $j < sizeof($info_601_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_x[$a][$j]; } for ($j = 0; $j < sizeof($info_601_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_y[$a][$j]; } for ($j = 0; $j < sizeof($info_601_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_601_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_602_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_a[$a][0]; for ($j = 0; $j < sizeof($info_602_b[$a]); $j++) { $mots_cles .= " , " . $info_602_b[$a][0]; } for ($j = 0; $j < sizeof($info_602_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_j[$a][$j]; } for ($j = 0; $j < sizeof($info_602_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_x[$a][$j]; } for ($j = 0; $j < sizeof($info_602_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_y[$a][$j]; } for ($j = 0; $j < sizeof($info_602_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_602_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_605_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_a[$a][0]; for ($j = 0; $j < sizeof($info_605_b[$a]); $j++) { $mots_cles .= " , " . $info_605_b[$a][0]; } for ($j = 0; $j < sizeof($info_605_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_j[$a][$j]; } for ($j = 0; $j < sizeof($info_605_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_x[$a][$j]; } for ($j = 0; $j < sizeof($info_605_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_y[$a][$j]; } for ($j = 0; $j < sizeof($info_605_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_605_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_606_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_a[$a][0]; for ($j = 0; $j < sizeof($info_606_b[$a]); $j++) { $mots_cles .= " , " . $info_606_b[$a][0]; } for ($j = 0; $j < sizeof($info_606_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_j[$a][$j]; } for ($j = 0; $j < sizeof($info_606_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_x[$a][$j]; } for ($j = 0; $j < sizeof($info_606_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_y[$a][$j]; } for ($j = 0; $j < sizeof($info_606_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_606_z[$a][$j]; } } for ($a = 0; $a < sizeof($info_607_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_a[$a][0]; for ($j = 0; $j < sizeof($info_607_b[$a]); $j++) { $mots_cles .= " , " . $info_607_b[$a][0]; } for ($j = 0; $j < sizeof($info_607_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_j[$a][$j]; } for ($j = 0; $j < sizeof($info_607_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_x[$a][$j]; } for ($j = 0; $j < sizeof($info_607_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_y[$a][$j]; } for ($j = 0; $j < sizeof($info_607_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_607_z[$a][$j]; } } if ($flag_import_610_in_mot_cles) { for ($a = 0; $a < sizeof($info_610_a); $a++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_610_a[$a][0]; for ($j = 0; $j < sizeof($info_610_b[$a]); $j++) { $mots_cles .= " , " . $info_610_b[$a][0]; } for ($j = 0; $j < sizeof($info_610_j[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_610_j[$a][$j]; } for ($j = 0; $j < sizeof($info_610_x[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_610_x[$a][$j]; } for ($j = 0; $j < sizeof($info_610_y[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_610_y[$a][$j]; } for ($j = 0; $j < sizeof($info_610_z[$a]); $j++) { $mots_cles .= " {$pmb_keyword_sep} " . $info_610_z[$a][$j]; } if (sizeof($info_610_e[$a])) { $mots_cles .= " ( "; for ($j = 0; $j < sizeof($info_610_e[$a]); $j++) { if ($j) { $mots_cles .= " , "; } $mots_cles .= $info_610_e[$a][$j]; } $mots_cles .= " ) "; } } } //print"<pre>";print_r($info_610_a);print_r($info_610_e);print"</pre>"; for ($a = 0; $a < sizeof($info_610_a); $a++) { $resultat = categories::searchLibelle(addslashes($info_610_a[$a][0]), $num_thesaurus_610, 'fr_FR', $thes_610->num_noeud_racine); if (!$resultat) { /*vérification de l'existence des categs, sinon création */ $resultat = create_categ($thes_610, $thes_610->num_noeud_racine, $info_610_a[$a][0], ' ' . strip_empty_words($info_610_a[$a][0]) . ' ', $info_610_3[$a][0]); } for ($j = 0; $j < sizeof($info_610_e[$a]); $j++) { if ($info_610_e[$a][$j]) { $num_parent = $resultat; $resultat = categories::searchLibelle(addslashes($info_610_e[$a][$j]), $num_thesaurus_610, 'fr_FR', $num_parent); if (!$resultat) { /*vérification de l'existence des categs, sinon création */ $resultat = create_categ($thes_610, $num_parent, $info_610_e[$a][$j], ' ' . strip_empty_words($info_610_e[$a][$j]) . ' ', $info_610_3[$a][0]); } } } /* ajout de l'indexation à la notice dans la table notices_categories*/ $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "' "; $res_ajout = @pmb_mysql_query($rqt_ajout, $dbh); } if (substr($mots_cles, 0, 2) == ' ;') { $mots_cles = substr($mots_cles, 2); } $mots_cles ? $index_matieres = strip_empty_words($mots_cles) : ($index_matieres = ''); $rqt_maj = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes($index_matieres) . " ' where notice_id='{$notice_id}' "; $res_ajout = pmb_mysql_query($rqt_maj, $dbh); // insert du param perso mémorisant le numero Opsys de la notice if (!$id_notices_custom_opsys) { $rqt = "select idchamp from notices_custom where name='num_opsys'"; $res = pmb_mysql_query($rqt, $dbh); if ($res && ($r = pmb_mysql_fetch_object($res))) { $id_notices_custom_opsys = $r->idchamp; } $rqt = "select idchamp from notices_custom where name='type_opsys'"; $res = pmb_mysql_query($rqt, $dbh); if ($res && ($r = pmb_mysql_fetch_object($res))) { $id_notices_custom_type_opsys = $r->idchamp; } } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$notice_id},'" . addslashes($num_opsys) . "')"; pmb_mysql_query($requete); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_type_opsys},{$notice_id},'" . addslashes($type_opsys) . "')"; pmb_mysql_query($requete); $requete = "select * from notices where notice_id={$notice_id}"; $resultat = pmb_mysql_query($requete); $r = pmb_mysql_fetch_object($resultat); // $flag_depouillements_464_doc_sonore // $flag_depouillements_464_doc_imprime=0; // Traiter les dépouillement du champ 464 if ($flag_depouillements_464) { if (is_array($info_464)) { switch ($type_opsys) { case 'UMO:1': // Documents imprimés Unimarc moyen $niveau_biblio = 'm'; $niveau_hierar = '0'; break; case 'UMO:2': // Documents sonores Unimarc moyen $niveau_biblio = 'm'; $niveau_hierar = '0'; break; case 'UMO:13': // bulletin $niveau_biblio = 'a'; $niveau_hierar = '2'; break; case 'UMO:4': // Documents audiovisuel Unimarc moyen $niveau_biblio = 'm'; $niveau_hierar = '0'; break; case 'UMO:8': // Logiciels - CDrom $niveau_biblio = 'm'; $niveau_hierar = '0'; break; default: $niveau_biblio = 'm'; $niveau_hierar = '0'; break; } //print "<pre>";print_r ($info_464);print "</pre>"; for ($i = 0; $i < sizeof($info_464); $i++) { $a_464 = $e_464 = $_3_464 = array(); $author_id = 0; for ($j = 0; $j < sizeof($info_464[$i]); $j++) { if ($info_464[$i][$j]['label'] == 'a') { $a_464[] = $info_464[$i][$j]['content']; } if ($info_464[$i][$j]['label'] == 'e') { $e_464[] = $info_464[$i][$j]['content']; } // Complément du titre if ($info_464[$i][$j]['label'] == '3') { $_3_464[] = $info_464[$i][$j]['content']; } // Complément du titre } //print "<pre>";print_r ($_3_464);print "</pre>"; for ($j = 0; $j < sizeof($a_464); $j++) { if ($_3_464[$j]) { $requete = "select author_id from authors where author_comment='" . addslashes($_3_464[$j]) . "' "; $result = pmb_mysql_query($requete); if ($row = pmb_mysql_fetch_row($result)) { $author_id = $row[0]; //print $author_id."<br />"; } } if ($a_464[$j] != '...') { $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($a_464[$j]) . "',tit2 ='" . addslashes($e_464[$j]) . "', niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}' "; //if ($type_opsys="UMO:2") print $requete ."<br />"; pmb_mysql_query($requete); $depouille_id = pmb_mysql_insert_id(); if ($depouille_id) { //link notice $requete = "insert into notices_relations set num_notice='{$depouille_id}', linked_notice ='{$notice_id}', relation_type='a' "; pmb_mysql_query($requete); if ($author_id) { $requete = "insert into responsability SET responsability_fonction='070' , responsability_notice='{$depouille_id}' , responsability_author = {$author_id}, responsability_type=0"; //print $requete."<br />"; $result = pmb_mysql_query($requete); } } } } } /* for ($i=0; $i<sizeof($info_464); $i++) { $a_464=''; $e_464=''; for ($j=0; $j<sizeof($info_464[$i]); $j++) { if($info_464[$i][$j]['label']=='a') $a_464=$info_464[$i][$j]['content']; if($info_464[$i][$j]['label']=='e') $e_464=$info_464[$i][$j]['content']; } $requete="insert into notices set typdoc='$r->typdoc', tit1 ='".addslashes($a_464)."',tit2 ='".addslashes($e_464)."', niveau_biblio='$niveau_biblio',niveau_hierar='$niveau_hierar' "; //if ($type_opsys="UMO:2") print $requete ."<br />"; pmb_mysql_query($requete); $depouille_id=pmb_mysql_insert_id(); if ($depouille_id) { //link notice $requete="insert into notices_relations set num_notice='$depouille_id', linked_notice ='$notice_id', relation_type='a' "; pmb_mysql_query($requete); } } */ } } // $info_461_3,$info_461_t : dépendance d'une notice chapeau for ($_3 = 0; $_3 < sizeof($info_461_3); $_3++) { switch ($type_opsys) { case 'UMO:1': case 'UMO:2': case 'UMO:4': case 'UMO:8': if ($flag_titre_serie_recuperation) { // que si on veut $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_461_3[$_3] . "'"; //print "$requete <br />"; $resultat = pmb_mysql_query($requete); //Notice chapeau existe-t-elle ? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = pmb_mysql_result($resultat, 0, 0); } else { $niveau_biblio = 'm'; $niveau_hierar = '1'; // Création de la notice temporaire chapeau $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_461_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}' "; //print "$requete <br />"; pmb_mysql_query($requete); $chapeau_id = pmb_mysql_insert_id(); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$chapeau_id},'" . addslashes($info_461_3[$_3]) . "')"; //print "$requete <br />"; pmb_mysql_query($requete); } if ($chapeau_id) { //link notice $requete = "insert into notices_relations set num_notice='{$notice_id}', linked_notice ='{$chapeau_id}', relation_type='a' "; //print "$requete <br />"; pmb_mysql_query($requete); } } break; case 'UMO:13': // bulletin de périodique $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_461_3[$_3] . "'"; //print "$requete <br />"; $resultat = pmb_mysql_query($requete); //Notice chapeau existe-t-elle ? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = pmb_mysql_result($resultat, 0, 0); } else { $niveau_biblio = 's'; $niveau_hierar = '1'; // Création de la notice temporaire chapeau $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_461_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}' "; //print "$requete <br />"; pmb_mysql_query($requete); $chapeau_id = pmb_mysql_insert_id(); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$chapeau_id},'" . addslashes($info_461_3[$_3]) . "')"; //print "$requete <br />"; pmb_mysql_query($requete); } if ($chapeau_id) { //link notice $requete = "insert into notices_relations set num_notice='{$notice_id}', linked_notice ='{$chapeau_id}', relation_type='b' , rank ='1'"; //print "$requete <br />"; pmb_mysql_query($requete); // création bulletin $info = array(); $bulletin = new bulletinage("", $chapeau_id); $info['bul_titre'] = addslashes($info_200_a[0]); $info['bul_no'] = addslashes($info_200_e[0]); $info['bul_date'] = addslashes($info_200_e[1]); $info['date_date'] = gen_date($info_200_e[1], $info_210_d[0]); $bulletin->bull_num_notice = $notice_id; $bulletin_id = $bulletin->update($info, true); } break; default: break; } } // $info_462_3,$info_462_t : Dépouillement, article for ($_3 = 0; $_3 < sizeof($info_462_3); $_3++) { switch ($type_opsys) { case 'UMO:1': case 'UMO:2': case 'UMO:8': $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_462_3[$_3] . "'"; //print "$requete <br />"; $resultat = pmb_mysql_query($requete); //Notice chapeau existe-t-elle ? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = pmb_mysql_result($resultat, 0, 0); } else { $niveau_biblio = 'm'; $niveau_hierar = '0'; // Création de la notice temporaire chapeau $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_462_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}' "; //print "$requete <br />"; pmb_mysql_query($requete); $chapeau_id = pmb_mysql_insert_id(); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$chapeau_id},'" . addslashes($info_462_3[$_3]) . "')"; //print "$requete <br />"; pmb_mysql_query($requete); } if ($chapeau_id) { //link notice $requete = "insert into notices_relations set num_notice='{$notice_id}', linked_notice ='{$chapeau_id}', relation_type='a' "; //print "$requete <br />"; pmb_mysql_query($requete); } break; case 'UMO:13': // bulletin de périodique => création des articles $requete = "select notices_custom_origine from notices_custom_values where notices_custom_small_text='" . $info_462_3[$_3] . "'"; //print "$requete <br />"; $resultat = pmb_mysql_query($requete); //Notice article existe-t-elle ? if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id $article_id = pmb_mysql_result($resultat, 0, 0); } else { $niveau_biblio = 'a'; $niveau_hierar = '2'; // Création de la notice temporaire de l'article $requete = "insert into notices set typdoc='{$r->typdoc}', tit1 ='" . addslashes($info_462_t[$a]) . "' , niveau_biblio='{$niveau_biblio}',niveau_hierar='{$niveau_hierar}' "; //print "$requete <br />"; pmb_mysql_query($requete); $article_id = pmb_mysql_insert_id(); $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$id_notices_custom_opsys},{$article_id},'" . addslashes($info_462_3[$_3]) . "')"; //print "$requete <br />"; pmb_mysql_query($requete); } if ($article_id) { //lien article de bulletin créé dans table analitique $requete = "insert into analysis set analysis_bulletin='{$bulletin_id}', analysis_notice ='{$article_id}' "; //print "$requete <br />"; pmb_mysql_query($requete); } break; default: break; } } }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_464; global $info_606_a; global $info_900, $info_901, $info_902, $info_903, $info_904, $info_905, $info_906, $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 $thes; global $index_sujets; global $pmb_keyword_sep; global $info_600_a, $info_600_j, $info_600_x, $info_600_y, $info_600_z; global $info_601_a, $info_601_j, $info_601_x, $info_601_y, $info_601_z; global $info_602_a, $info_602_j, $info_602_x, $info_602_y, $info_602_z; global $info_605_a, $info_605_j, $info_605_x, $info_605_y, $info_605_z; global $info_606_a, $info_606_j, $info_606_x, $info_606_y, $info_606_z; global $info_607_a, $info_607_j, $info_607_x, $info_607_y, $info_607_z; for ($a = 0; $a < sizeof($info_600_a); $a++) { $rameau .= "@@@" . trim($info_600_a[$a][0]); for ($j = 0; $j < sizeof($info_600_j[$a]); $j++) { $rameau .= " -- " . trim($info_600_j[$a][$j]); } for ($j = 0; $j < sizeof($info_600_x[$a]); $j++) { $rameau .= " -- " . trim($info_600_x[$a][$j]); } for ($j = 0; $j < sizeof($info_600_y[$a]); $j++) { $rameau .= " -- " . trim($info_600_y[$a][$j]); } for ($j = 0; $j < sizeof($info_600_z[$a]); $j++) { $rameau .= " -- " . trim($info_600_z[$a][$j]); } } for ($a = 0; $a < sizeof($info_601_a); $a++) { $rameau .= "@@@" . trim($info_601_a[$a][0]); for ($j = 0; $j < sizeof($info_601_j[$a]); $j++) { $rameau .= " -- " . trim($info_601_j[$a][$j]); } for ($j = 0; $j < sizeof($info_601_x[$a]); $j++) { $rameau .= " -- " . trim($info_601_x[$a][$j]); } for ($j = 0; $j < sizeof($info_601_y[$a]); $j++) { $rameau .= " -- " . trim($info_601_y[$a][$j]); } for ($j = 0; $j < sizeof($info_601_z[$a]); $j++) { $rameau .= " -- " . trim($info_601_z[$a][$j]); } } for ($a = 0; $a < sizeof($info_602_a); $a++) { $rameau .= "@@@" . trim($info_602_a[$a][0]); for ($j = 0; $j < sizeof($info_602_j[$a]); $j++) { $rameau .= " -- " . trim($info_602_j[$a][$j]); } for ($j = 0; $j < sizeof($info_602_x[$a]); $j++) { $rameau .= " -- " . trim($info_602_x[$a][$j]); } for ($j = 0; $j < sizeof($info_602_y[$a]); $j++) { $rameau .= " -- " . trim($info_602_y[$a][$j]); } for ($j = 0; $j < sizeof($info_602_z[$a]); $j++) { $rameau .= " -- " . trim($info_602_z[$a][$j]); } } for ($a = 0; $a < sizeof($info_605_a); $a++) { $rameau .= "@@@" . trim($info_605_a[$a][0]); for ($j = 0; $j < sizeof($info_605_j[$a]); $j++) { $rameau .= " -- " . trim($info_605_j[$a][$j]); } for ($j = 0; $j < sizeof($info_605_x[$a]); $j++) { $rameau .= " -- " . trim($info_605_x[$a][$j]); } for ($j = 0; $j < sizeof($info_605_y[$a]); $j++) { $rameau .= " -- " . trim($info_605_y[$a][$j]); } for ($j = 0; $j < sizeof($info_605_z[$a]); $j++) { $rameau .= " -- " . trim($info_605_z[$a][$j]); } } for ($a = 0; $a < sizeof($info_606_a); $a++) { $rameau .= "@@@" . trim($info_606_a[$a][0]); for ($j = 0; $j < sizeof($info_606_j[$a]); $j++) { $rameau .= " -- " . trim($info_606_j[$a][$j]); } for ($j = 0; $j < sizeof($info_606_x[$a]); $j++) { $rameau .= " -- " . trim($info_606_x[$a][$j]); } for ($j = 0; $j < sizeof($info_606_y[$a]); $j++) { $rameau .= " -- " . trim($info_606_y[$a][$j]); } for ($j = 0; $j < sizeof($info_606_z[$a]); $j++) { $rameau .= " -- " . trim($info_606_z[$a][$j]); } } for ($a = 0; $a < sizeof($info_607_a); $a++) { $rameau .= "@@@" . trim($info_607_a[$a][0]); for ($j = 0; $j < sizeof($info_607_j[$a]); $j++) { $rameau .= " -- " . trim($info_607_j[$a][$j]); } for ($j = 0; $j < sizeof($info_607_x[$a]); $j++) { $rameau .= " -- " . trim($info_607_x[$a][$j]); } for ($j = 0; $j < sizeof($info_607_y[$a]); $j++) { $rameau .= " -- " . trim($info_607_y[$a][$j]); } for ($j = 0; $j < sizeof($info_607_z[$a]); $j++) { $rameau .= " -- " . trim($info_607_z[$a][$j]); } } $categ_first = explode("@@@", stripslashes($rameau)); for ($i = 1; $i < count($categ_first); $i++) { $resultat = categories::searchLibelle(addslashes($categ_first[$i]), $thesaurus_defaut, 'fr_FR'); if (!$resultat) { /*vérification de l'existence des categs, sinon création */ $resultat = create_categ_cpt_rameau_first_level($thes->num_noeud_racine, $categ_first[$i], ' ' . strip_empty_words($categ_first[$i]) . ' '); } /* ajout de l'indexation à la notice dans la table notices_categories*/ $rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "', ordre_categorie=" . ($i - 1); $res_ajout = @mysql_query($rqt_ajout, $dbh); } }
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 traite_categories_from_form() { global $rameau; global $thesaurus_defaut; global $thes; $categories = array(); $categ_first = explode(" @@@ ", stripslashes($rameau)); for ($i = 0; $i < count($categ_first); $i++) { $categ_first[$i] = trim($categ_first[$i]); if ($categ_first[$i]) { $resultat = categories::searchLibelle(addslashes($categ_first[$i]), $thesaurus_defaut, 'fr_FR'); if (!$resultat) { $categories[]["categ_id"] = create_categ($thes->num_noeud_racine, $categ_first[$i], " " . addslashes(strip_empty_words($categ_first[$i])) . " "); } else { $categories[]["categ_id"] = $resultat; } } } return $categories; }
function do_thesaurus_ascodocpsy($id_thesaurus, $nom_categ, $branch_values = array(), $lang = 'fr_FR', $ordre_categ = 0) { global $notice_id; $res = pmb_mysql_query("select id_noeud from noeuds where autorite='TOP' and num_thesaurus='" . $id_thesaurus . "'"); if ($res && pmb_mysql_num_rows($res)) { $parent_thes = pmb_mysql_result($res, 0, 0); } else { return; } $rqt = "select id_noeud from noeuds join categories on id_noeud=num_noeud and libelle_categorie='" . $nom_categ . "' and num_parent='" . $parent_thes . "'"; $res = pmb_mysql_query($rqt); if ($res && pmb_mysql_num_rows($res)) { $num_parent = pmb_mysql_result($res, 0, 0); foreach ($branch_values as $terms) { foreach ($terms as $term) { $categ_id = categories::searchLibelle(addslashes($term), $id_thesaurus, $lang, $num_parent); if ($categ_id) { //le terme existe $noeud = new noeuds($categ_id); if ($noeud->num_renvoi_voir) { $categ_to_index = $noeud->num_renvoi_voir; } else { $categ_to_index = $categ_id; } } else { //le terme est à créé $n = new noeuds(); $n->num_thesaurus = $id_thesaurus; $n->num_parent = $num_parent; $n->save(); $c = new categories($n->id_noeud, $lang); $c->libelle_categorie = $term; $c->index_categorie = ' ' . strip_empty_words($term) . ' '; $c->save(); $categ_to_index = $n->id_noeud; } $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) VALUES({$notice_id},{$categ_to_index},{$ordre_categ})"; pmb_mysql_query($requete); $ordre_categ++; } } } }
function import_new_notice_suite() { global $info_461, $info_463, $info_530; global $info_900, $info_901, $tit_200a; global $info_215, $titre_ppal_200, $champ_210, $titre_perio_530a; global $info_606_a, $info_897; global $notice_id; global $bull_id; global $bl, $hl; echo "<pre>"; $bull_id = 0; //cas d'un article if ($bl == "a" && $hl == "2") { //on peut pas découper une date, on a pas de date mais une mention if (decoupe_date($info_463[0]["d"]) == 0 && clean_string($info_463[0]["e"]) == "") { $info_463[0]["e"] = $info_463[0]["d"]; $info_463[0]["d"] = ""; } $bulletin = array('titre' => clean_string($info_463[0]["t"]), 'date' => decoupe_date($info_463[0]["d"]), 'mention' => clean_string($info_463[0]["e"]), 'num' => clean_string($info_463[0]["v"])); $perio = array('titre' => $info_461[0]['t'], 'code' => $info_461[0]['x']); notice_to_article($perio, $bulletin); $update = " update notices set typdoc='t' where notice_id = {$notice_id}"; mysql_query($update); //cas d'un bulletin } else { if ($bl == "s" && $hl == "2") { if (decoupe_date($champ_210[0]['h']) == 0 && clean_string($titre_ppal_200[0]['h']) == "") { $titre_ppal_200[0]['h'] = $champ_210[0]['h']; $champ_210[0]['h'] = ""; } $bulletin = array('titre' => clean_string($titre_ppal_200[0]['i']), 'date' => decoupe_date($champ_210[0]['h']), 'mention' => clean_string($champ_210[0]['d']), 'num' => clean_string($titre_ppal_200[0]['h'])); $perio = array('titre' => $info_461[0]['t'], 'code' => $info_461[0]['x']); $bull_id = genere_bulletin($perio, $bulletin); $update = " update notices set typdoc='t' where notice_id = {$notice_id}"; mysql_query($update); } } //on s'occupe des descripteurs; $id_thesaurus = 1; $non_classes = 3; $lang = "fr_FR"; $ordre_categ = 0; foreach ($info_606_a as $terms) { foreach ($terms as $term) { $categ_id = categories::searchLibelle(addslashes($term), $id_thesaurus, $lang); if ($categ_id) { //le terme existe $noeud = new noeuds($categ_id); if ($noeud->num_renvoi_voir) { $categ_to_index = $noeud->num_renvoi_voir; } else { $categ_to_index = $categ_id; } } else { //le terme est à créé $n = new noeuds(); $n->num_thesaurus = $id_thesaurus; $n->num_parent = $non_classes; $n->save(); $c = new categories($n->id_noeud, $lang); $c->libelle_categorie = $term; $c->index_categorie = ' ' . strip_empty_words($term) . ' '; $c->save(); $categ_to_index = $n->id_noeud; } $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) VALUES({$notice_id},{$categ_to_index},{$ordre_categ})"; mysql_query($requete); $ordre_categ++; } } //on traite le commentaire de gestion $up = "update notices set commentaire_gestion = '" . addslashes($info_901[0][0]) . "' where notice_id = {$notice_id}"; mysql_query($up); //traitement des Champs perso //classique on commence par cherché l'id foreach ($info_900 as $champperso) { $champ = array('libelle' => $champperso['l'], 'nom' => $champperso['n'], 'value' => $champperso['a']); recup_champ_perso($champ, "notices", $notice_id); } //gestion des 897$... foreach ($info_897 as $docnum) { //si on a pas d'url, on traite pas if ($docnum['u']) { //on reprend pas les site web... if ($docnum['m'] != "text/html") { $doc = array('titre' => clean_string($docnum['a']), 'mimetype' => $docnum['m'], 'nom_fic' => clean_string($docnum['f']), 'url' => $docnum['u']); create_docnum($doc); } } } echo "</pre>"; }
function check_if_exists($data, $id_thesaurus, $num_parent = 0, $lang = "") { $lang = strtolower($lang); switch ($lang) { case "fr": case "fre": case "français": case "francais": case "french": $lang = "fr_FR"; break; default: $lang = "fr_FR"; break; } if ($data['label'] == "") { return 0; } $query = "select * from thesaurus where id_thesaurus = " . $id_thesaurus; $result = pmb_mysql_query($query); $id = 0; if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $id = categories::searchLibelle(addslashes($data['label']), $id_thesaurus, $lang, $num_parent); } return $id; }
static function build_categ($tab_categ, $id_thes, $id_parent, $do_lien = true, $do_create = true) { global $incr_categ, $notice_id, $lang; if (trim($tab_categ)) { $resultat = categories::searchLibelle(addslashes($tab_categ), $id_thes, $lang, $id_parent); if (!$resultat && $id_parent && $do_create) { // création de la catégorie $n = new noeuds(); $n->num_parent = $id_parent; $n->num_thesaurus = $id_thes; $n->save(); $resultat = $id_n = $n->id_noeud; $c = new categories($id_n, $lang); $c->libelle_categorie = $tab_categ; $c->save(); } // ajout de l'indexation à la notice dans la table notices_categories if ($do_lien && $resultat && $notice_id) { $incr_categ++; $rqt_ajout = "insert IGNORE into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "', ordre_categorie='" . $incr_categ . "' "; pmb_mysql_query($rqt_ajout); } return $resultat; } return 0; }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_464, $info_676; global $info_606_a, $info_606_x; global $info_900, $info_901, $info_902, $info_200, $info_903, $info_904, $info_910; global $rs, $bl, $dt; global $bulletin_ex; global $m_thess; //si on est en multi-thesaurus if (!$m_thess) { $rqt = "SELECT count(1) FROM thesaurus WHERE active=1"; $m_thess = mysql_result(mysql_query($rqt), 0, 0); } //Cas des périodiques if (is_array($info_464)) { $requete = "SELECT * FROM notices WHERE notice_id={$notice_id}"; $resultat = mysql_query($requete); $r = mysql_fetch_object($resultat); //Notice chapeau existe-t-elle ? $requete = "SELECT notice_id FROM notices WHERE tit1='" . addslashes($info_464[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = mysql_result($resultat, 0, 0); //Mise à jour du champ commentaire de gestion si nécessaire if ($info_903[0]) { $requete = "UPDATE notices SET commentaire_gestion=concat(commentaire_gestion,' ','" . addslashes($info_903[0]) . "') WHERE notice_id={$chapeau_id}"; mysql_query($requete); } //Bulletin existe-t-il ? $requete = "SELECT bulletin_id FROM bulletins WHERE bulletin_numero='" . addslashes($info_464[0]['v']) . "' AND mention_date='" . addslashes($info_464[0]['d']) . "' AND bulletin_notice={$chapeau_id}"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id bulletin $bulletin_id = mysql_result($resultat, 0, 0); } else { //Si non, création bulletin $info = array(); $bulletin = new bulletinage("", $chapeau_id); if ($info_464[0]['u']) { $info['bul_titre'] = addslashes($info_464[0]['u']); } else { $info['bul_titre'] = addslashes("Bulletin " . $info_464[0]['v']); } $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { if ($info_902[0]) { $info['date_date'] = $info_902[0]; } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } } else { //Si non, création notice chapeau et bulletin $chapeau = new serial(); $info = array(); $info['tit1'] = addslashes($info_464[0]['t']); $info['niveau_biblio'] = 's'; $info['niveau_hierar'] = '1'; $info['typdoc'] = $r->typdoc; $chapeau->update($info); $chapeau_id = $chapeau->serial_id; //Mise à jour du champ commentaire de gestion si nécessaire if ($info_903[0]) { $requete = "UPDATE notices SET commentaire_gestion=concat(commentaire_gestion,' ','" . addslashes($info_903[0]) . "') WHERE notice_id={$chapeau_id}"; mysql_query($requete); } $bulletin = new bulletinage("", $chapeau_id); $info = array(); if ($info_464[0]['u']) { $info['bul_titre'] = addslashes($info_464[0]['u']); } else { $info['bul_titre'] = addslashes("Bulletin " . $info_464[0]['v']); } $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { if ($info_902[0]) { $info['date_date'] = $info_902[0]; } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } //Passage de la notice en article $requete = "UPDATE notices SET niveau_biblio='a', niveau_hierar='2', npages='" . addslashes($info_464[0]['p']) . "' WHERE notice_id={$notice_id}"; mysql_query($requete); $requete = "INSERT INTO analysis (analysis_bulletin,analysis_notice) VALUES({$bulletin_id},{$notice_id})"; mysql_query($requete); $bulletin_ex = $bulletin_id; } else { $bulletin_ex = 0; } //Traitement du thésaurus if ($m_thess > 1) { //on est en multi-thesaurus for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur_tete = $info_606_a[$i][$j]; $descripteur_fils = $info_606_x[$i][$j]; //Recherche du thésaurus $thes_id = trouve_thesaurus($descripteur_tete); //Recherche du terme fils if ($thes_id > 0) { $categ_id_fils = categories::searchLibelle(addslashes(trim($descripteur_fils)), $thes_id, "fr_FR"); if (!$categ_id_fils) { //Création $new_thes = $thes_id == 1 ? 4 : $thes_id; //Choix du thesaurus Candidats descripteurs si descripteur inexistant $categ_id_fils = categories::searchLibelle(addslashes(trim($descripteur_fils)), $new_thes, "fr_FR"); if (!$categ_id_fils) { $noeud = new noeuds(); $noeud->num_thesaurus = $new_thes; $thesau = new thesaurus($new_thes); $noeud->num_parent = $thesau->num_noeud_racine; $noeud->save(); $categ_id_fils = $noeud->id_noeud; //Création du libellé $categ = new categories($noeud->id_noeud, 'fr_FR'); $categ->libelle_categorie = $descripteur_fils; $categ->index_categorie = " " . strip_empty_words($descripteur_fils) . " "; $categ->save(); } } $requete = "INSERT INTO notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ({$notice_id},{$categ_id_fils}, " . ($i + 1) . ")"; mysql_query($requete); } } } //for($i } else { //Traitement du thésaurus unique for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur_tete = $info_606_a[$i][$j]; $descripteur_fils = $info_606_x[$i][$j]; //Recherche du terme de tête //$requete="SELECT num_noeud FROM categories WHERE libelle_categorie='".addslashes($descripteur_tete)."' AND langue='fr_FR'"; $requete = "SELECT id_noeud FROM noeuds WHERE autorite='" . addslashes($descripteur_tete) . "'"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //la tête existe ! $categ_id_tete = mysql_result($resultat, 0, 0); } else { //Création de la tête //Nouveau Noeud ! $th = new thesaurus(1); $noeud = new noeuds(); $noeud->num_thesaurus = $th->id_thesaurus; $noeud->num_parent = $th->num_noeud_racine; $noeud->autorite = $descripteur_tete; $noeud->save(); $categ_id_tete = $noeud->id_noeud; //Création du libellé $categ = new categories($noeud->id_noeud, 'fr_FR'); $categ->libelle_categorie = $descripteur_tete; $categ->index_categorie = " " . strip_empty_words($descripteur_tete) . " "; $categ->save(); } //Recherche du terme fils $categ_id_fils = categories::searchLibelle(addslashes($descripteur_fils), 1, "fr_FR"); if (!$categ_id_fils) { //Création $noeud = new noeuds(); $noeud->num_thesaurus = 1; $noeud->num_parent = $categ_id_tete; $noeud->save(); $categ_id_fils = $noeud->id_noeud; //Création du libellé $categ = new categories($noeud->id_noeud, 'fr_FR'); $categ->libelle_categorie = $descripteur_fils; $categ->index_categorie = " " . strip_empty_words($descripteur_fils) . " "; $categ->save(); } $requete = "INSERT INTO notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ({$notice_id}, {$categ_id_fils}, " . ($i + 1) . ")"; mysql_query($requete); } } } //Indexation décimale if ($info_676[0]) { $requete = "select indexint_id from indexint where indexint_name='" . addslashes($info_676[0]) . "'"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $indexint = mysql_result($resultat, 0, 0); } else { $requete = "insert into indexint (indexint_name) values('" . addslashes($info_676[0]) . "')"; mysql_query($requete); $indexint = mysql_insert_id(); } $requete = "update notices set indexint=" . $indexint . " where notice_id=" . $notice_id; mysql_query($requete); } //Organisme if ($info_900[0]) { $no_champ = trouve_champ_perso("op"); if ($no_champ > 0) { $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_900[0]) . "' AND notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_900[0]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})"; mysql_query($requete); } } //Genre if ($info_901[0]) { $no_champ = trouve_champ_perso("gen"); if ($no_champ > 0) { $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_901[0]) . "' AND notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_901[0]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})"; mysql_query($requete); } } //Type de texte if (count($info_904)) { $no_champ = trouve_champ_perso("typtext"); if ($no_champ > 0) { for ($i = 0; $i < count($info_904); $i++) { for ($j = 0; $j < count($info_904[$i]); $j++) { $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_904[$i][$j]) . "' AND notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_904[$i][$j]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})"; mysql_query($requete); } } } } //Date de saisie if ($info_902[0]) { $no_champ = trouve_champ_perso("ds"); if ($no_champ > 0) { $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_date) VALUES({$no_champ},{$notice_id},'" . str_replace(".", "-", $info_902[0]) . "')"; mysql_query($requete); } } //N° de lot if ($info_903[0]) { $requete = "UPDATE notices SET commentaire_gestion='" . addslashes($info_903[0]) . "' WHERE notice_id={$notice_id}"; mysql_query($requete); } //Cas de la mise à jour des périodiques ou du champ bord (notices chapeau) if ($bl == "s") { //Si c'est un périodique if ($dt == "a") { //Passage de la notice en notice chapeau $requete = "UPDATE notices SET niveau_biblio='s', niveau_hierar='1' WHERE notice_id={$notice_id}"; mysql_query($requete); //Recherche si la notice existe déjà par rapport au titre $requete = "select notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND niveau_biblio='s' AND niveau_hierar='1' AND notice_id!={$notice_id}"; $resultat = mysql_query($requete); $update = false; if (mysql_num_rows($resultat)) { $update = true; $n_update = mysql_result($resultat, 0, 0); //Mise à jour de tous les bulletins $requete = "UPDATE bulletins SET bulletin_notice=" . $notice_id . " WHERE bulletin_notice=" . $n_update; mysql_query($requete); //Suppression de l'ancienne notice $requete = "DELETE FROM notices WHERE notice_id={$n_update}"; mysql_query($requete); $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $n_update; mysql_query($requete); $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $n_update; mysql_query($requete); $requete = "DELETE FROM responsability WHERE responsability_author=" . $n_update; mysql_query($requete); } if (!$update && $rs != "n") { //Si il n'y a pas de création, on supprime la notice $requete = "DELETE FROM notices WHERE notice_id={$notice_id}"; mysql_query($requete); $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $notice_id; mysql_query($requete); $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $notice_id; mysql_query($requete); $requete = "DELETE FROM responsability WHERE responsability_author=" . $notice_id; mysql_query($requete); } } else { if ($dt == "l") { //Recherche si la notice existe déjà par rapport au titre $requete = "select notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND typdoc='l' AND notice_id!={$notice_id}"; $resultat = mysql_query($requete); $update = false; if (mysql_num_rows($resultat)) { $update = true; $n_update = mysql_result($resultat, 0, 0); //Suppression de l'ancienne notice $requete = "DELETE FROM notices WHERE notice_id={$n_update}"; mysql_query($requete); $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $n_update; mysql_query($requete); $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $n_update; mysql_query($requete); $requete = "DELETE FROM responsability WHERE responsability_author=" . $n_update; mysql_query($requete); } } else { if ($dt == "r") { //Mise à jour du champ bord if ($info_910[0]) { $no_champ = trouve_champ_perso("bord"); if ($no_champ > 0) { //Recherche si la notice existe déjà par rapport au titre $requete = "SELECT notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND niveau_biblio='s' AND niveau_hierar='1' AND notice_id!={$notice_id}"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $notice_update = mysql_result($resultat, 0, 0); $requete = "UPDATE notices_custom_values SET notices_custom_text='" . addslashes(str_replace("##", "\n", $info_910[0])) . "' WHERE notices_custom_champ={$no_champ} AND notices_custom_origine=" . $notice_update; mysql_query($requete); if (!mysql_affected_rows()) { $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_text) VALUES({$no_champ},{$notice_update},'" . addslashes(str_replace("##", "\n", $info_910[0])) . "')"; mysql_query($requete); } } } } //Suppression de la nouvelle notice $requete = "DELETE FROM notices WHERE notice_id=" . $notice_id; mysql_query($requete); } } } } }
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 traite_categories_from_form() { global $rameau; global $dbh; global $thes; $rac = $thes->num_noeud_racine; // récupération du 606 : récup en catégories en essayant de classer : // les sujets sous le terme "Recherche par terme" $id_rech_theme = categories::searchLibelle('Recherche par terme', $thes->id_thesaurus, 'fr_FR'); if (!$id_rech_theme) { $id_rech_theme = create_categ($rac, 'Recherche par terme', strip_empty_words('Recherche par terme', 'fr_FR')); } // les précisions géographiques sous le terme "Recherche géographique" $id_rech_geo = categories::searchLibelle('Recherche géographique', $thes->id_thesaurus, 'fr_FR'); if (!$id_rech_geo) { $id_rech_geo = create_categ($rac, 'Recherche géographique', strip_empty_words('Recherche géographique', 'fr_FR')); } // les précisions de période sous le terme "Recherche chronologique" $id_rech_chrono = categories::searchLibelle('Recherche chronologique', $thes->id_thesaurus, 'fr_FR'); if (!$id_rech_chrono) { $id_rech_chrono = create_categ($rac, 'Recherche chronologique', strip_empty_words('Recherche chronologique', 'fr_FR')); } // FIN paramétrage $tableau_606 = unserialize(stripslashes($rameau)); $info_606_a = $tableau_606["info_606_a"]; $info_606_j = $tableau_606["info_606_j"]; $info_606_x = $tableau_606["info_606_x"]; $info_606_y = $tableau_606["info_606_y"]; $info_606_z = $tableau_606["info_606_z"]; // ici récupération du code de admin/import/func_cnl.inc.php puis modif pour création du tableau des catégories, ce qui doit être retourné par la fonction $libelle_j = ""; for ($a = 0; $a < sizeof($info_606_a); $a++) { for ($j = 0; $j < sizeof($info_606_j[$a]); $j++) { if (!$libelle_j) { $libelle_j .= trim($info_606_j[$a][$j]); } else { $libelle_j .= " ** " . trim($info_606_j[$a][$j]); } } if (!$libelle_j) { $libelle_final = trim($info_606_a[$a][0]); } else { $libelle_final = trim($info_606_a[$a][0]) . " ** " . $libelle_j; } if (!$libelle_final) { break; } $res_a = categories::searchLibelle(addslashes($libelle_final), $thes->id_thesaurus, 'fr_FR', $id_rech_theme); if ($res_a) { $categid_a = $res_a; } else { $categid_a = create_categ($id_rech_theme, $libelle_final, strip_empty_words($libelle_final)); } // récup des sous-categ en cascade sous $a $categ_parent = $categid_a; for ($x = 0; $x < sizeof($info_606_x[$a]); $x++) { $res_x = categories::searchLibelle(addslashes(trim($info_606_x[$a][$x])), $thes->id_thesaurus, 'fr_FR', $categ_parent); if ($res_x) { $categ_parent = $res_x; } else { $categ_parent = create_categ($categ_parent, trim($info_606_x[$a][$x]), strip_empty_words($info_606_x[$a][$x])); } } // fin récup des $x en cascade sous l'id de la catégorie 606$a if ($categ_parent != $id_rech_theme) { $categ_retour[]['categ_id'] = $categ_parent; } // récup des categ géo à loger sous la categ géo principale $categ_parent = $id_rech_geo; for ($y = 0; $y < sizeof($info_606_y[$a]); $y++) { $res_y = categories::searchLibelle(addslashes(trim($info_606_y[$a][$y])), $thes->id_thesaurus, 'fr_FR', $categ_parent); if ($res_y) { $categ_parent = $res_y; } else { $categ_parent = create_categ($categ_parent, trim($info_606_y[$a][$y]), strip_empty_words($info_606_y[$a][$y])); } } // fin récup des $y en cascade sous l'id de la catégorie principale thème géo if ($categ_parent != $id_rech_geo) { $categ_retour[]['categ_id'] = $categ_parent; } // récup des categ chrono à loger sous la categ chrono principale $categ_parent = $id_rech_chrono; for ($z = 0; $z < sizeof($info_606_z[$a]); $z++) { $res_z = categories::searchLibelle(addslashes(trim($info_606_z[$a][$z])), $thes->id_thesaurus, 'fr_FR', $categ_parent); if ($res_z) { $categ_parent = $res_z; } else { $categ_parent = create_categ($categ_parent, trim($info_606_z[$a][$z]), strip_empty_words($info_606_z[$a][$z])); } } // fin récup des $z en cascade sous l'id de la catégorie principale thème chrono if ($categ_parent != $id_rech_chrono) { $categ_retour[]['categ_id'] = $categ_parent; } } // DEBUG echo "<pre>"; print_r($categ_retour) ; echo "</pre>"; exit ; return $categ_retour; }