function save() { global $dbh; if ($this->idproc) { $q = "update procs set "; $q .= "requete = '" . addslashes($this->requete) . "', "; $q .= "comment = '" . addslashes($this->comment) . "', "; $q .= "autorisation = '" . implode(' ', $this->autorisations) . "', "; $q .= "parameters ='" . addslashes($this->parameters) . "', "; $q .= "num_classement = '" . $this->num_classement . "', "; $q .= "p_mode = '" . $this->p_mode . "', "; $q .= "p_form = '" . addslashes($this->p_form) . "' "; $q .= "where idproc = '" . $this->idproc . "' "; pmb_mysql_query($q, $dbh); } else { $q = "insert into procs set "; $q .= "requete = '" . addslashes($this->requete) . "', "; $q .= "comment = '" . addslashes($this->comment) . "', "; $q .= "autorisation = '" . implode(' ', $this->autorisations) . "', "; $q .= "parameters ='" . addslashes($this->parameters) . "', "; $q .= "num_classement = '" . $this->num_classement . "', "; $q .= "p_mode = '" . $this->p_mode . "', "; $q .= "p_form = '" . addslashes($this->p_form) . "' "; pmb_mysql_query($q, $dbh); $this->idproc = pmb_mysql_insert_id($dbh); } }
function _creer_transfert($id_expl, $src, $dest, $t_trans, $date_ret = '', $origine = 0, $ori_comp = '', $motif = '', $sens = 0, $etat = 0) { //on recupere le no de notice $rqt = "SELECT expl_notice, expl_bulletin, expl_statut, expl_section \n\t\t\t\tFROM exemplaires \n\t\t\t\tWHERE expl_id=" . $id_expl; $res = pmb_mysql_query($rqt); $expl = pmb_mysql_fetch_object($res); //$id_notice = pmb_mysql_result( $res, 0 ); // verif si déjà existrant $rqt = "Select * from transferts ,transferts_demande where \t\t\n\t\t\tnum_transfert=id_transfert and num_expl={$id_expl} and\t\t\t\t\t\n\t\t\tnum_notice=" . $expl->expl_notice . " and\n\t\t\tnum_bulletin=" . $expl->expl_bulletin . " and \n\t\t\ttype_transfert={$t_trans} and\n\t\t\tetat_transfert=0 and \n\t\t\torigine={$origine} and\n\t\t\torigine_comp ='" . addslashes($ori_comp) . "' and\n\t\t\tsource={$src} and\n\t\t\tdestinations ={$dest} "; $res = pmb_mysql_query($rqt); if (pmb_mysql_num_rows($res)) { $obj_data = pmb_mysql_fetch_object($res); $num = $obj_data->id_transfert; } else { //on cree l'enregistrement dans la table transferts $rqt = "INSERT INTO transferts ( \n\t\t\t\t\t\tnum_notice, num_bulletin, date_creation, \n\t\t\t\t\t\ttype_transfert, etat_transfert, \n\t\t\t\t\t\torigine, origine_comp, \n\t\t\t\t\t\tsource, destinations, \n\t\t\t\t\t\tdate_retour, motif ) VALUES (" . $expl->expl_notice . ", " . $expl->expl_bulletin . ", NOW()," . $t_trans . ", 0, " . $origine . ", '" . addslashes($ori_comp) . "'," . $src . ", '" . $dest . "', \n\t\t\t\t\t\t'" . $date_ret . "', '" . addslashes($motif) . "' )"; pmb_mysql_query($rqt); //on recupere l'id du transfert crée $num = pmb_mysql_insert_id(); } $rqt = "Select * from transferts_demande where\n\t\t\t\t\tnum_transfert={$num} and\t\t\t\t\t \n\t\t\t\t\tsens_transfert={$sens} and \n\t\t\t\t\tnum_location_source={$src} and \n\t\t\t\t\tnum_location_dest={$dest} and\n\t\t\t\t\tnum_expl={$id_expl} \n\t\t\t\t\t"; $res = pmb_mysql_query($rqt); if (!pmb_mysql_num_rows($res)) { //la table transferts_demande $rqt = "INSERT INTO transferts_demande (\n\t\t\t\t\t\tnum_transfert, date_creation, \n\t\t\t\t\t\tsens_transfert, num_location_source, \n\t\t\t\t\t\tnum_location_dest, num_expl, \n\t\t\t\t\t\tstatut_origine, section_origine, \n\t\t\t\t\t\tetat_demande ) VALUES (" . $num . ", NOW(), " . $sens . ", " . $src . ", " . $dest . ", " . $id_expl . ", " . $expl->expl_statut . ", " . $expl->expl_section . ", " . $etat . ")"; pmb_mysql_query($rqt); } return $num; }
function update_notice_categories_from_form($id_notice = 0, $id_bulletin = 0) { global $dbh; global $f_nb_categ; if (!$id_notice && $id_bulletin) { $query = "select * from bulletins where bulletin_id=" . $id_bulletin; $result = pmb_mysql_query($query, $dbh); if ($result) { $row = mysql_fetch_object($result); if ($row->num_notice) { $id_notice = $row->num_notice; } else { //on crée la notice de bulletin global $xmlta_doctype_bulletin, $deflt_notice_statut; pmb_mysql_query("INSERT INTO notices SET \n\t\t\t\t\ttit1 = '" . $row->bulletin_numero . ($row->mention_date ? " - " . $row->mention_date : "") . ($row->bulletin_titre ? " - " . $row->bulletin_titre : "") . "',\n\t\t\t\t\tstatut = '" . $deflt_notice_statut . "',\t\t\n\t\t\t\t\ttypdoc = '" . $xmlta_doctype_bulletin . "',\n\t\t\t\t\tcreate_date=sysdate(), update_date=sysdate() ", $dbh); $id_notice = pmb_mysql_insert_id($dbh); // Mise à jour des index de la notice notice::majNoticesTotal($id_notice); audit::insert_creation(AUDIT_NOTICE, $id_notice); //Mise à jour du bulletin $requete = "update bulletins set num_notice=" . $id_notice . " where bulletin_id=" . $id_bulletin; pmb_mysql_query($requete); //Mise à jour des liens bulletin -> notice mère $requete = "insert into notices_relations (num_notice,linked_notice,relation_type,rank) values(" . $id_notice . "," . $row->bulletin_notice . ",'b',1)"; pmb_mysql_query($requete); } } } if (!$id_notice) { return; } $query = "SELECT max(ordre_categorie) as ordre FROM notices_categories WHERE notcateg_notice='" . $id_notice . "' "; $result = pmb_mysql_query($query); $ordre_categ = 0; if ($result) { $row = mysql_fetch_object($result); if (isset($row->ordre)) { $ordre_categ = $row->ordre; } } if ($f_nb_categ) { $rqt_ins = "INSERT INTO notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES "; for ($i = 0; $i < $f_nb_categ; $i++) { $var_categ = "f_categ{$i}"; global ${$var_categ}; if (${$var_categ}) { $var_categid = "f_categ_id{$i}"; global ${$var_categid}; $rqt_sel = "SELECT notcateg_notice FROM notices_categories WHERE notcateg_notice='" . $id_notice . "' and num_noeud='" . ${$var_categid} . "' "; $res_sel = pmb_mysql_query($rqt_sel, $dbh); if ($res_sel && !pmb_mysql_num_rows($res_sel)) { $ordre_categ++; $rqt = $rqt_ins . " ('" . $id_notice . "','" . ${$var_categid} . "',{$ordre_categ}) "; $res_ins = @pmb_mysql_query($rqt, $dbh); } } } } }
function save() { global $dbh; $req = "insert into import_marc set notice='" . addslashes($this->sugg_uni_notice) . "', \n\t\t\torigine='" . addslashes($this->sugg_uni_origine) . "',\n\t\t\tno_notice='" . addslashes($this->sugg_uni_num_notice) . "'"; pmb_mysql_query($req, $dbh); $this->sugg_uni_id = pmb_mysql_insert_id(); $this->suggestions_unimarc($this->sugg_uni_id); }
function add_note($idnote = 0) { global $dbh, $base_path, $idtype, $idobject, $comment, $ordre_cible; $iddemande = $idobject; $commentaire = trim($comment); if ($ordre_cible) { $ordre = $ordre_cible; } else { $req = "select max(ordre)+1 from rapport_demandes where num_demande='" . $iddemande . "'"; $res = pmb_mysql_query($req, $dbh); $ordre = pmb_mysql_result($res, 0, 0); } $req = "insert into rapport_demandes set \n\t\tcontenu='" . $commentaire . "',\n\t\tnum_demande='" . $iddemande . "',\n\t\tnum_note='" . $idnote . "',\n\t\tordre = '" . $ordre . "',\n\t\ttype='" . $idtype . "'\n\t\t"; pmb_mysql_query($req, $dbh); if ($ordre_cible) { update_order(pmb_mysql_insert_id()); } $req = "select rd.id_item, rd.contenu, rd.ordre, rd.type, rd.num_note, sujet_action from rapport_demandes rd left join demandes_notes on num_note=id_note left join demandes_actions on num_action=id_action where rd.num_demande='" . $iddemande . "' order by ordre"; $res = pmb_mysql_query($req, $dbh); $display = ""; while ($item = pmb_mysql_fetch_object($res)) { $titre = substr($item->contenu, 0, 15) . "..."; $style = ""; if (!$item->num_note) { //Ajout manuel switch ($item->type) { case '1': //Titre $style = "style='background-color:#DECDEC' titre='yes'"; $content = $item->contenu; break; case '0': //Commmentaire $content = "* " . $item->contenu; break; } } else { $content = $item->contenu; } $ordre = $item->ordre; if ($item->sujet_action) { $contenu = "<u>" . $item->sujet_action . "</u> : " . $content; } else { $contenu = $content; } $drag = "<span id=\"rap_handle_{$item->id_item}\" style='padding-left:7px' ><img src=\"" . $base_path . "/images/notice_drag.png\" /></span>"; $del = "<span id=\"rap_del_{$item->id_item}\" style='padding-left:7px' onclick='delete_item({$item->id_item});' ><img src=\"" . $base_path . "/images/cross.png\" style='cursor:pointer;width:10px;vertical-align:middle;' /></span>"; $modif = "<span id=\"rap_modif_{$item->id_item}\" style='padding-left:7px;' onclick='modif_item({$item->id_item});' ><img src=\"" . $base_path . "/images/b_edit.png\" style='cursor:pointer;width:10px;vertical-align:middle;'/></span>"; $display .= "\n\t\t\t\t\t<div class='row' {$style} id='rap_drag_{$item->id_item}' draggable=\"yes\" dragtype=\"rapport\" dragtext=\"{$titre}\" dragicon=\"" . $base_path . "/images/icone_drag_notice.png\"\n\t\t\t\t\t\thandler=\"rap_handle_{$item->id_item}\" recepttype=\"rapport\" recept=\"yes\" highlight=\"rap_highlight\" downlight=\"rap_downlight\" iditem='{$item->id_item}' order='{$ordre}'>" . $contenu . $drag . $modif . $del . "</div>\t\t\t\n\t\t\t\t"; } ajax_http_send_response($display); }
function update($temp) { global $dbh; if ($this->id_classement) { $req = "update classements set nom_classement='" . $temp->nom_classement . "' where id_classement='" . $this->id_classement . "'"; $result = pmb_mysql_query($req, $dbh); } else { $req = "insert into classements set nom_classement='" . $temp->nom_classement . "', type_classement='" . $temp->type_classement . "' "; $result = @pmb_mysql_query($req, $dbh); $this->id_classement = pmb_mysql_insert_id(); $this->getData(); } }
function save() { global $dbh; if (!$this->explnum_doc_id) { //Création $req = "insert into explnum_doc set \n\t\t\t\t\t explnum_doc_nomfichier='" . addslashes($this->explnum_doc_nomfichier) . "',\n\t\t\t\t\t explnum_doc_mimetype='" . addslashes($this->explnum_doc_mime) . "',\n\t\t\t\t\t explnum_doc_extfichier='" . addslashes($this->explnum_doc_extfichier) . "',\n\t\t\t\t\t explnum_doc_data='" . addslashes($this->explnum_doc_contenu) . "'"; pmb_mysql_query($req, $dbh); $this->explnum_doc_id = pmb_mysql_insert_id(); } else { //Modification $req = "update explnum_doc set \n\t\t\t\t\t explnum_doc_nomfichier='" . addslashes($this->explnum_doc_nomfichier) . "',\n\t\t\t\t\t explnum_doc_mimetype='" . addslashes($this->explnum_doc_mime) . "',\n\t\t\t\t\t explnum_doc_extfichier='" . addslashes($this->explnum_doc_extfichier) . "',\n\t\t\t\t\t explnum_doc_data='" . addslashes($this->explnum_doc_contenu) . "'\n\t\t\t\t\t where id_explnum_doc='" . $this->explnum_doc_id . "'"; pmb_mysql_query($req, $dbh); } }
function save() { global $dbh; if (!$this->id_tache_docnum) { //Création $req = "insert into taches_docnum set \n\t\t\t\t\t tache_docnum_nomfichier='" . addslashes($this->tache_docnum_nomfichier) . "',\n\t\t\t\t\t tache_docnum_mimetype='" . addslashes($this->tache_docnum_mimetype) . "',\n\t\t\t\t\t tache_docnum_extfichier='" . addslashes($this->tache_docnum_extfichier) . "',\n\t\t\t\t\t tache_docnum_data='" . addslashes($this->tache_docnum_data) . "',\n\t\t\t\t\t tache_docnum_repertoire='" . addslashes($this->tache_docnum_repertoire) . "',\n\t\t\t\t\t tache_docnum_path='" . addslashes($this->tache_docnum_path) . "',\n\t\t\t\t\t num_tache='" . addslashes($this->num_tache) . "'\n\t\t\t\t\t "; pmb_mysql_query($req, $dbh); $this->id_tache_docnum = pmb_mysql_insert_id(); } else { //Modification $req = "update taches_docnum set \n\t\t\t\t\t tache_docnum_nomfichier='" . addslashes($this->tache_docnum_nomfichier) . "',\n\t\t\t\t\t tache_docnum_mimetype='" . addslashes($this->tache_docnum_mimetype) . "',\n\t\t\t\t\t tache_docnum_extfichier='" . addslashes($this->tache_docnum_extfichier) . "',\n\t\t\t\t\t tache_docnum_data='" . addslashes($this->tache_docnum_data) . "',\n\t\t\t\t\t tache_docnum_repertoire='" . addslashes($this->tache_docnum_repertoire) . "',\n\t\t\t\t\t tache_docnum_path='" . addslashes($this->tache_docnum_path) . "',\n\t\t\t\t\t num_tache='" . addslashes($this->num_tache) . "'\n\t\t\t\t\t where id_tache_docnum='" . $this->id_tache_docnum . "'"; pmb_mysql_query($req, $dbh); } }
function save() { global $dbh; if ($this->libelle == '') { die("Erreur de création statut de ligne d'acte"); } if ($this->id_statut) { $q = "update lignes_actes_statuts set \n\t\t\t\t\tlibelle = '" . $this->libelle . "',\n\t\t\t\t\trelance = '" . $this->relance . "'\n\t\t\t\t\twhere id_statut = '" . $this->id_statut . "' "; $r = pmb_mysql_query($q, $dbh); } else { $q = "insert into lignes_actes_statuts set \n\t\t\t\t\tlibelle = '" . $this->libelle . "',\n\t\t\t\t\trelance = '" . $this->relance . "' "; $r = pmb_mysql_query($q, $dbh); $this->id_statut = pmb_mysql_insert_id($dbh); } }
function save() { global $dbh; if ($this->libelle_categ == '') { die("Erreur de création catégorie de suggestions"); } if ($this->id_categ) { $q = "update suggestions_categ set libelle_categ = '" . addslashes($this->libelle_categ) . "' "; $q .= "where id_categ = '" . $this->id_categ . "' "; $r = pmb_mysql_query($q, $dbh); } else { $q = "insert into suggestions_categ set libelle_categ = '" . addslashes($this->libelle_categ) . "' "; $r = pmb_mysql_query($q, $dbh); $this->id_categ = pmb_mysql_insert_id($dbh); } }
function save() { global $dbh; if (!$this->libelle) { die("Erreur de création tva_achats"); } if ($this->id_tva) { $q = "update tva_achats set taux_tva ='" . $this->taux_tva . "', libelle = '" . $this->libelle . "', num_cp_compta = '" . $this->num_cp_compta . "' "; $q .= "where id_tva = '" . $this->id_tva . "' "; $r = pmb_mysql_query($q, $dbh); } else { $q = "insert into tva_achats set libelle = '" . $this->libelle . "', taux_tva = '" . $this->taux_tva . "', num_cp_compta = '" . $this->num_cp_compta . "' "; $r = pmb_mysql_query($q, $dbh); $this->id_tva = pmb_mysql_insert_id($dbh); } }
function save() { global $dbh; if ($this->libelle == '') { die("Erreur de création paiement"); } if ($this->id_paiement) { $q = "update paiements set libelle ='" . $this->libelle . "', commentaire = '" . $this->commentaire . "' "; $q .= "where id_paiement = '" . $this->id_paiement . "' "; $r = pmb_mysql_query($q, $dbh); } else { $q = "insert into paiements set libelle = '" . $this->libelle . "', commentaire = '" . $this->commentaire . "' "; pmb_mysql_query($q, $dbh); $this->id_paiement = pmb_mysql_insert_id($dbh); } }
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); }
function proceed() { global $first; switch ($this->act) { //Enregistrer case "update": //Si sauv_lieu_id vide alors création if ($this->sauv_table_id == "") { $this->verifName(); $requete = "insert into sauv_tables (sauv_table_nom) values('')"; pmb_mysql_query($requete) or die(pmb_mysql_error()); $this->sauv_table_id = pmb_mysql_insert_id(); $first = ""; } //Update avec les données reçues $this->verifTables(); $this->verifName(); $requete = "update sauv_tables set sauv_table_nom='" . $this->sauv_table_nom . "', sauv_table_tables='" . implode(",", $this->sauv_table_tables) . "' where sauv_table_id=" . $this->sauv_table_id; pmb_mysql_query($requete) or die(pmb_mysql_error()); $first = ""; break; //Supprimer //Supprimer case "delete": $requete = "delete from sauv_tables where sauv_table_id=" . $this->sauv_table_id; pmb_mysql_query($requete) or die(pmb_mysql_error()); $this->sauv_table_id = ""; $first = 0; break; //Annuler //Annuler case "cancel": echo "<script>history.go(-2);</script>"; exit; break; case "update_unsaved": $this->updateUnsaved(); break; //Visualiser //Visualiser default: //Ne rien faire, le numéro de la fiche est déjà dans $this->sauv_lieu_id } return $this->showForm(); }
public function save() { if ($this->id) { $query = "update editions_states"; $clause = " where id_editions_state = " . $this->id; } else { $query = "insert into editions_states"; $clause = ""; } //On supprimer les informations de paramétrage pour les vues au cas ou on supprime un champ utilisé pour une vue $this->state_fields_params["view"] = array(); //on va chercher les infos des filtres, tris, groupements... $query .= " set\n\t\t\teditions_state_name = '" . addslashes($this->name) . "',\n\t\t\teditions_state_num_classement = '" . addslashes($this->classement) . "',\n\t\t\teditions_state_used_datasource = '" . addslashes($this->used_datasource) . "',\n\t\t\teditions_state_comment = '" . addslashes($this->comment) . "',\n\t\t\teditions_state_fieldslist = '" . addslashes(serialize($this->state_fields_list)) . "',\n\t\t\teditions_state_fieldsparams = '" . addslashes(serialize($this->state_fields_params)) . "'"; pmb_mysql_query($query . $clause); if (!$this->id) { $this->id = pmb_mysql_insert_id(); } }
function save() { global $dbh; if ($this->libelle == '') { die("Erreur de création type produit"); } if ($this->id_produit) { $q = "update types_produits set libelle ='" . $this->libelle . "', num_cp_compta = '" . $this->num_cp_compta . "', "; $q .= "num_tva_achat = '" . $this->num_tva_achat . "' "; $q .= "where id_produit = '" . $this->id_produit . "' "; $r = pmb_mysql_query($q, $dbh); } else { $q = "insert into types_produits set libelle = '" . $this->libelle . "', num_cp_compta = '" . $this->num_cp_compta . "', "; $q .= " num_tva_achat = '" . $this->num_tva_achat . "' "; $r = pmb_mysql_query($q, $dbh); $this->id_produit = pmb_mysql_insert_id($dbh); } }
function save() { global $dbh; if ($this->libelle == '' || !$this->num_budget) { die("Erreur de création rubriques"); } if ($this->id_rubrique) { $q = "update rubriques set num_budget = '" . $this->num_budget . "', num_parent = '" . $this->num_parent . "', libelle = '" . $this->libelle . "', "; $q .= "commentaires = '" . $this->commentaires . "', montant = '" . $this->montant . "', num_cp_compta = '" . $this->num_cp_compta . "', autorisations = '" . $this->autorisations . "' "; $q .= "where id_rubrique = '" . $this->id_rubrique . "' "; $r = pmb_mysql_query($q, $dbh); } else { $q = "insert into rubriques set num_budget = '" . $this->num_budget . "', num_parent = '" . $this->num_parent . "', libelle = '" . $this->libelle . "', "; $q .= "commentaires = '" . $this->commentaires . "', montant = '" . $this->montant . "', num_cp_compta = '" . $this->num_cp_compta . "', autorisations = '" . $this->autorisations . "' "; $r = pmb_mysql_query($q, $dbh); $this->id_rubrique = pmb_mysql_insert_id($dbh); } }
function save() { global $dbh; if (!$this->num_entite || $this->libelle == '') { die("Erreur de création exercice"); } if ($this->id_exercice) { $q = "update exercices set num_entite = '" . $this->num_entite . "', libelle ='" . $this->libelle . "', "; $q .= "date_debut = '" . $this->date_debut . "', date_fin = '" . $this->date_fin . "', statut = '" . $this->statut . "' "; $q .= "where id_exercice = '" . $this->id_exercice . "' "; pmb_mysql_query($q, $dbh); } else { $q = "insert into exercices set num_entite = '" . $this->num_entite . "', libelle = '" . $this->libelle . "', "; $q .= "date_debut = '" . $this->date_debut . "', date_fin = '" . $this->date_fin . "', statut = '" . $this->statut . "' "; pmb_mysql_query($q, $dbh); $this->id_exercice = pmb_mysql_insert_id($dbh); $this->load(); } }
function save() { global $dbh; if ($this->libelle == '') { die("Erreur de création frais"); } if ($this->id_frais) { $q = "update frais set libelle ='" . $this->libelle . "', condition_frais = '" . $this->condition_frais . "', "; $q .= "montant = '" . $this->montant . "', num_cp_compta = '" . $this->num_cp_compta . "', "; $q .= "num_tva_achat = '" . $this->num_tva_achat . "', index_libelle = ' " . strip_empty_words($this->libelle) . " ' "; $q .= "where id_frais = '" . $this->id_frais . "' "; $r = pmb_mysql_query($q, $dbh); } else { $q = "insert into frais set libelle = '" . $this->libelle . "', condition_frais = '" . $this->condition_frais . "', "; $q .= "montant = '" . $this->montant . "', num_cp_compta = '" . $this->num_cp_compta . "', num_tva_achat = '" . $this->num_tva_achat . "', index_libelle = ' " . strip_empty_words($this->libelle) . " ' "; $r = pmb_mysql_query($q, $dbh); $this->id_frais = pmb_mysql_insert_id($dbh); } }
public function save() { global $dbh; global $name; global $code; $fields = "\n\t\t\tvoice_name='" . $name . "', voice_code='" . $code . "'\n\t\t"; if (!$this->id) { // Ajout $requete = "select max(voice_order) as ordre from nomenclature_voices"; $resultat = pmb_mysql_query($requete, $dbh); $ordre_max = @pmb_mysql_result($resultat, 0, 0); $req = "INSERT INTO nomenclature_voices SET {$fields}, voice_order=" . ($ordre_max + 1); pmb_mysql_query($req, $dbh); $this->id = pmb_mysql_insert_id($dbh); } else { $req = "UPDATE nomenclature_voices SET {$fields} where id_voice=" . $this->id; pmb_mysql_query($req, $dbh); } $this->fetch_data(); }
function proceed() { global $first; switch ($this->act) { //Enregistrer case "update": //Si sauv_lieu_id vide alors création if ($this->sauv_lieu_id == "") { $this->verifName(); $requete = "insert into sauv_lieux (sauv_lieu_nom,sauv_lieu_url) values('','')"; pmb_mysql_query($requete) or die(pmb_mysql_error()); $this->sauv_lieu_id = pmb_mysql_insert_id(); $first = ""; } //Update avec les données rfeçues $this->verifName(); $requete = "update sauv_lieux set sauv_lieu_nom='" . $this->sauv_lieu_nom . "', sauv_lieu_url='" . $this->sauv_lieu_url . "', sauv_lieu_protocol='" . $this->sauv_lieu_protocol . "',sauv_lieu_host='" . $this->sauv_lieu_host . "',sauv_lieu_login='******', sauv_lieu_password='******' where sauv_lieu_id=" . $this->sauv_lieu_id; pmb_mysql_query($requete) or die(pmb_mysql_error()); $first = ""; break; //Supprimer //Supprimer case "delete": $requete = "delete from sauv_lieux where sauv_lieu_id=" . $this->sauv_lieu_id; pmb_mysql_query($requete) or die(pmb_mysql_error()); $this->sauv_lieu_id = ""; $first = 0; break; //Annuler //Annuler case "cancel": echo "<script>history.go(-2);</script>"; exit; break; //Visualiser //Visualiser default: //Ne rien faire, le numéro de la fiche est déjà dans $this->sauv_lieu_id } return $this->showForm(); }
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 .= 'where id_noeud = \'' . $this->id_noeud . '\' '; pmb_mysql_query($q, $dbh); } 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 . '\' '; pmb_mysql_query($q, $dbh); $this->id_noeud = pmb_mysql_insert_id($dbh); } // 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); print $id_tmp . " "; if (!$id_cur || $id_cur == $id_top) { break; } if ($path) { $path = '/' . $path; } $path = $id_tmp . $path; } noeuds::process_categ_path($this->id_noeud, $path); }
static function calculate_empty_words($nb_notices_calcul = 0) { //si mot pas de lien suppression du mot @pmb_mysql_query("delete from mots where id_mot in (select num_mot from linked_mots where linked_mots.type_lien=2 group by num_mot) and id_mot not in (select num_linked_mot from linked_mots group by num_linked_mot)"); //vidage des mots vides calculés de la table linked_mots @pmb_mysql_query("delete from linked_mots where type_lien=2"); //si le paramètre de nombre de notices pour lequel le mot est considéré vide est vide, on considère que ce nombre est la moitié des notices //si le nombre de notices pour lequel le mot est présent est supérieur au paramètre if (!$nb_notices_calcul) { $nb_noti = "*2>nb"; } else { $nb_noti = ">" . $nb_notices_calcul; } $rqt1 = "select word, count(id_notice) as cm,(select count(*) from notices) as nb from notices_mots_global_index join words on num_word = id_word group by num_word having cm{$nb_noti}"; $execute_query1 = pmb_mysql_query($rqt1); //parcours de tous les mots trouvés afin de générer le code php while ($r1 = pmb_mysql_fetch_object($execute_query1)) { //vérification de l'existence du mot dans la table mots $rqt_select = "select id_mot from mots where mot='" . $r1->word . "'"; $query_select = pmb_mysql_query($rqt_select); if ($r_mot = pmb_mysql_num_rows($query_select)) { $id_mot = $r_mot->id_mot; // Verifier de l'existance en mot vide (type_lien à 3) $rqt_words_created = "select mot from mots,linked_mots where mots.id_mot=linked_mots.num_mot and linked_mots.type_lien=3"; $query_select = pmb_mysql_query($rqt_select); if (!pmb_mysql_num_rows($query_select)) { // Le mot est aussi un synonyme, donc insertion information mot vide calculé pmb_mysql_query("insert into linked_mots (num_mot,num_linked_mot, type_lien) values (" . $id_mot . ",0,2)"); } } else { //ajout du mot @pmb_mysql_query("insert into mots (mot) values ('" . $r1->word . "')"); $id_mot = pmb_mysql_insert_id(); @pmb_mysql_query("insert into linked_mots (num_mot,num_linked_mot, type_lien) values (" . $id_mot . ",0,2)"); } } }
public function save_form() { global $dbh; $this->get_hash(); if ($this->id) { $query = "update cms_cadre_content set"; $clause = " where id_cadre_content=" . $this->id; } else { $query = "insert into cms_cadre_content set"; $clause = ""; } $query .= " \n\t\t\tcadre_content_hash = '" . $this->hash . "',\n\t\t\tcadre_content_type = 'view',\n\t\t\tcadre_content_object = '" . $this->class_name . "'," . ($this->cadre_parent ? "cadre_content_num_cadre = " . $this->cadre_parent . "," : "") . "\t\t\n\t\t\tcadre_content_data = '" . addslashes($this->serialize()) . "'\n\t\t\t" . $clause; $result = pmb_mysql_query($query, $dbh); if ($result) { if (!$this->id) { $this->id = pmb_mysql_insert_id(); } //on supprime les anciennes vues... $query = "delete from cms_cadre_content where id_cadre_content != " . $this->id . " and cadre_content_type='view' and cadre_content_num_cadre = " . $this->cadre_parent; pmb_mysql_query($query, $dbh); return true; } return false; }
function import($name, $comment = "", $id_pclassement = "") { global $dbh; global $pmb_limitation_dewey; global $thesaurus_classement_defaut; // check sur la variable passée en paramètre if (!$name) { return 0; } if ($pmb_limitation_dewey < 0) { return 0; } if ($pmb_limitation_dewey) { $name = substr($name, 0, $pmb_limitation_dewey); } // tentative de récupérer l'id associée dans la base (implique que l'autorité existe) // préparation de la requête $key = addslashes($name); $comment = addslashes($comment); if (!$id_pclassement) { $num_pclass = $thesaurus_classement_defaut; } else { $num_pclass = $id_pclassement; } //On regarde si le plan de classement existe $query = "SELECT name_pclass FROM pclassement WHERE id_pclass='" . addslashes($num_pclass) . "' LIMIT 1 "; $result = @pmb_mysql_query($query, $dbh); if (!$result) { die("can't SELECT pclassement " . $query); } if (!pmb_mysql_num_rows($result)) { //Le plan de classement demandé n'existe pas return 0; // -> pas d'import } $query = "SELECT indexint_id FROM indexint WHERE indexint_name='" . rtrim(substr($key, 0, 255)) . "' and num_pclass='{$num_pclass}' LIMIT 1 "; $result = @pmb_mysql_query($query, $dbh); if (!$result) { die("can't SELECT indexint " . $query); } // résultat // récupération du résultat de la recherche $tindexint = pmb_mysql_fetch_object($result); // du résultat et récupération éventuelle de l'id if ($tindexint->indexint_id) { return $tindexint->indexint_id; } // id non-récupérée >> création if (!$id_pclassement) { $num_pclass = $thesaurus_classement_defaut; } else { $num_pclass = $id_pclassement; } $query = "INSERT INTO indexint SET indexint_name='{$key}', indexint_comment='{$comment}', index_indexint=' " . strip_empty_words($key . " " . $comment) . " ', num_pclass={$num_pclass} "; $result = @pmb_mysql_query($query, $dbh); if (!$result) { die("can't INSERT into indexint " . $query); } $id = pmb_mysql_insert_id($dbh); audit::insert_creation(AUDIT_INDEXINT, $id); return $id; }
public function save() { global $dbh; $fields = "\n\t\t\tworkshop_label='" . addslashes($this->label) . "',\n\t\t\tworkshop_num_nomenclature='" . $this->num_nomenclature . "',\n\t\t\tworkshop_order='" . $this->order . "'\n\t\t\t"; $req = "INSERT INTO nomenclature_workshops SET {$fields} "; pmb_mysql_query($req, $dbh); $this->id = pmb_mysql_insert_id(); foreach ($this->instruments_data as $instrument) { $req = "INSERT INTO nomenclature_workshops_instruments SET\r\n\t\t\t\tworkshop_instrument_num_workshop='" . $this->id . "',\r\n\t\t\t\tworkshop_instrument_num_instrument='" . $instrument['id'] . "',\r\n\t\t\t\tworkshop_instrument_number='" . $instrument['effective'] . "',\n\t\t\t\tworkshop_instrument_order='" . $instrument['order'] . "'\r\n\t\t\t\t"; pmb_mysql_query($req, $dbh); } $this->fetch_datas(); }
function create_expl($f_ex_cb, $id, $f_ex_typdoc, $f_ex_cote, $f_ex_section, $f_ex_statut, $f_ex_location, $f_ex_cstat, $f_ex_note, $f_ex_prix, $f_ex_owner, $f_ex_comment = '') { global $dbh; $new_expl = 0; $expl_retour = 0; $requete = "SELECT expl_id FROM exemplaires WHERE expl_cb='{$f_ex_cb}' "; $res = pmb_mysql_query($requete, $dbh); $nbr_lignes = @pmb_mysql_num_rows($res); if ($nbr_lignes) { $valid_requete = 0; $lu = pmb_mysql_fetch_array($res); $expl_retour = $lu['expl_id']; } else { $valid_requete = 1; } if ($valid_requete) { $requete = 'INSERT INTO exemplaires SET create_date=sysdate(), '; $requete .= "expl_cb='{$f_ex_cb}'"; $requete .= ", expl_notice={$id}"; $requete .= ", expl_typdoc={$f_ex_typdoc}"; $requete .= ", expl_cote='{$f_ex_cote}'"; $requete .= ", expl_section={$f_ex_section}"; $requete .= ", expl_statut={$f_ex_statut}"; $requete .= ", expl_location={$f_ex_location}"; $requete .= ", expl_codestat={$f_ex_cstat}"; $requete .= ", expl_note='" . ${f_ex_note} . "'"; $requete .= ", expl_comment='" . ${f_ex_comment} . "'"; $requete .= ", expl_prix='{$f_ex_prix}'"; $requete .= ", expl_owner='{$f_ex_owner}'"; $result = pmb_mysql_query($requete, $dbh); $expl_retour = pmb_mysql_insert_id(); audit::insert_creation(AUDIT_EXPL, $expl_retour); $new_expl = 1; } $retour = array($new_expl, $expl_retour); return $retour; }
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); }
public function save_form() { global $dbh; global $selector_choice; $this->parameters['selector'] = $selector_choice; $this->get_hash(); if ($this->id) { $query = "update cms_cadre_content set"; $clause = " where id_cadre_content=" . $this->id; } else { $query = "insert into cms_cadre_content set"; $clause = ""; } $query .= " \n\t\t\tcadre_content_hash = '" . $this->hash . "',\n\t\t\tcadre_content_type = 'datasource',\n\t\t\tcadre_content_object = '" . $this->class_name . "'," . ($this->cadre_parent ? "cadre_content_num_cadre = " . $this->cadre_parent . "," : "") . "\t\t\n\t\t\tcadre_content_data = '" . addslashes($this->serialize()) . "'\n\t\t\t" . $clause; $result = pmb_mysql_query($query, $dbh); if ($result) { if (!$this->id) { $this->id = pmb_mysql_insert_id(); } //on supprime les anciennes sources de données... $query = "delete from cms_cadre_content where id_cadre_content != " . $this->id . " and cadre_content_type='datasource' and cadre_content_num_cadre = " . $this->cadre_parent; pmb_mysql_query($query, $dbh); //sélecteur $selector_id = 0; for ($i = 0; $i < count($this->selectors); $i++) { if ($this->parameters['selector'] == $this->selectors[$i]['name']) { $selector_id = $this->selectors[$i]['id']; break; } } if ($this->parameters['selector']) { $selector = new $this->parameters['selector']($selector_id); $selector->get_hash_from_form(); $selector->set_parent($this->id); $selector->set_cadre_parent($this->cadre_parent); $result = $selector->save_form(); if ($result) { if ($selector_id == 0) { $this->selectors[] = array('id' => $selector->id, 'name' => $this->parameters['selector']); } return true; } else { //création de la source de donnée ratée, on supprime le hash de la table... $this->delete_hash(); return false; } } else { return true; } } else { //création de la source de donnée ratée, on supprime le hash de la table... $this->delete_hash(); return false; } }
function set_rights($es_r) { global $msg; $this->clear_error(); //Vérification des droits if (!$es_r->method && $this->es->group_exists($es_r->group) || $this->es->method_exists($es_r->group, $es_r->method)) { //Vérification des droits if ($es_r->anonymous_user && $this->has_basic_rights($es_r->anonymous_user, $es_r->group, $es_r->method) || !$es_r->anonymous_user) { //Pour chaque user, vérification des droits ! for ($i = 0; $i < count($es_r->users); $i++) { if ($es_r->users[$i] != $es_r->anonymous_user && !$this->has_basic_rights($es_r->users[$i], $es_r->group, $es_r->method)) { if ($es_r->method) { $this->set_error(ES_RIGHTS_USER_BAD_PMB_RIGHTS_FOR_METHOD, sprintf($msg["es_rights_user_unsifficent_rights"], $this->users[$es_r->users[$i]]->username, $es_r->method, $es_r->group)); } else { $this->set_error(ES_RIGHTS_USER_BAD_PMB_RIGHTS_FOR_GROUP, sprintf($msg["es_rights_user_unsifficent_rights_group"], $this->users[$es_r->users[$i]]->username, $es_r->group)); } return false; } } //Tout va bien, on insère !! //Recherche de l'ancien id $id_method = 0; $requete = "select id_method from es_methods where groupe='" . addslashes($es_r->group) . "' and method='" . addslashes($es_r->method) . "'"; $resultat = pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat)) { $id_method = pmb_mysql_result($resultat, 0, 0); } if ($id_method) { $requete = "delete from es_methods where groupe='" . addslashes($es_r->group) . "' and method='" . addslashes($es_r->method) . "'"; pmb_mysql_query($requete); $requete = "delete from es_methods_users where num_method={$id_method}"; pmb_mysql_query($requete); } //Insertion maintenant $requete = "insert into es_methods (groupe,method,available) values('" . addslashes($es_r->group) . "','" . addslashes($es_r->method) . "'," . $es_r->available . ")"; pmb_mysql_query($requete); $id_method = pmb_mysql_insert_id(); if ($es_r->anonymous_user) { pmb_mysql_query("insert into es_methods_users (num_method,num_user,anonymous) values({$id_method},{$es_r->anonymous_user},1)"); } for ($i = 0; $i < count($es_r->users); $i++) { if ($es_r->users[$i] != $es_r->anonymous_user) { pmb_mysql_query("insert into es_methods_users (num_method,num_user,anonymous) values({$id_method}," . $es_r->users[$i] . ",0)"); } } return true; } else { if ($es_r->method) { $this->set_error(ES_RIGHTS_ANONYMOUS_USER_BAD_PMB_RIGHTS_FOR_METHOD, sprintf($msg["es_rights_unsufficent_anonymous_user_method"], $this->users[$es_r->anonymous_user]->username, $es_r->method, $es_r->group)); } else { $this->set_error(ES_RIGHTS_ANONYMOUS_USER_BAD_PMB_RIGHTS_FOR_GROUP, sprintf($msg["es_rights_unsufficent_anonymous_user_group"], $this->users[$es_r->anonymous_user]->username, $es_r->group)); } return false; } } else { $this->set_error(ES_RIGHTS_UNKNOWN_GROUP_OR_METHOD, $msg["es_rights_error_unknown_group"]); return false; } }