|
@@ -47,7 +47,7 @@ $massaction = GETPOST('massaction', 'alpha');
|
|
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
|
|
|
$resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid", "int") : GETPOST("resourceid", "int");
|
|
|
$pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3);
|
|
|
-$search_status = (GETPOST("search_status", 'alpha') != '') ?GETPOST("search_status", 'alpha') : GETPOST("status", 'alpha');
|
|
|
+$search_status = (GETPOST("search_status", 'aZ09') != '') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09');
|
|
|
$type = GETPOST('search_type', 'alphanohtml') ?GETPOST('search_type', 'alphanohtml') : GETPOST('type', 'alphanohtml');
|
|
|
$optioncss = GETPOST('optioncss', 'alpha');
|
|
|
$year = GETPOST("year", 'int');
|
|
@@ -517,526 +517,543 @@ $parameters = array();
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
$sql .= $hookmanager->resPrint;
|
|
|
|
|
|
-$sql .= $db->order($sortfield, $sortorder);
|
|
|
-
|
|
|
+// Count total nb of records
|
|
|
$nbtotalofrecords = '';
|
|
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|
|
- // TODO Set and use an optimized request in $sqlforcount with no fields and no useless join to caluclate nb of records
|
|
|
- $result = $db->query($sql);
|
|
|
- $nbtotalofrecords = $db->num_rows($result);
|
|
|
+ /* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
|
|
+ $resql = $db->query($sql);
|
|
|
+ $nbtotalofrecords = $db->num_rows($resql);
|
|
|
+ */
|
|
|
+ /* The slow method does not consume memory on mysql (not tested on pgsql) */
|
|
|
+ /*$resql = $db->query($sql, 0, 'auto', 1);
|
|
|
+ while ($db->fetch_object($resql)) {
|
|
|
+ $nbtotalofrecords++;
|
|
|
+ }*/
|
|
|
+ /* This fast and low memory method to get and count full list converts the sql into a sql count */
|
|
|
+ $sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
|
|
+ $resql = $db->query($sqlforcount);
|
|
|
+ $objforcount = $db->fetch_object($resql);
|
|
|
+ $nbtotalofrecords = $objforcount->nbtotalofrecords;
|
|
|
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
|
|
$page = 0;
|
|
|
$offset = 0;
|
|
|
}
|
|
|
+ $db->free($resql);
|
|
|
}
|
|
|
|
|
|
-$sql .= $db->plimit($limit + 1, $offset);
|
|
|
-//print $sql;
|
|
|
+// Complete request and execute it with limit
|
|
|
+$sql .= $db->order($sortfield, $sortorder);
|
|
|
+if ($limit) {
|
|
|
+ $sql .= $db->plimit($limit + 1, $offset);
|
|
|
+}
|
|
|
|
|
|
-dol_syslog("comm/action/list.php", LOG_DEBUG);
|
|
|
$resql = $db->query($sql);
|
|
|
-if ($resql) {
|
|
|
- $actionstatic = new ActionComm($db);
|
|
|
- $societestatic = new Societe($db);
|
|
|
+if (!$resql) {
|
|
|
+ dol_print_error($db);
|
|
|
+ exit;
|
|
|
+}
|
|
|
|
|
|
- $num = $db->num_rows($resql);
|
|
|
+$num = $db->num_rows($resql);
|
|
|
|
|
|
- $arrayofselected = is_array($toselect) ? $toselect : array();
|
|
|
|
|
|
- // Local calendar
|
|
|
- $newtitle = '<div class="nowrap clear inline-block minheight30 margintoponly">';
|
|
|
- $newtitle .= '<input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' ';
|
|
|
- $newtitle .= '</div>';
|
|
|
- //$newtitle=$langs->trans($title);
|
|
|
+$actionstatic = new ActionComm($db);
|
|
|
+$societestatic = new Societe($db);
|
|
|
|
|
|
- $tabactive = 'cardlist';
|
|
|
+$num = $db->num_rows($resql);
|
|
|
|
|
|
- $head = calendars_prepare_head($param);
|
|
|
+$arrayofselected = is_array($toselect) ? $toselect : array();
|
|
|
|
|
|
- print '<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
|
|
+// Local calendar
|
|
|
+$newtitle = '<div class="nowrap clear inline-block minheight30 margintoponly">';
|
|
|
+$newtitle .= '<input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' ';
|
|
|
+$newtitle .= '</div>';
|
|
|
+//$newtitle=$langs->trans($title);
|
|
|
|
|
|
- if ($optioncss != '') {
|
|
|
- print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
- }
|
|
|
- print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
- 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.'">';
|
|
|
- print '<input type="hidden" name="type" value="'.$type.'">';
|
|
|
- $nav = '';
|
|
|
-
|
|
|
- if ($filter) {
|
|
|
- $nav .= '<input type="hidden" name="search_filter" value="'.$filter.'">';
|
|
|
- }
|
|
|
- if ($showbirthday) {
|
|
|
- $nav .= '<input type="hidden" name="search_showbirthday" value="1">';
|
|
|
- }
|
|
|
- print $nav;
|
|
|
-
|
|
|
- //print dol_get_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
|
|
- //print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
|
|
|
- //print dol_get_fiche_end();
|
|
|
-
|
|
|
- // Add link to show birthdays
|
|
|
- /*
|
|
|
- $link = '';
|
|
|
- if (empty($conf->use_javascript_ajax))
|
|
|
- {
|
|
|
- $newparam=$param; // newparam is for birthday links
|
|
|
- $newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam);
|
|
|
- if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1';
|
|
|
- $link='<a href="'.$_SERVER['PHP_SELF'];
|
|
|
- $link.='?'.$newparam;
|
|
|
- $link.='">';
|
|
|
- if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents");
|
|
|
- else $link.=$langs->trans("AgendaHideBirthdayEvents");
|
|
|
- $link.='</a>';
|
|
|
- }
|
|
|
- */
|
|
|
+$tabactive = 'cardlist';
|
|
|
|
|
|
- $s = $newtitle;
|
|
|
+$head = calendars_prepare_head($param);
|
|
|
|
|
|
- // Calendars from hooks
|
|
|
- $parameters = array(); $object = null;
|
|
|
- $reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action);
|
|
|
- if (empty($reshook)) {
|
|
|
- $s .= $hookmanager->resPrint;
|
|
|
- } elseif ($reshook > 1) {
|
|
|
- $s = $hookmanager->resPrint;
|
|
|
- }
|
|
|
+print '<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
|
|
|
|
|
- $viewmode = '';
|
|
|
- $viewmode .= '<a class="btnTitle btnTitleSelected reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
|
|
|
- //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
|
|
- $viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"');
|
|
|
- //$viewmode .= '</span>';
|
|
|
- $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
|
|
|
-
|
|
|
- $viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
|
|
- //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
|
|
- $viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"');
|
|
|
- //$viewmode .= '</span>';
|
|
|
- $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewCal").'</span></a>';
|
|
|
-
|
|
|
- $viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
|
|
- //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
|
|
- $viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
|
|
|
- //$viewmode .= '</span>';
|
|
|
- $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewWeek").'</span></a>';
|
|
|
-
|
|
|
- $viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
|
|
- //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
|
|
- $viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
|
|
|
- //$viewmode .= '</span>';
|
|
|
- $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewDay").'</span></a>';
|
|
|
-
|
|
|
- $viewmode .= '<a class="btnTitle reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
|
|
- //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
|
|
- $viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
|
|
|
- //$viewmode .= '</span>';
|
|
|
- $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewPerUser").'</span></a>';
|
|
|
-
|
|
|
- $viewmode .= '<span class="marginrightonly"></span>';
|
|
|
-
|
|
|
- // Add more views from hooks
|
|
|
- $parameters = array(); $object = null;
|
|
|
- $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
|
|
|
- if (empty($reshook)) {
|
|
|
- $viewmode .= $hookmanager->resPrint;
|
|
|
- } elseif ($reshook > 1) {
|
|
|
- $viewmode = $hookmanager->resPrint;
|
|
|
- }
|
|
|
+if ($optioncss != '') {
|
|
|
+ print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
+}
|
|
|
+print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
+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.'">';
|
|
|
+print '<input type="hidden" name="type" value="'.$type.'">';
|
|
|
+$nav = '';
|
|
|
|
|
|
- $tmpforcreatebutton = dol_getdate(dol_now(), true);
|
|
|
+if ($filter) {
|
|
|
+ $nav .= '<input type="hidden" name="search_filter" value="'.$filter.'">';
|
|
|
+}
|
|
|
+if ($showbirthday) {
|
|
|
+ $nav .= '<input type="hidden" name="search_showbirthday" value="1">';
|
|
|
+}
|
|
|
+print $nav;
|
|
|
|
|
|
- $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
|
|
|
+//print dol_get_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
|
|
+//print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
|
|
|
+//print dol_get_fiche_end();
|
|
|
|
|
|
- //$param='month='.$monthshown.'&year='.$year;
|
|
|
- $hourminsec = '100000';
|
|
|
+// Add link to show birthdays
|
|
|
+/*
|
|
|
+$link = '';
|
|
|
+if (empty($conf->use_javascript_ajax))
|
|
|
+{
|
|
|
+ $newparam=$param; // newparam is for birthday links
|
|
|
+ $newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam);
|
|
|
+ if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1';
|
|
|
+ $link='<a href="'.$_SERVER['PHP_SELF'];
|
|
|
+ $link.='?'.$newparam;
|
|
|
+ $link.='">';
|
|
|
+ if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents");
|
|
|
+ else $link.=$langs->trans("AgendaHideBirthdayEvents");
|
|
|
+ $link.='</a>';
|
|
|
+}
|
|
|
+*/
|
|
|
+
|
|
|
+$s = $newtitle;
|
|
|
+
|
|
|
+// Calendars from hooks
|
|
|
+$parameters = array(); $object = null;
|
|
|
+$reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action);
|
|
|
+if (empty($reshook)) {
|
|
|
+ $s .= $hookmanager->resPrint;
|
|
|
+} elseif ($reshook > 1) {
|
|
|
+ $s = $hookmanager->resPrint;
|
|
|
+}
|
|
|
+
|
|
|
+$viewmode = '';
|
|
|
+$viewmode .= '<a class="btnTitle btnTitleSelected reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
|
|
|
+//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
|
|
+$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"');
|
|
|
+//$viewmode .= '</span>';
|
|
|
+$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
|
|
|
+
|
|
|
+$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
|
|
+//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
|
|
+$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"');
|
|
|
+//$viewmode .= '</span>';
|
|
|
+$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewCal").'</span></a>';
|
|
|
+
|
|
|
+$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
|
|
+//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
|
|
+$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
|
|
|
+//$viewmode .= '</span>';
|
|
|
+$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewWeek").'</span></a>';
|
|
|
+
|
|
|
+$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
|
|
+//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
|
|
+$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
|
|
|
+//$viewmode .= '</span>';
|
|
|
+$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewDay").'</span></a>';
|
|
|
+
|
|
|
+$viewmode .= '<a class="btnTitle reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
|
|
+//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
|
|
+$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
|
|
|
+//$viewmode .= '</span>';
|
|
|
+$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewPerUser").'</span></a>';
|
|
|
+
|
|
|
+$viewmode .= '<span class="marginrightonly"></span>';
|
|
|
+
|
|
|
+// Add more views from hooks
|
|
|
+$parameters = array(); $object = null;
|
|
|
+$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
|
|
|
+if (empty($reshook)) {
|
|
|
+ $viewmode .= $hookmanager->resPrint;
|
|
|
+} elseif ($reshook > 1) {
|
|
|
+ $viewmode = $hookmanager->resPrint;
|
|
|
+}
|
|
|
|
|
|
- $url = DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
|
|
- $url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec;
|
|
|
- $url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''));
|
|
|
+$tmpforcreatebutton = dol_getdate(dol_now(), true);
|
|
|
|
|
|
- $newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create);
|
|
|
+$newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
|
|
|
|
|
|
- $param .= '&action='.$action;
|
|
|
+//$param='month='.$monthshown.'&year='.$year;
|
|
|
+$hourminsec = '100000';
|
|
|
|
|
|
- print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1 * $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode);
|
|
|
+$url = DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
|
|
+$url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec;
|
|
|
+$url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''));
|
|
|
|
|
|
- print $s;
|
|
|
+$newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create);
|
|
|
|
|
|
- $objecttmp = new ActionComm($db);
|
|
|
- include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
|
|
+$param .= '&action='.$action;
|
|
|
|
|
|
- $moreforfilter = '';
|
|
|
+print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1 * $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode);
|
|
|
|
|
|
- $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
|
|
- $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
|
|
- if ($massactionbutton) {
|
|
|
- $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
|
|
- }
|
|
|
- $i = 0;
|
|
|
+print $s;
|
|
|
|
|
|
- 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>';
|
|
|
+$objecttmp = new ActionComm($db);
|
|
|
+include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
|
|
|
|
|
- print '<div class="div-table-responsive">';
|
|
|
- print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
|
|
+$moreforfilter = '';
|
|
|
|
|
|
- print '<tr class="liste_titre_filter">';
|
|
|
- if (!empty($arrayfields['a.id']['checked'])) {
|
|
|
- print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.'"></td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['owner']['checked'])) {
|
|
|
- print '<td class="liste_titre"></td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['c.libelle']['checked'])) {
|
|
|
- print '<td class="liste_titre"></td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.label']['checked'])) {
|
|
|
- print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="'.$search_title.'"></td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.note']['checked'])) {
|
|
|
- print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_note" value="'.$search_note.'"></td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.datep']['checked'])) {
|
|
|
- print '<td class="liste_titre nowraponall" align="center">';
|
|
|
- print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.datep2']['checked'])) {
|
|
|
- print '<td class="liste_titre nowraponall" align="center">';
|
|
|
- print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['s.nom']['checked'])) {
|
|
|
- print '<td class="liste_titre"></td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.fk_contact']['checked'])) {
|
|
|
- print '<td class="liste_titre"></td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.fk_element']['checked'])) {
|
|
|
- print '<td class="liste_titre"></td>';
|
|
|
- }
|
|
|
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
|
|
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
|
|
+if ($massactionbutton) {
|
|
|
+ $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
|
|
+}
|
|
|
+$i = 0;
|
|
|
|
|
|
- // Extra fields
|
|
|
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
|
|
+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>';
|
|
|
|
|
|
- // Fields from hook
|
|
|
- $parameters = array('arrayfields'=>$arrayfields);
|
|
|
- $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
- print $hookmanager->resPrint;
|
|
|
+print '<div class="div-table-responsive">';
|
|
|
+print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
|
|
|
|
|
- if (!empty($arrayfields['a.datec']['checked'])) {
|
|
|
- print '<td class="liste_titre"></td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.tms']['checked'])) {
|
|
|
- print '<td class="liste_titre"></td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.percent']['checked'])) {
|
|
|
- print '<td class="liste_titre center">';
|
|
|
- $formactions->form_select_status_action('formaction', $search_status, 1, 'search_status', 1, 2, 'minwidth100imp maxwidth125');
|
|
|
- print ajax_combobox('selectsearch_status');
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
- // Action column
|
|
|
- print '<td class="liste_titre" align="middle">';
|
|
|
- $searchpicto = $form->showFilterButtons();
|
|
|
- print $searchpicto;
|
|
|
+print '<tr class="liste_titre_filter">';
|
|
|
+if (!empty($arrayfields['a.id']['checked'])) {
|
|
|
+ print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.'"></td>';
|
|
|
+}
|
|
|
+if (!empty($arrayfields['owner']['checked'])) {
|
|
|
+ print '<td class="liste_titre"></td>';
|
|
|
+}
|
|
|
+if (!empty($arrayfields['c.libelle']['checked'])) {
|
|
|
+ print '<td class="liste_titre"></td>';
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.label']['checked'])) {
|
|
|
+ print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="'.$search_title.'"></td>';
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.note']['checked'])) {
|
|
|
+ print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_note" value="'.$search_note.'"></td>';
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.datep']['checked'])) {
|
|
|
+ print '<td class="liste_titre nowraponall" align="center">';
|
|
|
+ print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
|
|
|
print '</td>';
|
|
|
- print "</tr>\n";
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.datep2']['checked'])) {
|
|
|
+ print '<td class="liste_titre nowraponall" align="center">';
|
|
|
+ print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
|
|
|
+ print '</td>';
|
|
|
+}
|
|
|
+if (!empty($arrayfields['s.nom']['checked'])) {
|
|
|
+ print '<td class="liste_titre"></td>';
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.fk_contact']['checked'])) {
|
|
|
+ print '<td class="liste_titre"></td>';
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.fk_element']['checked'])) {
|
|
|
+ print '<td class="liste_titre"></td>';
|
|
|
+}
|
|
|
|
|
|
- print '<tr class="liste_titre">';
|
|
|
- if (!empty($arrayfields['a.id']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder);
|
|
|
- }
|
|
|
- if (!empty($arrayfields['owner']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['owner']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
|
|
|
- }
|
|
|
- if (!empty($arrayfields['c.libelle']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", $param, "", "", $sortfield, $sortorder);
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.label']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['a.label']['label'], $_SERVER["PHP_SELF"], "a.label", $param, "", "", $sortfield, $sortorder);
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.note']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['a.note']['label'], $_SERVER["PHP_SELF"], "a.note", $param, "", "", $sortfield, $sortorder);
|
|
|
- }
|
|
|
- //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
|
|
- if (!empty($arrayfields['a.datep']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', 'align="center"', $sortfield, $sortorder);
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.datep2']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder);
|
|
|
- }
|
|
|
- if (!empty($arrayfields['s.nom']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $param, "", "", $sortfield, $sortorder);
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.fk_contact']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['a.fk_contact']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.fk_element']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
|
|
|
- }
|
|
|
+// Extra fields
|
|
|
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
|
|
|
|
|
- // Extra fields
|
|
|
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
|
|
+// Fields from hook
|
|
|
+$parameters = array('arrayfields'=>$arrayfields);
|
|
|
+$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
+print $hookmanager->resPrint;
|
|
|
|
|
|
- // Hook fields
|
|
|
- $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
|
|
- $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
- print $hookmanager->resPrint;
|
|
|
+if (!empty($arrayfields['a.datec']['checked'])) {
|
|
|
+ print '<td class="liste_titre"></td>';
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.tms']['checked'])) {
|
|
|
+ print '<td class="liste_titre"></td>';
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.percent']['checked'])) {
|
|
|
+ print '<td class="liste_titre center">';
|
|
|
+ $formactions->form_select_status_action('formaction', $search_status, 1, 'search_status', 1, 2, 'minwidth100imp maxwidth125');
|
|
|
+ print ajax_combobox('selectsearch_status');
|
|
|
+ print '</td>';
|
|
|
+}
|
|
|
+// Action column
|
|
|
+print '<td class="liste_titre" align="middle">';
|
|
|
+$searchpicto = $form->showFilterButtons();
|
|
|
+print $searchpicto;
|
|
|
+print '</td>';
|
|
|
+print "</tr>\n";
|
|
|
|
|
|
- if (!empty($arrayfields['a.datec']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.tms']['checked'])) {
|
|
|
- print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
|
|
|
- }
|
|
|
+print '<tr class="liste_titre">';
|
|
|
+if (!empty($arrayfields['a.id']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['owner']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['owner']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['c.libelle']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", $param, "", "", $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.label']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['a.label']['label'], $_SERVER["PHP_SELF"], "a.label", $param, "", "", $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.note']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['a.note']['label'], $_SERVER["PHP_SELF"], "a.note", $param, "", "", $sortfield, $sortorder);
|
|
|
+}
|
|
|
+//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
|
|
+if (!empty($arrayfields['a.datep']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', 'align="center"', $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.datep2']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['s.nom']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $param, "", "", $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.fk_contact']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['a.fk_contact']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.fk_element']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
|
|
|
+}
|
|
|
|
|
|
- if (!empty($arrayfields['a.percent']['checked'])) {
|
|
|
- print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder);
|
|
|
- }
|
|
|
- print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
|
|
- print "</tr>\n";
|
|
|
+// Extra fields
|
|
|
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
|
|
|
|
|
- $contactstatic = new Contact($db);
|
|
|
- $now = dol_now();
|
|
|
- $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
|
|
|
+// Hook fields
|
|
|
+$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
|
|
+$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
+print $hookmanager->resPrint;
|
|
|
|
|
|
- require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
|
|
|
- $caction = new CActionComm($db);
|
|
|
- $arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1);
|
|
|
- $contactListCache = array();
|
|
|
+if (!empty($arrayfields['a.datec']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['a.tms']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
|
|
|
+}
|
|
|
|
|
|
- while ($i < min($num, $limit)) {
|
|
|
- $obj = $db->fetch_object($resql);
|
|
|
+if (!empty($arrayfields['a.percent']['checked'])) {
|
|
|
+ print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder);
|
|
|
+}
|
|
|
+print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
|
|
+print "</tr>\n";
|
|
|
|
|
|
- // Discard auto action if option is on
|
|
|
- if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO') {
|
|
|
- $i++;
|
|
|
- continue;
|
|
|
- }
|
|
|
+$contactstatic = new Contact($db);
|
|
|
+$now = dol_now();
|
|
|
+$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
|
|
|
|
|
|
- $actionstatic->id = $obj->id;
|
|
|
- $actionstatic->ref = $obj->id;
|
|
|
- $actionstatic->code = $obj->code;
|
|
|
- $actionstatic->type_code = $obj->type_code;
|
|
|
- $actionstatic->type_label = $obj->type_label;
|
|
|
- $actionstatic->type_picto = $obj->type_picto;
|
|
|
- $actionstatic->type_color = $obj->type_color;
|
|
|
- $actionstatic->label = $obj->label;
|
|
|
- $actionstatic->location = $obj->location;
|
|
|
- $actionstatic->note_private = dol_htmlentitiesbr($obj->note);
|
|
|
-
|
|
|
- // Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
|
|
|
- // but only if we need it
|
|
|
- if (!empty($arrayfields['a.fk_contact']['checked'])) {
|
|
|
- $actionstatic->fetchResources();
|
|
|
- }
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
|
|
|
+$caction = new CActionComm($db);
|
|
|
+$arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1);
|
|
|
+$contactListCache = array();
|
|
|
|
|
|
- print '<tr class="oddeven">';
|
|
|
+while ($i < min($num, $limit)) {
|
|
|
+ $obj = $db->fetch_object($resql);
|
|
|
|
|
|
- // Ref
|
|
|
- if (!empty($arrayfields['a.id']['checked'])) {
|
|
|
- print '<td class="nowraponall">';
|
|
|
- print $actionstatic->getNomUrl(1, -1);
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
+ // Discard auto action if option is on
|
|
|
+ if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO') {
|
|
|
+ $i++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- // User owner
|
|
|
- if (!empty($arrayfields['owner']['checked'])) {
|
|
|
- print '<td class="tdoverflowmax150">'; // With edge and chrome the td overflow is not supported correctly when content is not full text.
|
|
|
- if ($obj->fk_user_action > 0) {
|
|
|
- $userstatic->fetch($obj->fk_user_action);
|
|
|
- print $userstatic->getNomUrl(-1);
|
|
|
- } else {
|
|
|
- print ' ';
|
|
|
- }
|
|
|
- print '</td>';
|
|
|
+ $actionstatic->id = $obj->id;
|
|
|
+ $actionstatic->ref = $obj->id;
|
|
|
+ $actionstatic->code = $obj->code;
|
|
|
+ $actionstatic->type_code = $obj->type_code;
|
|
|
+ $actionstatic->type_label = $obj->type_label;
|
|
|
+ $actionstatic->type_picto = $obj->type_picto;
|
|
|
+ $actionstatic->type_color = $obj->type_color;
|
|
|
+ $actionstatic->label = $obj->label;
|
|
|
+ $actionstatic->location = $obj->location;
|
|
|
+ $actionstatic->note_private = dol_htmlentitiesbr($obj->note);
|
|
|
+
|
|
|
+ // Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
|
|
|
+ // but only if we need it
|
|
|
+ if (!empty($arrayfields['a.fk_contact']['checked'])) {
|
|
|
+ $actionstatic->fetchResources();
|
|
|
+ }
|
|
|
+
|
|
|
+ print '<tr class="oddeven">';
|
|
|
+
|
|
|
+ // Ref
|
|
|
+ if (!empty($arrayfields['a.id']['checked'])) {
|
|
|
+ print '<td class="nowraponall">';
|
|
|
+ print $actionstatic->getNomUrl(1, -1);
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
+
|
|
|
+ // User owner
|
|
|
+ if (!empty($arrayfields['owner']['checked'])) {
|
|
|
+ print '<td class="tdoverflowmax150">'; // With edge and chrome the td overflow is not supported correctly when content is not full text.
|
|
|
+ if ($obj->fk_user_action > 0) {
|
|
|
+ $userstatic->fetch($obj->fk_user_action);
|
|
|
+ print $userstatic->getNomUrl(-1);
|
|
|
+ } else {
|
|
|
+ print ' ';
|
|
|
}
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
|
|
|
- // Type
|
|
|
- if (!empty($arrayfields['c.libelle']['checked'])) {
|
|
|
- print '<td class="nowraponall">';
|
|
|
- print $actionstatic->getTypePicto();
|
|
|
- $labeltype = $obj->type_code;
|
|
|
- if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
|
|
|
- $labeltype = 'AC_OTH';
|
|
|
+ // Type
|
|
|
+ if (!empty($arrayfields['c.libelle']['checked'])) {
|
|
|
+ print '<td class="nowraponall">';
|
|
|
+ print $actionstatic->getTypePicto();
|
|
|
+ $labeltype = $obj->type_code;
|
|
|
+ if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
|
|
|
+ $labeltype = 'AC_OTH';
|
|
|
+ }
|
|
|
+ if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
|
|
|
+ $labeltype = $langs->trans("Message");
|
|
|
+ } else {
|
|
|
+ if (!empty($arraylist[$labeltype])) {
|
|
|
+ $labeltype = $arraylist[$labeltype];
|
|
|
}
|
|
|
- if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
|
|
|
- $labeltype = $langs->trans("Message");
|
|
|
- } else {
|
|
|
- if (!empty($arraylist[$labeltype])) {
|
|
|
- $labeltype = $arraylist[$labeltype];
|
|
|
- }
|
|
|
- if ($obj->type_code == 'AC_OTH_AUTO' && ($obj->type_code != $obj->code) && $labeltype && !empty($arraylist[$obj->code])) {
|
|
|
- $labeltype .= ' - '.$arraylist[$obj->code]; // Use code in priority on type_code
|
|
|
- }
|
|
|
+ if ($obj->type_code == 'AC_OTH_AUTO' && ($obj->type_code != $obj->code) && $labeltype && !empty($arraylist[$obj->code])) {
|
|
|
+ $labeltype .= ' - '.$arraylist[$obj->code]; // Use code in priority on type_code
|
|
|
}
|
|
|
- print dol_trunc($labeltype, 28);
|
|
|
- print '</td>';
|
|
|
}
|
|
|
+ print dol_trunc($labeltype, 28);
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
|
|
|
- // Label
|
|
|
- if (!empty($arrayfields['a.label']['checked'])) {
|
|
|
- print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($actionstatic->label).'">';
|
|
|
- print $actionstatic->label;
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
+ // Label
|
|
|
+ if (!empty($arrayfields['a.label']['checked'])) {
|
|
|
+ print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($actionstatic->label).'">';
|
|
|
+ print $actionstatic->label;
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
|
|
|
- // Description
|
|
|
- if (!empty($arrayfields['a.note']['checked'])) {
|
|
|
- print '<td class="tdoverflowonsmartphone">';
|
|
|
- $text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0));
|
|
|
- print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private);
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
+ // Description
|
|
|
+ if (!empty($arrayfields['a.note']['checked'])) {
|
|
|
+ print '<td class="tdoverflowonsmartphone">';
|
|
|
+ $text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0));
|
|
|
+ print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private);
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
|
|
|
- $formatToUse = $obj->fulldayevent ? 'day' : 'dayhour';
|
|
|
+ $formatToUse = $obj->fulldayevent ? 'day' : 'dayhour';
|
|
|
|
|
|
- // Start date
|
|
|
- if (!empty($arrayfields['a.datep']['checked'])) {
|
|
|
- print '<td class="center nowraponall">';
|
|
|
- print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser');
|
|
|
- $late = 0;
|
|
|
- if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) {
|
|
|
- $late = 1;
|
|
|
- }
|
|
|
- if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) {
|
|
|
- $late = 1;
|
|
|
- }
|
|
|
- if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) {
|
|
|
- $late = 1;
|
|
|
- }
|
|
|
- if ($obj->percent > 0 && $obj->percent < 100 && !$obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) {
|
|
|
- $late = 1;
|
|
|
- }
|
|
|
- if ($late) {
|
|
|
- print img_warning($langs->trans("Late")).' ';
|
|
|
- }
|
|
|
- print '</td>';
|
|
|
+ // Start date
|
|
|
+ if (!empty($arrayfields['a.datep']['checked'])) {
|
|
|
+ print '<td class="center nowraponall">';
|
|
|
+ print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser');
|
|
|
+ $late = 0;
|
|
|
+ if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) {
|
|
|
+ $late = 1;
|
|
|
}
|
|
|
-
|
|
|
- // End date
|
|
|
- if (!empty($arrayfields['a.datep2']['checked'])) {
|
|
|
- print '<td class="center nowraponall">';
|
|
|
- print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser');
|
|
|
- print '</td>';
|
|
|
+ if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) {
|
|
|
+ $late = 1;
|
|
|
+ }
|
|
|
+ if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) {
|
|
|
+ $late = 1;
|
|
|
+ }
|
|
|
+ if ($obj->percent > 0 && $obj->percent < 100 && !$obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) {
|
|
|
+ $late = 1;
|
|
|
+ }
|
|
|
+ if ($late) {
|
|
|
+ print img_warning($langs->trans("Late")).' ';
|
|
|
}
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
|
|
|
- // Third party
|
|
|
- if (!empty($arrayfields['s.nom']['checked'])) {
|
|
|
- print '<td class="tdoverflowmax150">';
|
|
|
- if ($obj->socid > 0) {
|
|
|
- $societestatic->id = $obj->socid;
|
|
|
- $societestatic->client = $obj->client;
|
|
|
- $societestatic->name = $obj->societe;
|
|
|
- $societestatic->email = $obj->socemail;
|
|
|
+ // End date
|
|
|
+ if (!empty($arrayfields['a.datep2']['checked'])) {
|
|
|
+ print '<td class="center nowraponall">';
|
|
|
+ print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser');
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
|
|
|
- print $societestatic->getNomUrl(1, '', 28);
|
|
|
- } else {
|
|
|
- print ' ';
|
|
|
- }
|
|
|
- print '</td>';
|
|
|
+ // Third party
|
|
|
+ if (!empty($arrayfields['s.nom']['checked'])) {
|
|
|
+ print '<td class="tdoverflowmax150">';
|
|
|
+ if ($obj->socid > 0) {
|
|
|
+ $societestatic->id = $obj->socid;
|
|
|
+ $societestatic->client = $obj->client;
|
|
|
+ $societestatic->name = $obj->societe;
|
|
|
+ $societestatic->email = $obj->socemail;
|
|
|
+
|
|
|
+ print $societestatic->getNomUrl(1, '', 28);
|
|
|
+ } else {
|
|
|
+ print ' ';
|
|
|
}
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
|
|
|
- // Contact
|
|
|
- if (!empty($arrayfields['a.fk_contact']['checked'])) {
|
|
|
- print '<td class="tdoverflowmax100">';
|
|
|
-
|
|
|
- if (!empty($actionstatic->socpeopleassigned)) {
|
|
|
- $contactList = array();
|
|
|
- foreach ($actionstatic->socpeopleassigned as $socpeopleassigned) {
|
|
|
- if (!isset($contactListCache[$socpeopleassigned['id']])) {
|
|
|
- // if no cache found we fetch it
|
|
|
- $contact = new Contact($db);
|
|
|
- if ($contact->fetch($socpeopleassigned['id']) > 0) {
|
|
|
- $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1, '', 0);
|
|
|
- $contactList[] = $contact->getNomUrl(1, '', 0);
|
|
|
- }
|
|
|
- } else {
|
|
|
- // use cache
|
|
|
- $contactList[] = $contactListCache[$socpeopleassigned['id']];
|
|
|
+ // Contact
|
|
|
+ if (!empty($arrayfields['a.fk_contact']['checked'])) {
|
|
|
+ print '<td class="tdoverflowmax100">';
|
|
|
+
|
|
|
+ if (!empty($actionstatic->socpeopleassigned)) {
|
|
|
+ $contactList = array();
|
|
|
+ foreach ($actionstatic->socpeopleassigned as $socpeopleassigned) {
|
|
|
+ if (!isset($contactListCache[$socpeopleassigned['id']])) {
|
|
|
+ // if no cache found we fetch it
|
|
|
+ $contact = new Contact($db);
|
|
|
+ if ($contact->fetch($socpeopleassigned['id']) > 0) {
|
|
|
+ $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1, '', 0);
|
|
|
+ $contactList[] = $contact->getNomUrl(1, '', 0);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ // use cache
|
|
|
+ $contactList[] = $contactListCache[$socpeopleassigned['id']];
|
|
|
}
|
|
|
- if (!empty($contactList)) {
|
|
|
- print implode(', ', $contactList);
|
|
|
- }
|
|
|
- } elseif ($obj->fk_contact > 0) { //keep for retrocompatibility with faraway event
|
|
|
- $contactstatic->id = $obj->fk_contact;
|
|
|
- $contactstatic->email = $obj->email;
|
|
|
- $contactstatic->lastname = $obj->lastname;
|
|
|
- $contactstatic->firstname = $obj->firstname;
|
|
|
- $contactstatic->phone_pro = $obj->phone_pro;
|
|
|
- $contactstatic->phone_mobile = $obj->phone_mobile;
|
|
|
- $contactstatic->phone_perso = $obj->phone_perso;
|
|
|
- $contactstatic->country_id = $obj->country_id;
|
|
|
- print $contactstatic->getNomUrl(1, '', 0);
|
|
|
- } else {
|
|
|
- print " ";
|
|
|
}
|
|
|
- print '</td>';
|
|
|
- }
|
|
|
-
|
|
|
- // Linked object
|
|
|
- if (!empty($arrayfields['a.fk_element']['checked'])) {
|
|
|
- print '<td class="tdoverflowmax150">';
|
|
|
- //var_dump($obj->fkelement.' '.$obj->elementtype);
|
|
|
- if ($obj->fk_element > 0 && !empty($obj->elementtype)) {
|
|
|
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|
|
- print dolGetElementUrl($obj->fk_element, $obj->elementtype, 1);
|
|
|
- } else {
|
|
|
- print " ";
|
|
|
+ if (!empty($contactList)) {
|
|
|
+ print implode(', ', $contactList);
|
|
|
}
|
|
|
- print '</td>';
|
|
|
+ } elseif ($obj->fk_contact > 0) { //keep for retrocompatibility with faraway event
|
|
|
+ $contactstatic->id = $obj->fk_contact;
|
|
|
+ $contactstatic->email = $obj->email;
|
|
|
+ $contactstatic->lastname = $obj->lastname;
|
|
|
+ $contactstatic->firstname = $obj->firstname;
|
|
|
+ $contactstatic->phone_pro = $obj->phone_pro;
|
|
|
+ $contactstatic->phone_mobile = $obj->phone_mobile;
|
|
|
+ $contactstatic->phone_perso = $obj->phone_perso;
|
|
|
+ $contactstatic->country_id = $obj->country_id;
|
|
|
+ print $contactstatic->getNomUrl(1, '', 0);
|
|
|
+ } else {
|
|
|
+ print " ";
|
|
|
}
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
|
|
|
- // Extra fields
|
|
|
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
|
|
- // Fields from hook
|
|
|
- $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
|
|
- $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
- print $hookmanager->resPrint;
|
|
|
-
|
|
|
- // Date creation
|
|
|
- if (!empty($arrayfields['a.datec']['checked'])) {
|
|
|
- // Status/Percent
|
|
|
- print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datec), 'dayhour', 'tzuser').'</td>';
|
|
|
- }
|
|
|
- // Date update
|
|
|
- if (!empty($arrayfields['a.tms']['checked'])) {
|
|
|
- print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datem), 'dayhour', 'tzuser').'</td>';
|
|
|
- }
|
|
|
- if (!empty($arrayfields['a.percent']['checked'])) {
|
|
|
- // Status/Percent
|
|
|
- $datep = $db->jdate($obj->dp);
|
|
|
- print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent, 5, 0, $datep).'</td>';
|
|
|
- }
|
|
|
- // Action column
|
|
|
- print '<td class="nowrap center">';
|
|
|
- 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->id, $arrayofselected)) {
|
|
|
- $selected = 1;
|
|
|
- }
|
|
|
- print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
|
|
+ // Linked object
|
|
|
+ if (!empty($arrayfields['a.fk_element']['checked'])) {
|
|
|
+ print '<td class="tdoverflowmax150">';
|
|
|
+ //var_dump($obj->fkelement.' '.$obj->elementtype);
|
|
|
+ if ($obj->fk_element > 0 && !empty($obj->elementtype)) {
|
|
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|
|
+ print dolGetElementUrl($obj->fk_element, $obj->elementtype, 1);
|
|
|
+ } else {
|
|
|
+ print " ";
|
|
|
}
|
|
|
print '</td>';
|
|
|
+ }
|
|
|
|
|
|
- print "</tr>\n";
|
|
|
- $i++;
|
|
|
+ // Extra fields
|
|
|
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
|
|
+ // Fields from hook
|
|
|
+ $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
|
|
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
+ print $hookmanager->resPrint;
|
|
|
+
|
|
|
+ // Date creation
|
|
|
+ if (!empty($arrayfields['a.datec']['checked'])) {
|
|
|
+ // Status/Percent
|
|
|
+ print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datec), 'dayhour', 'tzuser').'</td>';
|
|
|
}
|
|
|
- print "</table>";
|
|
|
- print '</div>';
|
|
|
- print '</form>';
|
|
|
+ // Date update
|
|
|
+ if (!empty($arrayfields['a.tms']['checked'])) {
|
|
|
+ print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datem), 'dayhour', 'tzuser').'</td>';
|
|
|
+ }
|
|
|
+ if (!empty($arrayfields['a.percent']['checked'])) {
|
|
|
+ // Status/Percent
|
|
|
+ $datep = $db->jdate($obj->dp);
|
|
|
+ print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent, 5, 0, $datep).'</td>';
|
|
|
+ }
|
|
|
+ // Action column
|
|
|
+ print '<td class="nowrap center">';
|
|
|
+ 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->id, $arrayofselected)) {
|
|
|
+ $selected = 1;
|
|
|
+ }
|
|
|
+ print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
|
|
+ }
|
|
|
+ print '</td>';
|
|
|
|
|
|
- $db->free($resql);
|
|
|
-} else {
|
|
|
- dol_print_error($db);
|
|
|
+ print "</tr>\n";
|
|
|
+ $i++;
|
|
|
}
|
|
|
+print "</table>";
|
|
|
+print '</div>';
|
|
|
+print '</form>';
|
|
|
+
|
|
|
+$db->free($resql);
|
|
|
|
|
|
// End of page
|
|
|
llxFooter();
|