diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 2a6f5184f9a..0f7ce40c8ff 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -20,6 +20,15 @@ * $Source$ * */ + +/*! + \file htdocs/compta/bank/virement.php + \ingroup banque + \brief Page de siasie d'un virement + \version $Revision$ +*/ + + require("./pre.inc.php"); require("./bank.lib.php"); @@ -30,37 +39,43 @@ if (!$user->rights->banque->modifier) llxHeader(); -if ($action == 'add') + +/* + * Action ajout d'un virement + */ +if ($_POST["action"] == 'add') { - /* - * Ajout d'un virement - */ $mesg=''; - $dateo = $_POST["$reyear"]."-".$_POST["$remonth"]."-".$_POST["$reday"]; + $dateo = $_POST["reyear"]."-".$_POST["remonth"]."-".$_POST["reday"]; $label = $_POST["label"]; $amount= $_POST["amount"]; if ($label && $amount) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, datev, dateo, label, amount, fk_user_author,fk_account, fk_type)"; - $sql .= " VALUES (now(), now(), '$dateo', '$label', (0 - $amount),$user->id,$account_from, 'VIR')"; + $sql .= " VALUES (now(), now(), '$dateo', '$label', (0 - $amount),$user->id, ".$_POST["account_from"].", 'VIR')"; $result = $db->query($sql); if (!$result) { - print "Erreur: $sql :".$db->error(); + dolibarr_print_error($db); } $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, datev, dateo, label, amount, fk_user_author,fk_account, fk_type)"; - $sql .= " VALUES (now(), now(), '$dateo', '$label', $amount,$user->id, $account_to, 'VIR')"; + $sql .= " VALUES (now(), now(), '$dateo', '$label', $amount,$user->id, ".$_POST["account_to"].", 'VIR')"; $result = $db->query($sql); if ($result) { - $mesg.="
'; + +print ""; $db->close();