예제 #1
0
function show_list_liv($id_bibli)
{
    global $msg, $charset;
    global $search_form_actes, $livlist_form;
    global $nb_per_page_acq;
    global $class_path;
    global $user_input, $statut, $page, $nbr_lignes, $tri_param, $limit_param, $last_param;
    global $tab_bib;
    //Creation selecteur etablissement
    $sel_bibli = "<select class='saisie-50em' id='id_bibli' name='id_bibli' onchange=\"submit();\" >";
    foreach ($tab_bib[0] as $k => $v) {
        $sel_bibli .= "<option value='" . $v . "' ";
        if ($v == $id_bibli) {
            $sel_bibli .= "selected='selected' ";
        }
        $sel_bibli .= ">" . htmlentities($tab_bib[1][$k], ENT_QUOTES, $charset) . "</option>";
    }
    $sel_bibli .= "</select>";
    $search_form_actes = str_replace('<!-- sel_bibli -->', $sel_bibli, $search_form_actes);
    //Creation selecteur statut
    $sel_statut = "<select class='saisie-25em' id='statut' name='statut' onchange=\"submit();\" >";
    $list_statut = actes::getStatelist(TYP_ACT_LIV);
    foreach ($list_statut as $k => $v) {
        $sel_statut .= "<option value='" . $k . "'>" . htmlentities($v, ENT_QUOTES, $charset) . "</option>";
    }
    $sel_statut .= "</select>";
    $search_form_actes = str_replace('<!-- sel_statut -->', $sel_statut, $search_form_actes);
    //Affichage form de recherche
    $titre = htmlentities($msg['recherche'] . ' : ' . $msg['acquisition_ach_liv'], ENT_QUOTES, $charset);
    $action = "./acquisition.php?categ=ach&sub=livr&action=list&user_input=";
    $search_form_actes = str_replace('!!form_title!!', $titre, $search_form_actes);
    $search_form_actes = str_replace('!!action!!', $action, $search_form_actes);
    $search_form_actes = str_replace('!!user_input!!', $user_input, $search_form_actes);
    print $search_form_actes;
    if (!$statut) {
        $statut = getSessionLivState();
        //Recuperation du statut courant
    } else {
        setSessionLivState($statut);
    }
    print "<script type='text/javascript' >document.forms['search'].elements['statut'].value = " . $statut . ";document.forms['search'].elements['user_input'].focus();\n\tdocument.forms['search'].elements['user_input'].select();</script>";
    //Prise en compte du formulaire de recherche
    // nombre de références par pages
    if ($nb_per_page_acq != "") {
        $nb_per_page = $nb_per_page_acq;
    } else {
        $nb_per_page = 10;
    }
    // traitement de la saisie utilisateur
    require_once $class_path . "/analyse_query.class.php";
    // on récupére le nombre de lignes qui vont bien
    if (!$nbr_lignes) {
        if (!$user_input) {
            $nbr_lignes = entites::getNbActes($id_bibli, TYP_ACT_LIV, $statut);
        } else {
            $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
            if ($aq->error) {
                error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message));
                exit;
            }
            $nbr_lignes = entites::getNbActes($id_bibli, TYP_ACT_LIV, $statut, $aq, $user_input);
        }
    } else {
        $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
    }
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
    if ($nbr_lignes) {
        $url_base = "{$PHP_SELF}?categ=ach&sub=livr&action=list&id_bibli={$id_bibli}&user_input=" . rawurlencode(stripslashes($user_input)) . "&statut={$statut}";
        // on lance la vraie requête
        if (!$user_input) {
            $res = entites::listActes($id_bibli, TYP_ACT_LIV, $statut, $debut, $nb_per_page);
        } else {
            $res = entites::listActes($id_bibli, TYP_ACT_LIV, $statut, $debut, $nb_per_page, $aq, $user_input);
        }
        //Affichage liste des livraisons
        $liv_list = "";
        $nbr = pmb_mysql_num_rows($res);
        $parity = 1;
        for ($i = 0; $i < $nbr; $i++) {
            $row = pmb_mysql_fetch_object($res);
            $fourn = new entites($row->num_fournisseur);
            $id_cde = liens_actes::getParent($row->id_acte);
            $cde = new actes($id_cde);
            $st = $row->statut & ~STA_ACT_ARC;
            switch ($st) {
                case STA_ACT_REC:
                    $st_liv = htmlentities($msg['acquisition_liv_rec'], ENT_QUOTES, $charset);
                    break;
                default:
                    $st_liv = '';
            }
            if (($row->statut & STA_ACT_ARC) == STA_ACT_ARC) {
                $st_liv = '<s>' . $st_liv . '</s>';
            }
            if ($parity % 2) {
                $pair_impair = "even";
            } else {
                $pair_impair = "odd";
            }
            $parity += 1;
            $tr_javascript = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='" . $pair_impair . "'\" ";
            $dn_javascript = "onmousedown=\"document.location='./acquisition.php?categ=ach&sub=livr&action=modif&id_bibli=" . $id_bibli . "&id_liv=" . $row->id_acte . "' \" ";
            $liv_list .= "<tr class='" . $pair_impair . "' " . $tr_javascript . " style='cursor: pointer' >\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . $row->numero . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . $cde->numero . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . htmlentities($fourn->raison_sociale, ENT_QUOTES, $charset) . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . formatdate($row->date_acte) . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>{$st_liv}</i></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<a href=# onclick=\"openPopUp('./pdf.php?pdfdoc=livr&id_liv=" . $row->id_acte . "' ,'print_PDF', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\" >\n\t\t\t\t\t\t\t\t<img src='./images/print.gif' border='0' align='center' alt='" . htmlentities($msg['imprimer'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['imprimer'], ENT_QUOTES, $charset) . "' />\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>";
        }
        if (!$last_param) {
            $nav_bar = aff_pagination($url_base, $nbr_lignes, $nb_per_page, $page);
        } else {
            $nav_bar = "";
        }
        $livlist_form = str_replace('<!-- liv_list -->', $liv_list, $livlist_form);
        $livlist_form = str_replace('<!-- nav_bar -->', $nav_bar, $livlist_form);
        print $livlist_form;
    } else {
        // la requête n'a produit aucun résultat
        error_message($msg['acquisition_liv_rech'], str_replace('!!liv_cle!!', stripslashes($user_input), $msg['acquisition_liv_rech_error']), 0, './categ=ach&sub=livr&action=list&id_bibli=' . $id_bibli);
    }
}
예제 #2
0
function show_dev($id_bibli, $id_dev)
{
    global $msg, $charset;
    global $modif_dev_form, $bt_enr, $bt_dup, $bt_sup, $bt_cde, $bt_imp;
    global $pmb_gestion_devise;
    global $p_user;
    global $pmb_type_audit, $bt_audit;
    //Recuperation etablissement
    $bibli = new entites($id_bibli);
    $lib_bibli = htmlentities($bibli->raison_sociale, ENT_QUOTES, $charset);
    //Prise en compte des adresses utilisateurs par défaut
    $tab1 = explode('|', $p_user->speci_coordonnees_etab);
    $tab_adr = array();
    foreach ($tab1 as $v) {
        $tab2 = explode(',', $v);
        $tab_adr[$tab2[0]]['id_adr_fac'] = $tab2[1];
        $tab_adr[$tab2[0]]['id_adr_liv'] = $tab2[2];
    }
    $def_id_adr_fac = $tab_adr[$id_bibli]['id_adr_fac'];
    $def_id_adr_liv = $tab_adr[$id_bibli]['id_adr_liv'];
    $form = $modif_dev_form;
    if (!$id_dev) {
        //nouveau devis
        $titre = htmlentities($msg['acquisition_dev_cre'], ENT_QUOTES, $charset);
        $date_cre = formatdate(today());
        //$numero = calcNumero($id_bibli, TYP_ACT_DEV);
        $statut = STA_ACT_ENC;
        $sel_statut = "<input type='hidden' id='statut' name='statut' value='" . $statut . "' />";
        $sel_statut .= htmlentities($msg['acquisition_dev_enc'], ENT_QUOTES, $charset);
        $id_fou = '0';
        $lib_fou = '';
        $id_adr_fou = '0';
        $adr_fou = '';
        if ($def_id_adr_fac) {
            $id_adr_fac = $def_id_adr_fac;
            $coord = new coordonnees($def_id_adr_fac);
        } else {
            $coord_fac = entites::get_coordonnees($id_bibli, '1');
            if (pmb_mysql_num_rows($coord_fac) != 0) {
                $coord = pmb_mysql_fetch_object($coord_fac);
                $id_adr_fac = $coord->id_contact;
            } else {
                $id_adr_fac = '0';
            }
        }
        if ($id_adr_fac) {
            if ($coord->libelle != '') {
                $adr_fac = htmlentities($coord->libelle, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->contact != '') {
                $adr_fac .= htmlentities($coord->contact, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->adr1 != '') {
                $adr_fac .= htmlentities($coord->adr1, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->adr2 != '') {
                $adr_fac .= htmlentities($coord->adr2, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->cp != '') {
                $adr_fac .= htmlentities($coord->cp, ENT_QUOTES, $charset) . ' ';
            }
            if ($coord->ville != '') {
                $adr_fac .= htmlentities($coord->ville, ENT_QUOTES, $charset);
            }
        } else {
            $adr_fac = '';
        }
        if ($def_id_adr_liv) {
            $id_adr_liv = $def_id_adr_liv;
            $coord = new coordonnees($def_id_adr_liv);
        } else {
            $coord_liv = entites::get_coordonnees($id_bibli, '2');
            if (pmb_mysql_num_rows($coord_liv) != 0) {
                $coord = pmb_mysql_fetch_object($coord_liv);
                $id_adr_liv = $coord->id_contact;
            } else {
                $id_adr_liv = '0';
            }
        }
        if ($id_adr_liv) {
            if ($coord->libelle != '') {
                $adr_liv = htmlentities($coord->libelle, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->contact != '') {
                $adr_liv .= htmlentities($coord->contact, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->adr1 != '') {
                $adr_liv .= htmlentities($coord->adr1, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->adr2 != '') {
                $adr_liv .= htmlentities($coord->adr2, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->cp != '') {
                $adr_liv .= htmlentities($coord->cp, ENT_QUOTES, $charset) . ' ';
            }
            if ($coord->ville != '') {
                $adr_liv .= htmlentities($coord->ville, ENT_QUOTES, $charset);
            }
        } else {
            $id_adr_liv = $id_adr_fac;
            $adr_liv = $adr_fac;
        }
        $comment = '';
        $comment_i = '';
        $liens_cde = '';
        $ref = '';
        $devise = $pmb_gestion_devise;
        $bt_dup = '';
        $bt_cde = '';
        $bt_imp = '';
        $bt_audit = '';
        $bt_sup = '';
        $lignes = array(0 => 0, 1 => '');
    } else {
        // modification de devis
        $dev = new actes($id_dev);
        $titre = htmlentities($msg['acquisition_dev_mod'], ENT_QUOTES, $charset);
        $date_cre = formatdate($dev->date_acte);
        $numero = htmlentities($dev->numero, ENT_QUOTES, $charset);
        $statut = $dev->statut;
        if (($statut & STA_ACT_ARC) == STA_ACT_ARC) {
            $statut = STA_ACT_ARC;
        }
        //Creation selecteur statut
        $sel_statut = "<select class='saisie-25em' id='statut' name='statut' >";
        $list_statut = actes::getStatelist(TYP_ACT_DEV, FALSE);
        foreach ($list_statut as $k => $v) {
            $sel_statut .= "<option value='" . $k . "'>" . htmlentities($v, ENT_QUOTES, $charset) . "</option>";
        }
        $sel_statut .= "</select>";
        $id_fou = $dev->num_fournisseur;
        $fou = new entites($id_fou);
        $lib_fou = htmlentities($fou->raison_sociale, ENT_QUOTES, $charset);
        $coord = entites::get_coordonnees($fou->id_entite, '1');
        if (pmb_mysql_num_rows($coord) != 0) {
            $coord = pmb_mysql_fetch_object($coord);
            $id_adr_fou = $coord->id_contact;
            if ($coord->libelle != '') {
                $adr_fou = htmlentities($coord->libelle, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->contact != '') {
                $adr_fou .= htmlentities($coord->contact, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->adr1 != '') {
                $adr_fou .= htmlentities($coord->adr1, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->adr2 != '') {
                $adr_fou .= htmlentities($coord->adr2, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->cp != '') {
                $adr_fou .= htmlentities($coord->cp, ENT_QUOTES, $charset) . ' ';
            }
            if ($coord->ville != '') {
                $adr_fou .= htmlentities($coord->ville, ENT_QUOTES, $charset);
            }
        } else {
            $id_adr_fou = '0';
            $adr_fou = '';
        }
        $id_adr_fac = $dev->num_contact_fact;
        if ($id_adr_fac) {
            $coord_fac = new coordonnees($id_adr_fac);
            if ($coord_fac->libelle != '') {
                $adr_fac = htmlentities($coord_fac->libelle, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->contact != '') {
                $adr_fac .= htmlentities($coord_fac->contact, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord_fac->adr1 != '') {
                $adr_fac .= htmlentities($coord_fac->adr1, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord_fac->adr2 != '') {
                $adr_fac .= htmlentities($coord_fac->adr2, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord_fac->cp != '') {
                $adr_fac .= htmlentities($coord_fac->cp, ENT_QUOTES, $charset) . ' ';
            }
            if ($coord_fac->ville != '') {
                $adr_fac .= htmlentities($coord_fac->ville, ENT_QUOTES, $charset);
            }
        } else {
            $id_adr_fac = '0';
            $adr_fac = '';
        }
        $id_adr_liv = $dev->num_contact_livr;
        if ($id_adr_liv) {
            $coord_liv = new coordonnees($id_adr_liv);
            if ($coord_liv->libelle != '') {
                $adr_liv = htmlentities($coord_liv->libelle, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord_liv->contact != '') {
                $adr_liv .= htmlentities($coord_liv->contact, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord_liv->adr1 != '') {
                $adr_liv .= htmlentities($coord_liv->adr1, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord_liv->adr2 != '') {
                $adr_liv .= htmlentities($coord_liv->adr2, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord_liv->cp != '') {
                $adr_liv .= htmlentities($coord_liv->cp, ENT_QUOTES, $charset) . ' ';
            }
            if ($coord_liv->ville != '') {
                $adr_liv .= htmlentities($coord_liv->ville, ENT_QUOTES, $charset);
            }
        } else {
            $id_adr_liv = '0';
            $adr_liv = '';
        }
        $comment = htmlentities($dev->commentaires, ENT_QUOTES, $charset);
        $comment_i = htmlentities($dev->commentaires_i, ENT_QUOTES, $charset);
        $tab_liens = liens_actes::getChilds($id_dev);
        $liens_cde = '';
        while ($row_liens = pmb_mysql_fetch_object($tab_liens)) {
            if ($row_liens->type_acte == TYP_ACT_CDE) {
                $liens_cde .= "<br /><a href=\"./acquisition.php?categ=ach&sub=cmde&action=modif&id_bibli=" . $id_bibli . "&id_cde=" . $row_liens->num_acte_lie . "\">" . $row_liens->numero . "</a>";
            }
        }
        $ref = htmlentities($dev->reference, ENT_QUOTES, $charset);
        $devise = htmlentities($dev->devise, ENT_QUOTES, $charset);
        if (!$pmb_type_audit) {
            $bt_audit = '';
        }
        $lignes = show_lig_dev($id_dev);
    }
    //complement formulaire
    $form = str_replace('<!-- sel_statut -->', $sel_statut, $form);
    $form = str_replace('<!-- bouton_enr -->', $bt_enr, $form);
    $form = str_replace('<!-- bouton_dup -->', $bt_dup, $form);
    $form = str_replace('<!-- bouton_cde -->', $bt_cde, $form);
    $form = str_replace('<!-- bouton_imp -->', $bt_imp, $form);
    $form = str_replace('<!-- bouton_audit -->', $bt_audit, $form);
    $form = str_replace('<!-- bouton_sup -->', $bt_sup, $form);
    $form = str_replace('!!act_nblines!!', $lignes[0], $form);
    $form = str_replace('<!-- lignes -->', $lignes[1], $form);
    //Remplissage formulaire
    $form = str_replace('!!form_title!!', $titre, $form);
    $form = str_replace('!!id_bibli!!', $id_bibli, $form);
    $form = str_replace('!!lib_bibli!!', $lib_bibli, $form);
    $form = str_replace('!!id_dev!!', $id_dev, $form);
    $form = str_replace('!!date_cre!!', $date_cre, $form);
    $form = str_replace('!!numero!!', $numero, $form);
    $form = str_replace('!!statut!!', $statut, $form);
    $form = str_replace('!!id_fou!!', $id_fou, $form);
    $form = str_replace('!!lib_fou!!', $lib_fou, $form);
    $form = str_replace('!!id_adr_fou!!', $id_adr_fou, $form);
    $form = str_replace('!!adr_fou!!', $adr_fou, $form);
    $form = str_replace('!!id_adr_liv!!', $id_adr_liv, $form);
    $form = str_replace('!!adr_liv!!', $adr_liv, $form);
    $form = str_replace('!!id_adr_fac!!', $id_adr_fac, $form);
    $form = str_replace('!!adr_fac!!', $adr_fac, $form);
    $form = str_replace('!!comment!!', $comment, $form);
    $form = str_replace('!!comment_i!!', $comment_i, $form);
    $form = str_replace('!!ref!!', $ref, $form);
    $form = str_replace('!!devise!!', $devise, $form);
    $form = str_replace('!!liens_cde!!', $liens_cde, $form);
    print $form;
}
예제 #3
0
파일: account.php 프로젝트: bouchra012/PMB
         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) {
예제 #4
0
function show_list_fac($id_bibli)
{
    global $msg, $charset;
    global $search_form_actes, $faclist_form, $faclist_bt_chk, $faclist_script;
    global $faclist_bt_pay;
    global $nb_per_page_acq, $nb_per_page;
    global $class_path;
    global $user_input, $statut, $page, $nbr_lignes, $tri_param, $limit_param, $last_param, $sortBy;
    global $tab_bib;
    //gestion du tri
    if (!isset($sortBy)) {
        if (trim($_SESSION["acquisition_fac_sort"])) {
            $sortBy = $_SESSION["acquisition_fac_sort"];
        } else {
            $sortBy = "";
        }
    } else {
        $_SESSION["acquisition_fac_sort"] = $sortBy;
    }
    //Creation selecteur etablissement
    $sel_bibli = "<select class='saisie-50em' id='id_bibli' name='id_bibli' onchange=\"submit();\" >";
    foreach ($tab_bib[0] as $k => $v) {
        $sel_bibli .= "<option value='" . $v . "' ";
        if ($v == $id_bibli) {
            $sel_bibli .= "selected='selected' ";
        }
        $sel_bibli .= ">" . htmlentities($tab_bib[1][$k], ENT_QUOTES, $charset) . "</option>";
    }
    $sel_bibli .= "</select>";
    $search_form_actes = str_replace('<!-- sel_bibli -->', $sel_bibli, $search_form_actes);
    //Creation selecteur statut
    $sel_statut = "<select class='saisie-25em' id='statut' name='statut' onchange=\"submit();\" >";
    $list_statut = actes::getStatelist(TYP_ACT_FAC);
    foreach ($list_statut as $k => $v) {
        $sel_statut .= "<option value='" . $k . "'>" . htmlentities($v, ENT_QUOTES, $charset) . "</option>";
    }
    $sel_statut .= "</select>";
    $search_form_actes = str_replace('<!-- sel_statut -->', $sel_statut, $search_form_actes);
    //Affichage form de recherche
    $titre = htmlentities($msg['recherche'] . ' : ' . $msg['acquisition_ach_fac'], ENT_QUOTES, $charset);
    $action = "./acquisition.php?categ=ach&sub=fact&action=list&user_input=";
    $search_form_actes = str_replace('!!form_title!!', $titre, $search_form_actes);
    $search_form_actes = str_replace('!!action!!', $action, $search_form_actes);
    $search_form_actes = str_replace('!!user_input!!', $user_input, $search_form_actes);
    $search_form_actes = str_replace('!!sortBy!!', $sortBy, $search_form_actes);
    print $search_form_actes;
    if (!$statut) {
        $statut = getSessionFacState();
        //Recuperation du statut courant
    } else {
        setSessionFacState($statut);
    }
    print "<script type='text/javascript' >document.forms['search'].elements['statut'].value = " . $statut . ";document.forms['search'].elements['user_input'].focus();\n\tdocument.forms['search'].elements['user_input'].select();</script>";
    //Prise en compte du formulaire de recherche
    // nombre de références par pages
    if (!isset($nb_per_page)) {
        if ($nb_per_page_acq != "") {
            $nb_per_page = $nb_per_page_acq;
        } else {
            $nb_per_page = 10;
        }
    }
    // traitement de la saisie utilisateur
    require_once $class_path . "/analyse_query.class.php";
    // on récupére le nombre de lignes qui vont bien
    if (!$nbr_lignes) {
        if (!$user_input) {
            $nbr_lignes = entites::getNbActes($id_bibli, TYP_ACT_FAC, $statut);
        } else {
            $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
            if ($aq->error) {
                error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message));
                exit;
            }
            $nbr_lignes = entites::getNbActes($id_bibli, TYP_ACT_FAC, $statut, $aq, $user_input);
        }
    } else {
        $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
    }
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
    if ($nbr_lignes) {
        $url_base = "{$PHP_SELF}?categ=ach&sub=fact&action=list&id_bibli={$id_bibli}&user_input=" . rawurlencode(stripslashes($user_input)) . "&statut={$statut}&sortBy={$sortBy}";
        // on lance la vraie requête
        if (!$user_input) {
            $res = entites::listActes($id_bibli, TYP_ACT_FAC, $statut, $debut, $nb_per_page, 0, '', $sortBy);
        } else {
            $res = entites::listActes($id_bibli, TYP_ACT_FAC, $statut, $debut, $nb_per_page, $aq, $user_input, $sortBy);
        }
        //Affichage liste des factures
        $fac_list = "";
        $nbr = pmb_mysql_num_rows($res);
        $parity = 1;
        for ($i = 0; $i < $nbr; $i++) {
            $row = pmb_mysql_fetch_object($res);
            $st = $row->statut & ~STA_ACT_ARC;
            switch ($st) {
                case STA_ACT_REC:
                    $st_fac = htmlentities($msg['acquisition_fac_rec'], ENT_QUOTES, $charset);
                    break;
                case STA_ACT_PAY:
                    $st_fac = htmlentities($msg['acquisition_fac_pay'], ENT_QUOTES, $charset);
                    break;
                default:
                    $st_fac = '';
            }
            if (($row->statut & STA_ACT_ARC) == STA_ACT_ARC) {
                $st_fac = '<s>' . $st_fac . '</s>';
            }
            if ($parity % 2) {
                $pair_impair = "even";
            } else {
                $pair_impair = "odd";
            }
            $parity += 1;
            $tr_javascript = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='" . $pair_impair . "'\" ";
            $dn_javascript = "onmousedown=\"document.location='./acquisition.php?categ=ach&sub=fact&action=modif&id_bibli=" . $id_bibli . "&id_fac=" . $row->id_acte . "' \" ";
            $fac_list .= "<tr class='" . $pair_impair . "' " . $tr_javascript . " style='cursor: pointer' >\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . $row->numero . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . $row->num_acte_parent . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . htmlentities($row->raison_sociale, ENT_QUOTES, $charset) . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . formatdate($row->date_acte) . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>{$st_fac}</i></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<a href=# onclick=\"openPopUp('./pdf.php?pdfdoc=fact&id_fac=" . $row->id_acte . "' ,'print_PDF', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\" >\n\t\t\t\t\t\t\t\t<img src='./images/print.gif' border='0' align='center' alt='" . htmlentities($msg['imprimer'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['imprimer'], ENT_QUOTES, $charset) . "' />\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</td>";
            if ($statut == STA_ACT_REC) {
                $fac_list .= "<td><input type='checkbox' name='chk[]' id='chk[" . $row->id_acte . "]' value='" . $row->id_acte . "'/></td>";
            }
            $fac_list .= "</tr>";
        }
        if (!$last_param) {
            $nav_bar = aff_pagination($url_base, $nbr_lignes, $nb_per_page, $page, 10, true, true);
        } else {
            $nav_bar = "";
        }
        $fieldList = array("1" => "numero", "2" => "num_acte_parent", "3" => "raison_sociale", "4" => "date_acte");
        foreach ($fieldList as $k => $field) {
            if ($sortBy == $field) {
                $faclist_form = str_replace('!!sortBy_' . $k . '_1!!', "-" . $field, $faclist_form);
                $faclist_form = str_replace('!!sortBy_' . $k . '_2!!', "&nbsp;&#x25B4;", $faclist_form);
            } elseif ($sortBy == "-" . $field) {
                $faclist_form = str_replace('!!sortBy_' . $k . '_1!!', $field, $faclist_form);
                $faclist_form = str_replace('!!sortBy_' . $k . '_2!!', "&nbsp;&#x25BE;", $faclist_form);
            } else {
                $faclist_form = str_replace('!!sortBy_' . $k . '_1!!', $field, $faclist_form);
                $faclist_form = str_replace('!!sortBy_' . $k . '_2!!', "", $faclist_form);
            }
        }
        $faclist_form = str_replace('<!-- fac_list -->', $fac_list, $faclist_form);
        $faclist_form = str_replace('<!-- nav_bar -->', $nav_bar, $faclist_form);
        $bt_list = '';
        $bt_sup = '';
        if ($statut == STA_ACT_REC) {
            //colonne chk
            $faclist_form = str_replace("<!-- chk_th -->", "<th class='act_cell_chkbox'>&nbsp;</th>", $faclist_form);
            //Bouton Sélectionner
            $faclist_form = str_replace('<!-- bt_chk -->', $faclist_bt_chk, $faclist_form);
            //JavaScript
            $faclist_form = str_replace('<!-- script -->', $faclist_script, $faclist_form);
            //bouton payer
            $bt_list = $faclist_bt_pay;
        }
        $faclist_form = str_replace('<!-- bt_list -->', $bt_list, $faclist_form);
        $faclist_form = str_replace('<!-- bt_sup -->', $bt_sup, $faclist_form);
        print $faclist_form;
    } else {
        // la requête n'a produit aucun résultat
        error_message($msg['acquisition_fac_rech'], str_replace('!!fac_cle!!', stripslashes($user_input), $msg['acquisition_fac_rech_error']), 0, './categ=ach&sub=fact&action=list&id_bibli=' . $id_bibli);
    }
}
예제 #5
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;
 }
예제 #6
0
function show_list_cde($id_bibli)
{
    global $msg, $charset;
    global $search_form_actes, $cdelist_form, $cdelist_bt_chk, $cdelist_script;
    global $cdelist_bt_valid, $cdelist_bt_delete, $cdelist_bt_sold, $cdelist_bt_arc;
    global $nb_per_page_acq, $nb_per_page;
    global $class_path;
    global $user_input, $statut, $page, $nbr_lignes, $last_param, $sortBy;
    global $tab_bib;
    global $acquisition_pdfcde_by_mail;
    if (!isset($sortBy)) {
        if (trim($_SESSION["acquisition_cde_sort"])) {
            $sortBy = $_SESSION["acquisition_cde_sort"];
        } else {
            $sortBy = "";
        }
    } else {
        $_SESSION["acquisition_cde_sort"] = $sortBy;
    }
    $bib = new entites($id_bibli);
    $bib_coord = pmb_mysql_fetch_object(entites::get_coordonnees($id_bibli, 1));
    //Creation selecteur etablissement
    $sel_bibli = "<select class='saisie-50em' id='id_bibli' name='id_bibli' onchange=\"submit();\" >";
    foreach ($tab_bib[0] as $k => $v) {
        $sel_bibli .= "<option value='" . $v . "' ";
        if ($v == $id_bibli) {
            $sel_bibli .= "selected='selected' ";
        }
        $sel_bibli .= ">" . htmlentities($tab_bib[1][$k], ENT_QUOTES, $charset) . "</option>";
    }
    $sel_bibli .= "</select>";
    $search_form_actes = str_replace('<!-- sel_bibli -->', $sel_bibli, $search_form_actes);
    //Creation selecteur statut
    $sel_statut = "<select class='saisie-25em' id='statut' name='statut' onchange=\"submit();\" >";
    $list_statut = actes::getStatelist(TYP_ACT_CDE);
    foreach ($list_statut as $k => $v) {
        $sel_statut .= "<option value='" . $k . "'>" . htmlentities($v, ENT_QUOTES, $charset) . "</option>";
    }
    $sel_statut .= "</select>";
    $search_form_actes = str_replace('<!-- sel_statut -->', $sel_statut, $search_form_actes);
    //Affichage form de recherche
    $titre = htmlentities($msg['recherche'] . ' : ' . $msg['acquisition_ach_cde'], ENT_QUOTES, $charset);
    $action = "./acquisition.php?categ=ach&sub=cmde&action=list&user_input=";
    $bouton_add = "<input class='bouton' type='button' value='" . $msg['acquisition_ajout_cde'] . "' onclick=\"document.location='./acquisition.php?categ=ach&sub=cmde&action=modif&id_bibli=" . $id_bibli . "&id_cde=0';\" />";
    $search_form_actes = str_replace('!!form_title!!', $titre, $search_form_actes);
    $search_form_actes = str_replace('!!action!!', $action, $search_form_actes);
    $search_form_actes = str_replace('<!-- bouton_add -->', $bouton_add, $search_form_actes);
    $search_form_actes = str_replace('!!user_input!!', $user_input, $search_form_actes);
    $search_form_actes = str_replace('!!sortBy!!', $sortBy, $search_form_actes);
    print $search_form_actes;
    if (!$statut) {
        $statut = getSessionCdeState();
        //Recuperation du statut courant
    } else {
        setSessionCdeState($statut);
    }
    print "<script type='text/javascript' >document.forms['search'].elements['statut'].value = '" . $statut . "';document.forms['search'].elements['user_input'].focus();\n\tdocument.forms['search'].elements['user_input'].select();</script>";
    //Prise en compte du formulaire de recherche
    // nombre de références par pages
    if (!isset($nb_per_page)) {
        if ($nb_per_page_acq != "") {
            $nb_per_page = $nb_per_page_acq;
        } else {
            $nb_per_page = 10;
        }
    }
    // traitement de la saisie utilisateur
    require_once $class_path . "/analyse_query.class.php";
    // comptage
    if (!$nbr_lignes) {
        if (!$user_input) {
            $nbr_lignes = entites::getNbActes($id_bibli, TYP_ACT_CDE, $statut);
        } else {
            $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
            if ($aq->error) {
                error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message));
                exit;
            }
            $nbr_lignes = entites::getNbActes($id_bibli, TYP_ACT_CDE, $statut, $aq, $user_input);
        }
    } else {
        $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
    }
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
    if ($nbr_lignes) {
        $url_base = "{$PHP_SELF}?categ=ach&sub=cmde&action=list&id_bibli={$id_bibli}&user_input=" . rawurlencode(stripslashes($user_input)) . "&statut={$statut}&sortBy={$sortBy}";
        // liste
        if (!$user_input) {
            $res = entites::listActes($id_bibli, TYP_ACT_CDE, $statut, $debut, $nb_per_page, 0, '', $sortBy);
        } else {
            $res = entites::listActes($id_bibli, TYP_ACT_CDE, $statut, $debut, $nb_per_page, $aq, $user_input, $sortBy);
        }
        //Affichage liste des commandes
        $cde_list = "";
        $nbr = pmb_mysql_num_rows($res);
        $parity = 1;
        for ($i = 0; $i < $nbr; $i++) {
            $row = pmb_mysql_fetch_object($res);
            //TODO A modifier si une seule date de livraison par acte
            $dateech = $row->date_ech_calc;
            if ($dateech != '00000000') {
                $dateech = formatdate($dateech);
            } else {
                $dateech = '';
            }
            $st = $row->statut & ~(STA_ACT_FAC | STA_ACT_PAY | STA_ACT_ARC);
            switch ($st) {
                case STA_ACT_AVA:
                    $st_cde = htmlentities($msg['acquisition_cde_aval'], ENT_QUOTES, $charset);
                    break;
                case STA_ACT_ENC:
                    $st_cde = htmlentities($msg['acquisition_cde_enc'], ENT_QUOTES, $charset);
                    break;
                case STA_ACT_REC:
                    $st_cde = htmlentities($msg['acquisition_cde_liv'], ENT_QUOTES, $charset);
                    break;
                default:
                    $st_cde = htmlentities($msg['acquisition_cde_enc'], ENT_QUOTES, $charset);
            }
            if (($row->statut & STA_ACT_PAY) == STA_ACT_PAY) {
                $st_fac = htmlentities($msg['acquisition_act_pay'], ENT_QUOTES, $charset);
            } elseif (($row->statut & STA_ACT_FAC) == STA_ACT_FAC) {
                $st_fac = htmlentities($msg['acquisition_act_fac'], ENT_QUOTES, $charset);
            } else {
                $st_fac = '';
            }
            if ($st_fac) {
                $st_cde .= '&nbsp;/&nbsp;' . $st_fac;
            }
            if (($row->statut & STA_ACT_ARC) == STA_ACT_ARC) {
                $st_cde = '<s>' . $st_cde . '</s>';
            }
            if ($parity % 2) {
                $pair_impair = "even";
            } else {
                $pair_impair = "odd";
            }
            $parity += 1;
            $tr_javascript = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='" . $pair_impair . "'\" ";
            $dn_javascript = "onmousedown=\"document.location='./acquisition.php?categ=ach&sub=cmde&action=modif&id_bibli=" . $id_bibli . "&id_cde=" . $row->id_acte . "' \" ";
            $cde_list .= "<tr class='" . $pair_impair . "' " . $tr_javascript . " style='cursor: pointer' >\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . $row->numero . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . htmlentities($row->raison_sociale, ENT_QUOTES, $charset) . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . formatdate($row->date_acte) . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . $dateech . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>{$st_cde}</i></td>\n\t\t\t\t\t\t<td >\n\t\t\t\t\t\t\t<a href=# onclick=\"document.location='./acquisition.php?categ=ach&sub=cmde&action=print&id_bibli=" . $id_bibli . "&id_cde=" . $row->id_acte . "&page=" . $page . "&by_mail=0'\" >\n\t\t\t\t\t\t\t\t<img src='./images/print.gif' border='0' align='center' alt='" . htmlentities($msg['imprimer'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['imprimer'], ENT_QUOTES, $charset) . "' />\n\t\t\t\t\t\t\t</a>";
            if (($row->statut & ~STA_ACT_ARC) == STA_ACT_ENC && $acquisition_pdfcde_by_mail && strpos($bib_coord->email, '@')) {
                $cde_list .= "\t\t\t\n\t\t\t\t\t\t\t<a href=# onclick=\"document.location='./acquisition.php?categ=ach&sub=cmde&action=print&id_bibli=" . $id_bibli . "&id_cde=" . $row->id_acte . "&page=" . $page . "&by_mail=1'\" >\n\t\t\t\t\t\t\t\t<img src='./images/mail.png' border='0' align='center' alt='" . htmlentities($msg['58'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['58'], ENT_QUOTES, $charset) . "' />\n\t\t\t\t\t\t\t</a>";
            }
            $cde_list .= "</td>";
            if ($statut != STA_ACT_ALL && $statut != STA_ACT_ARC) {
                $cde_list .= "<td><input type='checkbox' name='chk[]' id='chk[" . $row->id_acte . "]' value='" . $row->id_acte . "'/></td>";
            }
            $cde_list .= "</tr>";
        }
        if (!$last_param) {
            $nav_bar = aff_pagination($url_base, $nbr_lignes, $nb_per_page, $page, 10, true, true);
        } else {
            $nav_bar = "";
        }
        $fieldList = array("1" => "numero", "2" => "raison_sociale", "3" => "date_acte", "4" => "date_ech_calc");
        foreach ($fieldList as $k => $field) {
            if ($sortBy == $field) {
                $cdelist_form = str_replace('!!sortBy_' . $k . '_1!!', "-" . $field, $cdelist_form);
                $cdelist_form = str_replace('!!sortBy_' . $k . '_2!!', "&nbsp;&#x25B4;", $cdelist_form);
            } elseif ($sortBy == "-" . $field) {
                $cdelist_form = str_replace('!!sortBy_' . $k . '_1!!', $field, $cdelist_form);
                $cdelist_form = str_replace('!!sortBy_' . $k . '_2!!', "&nbsp;&#x25BE;", $cdelist_form);
            } else {
                $cdelist_form = str_replace('!!sortBy_' . $k . '_1!!', $field, $cdelist_form);
                $cdelist_form = str_replace('!!sortBy_' . $k . '_2!!', "", $cdelist_form);
            }
        }
        $cdelist_form = str_replace('<!-- cde_list -->', $cde_list, $cdelist_form);
        $cdelist_form = str_replace('<!-- nav_bar -->', $nav_bar, $cdelist_form);
        if ($statut != STA_ACT_ALL && $statut != STA_ACT_ARC) {
            //colonne chk
            $cdelist_form = str_replace("<!-- chk_th -->", "<th class='act_cell_chkbox'>&nbsp;</th>", $cdelist_form);
            //Bouton Sélectionner
            $cdelist_form = str_replace('<!-- bt_chk -->', $cdelist_bt_chk, $cdelist_form);
            //JavaScript
            $cdelist_form = str_replace('<!-- script -->', $cdelist_script, $cdelist_form);
        }
        $bt_list = '';
        $bt_sup = '';
        switch ($statut) {
            case STA_ACT_AVA:
                $bt_list = $cdelist_bt_valid;
                $bt_sup = $cdelist_bt_delete;
                break;
            case STA_ACT_ENC:
                $bt_list = $cdelist_bt_sold;
                break;
            case STA_ACT_REC:
                $bt_list = $cdelist_bt_arc;
                break;
            default:
                break;
        }
        $cdelist_form = str_replace('<!-- bt_list -->', $bt_list, $cdelist_form);
        $cdelist_form = str_replace('<!-- bt_sup -->', $bt_sup, $cdelist_form);
        print $cdelist_form;
    } else {
        // la requête n'a produit aucun résultat
        error_message($msg['acquisition_cde_rech'], str_replace('!!cde_cle!!', stripslashes($user_input), $msg['acquisition_cde_rech_error']), 0, './categ=ach&sub=cmde&action=list&id_bibli=' . $id_bibli);
    }
}