Fix massaction delete on events
This commit is contained in:
parent
276bc4f908
commit
8b5f4fe9a6
@ -152,6 +152,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
//var_dump($_POST);exit;
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -301,7 +302,7 @@ if ($user->rights->agenda->allactions->delete)
|
||||
{
|
||||
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
}
|
||||
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$sql = "SELECT";
|
||||
@ -441,7 +442,6 @@ if ($resql)
|
||||
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
@ -546,7 +546,6 @@ if ($resql)
|
||||
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
$i = 0;
|
||||
|
||||
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
|
||||
print '</div>';
|
||||
|
||||
@ -1173,6 +1173,7 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permissio
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($_POST);var_dump($massaction);exit;
|
||||
|
||||
// Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before)
|
||||
if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permissiontodelete)
|
||||
|
||||
@ -51,6 +51,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
{
|
||||
global $conf, $user, $langs, $db, $hookmanager;
|
||||
global $begin_h, $end_h, $begin_d, $end_d;
|
||||
global $massaction;
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
@ -63,50 +64,35 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<input type="hidden" name="year" value="'.$year.'">';
|
||||
print '<input type="hidden" name="month" value="'.$month.'">';
|
||||
print '<input type="hidden" name="day" value="'.$day.'">';
|
||||
print '<input type="hidden" name="action" value="'.$action.'">';
|
||||
if ($massaction != 'predelete') { // When $massaction == 'predelete', action may be already output to 'delete' by the mass action system.
|
||||
print '<input type="hidden" name="action" value="'.$action.'">';
|
||||
}
|
||||
print '<input type="hidden" name="search_showbirthday" value="'.$showbirthday.'">';
|
||||
|
||||
//print '<div class="fichecenter">';
|
||||
|
||||
//if ($conf->browser->layout == 'phone') print '<div class="fichehalfleft">';
|
||||
//else print '<table class="nobordernopadding centpercent"><tr><td class="borderright">';
|
||||
|
||||
//print '<table class="nobordernopadding centpercent tableforfield">';
|
||||
|
||||
if ($canedit)
|
||||
{
|
||||
print '<div class="divsearchfield">';
|
||||
// Type
|
||||
//print '<tr>';
|
||||
//print '<td class="nowrap">';
|
||||
print '<span class="fas fa-square inline-block fawidth30" style=" color: #ddd;"></span>';
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("Type").'</span>';
|
||||
//print '</td><td class="nowraponall">';
|
||||
$multiselect = 0;
|
||||
if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
|
||||
{
|
||||
$multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
|
||||
}
|
||||
print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect, 0, 'maxwidth500');
|
||||
//print '</td></tr>';
|
||||
print '</div>';
|
||||
|
||||
// Assigned to
|
||||
print '<div class="divsearchfield">';
|
||||
//print '<tr>';
|
||||
//print '<td class="nowrap">';
|
||||
print img_picto('', 'user', 'class="fawidth30 inline-block"');
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("ActionsToDoBy").'</span>';
|
||||
//print '</td><td>';
|
||||
print $form->select_dolusers($filtert, 'search_filtert', 1, '', !$canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth500');
|
||||
print '</div>';
|
||||
print '<div class="divsearchfield">';
|
||||
//if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("ToUserOfGroup").' ';
|
||||
//else print '<br>';
|
||||
print img_picto('', 'object_group', 'class="fawidth30 inline-block"');
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("ToUserOfGroup").'</span>';
|
||||
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', !$canedit, '', '', '0', false, 'maxwidth500');
|
||||
//print '</td></tr>';
|
||||
print '</div>';
|
||||
|
||||
if ($conf->resource->enabled)
|
||||
@ -116,13 +102,9 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
|
||||
// Resource
|
||||
print '<div class="divsearchfield">';
|
||||
//print '<tr>';
|
||||
//print '<td class="nowrap">';
|
||||
print img_picto('', 'object_resource', 'class="fawidth30 inline-block"');
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("Resource").'</span>';
|
||||
//print '</td><td class="nowraponall">';
|
||||
print $formresource->select_resource_list($resourceid, "search_resourceid", '', 1, 0, 0, null, '', 2, 0, 'maxwidth500');
|
||||
//print '</td></tr>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
@ -130,13 +112,9 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
|
||||
{
|
||||
print '<div class="divsearchfield">';
|
||||
//print '<tr>';
|
||||
//print '<td class="nowrap">';
|
||||
print img_picto('', 'company', 'class="fawidth30 inline-block"');
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("ThirdParty").'</span>';
|
||||
//print '</td><td class="nowraponall">';
|
||||
print $form->select_company($socid, 'search_socid', '', ' ', 0, 0, null, 0, 'minwidth100 maxwidth500');
|
||||
//print '</td></tr>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -146,13 +124,9 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
print '<div class="divsearchfield">';
|
||||
//print '<tr>';
|
||||
//print '<td class="nowrap">';
|
||||
print img_picto('', 'project', 'class="fawidth30 inline-block"');
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("Project").'</span>';
|
||||
//print '</td><td class="nowraponall">';
|
||||
print $formproject->select_projects($socid ? $socid : -1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
//print '</td></tr>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -160,13 +134,9 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
{
|
||||
// Status
|
||||
print '<div class="divsearchfield">';
|
||||
//print '<tr>';
|
||||
//print '<td class="nowrap">';
|
||||
print img_picto('', 'setup', 'class="fawidth30 inline-block"');
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("Status").'</span>';
|
||||
//print '</td><td class="nowraponall">';
|
||||
$formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100');
|
||||
//print '</td></tr>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -174,12 +144,8 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
{
|
||||
print '<div class="divsearchfield">';
|
||||
// Filter on hours
|
||||
//print '<tr>';
|
||||
//print '<td class="nowrap">';
|
||||
print img_picto('', 'clock', 'class="fawidth30 inline-block"');
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("VisibleTimeRange").'</span>';
|
||||
//print '</td>';
|
||||
//print "<td class='nowrap'>";
|
||||
print "\n".'<div class="ui-grid-a inline-block"><div class="ui-block-a">';
|
||||
print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
|
||||
if (empty($conf->dol_use_jmobile)) print ' - ';
|
||||
@ -187,56 +153,27 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">';
|
||||
if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H");
|
||||
print '</div></div>';
|
||||
//print '</td></tr>';
|
||||
print '</div>';
|
||||
|
||||
// Filter on days
|
||||
print '<div class="divsearchfield">';
|
||||
//print '<tr>';
|
||||
//print '<td class="nowrap">';
|
||||
print img_picto('', 'clock', 'class="fawidth30 inline-block"');
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("VisibleDaysRange").'</span>';
|
||||
//print '</td>';
|
||||
//print "<td class='nowrap'>";
|
||||
print "\n".'<div class="ui-grid-a inline-block"><div class="ui-block-a">';
|
||||
print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
|
||||
if (empty($conf->dol_use_jmobile)) print ' - ';
|
||||
else print '</div><div class="ui-block-b">';
|
||||
print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
|
||||
print '</div></div>';
|
||||
//print '</td></tr>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Hooks
|
||||
$parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid);
|
||||
$object = null;
|
||||
$reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
|
||||
//print '</table>';
|
||||
|
||||
//if ($conf->browser->layout == 'phone') print '</div>';
|
||||
//else print '</td>';
|
||||
|
||||
/*
|
||||
if ($conf->browser->layout == 'phone') print '<div class="fichehalfright">';
|
||||
else print '<td class="center nowrap" valign="middle">';
|
||||
|
||||
print '<table class="centpercent"><tr><td align="center">';
|
||||
print '<div class="formleftzone">';
|
||||
print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="'.$langs->trans("Refresh").'">';
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
if ($conf->browser->layout == 'phone') print '</div>';
|
||||
else print '</td>';
|
||||
*/
|
||||
//if ($conf->browser->layout != 'phone') print '</tr></table>';
|
||||
|
||||
//print '</div>'; // Close fichecenter
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
//print '</form>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user