50 function print_actions_filter(
$form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals = array(), $actioncode =
'', $usergroupid =
'', $excludetype =
'', $resourceid = 0)
52 global $conf, $user, $langs, $db, $hookmanager;
53 global $begin_h, $end_h, $begin_d, $end_d;
56 $langs->load(
"companies");
58 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
63 print
'<input type="hidden" name="token" value="'.newToken().
'">';
64 print
'<input type="hidden" name="year" value="'.((int) $year).
'">';
65 print
'<input type="hidden" name="month" value="'.((int) $month).
'">';
66 print
'<input type="hidden" name="day" value="'.((int) $day).
'">';
67 if ($massaction !=
'predelete' && $massaction !=
'preaffecttag') {
68 print
'<input type="hidden" name="action" value="'.$action.
'">';
70 print
'<input type="hidden" name="search_showbirthday" value="'.((int) $showbirthday).
'">';
73 print
'<div class="divsearchfield">';
76 if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) {
77 $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
79 print
img_picto($langs->trans(
"ActionType"),
'square',
'class="pictofixedwidth inline-block" style="color: #ddd;"');
80 print
$formactions->select_type_actions($actioncode,
"search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect, 0,
'maxwidth500 widthcentpercentminusx');
84 print
'<div class="divsearchfield">';
85 print
img_picto($langs->trans(
"ActionsToDoBy"),
'user',
'class="pictofixedwidth inline-block"');
86 print
$form->select_dolusers($filtert,
'search_filtert', 1,
'', !$canedit,
'',
'', 0, 0, 0,
'', 0,
'',
'minwidth150 maxwidth500 widthcentpercentminusxx');
90 print
'<div class="divsearchfield">';
91 print
img_picto($langs->trans(
"ToUserOfGroup"),
'object_group',
'class="pictofixedwidth inline-block"');
92 print
$form->select_dolgroups($usergroupid,
'usergroup', 1,
'', !$canedit,
'',
'',
'0',
false,
'minwidth100 maxwidth500 widthcentpercentminusxx');
96 include_once DOL_DOCUMENT_ROOT.
'/resource/class/html.formresource.class.php';
100 print
'<div class="divsearchfield">';
101 print
img_picto($langs->trans(
"Resource"),
'object_resource',
'class="pictofixedwidth inline-block"');
102 print $formresource->select_resource_list($resourceid,
"search_resourceid",
'', 1, 0, 0,
null,
'', 2, 0,
'maxwidth500');
107 if (
isModEnabled(
'societe') && !empty($user->rights->societe->lire)) {
108 print
'<div class="divsearchfield">';
109 print
img_picto($langs->trans(
"ThirdParty"),
'company',
'class="pictofixedwidth inline-block"');
110 print
$form->select_company($socid,
'search_socid',
'',
' ', 0, 0,
null, 0,
'minwidth100 maxwidth500');
114 if (
isModEnabled(
'projet') && !empty($user->rights->projet->lire)) {
115 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
118 print
'<div class="divsearchfield">';
119 print
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth inline-block"');
120 print $formproject->select_projects($socid ? $socid : -1, $pid,
'search_projectid', 0, 0, 1, 0, 0, 0, 0,
'', 1, 0,
'maxwidth500');
124 if ($canedit && !preg_match(
'/list/', $_SERVER[
"PHP_SELF"])) {
126 print
'<div class="divsearchfield">';
127 print
img_picto($langs->trans(
"Status"),
'setup',
'class="pictofixedwidth inline-block"');
128 $formactions->form_select_status_action(
'formaction', $status, 1,
'search_status', 1, 2,
'minwidth100');
133 $parameters = array(
'canedit'=>$canedit,
'pid'=>$pid,
'socid'=>$socid);
135 $reshook = $hookmanager->executeHooks(
'searchAgendaFrom', $parameters, $object, $action);
137 print
'<div style="clear:both"></div>';
149 global $langs, $conf, $user, $db, $socid;
153 include_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
154 include_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
156 $sql =
"SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent";
157 $sql .=
", c.code, c.libelle as type_label";
158 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
159 $sql .=
", s.code_client, s.code_compta, s.client";
160 $sql .=
", s.logo, s.email, s.entity";
161 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as a LEFT JOIN ";
162 $sql .=
" ".MAIN_DB_PREFIX.
"c_actioncomm as c ON c.id = a.fk_action";
163 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON a.fk_soc = s.rowid";
164 if (empty($user->rights->societe->client->voir) && !$socid) {
165 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
167 $sql .=
" WHERE a.entity IN (".getEntity(
'agenda').
")";
168 $sql .=
" AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now).
"'))";
169 if (empty($user->rights->societe->client->voir) && !$socid) {
170 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
173 $sql .=
" AND s.rowid = ".((int) $socid);
175 $sql .=
" ORDER BY a.datep DESC, a.id DESC";
176 $sql .= $db->plimit($max, 0);
178 $resql = $db->query($sql);
180 $num = $db->num_rows(
$resql);
182 print
'<div class="div-table-responsive-no-min">';
183 print
'<table class="noborder centpercent">';
184 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"LastActionsToDo", $max).
'</th>';
185 print
'<th colspan="2" class="right"><a class="commonlink" href="'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&status=todo">'.$langs->trans(
"FullList").
'</a></th>';
191 $customerstatic =
new Client($db);
194 $obj = $db->fetch_object(
$resql);
197 print
'<tr class="oddeven">';
199 $staticaction->type_code = $obj->code;
200 $staticaction->label = ($obj->label ? $obj->label : $obj->type_label);
201 $staticaction->id = $obj->id;
202 print
'<td>'.$staticaction->getNomUrl(1, 34).
'</td>';
207 if ($obj->socid > 0) {
208 $customerstatic->id = $obj->socid;
209 $customerstatic->name = $obj->name;
211 $customerstatic->code_client = $obj->code_client;
212 $customerstatic->code_compta = $obj->code_compta;
213 $customerstatic->client = $obj->client;
214 $customerstatic->logo = $obj->logo;
215 $customerstatic->email = $obj->email;
216 $customerstatic->entity = $obj->entity;
217 print $customerstatic->getNomUrl(1,
'', 40);
221 $datep = $db->jdate($obj->dp);
222 $datep2 = $db->jdate($obj->dp2);
225 print
'<td width="100" class="right tddate">'.dol_print_date($datep,
'day').
' ';
227 if ($obj->percent == 0 && $datep && $datep < time()) {
230 if ($obj->percent == 0 && !$datep && $datep2 && $datep2 < time()) {
233 if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) {
236 if ($obj->percent > 0 && $obj->percent < 100 && !$datep2 && $datep && $datep < time()) {
245 print
'<td class="right" width="14">'.$staticaction->LibStatut($obj->percent, 3).
"</td>\n";
251 print
"</table></div><br>";
268 global $langs, $conf, $user, $db, $socid;
272 $sql =
"SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label";
273 $sql .=
", c.code, c.libelle";
274 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
275 $sql .=
", s.code_client, s.code_compta, s.client";
276 $sql .=
", s.logo, s.email, s.entity";
277 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as a LEFT JOIN ";
278 $sql .=
" ".MAIN_DB_PREFIX.
"c_actioncomm as c ON c.id = a.fk_action ";
279 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON a.fk_soc = s.rowid";
280 if (empty($user->rights->societe->client->voir) && !$socid) {
281 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
283 $sql .=
" WHERE a.entity IN (".getEntity(
'agenda').
")";
284 $sql .=
" AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now).
"'))";
285 if (empty($user->rights->societe->client->voir) && !$socid) {
286 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
289 $sql .=
" AND s.rowid = ".((int) $socid);
291 $sql .=
" ORDER BY a.datep2 DESC";
292 $sql .= $db->plimit($max, 0);
294 $resql = $db->query($sql);
296 $num = $db->num_rows(
$resql);
298 print
'<div class="div-table-responsive-no-min">';
299 print
'<table class="noborder centpercent">';
300 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"LastDoneTasks", $max).
'</th>';
301 print
'<th colspan="2" class="right"><a class="commonlink" href="'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&status=done">'.$langs->trans(
"FullList").
'</a></th>';
307 $customerstatic =
new Societe($db);
310 $obj = $db->fetch_object(
$resql);
313 print
'<tr class="oddeven">';
315 $staticaction->type_code = $obj->code;
316 $staticaction->libelle = $obj->label;
317 $staticaction->id = $obj->id;
318 print
'<td>'.$staticaction->getNomUrl(1, 34).
'</td>';
323 if ($obj->socid > 0) {
324 $customerstatic->id = $obj->socid;
325 $customerstatic->name = $obj->name;
327 $customerstatic->code_client = $obj->code_client;
328 $customerstatic->code_compta = $obj->code_compta;
329 $customerstatic->client = $obj->client;
330 $customerstatic->logo = $obj->logo;
331 $customerstatic->email = $obj->email;
332 $customerstatic->entity = $obj->entity;
333 print $customerstatic->getNomUrl(1,
'', 30);
338 print
'<td width="100" class="right tddate">'.dol_print_date($db->jdate($obj->da2),
'day');
342 print
'<td class="right" width="14">'.$staticaction->LibStatut($obj->percent, 3).
"</td>\n";
349 print
"</table></div><br>";
365 global $langs, $conf, $user;
369 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda_other.php";
370 $head[$h][1] = $langs->trans(
"Miscellaneous");
371 $head[$h][2] =
'other';
374 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda.php";
375 $head[$h][1] = $langs->trans(
"AutoActions");
376 $head[$h][2] =
'autoactions';
379 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda_reminder.php";
380 $head[$h][1] = $langs->trans(
"Reminders");
381 $head[$h][2] =
'reminders';
384 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda_xcal.php";
385 $head[$h][1] = $langs->trans(
"ExportCal");
386 $head[$h][2] =
'xcal';
389 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda_extsites.php";
390 $head[$h][1] = $langs->trans(
"ExtSites");
391 $head[$h][2] =
'extsites';
396 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda_extrafields.php";
397 $head[$h][1] = $langs->trans(
"ExtraFields");
398 $head[$h][2] =
'attributes';
415 global $db, $langs, $conf, $user;
420 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/card.php?id='.$object->id;
421 $head[$h][1] = $langs->trans(
"CardAction");
422 $head[$h][2] =
'card';
427 include_once DOL_DOCUMENT_ROOT.
'/resource/class/dolresource.class.php';
428 $resource =
new DolResource($db);
430 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=action&element_id='.$object->id;
431 $listofresourcelinked = $resource->getElementResources($object->element, $object->id);
432 $nbResources = (is_array($listofresourcelinked) ?count($listofresourcelinked) : 0);
433 $head[$h][1] = $langs->trans(
"Resources");
434 if ($nbResources > 0) {
435 $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ?
'<span class="badge marginleftonlyshort">'.($nbResources).
'</span>' :
'');
437 $head[$h][2] =
'resources';
442 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
443 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
444 $upload_dir = $conf->agenda->dir_output.
"/".$object->id;
445 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
446 $nbLinks =
Link::count($db, $object->element, $object->id);
447 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/document.php?id='.$object->id;
448 $head[$h][1] = $langs->trans(
"Documents");
449 if (($nbFiles + $nbLinks) > 0) {
450 $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ?
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>' :
'');
452 $head[$h][2] =
'documents';
455 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/info.php?id='.$object->id;
456 $head[$h][1] = $langs->trans(
'Info');
457 $head[$h][2] =
'info';
476 global $langs, $conf, $user;
481 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list'.($param ?
'&'.$param :
'');
482 $head[$h][1] = $langs->trans(
"ViewList");
483 $head[$h][2] =
'cardlist';
486 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/index.php?mode=show_month'.($param ?
'&'.$param :
'');
487 $head[$h][1] = $langs->trans(
"ViewCal");
488 $head[$h][2] =
'cardmonth';
491 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/index.php?mode=show_week'.($param ?
'&'.$param :
'');
492 $head[$h][1] = $langs->trans(
"ViewWeek");
493 $head[$h][2] =
'cardweek';
496 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/index.php?mode=show_day'.($param ?
'&'.$param :
'');
497 $head[$h][1] = $langs->trans(
"ViewDay");
498 $head[$h][2] =
'cardday';
502 if (!empty($conf->global->AGENDA_SHOW_PERTYPE)) {
503 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/pertype.php'.($param ?
'?'.$param :
'');
504 $head[$h][1] = $langs->trans(
"ViewPerType");
505 $head[$h][2] =
'cardpertype';
510 $newparam = preg_replace(
'/&?search_filtert=\d+/',
'', $newparam);
511 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/peruser.php'.($newparam ?
'?'.$newparam :
'');
512 $head[$h][1] = $langs->trans(
"ViewPerUser");
513 $head[$h][2] =
'cardperuser';