Пример #1
0
function update_dev()
{
    global $id_bibli, $id_dev, $num_dev, $statut;
    global $id_fou;
    global $id_adr_liv, $id_adr_fac;
    global $comment, $comment_i, $ref, $devise;
    global $code, $lib, $qte, $prix, $typ, $tva, $rem, $id_sug, $id_lig, $typ_lig, $id_prod;
    global $acquisition_gestion_tva;
    //Recuperation des lignes valides
    $tab_lig = array();
    if (count($id_lig)) {
        foreach ($id_lig as $k => $v) {
            $code[$k] = trim($code[$k]);
            $lib[$k] = trim($lib[$k]);
            if ($code[$k] != '' || $lib[$k] != '') {
                $tab_lig[$k] = $v;
            }
        }
    }
    if (!$id_dev) {
        //Creation de devis
        $dev = new actes();
        $dev->type_acte = TYP_ACT_DEV;
        $dev->num_entite = $id_bibli;
        /*$num_dev=trim($num_dev);
        		if ($num_dev!='') {
        			$dev->numero=$num_dev;
        		} else {
        			$dev->calc();
        		}*/
        $dev->statut = STA_ACT_ENC;
        $dev->num_fournisseur = $id_fou;
        $dev->num_contact_livr = $id_adr_liv;
        $dev->num_contact_fact = $id_adr_fac;
        $dev->commentaires = trim($comment);
        $dev->commentaires_i = trim($comment_i);
        $dev->reference = trim($ref);
        $dev->devise = trim($devise);
        $dev->save();
        $id_dev = $dev->id_acte;
        //Creation des lignes de devis
        foreach ($tab_lig as $k => $v) {
            $lig_dev = new lignes_actes();
            $lig_dev->type_ligne = $typ_lig[$k];
            $lig_dev->num_acte = $id_dev;
            $lig_dev->num_produit = $id_prod[$k];
            $lig_dev->num_acquisition = $id_sug[$k];
            $lig_dev->num_type = $typ[$k];
            $lig_dev->code = $code[$k];
            $lig_dev->libelle = $lib[$k];
            $lig_dev->prix = $prix[$k];
            if ($acquisition_gestion_tva) {
                $lig_dev->tva = $tva[$k];
            } else {
                $lig_dev->tva = '0.00';
            }
            $lig_dev->remise = $rem[$k];
            $lig_dev->nb = round($qte[$k]);
            $lig_dev->date_cre = today();
            $lig_dev->save();
        }
        //Mise à jour du statut des suggestions et envoi email suivi de suggestion
        $sug_map = new suggestions_map();
        $sug_map->doTransition('ESTIMATED', $id_sug);
    } else {
        //Modification de devis
        $dev = new actes($id_dev);
        /*$num_dev=trim($num_dev);
        		if ($num_dev!='') {
        			$dev->numero=$num_dev;
        		} else {
        			$dev->numero=addslashes($dev->numero);
        		}*/
        $old_statut = $dev->statut & ~STA_ACT_ARC;
        if ($old_statut != STA_ACT_ENC && $old_statut != STA_ACT_REC) {
            $old_statut = STA_ACT_ENC;
        }
        if ($statut == STA_ACT_ARC) {
            $rec_statut = $old_statut | STA_ACT_ARC;
        } else {
            $rec_statut = $statut;
        }
        $dev->statut = $rec_statut;
        $dev->num_fournisseur = $id_fou;
        $dev->num_contact_livr = $id_adr_liv;
        $dev->num_contact_fact = $id_adr_fac;
        $dev->commentaires = trim($comment);
        $dev->commentaires_i = trim($comment_i);
        $dev->reference = trim($ref);
        $dev->devise = trim($devise);
        $dev->save();
        //maj des lignes de devis
        foreach ($tab_lig as $k => $v) {
            $lig_dev = new lignes_actes($v);
            $lig_dev->type_ligne = $typ_lig[$k];
            $lig_dev->num_acte = $id_dev;
            $lig_dev->num_produit = $id_prod[$k];
            $lig_dev->num_acquisition = $id_sug[$k];
            $lig_dev->num_type = $typ[$k];
            $lig_dev->code = $code[$k];
            $lig_dev->libelle = $lib[$k];
            $lig_dev->prix = $prix[$k];
            if ($acquisition_gestion_tva) {
                $lig_dev->tva = $tva[$k];
            } else {
                $lig_dev->tva = '0.00';
            }
            $lig_dev->remise = $rem[$k];
            $lig_dev->nb = round($qte[$k]);
            $lig_dev->date_cre = today();
            $lig_dev->save();
            if ($v == 0) {
                $tab_lig[$k] = $lig_dev->id_ligne;
            }
        }
        //suppression des lignes non reprises
        $dev->cleanLignes($id_dev, $tab_lig);
    }
}
    $y_footer = '15';
} else {
    $y_footer = $pos_footer[0];
}
if (!$pos_footer[1]) {
    $fs_footer = '8';
} else {
    $fs_footer = $pos_footer[1];
}
//---------------------------------------------------------------------------------------------------------------------
$taille_doc = array($largeur_page, $hauteur_page);
$w = $largeur_page - $marge_gauche - $marge_droite;
$ourPDF = new $fpdf($orient_page, 'mm', $taille_doc);
$ourPDF->Open();
$ourPDF->SetMargins($marge_gauche, $marge_haut, $marge_droite);
$sug_map = new suggestions_map();
//On récupère les infos de la liste de suggestions
if (!$statut) {
    $statut = -1;
}
$us = stripslashes($user_input);
$mask = $sug_map->getMask_FILED();
if (!$user_input) {
    $q = suggestions::listSuggestions(0, $statut, $num_categ, $mask);
} else {
    $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
    $q = suggestions::listSuggestions(0, $statut, $num_categ, $mask, 0, 0, $aq, $user_input);
}
$res = pmb_mysql_query($q, $dbh);
$ourPDF->addPage();
$ourPDF->setFont($pmb_pdf_font);
Пример #3
0
     case "deflt3liv_statut":
         $t = actes::getStatelist(TYP_ACT_LIV);
         break;
     case "deflt3fac_statut":
         $t = actes::getStatelist(TYP_ACT_FAC);
         break;
     case "deflt3sug_statut":
         $m = new suggestions_map();
         $t = $m->getStateList();
         break;
     case 'deflt3lgstatcde':
     case 'deflt3lgstatdev':
         $q = lgstat::getList('QUERY');
         break;
     case 'deflt3receptsugstat':
         $m = new suggestions_map();
         $t = $m->getStateList('ORDERED', TRUE);
         break;
 }
 if ($q) {
     $r = mysql_query($q, $dbh) or die("<br />" . mysql_error() . "<br />" . $q . "<br />");
     $nb = mysql_num_rows($r);
     while ($row = mysql_fetch_row($r)) {
         $t[$row[0]] = $row[1];
     }
 }
 if (count($t)) {
     $deflt3user .= "<div class='row'><div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;</div>\n";
     $deflt3user .= "<div class='colonne_suite'><select class='saisie-30em' name=\"form_" . $field . "\">";
     foreach ($t as $k => $v) {
         $deflt3user .= "<option value=\"" . $k . "\" ";
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: suggestions_empr.inc.php,v 1.4 2015-04-03 11:16:25 jpermanne Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . "/suggestions_map.class.php";
require_once "./acquisition/suggestions/func_suggestions.inc.php";
global $dbh, $statut;
$sug_map = new suggestions_map();
if ($statut == -1 || $statut == '') {
    $statut_clause = "";
} else {
    $statut_clause = "and statut='" . $statut . "'";
}
$req = "select count(id_suggestion) as nb, concat(empr_nom,' ',empr_prenom) as nom, id_empr as id, empr_location from suggestions, suggestions_origine, empr\n where origine=id_empr and num_suggestion=id_suggestion and type_origine=1 {$statut_clause} group by nom";
$res = pmb_mysql_query($req, $dbh);
$aff = "\n\t<h1>" . $msg['acquisition_sug_ges'] . "</h1>\n\t<form name='list_lecteur_sug' method='post' action='./acquisition.php?categ=sug&sub=empr_sug'>\n\t<h3>" . $msg['acquisition_sugg_list_lecteur'] . "</h3>\n\t<div class='form-contenu'>\n\t\t<div class='row'>\n\t\t\t<label class='etiquette'>" . $msg['acquisition_sugg_filtre_by_etat'] . "\n\t\t\t</label>\t\n\t\t</div>\n\t\t<div class='row'> " . $sug_map->getStateSelector() . "\n\t\t</div>\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<th>" . $msg['acquisition_sugg_lecteur'] . "</th>\n\t\t\t\t<th>" . $msg['acquisition_sugg_nb'] . "</th>\n\t\t\t</tr>";
if (!pmb_mysql_num_rows($res)) {
    $aff .= "<tr><td>" . htmlentities($msg['acquisition_sugg_no_state_lecteur'], ENT_QUOTES, $charset) . "</td></tr>";
} else {
    $parity = 1;
    while ($empr = pmb_mysql_fetch_object($res)) {
        if ($parity % 2) {
            $pair_impair = "even";
        } else {
            $pair_impair = "odd";
        }
Пример #5
0
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: suggestions.inc.php,v 1.35 2013-10-15 07:49:33 dgoron Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
//URL de retour du form de création/modification de suggestion
$back_url = "onClick=\"document.location='./acquisition.php?categ=sug&action=list'\"";
require_once $base_path . '/acquisition/suggestions/func_suggestions.inc.php';
require_once $class_path . '/suggestions_map.class.php';
if ($acquisition_sugg_display) {
    require_once $acquisition_sugg_display;
} else {
    require_once 'suggestions_display.inc.php';
}
$sug_map = new suggestions_map();
//Traitement des transitions
if ($transition) {
    $sug_map->doTransition($transition, $chk);
    if ($sug_map->getState_DISPLAY($transition) != 'NO') {
        $statut = $sug_map->getState_ID($transition);
    } else {
        $statut = -1;
    }
}
//Traitement des changements de categories
if ($acquisition_sugg_categ == '1' && $action == 'to_categ') {
    $sug_map->changeCateg($chk, $to_categ);
}
//Traitement des actions
print "<h1>" . htmlentities($msg['acquisition_sug_ges'], ENT_QUOTES, $charset) . "</h1>";
Пример #6
0
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: valid_sugg.inc.php,v 1.20 2015-10-05 13:15:04 jpermanne Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
// classes de gestion des suggestions
require_once $base_path . '/classes/suggestions.class.php';
require_once $base_path . '/classes/suggestions_origine.class.php';
require_once $base_path . '/classes/suggestions_map.class.php';
require_once $base_path . '/classes/suggestions_categ.class.php';
require_once $include_path . '/explnum.inc.php';
require_once $base_path . '/classes/explnum_doc.class.php';
require_once $base_path . '/classes/suggestion_source.class.php';
$sug_map = new suggestions_map();
$sug_form = "<h3>" . htmlentities($msg["empr_make_sugg"], ENT_QUOTES, $charset) . "</h3>\n";
// Contrôle des données saisies
if ($tit != "" && ($aut != "" || $edi != "" || $code != "" || $_FILES['piece_jointe_sug']['name'] != "")) {
    //Les données minimun ont été saisies
    $userid = $_SESSION["id_empr_session"];
    if (!$userid) {
        $type = '2';
        //Visiteur non authentifié
        $userid = $mail;
    } else {
        $type = '1';
        //Abonné
    }
    //On évite de saisir 2 fois la même suggestion
    if ($id_sug || !suggestions::exists($userid, $tit, $aut, $edi, $code)) {
Пример #7
0
 function edit_suggestion($session_id, $suggestion)
 {
     global $dbh, $msg;
     if (!$session_id) {
         return FALSE;
     }
     $session_info = $this->retrieve_session_information($session_id);
     $empr_id = $session_info["empr_id"];
     if (!$empr_id) {
         return 0;
     }
     $id = $suggestion['sugg_id'] + 0;
     if (!$id) {
         return FALSE;
     }
     $exists = suggestions_origine::exists($empr_id, $id, 1);
     if (!$exists) {
         return FALSE;
     }
     $title = $suggestion['sugg_title'];
     $author = $suggestion['sugg_author'];
     $editor = $suggestion['sugg_editor'];
     $isbn_or_ean = $suggestion['sugg_barcode'];
     $price = $suggestion['sugg_price'];
     $url = $suggestion['sugg_url'];
     $comment = $suggestion['sugg_comment'];
     $sugg_categ = $suggestion['sugg_category'];
     $sugg_source = $suggestion['sugg_source'];
     $sugg_location = $suggestion['sugg_location'];
     global $charset;
     if ($this->proxy_parent->input_charset != 'utf-8' && $charset == 'utf-8') {
         $title = utf8_encode($suggestion['sugg_title']);
         $author = utf8_encode($suggestion['sugg_author']);
         $editor = utf8_encode($suggestion['sugg_editor']);
         $isbn_or_ean = utf8_encode($suggestion['sugg_barcode']);
         $price = utf8_encode($suggestion['sugg_price']);
         $url = utf8_encode($suggestion['sugg_url']);
         $comment = utf8_encode($suggestion['sugg_comment']);
         $sugg_categ = utf8_encode($suggestion['sugg_category']);
         $sugg_source = utf8_encode($suggestion['sugg_source']);
         $sugg_location = utf8_encode($suggestion['sugg_location']);
     } else {
         if ($this->proxy_parent->input_charset == 'utf-8' && $charset != 'utf-8') {
             $title = utf8_decode($suggestion['sugg_title']);
             $author = utf8_decode($suggestion['sugg_author']);
             $editor = utf8_decode($suggestion['sugg_editor']);
             $isbn_or_ean = utf8_decode($suggestion['sugg_barcode']);
             $price = utf8_decode($suggestion['sugg_price']);
             $url = utf8_decode($suggestion['sugg_url']);
             $comment = utf8_decode($suggestion['sugg_comment']);
             $sugg_categ = utf8_decode($suggestion['sugg_category']);
             $sugg_source = utf8_decode($suggestion['sugg_source']);
             $sugg_location = utf8_decode($suggestion['sugg_location']);
         }
     }
     $sug_map = new suggestions_map();
     global $opac_sugg_categ, $opac_sugg_categ_default;
     //copié de /opac_css/empr/make_sugg.inc.php
     //On évite de saisir 2 fois la même suggestion
     $su = new suggestions($id);
     $su->titre = $title;
     $su->editeur = $editor;
     $su->auteur = $author;
     $su->code = $isbn_or_ean;
     $price = str_replace(',', '.', $price);
     if (is_numeric($price)) {
         $su->prix = $price;
     }
     $su->nb = 1;
     $su->statut = $sug_map->getFirstStateId();
     $su->url_suggestion = $url;
     $su->commentaires = $comment;
     $su->date_creation = today();
     $su->sugg_src = $sugg_source;
     if ($opac_sugg_categ == '1') {
         if (!suggestions_categ::exists($sugg_categ)) {
             $sugg_categ = $opac_sugg_categ_default;
         }
         if (!suggestions_categ::exists($sugg_categ)) {
             $sugg_categ = '1';
         }
         $su->num_categ = $sugg_categ;
     }
     $su->sugg_location = $sugg_location;
     $su->save();
     return true;
 }
Пример #8
0
 protected function get_user_param_form($field)
 {
     global $msg, $dbh, $charset;
     global ${$field};
     global $location_user_section;
     $field_deb = substr($field, 0, 6);
     // 		$html="
     // 		<script type='text/javascript'>
     // 			function dashboard_save_params(name,value){
     // 				var req= new http_request();
     // 				req.request('./ajax.php?module=".$this->module."&categ=dashboard&sub=save_quick_params',1,'".$field."='+value,1,dashboard_params_saved);
     // 			}
     // 		</script>";
     $html = "";
     switch ($field_deb) {
         case "deflt_":
             if ($field == "deflt_styles") {
                 $html_style = "\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t<div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class='colonne_suite'>" . make_user_style_combo(${$field}) . "\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n";
             } elseif ($field == "deflt_docs_location") {
                 //visibilité des exemplaires
                 if ($pmb_droits_explr_localises && $usr->explr_visible_mod) {
                     $where_clause_explr = "idlocation in (" . $usr->explr_visible_mod . ") and";
                 } else {
                     $where_clause_explr = "";
                 }
                 $selector = gen_liste("select distinct idlocation, location_libelle from docs_location, docsloc_section where {$where_clause_explr} num_location=idlocation order by 2 ", "idlocation", "location_libelle", 'form_' . $field, "dashboard_calcule_section(this);", ${$field}, "", "", "", "", 0);
                 $html .= "\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t<div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div class='colonne_suite'>" . $selector . "\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n";
                 //localisation de l'utilisateur pour le calcul de la section
                 $location_user_section = ${$field};
             } elseif ($field == "deflt_collstate_location") {
                 $selector = gen_liste("select distinct idlocation, location_libelle from docs_location order by 2 ", "idlocation", "location_libelle", 'form_' . $field, "", ${$field}, "", "", "0", $msg["all_location"], 0);
                 $html .= "\n\t\t\t\t\t\t<div class='row'><div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;</div>\n\n\t\t\t\t\t\t<div class='colonne_suite'>" . $selector . "</div></div>\n";
             } elseif ($field == "deflt_resas_location") {
                 $selector = gen_liste("select distinct idlocation, location_libelle from docs_location order by 2 ", "idlocation", "location_libelle", 'form_' . $field, "", ${$field}, "", "", "0", $msg["all_location"], 0);
                 $html .= "\n\t\t\t\t\t\t<div class='row'><div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;</div>\n\n\t\t\t\t\t\t<div class='colonne_suite'>" . $selector . "</div></div>\n";
             } elseif ($field == "deflt_docs_section") {
                 // calcul des sections
                 $selector = "";
                 if (!$location_user_section) {
                     $location_user_section = $deflt_docs_location;
                 }
                 if ($pmb_droits_explr_localises && $usr->explr_visible_mod) {
                     $where_clause_explr = "where idlocation in (" . $usr->explr_visible_mod . ")";
                 } else {
                     $where_clause_explr = "";
                 }
                 $rqtloc = "SELECT idlocation FROM docs_location {$where_clause_explr} order by location_libelle";
                 $resloc = mysql_query($rqtloc, $dbh);
                 while ($loc = mysql_fetch_object($resloc)) {
                     $requete = "SELECT idsection, section_libelle FROM docs_section, docsloc_section where idsection=num_section and num_location='{$loc->idlocation}' order by section_libelle";
                     $result = mysql_query($requete, $dbh);
                     $nbr_lignes = mysql_num_rows($result);
                     if ($nbr_lignes) {
                         if ($loc->idlocation == $location_user_section) {
                             $selector .= "<div id=\"dashboard_docloc_section" . $loc->idlocation . "\" style=\"display:block\">\r\n";
                         } else {
                             $selector .= "<div id=\"dashboard_docloc_section" . $loc->idlocation . "\" style=\"display:none\">\r\n";
                         }
                         $selector .= "<select name='f_ex_section" . $loc->idlocation . "' id='f_ex_section" . $loc->idlocation . "'>\r\n";
                         while ($line = mysql_fetch_row($result)) {
                             $selector .= "<option value='{$line['0']}' ";
                             $selector .= $line[0] == ${$field} ? "selected='selected' >" : '>';
                             $selector .= htmlentities($line[1], ENT_QUOTES, $charset) . '</option>\\r\\n';
                         }
                         $selector .= '</select></div>';
                     }
                 }
                 $html .= "\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t<div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div class='colonne_suite'>" . $selector . "\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n";
             } elseif ($field == "deflt_upload_repertoire") {
                 $selector = "";
                 $requpload = "select repertoire_id, repertoire_nom from upload_repertoire";
                 $resupload = mysql_query($requpload, $dbh);
                 $selector .= "<div id='upload_section'>";
                 $selector .= "<select name='form_deflt_upload_repertoire'>";
                 $selector .= "<option value='0'>" . $msg[upload_repertoire_sql] . "</option>";
                 while ($repupload = mysql_fetch_object($resupload)) {
                     $selector .= "<option value='" . $repupload->repertoire_id . "' ";
                     if (${$field} == $repupload->repertoire_id) {
                         $selector .= "selected='selected' ";
                     }
                     $selector .= ">";
                     $selector .= htmlentities($repupload->repertoire_nom, ENT_QUOTES, $charset) . "</option>";
                 }
                 $selector .= "</select></div>";
                 $html .= "\n\t\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t\t<div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class='colonne_suite'>" . $selector . "\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>";
             } elseif ($field == "deflt_import_thesaurus") {
                 $requete = "select * from thesaurus order by 2";
                 $resultat_liste = mysql_query($requete, $dbh);
                 $nb_liste = mysql_num_rows($resultat_liste);
                 if ($nb_liste == 0) {
                     $html .= "";
                 } else {
                     $html .= "\n\t\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t\t<div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t\t\t\t<select class='saisie-30em' name=\"form_" . $field . "\">";
                     $j = 0;
                     while ($j < $nb_liste) {
                         $liste_values = mysql_fetch_row($resultat_liste);
                         $html .= "<option value=\"" . $liste_values[0] . "\" ";
                         if (${$field} == $liste_values[0]) {
                             $html .= "selected='selected' ";
                         }
                         $html .= ">" . $liste_values[1] . "</option>\n";
                         $j++;
                     }
                     $html .= "</select>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n";
                 }
             } elseif ($field == "deflt_short_loan_activate") {
                 $html .= "<div class='row'><div class='colonne60'>" . $msg[$field] . "</div>\n\n\t\t\t\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t\t<input type='checkbox' class='checkbox'";
                 if (${$field} == 1) {
                     $html .= " checked";
                 }
                 $html .= " value='1' name='form_{$field}'></div></div>\n";
             } elseif ($field == "deflt_cashdesk") {
                 $requete = "select * from cashdesk order by cashdesk_name";
                 $resultat_liste = mysql_query($requete, $dbh);
                 $nb_liste = mysql_num_rows($resultat_liste);
                 if ($nb_liste == 0) {
                     $html .= "";
                 } else {
                     // 						$html.="
                     // 							<div class='row'>
                     // 								<div class='colonne60'>".$msg[$field]."&nbsp;:&nbsp;
                     // 								</div>\n
                     // 								<div class='colonne_suite'>
                     // 									<select class='saisie-30em' name=\"form_".$field."\" onchange='dashboard_save_params(this.name,this.value)'>";
                     $html .= "\n\t\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t\t<div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t\t\t\t<select class='saisie-30em' name=\"form_" . $field . "\">";
                     $j = 0;
                     while ($j < $nb_liste) {
                         $liste_values = mysql_fetch_object($resultat_liste);
                         $html .= "<option value=\"" . $liste_values->cashdesk_id . "\" ";
                         if (${$field} == $liste_values->cashdesk_id) {
                             $html .= "selected";
                         }
                         $html .= ">" . htmlentities($liste_values->cashdesk_name, ENT_QUOTES, $charset) . "</option>\n";
                         $j++;
                     }
                     $html .= "</select>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n";
                 }
             } else {
                 $deflt_table = substr($field, 6);
                 if ($deflt_table == "integration_notice_statut") {
                     $deflt_table = "notice_statut";
                 }
                 switch ($field) {
                     case "deflt_entites":
                         $requete = "select id_entite, raison_sociale from " . $deflt_table . " where type_entite='1' order by 2 ";
                         break;
                     case "deflt_exercices":
                         $requete = "select id_exercice, libelle from " . $deflt_table . " order by 2 ";
                         break;
                     case "deflt_rubriques":
                         $requete = "select id_rubrique, concat(budgets.libelle,':', rubriques.libelle) from " . $deflt_table . " join budgets on num_budget=id_budget order by 2 ";
                         break;
                     default:
                         $requete = "select * from " . $deflt_table . " order by 2";
                         break;
                 }
                 $resultat_liste = mysql_query($requete, $dbh);
                 $nb_liste = mysql_num_rows($resultat_liste);
                 if ($nb_liste == 0) {
                     $html .= "";
                 } else {
                     $html .= "\n\t\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t\t<div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t\t\t\t<select class='saisie-30em' name=\"form_" . $field . "\">";
                     $j = 0;
                     while ($j < $nb_liste) {
                         $liste_values = mysql_fetch_row($resultat_liste);
                         $html .= "<option value=\"" . $liste_values[0] . "\" ";
                         if (${$field} == $liste_values[0]) {
                             $html .= "selected='selected' ";
                         }
                         $html .= ">" . $liste_values[1] . "</option>\n";
                         $j++;
                     }
                     $html .= "</select>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n";
                 }
             }
             break;
         case "param_":
             if ($field == "param_allloc") {
                 $html = "<div class='row'><div class='colonne60'>" . $msg[$field] . "</div>\n\n\t\t\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t<input type='checkbox' class='checkbox'";
                 if (${$field} == 1) {
                     $html .= " checked";
                 }
                 $html .= " value='1' name='form_{$field}'></div></div>\n";
             } else {
                 $html .= "<div class='row'>";
                 //if (strpos($msg[$field],'<br />')) $param_user .= "<br />";
                 $html .= "<input type='checkbox' class='checkbox'";
                 if (${$field} == 1) {
                     $html .= " checked";
                 }
                 $html .= " value='1' name='form_{$field}'>\n\n\t\t\t\t\t\t{$msg[$field]}\n\t\t\t\t\t\t</div>\n";
             }
             break;
         case "value_":
             switch ($field) {
                 case "value_deflt_fonction":
                     $flist = new marc_list('function');
                     $f = $flist->table[${$field}];
                     $html .= "<div class='row'><div class='colonne60'>\n\t\t\t\t\t\t{$msg[$field]}&nbsp;:&nbsp;</div>\n\n\t\t\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t<input type='text' class='saisie-30emr' id='form_value_deflt_fonction_libelle' name='form_value_deflt_fonction_libelle' value='" . htmlentities($f, ENT_QUOTES, $charset) . "' />\n\t\t\t\t\t\t<input type='button' class='bouton_small' value='" . $msg['parcourir'] . "' onclick=\"openPopUp('./select.php?what=function&caller=userform&p1=form_value_deflt_fonction&p2=form_value_deflt_fonction_libelle', 'select_func0', 400, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" />\n\t\t\t\t\t\t<input type='button' class='bouton_small' value='X' onclick=\"this.form.elements['form_value_deflt_fonction'].value='';this.form.elements['form_value_deflt_fonction_libelle'].value='';return false;\" />\n\t\t\t\t\t\t<input type='hidden' name='form_value_deflt_fonction' id='form_value_deflt_fonction' value=\"\${$field}\" />\n\t\t\t\t\t\t</div></div><br />";
                     break;
                 case "value_deflt_lang":
                     $llist = new marc_list('lang');
                     $l = $llist->table[${$field}];
                     $html .= "<div class='row'><div class='colonne60'>\n\t\t\t\t\t\t{$msg[$field]}&nbsp;:&nbsp;</div>\n\n\t\t\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t<input type='text' class='saisie-30emr' id='form_value_deflt_lang_libelle' name='form_value_deflt_lang_libelle' value='" . htmlentities($l, ENT_QUOTES, $charset) . "' />\n\t\t\t\t\t\t<input type='button' class='bouton_small' value='" . $msg['parcourir'] . "' onclick=\"openPopUp('./select.php?what=lang&caller=userform&p1=form_value_deflt_lang&p2=form_value_deflt_lang_libelle', 'select_lang', 400, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" />\n\t\t\t\t\t\t<input type='button' class='bouton_small' value='X' onclick=\"this.form.elements['form_value_deflt_lang'].value='';this.form.elements['form_value_deflt_lang_libelle'].value='';return false;\" />\n\t\t\t\t\t\t<input type='hidden' name='form_value_deflt_lang' id='form_value_deflt_lang' value=\"\${$field}\" />\n\t\t\t\t\t\t</div></div><br />";
                     break;
                 case "value_deflt_relation":
                 case "value_deflt_relation_serial":
                 case "value_deflt_relation_bulletin":
                 case "value_deflt_relation_analysis":
                     $html .= "<div class='row'><div class='colonne60'>\n\t\t\t\t\t\t{$msg[$field]}&nbsp;:&nbsp;</div>\n\n\t\t\t\t\t\t<div class='colonne_suite'>";
                     $liste_type_relation_down = new marc_list("relationtypedown");
                     $liste_type_relation_up = new marc_list("relationtypeup");
                     $liste_type_relation_both = array();
                     foreach ($liste_type_relation_up->table as $key_up => $val_up) {
                         foreach ($liste_type_relation_down->table as $key_down => $val_down) {
                             if ($val_up == $val_down) {
                                 $liste_type_relation_both[$key_down] = $val_down;
                                 unset($liste_type_relation_down->table[$key_down]);
                                 unset($liste_type_relation_up->table[$key_up]);
                             }
                         }
                     }
                     $html .= "<select onchange='' name='form_" . $field . "' size='1'>\n\t\t\t\t\t\t<optgroup class='erreur' label='{$msg['notice_lien_montant']}'>";
                     foreach ($liste_type_relation_up->table as $key => $val) {
                         if ($key . '-up' == ${$field}) {
                             $html .= '<option  style="color:#000000" value="' . $key . '-up" selected="selected">' . $val . '</option>';
                         } else {
                             $html .= '<option  style="color:#000000" value="' . $key . '-up">' . $val . '</option>';
                         }
                     }
                     $html .= "</optgroup>\n\t\t\t\t\t\t<optgroup class='erreur' label='{$msg['notice_lien_descendant']}'>";
                     foreach ($liste_type_relation_down->table as $key => $val) {
                         if ($key . '-down' == ${$field}) {
                             $html .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
                         } else {
                             $html .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                         }
                     }
                     $html .= "</optgroup>\n\t\t\t\t\t\t<optgroup class='erreur' label='{$msg['notice_lien_symetrique']}'>";
                     foreach ($liste_type_relation_both as $key => $val) {
                         if ($key . '-down' == ${$field}) {
                             $html .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
                         } else {
                             $html .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                         }
                     }
                     $html .= "</optgroup>\n\t\t\t\t\t\t</select>";
                     $html .= "</div></div><br />";
                     break;
                 default:
                     $html .= "<div class='row'><div class='colonne60'>\n\t\t\t\t\t\t{$msg[$field]}&nbsp;:&nbsp;</div>\n\n\t\t\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t<input type='text' class='saisie-20em' name='form_{$field}' value='" . htmlentities(${$field}, ENT_QUOTES, $charset) . "' />\n\t\t\t\t\t\t</div></div><br />";
                     break;
             }
             break;
         case "deflt2":
             if ($field == "deflt2docs_location") {
                 // localisation des lecteurs
                 $deflt_table = substr($field, 6);
                 $requete = "select * from " . $deflt_table . " order by 2";
                 $resultat_liste = mysql_query($requete, $dbh);
                 $nb_liste = mysql_num_rows($resultat_liste);
                 if ($nb_liste == 0) {
                     $html .= "";
                 } else {
                     $html .= "\n\t\t\t\t\t\t\t<div class='row'><div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;</div>\n";
                     $html .= "\n\t\t\t\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t\t<select class='saisie-30em' name=\"form_" . $field . "\">";
                     $j = 0;
                     while ($j < $nb_liste) {
                         $liste_values = mysql_fetch_row($resultat_liste);
                         $html .= "<option value=\"" . $liste_values[0] . "\" ";
                         if (${$field} == $liste_values[0]) {
                             $html .= "selected='selected' ";
                         }
                         $html .= ">" . $liste_values[1] . "</option>\n";
                         $j++;
                     }
                     $html .= "</select></div></div>!!param_allloc!!<br />\n";
                 }
             } else {
                 $deflt_table = substr($field, 6);
                 $requete = "select * from " . $deflt_table . " order by 2 ";
                 $resultat_liste = mysql_query($requete, $dbh);
                 $nb_liste = mysql_numrows($resultat_liste);
                 if ($nb_liste == 0) {
                     $html .= "";
                 } else {
                     $html .= "\n\t\t\t\t\t\t\t\t<div class='row'><div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;</div>\n";
                     $html .= "\n\t\t\t\t\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t\t\t\t<select class='saisie-30em' name=\"form_" . $field . "\">";
                     $j = 0;
                     while ($j < $nb_liste) {
                         $liste_values = mysql_fetch_row($resultat_liste);
                         $html .= "<option value=\"" . $liste_values[0] . "\" ";
                         if (${$field} == $liste_values[0]) {
                             $html .= "selected='selected' ";
                         }
                         $html .= ">" . $liste_values[1] . "</option>\n";
                         $j++;
                     }
                     $html .= "</select></div></div>\n";
                 }
             }
             break;
         case "xmlta_":
             switch ($field) {
                 case "xmlta_indexation_lang":
                     $langues = new XMLlist("{$include_path}/messages/languages.xml");
                     $langues->analyser();
                     $clang = $langues->table;
                     $combo = "<select name='form_" . $field . "' id='form_" . $field . "' class='saisie-20em' >";
                     if (!${$field}) {
                         $combo .= "<option value='' selected>--</option>";
                     } else {
                         $combo .= "<option value='' >--</option>";
                     }
                     while (list($cle, $value) = each($clang)) {
                         // arabe seulement si on est en utf-8
                         if ($charset != 'utf-8' and $user_lang != 'ar' or $charset == 'utf-8') {
                             if (strcmp($cle, ${$field}) != 0) {
                                 $combo .= "<option value='{$cle}'>{$value} ({$cle})</option>";
                             } else {
                                 $combo .= "<option value='{$cle}' selected>{$value} ({$cle})</option>";
                             }
                         }
                     }
                     $combo .= "</select>";
                     $html .= "\n\t\t\t\t\t\t<div class='row'><div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;</div>\n";
                     $html .= "\n\t\t\t\t\t\t<div class='colonne_suite'>{$combo}</div></div>\n";
                     break;
                 case "xmlta_doctype_serial":
                     $html .= "\n\t\t\t\t\t\t\t<div class='row'><div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;</div>\n";
                     $html .= "\n\t\t\t\t\t\t\t<div class='colonne_suite'>";
                     $select_doc = new marc_select("doctype", "form_" . $field, ${$field}, "");
                     $html .= $select_doc->display;
                     $html .= "</div></div>\n";
                     break;
                 case "xmlta_doctype_bulletin":
                 case "xmlta_doctype_analysis":
                     $html .= "\n\t\t\t\t\t\t\t<div class='row'><div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;</div>\n";
                     $html .= "\n\t\t\t\t\t\t\t<div class='colonne_suite'>";
                     $select_doc = new marc_select("doctype", "form_" . $field, ${$field}, "", "0", $msg[$field . "_parent"]);
                     $html .= $select_doc->display;
                     $html .= "</div></div>\n";
                     break;
                 default:
                     $deflt_table = substr($field, 6);
                     $html .= "\n\t\t\t\t\t\t\t<div class='row'><div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;</div>\n";
                     $html .= "\n\t\t\t\t\t\t\t<div class='colonne_suite'>";
                     $select_doc = new marc_select("{$deflt_table}", "form_" . $field, ${$field}, "");
                     $html .= $select_doc->display;
                     $html .= "</div></div>\n";
                     break;
             }
         case "deflt3":
             $q = '';
             $t = array();
             switch ($field) {
                 case "deflt3bibli":
                     $q = "select 0,'" . addslashes($msg['deflt3none']) . "' union ";
                     $q .= "select id_entite, raison_sociale from entites where type_entite='1' order by 2 ";
                     break;
                 case "deflt3exercice":
                     $q = "select 0,'" . addslashes($msg['deflt3none']) . "' union ";
                     $q .= "select id_exercice, libelle from exercices order by 2 ";
                     break;
                 case "deflt3rubrique":
                     $q = "select 0,'" . addslashes($msg['deflt3none']) . "' union ";
                     $q .= "select id_rubrique, concat(budgets.libelle,':', rubriques.libelle) from rubriques join budgets on num_budget=id_budget order by 2 ";
                     break;
                 case "deflt3dev_statut":
                     $t = actes::getStatelist(TYP_ACT_DEV);
                     break;
                 case "deflt3cde_statut":
                     $t = actes::getStatelist(TYP_ACT_CDE);
                     break;
                 case "deflt3liv_statut":
                     $t = actes::getStatelist(TYP_ACT_LIV);
                     break;
                 case "deflt3fac_statut":
                     $t = actes::getStatelist(TYP_ACT_FAC);
                     break;
                 case "deflt3sug_statut":
                     $m = new suggestions_map();
                     $t = $m->getStateList();
                     break;
                 case 'deflt3lgstatcde':
                 case 'deflt3lgstatdev':
                     $q = lgstat::getList('QUERY');
                     break;
                 case 'deflt3receptsugstat':
                     $m = new suggestions_map();
                     $t = $m->getStateList('ORDERED', TRUE);
                     break;
             }
             if ($q) {
                 $r = mysql_query($q, $dbh);
                 $nb = mysql_num_rows($r);
                 while ($row = mysql_fetch_row($r)) {
                     $t[$row[0]] = $row[1];
                 }
             }
             if (count($t)) {
                 $html .= "<div class='row'><div class='colonne60'>" . $msg[$field] . "&nbsp;:&nbsp;</div>\n";
                 $html .= "<div class='colonne_suite'><select class='saisie-30em' name=\"form_" . $field . "\">";
                 foreach ($t as $k => $v) {
                     $html .= "<option value=\"" . $k . "\" ";
                     if (${$field} == $k) {
                         $html .= "selected='selected' ";
                     }
                     $html .= ">" . htmlentities($v, ENT_QUOTES, $charset) . "</option>\n";
                 }
                 $html .= "</select></div></div><br />\n";
             }
             break;
         case "speci_":
             $speci_func = substr($field, 6);
             eval('$speci_user.= get_' . $speci_func . '($id, $$field, $i, \'userform\');');
             break;
         case "explr_":
             ${$field} = ${$field};
             break;
         default:
             break;
     }
     switch ($field) {
         case "deflt2docs_location":
             $html = str_replace("!!param_allloc!!", self::get_user_param_form("param_allloc"), $html);
             break;
     }
     return $html;
 }
     $y_footer = '15';
 } else {
     $y_footer = $pos_footer[0];
 }
 if (!$pos_footer[1]) {
     $fs_footer = '8';
 } else {
     $fs_footer = $pos_footer[1];
 }
 //---------------------------------------------------------------------------------------------------------------------
 $taille_doc = array($largeur_page, $hauteur_page);
 $w = $largeur_page - $marge_gauche - $marge_droite;
 $ourPDF = new $fpdf($orient_page, 'mm', $taille_doc);
 $ourPDF->Open();
 $ourPDF->SetMargins($marge_gauche, $marge_haut, $marge_droite);
 $sug_map = new suggestions_map();
 //On récupère les infos de la liste de suggestions
 if (!$statut) {
     $statut = -1;
 }
 $us = stripslashes($user_input);
 $mask = $sug_map->getMask_FILED();
 if (!$user_input) {
     $q = suggestions::listSuggestions(0, $statut, $num_categ, $mask, 0, 0, $aq, '', $sugg_location_id, '', 0, $origine_id, $type_origine);
 } else {
     $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
     $q = suggestions::listSuggestions(0, $statut, $num_categ, $mask, 0, 0, $aq, '', $sugg_location_id, $user_input, 0, $origine_id, $type_origine);
 }
 $res = pmb_mysql_query($q, $dbh);
 $ourPDF->addPage();
 $ourPDF->setFont($pmb_pdf_font);
Пример #10
0
function update_cde()
{
    global $id_bibli, $id_exer, $id_cde, $num_cde, $nom_acte, $id_dev, $statut;
    global $id_fou;
    global $id_adr_liv, $id_adr_fac;
    global $comment, $comment_i, $ref, $date_pay, $num_pay, $date_liv, $devise;
    global $code, $lib, $qte, $prix, $typ, $tva, $rem, $rub, $id_sug, $id_lig, $typ_lig, $id_prod;
    global $acquisition_gestion_tva;
    global $action;
    global $force_debit;
    global $lg_statut, $comment_lg, $comment_lo;
    if (!$id_cde) {
        //Creation de commande
        $cde = new actes();
        $cde->type_acte = TYP_ACT_CDE;
        $cde->num_entite = $id_bibli;
        $cde->num_exercice = $id_exer;
        /*$num_cde=trim($num_cde);
        		if ($num_cde!='') {
        			$cde->numero=$num_cde;
        		} else {
        			$cde->calc();
        		}*/
        $cde->nom_acte = trim($nom_acte);
        if ($action == 'valid') {
            $cde->statut = STA_ACT_ENC;
        } else {
            $cde->statut = STA_ACT_AVA;
        }
        $cde->num_fournisseur = $id_fou;
        $cde->num_contact_livr = $id_adr_liv;
        $cde->num_contact_fact = $id_adr_fac;
        $cde->commentaires = trim($comment);
        $cde->commentaires_i = trim($comment_i);
        $cde->reference = trim($ref);
        $cde->date_paiement = $date_pay;
        $cde->num_paiement = trim($num_pay);
        $cde->date_ech = $date_liv;
        $cde->devise = trim($devise);
        $cde->save();
        $id_cde = $cde->id_acte;
        //creation des liens entre actes
        if ($id_dev) {
            $la = new liens_actes($id_dev, $id_cde);
        }
        //Recuperation des lignes valides
        $tab_lig = array();
        if (count($id_lig)) {
            foreach ($id_lig as $k => $v) {
                $code[$k] = trim($code[$k]);
                $lib[$k] = trim($lib[$k]);
                $comment_lg[$k] = trim($comment_lg[$k]);
                $comment_lo[$k] = trim($comment_lo[$k]);
                if ($code[$k] != '' || $lib[$k] != '') {
                    $tab_lig[$k] = $v;
                }
            }
        }
        //creation des lignes de commande
        foreach ($tab_lig as $k => $v) {
            $lig_cde = new lignes_actes();
            $lig_cde->type_ligne = $typ_lig[$k];
            $lig_cde->num_acte = $id_cde;
            $lig_cde->num_rubrique = $rub[$k];
            $lig_cde->num_produit = $id_prod[$k];
            $lig_cde->num_acquisition = $id_sug[$k];
            $lig_cde->num_type = $typ[$k];
            $lig_cde->code = trim($code[$k]);
            $lig_cde->libelle = trim($lib[$k]);
            $lig_cde->prix = $prix[$k];
            if ($acquisition_gestion_tva) {
                $lig_cde->tva = $tva[$k];
            } else {
                $lig_cde->tva = '0.00';
            }
            $lig_cde->debit_tva = $force_debit[$k];
            $lig_cde->remise = $rem[$k];
            $lig_cde->nb = round($qte[$k]);
            $lig_cde->date_ech = $date_liv;
            $lig_cde->date_cre = today();
            $lig_cde->statut = $lg_statut[$k];
            $lig_cde->commentaires_gestion = $comment_lg[$k];
            $lig_cde->commentaires_opac = $comment_lo[$k];
            $lig_cde->save();
        }
        //Mise à jour du statut des suggestions et envoi email suivi de suggestion
        $sug_map = new suggestions_map();
        $sug_map->doTransition('ORDERED', $id_sug);
    } else {
        //modification de commande
        $cde = new actes($id_cde);
        $old_statut = $statut;
        if ($old_statut != STA_ACT_ENC) {
            //Commande a valider
            /*$num_cde=trim($num_cde);
            		if ($num_cde!='') {
            			$cde->numero=$num_cde;
            		} else {
            			$cde->numero=addslashes($cde->numero);
            		}*/
            $cde->nom_acte = trim($nom_acte);
            if ($action == 'valid') {
                $cde->date_valid = date("Y-m-d");
                $cde->statut = STA_ACT_ENC;
                //Statut commande = A valider->en cours
            }
            $cde->num_fournisseur = $id_fou;
            $cde->num_contact_livr = $id_adr_liv;
            $cde->num_contact_fact = $id_adr_fac;
            $cde->commentaires = trim($comment);
            $cde->commentaires_i = trim($comment_i);
            $cde->reference = trim($ref);
            $cde->date_paiement = $date_pay;
            $cde->num_paiement = trim($num_pay);
            $cde->date_ech = $date_liv;
            $cde->devise = trim($devise);
            $cde->save();
            //Recuperation des lignes valides
            $tab_lig = array();
            if (count($id_lig)) {
                foreach ($id_lig as $k => $v) {
                    $code[$k] = trim($code[$k]);
                    $lib[$k] = trim($lib[$k]);
                    $comment_lg[$k] = trim($comment_lg[$k]);
                    $comment_lo[$k] = trim($comment_lo[$k]);
                    if ($code[$k] != '' || $lib[$k] != '') {
                        $tab_lig[$k] = $v;
                    }
                }
            }
            //maj des lignes de commande
            foreach ($tab_lig as $k => $v) {
                $lig_cde = new lignes_actes($v);
                $lig_cde->type_ligne = $typ_lig[$k];
                $lig_cde->num_acte = $id_cde;
                $lig_cde->num_rubrique = $rub[$k];
                $lig_cde->num_produit = $id_prod[$k];
                $lig_cde->num_acquisition = $id_sug[$k];
                $lig_cde->num_type = $typ[$k];
                $lig_cde->code = trim($code[$k]);
                $lig_cde->libelle = trim($lib[$k]);
                $lig_cde->prix = $prix[$k];
                if ($acquisition_gestion_tva) {
                    $lig_cde->tva = $tva[$k];
                } else {
                    $lig_cde->tva = '0.00';
                }
                $lig_cde->debit_tva = $force_debit[$k];
                $lig_cde->remise = $rem[$k];
                $lig_cde->nb = round($qte[$k]);
                $lig_cde->date_ech = $date_liv;
                $lig_cde->date_cre = today();
                $lig_cde->statut = $lg_statut[$k];
                $lig_cde->commentaires_gestion = $comment_lg[$k];
                $lig_cde->commentaires_opac = $comment_lo[$k];
                $lig_cde->save();
                if ($v == 0) {
                    $tab_lig[$k] = $lig_cde->id_ligne;
                }
            }
            //suppression des lignes non reprises
            $cde->cleanLignes($id_cde, $tab_lig);
        } else {
            //Commande validee
            $cde->numero = addslashes($cde->numero);
            $cde->commentaires = trim($comment);
            $cde->commentaires_i = addslashes($cde->commentaires_i);
            $cde->reference = trim($ref);
            $cde->date_paiement = $date_pay;
            $cde->num_paiement = trim($num_pay);
            $cde->devise = addslashes($cde->devise);
            $cde->save();
            //Recuperation des lignes
            $tab_lig = array();
            if (count($id_lig)) {
                foreach ($id_lig as $k => $v) {
                    $comment_lg[$k] = trim($comment_lg[$k]);
                    $comment_lo[$k] = trim($comment_lo[$k]);
                    $tab_lig[$k] = $v;
                }
            }
            //maj des lignes de commande
            foreach ($tab_lig as $k => $v) {
                $lig_cde = new lignes_actes($v);
                $lig_cde->code = addslashes($lig_cde->code);
                $lig_cde->libelle = addslashes($lig_cde->libelle);
                $lig_cde->statut = $lg_statut[$k];
                $lig_cde->commentaires_gestion = $comment_lg[$k];
                $lig_cde->commentaires_opac = $comment_lo[$k];
                $lig_cde->save();
            }
        }
    }
}
Пример #11
0
function update_sug()
{
    global $id_sug, $sel_sugstat;
    //Mise à jour de la suggestion
    $sug = array();
    $sug[0] = new suggestions($id_sug);
    $sug_map = new suggestions_map();
    $sug_map->doTransition($sug_map->getStateNameFromId($sel_sugstat), $sug[0], TRUE);
}
Пример #12
0
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: view_sugg.inc.php,v 1.12.4.1 2015-09-24 15:48:16 dgoron Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
// inclusion des classes de gestion des suggestions
require_once $base_path . '/classes/suggestions.class.php';
require_once $base_path . '/classes/suggestions_origine.class.php';
require_once $base_path . '/classes/suggestions_categ.class.php';
require_once $base_path . '/classes/suggestions_map.class.php';
require_once $base_path . '/classes/suggestion_source.class.php';
$sug_map = new suggestions_map();
$sug_form .= "\n<div id='view_sugg'>\n\t<h3><span>" . htmlentities($msg['empr_view_sugg'], ENT_QUOTES, $charset) . "<span></h3>\n\t<div id='empr_view-container'>\n\t<!-- affichage liste des suggestions -->\n\t<table width='100%'><tr>\n\t\t<th>" . htmlentities($msg['acquisition_sug_dat_cre'], ENT_QUOTES, $charset) . "</th>\n\t\t<th>" . htmlentities($msg['acquisition_sug_tit'], ENT_QUOTES, $charset) . "</th>\n\t\t<th>" . htmlentities($msg['acquisition_sug_edi'], ENT_QUOTES, $charset) . "</th>\n\t\t<th>" . htmlentities($msg['acquisition_sug_aut'], ENT_QUOTES, $charset) . "</th>\n\t\t<th>" . htmlentities($msg['acquisition_sug_etat'], ENT_QUOTES, $charset) . "</th>\n\t\t<th>" . htmlentities($msg['empr_sugg_datepubli'], ENT_QUOTES, $charset) . "</th>\n\t\t<th>" . htmlentities($msg['empr_sugg_src'], ENT_QUOTES, $charset) . "</th>";
if ($opac_sugg_categ == '1') {
    $sug_form .= "<th>" . htmlentities($msg['acquisition_categ'], ENT_QUOTES, $charset) . "</th>";
}
$sug_form .= "<th>" . htmlentities($msg['empr_sugg_piece_jointe'], ENT_QUOTES, $charset) . "</th>";
$sug_form .= "<th>&nbsp;</th></tr>";
$q = suggestions::listSuggestionsByOrigine($id_empr, '1');
$res = pmb_mysql_query($q, $dbh);
$nbr = pmb_mysql_num_rows($res);
if ($nbr) {
    for ($i = 0; $i < $nbr; $i++) {
        $row = pmb_mysql_fetch_object($res);
        $lib_statut = $sug_map->getHtmlComment($row->statut);
        if ($parity++ % 2) {
            $pair_impair = "even";
Пример #13
0
function update_liv()
{
    global $id_bibli, $id_cde, $id_liv, $comment, $ref;
    global $max_lig, $max_lig_liv, $id_lig, $id_prod, $code, $rec;
    global $acquisition_email_sugg;
    $tab_liv = array();
    //Tableau des lignes livrées
    //Les lignes restant à livrer sont reprises dans la tableau si la qté reçue est >0
    for ($i = 1; $i <= $max_lig; $i++) {
        if ($rec[$i]) {
            $tab_liv[$i]['id_lig'] = $id_lig[$i];
            $tab_liv[$i]['rec'] = $rec[$i];
        }
    }
    //Les quantités recues des lignes déjà livrées sont reportées dans le tableau si l'identifiant de ligne existe
    //Sinon une nouvelle ligne est créée
    for ($i; $i <= $max_lig + $max_lig_liv; $i++) {
        $deja = false;
        for ($j = 1; $j <= $max_lig; $j++) {
            //Y a-t'il une ligne deja créée
            if ($tab_liv[$j]['id_lig'] == $id_lig[$i]) {
                //Si oui, on rajoute la quantité reçue dans le tableau
                $tab_liv[$j]['rec'] = $tab_liv[$j]['rec'] + $rec[$i];
                $deja = true;
                break;
            }
        }
        if (!$deja) {
            //Sinon, on crée la ligne dans le tableau
            $tab_liv[$i]['id_lig'] = $id_lig[$i];
            $tab_liv[$i]['rec'] = $rec[$i];
        }
    }
    //Récupération de la commande
    $cde = new actes($id_cde);
    if (!$id_liv) {
        //Création du bon de livraison
        $liv = new actes();
        $liv->date_acte = today();
        $liv->type_acte = '2';
        $liv->statut = '4';
        //Statut BL = recu
        $liv->num_entite = $cde->num_entite;
        $liv->num_fournisseur = $cde->num_fournisseur;
        $liv->num_contact_livr = $cde->num_contact_livr;
        $liv->num_contact_fact = $cde->num_contact_fact;
        $liv->num_exercice = $cde->num_exercice;
        $liv->commentaires = $comment;
        $liv->reference = $ref;
        $liv->calc();
        $liv->save();
        $id_liv = $liv->id_acte;
        //création des liens entre actes
        $la = new liens_actes($id_cde, $id_liv);
    } else {
        //Modification du bon de livraison
        $liv = new actes($id_liv);
        $liv->numero = addslashes($liv->numero);
        $liv->commentaires = trim($comment);
        $liv->reference = trim($ref);
        $liv->save();
    }
    //Suppression des lignes de livraisons précédemment enregistrées
    actes::deleteLignes($id_liv);
    $sug_map = new suggestions_map();
    //Création des lignes de livraison
    foreach ($tab_liv as $key => $value) {
        $lig_cde = new lignes_actes($tab_liv[$key]['id_lig']);
        $lig_liv = new lignes_actes();
        $lig_liv->num_acte = $liv->id_acte;
        $lig_liv->lig_ref = $lig_cde->id_ligne;
        $lig_liv->num_acquisition = $lig_cde->num_acquisition;
        $lig_liv->num_rubrique = $lig_cde->num_rubrique;
        $lig_liv->num_produit = $lig_cde->num_produit;
        $lig_liv->num_type = $lig_cde->num_type;
        $lig_liv->libelle = addslashes($lig_cde->libelle);
        $lig_liv->code = addslashes($lig_cde->code);
        $lig_liv->prix = $lig_cde->prix;
        $lig_liv->tva = $lig_cde->tva;
        $lig_liv->remise = $lig_cde->remise;
        $lig_liv->nb = $tab_liv[$key]['rec'];
        $lig_liv->date_cre = today();
        $lig_liv->save();
        if ($lig_cde->num_acquisition != 0) {
            $sug = array();
            $sug[] = $lig_cde->num_acquisition;
            $sug_map->doTransition('RECEIVED', $sug);
        }
    }
    //La commande est-elle soldée
    $tab_cde = actes::getLignes($id_cde);
    $solde = true;
    while ($row_cde = mysql_fetch_object($tab_cde)) {
        if ($row_cde->type_ligne == 3) {
            // Frais, non livrables
        } else {
            $tab_liv = lignes_actes::getLivraisons($row_cde->id_ligne);
            $nb_liv = 0;
            while ($row_liv = mysql_fetch_object($tab_liv)) {
                $nb_liv = $nb_liv + $row_liv->nb;
            }
            if ($row_cde->nb > $nb_liv) {
                $solde = false;
                break;
            }
        }
    }
    if ($solde) {
        $cde->statut = $cde->statut & ~2 | 4;
        // Cde soldée >> Statut commande = en cours->soldé
    }
    $cde->update_statut();
}