diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php
index de6b552d31c..0af409eefac 100644
--- a/htdocs/compta/bank/account.php
+++ b/htdocs/compta/bank/account.php
@@ -48,7 +48,7 @@ $page=isset($_GET["page"])?$_GET["page"]:0;
* Action
*/
-if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]))
+if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]) && $user->rights->banque->modifier)
{
if ($_POST["credit"] > 0)
{
@@ -79,10 +79,11 @@ if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"]))
dolibarr_print_error($db,$acct->error);
}
}
-if ($_GET["action"] == 'del' && $account && $user->rights->banque->modifier)
+if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"]=='yes' && $user->rights->banque->modifier)
{
- $acct=new Account($db,$account);
- $acct->deleteline($_GET["rowid"]);
+ $acct=new Account($db);
+ $acct->id=$account;
+ $result=$acct->deleteline($_GET["rowid"]);
}
@@ -92,6 +93,8 @@ if ($_GET["action"] == 'del' && $account && $user->rights->banque->modifier)
llxHeader();
+$html = new Form($db);
+
if ($account > 0)
{
if ($vline)
@@ -185,9 +188,14 @@ if ($account > 0)
$limitsql = $nbline;
}
+
+ // Onglets
+ $head=bank_prepare_head($acct);
+ dolibarr_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0);
+
+
/**
- * Formulaire de recherche
- *
+ * Bandeau recherche
*/
$mesg='';
@@ -201,20 +209,23 @@ if ($account > 0)
{
$mesg.= ''.img_next().'';
}
-
-
- // Onglets
- $head=bank_prepare_head($acct);
- dolibarr_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0);
-
- if (! $_GET["action"]=='addline')
+ if (! $_GET["action"]=='addline' && ! $_GET["action"]=='delete')
{
$titre=$langs->trans("FinancialAccount")." : ".$acct->label;
print_fiche_titre($titre,$mesg);
}
+
+ if ($_GET["action"]=='delete')
+ {
+ $text=$langs->trans('ConfirmDeleteTransaction');
+ $html->form_confirm($_SERVER['PHP_SELF'].'?account='.$acct->id.'&rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete');
+ print '
';
+ }
+
print '