示例#1
0
            dol_print_error($db);
        }
    } else {
        if ($action == 'deletecontact' && $user->rights->commande->creer) {
            $object->fetch($id);
            $result = $object->delete_contact($_GET["lineid"]);
            if ($result >= 0) {
                header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
                exit;
            } else {
                dol_print_error($db);
            }
        } else {
            if ($action == 'setaddress' && $user->rights->commande->creer) {
                $object->fetch($id);
                $result = $object->setDeliveryAddress($_POST['fk_address']);
                if ($result < 0) {
                    dol_print_error($db, $object->error);
                }
            }
        }
    }
}
/*
 * View
 */
llxHeader('', $langs->trans('Order'), 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');
$form = new Form($db);
$formcompany = new FormCompany($db);
$formother = new FormOther($db);
$contactstatic = new Contact($db);
    $commande->set_ref_client($user, GETPOST('ref_customer', 'alpha'));
}
if ($action == 'setdatedelivery' && $user->rights->commande->creer) {
    //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
    $datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
    $commande = new Commande($db);
    $commande->fetch($id);
    $result = $commande->set_date_livraison($user, $datelivraison);
    if ($result < 0) {
        $mesg = '<div class="error">' . $commande->error . '</div>';
    }
}
if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) {
    $commande = new Commande($db);
    $commande->fetch($id);
    $commande->setDeliveryAddress(GETPOST('delivery_address_id', 'int'));
}
if ($action == 'setmode' && $user->rights->commande->creer) {
    $commande = new Commande($db);
    $commande->fetch($id);
    $result = $commande->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
    if ($result < 0) {
        dol_print_error($db, $commande->error);
    }
}
if ($action == 'setconditions' && $user->rights->commande->creer) {
    $commande = new Commande($db);
    $commande->fetch($id);
    $result = $commande->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
    if ($result < 0) {
        dol_print_error($db, $commande->error);