diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php index cab62777291..a0d181e8f81 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ $langs->load("compta"); $langs->load("banks"); $langs->load("bills"); -$id=GETPOST("id"); +$id=GETPOST("id",'int'); $action=GETPOST('action'); // Security check @@ -87,7 +87,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) if ($action == 'delete') { - $result=$tva->fetch($_GET['id']); + $result=$tva->fetch($id); if ($tva->rappro == 0) { @@ -100,10 +100,10 @@ if ($action == 'delete') { $accountline=new AccountLine($db); $result=$accountline->fetch($tva->fk_bank); - $result=$accountline->delete($user); + if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing) } - if ($result > 0) + if ($result >= 0) { $db->commit(); header("Location: ".DOL_URL_ROOT.'/compta/tva/reglement.php'); @@ -289,4 +289,4 @@ if ($id) $db->close(); llxFooter(); -?> \ No newline at end of file +?>