function list_collection($coll, $collection_list, $nav_bar) { global $sub_collection_list_tmpl; global $charset; $sub_collection_list_tmpl = str_replace("!!cle!!", $coll, $sub_collection_list_tmpl); $sub_collection_list_tmpl = str_replace("!!list!!", $collection_list, $sub_collection_list_tmpl); $sub_collection_list_tmpl = str_replace("!!nav_bar!!", $nav_bar, $sub_collection_list_tmpl); subcollection::search_form(); print pmb_bidi($sub_collection_list_tmpl); }
static function get_informations_from_unimarc($fields, $from_subcollection = false, $import_subcoll = false) { $data = array(); if (!$from_subcollection) { $data['name'] = $fields['200'][0]['a'][0]; if (count($fields['200'][0]['i'])) { foreach ($fields['200'][0]['i'] as $value) { $data['name'] .= ". " . $value; } } if (count($fields['200'][0]['e'])) { foreach ($fields['200'][0]['e'] as $value) { $data['name'] .= " : " . $value; } } $data['issn'] = $fields['011'][0]['a'][0]; if ($fields['312']) { for ($i = 0; $i < count($fields['312']); $i++) { for ($j = 0; $j < count($fields['312'][$i]['a']); $j++) { if ($data['comment'] != "") { $data['comment'] .= "\n"; } $data['comment'] .= $fields['312'][$i]['a'][$j]; } } } $data['publisher'] = editeur::get_informations_from_unimarc($fields); if ($import_subcoll) { $data['subcollections'] = subcollection::get_informations_from_unimarc($fields, true); } } else { $data['name'] = $fields['410'][0]['t'][0]; $data['issn'] = $fields['410'][0]['x'][0]; $data['authority_number'] = $fields['410'][0]['3'][0]; $data['publisher'] = editeur::get_informations_from_unimarc($fields); } return $data; }
} require_once "{$class_path}/subcollection.class.php"; // la taille d'un paquet de notices $lot = SUBCOLLECTION_PAQUET_SIZE; // defini dans ./params.inc.php // taille de la jauge pour affichage $jauge_size = GAUGE_SIZE; // initialisation de la borne de départ if (!isset($start)) { $start = 0; } $v_state = urldecode($v_state); print "<br /><br /><h2 align='center'>" . htmlentities($msg["nettoyage_suppr_subcollections"], ENT_QUOTES, $charset) . "</h2>"; $query = mysql_query("SELECT sub_coll_id from sub_collections left join notices on sub_coll_id=subcoll_id where subcoll_id is null "); $affected = 0; if ($affected = mysql_num_rows($query)) { while ($ligne = mysql_fetch_object($query)) { $subcoll = new subcollection($ligne->sub_coll_id); $subcoll->delete(); } } //Nettoyage des informations d'autorités pour les sous collections subcollection::delete_autority_sources(); $query = mysql_query("update notices left join sub_collections ON sub_coll_id=subcoll_id SET subcoll_id=0 WHERE sub_coll_id is null"); $spec = $spec - CLEAN_SUBCOLLECTIONS; $v_state .= "<br /><img src=../../images/d.gif hspace=3>" . htmlentities($msg["nettoyage_suppr_subcollections"], ENT_QUOTES, $charset) . " : "; $v_state .= $affected . " " . htmlentities($msg["nettoyage_res_suppr_subcollections"], ENT_QUOTES, $charset); $opt = mysql_query('OPTIMIZE TABLE sub_collections'); // mise à jour de l'affichage de la jauge print "<table border='0' align='center' width='{$table_size}' cellpadding='0'><tr><td class='jauge'>\n \t\t<img src='../../images/jauge.png' width='{$jauge_size}' height='16'></td></tr></table>\n\t\t<div align='center'>100%</div>"; print "\n\t<form class='form-{$current_module}' name='process_state' action='./clean.php?spec={$spec}&start=0' method='post'>\n\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t</form>\n\t<script type=\"text/javascript\"><!--\n\t\tdocument.forms['process_state'].submit();\n\t\t-->\n\t</script>";
static function import($data) { // cette méthode prend en entrée un tableau constitué des informations éditeurs suivantes : // $data['name'] Nom de la collection // $data['coll_parent'] id de l'éditeur parent de la collection // $data['issn'] numéro ISSN de la collection // $data['statut'] statut de la collection global $dbh; // check sur le type de la variable passée en paramètre if (!sizeof($data) || !is_array($data)) { // si ce n'est pas un tableau ou un tableau vide, on retourne 0 return 0; } // check sur les éléments du tableau (data['name'] est requis). $long_maxi_name = pmb_mysql_field_len(pmb_mysql_query("SELECT sub_coll_name FROM sub_collections limit 1"), 0); $data['name'] = rtrim(substr(preg_replace('/\\[|\\]/', '', rtrim(ltrim($data['name']))), 0, $long_maxi_name)); //si on a pas d'id, on peut avoir les infos de la collection if (!$data['coll_parent']) { if ($data['collection']) { //on les a, on crée l'éditeur $data['coll_parent'] = collection::import($data['collection']); } } if ($data['name'] == "" || $data['coll_parent'] == 0) { /* il nous faut impérativement une collection parente */ return 0; } // préparation de la requête $key0 = addslashes($data['name']); $key1 = $data['coll_parent']; $key2 = addslashes($data['issn']); /* vérification que la collection existe bien ! */ $query = "SELECT collection_id FROM collections WHERE collection_id='{$key1}' LIMIT 1 "; $result = @pmb_mysql_query($query, $dbh); if (!$result) { die("can't SELECT colections " . $query); } if (pmb_mysql_num_rows($result) == 0) { return 0; } /* vérification que la sous-collection existe */ $query = "SELECT sub_coll_id FROM sub_collections WHERE sub_coll_name='{$key0}' AND sub_coll_parent='{$key1}' LIMIT 1 "; $result = @pmb_mysql_query($query, $dbh); if (!$result) { die("can't SELECT sub_collections " . $query); } $subcollection = pmb_mysql_fetch_object($result); /* la sous-collection existe, on retourne l'ID */ if ($subcollection->sub_coll_id) { return $subcollection->sub_coll_id; } // id non-récupérée, il faut créer la forme. $query = 'INSERT INTO sub_collections SET sub_coll_name="' . $key0 . '", '; $query .= 'sub_coll_parent="' . $key1 . '", '; $query .= 'sub_coll_issn="' . $key2 . '", '; $query .= 'subcollection_web="' . addslashes($data['subcollection_web']) . '", '; $query .= 'subcollection_comment="' . addslashes($data['comment']) . '", '; $query .= 'index_sub_coll=" ' . strip_empty_words($key0) . ' ' . strip_empty_words($key2) . ' " '; $result = @pmb_mysql_query($query, $dbh); if (!$result) { die("can't INSERT into sub_collections" . $query); } $id = pmb_mysql_insert_id($dbh); audit::insert_creation(AUDIT_SUB_COLLECTION, $id); //update authority informations $authority = new authority(0, $id, AUT_TABLE_SUB_COLLECTIONS); $authority->set_num_statut($data['statut']); $authority->update(); subcollection::update_index($id); return $id; }
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 insert_authority_infos($authority_number, $type, $id_origin_authority, $authority_infos = array()) { global $opac_enrichment_bnf_sparql; //on a un numéro d'autorité, on regarde si on l'a déjà rencontré $num_authority = $authority_infos['id']; $query = "select id_authority_source,num_authority from authorities_sources where authority_number = '" . $authority_number . "' and num_origin_authority='" . $id_origin_authority . "' and authority_type = '" . $type . "'"; $result = pmb_mysql_query($query) or die("can't select authorities_sources :" . $query); if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $num_authority = $row->num_authority; $num_authority_source = $row->id_authority_source; // on cherche la préférence... dès fois que... $query = "select id_authority_source, num_authority from authorities_sources where authority_number = '" . $authority_number . "' and authority_type = '" . $type . "' and authority_favorite = 1"; $result = pmb_mysql_query($query) or die("can't select authorities_sources :" . $query); if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $num_authority = $row->num_authority; $num_authority_source = $row->id_authority_source; } } else { // on importe l'autorité dans la base si elle n'a pas d'id if ($num_authority == 0) { switch ($type) { case "author": $num_authority = auteur::import($authority_infos); break; case "uniform_title": $num_authority = titre_uniforme::import($authority_infos); break; case "category": $num_authority = category::import($authority_infos); break; case "collection": $num_authority = collection::import($authority_infos); break; case "subcollection": $num_authority = subcollection::import($authority_infos); break; case "serie": break; } } // on intègre la source de l'autorité $query = "insert into authorities_sources set\n\t\t\tnum_authority = '{$num_authority}',\n\t\t\tauthority_number = '" . $authority_number . "',\n\t\t\tauthority_type = '{$type}',\n\t\t\tnum_origin_authority = " . $id_origin_authority . ",\n\t\t\timport_date = now()"; pmb_mysql_query($query) or die("can't insert authorities_sources :" . $query); $num_authority_source = pmb_mysql_insert_id(); //////////////////////////////////////////////////////////////// if ($opac_enrichment_bnf_sparql && $type == 'author') { auteur::author_enrichment($num_authority); } } return $num_authority; }
$bouton_ajouter = "<input type='button' class='bouton_small' onclick=\"document.location='{$base_url}&action=add&deb_rech='+this.form.f_user_input.value\" value='{$msg['176']}' />"; } // fonctions d'affichage des membres de la page switch ($action) { case 'add': $sub_collection_form = str_replace("!!deb_saisie!!", htmlentities(stripslashes($f_user_input), ENT_QUOTES, $charset), $sub_collection_form); print $sub_collection_form; break; case 'update': require_once "{$class_path}/editor.class.php"; require_once "{$class_path}/collection.class.php"; require_once "{$class_path}/subcollection.class.php"; $value['name'] = $collection_nom; $value['parent'] = $coll_id; $value['issn'] = $issn; $collection = new subcollection(); $collection->update($value); $sel_search_form = str_replace("!!bouton_ajouter!!", $bouton_ajouter, $sel_search_form); $sel_search_form = str_replace("!!deb_rech!!", htmlentities(stripslashes($f_user_input), ENT_QUOTES, $charset), $sel_search_form); print $sel_search_form; print $jscript; show_results($dbh, $collection_nom, 0, 0, $collection->id); break; default: $sel_search_form = str_replace("!!bouton_ajouter!!", $bouton_ajouter, $sel_search_form); $sel_search_form = str_replace("!!deb_rech!!", htmlentities(stripslashes($f_user_input), ENT_QUOTES, $charset), $sel_search_form); print $sel_search_form; print $jscript; show_results($dbh, $user_input, $nbr_lignes, $page); break; }
// +-------------------------------------------------+ // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: subcoll_see.inc.php,v 1.48.2.1 2014-12-16 13:58:15 jpermanne Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } require_once $base_path . '/includes/templates/subcollection.tpl.php'; require_once "{$class_path}/aut_link.class.php"; print "<div id='aut_details'>\n\n\t\t<h3><span>{$msg['detail_coll']}</span></h3>\n"; print "<div id='aut_details_container'>\n"; if ($id) { $id += 0; // affichage des informations sur la collection print "<div id=\"aut_see\">\n"; $ourSubcoll = new subcollection($id); print pmb_bidi($ourSubcoll->print_resume()); $aut_link = new aut_link(AUT_TABLE_SUB_COLLECTIONS, $id); print pmb_bidi($aut_link->get_display()); print "</div><!-- fermeture #aut_see -->\n"; print "<div id='aut_details_liste'>\n"; // affichage des notices associées print "<h3>{$msg['available_docs_in_subcoll']}</h3>\n"; //droits d'acces emprunteur/notice $acces_j = ''; if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) { require_once "{$class_path}/acces.class.php"; $ac = new acces(); $dom_2 = $ac->setDomain(2); $acces_j = $dom_2->getJoin($_SESSION['id_empr_session'], 4, 'notice_id'); }
case 'update': // mise à jour d'une sous collection $collection = new subcollection($id); $coll = array('name' => $collection_nom, 'parent' => $coll_id, 'issn' => $issn, 'subcollection_web' => $subcollection_web, 'comment' => $comment, 'statut' => $authority_statut); $collection->update($coll); include './autorites/subcollections/sub_collections_list.inc.php'; break; case 'collection_form': // création d'une sous collection if (!$id) { // affichage du form pour création $collection = new subcollection(); $collection->show_form(); } else { // affichage du form pour modification $collection = new subcollection($id); $collection->show_form(); } break; case 'collection_last': $last_param = 1; $tri_param = "order by sub_coll_id desc "; $limit_param = "limit 0, {$pmb_nb_lastautorities} "; $clef = ""; $nbr_lignes = 0; include './autorites/subcollections/sub_collections_list.inc.php'; break; default: // affichage du début de la liste (par défaut) include './autorites/subcollections/sub_collections_list.inc.php'; break;
function keep_authority_infos($authority_number, $type, $origin_authority, $notice_id, $authority_infos = array()) { //on a un numéro d'autorité, on regarde si on l'a déjà rencontré $query = "select id_authority_source,num_authority from authorities_sources where authority_number = '" . $authority_number . "' and num_origin_authority='" . $origin_authority . "' and authority_type = '" . $type . "'"; $result = mysql_query($query); if (mysql_num_rows($result)) { $row = mysql_fetch_object($result); $num_authority = $row->num_authority; $num_authority_source = $row->id_authority_source; // on cherche la préférence... dès fois que... $query = "select id_authority_source, num_authority from authorities_sources where authority_number = '" . $authority_number . "' and authority_type = '" . $type . "' and authority_favorite = 1"; $result = mysql_query($query); if (mysql_num_rows($result)) { $row = mysql_fetch_object($result); $num_authority = $row->num_authority; $num_authority_source = $row->id_authority_source; } } else { // c'est un petit nouveau switch ($type) { case "author": $num_authority = auteur::import($authority_infos); break; case "uniform_title": $num_authority = titre_uniforme::import($authority_infos); break; case "category": $num_authority = category::import($authority_infos); break; case "collection": $num_authority = collection::import($authority_infos); break; case "subcollection": $num_authority = subcollection::import($authority_infos); break; case "serie": break; } $query = "insert into authorities_sources set \n\t\t\tnum_authority = '{$num_authority}',\n\t\t\tauthority_number = '" . $authority_number . "',\n\t\t\tauthority_type = '{$type}',\n\t\t\tnum_origin_authority = " . $origin_authority . ",\n\t\t\timport_date = now()"; mysql_query($query); $num_authority_source = mysql_insert_id(); } //certaines autorités sont créés avant la notice... if ($notice_id != 0) { $query = "insert into notices_authorities_sources set \n\t\tnum_authority_source = " . $num_authority_source . ",\n\t\tnum_notice = " . $notice_id; mysql_query($query); } return $num_authority; }
public function check_if_exists($data) { switch ($data['type_authority']) { case "collection": $id = collection::check_if_exists($data); break; case "subcollection": $id = subcollection::check_if_exists($data); break; } return $id; }
public function create_authority() { switch ($this->notice->type) { case "author": $this->authority_id = auteur::import($this->notice->specifics_data); break; case "uniform_title": $this->authority_id = titre_uniforme::import($this->notice->specifics_data); break; case "collection": $this->authority_id = collection::import($this->notice->specifics_data); if ($this->authority_id != 0 && $this->notice->specifics_data['subcollections']) { for ($i = 0; $i < count($this->notice->specifics_data['subcollections']); $i++) { $this->notice->specifics_data['subcollections'][$i]['coll_parent'] = $this->authority_id; $subcoll_id = subcollection::check_if_exists($this->notice->specifics_data['subcollections'][$i]); if ($subcoll_id != 0 && $this->notice->specifics_data['subcollections'][$i]['authority_number']) { $query = "insert into authorities_sources set \n\t\t\t\t\t\t\t\t\tnum_authority = " . $subcoll_id . ",\n\t\t\t\t\t\t\t\t\tauthority_number = '" . $this->notice->specifics_data['subcollections'][$i]['authority_number'] . "',\t\n\t\t\t\t\t\t\t\t\tauthority_type = 'subcollection',\n\t\t\t\t\t\t\t\t\tnum_origin_authority = " . $this->num_origin . ",\n\t\t\t\t\t\t\t\t\tauthority_favorite = 0,\n\t\t\t\t\t\t\t\t\timport_date = now()"; mysql_query($query); } } } break; case "subcollection": $this->authority_id = subcollection::import($this->notice->specifics_data); if ($this->authority_id != 0 && $this->notice->specifics_data['collection'] && $this->notice->specifics_data['collection']['authority_number']) { $coll_id = collection::check_if_exists($this->notice->specifics_data['collection']); $query = "insert into authorities_sources set \n\t\t\t\t\t\t\tnum_authority = " . $coll_id . ",\n\t\t\t\t\t\t\tauthority_number = '" . $this->notice->specifics_data['collection']['authority_number'] . "',\t\n\t\t\t\t\t\t\tauthority_type = 'collection',\n\t\t\t\t\t\t\tnum_origin_authority = " . $this->num_origin . ",\n\t\t\t\t\t\t\tauthority_favorite = 0,\n\t\t\t\t\t\t\timport_date = now()"; mysql_query($query); } break; case "category": $this->authority_id = category::import($this->notice->specifics_data, $this->id_thesaurus, $this->get_parent_category(), $this->notice->common_data['lang']); break; default: // on fait rien... break; } if ($this->authority_id) { $query = "insert into authorities_sources set \n\t\t\t\tnum_authority = " . $this->authority_id . ",\n\t\t\t\tauthority_number = '" . $this->notice->common_data['authority_number'] . "',\t\n\t\t\t\tauthority_type = '" . $this->notice->type . "',\n\t\t\t\tnum_origin_authority = " . $this->num_origin . ",\n\t\t\t\tauthority_favorite = 1,\n\t\t\t\timport_date = now(),\n\t\t\t\tupdate_date = now()"; mysql_query($query); } else { return false; } }
function update($value, $force_creation = false) { global $dbh; global $msg, $charset; global $include_path; //si on a pas d'id, on peut avoir les infos de la collection if (!$value['parent']) { if ($value['collection']) { //on les a, on crée l'éditeur $value['collection'] = stripslashes_array($value['collection']); //La fonction d'import fait les addslashes contrairement à l'update $value['parent'] = collection::import($value['collection']); } } if (!$value['name'] || !$value['parent']) { return false; } // nettoyage des valeurs en entrée $value['name'] = clean_string($value['name']); // construction de la requête $requete = "SET sub_coll_name='{$value['name']}', "; $requete .= "sub_coll_parent='{$value['parent']}', "; $requete .= "sub_coll_issn='{$value['issn']}', "; $requete .= "subcollection_web='{$value['subcollection_web']}', "; $requete .= "subcollection_comment='{$value['comment']}', "; $requete .= "index_sub_coll=' " . strip_empty_words($value[name]) . " " . strip_empty_words($value["issn"]) . " '"; if ($this->id) { // update $requete = 'UPDATE sub_collections ' . $requete; $requete .= ' WHERE sub_coll_id=' . $this->id . ' '; if (mysql_query($requete, $dbh)) { $requete = "select collection_parent from collections WHERE collection_id='" . $value[parent] . "' "; $res = mysql_query($requete, $dbh); $ed_parent = mysql_result($res, 0, 0); $requete = "update notices set ed1_id='{$ed_parent}', coll_id='" . $value[parent] . "' WHERE subcoll_id='" . $this->id . "' "; $res = mysql_query($requete, $dbh); $aut_link = new aut_link(AUT_TABLE_SUB_COLLECTIONS, $this->id); $aut_link->save_form(); $aut_pperso = new aut_pperso("subcollection", $this->id); $aut_pperso->save_form(); audit::insert_modif(AUDIT_SUB_COLLECTION, $this->id); subcollection::update_index($this->id); return TRUE; } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[178], htmlentities($msg[182] . " -> " . $this->display, ENT_QUOTES, $charset)); return FALSE; } } else { if (!$force_creation) { // création : s'assurer que la sous-collection n'existe pas déjà if ($id_subcollection_exists = subcollection::check_if_exists($value)) { $subcollection_exists = new subcollection($id_subcollection_exists); require_once "{$include_path}/user_error.inc.php"; warning($msg[177], htmlentities($msg[219] . " -> " . $subcollection_exists->display, ENT_QUOTES, $charset)); return FALSE; } } $requete = 'INSERT INTO sub_collections ' . $requete . ';'; if (mysql_query($requete, $dbh)) { $this->id = mysql_insert_id(); $aut_link = new aut_link(AUT_TABLE_SUB_COLLECTIONS, $this->id); $aut_link->save_form(); $aut_pperso = new aut_pperso("subcollection", $this->id); $aut_pperso->save_form(); audit::insert_creation(AUDIT_SUB_COLLECTION, $this->id); return TRUE; } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[177], htmlentities($msg[182] . " -> " . $requete, ENT_QUOTES, $charset)); return FALSE; } } }