$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);
    }
}
/*
 * View
 */
$form = new Form($db);
$formfile = new FormFile($db);
$formproduct = new FormProduct($db);
llxHeader('', $langs->trans('OrderCard'), '');
if ($id > 0 || !empty($ref)) {
    $commande = new Commande($db);
    if ($commande->fetch($id, $ref) > 0) {
        $commande->loadExpeditions(1);