Esempio n. 1
0
function show_list_rel($id_bibli, $id_fou)
{
    global $msg, $charset;
    global $histrel_form, $histrel_hrow_form, $histrel_row_form;
    global $acquisition_gestion_tva;
    $tab_rel = array();
    if ($id_fou) {
        $tab_rel = lignes_actes::getRelancesBySupplier($id_fou);
    }
    $form = $histrel_form;
    $form = str_replace('!!form_title!!', htmlentities($msg['acquisition_hist_rel_fou'], ENT_QUOTES, $charset), $form);
    $bibli = new entites($id_bibli);
    $form = str_replace('!!id!!', $id_fou, $form);
    $form = str_replace('!!id_bibli!!', $id_bibli, $form);
    $form = str_replace('!!lib_bibli!!', htmlentities($bibli->raison_sociale, ENT_QUOTES, $charset), $form);
    $fourn = new entites($id_fou);
    $form = str_replace('!!raison!!', htmlentities($fourn->raison_sociale, ENT_QUOTES, $charset), $form);
    $date_rel = '';
    $lg_form = '';
    $i = 0;
    foreach ($tab_rel as $k => $rel) {
        $i++;
        if ($rel[date_rel] != $date_rel) {
            $date_rel = $rel['date_rel'];
            $form = str_replace('<!-- relances -->', $lg_form . '<!-- relances -->', $form);
            $lg_form = $histrel_hrow_form;
            $lg_form = str_replace('!!lib_rel!!', htmlentities(sprintf($msg['acquisition_hist_rel_du'], $date_rel), ENT_QUOTES, $charset), $lg_form);
        }
        $lg_form = str_replace('<!-- lignes -->', $histrel_row_form . '<!-- lignes -->', $lg_form);
        $lg_form = str_replace('!!numero!!', htmlentities($rel['numero'], ENT_QUOTES, $charset), $lg_form);
        $lg_form = str_replace('!!code!!', htmlentities($rel['code'], ENT_QUOTES, $charset), $lg_form);
        $lg_form = str_replace('!!lib!!', nl2br(htmlentities($rel['libelle'], ENT_QUOTES, $charset)), $lg_form);
        $lg_form = str_replace('!!qte!!', htmlentities($rel['nb'], ENT_QUOTES, $charset), $lg_form);
        $lg_form = str_replace('!!prix!!', htmlentities($rel['prix'], ENT_QUOTES, $charset), $lg_form);
        if ($rel['num_type']) {
            $tp = new types_produits($rel['num_type']);
            $lg_form = str_replace('!!lib_typ!!', htmlentities($tp->libelle, ENT_QUOTES, $charset), $lg_form);
        } else {
            $lg_form = str_replace('!!lib_typ!!', '', $lg_form);
        }
        if ($acquisition_gestion_tva) {
            $lg_form = str_replace('!!tva!!', $rel['tva'], $lg_form);
        }
        $lg_form = str_replace('!!rem!!', $rel['remise'], $lg_form);
        if ($rel['num_rubrique']) {
            $rub = new rubriques($rel['num_rubrique']);
            $lg_form = str_replace('!!lib_rub!!', htmlentities($rub->libelle, ENT_QUOTES, $charset), $lg_form);
        } else {
            $lg_form = str_replace('!!lib_rub!!', '', $lg_form);
        }
        $lg_stat = new lgstat($rel['statut']);
        $lg_form = str_replace('!!lgstat!!', htmlentities($lg_stat->libelle, ENT_QUOTES, $charset), $lg_form);
        $lg_form = str_replace('!!comment_lg!!', nl2br(htmlentities($rel['commentaires_gestion'], ENT_QUOTES, $charset)), $lg_form);
        $lg_form = str_replace('!!comment_lo!!', nl2br(htmlentities($rel['commentaires_opac'], ENT_QUOTES, $charset)), $lg_form);
        $lg_form = str_replace('!!no!!', $i, $lg_form);
        $lg_form = str_replace('!!id_lig!!', $rel['num_ligne'], $lg_form);
    }
    $form = str_replace('<!-- relances -->', $lg_form, $form);
    print $form;
}