function indexGlobal() { global $msg, $dbh, $charset, $PMBusername; if (SESSrights & ADMINISTRATION_AUTH) { $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_global"], ENT_QUOTES, $charset) . "</h3>"; //remise a zero de la table au début mysql_query("delete from notices_global_index", $dbh); mysql_query("delete from notices_mots_global_index", $dbh); $query = mysql_query("select notice_id from notices order by notice_id"); if (mysql_num_rows($query)) { while ($mesNotices = mysql_fetch_assoc($query)) { // Mise à jour de la table "notices_global_index" notice::majNoticesGlobalIndex($mesNotices['notice_id']); // Mise à jour de la table "notices_mots_global_index" notice::majNoticesMotsGlobalIndex($mesNotices['notice_id']); } mysql_free_result($query); } $not = mysql_query("SELECT count(1) FROM notices_global_index", $dbh); $count = mysql_result($not, 0, 0); $result .= $count . " " . htmlentities($msg["nettoyage_res_reindex_global"], ENT_QUOTES, $charset); } else { $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername); } return $result; }
if ($result) { include './catalog/notices/isbd.inc.php'; } else { // echec de la requete error_message($libelle, $msg[281], 1, "./catalog.php"); } //Recherche du titre uniforme automatique global $opac_enrichment_bnf_sparql; $opac_enrichment_bnf_sparql = 1; $titre_uniforme = notice::getAutomaticTu($id); // permet de charger la bonne langue, mot vide... $info = notice::indexation_prepare($id); // Mise a jour des index de la notice notice::majNotices($id); // Mise a jour de la table notices_global_index notice::majNoticesGlobalIndex($id); // Mise a jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($id); // restaure l'environnement de langue notice::indexation_restaure($info); //synchro_rdf if ($pmb_synchro_rdf) { $synchro_rdf->addRdf($id, 0); } } else { if ($f_tit1 == "") { // erreur : le champ tit1 est vide error_message($libelle, $notitle_message, 1, "./catalog.php"); } else { error_message_history($msg["notice_champs_perso"], $p_perso->error_message, 1); }
if (pmb_mysql_num_rows($query)) { // définition de l'état de la jauge $state = floor($start / ($count / $jauge_size)); $state .= "px"; // mise à jour de l'affichage de la jauge print "<table border='0' align='center' width='{$jauge_size}' cellpadding='0'><tr><td class='jauge' width='100%'>"; print "<img src='../../images/jauge.png' width='{$state}' height='16px'></td></tr></table>"; // calcul pourcentage avancement $percent = floor($start / $count * 100); // affichage du % d'avancement et de l'état print "<div align='center'>{$percent}%</div>"; while ($mesNotices = pmb_mysql_fetch_assoc($query)) { // permet de charger la bonne langue, mot vide... $info = notice::indexation_prepare($mesNotices['notice_id']); // Mise à jour de la table "notices_global_index" notice::majNoticesGlobalIndex($mesNotices['notice_id']); // Mise à jour de la table "notices_mots_global_index" notice::majNoticesMotsGlobalIndex($mesNotices['notice_id']); // restaure l'environnement de langue notice::indexation_restaure($info); } pmb_mysql_free_result($query); $next = $start + $lot; print "\n\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t<input type='hidden' name='start' value=\"{$next}\">\n\t<input type='hidden' name='count' value=\"{$count}\">\n\t</form>\n\t<script type=\"text/javascript\"><!-- \n\tsetTimeout(\"document.forms['current_state'].submit()\",1000); \n\t-->\n\t</script>"; } else { $spec = $spec - INDEX_GLOBAL; $not = pmb_mysql_query("SELECT count(1) FROM notices_global_index", $dbh); $compte = pmb_mysql_result($not, 0, 0); $v_state .= "<br /><img src=../../images/d.gif hspace=3>" . htmlentities($msg["nettoyage_reindex_global"], ENT_QUOTES, $charset) . " :"; $v_state .= $compte . " " . htmlentities($msg["nettoyage_res_reindex_global"], ENT_QUOTES, $charset); print "\n\t\t<form class='form-{$current_module}' name='process_state' action='./clean.php' 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\t<script type=\"text/javascript\"><!--\n\t\t\tdocument.forms['process_state'].submit();\n\t\t\t-->\n\t\t</script>";
static function update_index($id) { global $dbh; global $include_path; $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/collections/champs_base.xml", "authorities", AUT_TABLE_COLLECTIONS); $indexation_authority->maj($id); // On cherche tous les n-uplet de la table notice correspondant à cette collection. $found = pmb_mysql_query("select distinct notice_id from notices where coll_id='" . $id . "'", $dbh); // Pour chaque n-uplet trouvés on met a jour la table notice_global_index avec la collection modifiée : while ($mesNotices = pmb_mysql_fetch_object($found)) { $notice_id = $mesNotices->notice_id; notice::majNoticesGlobalIndex($notice_id); notice::majNoticesMotsGlobalIndex($notice_id, 'collection'); } }
public function create_notice() { global $dbh; global $pmb_keyword_sep; $fields = "\n\t\t\ttit1='" . addslashes($this->title) . "',\n\t\t\tn_resume='" . addslashes($this->summary) . "',\n\t\t\tlien='" . addslashes($this->url) . "',\n\t\t\tthumbnail_url='" . addslashes($this->logo_url) . "',\n\t\t\tdate_parution='" . addslashes($this->publication_date) . "',\n\t\t\tindex_l='" . addslashes(implode($pmb_keyword_sep, $this->tags)) . "'\n\t\t"; $req = "INSERT INTO notices SET {$fields} "; pmb_mysql_query($req, $dbh); $num_notice = pmb_mysql_insert_id(); if (!$num_notice) { return array(); } $query .= "update docwatch_items set\titem_num_notice = '" . $num_notice . "' where id_item = '" . $this->id . "'"; pmb_mysql_query($query, $dbh); // permet de charger la bonne langue, mot vide... $info = notice::indexation_prepare($num_notice); // Mise a jour des index de la notice notice::majNotices($num_notice); // Mise a jour de la table notices_global_index notice::majNoticesGlobalIndex($num_notice); // Mise a jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($num_notice); // restaure l'environnement de langue notice::indexation_restaure($info); return array('id' => $num_notice, 'title' => $this->title, 'link' => "./catalog.php?categ=isbd&id=" . $num_notice); }
public function create_record_child($id_parent, $data) { global $dbh; global $pmb_nomenclature_record_children_link; $tit1 = "Notice fille temporaire de la nomenclature {$id_parent}"; $fields = "\r\n\t\ttit1='" . addslashes($tit1) . "'\r\n\t\t"; $req = "INSERT INTO notices SET {$fields} "; pmb_mysql_query($req, $dbh); $this->id = pmb_mysql_insert_id(); if (!$this->id) { return 0; } if (!$data["rank"]) { $data["rank"] = 1; } $requete = 'INSERT INTO notices_relations VALUES("' . $this->id . '","' . $id_parent . '","' . $pmb_nomenclature_record_children_link . '","' . $data["rank"] . '")'; pmb_mysql_query($requete, $dbh); $this->save($data); $this->fetch_datas(); $data = $this->get_data(); $tit1 = $data["instrument_name"] . $data["voice_name"]; if ($data["musicstand_name"]) { $tit1 .= " / " . $data["musicstand_name"]; } if ($data["formation_label"]) { $tit1 .= " / " . $data["formation_label"]; } $fields = "\r\n\t\ttit1='" . addslashes($tit1) . "'\r\n\t\t"; $req = "UPDATE notices SET {$fields} where notice_id= " . $this->id; pmb_mysql_query($req, $dbh); // permet de charger la bonne langue, mot vide... $info = notice::indexation_prepare($this->id); // Mise a jour des index de la notice notice::majNotices($this->id); // Mise a jour de la table notices_global_index notice::majNoticesGlobalIndex($this->id); // Mise a jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($this->id); // restaure l'environnement de langue notice::indexation_restaure($info); return array('id' => $this->id, 'title' => $tit1); }
public function create_notice() { global $dbh; global $pmb_keyword_sep; if (docwatch_watch::check_watch_rights($this->num_watch)) { /** Récupération des paramètres défini dans la veille pour la création de notice à partir de ses items **/ $query = "select watch_record_default_type, watch_record_default_status from docwatch_watches where id_watch =" . $this->num_watch; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $record_type = $row->watch_record_default_type; $record_status = $row->watch_record_default_status; } else { return array(); } $tab_tag = array(); foreach ($this->tags as $tag) { $tab_tag[] = $tag["label"]; } $fields = "\n\t\t\t\ttit1='" . addslashes($this->title) . "',\n\t\t\t\tn_resume='" . addslashes($this->summary) . "',\n\t\t\t\tlien='" . addslashes($this->url) . "',\n\t\t\t\tthumbnail_url='" . addslashes($this->logo_url) . "',\n\t\t\t\tdate_parution='" . addslashes($this->publication_date) . "',\n\t\t\t\tyear='" . addslashes(format_date($this->publication_date)) . "',\n\t\t\t\ttypdoc='" . addslashes($record_type) . "',\n\t\t\t\tstatut='" . addslashes($record_status) . "',\n\t\t\t\tindex_l='" . addslashes(implode($pmb_keyword_sep, $tab_tag)) . "'\n\t\t\t"; $req = "INSERT INTO notices SET {$fields} "; pmb_mysql_query($req, $dbh); $num_notice = pmb_mysql_insert_id(); if (!$num_notice) { return array(); } foreach ($this->descriptors as $num_categ => $label) { $query = "insert into notices_categories set notcateg_notice = '" . $num_notice . "', num_noeud='" . $num_categ . "'"; pmb_mysql_query($query, $dbh); } $query = "update docwatch_items set\titem_num_notice = '" . $num_notice . "' where id_item = '" . $this->id . "'"; pmb_mysql_query($query, $dbh); $this->set_num_notice($num_notice); // permet de charger la bonne langue, mot vide... $info = notice::indexation_prepare($num_notice); // Mise a jour des index de la notice notice::majNotices($num_notice); // Mise a jour de la table notices_global_index notice::majNoticesGlobalIndex($num_notice); // Mise a jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($num_notice); // restaure l'environnement de langue notice::indexation_restaure($info); return array('id' => $num_notice, 'title' => $this->title, 'link' => "./catalog.php?categ=isbd&id=" . $num_notice); } }
function import_basic($notices, $params = array(), $with_expl = false) { global $base_path, $class_path, $include_path, $dbh, $msg, $charset; global $deflt_integration_notice_statut, $deflt_lenders, $deflt_docs_statut, $deflt_docs_location; $log = array(); //On contrôle tous les paramètres obligatoires if (!$params["func_import"]) { $params["func_import"] = "func_bdp.inc.php"; //Function d'import à utiliser } if (file_exists($base_path . "/admin/import/" . $params["func_import"])) { require_once $base_path . "/admin/import/" . $params["func_import"]; } else { require_once $base_path . "/admin/import/func_bdp.inc.php"; } //Notices if (!isset($params["isbn_mandatory"])) { $params["isbn_mandatory"] = "0"; } //ISBN obligatoire ? if (!isset($params["isbn_dedoublonnage"])) { $params["isbn_dedoublonnage"] = "1"; } //Dédoublonnage sur ISBN ? if (!isset($params["isbn_only"])) { $params["isbn_only"] = "0"; } //Que les ISBN if (!isset($params["statutnot"])) { $params["statutnot"] = $deflt_integration_notice_statut; } //Statut des notices importées -> On met la valeur du paramètre utilisateur "Statut de notice par défaut en intégration de notice" if (!isset($params["link_generate"])) { $params["link_generate"] = "0"; } //Générer les liens entre notices ? if (!isset($params["authorities_notices"])) { $params["authorities_notices"] = "0"; } //Tenir compte des notices d'autorités if (!isset($params["authorities_default_origin"])) { $params["authorities_default_origin"] = ""; } //Origine par défaut des autorités si non précisé dans les notices //Exemplaires if ($with_expl) { if (!isset($params["book_lender_id"])) { $params["book_lender_id"] = $deflt_lenders; } //Propriétaire -> On met la valeur du paramètre utilisateur "Propriétaire par défaut en création d'exemplaire" if (!isset($params["book_statut_id"])) { $params["book_statut_id"] = $deflt_docs_statut; } //Statut -> On met la valeur du paramètre utilisateur "Statut de document par défaut en création d'exemplaire" if (!isset($params["book_location_id"])) { $params["book_location_id"] = $deflt_docs_location; } //Localisation -> On met la valeur du paramètre utilisateur "Localisation du document par défaut en création d'exemplaire" if (!isset($params["cote_mandatory"])) { $params["cote_mandatory"] = "0"; } //Cote obligatoire ? if (!isset($params["tdoc_codage"])) { $params["tdoc_codage"] = "0"; } //Types de document Codage du propriétaire ? if (!isset($params["statisdoc_codage"])) { $params["statisdoc_codage"] = "0"; } //Codes statistiques Codage du propriétaire ? if (!isset($params["sdoc_codage"])) { $params["sdoc_codage"] = "0"; } //Sections Codage du propriétaire ? } //Find de contrôle des paramètres obligatoires //On rend global tous les paramètres passés (et pas forcément que les obligatoires) pour la suite foreach ($params as $key => $value) { global ${$key}; ${$key} = $value; } if (count($notices)) { ob_start(); //On temporise toutes les sorties (dans le cas ou dans la fonction d'import on fait des sorties écrans directement) $nbtot_notice = count($notices); $notice_deja_presente = 0; $notice_rejetee = 0; global $notices_crees, $notices_a_creer, $bulletins_crees, $bulletins_a_creer; $notices_crees = $notices_a_creer = $bulletins_crees = $bulletins_a_creer = array(); if ($with_expl) { global $section_995, $typdoc_995, $codstatdoc_995, $nb_expl_ignores; $section_995_ = new marc_list("section_995"); $section_995 = $section_995_->table; $typdoc_995_ = new marc_list("typdoc_995"); $typdoc_995 = $typdoc_995_->table; $codstatdoc_995_ = new marc_list("codstatdoc_995"); $codstatdoc_995 = $codstatdoc_995_->table; $nb_expl_ignores = 0; } foreach ($notices as $notice) { $notice = utf8_decode($notice); $res_lecture = recup_noticeunimarc($notice); if ($params["link_generate"]) { recup_noticeunimarc_link($notice); } global $tit_200a; if (!$res_lecture || !$tit_200a[0]) { $res_lecture = 0; $fp = fopen($base_path . "/temp/err_import.unimarc", "a+"); fwrite($fp, $notice); fclose($fp); $notice_rejetee++; } else { recup_noticeunimarc_suite($notice); global $isbn, $EAN, $issn_011, $collection_225, $collection_410, $code, $code10, $isbn_OK, $notice_id; if ($isbn[0] == "NULL") { $isbn[0] = ""; } // si isbn vide, on va tenter de prendre l'EAN stocké en 345$b if ($isbn[0] == "") { $isbn[0] = $EAN[0]; } // si isbn vide, on va tenter de prendre le serial en 011 if ($isbn[0] == "") { $isbn[0] = $issn_011[0]; } // si ISBN obligatoire et isbn toujours vide : if ($params["isbn_mandatory"] == 1 && $isbn[0] == "") { // on va tenter de prendre l'ISSN stocké en 225$x $isbn[0] = $collection_225[0]['x']; // si isbn toujours vide, on va tenter de prendre l'ISSN stocké en 410$x if ($isbn[0] == "") { $isbn[0] = $collection_410[0]['x']; } } // on commence par voir ce que le code est (basé sur la recherche par code du module catalogage $ex_query = clean_string($isbn[0]); $EAN = ''; $isbn = ''; $code = ''; $code10 = ''; if (isEAN($ex_query)) { // la saisie est un EAN -> on tente de le formater en ISBN $EAN = $ex_query; $isbn = EANtoISBN($ex_query); // si échec, on prend l'EAN comme il vient if (!$isbn) { $code = str_replace("*", "%", $ex_query); } else { $code = $isbn; $code10 = formatISBN($code, 10); } } else { if (isISBN($ex_query)) { // si la saisie est un ISBN $isbn = formatISBN($ex_query); // si échec, ISBN erroné on le prend sous cette forme if (!$isbn) { $code = str_replace("*", "%", $ex_query); } else { $code10 = $isbn; $code = formatISBN($code10, 13); } } else { // ce n'est rien de tout ça, on prend la saisie telle quelle $code = str_replace("*", "%", $ex_query); } } $isbn_OK = $code; $new_notice = 0; $notice_id = 0; // le paramétrage est-il : dédoublonnage sur code ? / Ne dédoublonner que sur code ISBN (ignorer les ISSN) ? if ($params["isbn_dedoublonnage"] && !$params["isbn_only"] || $params["isbn_dedoublonnage"] && $params["isbn_only"] && isISBN($isbn)) { $trouvees = 0; if ($EAN && $isbn) { // cas des EAN purs : constitution de la requête $requete = "SELECT distinct notice_id FROM notices "; $requete .= " WHERE notices.code in ('{$code}','{$EAN}'" . ($code10 ? ",'{$code10}'" : "") . ") limit 1"; $myQuery = mysql_query($requete, $dbh); $trouvees = mysql_num_rows($myQuery); } elseif ($isbn) { // recherche d'un isbn $requete = "SELECT distinct notice_id FROM notices "; $requete .= " WHERE notices.code in ('{$code}'" . ($code10 ? ",'{$code10}'" : "") . ") limit 1"; $myQuery = mysql_query($requete, $dbh); $trouvees = mysql_num_rows($myQuery); } elseif ($code) { // note : le code est recherché dans le champ code des notices // (cas des code-barres disques qui échappent à l'EAN) // $requete = "SELECT notice_id FROM notices "; $requete .= " WHERE notices.code like '{$code}' limit 10"; $myQuery = mysql_query($requete, $dbh); $trouvees = mysql_num_rows($myQuery); } // dédoublonnage sur isbn if ($EAN || $isbn || $code) { if ($trouvees == 0) { $new_notice = 1; } else { $new_notice = 0; $notice_id = mysql_result($myQuery, 0, "notice_id"); $sql_log = mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', '" . $msg[542] . " {$EAN} || {$isbn} || {$code} " . addslashes($tit_200a[0]) . "') "); } } else { if ($params["isbn_mandatory"] == 1) { $sql_log = mysql_query("insert into error_log (error_origin, error_text) values ('import_" . addslashes(SESSid) . ".inc', '" . $msg[543] . "') "); } else { $new_notice = 1; $sql_log = mysql_query("insert into error_log (error_origin, error_text) values ('import_" . addslashes(SESSid) . ".inc', '" . $msg[565] . "') "); } } } else { // pas de dédoublonnage if ($params["isbn_mandatory"] == 1 && $isbn_OK == "") { $sql_log = mysql_query("insert into error_log (error_origin, error_text) values ('import_" . addslashes(SESSid) . ".inc', '" . $msg[543] . "') "); } elseif ($isbn_OK) { $new_notice = 1; } else { $new_notice = 1; $sql_log = mysql_query("insert into error_log (error_origin, error_text) values ('import_" . addslashes(SESSid) . ".inc', '" . $msg[565] . "') "); } } /* the notice is new, we are going to import it... */ if ($new_notice == 1) { import_new_notice(); if ($params["link_generate"]) { import_notice_link(); } import_new_notice_suite(); // Mise à jour de la table "notices_global_index" notice::majNoticesGlobalIndex($notice_id); // Mise à jour de la table "notices_mots_global_index" notice::majNoticesMotsGlobalIndex($notice_id); } else { $notice_deja_presente++; //TRAITEMENT DES DOCS NUMERIQUES SUR NOTICE EXISTANTE global $add_explnum; //Fonction d'import func_ensai_ensae.inc.php if ($add_explnum === TRUE && function_exists("ajoute_explnum")) { ajoute_explnum(); } } // TRAITEMENT DES EXEMPLAIRES ICI if ($with_expl) { traite_exemplaires(); } } } //Fin du traitement des notices //Gestion des logs $formulaire = ""; $script = ""; $log["notice_deja_presente"] = $notice_deja_presente; $log["notice_rejetee"] = $notice_rejetee; $log["nbtot_notice"] = $nbtot_notice; $log["stdout"] = ob_get_contents(); if ($charset != "utf-8") { $log["stdout"] = utf8_encode($log["stdout"]); } ob_end_clean(); $gen_liste_log = ""; $resultat_liste = mysql_query("SELECT error_origin, error_text, count(*) as nb_error FROM error_log where error_origin in ('expl_" . addslashes(SESSid) . ".class','import_expl_" . addslashes(SESSid) . ".inc','iimport_expl_" . addslashes(SESSid) . ".inc','import_" . addslashes(SESSid) . ".inc.php', 'import_" . addslashes(SESSid) . ".inc','import_func_" . addslashes(SESSid) . ".inc.php') group by error_origin, error_text", $dbh); $nb_liste = mysql_num_rows($resultat_liste); if ($nb_liste > 0) { $i_log = 0; while ($i_log < $nb_liste) { $tmp = array(); $tmp["error_origin"] = mysql_result($resultat_liste, $i_log, "error_origin"); if ($charset != "utf-8") { $tmp["error_origin"] = utf8_encode($tmp["error_origin"]); } $tmp["error_text"] = mysql_result($resultat_liste, $i_log, "error_text"); if ($charset != "utf-8") { $tmp["error_text"] = utf8_encode($tmp["error_text"]); } $tmp["nb_error"] = mysql_result($resultat_liste, $i_log, "nb_error"); $log["error_log"][] = $tmp; $i_log++; } mysql_query("DELETE FROM error_log WHERE error_origin in ('expl_" . addslashes(SESSid) . ".class','import_expl_" . addslashes(SESSid) . ".inc','iimport_expl_" . addslashes(SESSid) . ".inc','import_" . addslashes(SESSid) . ".inc.php', 'import_" . addslashes(SESSid) . ".inc','import_func_" . addslashes(SESSid) . ".inc.php')", $dbh); } else { $log["result"] = $this->msg["import_basic_msg_ok"]; if ($charset != "utf-8") { $log["result"] = utf8_encode($log["result"]); } } } else { $log["result"] = $this->msg["import_basic_msg_ko"]; if ($charset != "utf-8") { $log["result"] = utf8_encode($log["result"]); } } return $log; }
function creer_lien_notice_bulletin($ancien_id = 0, $id_perio = 0, $id_bulletin = 0, $id_not_bull = 0, $titre_not_bull = "", $bulletin) { global $dbh, $msg, $isbn_OK, $tit_200a, $notice_id, $notices_crees, $statutnot; //On control que ce bulletin n'a pas déjà une notice $requete = "select num_notice from bulletins where bulletin_id='" . $id_bulletin . "'"; if ($id_not_bull) { $requete .= " and num_notice!='" . $id_not_bull . "'"; } $res = mysql_query($requete, $dbh); if (mysql_num_rows($res) && mysql_result($res, 0, 0)) { //Si j'ai déja une notice associé à ce bulletin je la récupère if ($id_not_bull) { //Si j'ai aussi un identifiant de notice de bulletin, je supprime le plus récent notice::del_notice($id_not_bull); mysql_query("insert into error_log (error_origin, error_text) values ('import_" . addslashes(SESSid) . ".inc', '" . $msg[542] . " {$id_unimarc} " . " {$isbn_OK} " . addslashes(clean_string(implode(" ; ", $tit_200a))) . "') ", $dbh); $id_notice_bulletin = mysql_result($res, 0, 0); //A voir pr modif } else { $id_notice_bulletin = mysql_result($res, 0, 0); } $notice_id = $id_notice_bulletin; } else { if ($titre_not_bull) { //Si j'ai un titre je créé la notice de bulletin $requete = "insert into notices (tit1,niveau_biblio, niveau_hierar,statut) values ('" . addslashes(clean_string($titre_not_bull)) . "', 'b', '2','" . $statutnot . "')"; mysql_query($requete, $dbh); $id_notice_bulletin = mysql_insert_id(); audit::insert_creation(AUDIT_NOTICE, $id_notice_bulletin); //calcul des droits d'accès s'ils sont activés calc_notice_acces_rights($id_notice_bulletin); // Mise à jour des index de la notice notice::majNotices($id_notice_bulletin); // Mise à jour de la table "notices_global_index" notice::majNoticesGlobalIndex($id_notice_bulletin); // Mise à jour de la table "notices_mots_global_index" notice::majNoticesMotsGlobalIndex($id_notice_bulletin); } else { $id_notice_bulletin = $id_not_bull; } //On créer le lien entre le bulletin et la notice de bulletin $requete = "update bulletins set num_notice='" . $id_notice_bulletin . "' where bulletin_id='" . $id_bulletin . "'"; mysql_query($requete, $dbh); } $notices_crees[$ancien_id] = $id_notice_bulletin; //Lien entre la notice de bulletin et la notice de periodique $requete = "insert into notices_relations(num_notice,linked_notice,relation_type) values ('" . $id_notice_bulletin . "','" . $id_perio . "','b')"; mysql_query($requete); if ($id_notice_bulletin && $bulletin["date"]) { $requete = "UPDATE notices SET year='" . addslashes(substr($bulletin["date"], 0, 4)) . "', date_parution='" . addslashes($bulletin["date"]) . "' WHERE notice_id='" . $id_notice_bulletin . "'"; mysql_query($requete); } return $id_notice_bulletin; }
$r = mysql_query($requete, $dbh) or die(mysql_error() . " <br />" . $requete); if (mysql_numrows($r)) { $loc = mysql_fetch_object($r); $tab_index_l = array(); $tab_index_l = explode($pmb_keyword_sep, trim($loc->index_l)); $tab_index_l[] = stripslashes($loc->libelle); for ($j = 0; $j < sizeof($tab_index_l); $j++) { if (!$tab_index_l[$j]) { unset($tab_index_l[$j]); } } $index_l = addslashes(implode($pmb_keyword_sep, $tab_index_l)); $index_matieres = " " . strip_empty_words($index_l) . " "; $requete = "update notices set index_l='" . $index_l . "',index_matieres='{$index_matieres}' where notice_id='" . $loc->num_notice . "'"; mysql_query($requete, $dbh) or die(mysql_error() . " <br />" . $requete); notice::majNoticesGlobalIndex($loc->num_notice); notice::majNoticesMotsGlobalIndex($loc->num_notice); $requete = "delete from tags where id_tag='" . $valid_id_tags[$i] . "'"; mysql_query($requete, $dbh) or die(mysql_error() . " <br />" . $requete); } } } break; case 'supprimer': for ($i = 0; $i < sizeof($valid_id_tags); $i++) { $acces_m = 1; if ($acces_jm) { $q = "select count(1) from tags {$acces_jm} where id_tag=" . $valid_id_tags[$i]; $r = mysql_query($q, $dbh); if (mysql_result($r, 0, 0) == 0) { $acces_m = 0;
} } // traitement des langues originales $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES "; while (list($key, $val) = each($f_langorg_form)) { $tmpcode_langue = $val['code']; if ($tmpcode_langue) { $tmpordre_langue = $val['ordre']; $rqt = $rqt_ins . " ('{$result}',1, '{$tmpcode_langue}', {$tmpordre_langue}) "; $res_ins = @pmb_mysql_query($rqt, $dbh); } } //Traitement des champs persos $p_perso->rec_fields_perso($result); // Mise à jour de la table notices_global_index notice::majNoticesGlobalIndex($result); // Mise à jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($result); if ($gestion_acces_active == 1) { //mise a jour des droits d'acces user_notice (idem notice mere perio) if ($gestion_acces_user_notice == 1) { $q = "replace into acces_res_1 select {$result}, res_prf_num, usr_prf_num, res_rights, res_mask from acces_res_1 where res_num=" . $myAnalysis->bulletin_notice; pmb_mysql_query($q, $dbh); } //mise a jour des droits d'acces empr_notice if ($gestion_acces_empr_notice == 1) { $dom_2 = $ac->setDomain(2); if ($analysis_id) { $dom_2->storeUserRights(1, $result, $res_prf, $chk_rights, $prf_rad, $r_rad); } else { $dom_2->storeUserRights(0, $result, $res_prf, $chk_rights, $prf_rad, $r_rad);
function update_index($id) { global $dbh; // On cherche tous les n-uplet de la table notice correspondant a cet auteur. $found = mysql_query("select distinct notice_id from notices where ed1_id='" . $id . "' OR ed2_id='" . $id . "'", $dbh); // Pour chaque n-uplet trouves on met a jour la table notice_global_index avec l'auteur modifie : while ($mesNotices = mysql_fetch_object($found)) { $notice_id = $mesNotices->notice_id; notice::majNoticesGlobalIndex($notice_id); notice::majNoticesMotsGlobalIndex($notice_id, 'publisher'); } }
function update_index($id) { global $dbh; // On cherche tous les n-uplet de la table notice correspondant à cet auteur. $found = mysql_query("select distinct(notice_id) from notices where tparent_id='" . $id . "'", $dbh); // Pour chaque n-uplet trouvés on met a jour la table notice_global_index avec l'auteur modifié : while ($mesNotices = mysql_fetch_object($found)) { $notice_id = $mesNotices->notice_id; notice::majNotices($notice_id); //Le titre de série est indexé dans les index de la notice notice::majNoticesGlobalIndex($notice_id); notice::majNoticesMotsGlobalIndex($notice_id, 'serie'); } }
static function update_index($id) { global $dbh; global $include_path; $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/publishers/champs_base.xml", "authorities", AUT_TABLE_PUBLISHERS); $indexation_authority->maj($id); // On cherche tous les n-uplet de la table notice correspondant a cet éditeur. $found = pmb_mysql_query("select distinct notice_id from notices where ed1_id='" . $id . "' OR ed2_id='" . $id . "'", $dbh); // Pour chaque n-uplet trouves on met a jour la table notice_global_index avec l'éditeur modifié : while ($mesNotices = pmb_mysql_fetch_object($found)) { $notice_id = $mesNotices->notice_id; notice::majNoticesGlobalIndex($notice_id); notice::majNoticesMotsGlobalIndex($notice_id, 'publisher'); } }
function import_new_notice_suite() { global $dbh; global $notice_id; global $bl, $hl; global $infos_4XX; global $hierarchic_level; global $bibliographic_level; global $doc_type; global $origine_notice; global $notices_crees; global $issn_011, $info_900; global $tit_200a; global $isbn; global $statutnot; global $info_003; global $info_336, $info_337; global $isbn_only, $isbn_dedoublonnage; if (isset($bibliographic_level) && isset($hierarchic_level)) { $niveau_biblio = $bibliographic_level . $hierarchic_level; } else { $niveau_biblio = $bl . $hl; } //num_notice = fille //linked_notice = mere $sens = array('mother' => array("linked_notice", "num_notice"), 'child' => array("num_notice", "linked_notice")); $link_type = array('412' => array('code' => "v", 'sens_link' => "child"), '413' => array('code' => "v", 'sens_link' => "mother"), '421' => array('code' => "e", 'sens_link' => "mother"), '422' => array('code' => "e", 'sens_link' => "child"), '423' => array('code' => "k", 'sens_link' => "child"), '430' => array('code' => "l", 'sens_link' => "child"), '431' => array('code' => "o", 'sens_link' => "mother"), '432' => array('code' => "t", 'sens_link' => "child"), '433' => array('code' => "o", 'sens_link' => "mother"), '434' => array('code' => "m", 'sens_link' => "child"), '435' => array('code' => "s", 'sens_link' => "child"), '436' => array('code' => "n", 'sens_link' => "mother"), '437' => array('code' => "o", 'sens_link' => "mother"), '440' => array('code' => "l", 'sens_link' => "mother"), '441' => array('code' => "o", 'sens_link' => "child"), '442' => array('code' => "t", 'sens_link' => "mother"), '443' => array('code' => "o", 'sens_link' => "child"), '444' => array('code' => "m", 'sens_link' => "mother"), '445' => array('code' => "s", 'sens_link' => "mother"), '446' => array('code' => "o", 'sens_link' => "child"), '447' => array('code' => "n", 'sens_link' => "child"), '451' => array('code' => "u", 'sens_link' => "child"), '452' => array('code' => "p", 'sens_link' => "child"), '453' => array('code' => "h", 'sens_link' => "mother"), '454' => array('code' => "h", 'sens_link' => "child"), '455' => array('code' => "q", 'sens_link' => "mother"), '456' => array('code' => "q", 'sens_link' => "child"), '520' => array('code' => "f", 'sens_link' => "child")); //dédoublonnage ! if ($isbn && $isbn_dedoublonnage) { $query = "select notice_id from notices where code like '" . $isbn . "' and notice_id != " . $notice_id; $result = mysql_query($query); if (mysql_num_rows($result)) { $row = mysql_fetch_object($result); notice::del_notice($notice_id); $notice_id = $row->notice_id; mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', '" . addslashes("La notice (" . $tit_200a[0] . ", " . $isbn . ") n'a pas été reprise car elle existe déjà en base (notice id: " . $notice_id . ")") . "') "); } } if (!$isbn_dedoublonnage || $isbn_only == 1) { $rq = "UPDATE notices SET code=REPLACE(code, '_pasToucheACa', '') WHERE notice_id = " . $notice_id; mysql_query($rq); } elseif ($issn_011[0]) { $query = "select notice_id from notices where code like '" . $issn_011[0] . "' and notice_id != " . $notice_id; $result = mysql_query($query); if (mysql_num_rows($result)) { while ($row = mysql_fetch_object($result)) { if (in_array($row->notice_id, $notices_crees)) { $old = new notice($row->notice_id); $old->replace($notice_id); $tab = array_flip($notices_crees); unset($tab[$row->notice_id]); $notices_crees = array_flip($tab); } else { notice::del_notice($notice_id); $notice_id = $row->notice_id; mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', '" . addslashes("La notice (" . $tit_200a[0] . ", " . $isbn . ") n'a pas été reprise car elle existe déjà en base (notice id: " . $notice_id . ")") . "') "); } } } } $n_gen_plus = ""; if (count($info_336)) { foreach ($info_336 as $value) { if ($tmp = trim($value)) { if ($n_gen_plus) { $n_gen_plus .= "\n"; } $n_gen_plus .= $tmp; } } } if (count($info_337)) { foreach ($info_337 as $value) { if ($tmp = trim($value)) { if ($n_gen_plus) { $n_gen_plus .= "\n"; } $n_gen_plus .= $tmp; } } } if ($n_gen_plus) { $requ = "UPDATE notices SET n_gen=IF(n_gen != '',CONCAT(n_gen,'\n" . addslashes($n_gen_plus) . "'),'" . addslashes($n_gen_plus) . "') WHERE notice_id = " . $notice_id; if (!mysql_query($requ)) { echo "Requête echoué: " . $requ . "<br/>"; } } switch ($niveau_biblio) { case "s1": case "s0": foreach ($infos_4XX as $key => $children) { foreach ($children as $child) { $issn = ""; //on commence par chercher si la notice existe $issn = traite_code_ISSN($child['x']); if ($issn) { $query = "select notice_id from notices where code ='" . $issn . "' and niveau_biblio = 's' and niveau_hierar = '1'"; $result = mysql_query($query); if (!mysql_num_rows($result)) { //la notice n'existe pas, il faut la créer... /* Origine de la notice */ $origine_not['nom'] = clean_string($origine_notice[0]['b']); $origine_not['pays'] = clean_string($origine_notice[0]['a']); $orinot_id = origine_notice::import($origine_not); if ($orinot_id == 0) { $orinot_id = 1; } $query = "insert into notices set \n\t\t\t\t\t\t\t\ttypdoc = '" . $doc_type . "',\n\t\t\t\t\t\t\t\ttit1 = '" . addslashes(clean_string($child['t'])) . "',\n\t\t\t\t\t\t\t\tcode = '" . $issn . "',\n\t\t\t\t\t\t\t\tniveau_biblio = 's',\n\t\t\t\t\t\t\t\tniveau_hierar = '1',\n\t\t\t\t\t\t\t\tstatut = " . $statutnot . ",\n\t\t\t\t\t\t\t\torigine_catalogage = '" . $orinot_id . "',\n\t\t\t\t\t\t\t\tcreate_date = sysdate(),\n\t\t\t\t\t\t\t\tupdate_date = sysdate()\n\t\t\t\t\t\t\t"; mysql_query($query); $child_id = mysql_insert_id(); $notices_crees[$child[0]] = $child_id; notice::majNotices($child_id); notice::majNoticesGlobalIndex($child_id); notice::majNoticesMotsGlobalIndex($child_id); } else { $child_id = mysql_result($result, 0, 0); } if ($child_id) { // on regarde si une relation similaire existe déjà... $query = "select relation_type from notices_relations where relation_type = '" . $link_type[$key]['code'] . "' and ((num_notice = " . $notice_id . " and linked_notice = " . $child_id . ") or (num_notice = " . $child_id . " and linked_notice = " . $notice_id . "))"; $result = mysql_query($query); if (!mysql_num_rows($result)) { $rank = 0; $query = "select count(rank) from notices_relations where relation_type = '" . $link_type[$key]['code'] . "' and "; if ($link_type[$key]['sens_link'] == "mother") { $query .= "num_notice = " . $child_id; } else { $query .= "num_notice = " . $notice_id; } $result = mysql_query($query); if (mysql_num_rows($result)) { $rank = mysql_result($result, 0, 0); } $query = "insert into notices_relations set \n\t\t\t\t\t\t\t\t\t" . $sens[$link_type[$key]['sens_link']][0] . " = " . $notice_id . ",\n\t\t\t\t\t\t\t\t\t" . $sens[$link_type[$key]['sens_link']][1] . " = " . $child_id . ",\n\t\t\t\t\t\t\t\t\trelation_type = '" . $link_type[$key]['code'] . "',\n\t\t\t\t\t\t\t\t\trank = " . ($rank + 1) . "\n\t\t\t\t\t\t\t\t"; mysql_query($query); } } } } } break; } if (count($info_900)) { for ($i = 0; $i < count($info_900); $i++) { if (trim($info_900[$i]["a"])) { if (!renseigne_cp_agro($info_900[$i], $notice_id)) { mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_" . addslashes(SESSid) . ".inc', '" . addslashes("La valeur : " . $info_900[$i]["a"] . " n'a pas été reprise dans le champ personnalisé : " . $info_900[$i]["n"] . " car le champ n'existe pas ou n'est pas défini de la même façon") . "') "); } } } } if ($tmp = trim($info_003[0])) { $requete = "SELECT notices_custom_origine FROM notices_custom_values WHERE notices_custom_champ=22 AND notices_custom_origine='" . $notice_id . "' AND notices_custom_small_text='" . addslashes($tmp) . "' "; $res = mysql_query($requete); if ($res && mysql_num_rows($res)) { } else { $requete = "INSERT INTO notices_custom_values(notices_custom_champ, notices_custom_origine, notices_custom_small_text) VALUES('22','" . $notice_id . "','" . addslashes($tmp) . "')"; mysql_query($requete); } } }
static function update_index($id) { global $dbh; // On cherche tous les n-uplet de la table notice correspondant à cet auteur. $found = pmb_mysql_query("select distinct responsability_notice from responsability where responsability_author='" . $id . "'", $dbh); // Pour chaque n-uplet trouvés on met a jour la table notice_global_index avec l'auteur modifié : while ($mesNotices = pmb_mysql_fetch_object($found)) { $notice_id = $mesNotices->responsability_notice; notice::majNoticesGlobalIndex($notice_id); notice::majNoticesMotsGlobalIndex($notice_id, 'author'); } // On met à jour les titres uniformes correspondant à cet auteur $found = pmb_mysql_query("select distinct responsability_tu_num from responsability_tu where responsability_tu_author_num='" . $id . "'", $dbh); // Pour chaque n-uplet trouvés on met a jour l'index du titre uniforme avec l'auteur modifié : while ($mesTu = pmb_mysql_fetch_object($found)) { titre_uniforme::update_index_tu($mesTu->responsability_tu_num); titre_uniforme::update_index($mesTu->responsability_tu_num); } }
function update_notice($notice_id) { global $pmb_type_audit; global $webdav_current_user_name, $webdav_current_user_id; global $gestion_acces_active, $gestion_acces_user_notice, $gestion_acces_empr_notice; $obj = $this; $type = $obj->type; $obj->update_notice_infos($notice_id); while ($obj = $obj->parentNode) { if ($obj->type != $type) { $type = $obj->type; $obj->update_notice_infos($notice_id); } } if ($pmb_type_audit) { $query = "INSERT INTO audit SET "; $query .= "type_obj='1', "; $query .= "object_id='{$notice_id}', "; $query .= "user_id='{$webdav_current_user_id}', "; $query .= "user_name='{$webdav_current_user_name}', "; $query .= "type_modif=2 "; $result = @pmb_mysql_query($query); } \notice::majNoticesGlobalIndex($notice_id); \notice::majNoticesMotsGlobalIndex($notice_id); //TODO - Calcul des droits sur la notice dans les 2 domaines... $ac = new \acces(); //pour la gestion if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1) { $dom_1 = $ac->setDomain(1); $dom_1->applyRessourceRights($notice_id); } //pour l'opac if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) { $dom_2 = $ac->setDomain(2); $dom_2->applyRessourceRights($notice_id); } }
static function majNoticesTotal($notice) { $info = notice::indexation_prepare($notice); notice::majNotices($notice); notice::majNoticesGlobalIndex($notice); notice::majNoticesMotsGlobalIndex($notice); notice::indexation_restaure($info); }
function update_in_database($id_notice = 0) { global $dbh; global $pmb_synchro_rdf; $new_notice = 2; $notice_retour = $id_notice; if (!$id_notice) { $retour = array(2, 0); return $retour; } //synchro_rdf if ($pmb_synchro_rdf) { $synchro_rdf = new synchro_rdf(); $synchro_rdf->delRdf($notice_retour, 0); } // traitement des titres uniformes global $pmb_use_uniform_title; if ($pmb_use_uniform_title) { if (count($this->titres_uniformes)) { $ntu = new tu_notice($id_notice); $ntu->update($this->titres_uniformes); } } for ($i = 0; $i < 2; $i++) { if ($this->editors[$i]['id']) { $editor_ids[$i] = $this->editors[$i]['id']; } else { $editor_ids[$i] = editeur::import($this->editors[$i]); } } if ($this->collection["id"]) { $collection_id = $this->collection["id"]; } else { $this->collection['parent'] = $editor_ids[0]; $collection_id = collection::import($this->collection); } if ($this->subcollection["id"]) { $subcollection_id = $this->subcollection["id"]; } else { $this->subcollection['coll_parent'] = $collection_id; $subcollection_id = subcollection::import($this->subcollection); $serie_id = serie::import(stripslashes($this->serie)); } /* traitement de Dewey */ if (!$this->internal_index) { if (!$this->dewey["new_comment"]) { $this->dewey["new_comment"] = ""; } if (!$this->dewey["new_pclass"]) { $this->dewey["new_pclass"] = ""; } $this->internal_index = indexint::import(clean_string($this->dewey[0]), clean_string($this->dewey["new_comment"]), clean_string($this->dewey["new_pclass"])); } $date_parution_z3950 = notice::get_date_parution($this->year); /* Origine de la notice */ $this->orinot_id = origine_notice::import($this->origine_notice); if ($this->orinot_id == 0) { $this->orinot_id = 1; } $sql_ins = "update notices set\n\t\t\ttypdoc \t='" . $this->document_type . "',\n\t\t\tcode \t ='" . $this->isbn . "',\t \n\t\t\ttit1 ='" . $this->titles[0] . "', \n\t\t\ttit2 ='" . $this->titles[1] . "', \n\t\t\ttit3 ='" . $this->titles[2] . "', \n\t\t\ttit4 ='" . $this->titles[3] . "', \n\t\t\ttparent_id ='" . $serie_id . "', \n\t\t\ttnvol ='" . $this->nbr_in_serie . "', \n\t\t\ted1_id =" . $editor_ids[0] . " , \n\t\t\ted2_id =" . $editor_ids[1] . " , \n\t\t\tyear ='" . $this->year . "', \n\t\t\tnpages ='" . $this->page_nbr . "', \n\t\t\till ='" . $this->illustration . "', \n\t\t\tsize ='" . $this->size . "', \n\t\t\taccomp ='" . $this->accompagnement . "', \n\t\t\tcoll_id =" . $collection_id . " , \n\t\t\tsubcoll_id =" . $subcollection_id . " , \n\t\t\tnocoll ='" . $this->nbr_in_collection . "', \n\t\t\tmention_edition ='" . $this->mention_edition . "', \n\t\t\tn_gen ='" . $this->general_note . "', \n\t\t\tn_contenu ='" . $this->content_note . "', \n\t\t\tn_resume ='" . $this->abstract_note . "', \n\t\t\tindexint ='" . $this->internal_index . "', \n\t\t\tstatut\t\t\t\t\t='" . $this->statut . "',\n\t\t\tcommentaire_gestion\t\t='" . $this->commentaire_gestion . "',\n\t\t\tindexation_lang\t\t\t='" . $this->indexation_lang . "',\n\t\t\tthumbnail_url\t\t\t='" . $this->thumbnail_url . "',\n\t\t\tindex_l ='" . clean_tags($this->free_index) . "', \n\t\t\tniveau_biblio ='" . $this->bibliographic_level . "', \n\t\t\tniveau_hierar ='" . $this->hierarchic_level . "', \n\t\t\tlien ='" . $this->link_url . "', \n\t\t\teformat ='" . $this->link_format . "', \n\t\t\torigine_catalogage ='" . $this->orinot_id . "', \n\t\t\tprix ='" . $this->prix . "',\n\t\t\tdate_parution \t\t\t='" . $date_parution_z3950 . "' \n\t\t\twhere notice_id='{$id_notice}' "; //echo "<pre>"; //print_r($this->aut_array); //echo "</pre>"; //echo $sql_ins."<br />"; //echo "<pre>"; //print_r($this->categories); //echo "</pre>"; //exit; $sql_result_ins = pmb_mysql_query($sql_ins) or die("Couldn't update notices : " . $sql_ins); $notice_retour = $id_notice; audit::insert_modif(AUDIT_NOTICE, $id_notice); // purge de la base des responsabilités de la notice intégrée... if ($notice_retour) { $rqt_del = "delete from responsability where responsability_notice='{$notice_retour}'"; $sql_result_del = pmb_mysql_query($rqt_del) or die("Couldn't purge table responsability : " . $rqt_del); } $rqt_ins = "insert into responsability (responsability_author, responsability_notice, responsability_fonction, responsability_type, responsability_ordre) VALUES "; for ($i = 0; $i < sizeof($this->aut_array); $i++) { $aut['id'] = clean_string($this->aut_array[$i]['id']); $aut['name'] = clean_string($this->aut_array[$i]['entree']); $aut['rejete'] = clean_string($this->aut_array[$i]['rejete']); $aut['date'] = clean_string($this->aut_array[$i]['date']); $aut['type'] = $this->aut_array[$i]['type_auteur']; $aut['subdivision'] = clean_string($this->aut_array[$i]['subdivision']); $aut['numero'] = clean_string($this->aut_array[$i]['numero']); $aut['lieu'] = clean_string($this->aut_array[$i]['lieu']); $aut['ville'] = clean_string($this->aut_array[$i]['ville']); $aut['pays'] = clean_string($this->aut_array[$i]['pays']); $aut['web'] = clean_string($this->aut_array[$i]['web']); $aut['author_comment'] = clean_string($this->aut_array[$i]['author_comment']); $aut['authority_number'] = clean_string($this->aut_array[$i]['authority_number']); /* Origine de l'autorité : on reprend les infos d'origine de la notice pour les attribuées aux origines des autorités */ $id_origine_auth = 0; $id_origine_auth = origin_authorities::import($this->origine_notice); if ($id_origine_auth == 0) { $id_origine_auth = 1; } // import de l'autorité auteur si elle n'existe pas et conservation des infos sur l'origine de l'autorité if ($aut['authority_number'] != '' && $id_origine_auth) { $this->aut_array[$i]["id"] = $this->insert_authority_infos($aut['authority_number'], "author", $id_origine_auth, $aut); } if (!$this->aut_array[$i]["id"]) { $this->aut_array[$i]["id"] = auteur::import($aut); } if ($this->aut_array[$i]["id"]) { $rqt = $rqt_ins . " (" . $this->aut_array[$i]["id"] . "," . $notice_retour . ",'" . $this->aut_array[$i]['fonction'] . "'," . $this->aut_array[$i]['responsabilite'] . "," . $i . ") "; $res_ins = pmb_mysql_query($rqt, $dbh); } } // traitement des categories if ($this->categorisation_type == "categorisation_auto") { traite_categories_enreg($notice_retour, $this->categories); } else { $rqt_del = "delete from notices_categories where notcateg_notice='{$notice_retour}' "; $res_del = @pmb_mysql_query($rqt_del, $dbh); $rqt_ins = "insert into notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES "; $rqt_ins_values = array(); foreach ($this->categories as $i => $category) { $id_categ = $category['categ_id']; if ($id_categ) { $rqt_ins_values[] = " ('{$notice_retour}','{$id_categ}', {$i}) "; } } $rqt_ins .= implode(",", $rqt_ins_values); $res_ins = @pmb_mysql_query($rqt_ins, $dbh); } // traitement des langues // langues de la publication $rqt_del = "delete from notices_langues where num_notice='{$notice_retour}' "; $res_del = pmb_mysql_query($rqt_del, $dbh); if (is_array($this->language_code) && count($this->language_code)) { $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES "; foreach ($this->language_code as $ordre_lang => $code_lang) { if ($code_lang) { $rqt = $rqt_ins . " ('{$notice_retour}',0, '{$code_lang}', {$ordre_lang}) "; $res_ins = @pmb_mysql_query($rqt, $dbh); } } } // langues originales if (is_array($this->original_language_code) && count($this->original_language_code)) { $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES "; foreach ($this->original_language_code as $ordre_lang => $code_lang) { if ($code_lang) { $rqt = $rqt_ins . " ('{$notice_retour}',1, '{$code_lang}', {$ordre_lang}) "; $res_ins = @pmb_mysql_query($rqt, $dbh); } } } //Traitement des champs personnalisés (du formulaire !!!) $p_perso = new parametres_perso("notices"); $nberrors = $p_perso->check_submited_fields(); $p_perso->rec_fields_perso($notice_retour); //Traitement import perso global $notice_id, $notice_org, $notice_type_org; if (function_exists('z_recup_noticeunimarc_suite') && function_exists('recup_noticeunimarc_suite')) { //Suppression des champs persos $requete = "delete from notices_custom_values where notices_custom_origine=" . $notice_retour; @pmb_mysql_query($requete); $notice_id = $notice_retour; z_recup_noticeunimarc_suite($notice_org); z_import_new_notice_suite(); } // Mise à jour des index de la notice notice::majNotices($notice_retour); // Mise à jour de la table notices_global_index notice::majNoticesGlobalIndex($notice_retour); // Mise à jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($notice_retour); //Documents numériques foreach ($this->doc_nums as $doc_num) { if (!$doc_num["a"]) { continue; } explnum_add_from_url($notice_retour, $this->bull_id, $doc_num["b"], $doc_num["a"], false, $this->source_id, $doc_num["f"], '', $doc_num["s"]); } //synchro_rdf if ($pmb_synchro_rdf) { $synchro_rdf->addRdf($notice_retour, 0); } $retour = array($new_notice, $notice_retour); return $retour; }
static function update_index($id) { global $dbh; global $include_path; $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/categories/champs_base.xml", "authorities", AUT_TABLE_CATEG); $indexation_authority->maj($id); //ajout des mots des termes dans la table words pour l autoindexation $q = "select trim(index_categorie) as index_categorie, langue from categories where num_noeud=" . $id; $r = pmb_mysql_query($q, $dbh); $i = 0; $t_words = array(); if (pmb_mysql_num_rows($r)) { while ($row = pmb_mysql_fetch_object($r)) { $t_row = explode(' ', $row->index_categorie); if (is_array($t_row) && count($t_row)) { $t_row = array_unique($t_row); foreach ($t_row as $w) { if ($w) { $t_words[$i]['word'] = $w; $t_words[$i]['lang'] = $row->langue; $i++; } } } } } if (count($t_words)) { //calcul de stem et double_metaphone foreach ($t_words as $i => $w) { $q1 = "select id_word from words where word='" . addslashes($w['word']) . "' and lang='" . addslashes($w['lang']) . "' limit 1"; $r1 = pmb_mysql_query($q1, $dbh); if (pmb_mysql_num_rows($r1)) { //le mot existe $t_words[$i]['allready_exists'] = 1; } else { //le mot n'existe pas $dmeta = new DoubleMetaPhone($w['word']); if ($dmeta->primary || $dmeta->secondary) { $t_words[$i]['double_metaphone'] = $dmeta->primary . " " . $dmeta->secondary; } if ($w['lang'] == 'fr_FR') { $stemming = new stemming($w['word']); $t_words[$i]['stem'] = $stemming->stem; } else { $t_words[$i]['stem'] = ''; } } } foreach ($t_words as $i => $w) { if (!$w['allready_exists']) { $q2 = "insert ignore into words (word, lang, double_metaphone, stem) values ('" . $w['word'] . "', '" . $w['lang'] . "', '" . $w['double_metaphone'] . "', '" . $w['stem'] . "') "; pmb_mysql_query($q2, $dbh); } } } // On cherche tous les n-uplet de la table notice correspondant à cette catégorie. $found = pmb_mysql_query("select distinct notcateg_notice from notices_categories where num_noeud='" . $id . "' ", $dbh); // Pour chaque n-uplet trouvés on met a jour la table notice_global_index avec l'auteur modifié : $num = pmb_mysql_num_rows($found); for ($j = 0; $j < $num; $j++) { $mesNotices = pmb_mysql_fetch_object($found); $notice_id = $mesNotices->notcateg_notice; notice::majNoticesGlobalIndex($notice_id); notice::majNoticesMotsGlobalIndex($notice_id, 'subject'); } //on cherche les questions correspondantes... $query = "select num_faq_question from faq_questions_categories where num_categ = " . $id; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $index = new indexation($include_path . "/indexation/faq/question.xml", "faq_questions"); while ($row = pmb_mysql_fetch_object($result)) { $index->maj($row->num_faq_question, "categories"); } } }
static function update_index($id) { global $dbh; global $include_path; $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/titres_uniformes/champs_base.xml", "authorities", AUT_TABLE_TITRES_UNIFORMES); $indexation_authority->maj($id); // On cherche tous les n-uplet de la table notice correspondant à ce titre_uniforme. $found = pmb_mysql_query("select ntu_num_notice from notices_titres_uniformes where ntu_num_tu = " . $id, $dbh); // Pour chaque n-uplet trouvés on met a jour la table notice_global_index avec l'auteur modifié : while ($mesNotices = pmb_mysql_fetch_object($found)) { $notice_id = $mesNotices->ntu_num_notice; notice::majNoticesGlobalIndex($notice_id); notice::majNoticesMotsGlobalIndex($notice_id, 'uniformtitle'); //TODO preciser le datatype avant d'appeler cette fonction } }
// traitement des langues originales $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES "; while (list($key, $val) = each($f_langorg_form)) { $tmpcode_langue = $val['code']; if ($tmpcode_langue) { $tmpordre_langue = $val['ordre']; $rqt = $rqt_ins . " ('{$update_result}',1, '{$tmpcode_langue}', {$tmpordre_langue}) "; $res_ins = @mysql_query($rqt, $dbh); } } //Traitement des champs perso $p_perso->rec_fields_perso($update_result); // permet de charger la bonne langue, mot vide... $info = notice::indexation_prepare($serial->serial_id); // Mise à jour de la table notices_global_index notice::majNoticesGlobalIndex($serial->serial_id); // Mise à jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($serial->serial_id); // restaure l'environnement de langue notice::indexation_restaure($info); //Pour la synchro rdf if ($pmb_synchro_rdf) { $synchro_rdf->addRdf($serial->serial_id, 0); } print "<div class='row'><div class='msg-perio'>" . $msg[maj_encours] . "</div></div>"; $retour = "./catalog.php?categ=serials&sub=view&serial_id=" . $serial->serial_id; print "\n\t\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"{$retour}\" style=\"display:none\">\n\t\t\t\t<input type=\"hidden\" name=\"id_form\" value=\"{$id_form}\">\n\t\t\t</form>\n\t\t\t<script type=\"text/javascript\">document.dummy.submit();</script>\n\t\t\t"; } else { error_message($msg[4004], $msg['catalog_serie_impossible'], 1, './catalog.php?categ=serials'); } }
$result = pmb_mysql_query($requete, $dbh); if ($tmp_not = pmb_mysql_fetch_object($result)) { $id_notice = $tmp_not->notice_id; $acreer = 0; } } if ($acreer) { $requete = "INSERT INTO notices SET code='" . addslashes($pe_isbn) . "', tit1='{$pe_titre}', statut='{$pmb_pret_express_statut}', niveau_biblio='m', niveau_hierar='0', create_date=sysdate() "; $result = pmb_mysql_query($requete, $dbh); if (!$result) { die('ERROR PE: insert into notice'); } $id_notice = pmb_mysql_insert_id(); audit::insert_creation(AUDIT_NOTICE, $id_notice); notice::majNotices($id_notice); notice::majNoticesGlobalIndex($id_notice, 1); notice::majNoticesMotsGlobalIndex($id_notice); if ($gestion_acces_active == 1) { require_once "{$class_path}/acces.class.php"; $ac = new acces(); //traitement des droits acces user_notice if ($gestion_acces_user_notice == 1) { $dom_1 = $ac->setDomain(1); $dom_1->storeUserRights(0, $id_notice); } //traitement des droits acces empr_notice if ($gestion_acces_empr_notice == 1) { $dom_2 = $ac->setDomain(2); $dom_2->storeUserRights(0, $id_notice); } }
} } // traitement des langues originales $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES "; while (list($key, $val) = each($f_langorg_form)) { $tmpcode_langue = $val['code']; if ($tmpcode_langue) { $tmpordre_langue = $val['ordre']; $rqt = $rqt_ins . " ('{$update_result}',1, '{$tmpcode_langue}', {$tmpordre_langue}) "; $res_ins = @mysql_query($rqt, $dbh); } } //Traitement des champs perso $p_perso->rec_fields_perso($update_result); // Mise à jour de la table notices_global_index notice::majNoticesGlobalIndex($update_result); // Mise à jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($update_result); if ($gestion_acces_active == 1 && $myBulletinage->bull_num_notice) { //mise a jour des droits d'acces user_notice (idem notice mere perio) if ($gestion_acces_user_notice == 1) { $q = "replace into acces_res_1 select {$myBulletinage->bull_num_notice}, res_prf_num, usr_prf_num, res_rights, res_mask from acces_res_1 where res_num=" . $myBulletinage->bulletin_notice; mysql_query($q, $dbh); } //mise a jour des droits d'acces empr_notice if ($gestion_acces_empr_notice == 1) { $dom_2 = $ac->setDomain(2); if ($bul_id) { $dom_2->storeUserRights(1, $myBulletinage->bull_num_notice, $res_prf, $chk_rights, $prf_rad, $r_rad); } else { $dom_2->storeUserRights(0, $myBulletinage->bull_num_notice, $res_prf, $chk_rights, $prf_rad, $r_rad);
static function update_index($id) { global $dbh; // On cherche tous les n-uplet de la table notice correspondant à ce titre_uniforme. $found = pmb_mysql_query("select ntu_num_notice from notices_titres_uniformes where ntu_num_tu = " . $id, $dbh); // Pour chaque n-uplet trouvés on met a jour la table notice_global_index avec l'auteur modifié : while ($mesNotices = pmb_mysql_fetch_object($found)) { $notice_id = $mesNotices->ntu_num_notice; notice::majNoticesGlobalIndex($notice_id); notice::majNoticesMotsGlobalIndex($notice_id); } }
static function update_index($id) { global $dbh; global $include_path; $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/series/champs_base.xml", "authorities", AUT_TABLE_SERIES); $indexation_authority->maj($id); // On cherche tous les n-uplet de la table notice correspondant à cette série. $found = pmb_mysql_query("select distinct(notice_id) from notices where tparent_id='" . $id . "'", $dbh); // Pour chaque n-uplet trouvés on met a jour la table notice_global_index avec la série modifiée : while ($mesNotices = pmb_mysql_fetch_object($found)) { $notice_id = $mesNotices->notice_id; notice::majNotices($notice_id); //Le titre de série est indexé dans les index de la notice notice::majNoticesGlobalIndex($notice_id); notice::majNoticesMotsGlobalIndex($notice_id, 'serie'); } }
static function update_index($id) { global $dbh; // On cherche tous les n-uplet de la table notice correspondant à cet auteur. $found = pmb_mysql_query("select distinct notice_id from notices where indexint='" . $id . "'", $dbh); // Pour chaque n-uplet trouvés on met a jour la table notice_global_index avec l'auteur modifié : while ($mesNotices = pmb_mysql_fetch_object($found)) { $notice_id = $mesNotices->notice_id; notice::majNoticesGlobalIndex($notice_id); notice::majNoticesMotsGlobalIndex($notice_id, 'indexint'); } }
function pmb_init_indexation_records() { global $dbh, $msg; $result = pmb_mysql_query("select notice_id from notices", $dbh); if ($result) { $count = pmb_mysql_num_rows($result); if ($count) { while ($mesNotices = pmb_mysql_fetch_assoc($result)) { // permet de charger la bonne langue, mot vide... $info = notice::indexation_prepare($mesNotices['notice_id']); // Mise à jour de la table "notices_global_index" notice::majNoticesGlobalIndex($mesNotices['notice_id']); // Mise à jour de la table "notices_mots_global_index" notice::majNoticesMotsGlobalIndex($mesNotices['notice_id']); // restaure l'environnement de langue notice::indexation_restaure($info); } pmb_indexation_display($msg["nettoyage_reindex_notices"], $count . " " . $msg["nettoyage_res_reindex_notices"]); } } }