Exemplo n.º 1
0
 function save()
 {
     global $dbh;
     if (!$this->num_thesaurus) {
         die('Erreur de création noeud');
     }
     if ($this->id_noeud) {
         //Mise à jour noeud
         $q = 'update noeuds set autorite =\'' . addslashes($this->autorite) . '\', ';
         $q .= 'num_parent = \'' . $this->num_parent . '\', num_renvoi_voir = \'' . $this->num_renvoi_voir . '\', ';
         $q .= 'visible = \'' . $this->visible . '\', num_thesaurus = \'' . $this->num_thesaurus . '\', ';
         $q .= 'authority_import_denied = \'' . $this->authority_import_denied . '\', not_use_in_indexation = \'' . $this->not_use_in_indexation . '\' ';
         $q .= 'where id_noeud = \'' . $this->id_noeud . '\' ';
         pmb_mysql_query($q, $dbh);
         audit::insert_modif(AUDIT_CATEG, $this->id_noeud);
     } else {
         $q = 'insert into noeuds set autorite = \'' . addslashes($this->autorite) . '\', ';
         $q .= 'num_parent = \'' . $this->num_parent . '\', num_renvoi_voir = \'' . $this->num_renvoi_voir . '\', ';
         $q .= 'visible = \'' . $this->visible . '\', num_thesaurus = \'' . $this->num_thesaurus . '\', ';
         $q .= 'authority_import_denied = \'' . $this->authority_import_denied . '\', not_use_in_indexation = \'' . $this->not_use_in_indexation . '\' ';
         pmb_mysql_query($q, $dbh);
         $this->id_noeud = pmb_mysql_insert_id($dbh);
         audit::insert_creation(AUDIT_CATEG, $this->id_noeud);
     }
     //update authority informations
     $authority = new authority(0, $this->id_noeud, AUT_TABLE_CATEG);
     $authority->set_num_statut($this->num_statut);
     $authority->update();
     // Mis à jour du path de lui-meme, et de tous les fils
     $thes = thesaurus::getByEltId($this->id_noeud);
     $id_top = $thes->num_noeud_racine;
     $path = '';
     $id_tmp = $this->id_noeud;
     while (true) {
         $q = "select num_parent from noeuds where id_noeud = '" . $id_tmp . "' limit 1";
         $r = pmb_mysql_query($q, $dbh);
         $id_tmp = $id_cur = pmb_mysql_result($r, 0, 0);
         if (!$id_cur || $id_cur == $id_top) {
             break;
         }
         if ($path) {
             $path = '/' . $path;
         }
         $path = $id_tmp . $path;
     }
     noeuds::process_categ_path($this->id_noeud, $path);
 }
Exemplo n.º 2
0
 static function change_state($state, $demande)
 {
     global $dbh, $demandes_init_workflow, $demandes_default_action, $pmb_type_audit;
     global $PMBuserid;
     global $sujet, $idtype, $idstatut;
     global $date_debut, $date_fin, $detail;
     global $time_elapsed, $progression, $cout, $iddemande, $ck_prive;
     if ($demandes_init_workflow === "1" && $PMBuserid) {
         //La demande est elle attribué à un utilisateur ?
         $query = 'SELECT 1 FROM demandes_users WHERE num_demande=' . $demande->id_demande;
         $result = pmb_mysql_query($query, $dbh);
         if (!pmb_mysql_num_rows($result)) {
             //si non, on attribue
             $query = 'INSERT INTO demandes_users SET num_user="******", num_demande="' . $demande->id_demande . '", date_creation="' . date("Y-m-d", time()) . '", users_statut=1';
             pmb_mysql_query($query, $dbh);
         }
     }
     $req = "update demandes set etat_demande={$state} where id_demande='" . $demande->id_demande . "'";
     pmb_mysql_query($req, $dbh);
     if ($state == 2 && $demandes_default_action === "1") {
         $query = "SELECT id_action FROM demandes_actions WHERE num_demande=" . $demande->id_demande;
         $result = pmb_mysql_query($query, $dbh);
         if (!pmb_mysql_num_rows($result)) {
             $action_default = new demandes_actions();
             $action_default->num_demande = $demande->id_demande;
             $action_default->actions_num_user = $PMBuserid;
             $action_default->date_action = date("Y-m-d", time());
             $action_default->deadline_action = date("Y-m-d", time());
             if ($action_default->list_statut) {
                 $action_default->statut_action = "";
                 for ($i = 1; $i <= count($action_default->list_statut); $i++) {
                     if ($action_default->list_statut[$i]['default']) {
                         $action_default->statut_action = $action_default->list_statut[$i]['id'];
                     }
                 }
                 if ($idstatut == "") {
                     reset($action_default->list_statut);
                     $first_statut = current($action_default->list_statut);
                     $action_default->statut_action = $first_statut['id'];
                 }
             }
             $action_default->type_action = $demande->first_action;
             $action_default->sujet_action = $demande->titre_demande;
             $action_default->detail_action = $demande->sujet_demande;
             demandes_actions::save($action_default);
         }
     }
     if ($pmb_type_audit) {
         audit::insert_modif(AUDIT_DEMANDE, $demande->id_demande);
     }
 }
Exemplo n.º 3
0
 function update_in_database($id_notice = 0)
 {
     global $dbh;
     global $pmb_synchro_rdf;
     $new_notice = 2;
     $notice_retour = $id_notice;
     if (!$id_notice) {
         $retour = array(2, 0);
         return $retour;
     }
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf($notice_retour, 0);
     }
     // traitement des titres uniformes
     global $pmb_use_uniform_title;
     if ($pmb_use_uniform_title) {
         if (count($this->titres_uniformes)) {
             $ntu = new tu_notice($id_notice);
             $ntu->update($this->titres_uniformes);
         }
     }
     for ($i = 0; $i < 2; $i++) {
         if ($this->editors[$i]['id']) {
             $editor_ids[$i] = $this->editors[$i]['id'];
         } else {
             $editor_ids[$i] = editeur::import($this->editors[$i]);
         }
     }
     if ($this->collection["id"]) {
         $collection_id = $this->collection["id"];
     } else {
         $this->collection['parent'] = $editor_ids[0];
         $collection_id = collection::import($this->collection);
     }
     if ($this->subcollection["id"]) {
         $subcollection_id = $this->subcollection["id"];
     } else {
         $this->subcollection['coll_parent'] = $collection_id;
         $subcollection_id = subcollection::import($this->subcollection);
         $serie_id = serie::import(stripslashes($this->serie));
     }
     /* traitement de Dewey */
     if (!$this->internal_index) {
         if (!$this->dewey["new_comment"]) {
             $this->dewey["new_comment"] = "";
         }
         if (!$this->dewey["new_pclass"]) {
             $this->dewey["new_pclass"] = "";
         }
         $this->internal_index = indexint::import(clean_string($this->dewey[0]), clean_string($this->dewey["new_comment"]), clean_string($this->dewey["new_pclass"]));
     }
     $date_parution_z3950 = notice::get_date_parution($this->year);
     /* Origine de la notice */
     $this->orinot_id = origine_notice::import($this->origine_notice);
     if ($this->orinot_id == 0) {
         $this->orinot_id = 1;
     }
     $sql_ins = "update notices set\n\t\t\ttypdoc           \t='" . $this->document_type . "',\n\t\t\tcode        \t        ='" . $this->isbn . "',\t            \n\t\t\ttit1                    ='" . $this->titles[0] . "',             \n\t\t\ttit2                    ='" . $this->titles[1] . "',             \n\t\t\ttit3                    ='" . $this->titles[2] . "',             \n\t\t\ttit4                    ='" . $this->titles[3] . "',             \n\t\t\ttparent_id              ='" . $serie_id . "',                    \n\t\t\ttnvol                   ='" . $this->nbr_in_serie . "',          \n\t\t\ted1_id                  =" . $editor_ids[0] . " ,                \n\t\t\ted2_id                  =" . $editor_ids[1] . " ,                \n\t\t\tyear                    ='" . $this->year . "',                  \n\t\t\tnpages                  ='" . $this->page_nbr . "',              \n\t\t\till                     ='" . $this->illustration . "',          \n\t\t\tsize                    ='" . $this->size . "',                  \n\t\t\taccomp                  ='" . $this->accompagnement . "',        \n\t\t\tcoll_id                 =" . $collection_id . " ,                \n\t\t\tsubcoll_id              =" . $subcollection_id . " ,             \n\t\t\tnocoll                  ='" . $this->nbr_in_collection . "',     \n\t\t\tmention_edition         ='" . $this->mention_edition . "',       \n\t\t\tn_gen                   ='" . $this->general_note . "',          \n\t\t\tn_contenu               ='" . $this->content_note . "',          \n\t\t\tn_resume                ='" . $this->abstract_note . "',         \n\t\t\tindexint                ='" . $this->internal_index . "',          \n\t\t\tstatut\t\t\t\t\t='" . $this->statut . "',\n\t\t\tcommentaire_gestion\t\t='" . $this->commentaire_gestion . "',\n\t\t\tindexation_lang\t\t\t='" . $this->indexation_lang . "',\n\t\t\tthumbnail_url\t\t\t='" . $this->thumbnail_url . "',\n\t\t\tindex_l                 ='" . clean_tags($this->free_index) . "',                \n\t\t\tniveau_biblio           ='" . $this->bibliographic_level . "',   \n\t\t\tniveau_hierar           ='" . $this->hierarchic_level . "',      \n\t\t\tlien                    ='" . $this->link_url . "',              \n\t\t\teformat                 ='" . $this->link_format . "',           \n\t\t\torigine_catalogage      ='" . $this->orinot_id . "',             \n\t\t\tprix                    ='" . $this->prix . "',\n\t\t\tdate_parution \t\t\t='" . $date_parution_z3950 . "'             \n\t\t\twhere notice_id='{$id_notice}' ";
     //echo "<pre>";
     //print_r($this->aut_array);
     //echo "</pre>";
     //echo $sql_ins."<br />";
     //echo "<pre>";
     //print_r($this->categories);
     //echo "</pre>";
     //exit;
     $sql_result_ins = pmb_mysql_query($sql_ins) or die("Couldn't update notices : " . $sql_ins);
     $notice_retour = $id_notice;
     audit::insert_modif(AUDIT_NOTICE, $id_notice);
     // purge de la base des responsabilités de la notice intégrée...
     if ($notice_retour) {
         $rqt_del = "delete from responsability where responsability_notice='{$notice_retour}'";
         $sql_result_del = pmb_mysql_query($rqt_del) or die("Couldn't purge table responsability : " . $rqt_del);
     }
     $rqt_ins = "insert into responsability (responsability_author, responsability_notice, responsability_fonction, responsability_type, responsability_ordre) VALUES ";
     for ($i = 0; $i < sizeof($this->aut_array); $i++) {
         $aut['id'] = clean_string($this->aut_array[$i]['id']);
         $aut['name'] = clean_string($this->aut_array[$i]['entree']);
         $aut['rejete'] = clean_string($this->aut_array[$i]['rejete']);
         $aut['date'] = clean_string($this->aut_array[$i]['date']);
         $aut['type'] = $this->aut_array[$i]['type_auteur'];
         $aut['subdivision'] = clean_string($this->aut_array[$i]['subdivision']);
         $aut['numero'] = clean_string($this->aut_array[$i]['numero']);
         $aut['lieu'] = clean_string($this->aut_array[$i]['lieu']);
         $aut['ville'] = clean_string($this->aut_array[$i]['ville']);
         $aut['pays'] = clean_string($this->aut_array[$i]['pays']);
         $aut['web'] = clean_string($this->aut_array[$i]['web']);
         $aut['author_comment'] = clean_string($this->aut_array[$i]['author_comment']);
         $aut['authority_number'] = clean_string($this->aut_array[$i]['authority_number']);
         /* Origine de l'autorité : on reprend les infos d'origine de la notice pour les attribuées aux origines des autorités */
         $id_origine_auth = 0;
         $id_origine_auth = origin_authorities::import($this->origine_notice);
         if ($id_origine_auth == 0) {
             $id_origine_auth = 1;
         }
         // import de l'autorité auteur si elle n'existe pas et conservation des infos sur l'origine de l'autorité
         if ($aut['authority_number'] != '' && $id_origine_auth) {
             $this->aut_array[$i]["id"] = $this->insert_authority_infos($aut['authority_number'], "author", $id_origine_auth, $aut);
         }
         if (!$this->aut_array[$i]["id"]) {
             $this->aut_array[$i]["id"] = auteur::import($aut);
         }
         if ($this->aut_array[$i]["id"]) {
             $rqt = $rqt_ins . " (" . $this->aut_array[$i]["id"] . "," . $notice_retour . ",'" . $this->aut_array[$i]['fonction'] . "'," . $this->aut_array[$i]['responsabilite'] . "," . $i . ") ";
             $res_ins = pmb_mysql_query($rqt, $dbh);
         }
     }
     // traitement des categories
     if ($this->categorisation_type == "categorisation_auto") {
         traite_categories_enreg($notice_retour, $this->categories);
     } else {
         $rqt_del = "delete from notices_categories where notcateg_notice='{$notice_retour}' ";
         $res_del = @pmb_mysql_query($rqt_del, $dbh);
         $rqt_ins = "insert into notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ";
         $rqt_ins_values = array();
         foreach ($this->categories as $i => $category) {
             $id_categ = $category['categ_id'];
             if ($id_categ) {
                 $rqt_ins_values[] = " ('{$notice_retour}','{$id_categ}', {$i}) ";
             }
         }
         $rqt_ins .= implode(",", $rqt_ins_values);
         $res_ins = @pmb_mysql_query($rqt_ins, $dbh);
     }
     // traitement des langues
     // langues de la publication
     $rqt_del = "delete from notices_langues where num_notice='{$notice_retour}' ";
     $res_del = pmb_mysql_query($rqt_del, $dbh);
     if (is_array($this->language_code) && count($this->language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',0, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @pmb_mysql_query($rqt, $dbh);
             }
         }
     }
     // langues originales
     if (is_array($this->original_language_code) && count($this->original_language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->original_language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',1, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @pmb_mysql_query($rqt, $dbh);
             }
         }
     }
     //Traitement des champs personnalisés (du formulaire !!!)
     $p_perso = new parametres_perso("notices");
     $nberrors = $p_perso->check_submited_fields();
     $p_perso->rec_fields_perso($notice_retour);
     //Traitement import perso
     global $notice_id, $notice_org, $notice_type_org;
     if (function_exists('z_recup_noticeunimarc_suite') && function_exists('recup_noticeunimarc_suite')) {
         //Suppression des champs persos
         $requete = "delete from notices_custom_values where notices_custom_origine=" . $notice_retour;
         @pmb_mysql_query($requete);
         $notice_id = $notice_retour;
         z_recup_noticeunimarc_suite($notice_org);
         z_import_new_notice_suite();
     }
     // Mise à jour des index de la notice
     notice::majNotices($notice_retour);
     // Mise à jour de la table notices_global_index
     notice::majNoticesGlobalIndex($notice_retour);
     // Mise à jour de la table notices_mots_global_index
     notice::majNoticesMotsGlobalIndex($notice_retour);
     //Documents numériques
     foreach ($this->doc_nums as $doc_num) {
         if (!$doc_num["a"]) {
             continue;
         }
         explnum_add_from_url($notice_retour, $this->bull_id, $doc_num["b"], $doc_num["a"], false, $this->source_id, $doc_num["f"], '', $doc_num["s"]);
     }
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf->addRdf($notice_retour, 0);
     }
     $retour = array($new_notice, $notice_retour);
     return $retour;
 }
Exemplo n.º 4
0
 function analysis_update($values)
 {
     global $dbh, $pmb_notice_img_folder_id, $opac_url_base, $pmb_notice_img_pics_max_size;
     if (is_array($values)) {
         $this->analysis_biblio_level = 'a';
         $this->analysis_hierar_level = '2';
         $this->analysis_typdoc = $values['typdoc'];
         $this->analysis_statut = $values['statut'];
         $this->analysis_commentaire_gestion = $values['f_commentaire_gestion'];
         $this->analysis_thumbnail_url = $values['f_thumbnail_url'];
         $this->analysis_tit1 = $values['f_tit1'];
         $this->analysis_tit2 = $values['f_tit2'];
         $this->analysis_tit3 = $values['f_tit3'];
         $this->analysis_tit4 = $values['f_tit4'];
         $this->analysis_n_gen = $values['f_n_gen'];
         $this->analysis_n_contenu = $values['f_n_contenu'];
         $this->analysis_n_resume = $values['f_n_resume'];
         $this->analysis_indexint = $values['f_indexint_id'];
         $this->analysis_index_l = $values['f_indexation'];
         $this->analysis_lien = $values['f_lien'];
         $this->analysis_eformat = $values['f_eformat'];
         $this->analysis_pages = $values['pages'];
         $this->analysis_signature = $values['signature'];
         $this->analysis_indexation_lang = $values['indexation_lang'];
         // insert de year à partir de la date de parution du bulletin
         if ($this->date_date) {
             $this->analysis_year = substr($this->date_date, 0, 4);
         }
         $this->date_parution_perio = $this->date_date;
         // construction de la requête :
         $data = "typdoc='" . $this->analysis_typdoc . "'";
         $data .= ", statut='" . $this->analysis_statut . "'";
         $data .= ", tit1='" . $this->analysis_tit1 . "'";
         $data .= ", tit3='" . $this->analysis_tit3 . "'";
         $data .= ", tit4='" . $this->analysis_tit4 . "'";
         $data .= ", year='" . $this->analysis_year . "'";
         $data .= ", npages='" . $this->analysis_pages . "'";
         $data .= ", n_contenu='" . $this->analysis_n_contenu . "'";
         $data .= ", n_gen='" . $this->analysis_n_gen . "'";
         $data .= ", n_resume='{$this->analysis_n_resume}'";
         $data .= ", lien='" . $this->analysis_lien . "'";
         $data .= ", eformat='" . $this->analysis_eformat . "'";
         $data .= ", indexint='" . $this->analysis_indexint . "'";
         $data .= ", index_l='" . clean_tags($this->analysis_index_l) . "'";
         $data .= ", niveau_biblio='" . $this->analysis_biblio_level . "'";
         $data .= ", niveau_hierar='" . $this->analysis_hierar_level . "'";
         $data .= ", commentaire_gestion='" . $this->analysis_commentaire_gestion . "'";
         $data .= ", thumbnail_url='" . $this->analysis_thumbnail_url . "'";
         $data .= ", signature='" . $this->analysis_signature . "'";
         $data .= ", date_parution='" . $this->date_parution_perio . "'";
         $data .= ", indexation_lang='" . $this->analysis_indexation_lang . "'";
         $result = 0;
         if (!$this->analysis_id) {
             // si c'est une création
             // fabrication de la requête finale
             $requete = "INSERT INTO notices SET {$data} , create_date=sysdate(), update_date=sysdate() ";
             $myQuery = mysql_query($requete, $dbh);
             $this->analysis_id = mysql_insert_id($dbh);
             if ($myQuery) {
                 $result = $this->analysis_id;
             }
             // si l'insertion est OK, il faut créer l'entrée dans la table 'analysis'
             if ($this->analysis_id) {
                 // Mise à jour des index de la notice
                 notice::majNoticesTotal($this->analysis_id);
                 audit::insert_creation(AUDIT_NOTICE, $this->analysis_id);
                 $requete = 'INSERT INTO analysis SET';
                 $requete .= ' analysis_bulletin=' . $this->id_bulletinage;
                 $requete .= ', analysis_notice=' . $this->analysis_id;
                 $myQuery = mysql_query($requete, $dbh);
             }
         } else {
             $requete = "UPDATE notices SET {$data} , update_date=sysdate() WHERE notice_id='" . $this->analysis_id . "' LIMIT 1";
             $myQuery = mysql_query($requete, $dbh);
             // Mise à jour des index de la notice
             notice::majNoticesTotal($this->analysis_id);
             audit::insert_modif(AUDIT_NOTICE, $this->analysis_id);
             if ($myQuery) {
                 $result = $this->analysis_id;
             }
         }
         // vignette de la notice uploadé dans un répertoire
         $id = $this->analysis_id;
         if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) {
             $poids_fichier_max = 1024 * 1024;
             //Limite la taille de l'image à 1 Mo
             $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
             $res = mysql_query($req, $dbh);
             if (mysql_num_rows($res)) {
                 $rep = mysql_fetch_object($res);
                 $filename_output = $rep->repertoire_path . "img_" . $id;
             }
             if (($fp = @fopen($_FILES['f_img_load']['tmp_name'], "rb")) && $filename_output) {
                 $image = "";
                 $size = 0;
                 $flag = true;
                 while (!feof($fp)) {
                     $image .= fread($fp, 4096);
                     $size = strlen($image);
                     if ($size > $poids_fichier_max) {
                         $flag = false;
                         break;
                     }
                 }
                 if ($flag) {
                     if ($img = imagecreatefromstring($image)) {
                         if (!($pmb_notice_img_pics_max_size * 1)) {
                             $pmb_notice_img_pics_max_size = 100;
                         }
                         $redim = false;
                         if (imagesx($img) >= imagesy($img)) {
                             if (imagesx($img) <= $pmb_notice_img_pics_max_size) {
                                 $largeur = imagesx($img);
                                 $hauteur = imagesy($img);
                             } else {
                                 $redim = true;
                                 $largeur = $pmb_notice_img_pics_max_size;
                                 $hauteur = $largeur * imagesy($img) / imagesx($img);
                             }
                         } else {
                             if (imagesy($img) <= $pmb_notice_img_pics_max_size) {
                                 $hauteur = imagesy($img);
                                 $largeur = imagesx($img);
                             } else {
                                 $redim = true;
                                 $hauteur = $pmb_notice_img_pics_max_size;
                                 $largeur = $hauteur * imagesx($img) / imagesy($img);
                             }
                         }
                         if ($redim) {
                             $dest = imagecreatetruecolor($largeur, $hauteur);
                             imagecopyresampled($dest, $img, 0, 0, 0, 0, $largeur, $hauteur, imagesx($img), imagesy($img));
                             imagepng($dest, $filename_output);
                             imagedestroy($dest);
                         } else {
                             imagepng($img, $filename_output);
                         }
                         imagedestroy($img);
                         $thumbnail_url = $opac_url_base . "getimage.php?noticecode=&vigurl=&notice_id=" . $id;
                         $req = "update notices set  thumbnail_url='" . $thumbnail_url . "' where notice_id ='" . $id . "'";
                         $res = mysql_query($req, $dbh);
                     }
                 }
             }
         }
         return $result;
     }
     //if(is_array($values))
 }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
0
 static function change_statut($statut, $action)
 {
     global $dbh, $pmb_type_audit, $PMBuserid;
     $query = "update demandes_actions set statut_action={$statut} where id_action='" . $action->id_action . "'";
     pmb_mysql_query($query, $dbh);
     if ($pmb_type_audit) {
         audit::insert_modif(AUDIT_ACTION, $action->id_action);
     }
 }
Exemplo n.º 7
0
 function move($to_bul)
 {
     global $msg;
     global $dbh;
     global $pmb_synchro_rdf;
     // rattachement du dépouillement
     $requete = 'UPDATE analysis SET analysis_bulletin=' . $to_bul . ' WHERE analysis_notice=' . $this->analysis_id;
     @pmb_mysql_query($requete, $dbh);
     //dates
     $myBul = new bulletinage($to_bul);
     $year = substr($myBul->date_date, 0, 4);
     $date_parution = $myBul->date_date;
     $requete = 'UPDATE notices SET year="' . $year . '", date_parution="' . $date_parution . '", update_date=sysdate() WHERE notice_id=' . $this->analysis_id . ' LIMIT 1';
     @pmb_mysql_query($requete, $dbh);
     //Indexation du dépouillement
     notice::majNoticesTotal($this->analysis_id);
     audit::insert_modif(AUDIT_NOTICE, $this->analysis_id);
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf($this->analysis_id, 0);
         $synchro_rdf->addRdf($this->analysis_id, 0);
     }
     return false;
 }
Exemplo n.º 8
0
 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;
 }
Exemplo n.º 9
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;
 }
Exemplo n.º 10
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;
 }
Exemplo n.º 11
0
 static function save(&$note)
 {
     global $dbh;
     global $demandes_email_demandes, $pmb_type_audit, $PMBuserid;
     if ($note->id_note) {
         //MODIFICATION
         $query = "UPDATE demandes_notes SET \n\t\t\tcontenu='" . $note->contenu . "',\n\t\t\tdate_note='" . $note->date_note . "',\n\t\t\tprive='" . $note->prive . "',\n\t\t\trapport='" . $note->rapport . "',\n\t\t\tnum_action='" . $note->num_action . "',\n\t\t\tnotes_num_user='******',\n\t\t\tnotes_type_user='******',\n\t\t\tnum_note_parent='" . $note->num_note_parent . "',\n\t\t\tnotes_read_gestion='" . $note->notes_read_gestion . "',\n\t\t\tnotes_read_opac='1' \n\t\t\tWHERE id_note='" . $note->id_note . "'";
         pmb_mysql_query($query, $dbh);
         if ($pmb_type_audit) {
             audit::insert_modif(AUDIT_NOTE, $note->id_note);
         }
     } else {
         //CREATION
         $query = "INSERT INTO demandes_notes SET\n\t\t\tcontenu='" . $note->contenu . "',\n\t\t\tdate_note='" . $note->date_note . "',\n\t\t\tprive='" . $note->prive . "',\n\t\t\trapport='" . $note->rapport . "',\n\t\t\tnum_action='" . $note->num_action . "',\n\t\t\tnotes_num_user='******',\n\t\t\tnotes_type_user='******',\n\t\t\tnum_note_parent='" . $note->num_note_parent . "', \n\t\t\tnotes_read_gestion='" . $note->notes_read_gestion . "',\n\t\t\tnotes_read_opac='1'";
         pmb_mysql_query($query, $dbh);
         $note->id_note = pmb_mysql_insert_id($dbh);
         if ($pmb_type_audit) {
             audit::insert_creation(AUDIT_NOTE, $note->id_note);
         }
         if (!$note->prive) {
             if ($demandes_email_demandes) {
                 $note->fetch_data($note->id_note, $note->num_action);
                 $note->send_alert_by_mail($note->notes_num_user, $note);
             }
         }
     }
     // Générer la réponse finale de la demande avec cette note
     if ($note->demande_end) {
         global $f_message;
         $f_message = $note->contenu;
         $demande = new demandes($note->num_demande);
         $demande->save_repfinale($note->id_note);
         demandes_notes::note_majParent($note->id_note, $note->num_action, $note->num_demande, "_gestion");
     }
 }
Exemplo n.º 12
0
 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;
         }
     }
 }
Exemplo n.º 13
0
 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;
         }
     }
 }
Exemplo n.º 14
0
function save_note($idaction, $idnote = 0, $id_demande = 0)
{
    global $contenu, $dbh, $charset, $id_empr;
    global $demandes_email_demandes, $pmb_type_audit;
    $date = date("Y-m-d", time());
    $req = " insert into demandes_notes \n\t\tset contenu='" . $contenu . "',\n\t\tdate_note='" . $date . "',";
    if ($idnote) {
        $req .= "num_note_parent='" . $idnote . "',";
    }
    $req .= " num_action='" . $idaction . "',";
    $req .= " notes_num_user='******', notes_type_user=1, ";
    $req .= " notes_read_gestion=1";
    pmb_mysql_query($req, $dbh);
    $req_up = "update demandes_actions set actions_read=1 where id_action='" . $idaction . "'";
    pmb_mysql_query($req_up, $dbh);
    $dmde_act = new demandes_action($id_demande, $idaction);
    $display = $dmde_act->getContenuForm();
    if ($demandes_email_demandes) {
        $dmde_act->send_alert_by_mail($id_empr, $idnote);
    }
    if ($pmb_type_audit && $idnote) {
        audit::insert_modif(AUDIT_NOTE, $idnote);
    } elseif ($pmb_type_audit && !$idnote) {
        $idnote = pmb_mysql_insert_id($dbh);
        audit::insert_creation(AUDIT_NOTE, $idnote);
    }
    // création d'une nouvelle note => alerte sur l'action + la demande
    $req_up1 = "update demandes_actions set actions_read_gestion='1' where id_action='" . $idaction . "';";
    $req_up2 = "update demandes inner join demandes_actions on demandes_actions.num_demande = demandes.id_demande set demandes.dmde_read_gestion='1' where demandes_actions.id_action='" . $idaction . "'";
    pmb_mysql_query($req_up1, $dbh);
    pmb_mysql_query($req_up2, $dbh);
    ajax_http_send_response($display);
}
Exemplo n.º 15
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;
 }
Exemplo n.º 16
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;
 }
Exemplo n.º 17
0
 $requete .= ", thumbnail_url='{$t_notice['thumbnail_url']}'";
 $requete .= ", signature='{$t_notice['signature']}'";
 $requete .= ", date_parution='{$date_parution_notice}'";
 $requete .= ", indexation_lang='{$t_notice['indexation_lang']}'";
 $requete .= ", notice_is_new='{$t_notice['notice_is_new']}'";
 $requete .= $req_notice_date_is_new;
 $requete .= $postrequete;
 $result = pmb_mysql_query($requete, $dbh);
 //traitement audit
 if (!$id) {
     $sav_id = 0;
     $id = pmb_mysql_insert_id($dbh);
     audit::insert_creation(AUDIT_NOTICE, $id);
 } else {
     $sav_id = $id;
     audit::insert_modif(AUDIT_NOTICE, $id);
 }
 // autorité personnalisées
 $authperso = new authperso_notice($id);
 $authperso->save_form();
 // map
 global $pmb_map_activate;
 if ($pmb_map_activate) {
     $map = new map_edition_controler(TYPE_RECORD, $id);
     $map->save_form();
     $map_info = new map_info($id);
     $map_info->save_form();
 }
 // vignette de la notice uploadé dans un répertoire
 if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) {
     $poids_fichier_max = 1024 * 1024;
Exemplo n.º 18
0
 static function save(&$note)
 {
     global $dbh;
     global $demandes_email_demandes, $pmb_type_audit;
     if ($note->id_note) {
         //MODIFICATION
         $query = "UPDATE demandes_notes SET \n\t\t\tcontenu='" . $note->contenu . "',\n\t\t\tdate_note='" . $note->date_note . "',\n\t\t\tprive='" . $note->prive . "',\n\t\t\trapport='" . $note->rapport . "',\n\t\t\tnum_action='" . $note->num_action . "',\n\t\t\tnotes_num_user='******',\n\t\t\tnotes_type_user='******',\n\t\t\tnum_note_parent='" . $note->num_note_parent . "',\n\t\t\tnotes_read_gestion='1',\n\t\t\tnotes_read_opac='" . $note->notes_read_opac . "'\n\t\t\tWHERE id_note='" . $note->id_note . "'";
         pmb_mysql_query($query, $dbh);
         if ($pmb_type_audit) {
             audit::insert_modif(AUDIT_NOTE, $note->id_note);
         }
     } else {
         //CREATION
         $query = "INSERT INTO demandes_notes SET\n\t\t\tcontenu='" . $note->contenu . "',\n\t\t\tdate_note='" . $note->date_note . "',\n\t\t\tprive='" . $note->prive . "',\n\t\t\trapport='" . $note->rapport . "',\n\t\t\tnum_action='" . $note->num_action . "',\n\t\t\tnotes_num_user='******',\n\t\t\tnotes_type_user='******',\n\t\t\tnum_note_parent='" . $note->num_note_parent . "', \n\t\t\tnotes_read_gestion='1',\n\t\t\tnotes_read_opac='" . $note->notes_read_opac . "'";
         pmb_mysql_query($query, $dbh);
         $note->id_note = pmb_mysql_insert_id($dbh);
         if ($pmb_type_audit) {
             audit::insert_creation(AUDIT_NOTE, $note->id_note);
         }
         if (!$note->prive) {
             if ($demandes_email_demandes) {
                 $note->fetch_data($note->id_note, $note->num_action);
                 $note->send_alert_by_mail($note->notes_num_user, $note);
             }
         }
     }
 }
Exemplo n.º 19
0
 function import($data)
 {
     global $msg;
     // cette méthode prend en entrée un tableau constitué des informations exemplaires suivantes :
     //	$data['cb']
     //	$data['notice']
     //  $data['bulletin']
     //	$data['typdoc']
     //	$data['cote']
     //	$data['section']
     //	$data['statut']
     //	$data['location']
     //	$data['codestat']
     //	$data['creation']
     //	$data['modif']
     //	$data['note']
     //	$data['prix']
     //	$data['expl_owner']
     //	$data['cote_mandatory'] cote obligatoire = 1, non obligatoire = 0
     //	$data['quoi_faire'] que faire de cet exemplaire :
     //		0 : supprimer, 1 ou vide : Mettre à jour ou ajouter, 2 : ajouter si possible, sinon rien.
     global $dbh;
     // check sur le type de  la variable passée en paramètre
     if (!sizeof($data) || !is_array($data)) {
         // si ce n'est pas un tableau ou un tableau vide, on retourne 0
         $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', '" . $msg[544] . "') ");
         return 0;
     }
     if ($data['quoi_faire'] == "") {
         $data['quoi_faire'] = "2";
     }
     if ((string) $data['quoi_faire'] == "0") {
         $sql_del = "delete from exemplaires where expl_cb='" . addslashes($data['cb']) . "' ";
         pmb_mysql_query($sql_del);
         return -1;
     }
     // check sur les éléments du tableau (cb, cote, notice, typdoc, section, statut, location, codestat, owner sont requis).
     $long_maxi = pmb_mysql_field_len(pmb_mysql_query("SELECT expl_cb FROM exemplaires limit 1"), 0);
     $data['cb'] = rtrim(substr(trim($data['cb']), 0, $long_maxi));
     $long_maxi = pmb_mysql_field_len(pmb_mysql_query("SELECT expl_cote FROM exemplaires limit 1"), 0);
     $data['cote'] = rtrim(substr(trim($data['cote']), 0, $long_maxi));
     $long_maxi = pmb_mysql_field_len(pmb_mysql_query("SELECT expl_prix FROM exemplaires limit 1"), 0);
     $data['prix'] = rtrim(substr(trim($data['prix']), 0, $long_maxi));
     if ($data['expl_owner'] == "") {
         $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', 'No lender given') ");
         return 0;
     }
     if ($data['cb'] == "") {
         $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', '" . $msg[545] . "') ");
         return 0;
     }
     if ($data['cote'] == "") {
         if ($data['cote_mandatory'] == 1) {
             $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', '" . $msg[546] . "') ");
             return 0;
         } else {
             $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', '" . $msg[567] . "') ");
         }
     }
     if ($data['notice'] == 0) {
         if ($data['bulletin'] == 0) {
             $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', '" . $msg[547] . "') ");
             return 0;
         }
     }
     if ($data['typdoc'] == 0) {
         $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', '" . $msg[548] . "') ");
         return 0;
     }
     if ($data['section'] == 0) {
         $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', '" . $msg[549] . "') ");
         return 0;
     }
     if ($data['statut'] == 0) {
         $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', '" . $msg[550] . "') ");
         return 0;
     }
     if ($data['location'] == 0) {
         $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', '" . $msg[551] . "') ");
         return 0;
     }
     if ($data['codestat'] == 0) {
         $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', '" . $msg[552] . "') ");
         return 0;
     }
     if ($data['type_antivol'] == "") {
         $data['type_antivol'] = "1";
     }
     // préparation de la requête
     $key0 = addslashes($data['cb']);
     $key1 = addslashes($data['cote']);
     /* vérification que l'exemplaire existe ou pas */
     $exe = new stdClass();
     $query = "SELECT expl_id FROM exemplaires WHERE expl_cb='{$key0}' LIMIT 1 ";
     $result = @pmb_mysql_query($query, $dbh);
     if (!$result) {
         die("can't SELECT exemplaires " . $query);
     }
     if (pmb_mysql_num_rows($result)) {
         $exe = pmb_mysql_fetch_object($result);
     }
     if (!$data['date_depot']) {
         $data['date_depot'] = "sysdate()";
     } else {
         $data['date_depot'] = "'" . $data['date_depot'] . "'";
     }
     if (!$data['date_retour']) {
         $data['date_retour'] = "sysdate()";
     } else {
         $data['date_retour'] = "'" . $data['date_retour'] . "'";
     }
     // l'exemplaire existe et on ne pouvait que l'ajouter, on retourne l'ID
     if ($exe->expl_id != "" && $data['quoi_faire'] == "2") {
         $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_" . addslashes(SESSid) . ".class', '" . $msg[553] . $data['cb'] . "') ");
         return $exe->expl_id;
     }
     // l'exemplaire existe et on doit le mettre à jour
     if ($exe->expl_id != "" && $data['quoi_faire'] == "1") {
         $sql_a_faire = "update exemplaires SET ";
         $sql_a_faire_suite = " where expl_cb='" . addslashes($data['cb']) . "' ";
     }
     // l'exemplaire n'existe pas : on doit le créer
     if ($exe->expl_id == "") {
         $sql_a_faire = "insert into exemplaires SET ";
         $sql_a_faire_suite = "";
     }
     $query = $sql_a_faire;
     $query .= "expl_cb='" . $key0 . "', ";
     $query .= "expl_notice='" . $data['notice'] . "', ";
     $query .= "expl_bulletin='" . $data['bulletin'] . "', ";
     $query .= "expl_typdoc='" . $data['typdoc'] . "', ";
     $query .= "expl_cote=trim('" . $key1 . "'), ";
     $query .= "expl_section='" . $data['section'] . "', ";
     $query .= "expl_statut='" . $data['statut'] . "', ";
     $query .= "expl_location='" . $data['location'] . "', ";
     $query .= "expl_codestat='" . $data['codestat'] . "', ";
     $query .= "expl_note='" . addslashes($data['note']) . "', ";
     $query .= "expl_comment='" . addslashes($data['comment']) . "', ";
     $query .= "expl_prix='" . addslashes($data['prix']) . "', ";
     $query .= "expl_owner='" . $data['expl_owner'] . "', ";
     $query .= "expl_date_depot=" . $data['date_depot'] . ", ";
     $query .= "expl_date_retour=" . $data['date_retour'] . ", ";
     $query .= "transfert_location_origine = " . $data['location'] . ", ";
     $query .= "transfert_statut_origine=" . $data['statut'] . ", ";
     $query .= "transfert_section_origine=" . $data['section'] . ", ";
     //$query .= "type_antivol=".$data['type_antivol'].", ";
     if ($data['creation']) {
         $query .= "create_date='" . $data['creation'] . "'";
     } else {
         $query .= "create_date=sysdate() ";
     }
     $query .= $sql_a_faire_suite;
     $result = @pmb_mysql_query($query, $dbh);
     if (!$result) {
         die("can't INSERT into exemplaires " . $query);
     }
     if ($exe->expl_id = "") {
         audit::insert_creation(AUDIT_EXPL, pmb_mysql_insert_id($dbh));
         return pmb_mysql_insert_id($dbh);
     } else {
         $sql_id = pmb_mysql_query("select expl_id from exemplaires where expl_cb='" . addslashes($data['cb']) . "' ");
         $exe = pmb_mysql_fetch_object($sql_id);
         audit::insert_modif(AUDIT_EXPL, $exe->expl_id);
         return $exe->expl_id;
     }
 }
Exemplo n.º 20
0
function maj_stat_pret($stuff)
{
    global $dbh, $empr_archivage_prets, $empr_archivage_prets_purge;
    if (!is_object($stuff)) {
        die("Pb in ./circ/pret_func.inc.php [maj_stat_pret()].");
    }
    $query = "update pret_archive set ";
    $query .= "arc_debut='" . $stuff->pret_date . "', ";
    $query .= "arc_fin=now(), ";
    if ($empr_archivage_prets) {
        $query .= "arc_id_empr='" . addslashes($stuff->id_empr) . "', ";
    }
    $query .= "arc_empr_cp='" . addslashes($stuff->empr_cp) . "', ";
    $query .= "arc_empr_ville='" . addslashes($stuff->empr_ville) . "', ";
    $query .= "arc_empr_prof='" . addslashes($stuff->empr_prof) . "', ";
    $query .= "arc_empr_year='" . addslashes($stuff->empr_year) . "', ";
    $query .= "arc_empr_categ='" . $stuff->empr_categ . "', ";
    $query .= "arc_empr_codestat='" . $stuff->empr_codestat . "', ";
    $query .= "arc_empr_sexe='" . $stuff->empr_sexe . "', ";
    $query .= "arc_empr_statut='" . $stuff->empr_statut . "', ";
    $query .= "arc_empr_location='" . $stuff->empr_location . "', ";
    $query .= "arc_type_abt='" . $stuff->type_abt . "', ";
    $query .= "arc_expl_typdoc='" . $stuff->expl_typdoc . "', ";
    $query .= "arc_expl_id='" . $stuff->expl_id . "', ";
    $query .= "arc_expl_notice='" . $stuff->expl_notice . "', ";
    $query .= "arc_expl_bulletin='" . $stuff->expl_bulletin . "', ";
    $query .= "arc_expl_cote='" . addslashes($stuff->expl_cote) . "', ";
    $query .= "arc_expl_statut='" . $stuff->expl_statut . "', ";
    $query .= "arc_expl_location='" . $stuff->expl_location . "', ";
    $query .= "arc_expl_section='" . $stuff->expl_section . "', ";
    $query .= "arc_expl_codestat='" . $stuff->expl_codestat . "', ";
    $query .= "arc_expl_owner='" . $stuff->expl_owner . "', ";
    $query .= "arc_niveau_relance='" . $stuff->niveau_relance . "', ";
    $query .= "arc_date_relance='" . $stuff->date_relance . "', ";
    $query .= "arc_printed='" . $stuff->printed . "', ";
    $query .= "arc_cpt_prolongation='" . $stuff->cpt_prolongation . "', ";
    $query .= "arc_short_loan_flag='" . $stuff->short_loan_flag . "' ";
    $query .= " where arc_id='" . $stuff->pret_arc_id . "' ";
    $res = mysql_query($query, $dbh);
    audit::insert_modif(AUDIT_PRET, $stuff->pret_arc_id);
    // purge des vieux trucs
    if ($empr_archivage_prets_purge) {
        //on ne purge qu'une fois par session et par jour
        if (!isset($_SESSION["last_empr_archivage_prets_purge_day"]) || $_SESSION["last_empr_archivage_prets_purge_day"] != date("m.d.y")) {
            mysql_query("update pret_archive set arc_id_empr=0 where arc_id_empr!=0 and date_add(arc_fin, interval {$empr_archivage_prets_purge} day) < sysdate()") or die(mysql_error() . "<br />" . "update pret_archive set arc_id_empr=0 where arc_id_empr!=0 and date_add(arc_fin, interval {$empr_archivage_prets_purge} day) < sysdate()");
            $_SESSION["last_empr_archivage_prets_purge_day"] = date("m.d.y");
        }
    }
    return $res;
}
Exemplo n.º 21
0
 function save()
 {
     global $dbh, $num_cde, $num_dev;
     if (!$this->num_entite || !$this->num_fournisseur) {
         die("Erreur de création actes");
     }
     //récupération du libelle fournisseur
     $q = "select raison_sociale from entites where id_entite = '" . $this->num_fournisseur . "' ";
     $r = mysql_query($q, $dbh);
     $fou = mysql_result($r, 0, 0);
     if ($this->type_acte == TYP_ACT_CDE) {
         $num = trim($num_cde);
     } else {
         if ($this->type_acte == TYP_ACT_DEV) {
             $num = trim($num_dev);
         }
     }
     if ($this->id_acte) {
         if ($num != '') {
             $this->numero = $num;
         } else {
             $this->numero = addslashes($this->numero);
         }
         $q = "update actes set ";
         $q .= "numero = '" . $this->numero . "', ";
         $q .= "nom_acte = '" . $this->nom_acte . "', ";
         $q .= "statut = '" . $this->statut . "', ";
         $q .= "date_paiement = '" . $this->date_paiement . "', ";
         $q .= "num_paiement = '" . $this->num_paiement . "', ";
         $q .= "num_fournisseur = '" . $this->num_fournisseur . "', ";
         $q .= "num_contact_livr = '" . $this->num_contact_livr . "', ";
         $q .= "num_contact_fact = '" . $this->num_contact_fact . "', ";
         //TODO Voir suppression num_exercice
         $q .= "num_exercice = '" . $this->num_exercice . "', ";
         $q .= "commentaires = '" . $this->commentaires . "', ";
         $q .= "reference = '" . $this->reference . "', ";
         $q .= "commentaires_i = '" . $this->commentaires_i . "', ";
         $q .= "devise = '" . $this->devise . "', ";
         $q .= "date_ech = '" . $this->date_ech . "', ";
         $q .= "index_acte = ' " . $this->numero . " " . strip_empty_words($fou) . " " . strip_empty_words($this->commentaires) . " " . strip_empty_words($this->reference) . " ' ";
         $q .= "where id_acte = '" . $this->id_acte . "' ";
         $r = mysql_query($q, $dbh);
         audit::insert_modif(AUDIT_ACQUIS, $this->id_acte);
     } else {
         if ($num != '') {
             $this->numero = $num;
         } else {
             $this->calc();
         }
         $q = "insert into actes set type_acte = '" . $this->type_acte . "', ";
         $q .= "date_acte = '" . today() . "', ";
         $q .= "numero = '" . $this->numero . "', ";
         $q .= "nom_acte = '" . $this->nom_acte . "', ";
         $q .= "statut = '" . $this->statut . "', ";
         $q .= "date_paiement = '" . $this->date_paiement . "', ";
         $q .= "num_paiement = '" . $this->num_paiement . "', ";
         $q .= "num_entite = '" . $this->num_entite . "', ";
         $q .= "num_fournisseur = '" . $this->num_fournisseur . "', ";
         $q .= "num_contact_livr = '" . $this->num_contact_livr . "', ";
         $q .= "num_contact_fact = '" . $this->num_contact_fact . "', ";
         //TODO Voir suppression num_exercice
         $q .= "num_exercice = '" . $this->num_exercice . "', ";
         $q .= "commentaires = '" . $this->commentaires . "' , ";
         $q .= "reference = '" . $this->reference . "', ";
         $q .= "commentaires_i = '" . $this->commentaires_i . "', ";
         $q .= "devise = '" . $this->devise . "', ";
         $q .= "date_ech = '" . $this->date_ech . "', ";
         $q .= "index_acte = ' " . strip_empty_words($this->numero) . " " . strip_empty_words($fou) . " " . strip_empty_words($this->commentaires) . " " . strip_empty_words($this->reference) . " ' ";
         $r = mysql_query($q, $dbh);
         $this->id_acte = mysql_insert_id($dbh);
         audit::insert_creation(AUDIT_ACQUIS, $this->id_acte);
     }
 }
Exemplo n.º 22
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;
 }
Exemplo n.º 23
0
 public function save()
 {
     global $dbh;
     $audit_id = $this->id;
     if ($this->id) {
         $save = "update ";
         $order = "";
         $clause = "where id_section = '" . $this->id . "'";
     } else {
         $save = "insert into ";
         //on place la nouvelle rubrique à la fin par défaut
         $query = "SELECT id_section FROM cms_sections WHERE section_num_parent=" . addslashes($this->num_parent);
         $result = pmb_mysql_query($query, $dbh);
         $order = ",section_order = '" . (pmb_mysql_num_rows($result) + 1) . "' ";
         $clause = "";
     }
     $save .= "cms_sections set \n\t\tsection_title = '" . addslashes($this->title) . "', \n\t\tsection_resume = '" . addslashes($this->resume) . "', \n\t\tsection_publication_state ='" . addslashes($this->publication_state) . "', \n\t\tsection_start_date = '" . addslashes($this->start_date) . "', \n\t\tsection_end_date = '" . addslashes($this->end_date) . "', \n\t\tsection_num_parent = '" . addslashes($this->num_parent) . "' ,\n\t\tsection_num_type = '" . $this->num_type . "'  " . (!$this->id ? ",section_creation_date=sysdate() " : "") . "\n\t\t{$order}" . "\n\t\t{$clause}";
     pmb_mysql_query($save, $dbh);
     if (!$this->id) {
         $this->id = pmb_mysql_insert_id();
     }
     //au tour des descripteurs...
     //on commence par tout retirer...
     $del = "delete from cms_sections_descriptors where num_section = '" . $this->id . "'";
     pmb_mysql_query($del, $dbh);
     for ($i = 0; $i < count($this->descriptors); $i++) {
         $rqt = "insert into cms_sections_descriptors set num_section = '" . $this->id . "', num_noeud = '" . $this->descriptors[$i] . "',section_descriptor_order='" . $i . "'";
         pmb_mysql_query($rqt, $dbh);
     }
     //et maintenant le logo...
     $this->save_logo();
     //enfin les éléments du type de contenu
     $types = new cms_editorial_types("section");
     $types->save_type_form($this->num_type, $this->id);
     $this->maj_indexation();
     $this->save_documents();
     //bouton pour le cache
     $upd = "UPDATE cms_sections SET section_update_timestamp = now() WHERE id_section = '" . $this->id . "'";
     pmb_mysql_query($upd, $dbh);
     //Audit
     if (!$audit_id) {
         audit::insert_creation(AUDIT_EDITORIAL_SECTION, $this->id);
     } else {
         audit::insert_modif(AUDIT_EDITORIAL_SECTION, $this->id);
     }
 }
Exemplo n.º 24
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;
 }
Exemplo n.º 25
0
 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;
 }