diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 44aa49361f9..6820b853b5a 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -39,12 +39,17 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'bills')); -$action = GETPOST('action', 'alpha'); -$massaction = GETPOST('massaction', 'alpha'); -$confirm = GETPOST('confirm', 'alpha'); -$optioncss = GETPOST('optioncss', 'alpha'); +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'salestaxeslist'; -$mode = GETPOST('mode', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'alpha'); +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $search_ref = GETPOST('search_ref', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); @@ -62,9 +67,9 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST('page', 'int'); - -if (empty($page) || $page == -1) { - $page = 0; // If $page is not defined, or '' or -1 +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters + $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; @@ -96,6 +101,9 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); $hookmanager->initHooks(array('salestaxeslist')); $object = new Tva($db); +$permissiontoadd = $user->hasRight('tax', 'charges', 'creer'); +$permissiontodelete = $user->hasRight('tax', 'charges', 'supprimer'); + // Security check $socid = GETPOST('socid', 'int'); if ($user->socid) { @@ -116,6 +124,7 @@ if ($reshook < 0) { if (empty($reshook)) { + // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // Both test are required to be compatible with all browsers @@ -129,7 +138,15 @@ if (empty($reshook)) { $search_account = ''; $search_amount = ''; $search_status = ''; + $toselect = array(); + $search_array_options = array(); } + + // Mass actions + $objectclass = 'Tva'; + $objectlabel = 'Tva'; + $uploaddir = $conf->tax->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -145,8 +162,15 @@ $bankstatic = new Account($db); $accountingjournal = new AccountingJournal($db); $bankline = new AccountLine($db); -llxHeader('', $langs->trans("VATDeclarations")); +$now = dol_now(); +$title = $langs->trans("VATDeclarations"); +//$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject"; +$help_url = ''; + + +// Build and execute select +// -------------------------------------------------------------------- $sql = 'SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment as type, t.fk_account,'; $sql.= ' ba.label as blabel, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,'; $sql.= ' t.num_payment, pst.code as payment_code,'; @@ -207,7 +231,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -223,22 +247,28 @@ if ($limit) { $resql = $db->query($sql); if (!$resql) { dol_print_error($db); - llxFooter(); - $db->close(); exit; } $num = $db->num_rows($resql); + +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $title, $help_url); + +$arrayofselected = is_array($toselect) ? $toselect : array(); + $param = ''; if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } -if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) { - $param .= '&contextpage='.$contextpage; +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.$limit; + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -298,24 +328,33 @@ if (!empty($search_amount)) { if ($search_status != '' && $search_status != '-1') { $param .= '&search_status='.urlencode($search_status); } + +// List of mass actions available $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); +if (!empty($permissiontodelete)) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); +} $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $moreforfilter = ''; -print '