diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index ee30812545a..fb43f098583 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -52,6 +52,9 @@ $ref=GETPOST('ref','alpha'); $dvid=GETPOST('dvid','alpha'); $numref=GETPOST('num','alpha'); $ve=GETPOST("ve",'alpha'); +$brref=GETPOST('brref','alpha'); +$oldbankreceipt=GETPOST('oldbankreceipt','alpha'); +$newbankreceipt=GETPOST('newbankreceipt','alpha'); // Security check $fieldid = (! empty($ref)?$ref:$id); @@ -149,9 +152,6 @@ else { } - - - $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; $sql.= " b.fk_bordereau,"; @@ -174,6 +174,16 @@ $sqlrequestforbankline = $sql; * Actions */ +if ($action == 'confirm_editbankreceipt' && ! empty($oldbankreceipt) && ! empty($newbankreceipt)) +{ + // TODO Add a test to check newbankreceipt does not exists yet + $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX.'bank SET num_releve = "'.$db->escape($newbankreceipt).'" WHERE num_releve = "'.$db->escape($oldbankreceipt).'"'; + $result = $db->query($sqlupdate); + if ($result < 0) dol_print_error($db); + + $action='view'; +} + // ZIP creation if ($action=="dl" && $numref > 0) { @@ -404,16 +414,22 @@ if (empty($numref)) } print ''; - print '

'; print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&account=".$object->id, $sortfield, $sortorder,'',$numrows); + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; print ''; + print ''; print ''; $balancestart=array(); @@ -429,7 +445,20 @@ if (empty($numref)) } else { - print ''; + print ''; + print ''; // Calculate start amount $sql = "SELECT sum(b.amount) as amount"; @@ -459,11 +488,18 @@ if (empty($numref)) } print ''; + print ''; + print ''."\n"; } $i++; } print "
'.$langs->trans("AccountStatement").''.$langs->trans("InitialBankBalance").''.$langs->trans("EndBankBalance").'
'.$objp->numr.'
'; + if ($action != 'editbankreceipt' || $objp->numr != $brref) + { + print ''.$objp->numr.''; + } + else + { + print ''; + print ''; + print ''; + print ''; + } + print ''.price(($balancestart[$objp->numr]+$content[$objp->numr]),'',$langs,1,-1,-1,$conf->currency).''; + if ($user->rights->banque->consolidate && $action != 'editbankreceipt') { + print 'numr.'">'.img_edit().''; + } + print '
\n"; + print '
'; print "\n\n"; }