diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 566a2ff53cc..8fbc028a589 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -19,7 +19,7 @@ /** * \file htdocs/compta/localtax/card.php * \ingroup tax - * \brief Page of IRPF payments + * \brief Page of second or third tax payments (like IRPF for spain, ...) */ require '../../main.inc.php'; @@ -30,17 +30,25 @@ $langs->load("compta"); $langs->load("banks"); $langs->load("bills"); -$id=$_REQUEST["id"]; +$id=GETPOST("id",'int'); +$action=GETPOST("action","alpha"); +$refund=GETPOST("refund","int"); +if (empty($refund)) $refund=0; + $lttype=GETPOST('localTaxType', 'int'); -$mesg = ''; // Security check $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); +$localtax = new Localtax($db); -/* +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('localtaxvatcard','globalcard')); + + +/** * Actions */ @@ -50,9 +58,8 @@ if($_POST["cancel"] == $langs->trans("Cancel")){ exit; } -if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) +if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) { - $localtax = new Localtax($db); $db->begin(); @@ -83,10 +90,9 @@ if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) } //delete payment of localtax -if ($_GET["action"] == 'delete') +if ($action == 'delete') { - $localtax = new Localtax($db); - $result=$localtax->fetch($_GET['id']); + $result=$localtax->fetch($id); if ($localtax->rappro == 0) { @@ -99,10 +105,10 @@ if ($_GET["action"] == 'delete') { $accountline=new AccountLine($db); $result=$accountline->fetch($localtax->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/localtax/reglement.php?localTaxType='.$localtax->ltt); @@ -149,26 +155,26 @@ if ($id) } -if ($_GET["action"] == 'create') +if ($action == 'create') { - print "
'."\n"; } else diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 12c759a67d6..00c805b98ba 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -958,6 +958,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r * @param string $langkey Translation key * @param string $fieldkey Key of the html select field the text refers to * @param int $fieldrequired 1=Field is mandatory + * @deprecated Form::editfieldkey */ function fieldLabel($langkey, $fieldkey, $fieldrequired=0) {