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='
'.$tva->error.'
'; - $_GET["action"]="create"; + $action="create"; } } -if ($_GET["action"] == 'delete') +if ($action == 'delete') { - $tva = new Tva($db); $result=$tva->fetch($_GET['id']); if ($tva->rappro == 0) @@ -143,7 +151,7 @@ if ($id) } // Formulaire saisie tva -if ($_GET["action"] == 'create') +if ($action == 'create') { print "
\n"; print ''; @@ -223,6 +231,9 @@ if ($id) print $vatpayment->ref; print ''; + // Label + print ''.$langs->trans("Label").''.$vatpayment->label.''; + print ""; print ''.$langs->trans("DatePayment").''; print dol_print_date($vatpayment->datep,'day'); @@ -273,5 +284,4 @@ if ($id) $db->close(); llxFooter(); - -?> +?> \ No newline at end of file