Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
0
     audit::insert_creation(AUDIT_EXPL, $expl_id);
 }
 if ($abt_id && $serial_circ_add) {
     $serialcirc_diff = new serialcirc_diff(0, $abt_id);
 }
 // Si c'est à faire circuler
 if ($serialcirc_diff->id) {
     $serialcirc_diff->add_circ_expl($expl_id);
 }
 // traitement des concepts
 if ($thesaurus_concepts_active == 1) {
     $index_concept = new index_concept($expl_id, TYPE_EXPL);
     $index_concept->save();
 }
 //Insertion des champs personalises
 $p_perso->rec_fields_perso($expl_id);
 // Mise a jour de la table notices_mots_global_index pour toutes les notices en relation avec l'exemplaire
 $req_maj = "SELECT bulletin_notice,num_notice, analysis_notice FROM bulletins LEFT JOIN analysis ON analysis_bulletin=bulletin_id WHERE bulletin_id='" . $expl_bulletin . "'";
 $res_maj = pmb_mysql_query($req_maj);
 if ($res_maj && pmb_mysql_num_rows($res_maj)) {
     $first = true;
     //Pour la premiere ligne de résultat on doit indexer aussi la notice de périodique et de bulletin au besoin
     while ($ligne = pmb_mysql_fetch_object($res_maj)) {
         if ($first) {
             if ($ligne->bulletin_notice) {
                 notice::majNoticesMotsGlobalIndex($ligne->bulletin_notice, 'expl');
             }
             if ($ligne->num_notice) {
                 notice::majNoticesMotsGlobalIndex($ligne->num_notice, 'expl');
             }
         }
Ejemplo n.º 3
0
         $rqt = $rqt_ins . " ('{$id}',0, '{$tmpcode_langue}',{$tmpordre_langue}) ";
         $res_ins = pmb_mysql_query($rqt, $dbh);
     }
 }
 // traitement des langues originales
 $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
 while (list($key, $val) = each($f_langorg_form)) {
     $tmpcode_langue = $val['code'];
     if ($tmpcode_langue) {
         $tmpordre_langue = $val['ordre'];
         $rqt = $rqt_ins . " ('{$id}',1, '{$tmpcode_langue}',{$tmpordre_langue}) ";
         $res_ins = @pmb_mysql_query($rqt, $dbh);
     }
 }
 //Traitement des champs personnalises
 $p_perso->rec_fields_perso($id);
 if ($result) {
     include './catalog/notices/isbd.inc.php';
 } else {
     // echec de la requete
     error_message($libelle, $msg[281], 1, "./catalog.php");
 }
 //Recherche du titre uniforme automatique
 global $opac_enrichment_bnf_sparql;
 $opac_enrichment_bnf_sparql = 1;
 $titre_uniforme = notice::getAutomaticTu($id);
 // permet de charger la bonne langue, mot vide...
 $info = notice::indexation_prepare($id);
 // Mise a jour des index de la notice
 notice::majNotices($id);
 // Mise a jour de la table notices_global_index
Ejemplo n.º 4
0
 function update_empr($empr_cb = '', $empr_id = 0, $fields)
 {
     global $dbh, $lang;
     global $msg;
     global $charset;
     global $pmb_num_carte_auto, $deflt2docs_location, $pmb_gestion_abonnement, $pmb_gestion_financiere;
     object_to_array($fields);
     $empr_cb = $this->clean_field((string) $empr_cb);
     $empr_id += 0;
     if (!$empr_id && $empr_cb == '') {
         return $this->build_error("idempr et empr_cb vide.");
     }
     if ($empr_id) {
         $where = " id_empr = {$empr_id} ";
     } else {
         $where = " empr_cb = '" . addslashes($empr_cb) . "' ";
     }
     $sql = "SELECT id_empr, empr_cb FROM empr WHERE {$where}";
     $res = pmb_mysql_query($sql);
     if (!$res || !pmb_mysql_num_rows($res)) {
         return $this->build_error("Lecteur inconnu: 'empr_cb' = {$empr_cb} ou id_empr = {$empr_id} .");
     }
     $empr_res = pmb_mysql_fetch_object($res);
     $empr_id = $empr_res->id_empr;
     // clean des entrées
     $fields = $this->clean_fields($fields);
     /*
     		$fields['nom']=$this->clean_field($fields['nom']);
     		$fields['prenom']=$this->clean_field($fields['prenom']);
     		$fields['adr1']=$this->clean_field($fields['adr1']);
     		$fields['adr2']=$this->clean_field($fields['adr2']);
     		$fields['cp']=$this->clean_field($fields['cp']);
     		$fields['ville']=$this->clean_field($fields['ville']);
     		$fields['pays']=$this->clean_field($fields['pays']);
     		$fields['mail']=$this->clean_field($fields['mail']);
     		$fields['tel1']=$this->clean_field($fields['tel1']);
     		$fields['sms']=$this->clean_field($fields['sms'])+0;
     		$fields['tel2']=$this->clean_field($fields['tel2']);
     		$fields['prof']=$this->clean_field($fields['prof']);
     		$fields['birth']=$this->clean_field($fields['birth']);
     		$fields['sexe']=$this->clean_field($fields['sexe'])+0;
     		$fields['login']=$this->clean_field($fields['login']);
     		$fields['pwd']=$this->clean_field($fields['pwd']);
     		$fields['msg']=$this->clean_field($fields['msg']);
     		$fields['lang']=$this->clean_field($fields['lang']);
     		$fields['location']=$this->clean_field($fields['location']+0);
     		$fields['date_adhesion']=$this->clean_field($fields['date_adhesion']);
     		$fields['date_expiration']=$this->clean_field($fields['date_expiration']);
     		$fields['categ']=$this->clean_field($fields['categ'])+0;
     		$fields['statut']=$this->clean_field($fields['statut']+0);
     		$fields['lang']=$this->clean_field($fields['lang']);
     		$fields['cstat']=$this->clean_field($fields['cstat'])+0;
     		$fields['type_abt']=$this->clean_field($fields['type_abt']+0);
     		$fields['ldap']=$this->clean_field($fields['ldap'])+0;*/
     $fields['sexe'] += 0;
     $fields['location'] += 0;
     $fields['categ'] += 0;
     $fields['statut'] += 0;
     $fields['lang'] += 0;
     $fields['cstat'] += 0;
     $fields['type_abt'] += 0;
     $fields['ldap'] += 0;
     // vérification des champs obligatoires
     if (!$fields['nom']) {
         return $this->build_error("Le champ 'nom' n'est pas renseigne.");
     }
     if (!$fields['categ']) {
         return $this->build_error("Le champ 'categ' n'est pas renseigne.");
     }
     if (!$fields['statut']) {
         return $this->build_error("Le champ 'statut' n'est pas renseigne.");
     }
     if (!$fields['cstat']) {
         return $this->build_error("Le champ 'cstat' n'est pas renseigne.");
     }
     // vérification des relations
     $q = "select idstatut from empr_statut where idstatut='" . $fields['statut'] . "' limit 1";
     $r = pmb_mysql_query($q, $dbh);
     if (!pmb_mysql_num_rows($r)) {
         return $this->build_error("Le champ 'statut' = " . $fields['statut'] . " n'est pas un Id present dans la base de donnee.");
     }
     $q = "select idcode from empr_codestat where idcode='" . $fields['cstat'] . "' limit 1";
     $r = pmb_mysql_query($q, $dbh);
     if (!pmb_mysql_num_rows($r)) {
         return $this->build_error("Le champ 'cstat' = " . $fields['cstat'] . " n'est pas un Id present dans la base de donnee.");
     }
     $q = "select id_categ_empr from empr_categ where id_categ_empr='" . $fields['categ'] . "' limit 1";
     $r = pmb_mysql_query($q, $dbh);
     if (!pmb_mysql_num_rows($r)) {
         return $this->build_error("Le champ 'categ' = " . $fields['categ'] . " n'est pas un Id present dans la base de donnee.");
     }
     if ($fields['location']) {
         $q = "select idlocation from docs_location where idlocation='" . $fields['location'] . "' limit 1";
         $r = pmb_mysql_query($q, $dbh);
         if (!pmb_mysql_num_rows($r)) {
             $fields['location'] = 0;
         }
     }
     if (!$fields['location']) {
         $loca = pmb_mysql_query("select min(idlocation) as idlocation from docs_location", $dbh);
         $locaid = pmb_mysql_fetch_object($loca);
         $fields['location'] = $locaid->idlocation;
     }
     if ($fields['mail']) {
         if (!filter_var($fields['mail'], FILTER_VALIDATE_EMAIL)) {
             return $this->build_error("Le champ 'mail' = " . $fields['mail'] . " n'est pas un mail valide.");
         }
     }
     if (!$fields['sexe']) {
         $fields['sexe'] = 0;
     }
     if (!$fields['lang']) {
         $fields['lang'] = $lang;
     }
     $requete = "UPDATE empr SET ";
     $requete .= "empr_nom='" . addslashes($fields['nom']) . "', ";
     $requete .= "empr_prenom='" . addslashes($fields['prenom']) . "', ";
     $requete .= "empr_adr1='" . addslashes($fields['adr1']) . "', ";
     $requete .= "empr_adr2='" . addslashes($fields['adr2']) . "', ";
     $requete .= "empr_cp='" . addslashes($fields['cp']) . "', ";
     $requete .= "empr_ville='" . addslashes($fields['ville']) . "', ";
     $requete .= "empr_pays='" . addslashes($fields['pays']) . "', ";
     $requete .= "empr_mail='" . addslashes($fields['mail']) . "', ";
     $requete .= "empr_tel1='" . addslashes($fields['tel1']) . "', ";
     $requete .= "empr_sms='" . addslashes($fields['sms']) . "', ";
     $requete .= "empr_tel2='" . addslashes($fields['tel2']) . "', ";
     $requete .= "empr_prof='" . addslashes($fields['prof']) . "', ";
     $requete .= "empr_year='" . addslashes($fields['birth']) . "', ";
     $requete .= "empr_categ='" . $fields['categ'] . "', ";
     $requete .= "empr_statut='" . $fields['statut'] . "', ";
     $requete .= "empr_lang='" . addslashes($fields['lang']) . "', ";
     if ($fields['date_adhesion'] == "") {
         $requete .= "empr_date_adhesion=CURRENT_DATE(), ";
     } else {
         $requete .= "empr_date_adhesion='" . addslashes($fields['date_adhesion']) . "', ";
     }
     if ($fields['date_expiration'] == "" or $fields['date_expiration'] == $fields['date_adhesion']) {
         /* AJOUTER ICI LE CALCUL EN FONCTION DE LA CATEGORIE */
         $rqt_empr_categ = "select duree_adhesion from empr_categ where id_categ_empr = " . $fields['categ'] . " ";
         $res_empr_categ = pmb_mysql_query($rqt_empr_categ, $dbh);
         $empr_categ = pmb_mysql_fetch_object($res_empr_categ);
         if ($fields['date_adhesion']) {
             $rqt_date = "select date_add('" . addslashes($fields['date_adhesion']) . "', INTERVAL " . $empr_categ->duree_adhesion . " DAY) as date_expiration ";
         } else {
             $rqt_date = "select date_add(CURRENT_DATE(), INTERVAL " . $empr_categ->duree_adhesion . " DAY) as date_expiration ";
         }
         $resultatdate = pmb_mysql_query($rqt_date);
         $resdate = pmb_mysql_fetch_object($resultatdate);
         $requete .= "empr_date_expiration='" . $resdate->date_expiration . "', ";
     } else {
         $requete .= "empr_date_expiration='" . $fields['date_expiration'] . "', ";
     }
     $requete .= "empr_codestat=" . $fields['cstat'] . ", ";
     $requete .= "empr_modif=CURRENT_DATE(), ";
     $requete .= "empr_sexe='" . $fields['sexe'] . "', ";
     $requete .= "empr_msg='" . addslashes($fields['msg']) . "', ";
     $requete .= "empr_login='******'login']) . "', ";
     $requete .= "empr_location='" . $fields['location'] . "', ";
     // ldap - MaxMan
     if ($fields['ldap']) {
         $requete .= "empr_ldap='1', ";
         $fields['pwd'] = "";
     } else {
         $requete .= "empr_ldap='0', ";
     }
     //Gestion financière
     if ($pmb_gestion_abonnement == 2 && $pmb_gestion_financiere) {
         $requete .= "type_abt='" . $fields['type_abt'] . "', ";
     } else {
         $requete .= "type_abt=0, ";
     }
     if ($fields['pwd'] != "") {
         $requete .= "empr_password='******'pwd']) . "' ";
     } else {
         $requete .= "empr_password='******'birth']) . "' ";
     }
     $requete .= " WHERE id_empr=" . $empr_id . " limit 1";
     $res = pmb_mysql_query($requete, $dbh);
     if (!$res) {
         return $this->build_error("Impossible de modifier le lecteur: {$requete}");
     }
     if ($fields['pwd'] != "") {
         emprunteur::update_digest($fields['login'], $fields['pwd']);
         emprunteur::hash_password($fields['login'], $fields['pwd']);
     } else {
         emprunteur::update_digest($fields['login'], $fields['birth']);
         emprunteur::hash_password($fields['login'], $fields['birth']);
     }
     if (is_array($fields['pperso_list'])) {
         $p_perso = new parametres_perso("empr");
         foreach ($fields['pperso_list'] as $pp) {
             $name = $pp["name"];
             global ${$name};
             ${$name} = $pp["value_list"];
         }
         $p_perso->rec_fields_perso($empr_id);
     }
     if (is_array($fields['groupe_list'])) {
         emprunteur::rec_groupe_empr($empr_id, $fields['groupe_list']);
     }
     emprunteur::ins_lect_categ_dsi($empr_id, $fields['categ'], 0);
     if ($pmb_gestion_financiere && $pmb_gestion_abonnement) {
         emprunteur::rec_abonnement($empr_id, $type_abt, $fields['categ']);
     }
     return $this->build_ok();
 }
Ejemplo n.º 5
0
 static function save(&$demande)
 {
     global $dbh, $pmb_type_audit;
     if ($demande->id_demande) {
         //MODIFICATION
         $query = "UPDATE demandes SET\n\t\t\tsujet_demande='" . $demande->sujet_demande . "',\r\n\t\t\tnum_demandeur='" . $demande->num_demandeur . "',\r\n\t\t\tdate_demande='" . $demande->date_demande . "',\r\n\t\t\tdeadline_demande='" . $demande->deadline_demande . "',\r\n\t\t\tdate_prevue='" . $demande->date_prevue . "',\r\n\t\t\tprogression='" . $demande->progression . "',\r\n\t\t\ttitre_demande='" . $demande->titre_demande . "',\r\n\t\t\ttype_demande='" . $demande->type_demande . "',\r\n\t\t\ttheme_demande='" . $demande->theme_demande . "',\n\t\t\tnum_user_cloture='" . $demande->num_user_cloture . "',\n\t\t\tnum_linked_notice = '" . $demande->get_num_linked_notice() . "'\r\n\t\t\tWHERE id_demande='" . $demande->id_demande . "'";
         pmb_mysql_query($query, $dbh);
         if ($pmb_type_audit) {
             audit::insert_modif(AUDIT_DEMANDE, $demande->id_demande);
         }
     } else {
         //On ajoute une notice ?
         self::save_notice($demande);
         //CREATION de la demande
         $query = "INSERT INTO demandes SET\n\t\t\tsujet_demande='" . $demande->sujet_demande . "',\r\n\t\t\tetat_demande='" . $demande->etat_demande . "',\r\n\t\t\tnum_demandeur='" . $demande->num_demandeur . "',\r\n\t\t\tdate_demande='" . $demande->date_demande . "',\r\n\t\t\tdate_prevue='" . $demande->date_prevue . "',\r\n\t\t\tdeadline_demande='" . $demande->deadline_demande . "',\r\n\t\t\tprogression='" . $demande->progression . "',\r\n\t\t\ttitre_demande='" . $demande->titre_demande . "',\r\n\t\t\ttype_demande='" . $demande->type_demande . "',\r\n\t\t\ttheme_demande='" . $demande->theme_demande . "',\r\n\t\t\tnum_notice='" . $demande->num_notice . "',\n\t\t\tdmde_read_opac='1',\n\t\t\tnum_linked_notice = '" . $demande->get_num_linked_notice() . "'";
         pmb_mysql_query($query, $dbh);
         $demande->id_demande = pmb_mysql_insert_id($dbh);
         if ($pmb_type_audit) {
             audit::insert_creation(AUDIT_DEMANDE, $demande->id_demande);
         }
     }
     //Vérification des champs personalisés
     $p_perso = new parametres_perso("demandes");
     $nberrors = $p_perso->check_submited_fields();
     if ($nberrors) {
         error_message_history("", $p_perso->error_message, 1);
     } else {
         //Insertion des champs personalisés
         $p_perso->rec_fields_perso($demande->id_demande);
     }
     //MAJ des users de la demande
     self::save_demandes_users($demande);
 }
Ejemplo n.º 6
0
 function update_from_form()
 {
     global $state_collections, $origine, $archive, $cote, $note, $lacune, $serial_id, $archstatut_id, $archtype_id, $location_id, $archempla_id;
     global $deflt_docs_location;
     $value = new stdClass();
     $value->id_serial = stripslashes($serial_id);
     if (!$location_id) {
         $location_id = $deflt_docs_location;
     }
     $value->location_id = stripslashes($location_id);
     $value->state_collections = stripslashes($state_collections);
     $value->collstate_emplacement = stripslashes($archempla_id);
     $value->collstate_type = stripslashes($archtype_id);
     $value->collstate_origine = stripslashes($origine);
     $value->collstate_note = stripslashes($note);
     $value->collstate_cote = stripslashes($cote);
     $value->collstate_archive = stripslashes($archive);
     $value->collstate_lacune = stripslashes($lacune);
     if (!$archstatut_id) {
         $archstatut_id = 1;
     }
     $value->collstate_statut = stripslashes($archstatut_id);
     $this->update($value);
     //Traitement des champs perso
     $p_perso = new parametres_perso("collstate");
     $p_perso->check_submited_fields();
     $p_perso->rec_fields_perso($this->id);
     if ($value->id_serial) {
         notice::majNoticesMotsGlobalIndex($value->id_serial, 'collstate');
     }
 }
Ejemplo n.º 7
0
         $rqt = $rqt_ins . " ('{$update_result}',0, '{$tmpcode_langue}', {$tmpordre_langue}) ";
         $res_ins = mysql_query($rqt, $dbh);
     }
 }
 // traitement des langues originales
 $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
 while (list($key, $val) = each($f_langorg_form)) {
     $tmpcode_langue = $val['code'];
     if ($tmpcode_langue) {
         $tmpordre_langue = $val['ordre'];
         $rqt = $rqt_ins . " ('{$update_result}',1, '{$tmpcode_langue}', {$tmpordre_langue}) ";
         $res_ins = @mysql_query($rqt, $dbh);
     }
 }
 //Traitement des champs perso
 $p_perso->rec_fields_perso($update_result);
 // Mise à jour de la table notices_global_index
 notice::majNoticesGlobalIndex($update_result);
 // Mise à jour de la table notices_mots_global_index
 notice::majNoticesMotsGlobalIndex($update_result);
 if ($gestion_acces_active == 1 && $myBulletinage->bull_num_notice) {
     //mise a jour des droits d'acces user_notice (idem notice mere perio)
     if ($gestion_acces_user_notice == 1) {
         $q = "replace into acces_res_1 select {$myBulletinage->bull_num_notice}, res_prf_num, usr_prf_num, res_rights, res_mask from acces_res_1 where res_num=" . $myBulletinage->bulletin_notice;
         mysql_query($q, $dbh);
     }
     //mise a jour des droits d'acces empr_notice
     if ($gestion_acces_empr_notice == 1) {
         $dom_2 = $ac->setDomain(2);
         if ($bul_id) {
             $dom_2->storeUserRights(1, $myBulletinage->bull_num_notice, $res_prf, $chk_rights, $prf_rad, $r_rad);
Ejemplo n.º 8
0
         $rqt = $rqt_ins . " ('{$result}',0, '{$tmpcode_langue}', {$tmpordre_langue}) ";
         $res_ins = pmb_mysql_query($rqt, $dbh);
     }
 }
 // traitement des langues originales
 $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
 while (list($key, $val) = each($f_langorg_form)) {
     $tmpcode_langue = $val['code'];
     if ($tmpcode_langue) {
         $tmpordre_langue = $val['ordre'];
         $rqt = $rqt_ins . " ('{$result}',1, '{$tmpcode_langue}', {$tmpordre_langue}) ";
         $res_ins = @pmb_mysql_query($rqt, $dbh);
     }
 }
 //Traitement des champs persos
 $p_perso->rec_fields_perso($result);
 // Mise à jour de la table notices_global_index
 notice::majNoticesGlobalIndex($result);
 // Mise à jour de la table notices_mots_global_index
 notice::majNoticesMotsGlobalIndex($result);
 if ($gestion_acces_active == 1) {
     //mise a jour des droits d'acces user_notice (idem notice mere perio)
     if ($gestion_acces_user_notice == 1) {
         $q = "replace into acces_res_1 select {$result}, res_prf_num, usr_prf_num, res_rights, res_mask from acces_res_1 where res_num=" . $myAnalysis->bulletin_notice;
         pmb_mysql_query($q, $dbh);
     }
     //mise a jour des droits d'acces empr_notice
     if ($gestion_acces_empr_notice == 1) {
         $dom_2 = $ac->setDomain(2);
         if ($analysis_id) {
             $dom_2->storeUserRights(1, $result, $res_prf, $chk_rights, $prf_rad, $r_rad);
Ejemplo n.º 9
0
function add_expl()
{
    global $typ_lig, $id_prod;
    global $pmb_droits_explr_localises, $explr_visible_mod;
    global $f_ex_cb, $f_ex_cote, $f_ex_typdoc, $f_ex_location, $f_ex_statut, $f_ex_cstat;
    global $f_ex_note, $f_ex_comment, $f_ex_prix, $f_ex_owner;
    global ${'f_ex_section' . $f_ex_location};
    $error = false;
    // visibilité des exemplaires
    // On ne vérifie que si l'utilisateur peut créer sur au moins une localisation.
    if ($pmb_droits_explr_localises && !$explr_visible_mod) {
        return $error;
    }
    $id_notice = 0;
    $id_bulletin = 0;
    switch ($typ_lig) {
        case '1':
            //notice
            $id_notice = $id_prod;
            break;
        case '2':
            //bulletin
            $id_bulletin = $id_prod;
            break;
        default:
            //non catalogué
            break;
    }
    if (!$id_bulletin && !$id_notice) {
        return $error;
    }
    //Vérification des champs personalisés
    $p_perso = new parametres_perso("expl");
    $nberrors = $p_perso->check_submited_fields();
    if ($nberrors) {
        return $error;
    }
    if ($id_notice) {
        $nex = new exemplaire($f_ex_cb, 0, $id_notice, 0);
    } else {
        $nex = new exemplaire($f_ex_cb, 0, 0, $id_bulletin);
    }
    if ($nex->expl_id) {
        return $error;
    } else {
        $nex->typdoc_id = $f_ex_typdoc;
        $nex->expl_cb = $nex_expl_cb;
        $nex->cote = $f_ex_cote;
        $nex->section_id = ${'f_ex_section' . $f_ex_location};
        $nex->statut_id = $f_ex_statut;
        $nex->location_id = $f_ex_location;
        $nex->codestat_id = $f_ex_cstat;
        $nex->note = $f_ex_note;
        $nex->prix = $f_ex_prix;
        $nex->owner_id = $f_ex_owner;
        $nex->create_date = today();
        $nex->expl_comment = $f_ex_comment;
        if (!$nex->save()) {
            return $error;
        }
        $p_perso->rec_fields_perso($nex->expl_id);
    }
    return !$error;
}