Ejemplo n.º 1
0
        } else {
            dol_print_error($db, "result={$result}");
            $db->rollback();
        }
    } else {
        dol_print_error($db);
    }
}
// bascule du statut d'un contact
if ($_GET["action"] == 'swapstatut' && $user->rights->fournisseur->commande->creer) {
    $commande = new CommandeFournisseur($db);
    if ($commande->fetch($_GET["id"])) {
        $contact = $commande->detail_contact($_GET["ligne"]);
        $id_type_contact = $contact->fk_c_type_contact;
        $statut = $contact->statut == 4 ? 5 : 4;
        $result = $commande->update_contact($_GET["ligne"], $statut, $id_type_contact);
        if ($result >= 0) {
            $db->commit();
        } else {
            dol_print_error($db, "result={$result}");
            $db->rollback();
        }
    } else {
        dol_print_error($db);
    }
}
// Efface un contact
if ($_GET["action"] == 'deleteline' && $user->rights->fournisseur->commande->creer) {
    $commande = new CommandeFournisseur($db);
    $commande->fetch($_GET["id"]);
    $result = $commande->delete_contact($_GET["lineid"]);