Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 function update_from_form($id = 0)
 {
     global $dbh;
     global $thesaurus_concepts_active;
     global $authority_statut;
     $id += 0;
     if (!$id) {
         $requete = "insert into authperso_authorities set authperso_authority_authperso_num=" . $this->id;
         pmb_mysql_query($requete);
         $id = pmb_mysql_insert_id($dbh);
         audit::insert_creation($this->id + 1000, $id);
     } else {
         audit::insert_modif($this->id + 1000, $id);
     }
     if (!$id) {
         return;
     }
     //update authority informations
     $authority = new authority(0, $id, AUT_TABLE_AUTHPERSO);
     $authority->set_num_statut($authority_statut);
     $authority->update();
     $p_perso = new custom_parametres_perso("authperso", "authperso", $this->id);
     $p_perso->rec_fields_perso($id);
     $aut_link = new aut_link($this->id + 1000, $id);
     $aut_link->save_form();
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($id, TYPE_AUTHPERSO);
         $index_concept->save();
     }
     $this->update_global_index($id);
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
     $requete = "INSERT INTO exemplaires set {$values} , create_date=sysdate() ";
     $myQuery = pmb_mysql_query($requete, $dbh);
     $expl_id = pmb_mysql_insert_id();
     audit::insert_creation(AUDIT_EXPL, $expl_id);
 }
 if ($abt_id && $serial_circ_add) {
     $serialcirc_diff = new serialcirc_diff(0, $abt_id);
 }
 // Si c'est à faire circuler
 if ($serialcirc_diff->id) {
     $serialcirc_diff->add_circ_expl($expl_id);
 }
 // traitement des concepts
 if ($thesaurus_concepts_active == 1) {
     $index_concept = new index_concept($expl_id, TYPE_EXPL);
     $index_concept->save();
 }
 //Insertion des champs personalises
 $p_perso->rec_fields_perso($expl_id);
 // Mise a jour de la table notices_mots_global_index pour toutes les notices en relation avec l'exemplaire
 $req_maj = "SELECT bulletin_notice,num_notice, analysis_notice FROM bulletins LEFT JOIN analysis ON analysis_bulletin=bulletin_id WHERE bulletin_id='" . $expl_bulletin . "'";
 $res_maj = pmb_mysql_query($req_maj);
 if ($res_maj && pmb_mysql_num_rows($res_maj)) {
     $first = true;
     //Pour la premiere ligne de résultat on doit indexer aussi la notice de périodique et de bulletin au besoin
     while ($ligne = pmb_mysql_fetch_object($res_maj)) {
         if ($first) {
             if ($ligne->bulletin_notice) {
                 notice::majNoticesMotsGlobalIndex($ligne->bulletin_notice, 'expl');
             }
             if ($ligne->num_notice) {
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
 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;
 }
Ejemplo n.º 9
0
 function update($with_print = true)
 {
     global $dbh, $msg;
     global $current_module, $pmb_explnum_statut;
     global $id_rep, $up_place;
     global $mime_vign;
     global $gestion_acces_active, $gestion_acces_empr_docnum;
     global $res_prf, $chk_rights, $prf_rad, $r_rad;
     global $thesaurus_concepts_active;
     $update = false;
     if ($this->explnum_id) {
         $requete = "UPDATE explnum SET ";
         $limiter = " WHERE explnum_id='{$this->explnum_id}' ";
         $update = true;
     } else {
         $requete = "INSERT INTO explnum SET ";
         $limiter = "";
     }
     if ($with_print) {
         print "<div class=\"row\"><h1>{$msg['explnum_doc_associe']}</h1>";
     }
     if (!$this->params["erreur"]) {
         $requete .= " explnum_notice='" . $this->infos_docnum["notice"] . "'";
         $requete .= ", explnum_bulletin='" . $this->infos_docnum["bull"] . "'";
         $requete .= ", explnum_nom='" . $this->infos_docnum["nom"] . "'";
         $requete .= ", explnum_url='" . $this->infos_docnum["url"] . "'";
         if ($this->params["maj_mimetype"]) {
             $requete .= ", explnum_mimetype='" . $this->infos_docnum["mime"] . "' ";
         }
         if ($this->params["maj_data"]) {
             if (!$this->params["is_upload"]) {
                 $requete .= ", explnum_data='" . addslashes($this->infos_docnum["contenu"]) . "'";
             }
             $requete .= ", explnum_nomfichier='" . addslashes($this->infos_docnum["userfile_name"]) . "'";
             $requete .= ", explnum_extfichier='" . addslashes($this->infos_docnum["userfile_ext"]) . "'";
         }
         if ($this->params["maj_vignette"] && !$this->params["conservervignette"]) {
             $requete .= ", explnum_vignette='" . addslashes($this->infos_docnum["contenu_vignette"]) . "'";
         }
         if ($pmb_explnum_statut == '1') {
             $requete .= ", explnum_statut='" . $this->params["statut"] . "'";
         }
         $requete .= ", explnum_repertoire='" . ($up_place ? $id_rep : 0) . "'";
         $requete .= ", explnum_path='" . $this->infos_docnum["path"] . "'";
         $requete .= ", explnum_docnum_statut='" . $this->params["explnum_statut"] . "'";
         $requete .= $limiter;
         pmb_mysql_query($requete, $dbh);
         if (!$update) {
             $this->explnum_id = pmb_mysql_insert_id();
         }
         //traitement des droits acces user_docnum
         if ($gestion_acces_active == 1 && $gestion_acces_empr_docnum == 1) {
             $ac = new acces();
             $dom_3 = $ac->setDomain(3);
             if ($update) {
                 $dom_3->storeUserRights(1, $this->explnum_id, $res_prf, $chk_rights, $prf_rad, $r_rad);
             } else {
                 $dom_3->storeUserRights(0, $this->explnum_id, $res_prf, $chk_rights, $prf_rad, $r_rad);
             }
         }
         //Indexation du document
         global $pmb_indexation_docnum;
         if ($pmb_indexation_docnum) {
             $vign_index = $this->indexer_docnum();
             if (!$mime_vign && !$this->params["conservervignette"] && !$this->infos_docnum["vignette_name"]) {
                 if ($vign_index) {
                     $req_mime = "update explnum set explnum_vignette='" . addslashes($vign_index) . "' where explnum_id='" . $this->explnum_id . "'";
                     pmb_mysql_query($req_mime, $dbh);
                 } else {
                     $contenu_vignette = construire_vignette("", "", $this->infos_docnum["url"]);
                     if ($contenu_vignette) {
                         $req_mime = "update explnum set explnum_vignette='" . addslashes($contenu_vignette) . "' where explnum_id='" . $this->explnum_id . "'";
                         pmb_mysql_query($req_mime, $dbh);
                     }
                 }
             }
         } elseif (!$mime_vign && !$this->params["conservervignette"] && !$this->infos_docnum["vignette_name"] && $this->infos_docnum["url"]) {
             //Si pas d'indexation et que je ne force pas la vignette en fonction du mimetype et si j'ai une url
             $contenu_vignette = construire_vignette("", "", $this->infos_docnum["url"]);
             if ($contenu_vignette) {
                 $req_mime = "update explnum set explnum_vignette='" . addslashes($contenu_vignette) . "' where explnum_id='" . $this->explnum_id . "'";
                 pmb_mysql_query($req_mime, $dbh);
             }
         }
         // Segmentation du document
         global $pmb_diarization_docnum;
         if ($pmb_diarization_docnum) {
             $this->diarization_docnum();
         }
         // Indexation concepts
         if ($thesaurus_concepts_active == 1) {
             $index_concept = new index_concept($this->explnum_id, TYPE_EXPLNUM);
             $index_concept->save();
         }
         //On enregistre la ou les localisations
         global $loc_selector;
         if ($update) {
             $req = "delete from explnum_location where num_explnum='" . $this->explnum_id . "'";
             pmb_mysql_query($req, $dbh);
         }
         if (count($loc_selector) == 1 && $loc_selector[0] == -1) {
             //Ne rien faire
             //$req = "select idlocation from docs_location";
             //$res = pmb_mysql_query($req,$dbh);
             //while($loc=pmb_mysql_fetch_object($res)){
             //	$req = "replace into explnum_location set num_explnum='".$this->explnum_id."', num_location='".$loc->idlocation."'";
             //	pmb_mysql_query($req,$dbh);
             //}
         } else {
             for ($i = 0; $i < count($loc_selector); $i++) {
                 $req = "replace into explnum_location set num_explnum='" . $this->explnum_id . "', num_location='" . $loc_selector[$i] . "'";
                 pmb_mysql_query($req, $dbh);
             }
         }
         // on reaffiche l'ISBD
         if ($with_print) {
             print "<div class='row'><div class='msg-perio'>" . $msg['maj_encours'] . "</div></div>";
         }
         $id_form = md5(microtime());
         if (pmb_mysql_error()) {
             if ($with_print) {
                 echo "MySQL error : " . pmb_mysql_error();
                 print "\n\t\t\t\t\t\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"" . $this->params["retour"] . "\" >\n\t\t\t\t\t\t\t\t<input type='submit' class='bouton' name=\"id_form\" value=\"Ok\">\n\t\t\t\t\t\t\t\t</form>";
                 print "</div>";
             }
             exit;
         }
         if ($with_print) {
             print "\n\t\t\t\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"" . $this->params["retour"] . "\" style=\"display:none\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"id_form\" value=\"{$id_form}\">\n\t\t\t\t\t\t</form>";
             print "<script type=\"text/javascript\">document.dummy.submit();</script>";
         }
     } else {
         eval("\$bid=\"" . $msg['explnum_erreurupload'] . "\";");
         if ($with_print) {
             print "<div class='row'><div class='msg-perio'>" . $bid . "</div></div>";
             print "\n\t\t\t\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"" . $this->params["retour"] . "\" >\n\t\t\t\t\t\t<input type='submit' class='bouton' name=\"id_form\" value=\"Ok\">\n\t\t\t\t\t</form>";
         }
     }
     if ($with_print) {
         print "</div>";
     }
 }
Ejemplo n.º 10
0
 function update($value, $force_creation = false)
 {
     global $dbh;
     global $msg, $charset;
     global $include_path;
     global $thesaurus_concepts_active;
     //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 (pmb_mysql_query($requete, $dbh)) {
             $requete = "select collection_parent from collections WHERE collection_id='" . $value[parent] . "' ";
             $res = pmb_mysql_query($requete, $dbh);
             $ed_parent = pmb_mysql_result($res, 0, 0);
             $requete = "update notices set ed1_id='{$ed_parent}', coll_id='" . $value[parent] . "' WHERE subcoll_id='" . $this->id . "' ";
             $res = pmb_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);
         } 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 (pmb_mysql_query($requete, $dbh)) {
             $this->id = pmb_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);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[177], htmlentities($msg[182] . " -> " . $requete, ENT_QUOTES, $charset));
             return FALSE;
         }
     }
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_SUBCOLLECTION);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->id, "subcollection");
     return TRUE;
 }