示例#1
0
function show_budg_form($id_bibli, $id_bud = 0)
{
    global $dbh, $msg, $charset;
    global $budg_form, $bt_add_lig;
    global $ptab;
    global $lig_rub, $lig_rub_img;
    global $mnt_form, $sel_typ_form;
    //Récuperation du budget
    if ($id_bud) {
        $bud = new budgets($id_bud);
    }
    //Affichage exercices actifs
    $q = exercices::listByEntite($id_bibli, STA_EXE_ACT, 'statut desc, date_debut desc');
    $res = mysql_query($q, $dbh);
    if (!$id_bud) {
        //Nouveau budget ->choix exercice possible & choix type possible (affectation globale ou par lignes)
        $form_exer = "<select id='exer' name ='exer' >";
        while ($row = mysql_fetch_object($res)) {
            $form_exer .= "<option value='" . $row->id_exercice . "' >" . $row->libelle . "</option>";
        }
        $form_exer .= "</select>";
        $mnt = $mnt_form[0];
        $sel_typ = $sel_typ_form;
        $bouton_dup = "";
    } else {
        //Modification
        if ($bud->statut == STA_BUD_PRE || $bud->statut == STA_BUD_VAL && !budgets::hasLignes($id_bud)) {
            //Exercice modifiable si budget non activé ou pas de lignes d'actes affectées
            $form_exer = "<select id='exer' name ='exer' >";
            while ($row = mysql_fetch_object($res)) {
                $form_exer .= "<option value='" . $row->id_exercice . "' ";
                if ($bud->num_exercice == $row->id_exercice) {
                    $form_exer .= "selected='selected' ";
                }
                $form_exer .= ">" . $row->libelle . "</option>";
            }
            $form_exer .= "</select>";
        } else {
            // Exercice non modifiable si budget activé et non vide ou cloturé
            $exer = new exercices($bud->num_exercice);
            $form_exer = "<input type='hidden' id='exer' name='exer' value='" . $exer->id_exercice . "' />" . htmlentities($exer->libelle, ENT_QUOTES, $charset);
        }
        if ($bud->type_budget == TYP_BUD_RUB) {
            $mnt = $bud->montant_global;
        } else {
            $mnt = str_replace('!!mnt_bud!!', $bud->montant_global, $mnt_form[1]);
        }
        if (!$bud->type_budget) {
            $sel_typ = htmlentities($msg['acquisition_budg_aff_rub'], ENT_QUOTES, $charset);
        } else {
            $sel_typ = htmlentities($msg['acquisition_budg_aff_glo'], ENT_QUOTES, $charset);
        }
        $bouton_dup = $ptab[5];
    }
    //Affichage entete formulaire
    if (!$id_bud) {
        $budg_form = str_replace('!!form_title!!', htmlentities($msg[acquisition_ajout_budg], ENT_QUOTES, $charset), $budg_form);
        $budg_form = str_replace('!!libelle!!', '', $budg_form);
        $budg_form = str_replace('!!seuil!!', '100', $budg_form);
        $budg_form = str_replace('!!comment!!', '', $budg_form);
        $budg_form = str_replace('!!statut!!', htmlentities($msg[acquisition_budg_pre], ENT_QUOTES, $charset), $budg_form);
        $budg_form = str_replace('!!val_statut!!', '0', $budg_form);
    } else {
        $budg_form = str_replace('!!form_title!!', htmlentities($msg[acquisition_modif_budg], ENT_QUOTES, $charset), $budg_form);
        $budg_form = str_replace('!!libelle!!', htmlentities($bud->libelle, ENT_QUOTES, $charset), $budg_form);
        $budg_form = str_replace('!!seuil!!', $bud->seuil_alerte, $budg_form);
        $budg_form = str_replace('!!comment!!', htmlentities($bud->commentaires, ENT_QUOTES, $charset), $budg_form);
        switch ($bud->statut) {
            case STA_BUD_PRE:
                $budg_form = str_replace('!!statut!!', htmlentities($msg[acquisition_budg_pre], ENT_QUOTES, $charset), $budg_form);
                //Affichage du bouton d'activation
                $budg_form = str_replace('<!-- bouton_act -->', $ptab[2], $budg_form);
                break;
            case STA_BUD_VAL:
                $budg_form = str_replace('!!statut!!', htmlentities($msg[acquisition_statut_actif], ENT_QUOTES, $charset), $budg_form);
                //Affichage du bouton de cloture
                $budg_form = str_replace('<!-- bouton_clot -->', $ptab[0], $budg_form);
                break;
            case STA_BUD_CLO:
                $budg_form = str_replace('!!statut!!', htmlentities($msg[acquisition_statut_clot], ENT_QUOTES, $charset), $budg_form);
                break;
            default:
                $budg_form = str_replace('!!statut!!', htmlentities($msg[acquisition_budg_pre], ENT_QUOTES, $charset), $budg_form);
                //Affichage du bouton d'activation
                $budg_form = str_replace('<!-- bouton_act -->', $ptab[2], $budg_form);
                break;
        }
        $budg_form = str_replace('!!val_statut!!', $bud->statut, $budg_form);
        $budg_form = str_replace('<!-- bouton_sup -->', $ptab[1], $budg_form);
    }
    $budg_form = str_replace('!!montant!!', $mnt, $budg_form);
    $budg_form = str_replace('!!sel_typ!!', $sel_typ, $budg_form);
    $budg_form = str_replace('!!id!!', $id_bud, $budg_form);
    $budg_form = str_replace('!!libelle_suppr!!', addslashes($bud->libelle), $budg_form);
    $budg_form = str_replace('!!id_parent!!', 0, $budg_form);
    //Affichage rubriques budgetaires
    if (!$id_bud) {
        $budg_form = str_replace('!!lib_mnt!!', htmlentities($msg['acquisition_rub_mnt'], ENT_QUOTES, $charset), $budg_form);
        $budg_form = str_replace('<!-- rubriques -->', '', $budg_form);
    } else {
        if ($bud->type_budget == TYP_BUD_RUB) {
            $budg_form = str_replace('!!lib_mnt!!', htmlentities($msg['acquisition_rub_mnt'], ENT_QUOTES, $charset), $budg_form);
        } else {
            $budg_form = str_replace('!!lib_mnt!!', '&nbsp;', $budg_form);
        }
        $q = budgets::listRubriques($id_bud);
        $list_n1 = mysql_query($q, $dbh);
        while ($row = mysql_fetch_object($list_n1)) {
            $budg_form = str_replace('<!-- rubriques -->', $lig_rub[0] . '<!-- rubriques -->', $budg_form);
            $budg_form = str_replace('<!-- marge -->', '', $budg_form);
            if (rubriques::countChilds($row->id_rubrique)) {
                $budg_form = str_replace('<!-- img_plus -->', $lig_rub_img, $budg_form);
            } else {
                $budg_form = str_replace('<!-- img_plus -->', '', $budg_form);
            }
            $budg_form = str_replace('!!id_rub!!', $row->id_rubrique, $budg_form);
            $budg_form = str_replace('!!id_parent!!', $row->num_parent, $budg_form);
            $budg_form = str_replace('!!lib_rub!!', $row->libelle, $budg_form);
            if ($bud->type_budget == TYP_BUD_RUB) {
                $budg_form = str_replace('!!lib_mnt!!', htmlentities($msg['acquisition_rub_mnt'], ENT_QUOTES, $charset), $budg_form);
                $budg_form = str_replace('!!mnt!!', $row->montant, $budg_form);
            } else {
                $budg_form = str_replace('!!lib_mnt!!', '&nbsp;', $budg_form);
                $budg_form = str_replace('!!mnt!!', '&nbsp', $budg_form);
            }
            $budg_form = str_replace('!!ncp!!', $row->num_cp_compta, $budg_form);
            $budg_form = str_replace('<!-- sous_rub -->', '<!-- sous_rub' . $row->id_rubrique . ' -->', $budg_form);
            afficheSousRubriques($id_bud, $row->id_rubrique, $budg_form, 1);
        }
        if ($bud->statut != STA_BUD_CLO) {
            $budg_form = str_replace('<!-- bouton_lig -->', $bt_add_lig, $budg_form);
        }
    }
    $biblio = new entites($id_bibli);
    print "<div class='row'><label class='etiquette'>" . htmlentities($biblio->raison_sociale, ENT_QUOTES, $charset) . "</label></div>";
    $budg_form = str_replace('<!-- bouton_dup -->', $bouton_dup, $budg_form);
    $budg_form = str_replace('!!exer!!', $form_exer, $budg_form);
    $budg_form = str_replace('!!id_bibli!!', $id_bibli, $budg_form);
    $budg_form = str_replace('!!id_bud!!', $id_bud, $budg_form);
    $budg_form = str_replace('!!id_rub!!', 0, $budg_form);
    $budg_form = str_replace('!!id_parent!!', 0, $budg_form);
    print $budg_form;
    print confirmation_delete("./admin.php?categ=acquisition&sub=budget&action=del&id_bibli=" . $id_bibli . "&id_bud=");
}
function show_exer_form($id_entite, $id_exer = 0)
{
    global $msg;
    global $charset;
    global $exer_form, $date_deb_mod, $date_fin_mod;
    global $ptab;
    $exer_form = str_replace('!!id_entite!!', $id_entite, $exer_form);
    $exer_form = str_replace('!!id_exer!!', $id_exer, $exer_form);
    if (!$id_exer) {
        $exer_form = str_replace('!!form_title!!', htmlentities($msg[acquisition_ajout_exer], ENT_QUOTES, $charset), $exer_form);
        $exer_form = str_replace('!!libelle!!', '', $exer_form);
        $exer_form = str_replace('!!date_deb!!', $date_deb_mod, $exer_form);
        $exer_form = str_replace('!!date_deb!!', '', $exer_form);
        $exer_form = str_replace('!!date_fin!!', $date_fin_mod, $exer_form);
        $exer_form = str_replace('!!date_fin!!', '', $exer_form);
        $exer_form = str_replace('!!statut!!', htmlentities($msg[acquisition_statut_actif], ENT_QUOTES, $charset), $exer_form);
    } else {
        $exer = new exercices($id_exer);
        $exer_form = str_replace('!!form_title!!', htmlentities($msg[acquisition_modif_exer], ENT_QUOTES, $charset), $exer_form);
        $exer_form = str_replace('!!libelle!!', htmlentities($exer->libelle, ENT_QUOTES, $charset), $exer_form);
        if (exercices::hasBudgets($id_exer) || exercices::hasActes($id_exer)) {
            $exer_form = str_replace('!!date_deb!!', formatdate($exer->date_debut), $exer_form);
            $exer_form = str_replace('!!date_fin!!', formatdate($exer->date_fin), $exer_form);
        } else {
            $exer_form = str_replace('!!date_deb!!', $date_deb_mod, $exer_form);
            $exer_form = str_replace('!!date_deb!!', formatdate($exer->date_debut), $exer_form);
            $exer_form = str_replace('!!date_fin!!', $date_fin_mod, $exer_form);
            $exer_form = str_replace('!!date_fin!!', formatdate($exer->date_fin), $exer_form);
        }
        switch ($exer->statut) {
            case STA_EXE_CLO:
                $ms = $msg['acquisition_statut_clot'];
                $aff_bt_def = FALSE;
                break;
            case STA_EXE_DEF:
                $ms = $msg['acquisition_statut_def'];
                $aff_bt_def = FALSE;
                break;
            default:
                $ms = $msg['acquisition_statut_actif'];
                $aff_bt_def = TRUE;
                break;
        }
        $exer_form = str_replace('!!statut!!', htmlentities($ms, ENT_QUOTES, $charset), $exer_form);
        if ($aff_bt_def) {
            $exer_form = str_replace('<!-- case_def -->', $ptab[2], $exer_form);
        } else {
            $exer_form = str_replace('<!-- case_def -->', '', $exer_form);
        }
        $ptab = str_replace('!!id!!', $id_exer, $ptab);
        $ptab = str_replace('!!libelle_suppr!!', addslashes($exer->libelle), $ptab);
        //Affichage du bouton de cloture
        if ($exer->statut != STA_EXE_CLO) {
            $exer_form = str_replace('<!-- bouton_clot -->', $ptab[0], $exer_form);
        }
        $exer_form = str_replace('<!-- bouton_sup -->', $ptab[1], $exer_form);
    }
    print confirmation_suppression("./admin.php?categ=acquisition&sub=compta&action=del&ent=" . $id_entite . "&id=");
    print confirmation_cloture("./admin.php?categ=acquisition&sub=compta&action=clot&ent=" . $id_entite . "&id=");
    $biblio = new entites($id_entite);
    print "<div class='row'><label class='etiquette'>" . htmlentities($biblio->raison_sociale, ENT_QUOTES, $charset) . "</label></div>";
    print $exer_form;
}
示例#3
0
function show_list_recept()
{
    global $msg, $charset, $dbh, $tab_bib;
    global $recept_search_form, $recept_list_form, $recept_search_form_suite, $recept_hrow_form, $recept_row_form, $sel_fou_form, $sel_dem_form, $sel_rub_form, $sel_date_form;
    global $bt_app, $bt_rel, $bt_chk, $link_not, $link_bull, $link_art, $link_sug, $bt_cat;
    global $user_userid;
    global $lgstat_filter, $deflt3lgstatcde;
    global $id_bibli, $id_exer;
    global $f_fou_code, $f_dem_code, $t_dem, $f_rub_code;
    global $cde_query, $all_query, $recept_query;
    global $chk_dev;
    global $lgstat_all, $comment_lg_all, $comment_lo_all;
    global $page, $nb_per_page, $nbr_lignes, $last_param;
    global $date_inf, $date_sup;
    //verifications
    if (!$id_bibli) {
        $id_bibli = entites::getSessionBibliID();
    }
    if (!$id_bibli) {
        $id_bibli = $tab_bib[0][0];
    }
    entites::setSessionBibliId($id_bibli);
    $id_exer = exercices::getSessionExerciceId($id_bibli, $id_exer);
    //Affichage form de recherche
    $titre = htmlentities($msg['recherche'] . ' : ' . $msg['acquisition_recept'], ENT_QUOTES, $charset);
    $recept_form = $recept_search_form;
    $recept_form = str_replace('!!form_title!!', $titre, $recept_form);
    $serialized_search = rawurlencode(serialize(array('id_bibli' => $id_bibli, 'id_exer' => $id_exer, 'f_fou_code' => $f_fou_code, 'f_dem_code' => $f_dem_code, 't_dem' => $t_dem, 'f_rub_code' => $f_rub_code, 'cde_query' => stripslashes($cde_query), 'all_query' => stripslashes($all_query), 'chk_dev' => $chk_dev, 'lgstat_filter' => $lgstat_filter)));
    $recept_form = str_replace('!!serialized_search!!', $serialized_search, $recept_form);
    //Affichage selecteur etablissement
    $sel_bibli = entites::getBibliHtmlSelect(SESSuserid, $id_bibli, FALSE, array('class' => 'saisie-50em', 'id' => 'id_bibli', 'name' => 'id_bibli', 'onChange' => 'submit();'));
    $recept_form = str_replace('<!-- sel_bibli -->', $sel_bibli, $recept_form);
    //Affichage selecteur exercice
    $sel_exer = exercices::getHtmlSelect($id_bibli, $id_exer, FALSE, array('id' => 'id_exer', 'name' => 'id_exer', 'onChange' => 'submit();'));
    $recept_form = str_replace('<!-- sel_exer -->', $sel_exer, $recept_form);
    //Affichage fournisseurs
    $i = 0;
    $tab_fou2 = array();
    if (is_array($f_fou_code) && count($f_fou_code)) {
        $tab_fou = entites::getRaisonSociale($f_fou_code, $id_bibli);
        foreach ($f_fou_code as $v) {
            if ($v && $tab_fou[$v]) {
                $tab_fou2[$v] = $tab_fou[$v];
                if ($i > 0) {
                    $recept_form = str_replace('<!-- sel_fou -->', $sel_fou_form . '<!-- sel_fou -->', $recept_form);
                    $recept_form = str_replace('!!i!!', $i, $recept_form);
                }
                $recept_form = str_replace('!!f_fou_code!!', $v, $recept_form);
                $recept_form = str_replace('!!f_fou!!', htmlentities($tab_fou[$v], ENT_QUOTES, $charset), $recept_form);
                $i++;
            }
        }
        $recept_form = str_replace('!!max_fou!!', $i > 0 ? $i : '1', $recept_form);
    }
    if (!$i) {
        $recept_form = str_replace('!!f_fou_code!!', '0', $recept_form);
        $recept_form = str_replace('!!f_fou!!', '', $recept_form);
        $recept_form = str_replace('!!max_fou!!', '1', $recept_form);
    }
    //Affichage demandeurs
    $i = 0;
    $tab_empr = array();
    $tab_user = array();
    if (is_array($f_dem_code) && count($f_dem_code) && is_array($t_dem) && count($t_dem)) {
        foreach ($f_dem_code as $k => $v) {
            if ($t_dem[$k]) {
                $tab_empr[] = $v;
            } else {
                $tab_user[] = $v;
            }
        }
        $tab_empr = emprunteur::getName($tab_empr);
        $tab_user = getUserName($tab_user);
        foreach ($f_dem_code as $k => $v) {
            if ($v && ($t_dem[$k] === '0' && $tab_user[$v] || $t_dem[$k] === '1' && $tab_empr[$v])) {
                if ($i > 0) {
                    $recept_form = str_replace('<!-- sel_dem -->', $sel_dem_form . '<!-- sel_dem -->', $recept_form);
                    $recept_form = str_replace('!!i!!', $i, $recept_form);
                }
                $recept_form = str_replace('!!f_dem_code!!', $v, $recept_form);
                $recept_form = str_replace('!!t_dem!!', $t_dem[$k], $recept_form);
                if ($t_dem[$k]) {
                    $recept_form = str_replace('!!f_dem!!', htmlentities($tab_empr[$v], ENT_QUOTES, $charset), $recept_form);
                } else {
                    $recept_form = str_replace('!!f_dem!!', htmlentities($tab_user[$v], ENT_QUOTES, $charset), $recept_form);
                }
                $i++;
            }
        }
        $recept_form = str_replace('!!max_dem!!', $i > 0 ? $i : '1', $recept_form);
    }
    if (!$i) {
        $recept_form = str_replace('!!f_dem_code!!', '0', $recept_form);
        $recept_form = str_replace('!!t_dem!!', '0', $recept_form);
        $recept_form = str_replace('!!f_dem!!', '', $recept_form);
        $recept_form = str_replace('!!max_dem!!', '1', $recept_form);
    }
    //Affichage rubriques budgetaires
    $i = 0;
    $tab_rub2 = array();
    if (is_array($f_rub_code) && count($f_rub_code)) {
        $tab_rub = rubriques::getLibelle($f_rub_code, $id_bibli, $id_exer, SESSuserid);
        foreach ($f_rub_code as $v) {
            if ($v && $tab_rub[$v]) {
                $tab_rub2[$v] = $tab_rub[$v];
                if ($i > 0) {
                    $recept_form = str_replace('<!-- sel_rub -->', $sel_rub_form . '<!-- sel_rub -->', $recept_form);
                    $recept_form = str_replace('!!i!!', $i, $recept_form);
                }
                $recept_form = str_replace('!!f_rub_code!!', $v, $recept_form);
                $recept_form = str_replace('!!f_rub!!', htmlentities($tab_rub[$v], ENT_QUOTES, $charset), $recept_form);
                $i++;
            }
        }
        $recept_form = str_replace('!!max_rub!!', $i > 0 ? $i : '1', $recept_form);
    }
    if (!$i) {
        $recept_form = str_replace('!!f_rub_code!!', '0', $recept_form);
        $recept_form = str_replace('!!f_rub!!', '', $recept_form);
        $recept_form = str_replace('!!max_rub!!', '1', $recept_form);
    }
    //Affichage zone commande
    if (!isset($chk_dev)) {
        $chk_dev = TYP_ACT_CDE;
    }
    if ($chk_dev) {
        $recept_form = str_replace('!!dev_checked!!', "checked='checked'", $recept_form);
        $recept_form = str_replace('!!cde_checked!!', '', $recept_form);
    } else {
        $recept_form = str_replace('!!dev_checked!!', '', $recept_form);
        $recept_form = str_replace('!!cde_checked!!', "checked='checked'", $recept_form);
    }
    $recept_form = str_replace('!!cde_query!!', htmlentities(stripslashes($cde_query), ENT_QUOTES, $charset), $recept_form);
    //Affichage selecteur dates
    $sel_date_form[0] = str_replace('!!msg!!', htmlentities($msg['acquisition_recept_date'], ENT_QUOTES, $charset), $sel_date_form[0]);
    if ($date_inf) {
        $date_inf_lib = formatdate($date_inf);
    } else {
        $date_inf_lib = $msg['parperso_nodate'];
    }
    $sel_date_form[1] = str_replace('!!date_inf!!', $date_inf, $sel_date_form[1]);
    $sel_date_form[1] = str_replace('!!date_inf_lib!!', $date_inf_lib, $sel_date_form[1]);
    if ($date_sup) {
        $date_sup_lib = formatdate($date_sup);
    } else {
        $date_sup_lib = $msg['parperso_nodate'];
    }
    $sel_date_form[2] = str_replace('!!date_sup!!', $date_sup, $sel_date_form[2]);
    $sel_date_form[2] = str_replace('!!date_sup_lib!!', $date_sup_lib, $sel_date_form[2]);
    $sel_date_form[0] = sprintf($sel_date_form[0], $sel_date_form[1], $sel_date_form[2]);
    $recept_form = str_replace('<!-- sel_date -->', $sel_date_form[0], $recept_form);
    //Creation selecteur statut de lignes de commandes
    if (!(is_array($lgstat_filter) && count($lgstat_filter))) {
        $lgstat_filter = array(0 => $deflt3lgstatcde);
    }
    $sel_lgstat = lgstat::getHtmlSelect($lgstat_filter, FALSE, array('id' => 'lgstat_filter[]', 'name' => 'lgstat_filter[]', 'multiple' => 'multiple', 'size' => '5'));
    $recept_form = str_replace('<!-- sel_lgstat -->', $sel_lgstat, $recept_form);
    //Affichage zone tous les champs
    $recept_form = str_replace('!!all_query!!', htmlentities(stripslashes($all_query), ENT_QUOTES, $charset), $recept_form);
    //Prise en compte du formulaire de recherche
    // nombre de références par pages
    if (!$nb_per_page) {
        $nb_per_page = 10;
    }
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
    //La recherche ici
    $recept = new receptions($id_bibli, $id_exer);
    //filtre
    $filtres = $recept->setFiltres(array_keys($tab_fou2), array_keys($tab_empr), array_keys($tab_user), array_keys($tab_rub2), $chk_dev, $cde_query, $lgstat_filter, $date_inf, $date_sup);
    // comptage
    if (!$nbr_lignes) {
        $nbr_lignes = $recept->calcNbLignes($all_query);
        $err = $recept->getError();
    }
    // liste
    if ($nbr_lignes) {
        $t_list = $recept->getLignes();
        //Affichage des lignes
        $recept_form .= $recept_list_form;
        //Affichage zone de reception
        $recept_form = str_replace('!!recept_query!!', htmlentities(stripslashes($recept_query), ENT_QUOTES, $charset), $recept_form);
        $tab_aff = array();
        $lgstat_form = lgstat::getHtmlSelect(array(0 => 0), FALSE, array('id' => 'sel_lgstat_!!id_lig!!', 'onchange' => 'recept_upd_lgstat(this.getAttribute("id"));'));
        $act_form = '';
        $i = 1;
        foreach ($t_list as $id_acte => $t_row) {
            //Affichage lignes à recevoir
            foreach ($t_row as $id_ligne => $row) {
                if (!in_array($id_acte, $tab_aff)) {
                    array_push($tab_aff, $id_acte);
                    $recept_form = str_replace('<!-- actes -->', $act_form . '<!-- actes -->', $recept_form);
                    $act_form = str_replace('!!lib_acte!!', htmlentities($msg['acquisition_recept_fou'], ENT_QUOTES, $charset) . "&nbsp;<a href=\"./acquisition.php?categ=ach&sub=fourn&action=modif&id_bibli=" . $id_bibli . '&id=' . $row['num_fournisseur'] . "\">" . htmlentities($row['raison_sociale'], ENT_QUOTES, $charset) . "</a>" . '&nbsp;' . (htmlentities($row['type_acte'] ? $msg['acquisition_act_num_dev'] : $msg['acquisition_act_num_cde'], ENT_QUOTES, $charset) . "<a href=\"./acquisition.php?categ=ach&sub=" . ($row['type_acte'] ? 'devi' : 'cmde') . "&action=modif&id_bibli=" . $id_bibli . ($row['type_acte'] ? '&id_dev=' : '&id_cde=') . $id_acte . "\">" . htmlentities($row['numero'], ENT_QUOTES, $charset) . "</a>") . '&nbsp;' . htmlentities($msg['653'], ENT_QUOTES, $charset) . '&nbsp;' . formatdate($row['date_acte']), $recept_hrow_form);
                }
                $row_form = $recept_row_form;
                $row_form = str_replace('!!code!!', htmlentities($row['code'], ENT_QUOTES, $charset), $row_form);
                $row_form = str_replace('!!lib!!', nl2br(htmlentities($row['libelle'], ENT_QUOTES, $charset)), $row_form);
                $row_form = str_replace('!!qte_cde!!', $row['nb_cde'], $row_form);
                $row_form = str_replace('!!qte_liv!!', $row['nb_liv'], $row_form);
                $row_form = str_replace('!!qte_sol!!', $row['nb_sol'], $row_form);
                $lgstat_row_form = str_replace("value='" . $row['statut'] . "'", "value='" . $row['statut'] . "' selected='selected' ", $lgstat_form);
                $row_form = str_replace('!!lgstat!!', $lgstat_row_form, $row_form);
                $row_form = str_replace('!!comment_lg!!', nl2br(htmlentities($row['commentaires_gestion'], ENT_QUOTES, $charset)), $row_form);
                $row_form = str_replace('!!comment_lo!!', nl2br(htmlentities($row['commentaires_opac'], ENT_QUOTES, $charset)), $row_form);
                $row_form = str_replace('!!id_lig!!', $id_ligne, $row_form);
                $row_form = str_replace('!!typ_lig!!', $row['type_ligne'], $row_form);
                if ($row['num_produit']) {
                    switch ($row['type_ligne']) {
                        case '1':
                            //notice
                            $row_form = str_replace('<!-- link_cat -->', $link_not, $row_form);
                            break;
                        case '2':
                            //bulletin
                            $row_form = str_replace('<!-- link_cat -->', $link_bull, $row_form);
                            break;
                        case '5':
                            //article
                            $id_bull = analysis::getBulletinIdFromAnalysisId($row['num_produit']);
                            if ($id_bull) {
                                $row_form = str_replace('<!-- link_cat -->', $link_art, $row_form);
                                $row_form = str_replace('!!id_bull!!', $id_bull, $row_form);
                            }
                            break;
                        default:
                            break;
                    }
                } else {
                    $tmp_bt_cat = str_replace('!!id_lig!!', $id_ligne, $bt_cat);
                    $row_form = str_replace('<!-- bt_cat -->', $tmp_bt_cat, $row_form);
                }
                if ($row['num_acquisition']) {
                    $row_form = str_replace('<!-- link_sug -->', $link_sug, $row_form);
                    $row_form = str_replace('!!id_sug!!', $row['num_acquisition'], $row_form);
                }
                $row_form = str_replace('!!id_prod!!', $row['num_produit'], $row_form);
                $row_form = str_replace('!!no!!', $i, $row_form);
                $tab_rel = array();
                $tab_rel = lignes_actes::getRelances($id_ligne);
                $row_form = str_replace('!!nb_relances!!', htmlentities(sprintf($msg['acquisition_recept_hist'], count($tab_rel)), ENT_QUOTES, $charset), $row_form);
                if (count($tab_rel)) {
                    $row_form = str_replace('<!-- relances -->', implode('&nbsp;-&nbsp; ', $tab_rel), $row_form);
                }
                $act_form = str_replace('<!-- lignes -->', $row_form . '<!-- lignes -->', $act_form);
                $i++;
            }
        }
        $recept_form = str_replace('<!-- actes -->', $act_form . '<!-- actes -->', $recept_form);
        $recept_form = str_replace('!!max_no!!', $i * 1 - 1, $recept_form);
        //Affichage commentaires
        $recept_form = str_replace('!!comment_lg_all!!', htmlentities(stripslashes($comment_lg_all), ENT_QUOTES, $charset), $recept_form);
        $recept_form = str_replace('!!comment_lo_all!!', htmlentities(stripslashes($comment_lo_all), ENT_QUOTES, $charset), $recept_form);
        //boutons
        $lgstat_all = lgstat::getHtmlSelect(array(0 => 0), $msg['acquisition_recept_lgstat_none'], array('id' => 'sel_lgstat_all', 'name' => 'sel_lgstat_all'));
        $recept_form = str_replace('<!-- sel_lgstat_all -->', $lgstat_all, $recept_form);
        $recept_form = str_replace('<!-- bt_app -->', $bt_app, $recept_form);
        $recept_form = str_replace('<!-- bt_rel -->', $bt_rel, $recept_form);
        $recept_form = str_replace('<!-- bt_chk -->', $bt_chk, $recept_form);
        //Barre de navigation
        /*
        if (!$last_param) {
        	$nav_bar = aff_pagination ($url_base, $nbr_lignes, $nb_per_page, $page, 10, true, true) ;
        	    } else {
        	    	$nav_bar = "";
        	    }
        	    $recept_form=str_replace('<!-- nav_bar -->', $nav_bar,$recept_form);
        */
        $recept_form .= $recept_search_form_suite;
        print $recept_form;
    } elseif ($err) {
        //erreur dans la recherche
        $recept_form .= $recept_search_form_suite;
        print $recept_form;
        print $err;
    } else {
        // pas de resultat
        $recept_form .= $recept_search_form_suite;
        print $recept_form;
        $cle = array();
        if ($cde_query) {
            $cle[] = htmlentities($msg['acquisition_recept_act_search'] . ' ' . stripslashes($cde_query), ENT_QUOTES, $charset);
        }
        if ($all_query) {
            $cle[] = htmlentities($msg['acquisition_recept_global_search'] . ' ' . stripslashes($all_query), ENT_QUOTES, $charset);
        }
        error_message($msg['acquisition_recept_rech'], str_replace('!!cle!!', implode(',', $cle), $msg['acquisition_recept_rech_error']), 0);
    }
}