Example #1
0
        // $charge->fournisseur = GETPOST ( "fournisseur" );
        // $charge->nouveau_fournisseur = GETPOST ( "nouveau_fournisseur" );
        if (!empty($nouveau_fournisseur)) {
            $charge->fournisseur = $nouveau_fournisseur;
        } elseif (!empty($fournisseur)) {
            $charge->fournisseur = $fournisseur;
        }
        $charge->local_id = GETPOST("local_id");
        $charge->type = GETPOST("type");
        $charge->montant_ttc = GETPOST("montant_ttc");
        $charge->date_acq = $dateacq;
        $charge->periode_du = $datedu;
        $charge->periode_au = $dateau;
        $charge->proprietaire_id = GETPOST("proprietaire_id");
        $e_charge = $charge;
        $res = $charge->update();
        if ($res >= 0) {
            setEventMessage($langs->trans("SocialContributionAdded"), 'mesgs');
        } else {
            setEventMessage($charge->error, 'errors');
        }
        header("Location: " . DOL_URL_ROOT . "/immobilier/charge/fiche_charge.php?id=" . $charge->id);
    }
}
/*
 * View
 *
 */
if (GETPOST("action") == 'create') {
    llxheader('', $langs->trans("addcharge"), '');
    $nbligne = 0;