67 $showextcals = array(),
74 global $user, $langs, $db, $hookmanager;
77 $langs->load(
"companies");
79 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
84 print
'<input type="hidden" name="token" value="'.newToken().
'">';
85 print
'<input type="hidden" name="year" value="'.((int) $year).
'">';
86 print
'<input type="hidden" name="month" value="'.((int) $month).
'">';
87 print
'<input type="hidden" name="day" value="'.((int) $day).
'">';
88 if ($massaction !=
'predelete' && $massaction !=
'preaffecttag') {
89 print
'<input type="hidden" name="action" value="'.$action.
'">';
91 print
'<input type="hidden" name="search_showbirthday" value="'.((int) $showbirthday).
'">';
93 print
'<div class="divsearchfield">';
99 print
img_picto($langs->trans(
"ActionType"),
'square',
'class="pictofixedwidth inline-block" style="color: #ddd;"');
100 print $formactions->select_type_actions($actioncode,
"search_actioncode", $excludetype, (
getDolGlobalString(
'AGENDA_USE_EVENT_TYPE') ? -1 : 1), 0, $multiselect, 0,
'minwidth150 maxwidth200 widthcentpercentminusx', 1);
105 print
'<div class="divsearchfield">';
106 print
img_picto($langs->trans(
"ActionsToDoBy"),
'user',
'class="pictofixedwidth inline-block"');
107 print $form->select_dolusers($filtert,
'search_filtert', 1,
'', !$canedit,
'',
'', 0, 0, 0,
'', 0,
'',
'minwidth100 maxwidth250 widthcentpercentminusx');
111 print
'<div class="divsearchfield">';
112 print
img_picto($langs->trans(
"ToUserOfGroup"),
'object_group',
'class="pictofixedwidth inline-block"');
113 print $form->select_dolgroups($usergroupid,
'usergroup', 1,
'', !$canedit,
'',
'',
'0',
false,
'minwidth100 maxwidth250 widthcentpercentminusx');
116 if (isModEnabled(
'resource')) {
117 include_once DOL_DOCUMENT_ROOT.
'/resource/class/html.formresource.class.php';
121 print
'<div class="divsearchfield">';
122 print
img_picto($langs->trans(
"Resource"),
'object_resource',
'class="pictofixedwidth inline-block"');
123 print $formresource->select_resource_list($resourceid,
"search_resourceid", [], 1, 0, 0, [], [], 2, 0,
'minwidth100 maxwidth250 widthcentpercentminusx');
128 if (isModEnabled(
'societe') && $user->hasRight(
'societe',
'lire')) {
129 print
'<div class="divsearchfield">';
130 print
img_picto($langs->trans(
"ThirdParty"),
'company',
'class="pictofixedwidth inline-block"');
131 print $form->select_company($socid,
'search_socid',
'',
' ', 0, 0,
null, 0,
'minwidth100 maxwidth250 widthcentpercentminusx');
135 if (isModEnabled(
'project') && $user->hasRight(
'projet',
'lire')) {
136 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
139 print
'<div class="divsearchfield">';
140 print
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth inline-block"');
141 print $formproject->select_projects($socid ? $socid : -1, $pid,
'search_projectid', 0, 0, 1, 0, 0, 0, 0,
'', 1, 0,
'minwidth100 maxwidth250 widthcentpercentminusx');
145 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
146 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
147 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
149 $langs->load(
'categories');
151 print
'<div class="divsearchfield">';
152 print
img_picto($langs->trans(
'Categories'),
'category',
'class="pictofixedwidth"');
153 print $formother->select_categories(
'actioncomm', $search_categ_cus,
'search_categ_cus', 1, $langs->trans(
'ActionCommCategoriesArea'),
'minwidth100 maxwidth250 widthcentpercentminusx');
157 if ($canedit && !preg_match(
'/list/', $_SERVER[
"PHP_SELF"])) {
159 print
'<div class="divsearchfield">';
160 print
img_picto($langs->trans(
"Status"),
'status',
'class="pictofixedwidth inline-block"');
161 $formactions->form_select_status_action(
'formaction', $status, 1,
'search_status', 1, 2,
'minwidth100');
166 $parameters = array(
'canedit' => $canedit,
'pid' => $pid,
'socid' => $socid);
168 $reshook = $hookmanager->executeHooks(
'searchAgendaFrom', $parameters,
$object, $action);
170 print
'<div class="clearboth"></div>';
182 global $langs, $conf, $user, $db, $socid;
186 include_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
187 include_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
189 $sql =
"SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent";
190 $sql .=
", c.code, c.libelle as type_label";
191 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
192 $sql .=
", s.code_client, s.code_compta, s.client";
193 $sql .=
", s.logo, s.email, s.entity";
194 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as a LEFT JOIN ";
195 $sql .=
" ".MAIN_DB_PREFIX.
"c_actioncomm as c ON c.id = a.fk_action";
196 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON a.fk_soc = s.rowid";
197 if (!$user->hasRight(
'societe',
'client',
'voir')) {
198 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
200 $sql .=
" WHERE a.entity IN (".getEntity(
'agenda').
")";
201 $sql .=
" AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now).
"'))";
202 if (!$user->hasRight(
'societe',
'client',
'voir')) {
203 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
206 $sql .=
" AND s.rowid = ".((int) $socid);
208 $sql .=
" ORDER BY a.datep DESC, a.id DESC";
209 $sql .= $db->plimit($max, 0);
211 $resql = $db->query($sql);
213 $num = $db->num_rows($resql);
215 print
'<div class="div-table-responsive-no-min">';
216 print
'<table class="noborder centpercent">';
217 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"LastActionsToDo", $max).
'</th>';
218 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>';
224 $customerstatic =
new Client($db);
227 $obj = $db->fetch_object($resql);
230 print
'<tr class="oddeven">';
232 $staticaction->type_code = $obj->code;
233 $staticaction->label = ($obj->label ? $obj->label : $obj->type_label);
234 $staticaction->id = $obj->id;
235 print
'<td>'.$staticaction->getNomUrl(1, 34).
'</td>';
240 if ($obj->socid > 0) {
241 $customerstatic->id = $obj->socid;
242 $customerstatic->name = $obj->name;
244 $customerstatic->code_client = $obj->code_client;
245 $customerstatic->code_compta = $obj->code_compta;
246 $customerstatic->code_compta_client = $obj->code_compta;
247 $customerstatic->client = $obj->client;
248 $customerstatic->logo = $obj->logo;
249 $customerstatic->email = $obj->email;
250 $customerstatic->entity = $obj->entity;
251 print $customerstatic->getNomUrl(1,
'', 40);
255 $datep = $db->jdate($obj->dp);
256 $datep2 = $db->jdate($obj->dp2);
259 print
'<td width="100" class="right tddate">'.dol_print_date($datep,
'day').
' ';
261 if ($obj->percent == 0 && $datep && $datep < time()) {
264 if ($obj->percent == 0 && !$datep && $datep2 && $datep2 < time()) {
267 if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) {
270 if ($obj->percent > 0 && $obj->percent < 100 && !$datep2 && $datep && $datep < time()) {
279 print
'<td class="right" width="14">'.$staticaction->LibStatut($obj->percent, 3).
"</td>\n";
285 print
"</table></div><br>";
302 global $langs, $conf, $user, $db, $socid;
306 $sql =
"SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label";
307 $sql .=
", c.code, c.libelle";
308 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
309 $sql .=
", s.code_client, s.code_compta, s.client";
310 $sql .=
", s.logo, s.email, s.entity";
311 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as a LEFT JOIN ";
312 $sql .=
" ".MAIN_DB_PREFIX.
"c_actioncomm as c ON c.id = a.fk_action ";
313 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON a.fk_soc = s.rowid";
314 if (!$user->hasRight(
'societe',
'client',
'voir')) {
315 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
317 $sql .=
" WHERE a.entity IN (".getEntity(
'agenda').
")";
318 $sql .=
" AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now).
"'))";
319 if (!$user->hasRight(
'societe',
'client',
'voir')) {
320 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
323 $sql .=
" AND s.rowid = ".((int) $socid);
325 $sql .=
" ORDER BY a.datep2 DESC";
326 $sql .= $db->plimit($max, 0);
328 $resql = $db->query($sql);
330 $num = $db->num_rows($resql);
332 print
'<div class="div-table-responsive-no-min">';
333 print
'<table class="noborder centpercent">';
334 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"LastDoneTasks", $max).
'</th>';
335 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>';
341 $customerstatic =
new Societe($db);
344 $obj = $db->fetch_object($resql);
347 print
'<tr class="oddeven">';
349 $staticaction->type_code = $obj->code;
350 $staticaction->label = $obj->label;
351 $staticaction->id = $obj->id;
352 print
'<td>'.$staticaction->getNomUrl(1, 34).
'</td>';
357 if ($obj->socid > 0) {
358 $customerstatic->id = $obj->socid;
359 $customerstatic->name = $obj->name;
361 $customerstatic->code_client = $obj->code_client;
362 $customerstatic->code_compta = $obj->code_compta;
363 $customerstatic->code_compta_client = $obj->code_compta;
364 $customerstatic->client = $obj->client;
365 $customerstatic->logo = $obj->logo;
366 $customerstatic->email = $obj->email;
367 $customerstatic->entity = $obj->entity;
368 print $customerstatic->getNomUrl(1,
'', 30);
373 print
'<td width="100" class="right tddate">'.dol_print_date($db->jdate($obj->da2),
'day');
377 print
'<td class="right" width="14">'.$staticaction->LibStatut($obj->percent, 3).
"</td>\n";
384 print
"</table></div><br>";
400 global $langs, $conf, $user, $db;
403 $extrafields->fetch_name_optionals_label(
'actioncomm');
408 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda_other.php";
409 $head[$h][1] = $langs->trans(
"Miscellaneous");
410 $head[$h][2] =
'other';
413 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda.php";
414 $head[$h][1] = $langs->trans(
"AutoActions");
415 $head[$h][2] =
'autoactions';
418 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda_reminder.php";
419 $head[$h][1] = $langs->trans(
"Reminders");
420 $head[$h][2] =
'reminders';
423 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda_xcal.php";
424 $head[$h][1] = $langs->trans(
"ExportCal");
425 $head[$h][2] =
'xcal';
428 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda_extsites.php";
429 $head[$h][1] = $langs->trans(
"ExtSites");
430 $head[$h][2] =
'extsites';
435 $head[$h][0] = DOL_URL_ROOT.
"/admin/agenda_extrafields.php";
436 $head[$h][1] = $langs->trans(
"ExtraFields");
437 $nbExtrafields = $extrafields->attributes[
'actioncomm'][
'count'];
438 if ($nbExtrafields > 0) {
439 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
441 $head[$h][2] =
'attributes';
458 global $db, $langs, $conf, $user;
463 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/card.php?id='.
$object->id;
464 $head[$h][1] = $langs->trans(
"CardAction");
465 $head[$h][2] =
'card';
469 if (isModEnabled(
'resource')) {
470 include_once DOL_DOCUMENT_ROOT.
'/resource/class/dolresource.class.php';
473 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=action&element_id='.
$object->id;
474 $listofresourcelinked = $resource->getElementResources(
$object->element,
$object->id);
475 $nbResources = (is_array($listofresourcelinked) ? count($listofresourcelinked) : 0);
476 $head[$h][1] = $langs->trans(
"Resources");
477 if ($nbResources > 0) {
478 $head[$h][1] .= (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">'.($nbResources).
'</span>' :
'');
480 $head[$h][2] =
'resources';
485 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
486 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
487 $upload_dir = $conf->agenda->dir_output.
"/".
$object->id;
488 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
490 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/document.php?id='.
$object->id;
491 $head[$h][1] = $langs->trans(
"Documents");
492 if (($nbFiles + $nbLinks) > 0) {
493 $head[$h][1] .= (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>' :
'');
495 $head[$h][2] =
'documents';
498 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/info.php?id='.
$object->id;
499 $head[$h][1] = $langs->trans(
'Info');
500 $head[$h][2] =
'info';
519 global $langs, $conf, $user;
524 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list'.($param ?
'&'.$param :
'');
525 $head[$h][1] = $langs->trans(
"ViewList");
526 $head[$h][2] =
'cardlist';
529 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/index.php?mode=show_month'.($param ?
'&'.$param :
'');
530 $head[$h][1] = $langs->trans(
"ViewCal");
531 $head[$h][2] =
'cardmonth';
534 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/index.php?mode=show_week'.($param ?
'&'.$param :
'');
535 $head[$h][1] = $langs->trans(
"ViewWeek");
536 $head[$h][2] =
'cardweek';
539 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/index.php?mode=show_day'.($param ?
'&'.$param :
'');
540 $head[$h][1] = $langs->trans(
"ViewDay");
541 $head[$h][2] =
'cardday';
546 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/pertype.php'.($param ?
'?'.$param :
'');
547 $head[$h][1] = $langs->trans(
"ViewPerType");
548 $head[$h][2] =
'cardpertype';
553 $newparam = preg_replace(
'/&?search_filtert=\d+/',
'', $newparam);
554 $head[$h][0] = DOL_URL_ROOT.
'/comm/action/peruser.php'.($newparam ?
'?'.$newparam :
'');
555 $head[$h][1] = $langs->trans(
"ViewPerUser");
556 $head[$h][2] =
'cardperuser';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
show_array_actions_to_do($max=5)
Show actions to do array.
print_actions_filter( $form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filtered, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid=0, $excludetype='', $resourceid=0, $search_categ_cus=0)
Show filter form in agenda view.
show_array_last_actions_done($max=5)
Show last actions array.
calendars_prepare_head($param)
Define head array for tabs of agenda setup pages.
agenda_prepare_head()
Prepare array with list of tabs.
actions_prepare_head($object)
Prepare array with list of tabs.
Class to manage agenda events (actions)
Class to manage customers or prospects.
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_now($mode='auto')
Return date for now.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.