function update($value, $force_creation = false) { global $dbh; global $msg, $charset; global $include_path; global $thesaurus_concepts_active; // nettoyage des valeurs en entrée $value['name'] = clean_string($value['name']); $value['issn'] = clean_string($value['issn']); if (!$value['parent']) { if ($value['publisher']) { //on les a, on crée l'éditeur $value['publisher'] = stripslashes_array($value['publisher']); //La fonction d'import fait les addslashes contrairement à l'update $value['parent'] = editeur::import($value['publisher']); } } if (!$value['name'] || !$value['parent']) { return false; } // construction de la requête $requete = 'SET collection_name="' . $value['name'] . '", '; $requete .= 'collection_parent="' . $value['parent'] . '", '; $requete .= 'collection_issn="' . $value['issn'] . '", '; $requete .= 'collection_web="' . $value['collection_web'] . '", '; $requete .= 'collection_comment="' . $value['comment'] . '", '; $requete .= 'index_coll=" ' . strip_empty_words($value['name']) . ' ' . strip_empty_words($value['issn']) . ' "'; if ($this->id) { // update $requete = 'UPDATE collections ' . $requete; $requete .= ' WHERE collection_id=' . $this->id . ' ;'; if (pmb_mysql_query($requete, $dbh)) { $requete = "update notices set ed1_id='" . $value[parent] . "' WHERE coll_id='" . $this->id . "' "; $res = pmb_mysql_query($requete, $dbh); // liens entre autorités $aut_link = new aut_link(AUT_TABLE_COLLECTIONS, $this->id); $aut_link->save_form(); $aut_pperso = new aut_pperso("collection", $this->id); $aut_pperso->save_form(); audit::insert_modif(AUDIT_COLLECTION, $this->id); } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[167], htmlentities($msg[169] . " -> " . $this->display, ENT_QUOTES, $charset)); return FALSE; } } else { if (!$force_creation) { // création : s'assurer que la collection n'existe pas déjà if ($id_collection_exists = collection::check_if_exists($value)) { $collection_exists = new collection($id_collection_exists); require_once "{$include_path}/user_error.inc.php"; warning($msg[167], htmlentities($msg[171] . " -> " . $collection_exists->display, ENT_QUOTES, $charset)); return FALSE; } } $requete = 'INSERT INTO collections ' . $requete . ';'; if (pmb_mysql_query($requete, $dbh)) { $this->id = pmb_mysql_insert_id(); // liens entre autorités $aut_link = new aut_link(AUT_TABLE_COLLECTIONS, $this->id); $aut_link->save_form(); audit::insert_creation(AUDIT_COLLECTION, $this->id); } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[167], htmlentities($msg[170] . " -> " . $requete, ENT_QUOTES, $charset)); return FALSE; } } // Indexation concepts if ($thesaurus_concepts_active == 1) { $index_concept = new index_concept($this->id, TYPE_COLLECTION); $index_concept->save(); } // Mise à jour des vedettes composées contenant cette autorité vedette_composee::update_vedettes_built_with_element($this->id, "collection"); if ($value['subcollections']) { for ($i = 0; $i < count($value['subcollections']); $i++) { $subcoll = stripslashes_array($value['subcollections'][$i]); //La fonction d'import fait les addslashes contrairement à l'update $subcoll['coll_parent'] = $this->id; subcollection::import($subcoll); } } //update authority informations $authority = new authority(0, $this->id, AUT_TABLE_COLLECTIONS); $authority->set_num_statut($value['statut']); $authority->update(); collection::update_index($this->id); return true; }
function update($nom, $comment, $id_pclass = 0) { global $dbh; global $msg; global $include_path; global $thesaurus_classement_mode_pmb, $thesaurus_classement_defaut; global $thesaurus_concepts_active; if (!$nom) { return false; } // nettoyage de la chaîne en entrée $nom = clean_string($nom); if ($thesaurus_classement_mode_pmb == 0 || $id_pclass == 0) { $id_pclass = $thesaurus_classement_defaut; } $requete = "SET indexint_name='{$nom}', "; $requete .= "indexint_comment='{$comment}', "; $requete .= "num_pclass='{$id_pclass}', "; $requete .= "index_indexint=' " . strip_empty_words($nom . " " . $comment) . " '"; if ($this->indexint_id) { // update $requete = 'UPDATE indexint ' . $requete; $requete .= ' WHERE indexint_id=' . $this->indexint_id . ' LIMIT 1;'; if (pmb_mysql_query($requete, $dbh)) { $aut_link = new aut_link(AUT_TABLE_INDEXINT, $this->indexint_id); $aut_link->save_form(); $aut_pperso = new aut_pperso("indexint", $this->indexint_id); $aut_pperso->save_form(); indexint::update_index($this->indexint_id); audit::insert_modif(AUDIT_INDEXINT, $this->indexint_id); } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[indexint_update], $msg[indexint_unable]); return FALSE; } } else { // création : s'assurer que le nom n'existe pas déjà $dummy = "SELECT * FROM indexint WHERE indexint_name = '" . $nom . "' and num_pclass='" . $id_pclass . "' LIMIT 1 "; $check = pmb_mysql_query($dummy, $dbh); if (pmb_mysql_num_rows($check)) { require_once "{$include_path}/user_error.inc.php"; warning($msg[indexint_create], $msg[indexint_exists]); return FALSE; } $requete = 'INSERT INTO indexint ' . $requete . ';'; if (pmb_mysql_query($requete, $dbh)) { $this->indexint_id = pmb_mysql_insert_id(); $aut_link = new aut_link(AUT_TABLE_INDEXINT, $this->indexint_id); $aut_link->save_form(); $aut_pperso = new aut_pperso("indexint", $this->indexint_id); $aut_pperso->save_form(); audit::insert_creation(AUDIT_INDEXINT, $this->indexint_id); } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[indexint_create], $msg[indexint_unable_create]); return FALSE; } } // Indexation concepts if ($thesaurus_concepts_active == 1) { $index_concept = new index_concept($this->indexint_id, TYPE_INDEXINT); $index_concept->save(); } // Mise à jour des vedettes composées contenant cette autorité vedette_composee::update_vedettes_built_with_element($this->indexint_id, "indexint"); return TRUE; }
function update($value, $force_creation = false) { global $dbh; global $msg, $charset; global $include_path; // nettoyage des valeurs en entrée $value['name'] = clean_string($value['name']); $value['issn'] = clean_string($value['issn']); if (!$value['parent']) { if ($value['publisher']) { //on les a, on crée l'éditeur $value['publisher'] = stripslashes_array($value['publisher']); //La fonction d'import fait les addslashes contrairement à l'update $value['parent'] = editeur::import($value['publisher']); } } if (!$value['name'] || !$value['parent']) { return false; } // construction de la requête $requete = "SET collection_name='{$value['name']}', "; $requete .= "collection_parent='{$value['parent']}', "; $requete .= "collection_issn='{$value['issn']}', "; $requete .= "collection_web='{$value['collection_web']}', "; $requete .= "collection_comment='{$value['comment']}', "; $requete .= "index_coll=' " . strip_empty_words($value[name]) . " " . strip_empty_words($value["issn"]) . " '"; if ($this->id) { // update $requete = 'UPDATE collections ' . $requete; $requete .= ' WHERE collection_id=' . $this->id . ' ;'; if (mysql_query($requete, $dbh)) { $requete = "update notices set ed1_id='" . $value[parent] . "' WHERE coll_id='" . $this->id . "' "; $res = mysql_query($requete, $dbh); // liens entre autorités $aut_link = new aut_link(AUT_TABLE_COLLECTIONS, $this->id); $aut_link->save_form(); $aut_pperso = new aut_pperso("collection", $this->id); $aut_pperso->save_form(); collection::update_index($this->id); audit::insert_modif(AUDIT_COLLECTION, $this->id); } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[167], htmlentities($msg[169] . " -> " . $this->display, ENT_QUOTES, $charset)); return FALSE; } } else { if (!$force_creation) { // création : s'assurer que la collection n'existe pas déjà if ($id_collection_exists = collection::check_if_exists($value)) { $collection_exists = new collection($id_collection_exists); require_once "{$include_path}/user_error.inc.php"; warning($msg[167], htmlentities($msg[171] . " -> " . $collection_exists->display, ENT_QUOTES, $charset)); return FALSE; } } $requete = 'INSERT INTO collections ' . $requete . ';'; if (mysql_query($requete, $dbh)) { $this->id = mysql_insert_id(); // liens entre autorités $aut_link = new aut_link(AUT_TABLE_COLLECTIONS, $this->id); $aut_link->save_form(); audit::insert_creation(AUDIT_COLLECTION, $this->id); } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[167], htmlentities($msg[170] . " -> " . $requete, ENT_QUOTES, $charset)); return FALSE; } } if ($value['subcollections']) { for ($i = 0; $i < count($value['subcollections']); $i++) { $subcoll = stripslashes_array($value['subcollections'][$i]); //La fonction d'import fait les addslashes contrairement à l'update $subcoll['coll_parent'] = $this->id; subcollection::import($subcoll); } } return true; }
} //Remplacement $button_remplace = "<input type='button' class='bouton' value='{$msg['158']}' "; $button_remplace .= "onclick='unload_off();document.location=\"./autorites.php?categ=categories&sub=categ_replace&id={$id}&parent={$parent}\"'/>"; $category_form = str_replace("<!-- remplace_categ -->", $button_remplace, $category_form); //Suppression $category_form = str_replace('<!-- delete_button -->', $delete_button, $category_form); } else { $category_form = str_replace("<!-- numero_autorite -->", $num_aut, $category_form); } if ($import_denied == 1) { $import_denied_checked = "checked='checked'"; } else { $import_denied_checked = ""; } $category_form = str_replace('!!authority_import_denied!!', $import_denied_checked, $category_form); require_once "{$class_path}/aut_link.class.php"; $aut_link = new aut_link(AUT_TABLE_CATEG, $id); $category_form = str_replace('<!-- aut_link -->', $aut_link->get_form('categ_form'), $category_form); $aut_pperso = new aut_pperso("categ", $id); $category_form = str_replace('!!aut_pperso!!', $aut_pperso->get_form(), $category_form); $category_form = str_replace('!!voir_notices!!', $button_voir, $category_form); if ($pmb_type_audit && $id) { $bouton_audit = " <input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=" . AUDIT_CATEG . "&object_id=" . $id . "', 'audit_popup', 700, 500, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" title=\"" . $msg['audit_button'] . "\" value=\"" . $msg['audit_button'] . "\" /> "; } $category_form = str_replace('!!audit_bt!!', $bouton_audit, $category_form); $category_form = str_replace('!!user_input!!', htmlentities($user_input, ENT_QUOTES, $charset), $category_form); $category_form = str_replace('!!nbr_lignes!!', $nbr_lignes, $category_form); $category_form = str_replace('!!page!!', $page, $category_form); $category_form = str_replace('!!nb_per_page!!', $nb_per_page, $category_form); print $category_form;
function delete($id_noeud = 0) { global $dbh; if (!$id_noeud && is_object($this)) { $id_noeud = $this->id_noeud; } // Supprime les categories. $q = "delete from categories where num_noeud = '" . $id_noeud . "' "; mysql_query($q, $dbh); //Import d'autorité noeuds::delete_autority_sources($id_noeud); // Supprime les renvois voir_aussi vers ce noeud. $q = "delete from voir_aussi where num_noeud_dest = '" . $id_noeud . "' "; mysql_query($q, $dbh); // Supprime les renvois voir_aussi depuis ce noeud. $q = "delete from voir_aussi where num_noeud_orig = '" . $id_noeud . "' "; mysql_query($q, $dbh); // Supprime les associations avec des notices. $q = "delete from notices_categories where num_noeud = '" . $id_noeud . "' "; mysql_query($q, $dbh); // Supprime le noeud. $q = "delete from noeuds where id_noeud = '" . $id_noeud . "' "; mysql_query($q, $dbh); audit::delete_audit(AUDIT_CATEG, $id_noeud); // liens entre autorités $aut_link = new aut_link(AUT_TABLE_CATEG, $id_noeud); $aut_link->delete(); $aut_pperso = new aut_pperso("categ", $id_noeud); $aut_pperso->delete(); }
function delete($id_noeud = 0) { global $dbh; if (!$id_noeud && is_object($this)) { $id_noeud = $this->id_noeud; } // Supprime les categories. $q = "delete from categories where num_noeud = '" . $id_noeud . "' "; pmb_mysql_query($q, $dbh); //Import d'autorité noeuds::delete_autority_sources($id_noeud); // Supprime les renvois voir_aussi vers ce noeud. $q = "delete from voir_aussi where num_noeud_dest = '" . $id_noeud . "' "; pmb_mysql_query($q, $dbh); // Supprime les renvois voir_aussi depuis ce noeud. $q = "delete from voir_aussi where num_noeud_orig = '" . $id_noeud . "' "; pmb_mysql_query($q, $dbh); // Supprime les associations avec des notices. $q = "delete from notices_categories where num_noeud = '" . $id_noeud . "' "; pmb_mysql_query($q, $dbh); //Supprime les emprises du noeud $req = "select map_emprise_id from map_emprises where map_emprise_type=2 and map_emprise_obj_num=" . $id_noeud; $result = pmb_mysql_query($req, $dbh); if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $q = "delete from map_emprises where map_emprise_obj_num ='" . $id_noeud . "' and map_emprise_type = 2"; pmb_mysql_query($q, $dbh); $req_areas = "delete from map_hold_areas where type_obj=2 and id_obj=" . $row->map_emprise_id; pmb_mysql_query($req_areas, $dbh); } //suppression des renvois voir restants $q = "update noeuds set num_renvoi_voir = '0' where num_renvoi_voir = '" . $id_noeud . "' "; pmb_mysql_query($q, $dbh); // Supprime le noeud. $q = "delete from noeuds where id_noeud = '" . $id_noeud . "' "; pmb_mysql_query($q, $dbh); audit::delete_audit(AUDIT_CATEG, $id_noeud); // liens entre autorités $aut_link = new aut_link(AUT_TABLE_CATEG, $id_noeud); $aut_link->delete(); $aut_pperso = new aut_pperso("categ", $id_noeud); $aut_pperso->delete(); // nettoyage indexation indexation_authority::delete_all_index($id_noeud, "authorities", "id_authority", AUT_TABLE_CATEG); // effacement de l'identifiant unique d'autorité $authority = new authority(0, $id_noeud, AUT_TABLE_CATEG); $authority->delete(); }
function update($value) { global $dbh; global $msg; global $include_path; global $thesaurus_concepts_active; global $authority_statut; if (!$value) { return false; } // nettoyage de la chaîne en entrée $value = clean_string($value); $requete = 'SET serie_name="' . $value . '", '; $requete .= 'serie_index=" ' . strip_empty_words($value) . '" '; if ($this->s_id) { // update $requete = 'UPDATE series ' . $requete; $requete .= ' WHERE serie_id=' . $this->s_id . ' LIMIT 1;'; if (pmb_mysql_query($requete, $dbh)) { $rqt_notice = "select notice_id,tit1,tit2,tit3,tit4 from notices where tparent_id=" . $this->s_id; $r_notice = pmb_mysql_query($rqt_notice); while ($r = pmb_mysql_fetch_object($r_notice)) { $rq_serie = "update notices, series set notices.index_serie=serie_index, notices.index_wew=concat(serie_name,' ',tit1,' ',tit2,' ',tit3,' ',tit4),notices.index_sew=concat(' ',serie_index,' ','" . addslashes(strip_empty_words($r->tit1 . " " . $r->tit2 . " " . $r->tit3 . " " . $r->tit4)) . "',' ') where notice_id=" . $r->notice_id . " and serie_id=tparent_id"; pmb_mysql_query($rq_serie); } $aut_link = new aut_link(AUT_TABLE_SERIES, $this->s_id); $aut_link->save_form(); $aut_pperso = new aut_pperso("serie", $this->s_id); $aut_pperso->save_form(); audit::insert_modif(AUDIT_SERIE, $this->s_id); } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[337], $msg[341]); return FALSE; } } else { // création : s'assurer que le titre n'existe pas déjà $dummy = "SELECT * FROM series WHERE serie_name REGEXP '^{$value}\$' LIMIT 1 "; $check = pmb_mysql_query($dummy, $dbh); if (pmb_mysql_num_rows($check)) { require_once "{$include_path}/user_error.inc.php"; warning($msg[336], $msg[340]); return FALSE; } $requete = 'INSERT INTO series ' . $requete . ';'; if (pmb_mysql_query($requete, $dbh)) { $this->s_id = pmb_mysql_insert_id(); $aut_link = new aut_link(AUT_TABLE_SERIES, $this->s_id); $aut_link->save_form(); $aut_pperso = new aut_pperso("serie", $this->s_id); $aut_pperso->save_form(); audit::insert_creation(AUDIT_SERIE, $this->s_id); } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[336], $msg[342]); return FALSE; } } //update authority informations $authority = new authority(0, $this->s_id, AUT_TABLE_SERIES); $authority->set_num_statut($authority_statut); $authority->update(); // Indexation concepts if ($thesaurus_concepts_active == 1) { $index_concept = new index_concept($this->s_id, TYPE_SERIE); $index_concept->save(); } // Mise à jour des vedettes composées contenant cette autorité vedette_composee::update_vedettes_built_with_element($this->s_id, "serie"); serie::update_index($this->s_id); return TRUE; }
function update($value) { global $dbh; global $msg; global $include_path; global $pmb_synchro_rdf; global $thesaurus_concepts_active, $max_aut0, $max_aut1; global $mc_oeuvre_nature; global $pmb_authors_qualification; if (!$value['name']) { return false; } // nettoyage des chaînes en entrée $value['name'] = clean_string($value['name']); $value['num_author'] = clean_string($value['num_author']); $value['form'] = clean_string($value['form']); $value['form_selector'] = clean_string($value['form_selector']); $value['date'] = clean_string($value['date']); $value['subject'] = clean_string($value['subject']); $value['place'] = clean_string($value['place']); $value['history'] = clean_string($value['history']); $value['characteristic'] = clean_string($value['characteristic']); $value['intended_termination'] = clean_string($value['intended_termination']); $value['intended_audience'] = clean_string($value['intended_audience']); $value['context'] = clean_string($value['context']); $value['equinox'] = clean_string($value['equinox']); $value['coordinates'] = clean_string($value['coordinates']); $value['tonalite'] = clean_string($value['tonalite']); $value['tonalite_selector'] = clean_string($value['tonalite_selector']); $value['comment'] = clean_string($value['comment']); $value['oeuvre_nature'] = clean_string($value['oeuvre_nature']); $value['oeuvre_nature_nature'] = clean_string($mc_oeuvre_nature->attributes[$value['oeuvre_nature']]['NATURE']); $value['oeuvre_type'] = clean_string($value['oeuvre_type']); $titre = titre_uniforme::import_tu_exist($value, 1, $this->id); if ($titre) { require_once "{$include_path}/user_error.inc.php"; warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_doublon_erreur"]); return FALSE; } $tu_auteur = new auteur($value['num_author']); if (!$tu_auteur->id) { $value['num_author'] = 0; } else { $value['num_author'] = $tu_auteur->id; } $flag_index = 0; $requete = "SET "; $requete .= "tu_name='" . $value["name"] . "', "; $requete .= "tu_num_author='" . $value['num_author'] . "', "; $requete .= "tu_forme='" . $value["form"] . "', "; $requete .= "tu_forme_marclist='" . $value["form_selector"] . "', "; $requete .= "tu_date='" . $value["date"] . "', "; $requete .= "tu_sujet='" . $value["subject"] . "', "; $requete .= "tu_lieu='" . $value["place"] . "', "; $requete .= "tu_histoire='" . $value["history"] . "', "; $requete .= "tu_caracteristique='" . $value["characteristic"] . "', "; $requete .= "tu_completude='" . $value["intended_termination"] . "', "; $requete .= "tu_public='" . $value["intended_audience"] . "', "; $requete .= "tu_contexte='" . $value["context"] . "', "; $requete .= "tu_equinoxe='" . $value["equinox"] . "', "; $requete .= "tu_coordonnees='" . $value["coordinates"] . "', "; $requete .= "tu_tonalite='" . $value["tonalite"] . "', "; $requete .= "tu_tonalite_marclist='" . $value["tonalite_selector"] . "', "; $requete .= "tu_comment='" . $value["comment"] . "', "; $requete .= "tu_import_denied='" . $value["import_denied"] . "', "; $requete .= "tu_oeuvre_nature='" . $value["oeuvre_nature"] . "', "; $requete .= "tu_oeuvre_nature_nature='" . $value["oeuvre_nature_nature"] . "', "; $requete .= "tu_oeuvre_type='" . $value["oeuvre_type"] . "' "; if ($this->id) { // update $requete = 'UPDATE titres_uniformes ' . $requete; $requete .= ' WHERE tu_id=' . $this->id . ' ;'; if (pmb_mysql_query($requete, $dbh)) { $flag_index = 1; } else { require_once "{$include_path}/user_error.inc.php"; warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_modif_erreur"]); return FALSE; } audit::insert_modif(AUDIT_TITRE_UNIFORME, $this->id); } else { // creation $requete = 'INSERT INTO titres_uniformes ' . $requete . ' '; $result = pmb_mysql_query($requete, $dbh); if ($result) { $this->id = pmb_mysql_insert_id(); } else { require_once "{$include_path}/user_error.inc.php"; warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_creation_erreur"]); return FALSE; } audit::insert_creation(AUDIT_TITRE_UNIFORME, $this->id); } $this->update_oeuvre_expression($value['oeuvre_expression']); $this->update_other_link($value['other_link']); $this->update_oeuvre_event($value['oeuvre_event']); // auteurs for ($i = 0; $i < $max_aut0; $i++) { eval("global \$f_aut0_id{$i}; \$var_autid=\$f_aut0_id{$i};"); eval("global \$f_f0_code{$i}; \$var_autfonc=\$f_f0_code{$i};"); $f_aut[] = array('id' => $var_autid, 'fonction' => $var_autfonc, 'type' => '0', 'ordre' => $i); } // interpretes for ($i = 0; $i < $max_aut1; $i++) { eval("global \$f_aut1_id{$i}; \$var_autid=\$f_aut1_id{$i};"); eval("global \$f_f1_code{$i}; \$var_autfonc=\$f_f1_code{$i};"); $f_aut[] = array('id' => $var_autid, 'fonction' => $var_autfonc, 'type' => '1', 'ordre' => $i); } // Clean des vedettes titre_uniforme::delete_vedette_links($this->id); // traitement des auteurs $rqt_del = "delete from responsability_tu where responsability_tu_num='" . $this->id . "' "; $res_del = pmb_mysql_query($rqt_del); $rqt_ins = "INSERT INTO responsability_tu (responsability_tu_author_num, responsability_tu_num, responsability_tu_fonction, responsability_tu_type, responsability_tu_ordre) VALUES "; $i = 0; $var_name = 'saisie_titre_uniforme_role_composed'; global ${$var_name}; $role_composed = ${$var_name}; $var_name = 'saisie_titre_uniforme_role_autre_composed'; global ${$var_name}; $role_composed_autre = ${$var_name}; while ($i <= count($f_aut) - 1) { $id_aut = $f_aut[$i]['id']; if ($id_aut) { $fonc_aut = $f_aut[$i]['fonction']; $type_aut = $f_aut[$i]['type']; $ordre_aut = $f_aut[$i]['ordre']; $rqt = $rqt_ins . " ('{$id_aut}','" . $this->id . "','{$fonc_aut}','{$type_aut}', {$ordre_aut}) "; $res_ins = @pmb_mysql_query($rqt); $id_responsability_tu = pmb_mysql_insert_id(); if ($pmb_authors_qualification) { switch ($type_aut) { case 0: $this->update_vedette(stripslashes_array($role_composed[$ordre_aut]), $id_responsability_tu, TYPE_TU_RESPONSABILITY); break; case 1: $this->update_vedette(stripslashes_array($role_composed_autre[$ordre_aut]), $id_responsability_tu, TYPE_TU_RESPONSABILITY_INTERPRETER); break; } } } $i++; } $aut_link = new aut_link(AUT_TABLE_TITRES_UNIFORMES, $this->id); $aut_link->save_form(); $aut_pperso = new aut_pperso("tu", $this->id); $aut_pperso->save_form(); //update authority informations $authority = new authority(0, $this->id, AUT_TABLE_TITRES_UNIFORMES); $authority->set_num_statut($value['statut']); $authority->update(); // Indexation concepts if ($thesaurus_concepts_active == 1) { $index_concept = new index_concept($this->id, TYPE_TITRE_UNIFORME); $index_concept->save(); } // Mise à jour des vedettes composées contenant cette autorité vedette_composee::update_vedettes_built_with_element($this->id, "titre_uniforme"); // Gestion des champ répétables $requete = "DELETE FROM tu_distrib WHERE distrib_num_tu='{$this->id}' "; pmb_mysql_query($requete, $dbh); $requete = "DELETE FROM tu_ref WHERE ref_num_tu='{$this->id}' "; pmb_mysql_query($requete, $dbh); $requete = "DELETE FROM tu_subdiv WHERE subdiv_num_tu='{$this->id}' "; pmb_mysql_query($requete, $dbh); // Distribution instrumentale et vocale (pour la musique) for ($i = 0; $i < count($value['distrib']); $i++) { $requete = "INSERT INTO tu_distrib SET\n\t\t\tdistrib_num_tu='{$this->id}',\n\t\t\tdistrib_name='" . $value['distrib'][$i] . "',\n\t\t\tdistrib_ordre='{$i}' "; pmb_mysql_query($requete, $dbh); } // Référence numérique (pour la musique) for ($i = 0; $i < count($value['ref']); $i++) { $requete = "INSERT INTO tu_ref SET\n\t\t\tref_num_tu='{$this->id}',\n\t\t\tref_name='" . $value['ref'][$i] . "',\n\t\t\tref_ordre='{$i}' "; pmb_mysql_query($requete, $dbh); } // Subdivison de forme for ($i = 0; $i < count($value['subdiv']); $i++) { $requete = "INSERT INTO tu_subdiv SET\n\t\t\tsubdiv_num_tu='{$this->id}',\n\t\t\tsubdiv_name='" . $value['subdiv'][$i] . "',\n\t\t\tsubdiv_ordre='{$i}' "; pmb_mysql_query($requete, $dbh); } // mise à jour du champ index du titre uniforme if ($this->id) { titre_uniforme::update_index_tu($this->id); } // réindexation de la notice // if ($flag_index) titre_uniforme::update_index($this->id); //Enrichissement if ($this->id && $opac_enrichment_bnf_sparql) { titre_uniforme::tu_enrichment($this->id); } //mise à jour de l'oeuvre rdf if ($flag_index && $pmb_synchro_rdf) { $synchro_rdf = new synchro_rdf(); $synchro_rdf->updateAuthority($this->id, 'oeuvre'); } return TRUE; }
} // Indexation concepts if ($thesaurus_concepts_active == 1) { $index_concept = new index_concept($id, TYPE_CATEGORY); $index_concept->save(); } // liens entre autorités require_once "{$class_path}/aut_link.class.php"; $aut_link = new aut_link(AUT_TABLE_CATEG, $id); $aut_link->save_form(); global $pmb_map_activate; if ($pmb_map_activate) { $map = new map_edition_controler(AUT_TABLE_CATEG, $id); $map->save_form(); } $aut_pperso = new aut_pperso("categ", $id); $aut_pperso->save_form(); //traitement categories foreach ($lg as $key => $value) { if ($category_libelle[$key] !== NULL) { if ($category_libelle[$key] !== '' || $category_libelle[$key] === '' && categories::exists($id, $key)) { $cat = new categories($id, $key); $cat->libelle_categorie = stripslashes($category_libelle[$key]); $cat->note_application = stripslashes($category_na[$key]); $cat->comment_public = stripslashes($category_cm[$key]); $cat->index_categorie = strip_empty_words($category_libelle[$key]); $cat->save(); } } } if (!noeuds::isProtected($id)) {
function update($value) { global $dbh; global $msg; global $include_path; global $pmb_synchro_rdf; global $thesaurus_concepts_active; if (!$value['name']) { return false; } // nettoyage des valeurs en entree $value[name] = clean_string($value[name]); $value[adr1] = clean_string($value[adr1]); $value[adr2] = clean_string($value[adr2]); $value[cp] = clean_string($value[cp]); $value[ville] = clean_string($value[ville]); $value[pays] = clean_string($value[pays]); $value[web] = clean_string($value[web]); // construction de la requete $requete = "SET ed_name='{$value['name']}', "; $requete .= "ed_adr1='{$value['adr1']}', "; $requete .= "ed_adr2='{$value['adr2']}', "; $requete .= "ed_cp='{$value['cp']}', "; $requete .= "ed_ville='{$value['ville']}', "; $requete .= "ed_pays='{$value['pays']}', "; $requete .= "ed_web='{$value['web']}', "; $requete .= "ed_comment='{$value['ed_comment']}', "; $requete .= "index_publisher=' " . strip_empty_chars($value[name] . " " . $value[ville] . " " . $value[pays]) . " '"; if ($this->id) { // update $requete = 'UPDATE publishers ' . $requete; $requete .= ' WHERE ed_id=' . $this->id . ' LIMIT 1;'; if (pmb_mysql_query($requete, $dbh)) { $aut_link = new aut_link(AUT_TABLE_PUBLISHERS, $this->id); $aut_link->save_form(); $aut_pperso = new aut_pperso("publisher", $this->id); $aut_pperso->save_form(); editeur::update_index($this->id); audit::insert_modif(AUDIT_PUBLISHER, $this->id); //mise à jour de l'éditeur dans la base rdf if ($pmb_synchro_rdf) { $synchro_rdf = new synchro_rdf(); $synchro_rdf->updateAuthority($this->id, 'editeur'); } } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[145], $msg[150]); return FALSE; } } else { // s'assurer que l'editeur n'existe pas deja // on teste sur le nom et la ville seulement. voir a l'usage si necessaire de tester plus if (editeur::check_if_exists($value)) { require_once "{$include_path}/user_error.inc.php"; warning($msg[145], $msg[149] . " ({$value['name']})."); return FALSE; } $requete = 'INSERT INTO publishers ' . $requete . ';'; if (pmb_mysql_query($requete, $dbh)) { $this->id = pmb_mysql_insert_id(); $aut_link = new aut_link(AUT_TABLE_PUBLISHERS, $this->id); $aut_link->save_form(); $aut_pperso = new aut_pperso("publisher", $this->id); $aut_pperso->save_form(); audit::insert_creation(AUDIT_PUBLISHER, $this->id); } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[145], $msg[151]); return FALSE; } } if ($thesaurus_concepts_active == 1) { $index_concept = new index_concept($this->id, TYPE_PUBLISHER); $index_concept->save(); } // Mise à jour des vedettes composées contenant cette autorité vedette_composee::update_vedettes_built_with_element($this->id, "publisher"); return TRUE; }
static function majNoticesGlobalIndex($notice, $NoIndex = 1) { global $dbh; pmb_mysql_query("delete from notices_global_index where num_notice = " . $notice . " AND no_index = " . $NoIndex, $dbh); $titres = pmb_mysql_query("select index_serie, tnvol, index_wew, index_sew, index_l, index_matieres, n_gen, n_contenu, n_resume, index_n_gen, index_n_contenu, index_n_resume, eformat, niveau_biblio from notices where notice_id = " . $notice, $dbh); $mesNotices = pmb_mysql_fetch_assoc($titres); $tit = $mesNotices['index_wew']; $indTit = $mesNotices['index_sew']; $indMat = $mesNotices['index_matieres']; $indL = $mesNotices['index_l']; $indResume = $mesNotices['index_n_resume']; $indGen = $mesNotices['index_n_gen']; $indContenu = $mesNotices['index_n_contenu']; $resume = $mesNotices['n_resume']; $gen = $mesNotices['n_gen']; $contenu = $mesNotices['n_contenu']; $indSerie = $mesNotices['index_serie']; $tvol = $mesNotices['tnvol']; $eformatlien = $mesNotices['eformat']; $infos_global = ' ' . $tvol . ' ' . $tit . ' ' . $resume . ' ' . $gen . ' ' . $contenu . ' ' . $indL . ' '; $infos_global_index = ' ' . $indSerie . ' ' . $indTit . ' ' . $indResume . ' ' . $indGen . ' ' . $indContenu . ' ' . $indMat . ' '; // Authors : $auteurs = pmb_mysql_query("select author_id, author_type, author_name, author_rejete, author_date, author_lieu,author_ville,author_pays,author_numero,author_subdivision, index_author from authors, responsability WHERE responsability_author = author_id AND responsability_notice = {$notice}", $dbh); $numA = pmb_mysql_num_rows($auteurs); $aut_pperso = new aut_pperso("author"); for ($j = 0; $j < $numA; $j++) { $mesAuteurs = pmb_mysql_fetch_assoc($auteurs); $infos_global .= $mesAuteurs['author_name'] . ' ' . $mesAuteurs['author_rejete'] . ' ' . $mesAuteurs['author_lieu'] . ' ' . $mesAuteurs['author_ville'] . ' ' . $mesAuteurs['author_pays'] . ' ' . $mesAuteurs['author_numero'] . ' ' . $mesAuteurs['author_subdivision'] . ' '; if ($mesAuteurs['author_type'] == "72") { $infos_global .= ' ' . $mesAuteurs['author_date'] . ' '; } $infos_global_index .= strip_empty_chars($mesAuteurs['author_name'] . ' ' . $mesAuteurs['author_rejete'] . ' ' . $mesAuteurs['author_lieu'] . ' ' . $mesAuteurs['author_ville'] . ' ' . $mesAuteurs['author_pays'] . ' ' . $mesAuteurs['author_numero'] . ' ' . $mesAuteurs['author_subdivision']) . ' '; if ($mesAuteurs['author_type'] == "72") { $infos_global_index .= strip_empty_chars($mesAuteurs['author_date'] . " "); } $mots_perso = $aut_pperso->get_fields_recherche($mesAuteurs['author_id']); if ($mots_perso) { $infos_global .= $mots_perso . ' '; $infos_global_index .= strip_empty_words($mots_perso) . ' '; } } pmb_mysql_free_result($auteurs); // Nom du periodique //cas d'un article if ($mesNotices['niveau_biblio'] == 'a') { $temp = pmb_mysql_query("select bulletin_notice, bulletin_titre, index_titre, index_wew, index_sew from analysis, bulletins, notices WHERE analysis_notice=" . $notice . " and analysis_bulletin = bulletin_id and bulletin_notice=notice_id", $dbh); $numP = pmb_mysql_num_rows($temp); if ($numP) { // La notice appartient a un periodique, on selectionne le titre de periodique : $mesTemp = pmb_mysql_fetch_assoc($temp); $infos_global .= $mesTemp['index_wew'] . ' ' . $mesTemp['bulletin_titre'] . ' ' . $mesTemp['index_titre'] . ' '; $infos_global_index .= strip_empty_words($mesTemp['index_wew'] . ' ' . $mesTemp['bulletin_titre'] . ' ' . $mesTemp['index_titre']) . ' '; } pmb_mysql_free_result($temp); //cas d'un bulletin } else { if ($mesNotices['niveau_biblio'] == 'b') { $temp = pmb_mysql_query("select serial.index_wew from notices join bulletins on bulletins.num_notice = notices.notice_id join notices as serial on serial.notice_id = bulletins.bulletin_notice where notices.notice_id = " . $notice); $numP = pmb_mysql_num_rows($temp); if ($numP) { // La notice appartient a un periodique, on selectionne le titre de periodique : $mesTemp = pmb_mysql_fetch_assoc($temp); $infos_global .= $mesTemp['index_wew'] . ' '; $infos_global_index .= strip_empty_words($mesTemp['index_wew']); } pmb_mysql_free_result($temp); } } // Categories : $aut_pperso = new aut_pperso("categ"); $noeud = pmb_mysql_query("select notices_categories.num_noeud as categ_id, libelle_categorie from notices_categories,categories where notcateg_notice = " . $notice . " and notices_categories.num_noeud=categories.num_noeud order by ordre_categorie", $dbh); $numNoeuds = pmb_mysql_num_rows($noeud); // Pour chaque noeud trouve on cherche les noeuds parents et les noeuds fils : for ($j = 0; $j < $numNoeuds; $j++) { // On met a jour la table notices_global_index avec le noeud trouve: $mesNoeuds = pmb_mysql_fetch_assoc($noeud); $infos_global .= $mesNoeuds['libelle_categorie'] . ' '; $infos_global_index .= strip_empty_words($mesNoeuds['libelle_categorie']) . ' '; $mots_perso = $aut_pperso->get_fields_recherche($mesNoeuds['categ_id']); if ($mots_perso) { $infos_global .= $mots_perso . ' '; $infos_global_index .= strip_empty_words($mots_perso) . ' '; } } // Sous-collection : $aut_pperso = new aut_pperso("subcollection"); $subColls = pmb_mysql_query("select subcoll_id, sub_coll_name, index_sub_coll from notices, sub_collections WHERE subcoll_id = sub_coll_id AND notice_id = " . $notice, $dbh); $numSC = pmb_mysql_num_rows($subColls); for ($j = 0; $j < $numSC; $j++) { $mesSubColl = pmb_mysql_fetch_assoc($subColls); $infos_global .= $mesSubColl['index_sub_coll'] . ' ' . $mesSubColl['sub_coll_name'] . ' '; $infos_global_index .= strip_empty_words($mesSubColl['index_sub_coll'] . ' ' . $mesSubColl['sub_coll_name']) . ' '; $mots_perso = $aut_pperso->get_fields_recherche($mesSubColl['subcoll_id']); if ($mots_perso) { $infos_global .= $mots_perso . ' '; $infos_global_index .= strip_empty_words($mots_perso) . ' '; } } pmb_mysql_free_result($subColls); // Indexation numerique : $aut_pperso = new aut_pperso("indexint"); $indexNums = pmb_mysql_query("select indexint_id, indexint_name, indexint_comment from notices, indexint WHERE indexint = indexint_id AND notice_id = " . $notice, $dbh); $numIN = pmb_mysql_num_rows($indexNums); for ($j = 0; $j < $numIN; $j++) { $mesindexNums = pmb_mysql_fetch_assoc($indexNums); $infos_global .= $mesindexNums['indexint_name'] . ' ' . $mesindexNums['indexint_comment'] . ' '; $infos_global_index .= strip_empty_words($mesindexNums['indexint_name'] . ' ' . $mesindexNums['indexint_comment']) . ' '; $mots_perso = $aut_pperso->get_fields_recherche($mesindexNums['indexint_id']); if ($mots_perso) { $infos_global .= $mots_perso . ' '; $infos_global_index .= strip_empty_words($mots_perso) . ' '; } } pmb_mysql_free_result($indexNums); // Collection : $aut_pperso = new aut_pperso("collection"); $Colls = pmb_mysql_query("select coll_id, collection_name ,collection_issn from notices, collections WHERE coll_id = collection_id AND notice_id = " . $notice, $dbh); $numCo = pmb_mysql_num_rows($Colls); for ($j = 0; $j < $numCo; $j++) { $mesColl = pmb_mysql_fetch_assoc($Colls); $infos_global .= $mesColl['collection_name'] . ' ' . $mesColl['collection_issn'] . ' '; $infos_global_index .= strip_empty_words($mesColl['collection_name']) . ' ' . strip_empty_words($mesColl['collection_issn']) . ' '; $mots_perso = $aut_pperso->get_fields_recherche($mesColl['coll_id']); if ($mots_perso) { $infos_global .= $mots_perso . ' '; $infos_global_index .= strip_empty_words($mots_perso) . ' '; } } pmb_mysql_free_result($Colls); // Editeurs : $aut_pperso = new aut_pperso("publisher"); $editeurs = pmb_mysql_query("select ed_id, ed_name from notices, publishers WHERE (ed1_id = ed_id OR ed2_id = ed_id) AND notice_id = " . $notice, $dbh); $numE = pmb_mysql_num_rows($editeurs); for ($j = 0; $j < $numE; $j++) { $mesEditeurs = pmb_mysql_fetch_assoc($editeurs); $infos_global .= $mesEditeurs['ed_name'] . ' '; $infos_global_index .= strip_empty_chars($mesEditeurs['ed_name']) . ' '; $mots_perso = $aut_pperso->get_fields_recherche($mesEditeurs['ed_id']); if ($mots_perso) { $infos_global .= $mots_perso . ' '; $infos_global_index .= strip_empty_words($mots_perso) . ' '; } } pmb_mysql_free_result($editeurs); pmb_mysql_free_result($titres); // Titres Uniformes : $aut_pperso = new aut_pperso("tu"); $tu = pmb_mysql_query("select tu_id, ntu_titre, tu_name, tu_tonalite, tu_sujet, tu_lieu, tu_contexte from notices_titres_uniformes,titres_uniformes WHERE tu_id=ntu_num_tu and ntu_num_notice=" . $notice, $dbh); if (pmb_mysql_error() == "" && pmb_mysql_num_rows($tu)) { $numtu = pmb_mysql_num_rows($tu); for ($j = 0; $j < $numtu; $j++) { $mesTu = pmb_mysql_fetch_assoc($tu); $infos_global .= $mesTu['ntu_titre'] . ' ' . $mesTu['tu_name'] . ' ' . $mesTu['tu_tonalite'] . ' ' . $mesTu['tu_sujet'] . ' ' . $mesTu['tu_lieu'] . ' ' . $mesTu['tu_contexte'] . ' '; $infos_global_index .= strip_empty_words($mesTu['ntu_titre'] . ' ' . $mesTu['tu_name'] . ' ' . $mesTu['tu_tonalite'] . ' ' . $mesTu['tu_sujet'] . ' ' . $mesTu['tu_lieu'] . ' ' . $mesTu['tu_contexte']) . ' '; $mots_perso = $aut_pperso->get_fields_recherche($mesTu['tu_id']); if ($mots_perso) { $infos_global .= $mots_perso . ' '; $infos_global_index .= strip_empty_words($mots_perso) . ' '; } } pmb_mysql_free_result($tu); } // indexer les cotes des etat des collections : $p_perso = new parametres_perso("collstate"); $coll = pmb_mysql_query("select collstate_id, collstate_cote from collections_state WHERE id_serial=" . $notice, $dbh); $numcoll = pmb_mysql_num_rows($coll); for ($j = 0; $j < $numcoll; $j++) { $mescoll = pmb_mysql_fetch_assoc($coll); $infos_global .= $mescoll['collstate_cote'] . ' '; $infos_global_index .= strip_empty_words($mescoll['collstate_cote']) . ' '; // champ perso cherchable $mots_perso = $p_perso->get_fields_recherche($mescoll['collstate_id']); if ($mots_perso) { $infos_global .= $mots_perso . ' '; $infos_global_index .= strip_empty_words($mots_perso) . ' '; } } pmb_mysql_free_result($coll); // Nomenclature global $pmb_nomenclature_activate; if ($pmb_nomenclature_activate) { $mots = nomenclature_record_ui::get_index($notice); $infos_global .= $mots . ' '; $infos_global_index .= strip_empty_words($mots) . ' '; } // champ perso cherchable $p_perso = new parametres_perso("notices"); $mots_perso = $p_perso->get_fields_recherche($notice); if ($mots_perso) { $infos_global .= $mots_perso . ' '; $infos_global_index .= strip_empty_words($mots_perso) . ' '; } // champs des authperso $auth_perso = new authperso_notice($notice); $mots_authperso = $auth_perso->get_fields_search(); if ($mots_authperso) { $infos_global .= $mots_authperso . ' '; $infos_global_index .= strip_empty_words($mots_authperso) . ' '; } // flux RSS éventuellement $eformat = array(); $eformat = explode(' ', $eformatlien); if ($eformat[0] == 'RSS' && $eformat[3] == '1') { $flux = strip_tags(affiche_rss($notice)); $infos_global_index .= strip_empty_words($flux) . ' '; } pmb_mysql_query("insert into notices_global_index SET num_notice=" . $notice . ",no_index =" . $NoIndex . ", infos_global='" . addslashes($infos_global) . "', index_infos_global='" . addslashes($infos_global_index) . "'", $dbh); }
function update($value, $force = false) { global $dbh; global $msg, $charset; global $include_path; global $pmb_synchro_rdf; global $thesaurus_concepts_active; global $opac_enrichment_bnf_sparql; if (!$value['name']) { return false; } // nettoyage des chaînes en entrée $value['name'] = clean_string($value['name']); $value['rejete'] = clean_string($value['rejete']); $value['date'] = clean_string($value['date']); $value['lieu'] = clean_string($value['lieu']); $value['ville'] = clean_string($value['ville']); $value['pays'] = clean_string($value['pays']); $value['subdivision'] = clean_string($value['subdivision']); $value['numero'] = clean_string($value['numero']); if (!$force) { if ($this->id) { // s'assurer que l'auteur n'existe pas déjà switch ($value['type']) { case 71: // Collectivité $and_dedoublonnage = " and author_subdivision ='" . $value['subdivision'] . "' and author_lieu='" . $value['lieu'] . "' and author_ville = '" . $value['ville'] . "' and author_pays = '" . $value['pays'] . "' and author_numero ='" . $value['numero'] . "' "; break; case 72: // Congrès $and_dedoublonnage = " and author_subdivision ='" . $value['subdivision'] . "' and author_lieu='" . $value['lieu'] . "' and author_ville = '" . $value['ville'] . "' and author_pays = '" . $value['pays'] . "' and author_numero ='" . $value['numero'] . "' "; break; default: $and_dedoublonnage = ''; break; } $dummy = "SELECT * FROM authors WHERE author_type='" . $value['type'] . "' AND author_name='" . $value['name'] . "'"; $dummy .= " AND author_rejete='" . $value['rejete'] . "' "; $dummy .= "AND author_date='" . $value[date] . "' and author_id!='" . $this->id . "' {$and_dedoublonnage} "; $check = pmb_mysql_query($dummy, $dbh); if (pmb_mysql_num_rows($check)) { $auteur_exists = new auteur(pmb_mysql_result($check, 0, "author_id")); require_once "{$include_path}/user_error.inc.php"; warning($msg[200], htmlentities($msg[220] . " -> " . $auteur_exists->display, ENT_QUOTES, $charset)); return FALSE; } } else { // s'assurer que l'auteur n'existe pas déjà if ($id_auteur_exists = auteur::check_if_exists($value)) { $auteur_exists = new auteur($id_auteur_exists); require_once "{$include_path}/user_error.inc.php"; warning($msg[200], htmlentities($msg[220] . " -> " . $auteur_exists->display, ENT_QUOTES, $charset)); return FALSE; } } // s'assurer que la forme_retenue ne pointe pas dans les deux sens if ($this->id) { $dummy = "SELECT * FROM authors WHERE author_id='" . $value[voir_id] . "' and author_see='" . $this->id . "'"; $check = pmb_mysql_query($dummy, $dbh); if (pmb_mysql_num_rows($check)) { require_once "{$include_path}/user_error.inc.php"; warning($msg[200], htmlentities($msg['author_forme_retenue_error'] . " -> " . $this->display, ENT_QUOTES, $charset)); return FALSE; } } } $requete = "SET author_type='{$value['type']}', "; $requete .= "author_name='{$value['name']}', "; $requete .= "author_rejete='{$value['rejete']}', "; $requete .= "author_date='{$value['date']}', "; $requete .= "author_lieu='" . $value["lieu"] . "', "; $requete .= "author_ville='" . $value["ville"] . "', "; $requete .= "author_pays='" . $value["pays"] . "', "; $requete .= "author_subdivision='" . $value["subdivision"] . "', "; $requete .= "author_numero='" . $value["numero"] . "', "; $requete .= "author_web='{$value['author_web']}', "; $requete .= "author_see='{$value['voir_id']}', "; $requete .= "author_comment='{$value['author_comment']}', "; $word_to_index = $value["name"] . " " . $value["rejete"] . " " . $value["lieu"] . " " . $value["ville"] . " " . $value["pays"] . " " . $value["numero"] . " " . $value["subdivision"]; if ($value['type'] == 72) { $word_to_index .= " " . $value["date"]; } $requete .= "index_author=' " . strip_empty_chars($word_to_index) . " ',"; $requete .= "author_import_denied= " . ($value['import_denied'] ? 1 : 0); if ($this->id) { audit::insert_modif(AUDIT_AUTHOR, $this->id); // update // on checke s'il n'y a pas un renvoi circulaire if ($this->id == $value['voir_id']) { require_once "{$include_path}/user_error.inc.php"; warning($msg[199], htmlentities($msg[222] . " -> " . $this->display, ENT_QUOTES, $charset)); return FALSE; } $requete = 'UPDATE authors ' . $requete; $requete .= ' WHERE author_id=' . $this->id . ' ;'; if (pmb_mysql_query($requete, $dbh)) { // liens entre autorités $aut_link = new aut_link(AUT_TABLE_AUTHORS, $this->id); $aut_link->save_form(); $aut_pperso = new aut_pperso("author", $this->id); $aut_pperso->save_form(); auteur::update_index($this->id); // mise à jour de l'auteur dans la base rdf if ($pmb_synchro_rdf) { $synchro_rdf = new synchro_rdf(); $synchro_rdf->updateAuthority($this->id, 'auteur'); } // ////////////////////////modif de l'update/////////////////////////////// $query = "select 1 from authors where (author_enrichment_last_update < now()-interval '0' day) and author_id={$this->id}"; $result = pmb_mysql_query($query, $dbh); if ($opac_enrichment_bnf_sparql && pmb_mysql_num_rows($result)) { auteur::author_enrichment($this->id); } // //////////////////////////////////////////////////////////////////////// } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[199], htmlentities($msg[208] . " -> " . $this->display, ENT_QUOTES, $charset)); return FALSE; } } else { // creation $requete = 'INSERT INTO authors ' . $requete . ' '; if (pmb_mysql_query($requete, $dbh)) { $this->id = pmb_mysql_insert_id(); // liens entre autorités $aut_link = new aut_link(AUT_TABLE_AUTHORS, $this->id); $aut_link->save_form(); $aut_pperso = new aut_pperso("author", $this->id); $aut_pperso->save_form(); audit::insert_creation(AUDIT_AUTHOR, $this->id); // ajout des enrichissements si activés if ($opac_enrichment_bnf_sparql) { auteur::author_enrichment($this->id); } } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[200], htmlentities($msg[221] . " -> " . $requete, ENT_QUOTES, $charset)); return FALSE; } } // Indexation concepts if ($thesaurus_concepts_active == 1) { $index_concept = new index_concept($this->id, TYPE_AUTHOR); $index_concept->save(); } // Mise à jour des vedettes composées contenant cette autorité vedette_composee::update_vedettes_built_with_element($this->id, "author"); return TRUE; }
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; } } }
function update($value) { global $dbh; global $msg; global $include_path; if (!$value) { return false; } // nettoyage de la chaîne en entrée $value = clean_string($value); $requete = "SET serie_name='" . $value . "', "; $requete .= "serie_index=' " . strip_empty_words($value) . " '"; if ($this->s_id) { // update $requete = 'UPDATE series ' . $requete; $requete .= ' WHERE serie_id=' . $this->s_id . ' LIMIT 1;'; if (mysql_query($requete, $dbh)) { $rqt_notice = "select notice_id,tit1,tit2,tit3,tit4 from notices where tparent_id=" . $this->s_id; $r_notice = mysql_query($rqt_notice); while ($r = mysql_fetch_object($r_notice)) { $rq_serie = "update notices, series set notices.index_serie=serie_index, notices.index_wew=concat(serie_name,' ',tit1,' ',tit2,' ',tit3,' ',tit4),notices.index_sew=concat(' ',serie_index,' ','" . addslashes(strip_empty_words($r->tit1 . " " . $r->tit2 . " " . $r->tit3 . " " . $r->tit4)) . "',' ') where notice_id=" . $r->notice_id . " and serie_id=tparent_id"; mysql_query($rq_serie); } $aut_link = new aut_link(AUT_TABLE_SERIES, $this->s_id); $aut_link->save_form(); $aut_pperso = new aut_pperso("serie", $this->s_id); $aut_pperso->save_form(); serie::update_index($this->s_id); audit::insert_modif(AUDIT_SERIE, $this->s_id); return TRUE; } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[337], $msg[341]); return FALSE; } } else { // création : s'assurer que le titre n'existe pas déjà $dummy = "SELECT * FROM series WHERE serie_name REGEXP '^{$value}\$' LIMIT 1 "; $check = mysql_query($dummy, $dbh); if (mysql_num_rows($check)) { require_once "{$include_path}/user_error.inc.php"; warning($msg[336], $msg[340]); return FALSE; } $requete = 'INSERT INTO series ' . $requete . ';'; if (mysql_query($requete, $dbh)) { $this->s_id = mysql_insert_id(); $aut_link = new aut_link(AUT_TABLE_SERIES, $this->s_id); $aut_link->save_form(); $aut_pperso = new aut_pperso("serie", $this->s_id); $aut_pperso->save_form(); audit::insert_creation(AUDIT_SERIE, $this->s_id); return TRUE; } else { require_once "{$include_path}/user_error.inc.php"; warning($msg[336], $msg[342]); return FALSE; } } }
function update($value) { global $dbh; global $msg; global $include_path; global $pmb_synchro_rdf; if (!$value['name']) { return false; } // nettoyage des chaînes en entrée $value['name'] = clean_string($value['name']); $value['num_author'] = clean_string($value['num_author']); $value['form'] = clean_string($value['form']); $value['date'] = clean_string($value['date']); $value['subject'] = clean_string($value['subject']); $value['place'] = clean_string($value['place']); $value['history'] = clean_string($value['history']); $value['characteristic'] = clean_string($value['characteristic']); $value['intended_termination'] = clean_string($value['intended_termination']); $value['intended_audience'] = clean_string($value['intended_audience']); $value['context'] = clean_string($value['context']); $value['equinox'] = clean_string($value['equinox']); $value['coordinates'] = clean_string($value['coordinates']); $value['tonalite'] = clean_string($value['tonalite']); $value['comment'] = clean_string($value['comment']); $titre = titre_uniforme::import_tu_exist($value, 1, $this->id); if ($titre) { require_once "{$include_path}/user_error.inc.php"; warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_doublon_erreur"]); return FALSE; } $tu_auteur = new auteur($value['num_author']); if (!$tu_auteur->id) { $value['num_author'] = 0; } else { $value['num_author'] = $tu_auteur->id; } $flag_index = 0; $requete = "SET "; $requete .= "tu_name='" . $value["name"] . "', "; $requete .= "tu_num_author='" . $value['num_author'] . "', "; $requete .= "tu_forme='" . $value["form"] . "', "; $requete .= "tu_date='" . $value["date"] . "', "; $requete .= "tu_sujet='" . $value["subject"] . "', "; $requete .= "tu_lieu='" . $value["place"] . "', "; $requete .= "tu_histoire='" . $value["history"] . "', "; $requete .= "tu_caracteristique='" . $value["characteristic"] . "', "; $requete .= "tu_completude='" . $value["intended_termination"] . "', "; $requete .= "tu_public='" . $value["intended_audience"] . "', "; $requete .= "tu_contexte='" . $value["context"] . "', "; $requete .= "tu_equinoxe='" . $value["equinox"] . "', "; $requete .= "tu_coordonnees='" . $value["coordinates"] . "', "; $requete .= "tu_tonalite='" . $value["tonalite"] . "', "; $requete .= "tu_comment='" . $value["comment"] . "', "; $requete .= "tu_import_denied='" . $value["import_denied"] . "'"; if ($this->id) { // update $requete = 'UPDATE titres_uniformes ' . $requete; $requete .= ' WHERE tu_id=' . $this->id . ' ;'; if (mysql_query($requete, $dbh)) { $flag_index = 1; } else { require_once "{$include_path}/user_error.inc.php"; warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_modif_erreur"]); return FALSE; } audit::insert_modif(AUDIT_TITRE_UNIFORME, $this->id); } else { // creation $requete = 'INSERT INTO titres_uniformes ' . $requete . ' '; $result = mysql_query($requete, $dbh); if ($result) { $this->id = mysql_insert_id(); } else { require_once "{$include_path}/user_error.inc.php"; warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_creation_erreur"]); return FALSE; } audit::insert_creation(AUDIT_TITRE_UNIFORME, $this->id); } $aut_link = new aut_link(AUT_TABLE_TITRES_UNIFORMES, $this->id); $aut_link->save_form(); $aut_pperso = new aut_pperso("tu", $this->id); $aut_pperso->save_form(); // Gestion des champ répétables $requete = "DELETE FROM tu_distrib WHERE distrib_num_tu='{$this->id}' "; mysql_query($requete, $dbh); $requete = "DELETE FROM tu_ref WHERE ref_num_tu='{$this->id}' "; mysql_query($requete, $dbh); $requete = "DELETE FROM tu_subdiv WHERE subdiv_num_tu='{$this->id}' "; mysql_query($requete, $dbh); // Distribution instrumentale et vocale (pour la musique) for ($i = 0; $i < count($value['distrib']); $i++) { $requete = "INSERT INTO tu_distrib SET\n\t\t\tdistrib_num_tu='{$this->id}',\n\t\t\tdistrib_name='" . $value['distrib'][$i] . "',\n\t\t\tdistrib_ordre='{$i}' "; mysql_query($requete, $dbh); } // Référence numérique (pour la musique) for ($i = 0; $i < count($value['ref']); $i++) { $requete = "INSERT INTO tu_ref SET\n\t\tref_num_tu='{$this->id}',\n\t\tref_name='" . $value['ref'][$i] . "',\n\t\tref_ordre='{$i}' "; mysql_query($requete, $dbh); } // Subdivison de forme for ($i = 0; $i < count($value['subdiv']); $i++) { $requete = "INSERT INTO tu_subdiv SET\n\t\tsubdiv_num_tu='{$this->id}',\n\t\tsubdiv_name='" . $value['subdiv'][$i] . "',\n\t\tsubdiv_ordre='{$i}' "; mysql_query($requete, $dbh); } // mise à jour du champ index du titre uniforme if ($this->id) { titre_uniforme::update_index_tu($this->id); } // réindexation de la notice if ($flag_index) { titre_uniforme::update_index($this->id); } //mise à jour de l'oeuvre rdf if ($flag_index && $pmb_synchro_rdf) { $synchro_rdf = new synchro_rdf(); $synchro_rdf->updateAuthority($this->id, 'oeuvre'); } return TRUE; }