예제 #1
0
    $object->fetch($id);
    $result = $object->set_paid($user);
    if ($result < 0) {
        setEventMessage($object->error, 'errors');
    }
}
// Set supplier ref
if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) {
    $result = $object->setValueFrom('ref_supplier', GETPOST('ref_supplier', 'alpha'));
    if ($result < 0) {
        dol_print_error($db, $object->error);
    }
}
// conditions de reglement
if ($action == 'setconditions' && $user->rights->fournisseur->commande->creer) {
    $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
} else {
    if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) {
        $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
    } elseif ($action == 'setlabel' && $user->rights->fournisseur->facture->creer) {
        $object->fetch($id);
        $object->label = $_POST['label'];
        $result = $object->update($user);
        if ($result < 0) {
            dol_print_error($db);
        }
    } elseif ($action == 'setdatef' && $user->rights->fournisseur->facture->creer) {
        $object->fetch($id);
        $object->date = dol_mktime(12, 0, 0, $_POST['datefmonth'], $_POST['datefday'], $_POST['datefyear']);
        if ($object->date_echeance && $object->date_echeance < $object->date) {
            $object->date_echeance = $object->date;