53 $this->family =
"projects";
54 $this->module_position =
'16';
56 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
57 $this->
description =
"Follow events or rendez-vous. Record manual events into Agendas or let application record automatic events for log tracking.";
59 $this->version =
'dolibarr';
61 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
62 $this->picto =
'action';
65 $this->dirs = array(
"/agenda/temp");
68 $this->config_page_url = array(
"agenda_other.php");
71 $this->hidden =
false;
72 $this->depends = array();
73 $this->requiredby = array();
74 $this->conflictwith = array();
75 $this->langfiles = array(
"companies");
76 $this->phpmin = array(7, 0);
79 $this->module_parts = array();
87 $this->
const = array();
89 $sqlreadactions =
"SELECT code, label, description FROM ".MAIN_DB_PREFIX.
"c_action_trigger ORDER by rang";
90 $resql = $this->db->query($sqlreadactions);
92 while ($obj = $this->db->fetch_object($resql)) {
94 if (preg_match(
'/^TASK_/', $obj->code)) {
98 $this->
const[] = array(
'MAIN_AGENDA_ACTIONAUTO_'.$obj->code,
"chaine",
"1",
'', 0,
'current');
106 $this->tabs = array();
110 $this->boxes = array(
111 0=>array(
'file'=>
'box_actions.php',
'enabledbydefaulton'=>
'Home'),
112 1=>array(
'file'=>
'box_actions_future.php',
'enabledbydefaulton'=>
'Home')
118 $this->cronjobs = array(
119 0=>array(
'label'=>
'SendEmailsReminders',
'jobtype'=>
'method',
'class'=>
'comm/action/class/actioncomm.class.php',
'objectname'=>
'ActionComm',
'method'=>
'sendEmailsReminder',
'parameters'=>
'',
'comment'=>
'SendEMailsReminder',
'frequency'=>5,
'unitfrequency'=>60,
'priority'=>10,
'status'=>1,
'test'=>
'isModEnabled("agenda")',
'datestart'=>$datestart),
124 $this->rights = array();
125 $this->rights_class =
'agenda';
136 $this->rights[$r][0] = 2401;
137 $this->rights[$r][1] =
'Read actions/tasks linked to his account';
138 $this->rights[$r][2] =
'r';
139 $this->rights[$r][3] = 0;
140 $this->rights[$r][4] =
'myactions';
141 $this->rights[$r][5] =
'read';
144 $this->rights[$r][0] = 2402;
145 $this->rights[$r][1] =
'Create/modify actions/tasks linked to his account';
146 $this->rights[$r][2] =
'w';
147 $this->rights[$r][3] = 0;
148 $this->rights[$r][4] =
'myactions';
149 $this->rights[$r][5] =
'create';
152 $this->rights[$r][0] = 2403;
153 $this->rights[$r][1] =
'Delete actions/tasks linked to his account';
154 $this->rights[$r][2] =
'w';
155 $this->rights[$r][3] = 0;
156 $this->rights[$r][4] =
'myactions';
157 $this->rights[$r][5] =
'delete';
160 $this->rights[$r][0] = 2411;
161 $this->rights[$r][1] =
'Read actions/tasks of others';
162 $this->rights[$r][2] =
'r';
163 $this->rights[$r][3] = 0;
164 $this->rights[$r][4] =
'allactions';
165 $this->rights[$r][5] =
'read';
168 $this->rights[$r][0] = 2412;
169 $this->rights[$r][1] =
'Create/modify actions/tasks of others';
170 $this->rights[$r][2] =
'w';
171 $this->rights[$r][3] = 0;
172 $this->rights[$r][4] =
'allactions';
173 $this->rights[$r][5] =
'create';
176 $this->rights[$r][0] = 2413;
177 $this->rights[$r][1] =
'Delete actions/tasks of others';
178 $this->rights[$r][2] =
'w';
179 $this->rights[$r][3] = 0;
180 $this->rights[$r][4] =
'allactions';
181 $this->rights[$r][5] =
'delete';
184 $this->rights[$r][0] = 2414;
185 $this->rights[$r][1] =
'Export actions/tasks of others';
186 $this->rights[$r][2] =
'w';
187 $this->rights[$r][3] = 0;
188 $this->rights[$r][4] =
'export';
191 $this->menu = array();
208 $this->menu[$r] = array(
211 'titre'=>
'TMenuAgenda',
212 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth"'),
213 'mainmenu'=>
'agenda',
214 'url'=>
'/comm/action/index.php',
217 'perms'=>
'$user->rights->agenda->myactions->read || $user->rights->resource->read',
218 'enabled'=>
'isModEnabled("agenda") || isModEnabled("resource")',
224 $this->menu[$r] = array(
228 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth"'),
229 'mainmenu'=>
'agenda',
230 'url'=>
'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda',
233 'perms'=>
'$user->rights->agenda->myactions->read',
234 'enabled'=>
'isModEnabled("agenda")',
239 $this->menu[$r] = array(
242 'titre'=>
'NewAction',
243 'mainmenu'=>
'agenda',
244 'url'=>
'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create',
245 'langs'=>
'commercial',
247 'perms'=>
'($user->hasRight("agenda", "myactions", "create")||$user->hasRight("agenda", "allactions", "create"))',
248 'enabled'=>
'isModEnabled("agenda")',
254 $this->menu[$r] = array(
258 'mainmenu'=>
'agenda',
259 'url'=>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda',
262 'perms'=>
'$user->rights->agenda->myactions->read',
263 'enabled'=>
'isModEnabled("agenda")',
268 $this->menu[$r] = array(
271 'titre'=>
'MenuToDoMyActions',
272 'mainmenu'=>
'agenda',
273 'url'=>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
276 'perms'=>
'$user->rights->agenda->myactions->read',
277 'enabled'=>
'isModEnabled("agenda")',
282 $this->menu[$r] = array(
285 'titre'=>
'MenuDoneMyActions',
286 'mainmenu'=>
'agenda',
287 'url'=>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
290 'perms'=>
'$user->rights->agenda->myactions->read',
291 'enabled'=>
'isModEnabled("agenda")',
296 $this->menu[$r] = array(
299 'titre'=>
'MenuToDoActions',
300 'mainmenu'=>
'agenda',
301 'url'=>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
304 'perms'=>
'$user->rights->agenda->allactions->read',
305 'enabled'=>
'$user->rights->agenda->allactions->read',
310 $this->menu[$r] = array(
313 'titre'=>
'MenuDoneActions',
314 'mainmenu'=>
'agenda',
315 'url'=>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
318 'perms'=>
'$user->rights->agenda->allactions->read',
319 'enabled'=>
'$user->rights->agenda->allactions->read',
326 $this->menu[$r] = array(
330 'mainmenu'=>
'agenda',
331 'url'=>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda',
334 'perms'=>
'$user->rights->agenda->myactions->read',
335 'enabled'=>
'isModEnabled("agenda")',
340 $this->menu[$r] = array(
343 'titre'=>
'MenuToDoMyActions',
344 'mainmenu'=>
'agenda',
345 'url'=>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
348 'perms'=>
'$user->rights->agenda->myactions->read',
349 'enabled'=>
'isModEnabled("agenda")',
354 $this->menu[$r] = array(
357 'titre'=>
'MenuDoneMyActions',
358 'mainmenu'=>
'agenda',
359 'url'=>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
362 'perms'=>
'$user->rights->agenda->myactions->read',
363 'enabled'=>
'isModEnabled("agenda")',
368 $this->menu[$r] = array(
371 'titre'=>
'MenuToDoActions',
372 'mainmenu'=>
'agenda',
373 'url'=>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
376 'perms'=>
'$user->rights->agenda->allactions->read',
377 'enabled'=>
'$user->rights->agenda->allactions->read',
382 $this->menu[$r] = array(
385 'titre'=>
'MenuDoneActions',
386 'mainmenu'=>
'agenda',
387 'url'=>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
390 'perms'=>
'$user->rights->agenda->allactions->read',
391 'enabled'=>
'$user->rights->agenda->allactions->read',
397 $this->menu[$r] = array(
400 'titre'=>
'Reportings',
401 'mainmenu'=>
'agenda',
402 'url'=>
'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda',
405 'perms'=>
'$user->rights->agenda->allactions->read',
406 'enabled'=>
'isModEnabled("agenda")',
412 $this->menu[$r] = array(
415 'titre' =>
'Categories',
416 'mainmenu' =>
'agenda',
417 'url'=>
'/categories/index.php?mainmenu=agenda&leftmenu=agenda&type=10',
420 'perms' =>
'$user->rights->agenda->allactions->read',
421 'enabled' =>
'$conf->categorie->enabled',
433 $this->export_code[$r] = $this->rights_class.
'_'.$r;
434 $this->export_label[$r] =
"ExportDataset_event1";
435 $this->export_permission[$r] = array(array(
"agenda",
"export"));
436 $this->export_fields_array[$r] = array(
'ac.id'=>
"IdAgenda",
'ac.ref_ext'=>
"ExternalRef",
'ac.datec'=>
"DateCreation",
'ac.datep'=>
"DateActionBegin",
437 'ac.datep2'=>
"DateActionEnd",
'ac.label'=>
"Title",
'ac.note'=>
"Note",
'ac.percent'=>
"Percent",
'ac.durationp'=>
"Duration",
438 'cac.libelle'=>
"ActionType",
439 's.rowid'=>
"IdCompany",
's.nom'=>
'CompanyName',
's.address'=>
'Address',
's.zip'=>
'Zip',
's.town'=>
'Town',
440 'co.code'=>
'CountryCode',
's.phone'=>
'Phone',
's.siren'=>
'ProfId1',
's.siret'=>
'ProfId2',
's.ape'=>
'ProfId3',
's.idprof4'=>
'ProfId4',
's.idprof5'=>
'ProfId5',
's.idprof6'=>
'ProfId6',
441 's.code_compta'=>
'CustomerAccountancyCode',
's.code_compta_fournisseur'=>
'SupplierAccountancyCode',
's.tva_intra'=>
'VATIntra',
442 'p.ref' =>
'ProjectRef',
444 $this->export_TypeFields_array[$r] = array(
'ac.ref_ext'=>
"Text",
'ac.datec'=>
"Date",
'ac.datep'=>
"Date",
445 'ac.datep2'=>
"Date",
'ac.label'=>
"Text",
'ac.note'=>
"Text",
'ac.percent'=>
"Numeric",
446 'ac.durationp'=>
"Duree",
447 'cac.libelle'=>
"List:c_actioncomm:libelle:libelle",
448 's.nom'=>
'Text',
's.address'=>
'Text',
's.zip'=>
'Text',
's.town'=>
'Text',
449 'co.code'=>
'Text',
's.phone'=>
'Text',
's.siren'=>
'Text',
's.siret'=>
'Text',
's.ape'=>
'Text',
's.idprof4'=>
'Text',
's.idprof5'=>
'Text',
's.idprof6'=>
'Text',
450 's.code_compta'=>
'Text',
's.code_compta_fournisseur'=>
'Text',
's.tva_intra'=>
'Text',
453 $this->export_entities_array[$r] = array(
'ac.id'=>
"action",
'ac.ref_ext'=>
"action",
'ac.datec'=>
"action",
'ac.datep'=>
"action",
454 'ac.datep2'=>
"action",
'ac.label'=>
"action",
'ac.note'=>
"action",
'ac.percent'=>
"action",
'ac.durationp'=>
"action",
455 'cac.libelle'=>
"action",
456 's.rowid'=>
"company",
's.nom'=>
'company',
's.address'=>
'company',
's.zip'=>
'company',
's.town'=>
'company',
457 'co.code'=>
'company',
's.phone'=>
'company',
's.siren'=>
'company',
's.siret'=>
'company',
's.ape'=>
'company',
's.idprof4'=>
'company',
's.idprof5'=>
'company',
's.idprof6'=>
'company',
458 's.code_compta'=>
'company',
's.code_compta_fournisseur'=>
'company',
's.tva_intra'=>
'company',
459 'p.ref' =>
'project',
462 $keyforselect =
'actioncomm'; $keyforelement =
'action'; $keyforaliasextra =
'extra';
463 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
465 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
466 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'actioncomm as ac';
467 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'actioncomm_extrafields as extra ON ac.id = extra.fk_object';
468 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_actioncomm as cac on ac.fk_action = cac.id';
469 if (!empty($user) && !$user->hasRight(
'agenda',
'allactions',
'read')) {
470 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'actioncomm_resources acr on ac.id = acr.fk_actioncomm';
472 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'socpeople as sp on ac.fk_contact = sp.rowid';
473 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s on ac.fk_soc = s.rowid';
474 if (!empty($user) && !$user->hasRight(
'societe',
'client',
'voir')) {
475 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
477 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as co on s.fk_pays = co.rowid';
478 $this->export_sql_end[$r] .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = ac.fk_project";
479 $this->export_sql_end[$r] .=
' WHERE ac.entity IN ('.getEntity(
'agenda').
')';
480 if (empty($user->rights->societe->client->voir)) {
481 $this->export_sql_end[$r] .=
' AND (sc.fk_user = '.(empty($user) ? 0 : $user->id).
' OR ac.fk_soc IS NULL)';
483 if (!empty($user) && !$user->hasRight(
'agenda',
'allactions',
'read')) {
484 $this->export_sql_end[$r] .=
' AND acr.fk_element = '.(empty($user) ? 0 : $user->id);
486 $this->export_sql_order[$r] =
' ORDER BY ac.datep';