68 $showextcals = array(),
73 $search_categ_cus = 0,
74 $search_import_key =
''
76 global $user, $langs, $db, $hookmanager;
79 $langs->load(
"companies");
81 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
86 print
'<input type="hidden" name="token" value="'.newToken().
'">';
87 print
'<input type="hidden" name="year" value="'.((int) $year).
'">';
88 print
'<input type="hidden" name="month" value="'.((int) $month).
'">';
89 print
'<input type="hidden" name="day" value="'.((int) $day).
'">';
90 if ($massaction !=
'predelete' && $massaction !=
'preaffecttag') {
91 print
'<input type="hidden" name="action" value="'.$action.
'">';
93 print
'<input type="hidden" name="search_showbirthday" value="'.((int) $showbirthday).
'">';
95 print
'<div class="divsearchfield">';
101 print
img_picto($langs->trans(
"ActionType"),
'square',
'class="pictofixedwidth inline-block" style="color: #ddd;"');
102 print $formactions->select_type_actions($actioncode,
"search_actioncode", $excludetype, (
getDolGlobalString(
'AGENDA_USE_EVENT_TYPE') ? -1 : 1), 0, $multiselect, 0,
'minwidth150 maxwidth200 widthcentpercentminusx', 1);
107 print
'<div class="divsearchfield">';
108 print
img_picto($langs->trans(
"ActionsToDoBy"),
'user',
'class="pictofixedwidth inline-block"');
109 print $form->select_dolusers($filtert,
'search_filtert', 1,
null, (
int) !$canedit,
'',
'',
'0', 0, 0,
'', 2,
'',
'minwidth100 maxwidth250 widthcentpercentminusx');
113 print
'<div class="divsearchfield">';
114 print
img_picto($langs->trans(
"ToUserOfGroup"),
'object_group',
'class="pictofixedwidth inline-block"');
115 print $form->select_dolgroups($usergroupid,
'usergroup', 1,
'', (
int) !$canedit,
'', array(),
'0',
false,
'minwidth100 maxwidth250 widthcentpercentminusx');
119 include_once DOL_DOCUMENT_ROOT.
'/resource/class/html.formresource.class.php';
123 print
'<div class="divsearchfield">';
124 print
img_picto($langs->trans(
"Resource"),
'object_resource',
'class="pictofixedwidth inline-block"');
125 print $formresource->select_resource_list($resourceid,
"search_resourceid",
'', 1, 0, 0, [],
'', 2, 0,
'minwidth100 maxwidth250 widthcentpercentminusx');
130 if (
isModEnabled(
'societe') && $user->hasRight(
'societe',
'lire')) {
131 print
'<div class="divsearchfield">';
132 print
img_picto($langs->trans(
"ThirdParty"),
'company',
'class="pictofixedwidth inline-block"');
133 print $form->select_company($socid,
'search_socid',
'',
' ', 0, 0, array(), 0,
'minwidth100 maxwidth250 widthcentpercentminusx');
137 if (
isModEnabled(
'project') && $user->hasRight(
'projet',
'lire')) {
138 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
141 print
'<div class="divsearchfield">';
142 print
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth inline-block"');
143 print $formproject->select_projects($socid ? $socid : -1, (string) $pid,
'search_projectid', 0, 0, 1, 0, 0, 0, 0,
'', 1, 0,
'minwidth100 maxwidth250 widthcentpercentminusx');
147 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
148 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
149 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
151 $langs->load(
'categories');
153 print
'<div class="divsearchfield">';
154 print
img_picto($langs->trans(
'Categories'),
'category',
'class="pictofixedwidth"');
155 print $formother->select_categories(
'actioncomm', $search_categ_cus,
'search_categ_cus', 1, $langs->trans(
'Categories'),
'minwidth100 maxwidth250 widthcentpercentminusx');
159 if ($canedit && !preg_match(
'/list/', $_SERVER[
"PHP_SELF"])) {
161 print
'<div class="divsearchfield">';
162 print
img_picto($langs->trans(
"Status"),
'status',
'class="pictofixedwidth inline-block"');
163 $formactions->form_select_status_action(
'formaction', $status, 1,
'search_status', 1, 2,
'minwidth100');
168 $parameters = array(
'canedit' => $canedit,
'pid' => $pid,
'socid' => $socid);
170 $reshook = $hookmanager->executeHooks(
'searchAgendaFrom', $parameters,
$object, $action);
172 print
'<div class="clearboth"></div>';
184 global $langs, $conf, $user, $db, $socid;
188 include_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
189 include_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
191 $sql =
"SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent";
192 $sql .=
", c.code, c.libelle as type_label";
193 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
194 $sql .=
", s.code_client, s.code_compta, s.client";
195 $sql .=
", s.logo, s.email, s.entity";
196 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as a LEFT JOIN ";
197 $sql .=
" ".MAIN_DB_PREFIX.
"c_actioncomm as c ON c.id = a.fk_action";
198 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON a.fk_soc = s.rowid";
199 if (!$user->hasRight(
'societe',
'client',
'voir')) {
200 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
202 $sql .=
" WHERE a.entity IN (".getEntity(
'agenda').
")";
203 $sql .=
" AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now).
"'))";
204 if (!$user->hasRight(
'societe',
'client',
'voir')) {
205 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
208 $sql .=
" AND s.rowid = ".((int) $socid);
210 $sql .=
" ORDER BY a.datep DESC, a.id DESC";
211 $sql .= $db->plimit($max, 0);
213 $resql = $db->query($sql);
215 $num = $db->num_rows($resql);
217 print
'<div class="div-table-responsive-no-min">';
218 print
'<table class="noborder centpercent">';
219 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"LastActionsToDo", $max).
'</th>';
220 print
'<th colspan="2" class="right"><a class="commonlink" href="'.dolBuildUrl(DOL_URL_ROOT.
'/comm/action/list.php', [
'mode' =>
'show_list',
'status' =>
'todo']).
'">'.$langs->trans(
"FullList").
'</a></th>';
226 $customerstatic =
new Client($db);
229 $obj = $db->fetch_object($resql);
232 print
'<tr class="oddeven">';
234 $staticaction->type_code = $obj->code;
235 $staticaction->label = ($obj->label ? $obj->label : $obj->type_label);
236 $staticaction->id = $obj->id;
237 print
'<td>'.$staticaction->getNomUrl(1, 34).
'</td>';
242 if ($obj->socid > 0) {
243 $customerstatic->id = $obj->socid;
244 $customerstatic->name = $obj->name;
246 $customerstatic->code_client = $obj->code_client;
247 $customerstatic->code_compta = $obj->code_compta;
248 $customerstatic->code_compta_client = $obj->code_compta;
249 $customerstatic->client = $obj->client;
250 $customerstatic->logo = $obj->logo;
251 $customerstatic->email = $obj->email;
252 $customerstatic->entity = $obj->entity;
253 print $customerstatic->getNomUrl(1,
'', 40);
257 $datep = $db->jdate($obj->dp);
258 $datep2 = $db->jdate($obj->dp2);
261 print
'<td width="100" class="right tddate">'.dol_print_date($datep,
'day').
' ';
263 if ($obj->percent == 0 && $datep && $datep < time()) {
266 if ($obj->percent == 0 && !$datep && $datep2 && $datep2 < time()) {
269 if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) {
272 if ($obj->percent > 0 && $obj->percent < 100 && !$datep2 && $datep && $datep < time()) {
281 print
'<td class="right" width="14">'.$staticaction->LibStatut($obj->percent, 3).
"</td>\n";
287 print
"</table></div><br>";
304 global $langs, $conf, $user, $db, $socid;
308 $sql =
"SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label";
309 $sql .=
", c.code, c.libelle";
310 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
311 $sql .=
", s.code_client, s.code_compta, s.client";
312 $sql .=
", s.logo, s.email, s.entity";
313 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as a LEFT JOIN ";
314 $sql .=
" ".MAIN_DB_PREFIX.
"c_actioncomm as c ON c.id = a.fk_action ";
315 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON a.fk_soc = s.rowid";
316 if (!$user->hasRight(
'societe',
'client',
'voir')) {
317 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
319 $sql .=
" WHERE a.entity IN (".getEntity(
'agenda').
")";
320 $sql .=
" AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now).
"'))";
321 if (!$user->hasRight(
'societe',
'client',
'voir')) {
322 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
325 $sql .=
" AND s.rowid = ".((int) $socid);
327 $sql .=
" ORDER BY a.datep2 DESC";
328 $sql .= $db->plimit($max, 0);
330 $resql = $db->query($sql);
332 $num = $db->num_rows($resql);
334 print
'<div class="div-table-responsive-no-min">';
335 print
'<table class="noborder centpercent">';
336 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"LastDoneTasks", $max).
'</th>';
337 print
'<th colspan="2" class="right"><a class="commonlink" href="'.dolBuildUrl(DOL_URL_ROOT.
'/comm/action/list.php', [
'mode'=>
'show_list',
'status' =>
'done']).
'">'.$langs->trans(
"FullList").
'</a></th>';
343 $customerstatic =
new Societe($db);
346 $obj = $db->fetch_object($resql);
349 print
'<tr class="oddeven">';
351 $staticaction->type_code = $obj->code;
352 $staticaction->label = $obj->label;
353 $staticaction->id = $obj->id;
354 print
'<td>'.$staticaction->getNomUrl(1, 34).
'</td>';
359 if ($obj->socid > 0) {
360 $customerstatic->id = $obj->socid;
361 $customerstatic->name = $obj->name;
363 $customerstatic->code_client = $obj->code_client;
364 $customerstatic->code_compta = $obj->code_compta;
365 $customerstatic->code_compta_client = $obj->code_compta;
366 $customerstatic->client = $obj->client;
367 $customerstatic->logo = $obj->logo;
368 $customerstatic->email = $obj->email;
369 $customerstatic->entity = $obj->entity;
370 print $customerstatic->getNomUrl(1,
'', 30);
375 print
'<td width="100" class="right tddate">'.dol_print_date($db->jdate($obj->da2),
'day');
379 print
'<td class="right" width="14">'.$staticaction->LibStatut($obj->percent, 3).
"</td>\n";
386 print
"</table></div><br>";
402 global $langs, $conf, $user, $db;
405 $extrafields->fetch_name_optionals_label(
'actioncomm');
410 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/admin/agenda_other.php");
411 $head[$h][1] = $langs->trans(
"Miscellaneous");
412 $head[$h][2] =
'other';
415 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/admin/agenda.php");
416 $head[$h][1] = $langs->trans(
"AutoActions");
417 $head[$h][2] =
'autoactions';
420 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/admin/agenda_reminder.php");
421 $head[$h][1] = $langs->trans(
"Reminders");
422 $head[$h][2] =
'reminders';
425 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/admin/agenda_xcal.php");
426 $head[$h][1] = $langs->trans(
"ExportCal");
427 $head[$h][2] =
'xcal';
430 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/admin/agenda_extsites.php");
431 $head[$h][1] = $langs->trans(
"ExtSites");
432 $head[$h][2] =
'extsites';
437 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/admin/agenda_extrafields.php");
438 $head[$h][1] = $langs->trans(
"ExtraFields");
439 $nbExtrafields = $extrafields->attributes[
'actioncomm'][
'count'];
440 if ($nbExtrafields > 0) {
441 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
443 $head[$h][2] =
'attributes';
460 global $db, $langs, $conf, $user;
465 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/comm/action/card.php', [
'id'=>
$object->id]);
466 $head[$h][1] = $langs->trans(
"CardAction");
467 $head[$h][2] =
'card';
472 include_once DOL_DOCUMENT_ROOT.
'/resource/class/dolresource.class.php';
475 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/resource/element_resource.php', [
'element' =>
'action',
'element_id'=>
$object->id]);
476 $listofresourcelinked = $resource->getElementResources(
$object->element,
$object->id);
477 $nbResources = (is_array($listofresourcelinked) ? count($listofresourcelinked) : 0);
478 $head[$h][1] = $langs->trans(
"Resources");
479 if ($nbResources > 0) {
480 $head[$h][1] .= (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">'.($nbResources).
'</span>' :
'');
482 $head[$h][2] =
'resources';
487 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
488 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
489 $upload_dir = $conf->agenda->dir_output.
"/".
$object->id;
490 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
492 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/comm/action/document.php', [
'id' =>
$object->id]);
493 $head[$h][1] = $langs->trans(
"Documents");
494 if (($nbFiles + $nbLinks) > 0) {
495 $head[$h][1] .= (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>' :
'');
497 $head[$h][2] =
'documents';
500 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/comm/action/info.php', [
'id' =>
$object->id]);
501 $head[$h][1] = $langs->trans(
'Info');
502 $head[$h][2] =
'info';
521 global $langs, $conf, $user;
526 parse_str($param, $query);
528 $query = array_merge($query, [
'mode' =>
'show_list']);
529 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/comm/action/list.php', $query);
530 $head[$h][1] = $langs->trans(
"ViewList");
531 $head[$h][2] =
'cardlist';
534 $query[
'mode'] =
'show_month';
535 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/comm/action/index.php', $query);
536 $head[$h][1] = $langs->trans(
"ViewCal");
537 $head[$h][2] =
'cardmonth';
540 $query[
'mode'] =
'show_week';
541 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/comm/action/index.php', $query);
542 $head[$h][1] = $langs->trans(
"ViewWeek");
543 $head[$h][2] =
'cardweek';
546 $query[
'mode'] =
'show_day';
547 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/comm/action/index.php', $query);
548 $head[$h][1] = $langs->trans(
"ViewDay");
549 $head[$h][2] =
'cardday';
552 unset($query[
'mode']);
554 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/comm/action/pertype.php', $query);
555 $head[$h][1] = $langs->trans(
"ViewPerType");
556 $head[$h][2] =
'cardpertype';
561 $newparam = preg_replace(
'/&?search_filtert=\d+/',
'', $newparam);
563 parse_str($newparam, $query);
565 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/comm/action/peruser.php', $query);
566 $head[$h][1] = $langs->trans(
"ViewPerUser");
567 $head[$h][2] =
'cardperuser';
if(! $sortfield) if(! $sortorder) $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, $search_import_key='')
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.
dol_now($mode='gmt')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dolBuildUrl($url, $params=[], $addtoken=false)
Return path of url.
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.
isModEnabled($module)
Is Dolibarr module enabled.