diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 297dc3f7de5..b97df2b24bf 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -45,6 +45,7 @@ $langs->loadLangs(array('compta', 'banks', 'bills', 'hrm', 'projects')); $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist'; $mode = GETPOST('mode', 'alpha'); @@ -126,6 +127,7 @@ if ($user->socid) { $socid = $user->socid; } $result = restrictedArea($user, 'tax', '', 'chargesociales', 'charges'); +$permissiontodelete = $user->rights->tax->charges->supprimer; /* @@ -170,7 +172,14 @@ if (empty($reshook)) { $search_type = ''; $search_account = ''; $search_array_options = array(); + $toselect = array(); } + + // Mass actions + $objectclass = 'ChargeSociales'; + $objectlabel = 'ChargeSociales'; + $uploaddir = $conf->tax->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } /* @@ -188,6 +197,8 @@ if (isModEnabled('project')) { llxHeader('', $langs->trans("SocialContributions")); +$arrayofselected = is_array($toselect) ? $toselect : array(); + $sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user,"; $sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,"; if (isModEnabled('project')) { @@ -378,6 +389,15 @@ if ($user->rights->tax->charges->creer) { $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create'); } + +// List of mass actions available +$arrayofmassactions = array(); +if (!empty($permissiontodelete)) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); +} +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); +$moreforfilter = ''; + print '
'; if ($optioncss != '') { print ''; @@ -394,7 +414,7 @@ print ''; $center = ''; -print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1); if (empty($mysoc->country_id) && empty($mysoc->country_code)) { print '
'; @@ -408,8 +428,6 @@ if (empty($mysoc->country_id) && empty($mysoc->country_code)) { $db->close(); } -$moreforfilter = ''; -$massactionbutton = ''; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields @@ -417,6 +435,10 @@ if ($massactionbutton) { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } +$objecttmp = new ChargeSociales($db); +$trackid = 'sc'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + print '
'; print ''."\n"; @@ -630,7 +652,15 @@ while ($i < $imaxinloop) { // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print ''; } // Line number @@ -774,7 +804,15 @@ while ($i < $imaxinloop) { // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print ''; } if (!$i) { $totalarray['nbfield']++;
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '