52 $this->family =
"projects";
53 $this->module_position =
'16';
55 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
56 $this->
description =
"Follow events or rendez-vous. Record manual events into Agendas or let application record automatic events for log tracking.";
58 $this->version =
'dolibarr';
60 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
61 $this->picto =
'action';
64 $this->dirs = array(
"/agenda/temp");
67 $this->config_page_url = array(
"agenda_other.php");
70 $this->hidden =
false;
71 $this->depends = array();
72 $this->requiredby = array();
73 $this->conflictwith = array();
74 $this->langfiles = array(
"companies");
75 $this->phpmin = array(7, 0);
78 $this->module_parts = array();
86 $this->
const = array();
88 $sqlreadactions =
"SELECT code, label, description FROM ".MAIN_DB_PREFIX.
"c_action_trigger ORDER by rang";
89 $resql = $this->db->query($sqlreadactions);
91 while ($obj = $this->db->fetch_object($resql)) {
93 if (preg_match(
'/^TASK_/', $obj->code)) {
97 $this->
const[] = array(
'MAIN_AGENDA_ACTIONAUTO_'.$obj->code,
"chaine",
"1",
'', 0,
'current');
105 $this->tabs = array();
109 $this->boxes = array(
110 0=>array(
'file'=>
'box_actions.php',
'enabledbydefaulton'=>
'Home'),
111 1=>array(
'file'=>
'box_actions_future.php',
'enabledbydefaulton'=>
'Home')
117 $this->cronjobs = array(
118 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),
123 $this->rights = array();
124 $this->rights_class =
'agenda';
135 $this->rights[$r][0] = 2401;
136 $this->rights[$r][1] =
'Read actions/tasks linked to his account';
137 $this->rights[$r][2] =
'r';
138 $this->rights[$r][3] = 0;
139 $this->rights[$r][4] =
'myactions';
140 $this->rights[$r][5] =
'read';
143 $this->rights[$r][0] = 2402;
144 $this->rights[$r][1] =
'Create/modify actions/tasks linked to his account';
145 $this->rights[$r][2] =
'w';
146 $this->rights[$r][3] = 0;
147 $this->rights[$r][4] =
'myactions';
148 $this->rights[$r][5] =
'create';
151 $this->rights[$r][0] = 2403;
152 $this->rights[$r][1] =
'Delete actions/tasks linked to his account';
153 $this->rights[$r][2] =
'w';
154 $this->rights[$r][3] = 0;
155 $this->rights[$r][4] =
'myactions';
156 $this->rights[$r][5] =
'delete';
159 $this->rights[$r][0] = 2411;
160 $this->rights[$r][1] =
'Read actions/tasks of others';
161 $this->rights[$r][2] =
'r';
162 $this->rights[$r][3] = 0;
163 $this->rights[$r][4] =
'allactions';
164 $this->rights[$r][5] =
'read';
167 $this->rights[$r][0] = 2412;
168 $this->rights[$r][1] =
'Create/modify actions/tasks of others';
169 $this->rights[$r][2] =
'w';
170 $this->rights[$r][3] = 0;
171 $this->rights[$r][4] =
'allactions';
172 $this->rights[$r][5] =
'create';
175 $this->rights[$r][0] = 2413;
176 $this->rights[$r][1] =
'Delete actions/tasks of others';
177 $this->rights[$r][2] =
'w';
178 $this->rights[$r][3] = 0;
179 $this->rights[$r][4] =
'allactions';
180 $this->rights[$r][5] =
'delete';
183 $this->rights[$r][0] = 2414;
184 $this->rights[$r][1] =
'Export actions/tasks of others';
185 $this->rights[$r][2] =
'w';
186 $this->rights[$r][3] = 0;
187 $this->rights[$r][4] =
'export';
190 $this->menu = array();
207 $this->menu[$r] = array(
210 'titre'=>
'TMenuAgenda',
211 'prefix' =>
img_picto(
'', $this->picto,
'class="pictofixedwidth"'),
212 'mainmenu'=>
'agenda',
213 'url'=>
'/comm/action/index.php',
216 'perms'=>
'$user->hasRight("agenda", "myactions", "read") || $user->hasRight("resource", "read")',
217 'enabled'=>
'isModEnabled("agenda") || isModEnabled("resource")',
223 $this->menu[$r] = array(
227 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth"'),
228 'mainmenu'=>
'agenda',
229 'url'=>
'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda',
232 'perms'=>
'$user->hasRight("agenda", "myactions", "read")',
233 'enabled'=>
'isModEnabled("agenda")',
238 $this->menu[$r] = array(
241 'titre'=>
'NewAction',
242 'mainmenu'=>
'agenda',
243 'url'=>
'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create',
244 'langs'=>
'commercial',
246 'perms'=>
'($user->hasRight("agenda", "myactions", "create") || $user->hasRight("agenda", "allactions", "create"))',
247 'enabled'=>
'isModEnabled("agenda")',
253 $this->menu[$r] = array(
257 'mainmenu'=>
'agenda',
258 'url'=>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda',
261 'perms'=>
'$user->hasRight("agenda", "myactions", "read")',
262 'enabled'=>
'isModEnabled("agenda")',
267 $this->menu[$r] = array(
270 'titre'=>
'MenuToDoMyActions',
271 'mainmenu'=>
'agenda',
272 'url'=>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
275 'perms'=>
'$user->hasRight("agenda", "myactions", "read")',
276 'enabled'=>
'isModEnabled("agenda")',
281 $this->menu[$r] = array(
284 'titre'=>
'MenuDoneMyActions',
285 'mainmenu'=>
'agenda',
286 'url'=>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
289 'perms'=>
'$user->hasRight("agenda", "myactions", "read")',
290 'enabled'=>
'isModEnabled("agenda")',
295 $this->menu[$r] = array(
298 'titre'=>
'MenuToDoActions',
299 'mainmenu'=>
'agenda',
300 'url'=>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
303 'perms'=>
'$user->hasRight("agenda", "allactions", "read")',
304 'enabled'=>
'isModEnabled("agenda")',
309 $this->menu[$r] = array(
312 'titre'=>
'MenuDoneActions',
313 'mainmenu'=>
'agenda',
314 'url'=>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
317 'perms'=>
'$user->hasRight("agenda", "allactions", "read")',
318 'enabled'=>
'isModEnabled("agenda")',
325 $this->menu[$r] = array(
329 'mainmenu'=>
'agenda',
330 'url'=>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda',
333 'perms'=>
'$user->hasRight("agenda", "myactions", "read")',
334 'enabled'=>
'isModEnabled("agenda")',
339 $this->menu[$r] = array(
342 'titre'=>
'MenuToDoMyActions',
343 'mainmenu'=>
'agenda',
344 'url'=>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
347 'perms'=>
'$user->hasRight("agenda", "myactions", "read")',
348 'enabled'=>
'isModEnabled("agenda")',
353 $this->menu[$r] = array(
356 'titre'=>
'MenuDoneMyActions',
357 'mainmenu'=>
'agenda',
358 'url'=>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
361 'perms'=>
'$user->hasRight("agenda", "myactions", "read")',
362 'enabled'=>
'isModEnabled("agenda")',
367 $this->menu[$r] = array(
370 'titre'=>
'MenuToDoActions',
371 'mainmenu'=>
'agenda',
372 'url'=>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
375 'perms'=>
'$user->hasRight("agenda", "allactions", "read")',
376 'enabled'=>
'isModEnabled("agenda")',
381 $this->menu[$r] = array(
384 'titre'=>
'MenuDoneActions',
385 'mainmenu'=>
'agenda',
386 'url'=>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
389 'perms'=>
'$user->hasRight("agenda", "allactions", "read")',
390 'enabled'=>
'isModEnabled("agenda")',
396 $this->menu[$r] = array(
399 'titre'=>
'Reportings',
400 'mainmenu'=>
'agenda',
401 'url'=>
'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda',
404 'perms'=>
'$user->hasRight("agenda", "allactions", "read")',
405 'enabled'=>
'isModEnabled("agenda")',
411 $this->menu[$r] = array(
414 'titre' =>
'Categories',
415 'mainmenu' =>
'agenda',
416 'url'=>
'/categories/index.php?mainmenu=agenda&leftmenu=agenda&type=10',
419 'perms' =>
'$user->hasRight("agenda", "allactions", "read")',
420 'enabled' =>
'isModEnabled("categorie")',
432 $this->export_code[$r] = $this->rights_class.
'_'.$r;
433 $this->export_label[$r] =
"ExportDataset_event1";
434 $this->export_permission[$r] = array(array(
"agenda",
"export"));
435 $this->export_fields_array[$r] = array(
'ac.id'=>
"IdAgenda",
'ac.ref_ext'=>
"ExternalRef",
'ac.datec'=>
"DateCreation",
'ac.datep'=>
"DateActionBegin",
436 'ac.datep2'=>
"DateActionEnd",
'ac.label'=>
"Title",
'ac.note'=>
"Note",
'ac.percent'=>
"Percent",
'ac.durationp'=>
"Duration",
437 'cac.libelle'=>
"ActionType",
438 's.rowid'=>
"IdCompany",
's.nom'=>
'CompanyName',
's.address'=>
'Address',
's.zip'=>
'Zip',
's.town'=>
'Town',
439 'co.code'=>
'CountryCode',
's.phone'=>
'Phone',
's.siren'=>
'ProfId1',
's.siret'=>
'ProfId2',
's.ape'=>
'ProfId3',
's.idprof4'=>
'ProfId4',
's.idprof5'=>
'ProfId5',
's.idprof6'=>
'ProfId6',
440 's.code_compta'=>
'CustomerAccountancyCode',
's.code_compta_fournisseur'=>
'SupplierAccountancyCode',
's.tva_intra'=>
'VATIntra',
441 'p.ref' =>
'ProjectRef',
443 $this->export_TypeFields_array[$r] = array(
'ac.ref_ext'=>
"Text",
'ac.datec'=>
"Date",
'ac.datep'=>
"Date",
444 'ac.datep2'=>
"Date",
'ac.label'=>
"Text",
'ac.note'=>
"Text",
'ac.percent'=>
"Numeric",
445 'ac.durationp'=>
"Duree",
446 'cac.libelle'=>
"List:c_actioncomm:libelle:libelle",
447 's.nom'=>
'Text',
's.address'=>
'Text',
's.zip'=>
'Text',
's.town'=>
'Text',
448 'co.code'=>
'Text',
's.phone'=>
'Text',
's.siren'=>
'Text',
's.siret'=>
'Text',
's.ape'=>
'Text',
's.idprof4'=>
'Text',
's.idprof5'=>
'Text',
's.idprof6'=>
'Text',
449 's.code_compta'=>
'Text',
's.code_compta_fournisseur'=>
'Text',
's.tva_intra'=>
'Text',
452 $this->export_entities_array[$r] = array(
'ac.id'=>
"action",
'ac.ref_ext'=>
"action",
'ac.datec'=>
"action",
'ac.datep'=>
"action",
453 'ac.datep2'=>
"action",
'ac.label'=>
"action",
'ac.note'=>
"action",
'ac.percent'=>
"action",
'ac.durationp'=>
"action",
454 'cac.libelle'=>
"action",
455 's.rowid'=>
"company",
's.nom'=>
'company',
's.address'=>
'company',
's.zip'=>
'company',
's.town'=>
'company',
456 'co.code'=>
'company',
's.phone'=>
'company',
's.siren'=>
'company',
's.siret'=>
'company',
's.ape'=>
'company',
's.idprof4'=>
'company',
's.idprof5'=>
'company',
's.idprof6'=>
'company',
457 's.code_compta'=>
'company',
's.code_compta_fournisseur'=>
'company',
's.tva_intra'=>
'company',
458 'p.ref' =>
'project',
461 $keyforselect =
'actioncomm';
462 $keyforelement =
'action';
463 $keyforaliasextra =
'extra';
464 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
466 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
467 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'actioncomm as ac';
468 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'actioncomm_extrafields as extra ON ac.id = extra.fk_object';
469 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_actioncomm as cac on ac.fk_action = cac.id';
470 if (!empty($user) && !$user->hasRight(
'agenda',
'allactions',
'read')) {
471 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'actioncomm_resources acr on ac.id = acr.fk_actioncomm';
473 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'socpeople as sp on ac.fk_contact = sp.rowid';
474 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s on ac.fk_soc = s.rowid';
475 if (!empty($user) && !$user->hasRight(
'societe',
'client',
'voir')) {
476 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
478 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as co on s.fk_pays = co.rowid';
479 $this->export_sql_end[$r] .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = ac.fk_project";
480 $this->export_sql_end[$r] .=
' WHERE ac.entity IN ('.getEntity(
'agenda').
')';
481 if (!empty($user) && !$user->hasRight(
'societe',
'client',
'voir')) {
482 $this->export_sql_end[$r] .=
' AND (sc.fk_user = '.(empty($user) ? 0 : $user->id).
' OR ac.fk_soc IS NULL)';
484 if (!empty($user) && !$user->hasRight(
'agenda',
'allactions',
'read')) {
485 $this->export_sql_end[$r] .=
' AND acr.fk_element = '.(empty($user) ? 0 : $user->id);
487 $this->export_sql_order[$r] =
' ORDER BY ac.datep';