diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php index a95f7b85963..a31b4030b65 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/fiche.php @@ -31,7 +31,8 @@ $langs->load("compta"); $langs->load("banks"); $langs->load("bills"); -$id=$_REQUEST["id"]; +$id=GETPOST("id"); +$action=GETPOST('action'); $mesg = ''; @@ -40,17 +41,25 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); +$tva = new Tva($db); + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('taxvatcard')); -/** - * Action ajout paiement tva - */ -if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) -{ - $tva = new Tva($db); +/** + * Actions + */ + +if ($_POST["cancel"] == $langs->trans("Cancel")) +{ + header("Location: reglement.php"); + exit; +} + +if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) +{ $db->begin(); $datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]); @@ -74,13 +83,12 @@ if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) { $db->rollback(); $mesg='