Skip to content
Snippets Groups Projects
Commit 97828e44 authored by Regis Houssin's avatar Regis Houssin
Browse files

Merge branch 'develop' of git+ssh://git@github.com/Dolibarr/dolibarr.git into develop

parents 727a18fd 747774d7
Branches
Tags
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copytight (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copytight (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copytight (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -31,18 +32,20 @@ $langs->load("banks"); ...@@ -31,18 +32,20 @@ $langs->load("banks");
if (! $user->rights->banque->transfer) if (! $user->rights->banque->transfer)
accessforbidden(); accessforbidden();
$action = GETPOST('action','alpha');
/* /*
* Action ajout d'un virement * Action ajout d'un virement
*/ */
if ($_POST["action"] == 'add') if ($action == 'add')
{ {
$langs->load("errors"); $langs->load("errors");
$mesg=''; $mesg='';
$dateo = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); $dateo = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
$label = $_POST["label"]; $label = GETPOST('label','alpha');
$amount= $_POST["amount"]; $amount= GETPOST('amount','int');
if (! $label) if (! $label)
{ {
...@@ -54,12 +57,12 @@ if ($_POST["action"] == 'add') ...@@ -54,12 +57,12 @@ if ($_POST["action"] == 'add')
$error=1; $error=1;
$mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"))."</div>"; $mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"))."</div>";
} }
if (! $_POST['account_from']) if (! GETPOST('account_from','int'))
{ {
$error=1; $error=1;
$mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferFrom"))."</div>"; $mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferFrom"))."</div>";
} }
if (! $_POST['account_to']) if (! GETPOST('account_to','int'))
{ {
$error=1; $error=1;
$mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferTo"))."</div>"; $mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferTo"))."</div>";
...@@ -69,10 +72,10 @@ if ($_POST["action"] == 'add') ...@@ -69,10 +72,10 @@ if ($_POST["action"] == 'add')
require_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'); require_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php');
$accountfrom=new Account($db); $accountfrom=new Account($db);
$accountfrom->fetch($_POST["account_from"]); $accountfrom->fetch(GETPOST('account_from','int'));
$accountto=new Account($db); $accountto=new Account($db);
$accountto->fetch($_POST["account_to"]); $accountto->fetch(GETPOST('account_to','int'));
if ($accountto->id != $accountfrom->id) if ($accountto->id != $accountfrom->id)
{ {
...@@ -133,6 +136,18 @@ llxHeader(); ...@@ -133,6 +136,18 @@ llxHeader();
$form=new Form($db); $form=new Form($db);
$account_from='';
$account_to='';
$label='';
$amount='';
if($error)
{
$account_from = GETPOST('account_from','int');
$account_to = GETPOST('account_to','int');
$label = GETPOST('label','alpha');
$amount = GETPOST('amount','int');
}
print_fiche_titre($langs->trans("BankTransfer")); print_fiche_titre($langs->trans("BankTransfer"));
...@@ -153,18 +168,18 @@ print '</tr>'; ...@@ -153,18 +168,18 @@ print '</tr>';
$var=false; $var=false;
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';
print $form->select_comptes($_POST['account_from'],'account_from',0,'',1); print $form->select_comptes($account_from,'account_from',0,'',1);
print "</td>"; print "</td>";
print "<td>\n"; print "<td>\n";
print $form->select_comptes($_POST['account_to'],'account_to',0,'',1); print $form->select_comptes($account_to,'account_to',0,'',1);
print "</td>\n"; print "</td>\n";
print "<td>"; print "<td>";
$form->select_date($dateo,'','','','','add'); $form->select_date($dateo,'','','','','add');
print "</td>\n"; print "</td>\n";
print '<td><input name="label" class="flat" type="text" size="40" value="'.$_POST["label"].'"></td>'; print '<td><input name="label" class="flat" type="text" size="40" value="'.$label.'"></td>';
print '<td><input name="amount" class="flat" type="text" size="8" value="'.$_POST["amount"].'"></td>'; print '<td><input name="amount" class="flat" type="text" size="8" value="'.$amount.'"></td>';
print "</table>"; print "</table>";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment