From d4639540c4a429451fddaee0d43936df16108473 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Nov 2007 22:47:50 +0000 Subject: [PATCH] Qual: Mutualisation du code --- htdocs/compta/bank/virement.php | 65 ++++++++++++--------------------- 1 file changed, 23 insertions(+), 42 deletions(-) diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 314bb86df6a..123b3e238d1 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -42,6 +42,8 @@ if (!$user->rights->banque->modifier) */ if ($_POST["action"] == 'add') { + $langs->load("errors"); + $mesg=''; $dateo = dolibarr_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); $label = $_POST["label"]; @@ -57,6 +59,16 @@ if ($_POST["action"] == 'add') $error=1; $mesg.="
".$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"))."
"; } + if (! $_POST['account_from']) + { + $error=1; + $mesg.="
".$langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferFrom"))."
"; + } + if (! $_POST['account_to']) + { + $error=1; + $mesg.="
".$langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferTo"))."
"; + } if (! $error) { require_once(DOL_DOCUMENT_ROOT.'/compta/bank/account.class.php'); @@ -79,7 +91,9 @@ if ($_POST["action"] == 'add') if ($result1 > 0 && $result2 > 0) { - $mesg.="
Le virement depuis  id."\">".$accountfrom->label."  vers  id."\">".$accountto->label."  de ".$amount." ".$langs->trans("Currency".$conf->monnaie)." a ete cree.
"; + $mesg.="
"; + $mesg.=$langs->trans("TransferFromToDone","id."\">".$accountfrom->label."","id."\">".$accountto->label."",$amount,$langs->transnoentities("Currency".$conf->monnaie)); + $mesg.="
"; $db->commit(); } else @@ -127,51 +141,18 @@ print ''; $var=false; print ''; -print "\n"; +print $html->select_comptes($_POST['account_from'],'account_from',0,'',1); +print ""; -print '\n"; +print "\n"; +print $html->select_comptes($_POST['account_to'],'account_to',0,'',1); +print "\n"; print ""; -$html->select_date('','','','','','add'); +$html->select_date($dateo,'','','','','add'); print "\n"; -print ''; -print ''; +print ''; +print ''; print "";