diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php index ce4ff8102e9..2463c768098 100644 --- a/htdocs/compta/bank/rappro.php +++ b/htdocs/compta/bank/rappro.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2010 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -47,6 +47,8 @@ $id=GETPOST('account', 'int'); // Conciliation if ($action == 'rappro' && $user->rights->banque->consolidate) { + $error=0; + // Definition, nettoyage parametres $num_releve=trim($_POST["num_releve"]); @@ -54,25 +56,37 @@ if ($action == 'rappro' && $user->rights->banque->consolidate) { $bankline=new AccountLine($db); - if (isset($_POST["rowid"]) && is_array($_POST["rowid"])) + if (isset($_POST['rowid']) && is_array($_POST['rowid'])) { - foreach($_POST["rowid"] as $row) + foreach($_POST['rowid'] as $row) { if($row > 0) { $result=$bankline->fetch($row); $bankline->num_releve=$num_releve; //$_POST["num_releve"]; $result=$bankline->update_conciliation($user,$_POST["cat"]); - if ($result < 0) $mesg.=$bankline->error; + if ($result < 0) + { + $mesg.=$bankline->error; + $error++; + break; + } } } } } else { + $error++; $langs->load("errors"); $mesg='
'.$langs->trans("ErrorPleaseTypeBankTransactionReportName").'
'; } + + if (! $error) + { + header('Location: '.DOL_URL_ROOT.'/compta/bank/rappro?account='.$id); // To avoid to submit twice and allow back + exit; + } } /* @@ -80,12 +94,12 @@ if ($action == 'rappro' && $user->rights->banque->consolidate) */ if ($action == 'del') { - $accline=new AccountLine($db); - $accline->fetch($_GET["rowid"]); - $result=$accline->delete(); + $bankline=new AccountLine($db); + $bankline->fetch($_GET["rowid"]); + $result=$bankline->delete($user); if ($result < 0) { - dol_print_error($db,$accline->error); + dol_print_error($db,$bankline->error); } } @@ -200,7 +214,7 @@ if ($resql) } - print '
'; + print ''; print ''; print ""; print "id."\">"; @@ -212,8 +226,7 @@ if ($resql) { print $langs->trans("EventualyAddCategory").':
'; } - print $langs->trans("ThenCheckLinesAndConciliate").' '; - print "trans("Conciliate")."\">
"; + print '
'.$langs->trans("ThenCheckLinesAndConciliate").' "'.$langs->trans("Conciliate").'"
'; print '
'; @@ -230,7 +243,6 @@ if ($resql) print "\n"; - $i = 0; while ($i < $num) { @@ -265,7 +277,7 @@ if ($resql) print ''; } - // Number + // Type + Number $label=($langs->trans("PaymentType".$objp->type)!="PaymentType".$objp->type)?$langs->trans("PaymentType".$objp->type):$objp->type; // $objp->type is a code if ($label=='SOLD') $label=''; print ''.$label.($objp->num_chq?' '.$objp->num_chq:'').''; @@ -400,12 +412,12 @@ if ($resql) } - // Affiche zone saisie releve + bouton "Rapprocher" + // Show checkbox for conciliation if ($db->jdate($objp->do) <= $now) { print ''; - print ''; + print 'rowid])?' checked="checked"':'').'>'; // print ''; // print '   '; // print "trans("Conciliate")."\">"; @@ -429,13 +441,12 @@ if ($resql) } $db->free($resql); + print "
\n"; - print "
\n"; + print '

'; + + print "\n"; - if ($num != 0) - { - print "
\n"; - } } else {