34 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
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",
"project");
76 $this->phpmin = array(7, 0);
77 $this->enabled_bydefault =
true;
80 $this->module_parts = array();
88 $this->
const = array();
90 $sqlreadactions =
"SELECT code, label, description FROM ".MAIN_DB_PREFIX.
"c_action_trigger ORDER by rang";
91 $resql = $this->db->query($sqlreadactions);
93 while ($obj = $this->db->fetch_object($resql)) {
95 if (preg_match(
'/^TASK_/', $obj->code)) {
99 $this->
const[] = array(
'MAIN_AGENDA_ACTIONAUTO_'.$obj->code,
"chaine",
"1",
'', 0,
'current');
107 $this->tabs = array();
111 $this->boxes = array(
112 0 => array(
'file' =>
'box_actions.php',
'enabledbydefaulton' =>
'Home'),
113 1 => array(
'file' =>
'box_actions_future.php',
'enabledbydefaulton' =>
'Home')
119 $this->cronjobs = array(
120 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),
125 $this->rights = array();
126 $this->rights_class =
'agenda';
137 $this->rights[$r][0] = 2401;
138 $this->rights[$r][1] =
'Read actions/tasks linked to his account';
139 $this->rights[$r][2] =
'r';
140 $this->rights[$r][3] = 0;
141 $this->rights[$r][4] =
'myactions';
142 $this->rights[$r][5] =
'read';
145 $this->rights[$r][0] = 2402;
146 $this->rights[$r][1] =
'Create/modify actions/tasks linked to his account';
147 $this->rights[$r][2] =
'w';
148 $this->rights[$r][3] = 0;
149 $this->rights[$r][4] =
'myactions';
150 $this->rights[$r][5] =
'create';
153 $this->rights[$r][0] = 2403;
154 $this->rights[$r][1] =
'Delete actions/tasks linked to his account';
155 $this->rights[$r][2] =
'w';
156 $this->rights[$r][3] = 0;
157 $this->rights[$r][4] =
'myactions';
158 $this->rights[$r][5] =
'delete';
161 $this->rights[$r][0] = 2411;
162 $this->rights[$r][1] =
'Read actions/tasks of others';
163 $this->rights[$r][2] =
'r';
164 $this->rights[$r][3] = 0;
165 $this->rights[$r][4] =
'allactions';
166 $this->rights[$r][5] =
'read';
169 $this->rights[$r][0] = 2412;
170 $this->rights[$r][1] =
'Create/modify actions/tasks of others';
171 $this->rights[$r][2] =
'w';
172 $this->rights[$r][3] = 0;
173 $this->rights[$r][4] =
'allactions';
174 $this->rights[$r][5] =
'create';
177 $this->rights[$r][0] = 2413;
178 $this->rights[$r][1] =
'Delete actions/tasks of others';
179 $this->rights[$r][2] =
'w';
180 $this->rights[$r][3] = 0;
181 $this->rights[$r][4] =
'allactions';
182 $this->rights[$r][5] =
'delete';
185 $this->rights[$r][0] = 2414;
186 $this->rights[$r][1] =
'Export actions/tasks of others';
187 $this->rights[$r][2] =
'w';
188 $this->rights[$r][3] = 0;
189 $this->rights[$r][4] =
'export';
192 $this->menu = array();
209 $this->menu[$r] = array(
212 'titre' =>
'TMenuAgenda',
213 'prefix' =>
img_picto(
'', $this->picto,
'class="pictofixedwidth"'),
214 'mainmenu' =>
'agenda',
215 'url' =>
'/comm/action/index.php',
218 'perms' =>
'$user->hasRight("agenda", "myactions", "read") || $user->hasRight("resource", "read")',
219 'enabled' =>
'isModEnabled("agenda") || isModEnabled("resource")',
225 $this->menu[$r] = array(
228 'titre' =>
'Actions',
229 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth"'),
230 'mainmenu' =>
'agenda',
231 'url' =>
'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda',
234 'perms' =>
'$user->hasRight("agenda", "myactions", "read")',
235 'enabled' =>
'isModEnabled("agenda")',
240 $this->menu[$r] = array(
243 'titre' =>
'NewAction',
244 'mainmenu' =>
'agenda',
245 'url' =>
'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create',
246 'langs' =>
'commercial',
248 'perms' =>
'($user->hasRight("agenda", "myactions", "create") || $user->hasRight("agenda", "allactions", "create"))',
249 'enabled' =>
'isModEnabled("agenda")',
255 $this->menu[$r] = array(
258 'titre' =>
'Calendar',
259 'mainmenu' =>
'agenda',
260 'url' =>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda',
263 'perms' =>
'$user->hasRight("agenda", "myactions", "read")',
264 'enabled' =>
'isModEnabled("agenda")',
269 $this->menu[$r] = array(
272 'titre' =>
'MenuToDoMyActions',
273 'mainmenu' =>
'agenda',
274 'url' =>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
277 'perms' =>
'$user->hasRight("agenda", "myactions", "read")',
278 'enabled' =>
'isModEnabled("agenda")',
283 $this->menu[$r] = array(
286 'titre' =>
'MenuDoneMyActions',
287 'mainmenu' =>
'agenda',
288 'url' =>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
291 'perms' =>
'$user->hasRight("agenda", "myactions", "read")',
292 'enabled' =>
'isModEnabled("agenda")',
297 $this->menu[$r] = array(
300 'titre' =>
'MenuToDoActions',
301 'mainmenu' =>
'agenda',
302 'url' =>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
305 'perms' =>
'$user->hasRight("agenda", "allactions", "read")',
306 'enabled' =>
'isModEnabled("agenda")',
311 $this->menu[$r] = array(
314 'titre' =>
'MenuDoneActions',
315 'mainmenu' =>
'agenda',
316 'url' =>
'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
319 'perms' =>
'$user->hasRight("agenda", "allactions", "read")',
320 'enabled' =>
'isModEnabled("agenda")',
327 $this->menu[$r] = array(
331 'mainmenu' =>
'agenda',
332 'url' =>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda',
335 'perms' =>
'$user->hasRight("agenda", "myactions", "read")',
336 'enabled' =>
'isModEnabled("agenda")',
341 $this->menu[$r] = array(
344 'titre' =>
'MenuToDoMyActions',
345 'mainmenu' =>
'agenda',
346 'url' =>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
349 'perms' =>
'$user->hasRight("agenda", "myactions", "read")',
350 'enabled' =>
'isModEnabled("agenda")',
355 $this->menu[$r] = array(
358 'titre' =>
'MenuDoneMyActions',
359 'mainmenu' =>
'agenda',
360 'url' =>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
363 'perms' =>
'$user->hasRight("agenda", "myactions", "read")',
364 'enabled' =>
'isModEnabled("agenda")',
369 $this->menu[$r] = array(
372 'titre' =>
'MenuToDoActions',
373 'mainmenu' =>
'agenda',
374 'url' =>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
377 'perms' =>
'$user->hasRight("agenda", "allactions", "read")',
378 'enabled' =>
'isModEnabled("agenda")',
383 $this->menu[$r] = array(
386 'titre' =>
'MenuDoneActions',
387 'mainmenu' =>
'agenda',
388 'url' =>
'/comm/action/list.php?mode=show_list&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
391 'perms' =>
'$user->hasRight("agenda", "allactions", "read")',
392 'enabled' =>
'isModEnabled("agenda")',
398 $this->menu[$r] = array(
401 'titre' =>
'Reportings',
402 'mainmenu' =>
'agenda',
403 'url' =>
'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda',
406 'perms' =>
'$user->hasRight("agenda", "allactions", "read")',
407 'enabled' =>
'isModEnabled("agenda")',
413 $this->menu[$r] = array(
416 'titre' =>
'Categories',
417 'mainmenu' =>
'agenda',
418 'url' =>
'/categories/index.php?mainmenu=agenda&leftmenu=agenda&type=10',
421 'perms' =>
'$user->hasRight("agenda", "allactions", "read")',
422 'enabled' =>
'isModEnabled("category")',
434 $this->export_code[$r] = $this->rights_class.
'_'.$r;
435 $this->export_label[$r] =
"ExportDataset_event1";
436 $this->export_permission[$r] = array(array(
"agenda",
"export"));
437 $this->export_fields_array[$r] = array(
'ac.id' =>
"IdAgenda",
'ac.ref_ext' =>
"ExternalRef",
'ac.ref' =>
"Ref",
'ac.datec' =>
"DateCreation",
'ac.datep' =>
"DateActionBegin",
438 'ac.datep2' =>
"DateActionEnd",
'ac.location' =>
'Location',
'ac.label' =>
"Title",
'ac.note' =>
"Note",
'ac.percent' =>
"Percentage",
'ac.durationp' =>
"Duration",
439 'ac.fk_user_author' =>
'CreatedById',
'ac.fk_user_action' =>
'ActionsOwnedBy',
'ac.fk_user_mod' =>
'ModifiedBy',
'ac.transparency' =>
"Transparency",
'ac.priority' =>
"Priority",
'ac.fk_element' =>
"ElementID",
'ac.elementtype' =>
"ElementType",
440 'cac.libelle' =>
"ActionType",
'cac.code' =>
"Code",
441 's.rowid' =>
"IdCompany",
's.nom' =>
'CompanyName',
's.address' =>
'Address',
's.zip' =>
'Zip',
's.town' =>
'Town',
442 'co.code' =>
'CountryCode',
's.phone' =>
'Phone',
's.siren' =>
'ProfId1',
's.siret' =>
'ProfId2',
's.ape' =>
'ProfId3',
's.idprof4' =>
'ProfId4',
's.idprof5' =>
'ProfId5',
's.idprof6' =>
'ProfId6',
443 's.code_compta' =>
'CustomerAccountancyCode',
's.code_compta_fournisseur' =>
'SupplierAccountancyCode',
's.tva_intra' =>
'VATIntra',
444 'p.ref' =>
'ProjectRef',
448 $nbofallowedentities = count(explode(
',',
getEntity(
'agenda')));
449 if (
isModEnabled(
'multicompany') && $nbofallowedentities > 1) {
450 $this->export_fields_array[$r][
'ac.entity'] =
'Entity';
453 $this->export_TypeFields_array[$r] = array(
'ac.ref_ext' =>
"Text",
'ac.ref' =>
"Text",
'ac.datec' =>
"Date",
'ac.datep' =>
"Date",
454 'ac.datep2' =>
"Date",
'ac.location' =>
'Text',
'ac.label' =>
"Text",
'ac.note' =>
"Text",
'ac.percent' =>
"Numeric",
455 'ac.durationp' =>
"Duree",
'ac.fk_user_author' =>
'Numeric',
'ac.fk_user_action' =>
'Numeric',
'ac.fk_user_mod' =>
'Numeric',
'ac.transparency' =>
"Numeric",
'ac.priority' =>
"Numeric",
'ac.fk_element' =>
"Numeric",
'ac.elementtype' =>
"Text",
456 'cac.libelle' =>
"List:c_actioncomm:libelle:libelle",
'cac.code' =>
"Text",
457 's.nom' =>
'Text',
's.address' =>
'Text',
's.zip' =>
'Text',
's.town' =>
'Text',
458 'co.code' =>
'Text',
's.phone' =>
'Text',
's.siren' =>
'Text',
's.siret' =>
'Text',
's.ape' =>
'Text',
's.idprof4' =>
'Text',
's.idprof5' =>
'Text',
's.idprof6' =>
'Text',
459 's.code_compta' =>
'Text',
's.code_compta_fournisseur' =>
'Text',
's.tva_intra' =>
'Text',
460 'p.ref' =>
'Text',
'ac.entity' =>
'List:entity:label:rowid'
463 $this->export_entities_array[$r] = array(
'ac.id' =>
"action",
'ac.ref_ext' =>
"action",
'ac.ref' =>
"action",
'ac.datec' =>
"action",
'ac.datep' =>
"action",
464 'ac.datep2' =>
"action",
'ac.location' =>
'action',
'ac.label' =>
"action",
'ac.note' =>
"action",
'ac.percent' =>
"action",
'ac.durationp' =>
"action",
'ac.fk_user_author' =>
'user',
'ac.fk_user_action' =>
'user',
'ac.fk_user_mod' =>
'user',
'ac.transparency' =>
"action",
'ac.priority' =>
"action",
'ac.fk_element' =>
"action",
'ac.elementtype' =>
"action",
465 's.rowid' =>
"company",
's.nom' =>
'company',
's.address' =>
'company',
's.zip' =>
'company',
's.town' =>
'company',
466 'co.code' =>
'company',
's.phone' =>
'company',
's.siren' =>
'company',
's.siret' =>
'company',
's.ape' =>
'company',
's.idprof4' =>
'company',
's.idprof5' =>
'company',
's.idprof6' =>
'company',
467 's.code_compta' =>
'company',
's.code_compta_fournisseur' =>
'company',
's.tva_intra' =>
'company',
468 'p.ref' =>
'project',
471 $keyforselect =
'actioncomm';
472 $keyforelement =
'action';
473 $keyforaliasextra =
'extra';
474 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
476 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
477 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'actioncomm as ac';
478 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'actioncomm_extrafields as extra ON ac.id = extra.fk_object';
479 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_actioncomm as cac on ac.fk_action = cac.id';
480 if (!empty($user) && !$user->hasRight(
'agenda',
'allactions',
'read')) {
481 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'actioncomm_resources acr on ac.id = acr.fk_actioncomm';
483 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'socpeople as sp on ac.fk_contact = sp.rowid';
484 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s on ac.fk_soc = s.rowid';
485 if (!empty($user) && !$user->hasRight(
'societe',
'client',
'voir')) {
486 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
488 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as uc ON ac.fk_user_author = uc.rowid';
489 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as co on s.fk_pays = co.rowid';
490 $this->export_sql_end[$r] .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = ac.fk_project";
491 $this->export_sql_end[$r] .=
' WHERE ac.entity IN ('.getEntity(
'agenda').
')';
492 if (!empty($user) && !$user->hasRight(
'societe',
'client',
'voir')) {
493 $this->export_sql_end[$r] .=
' AND (sc.fk_user = '.(empty($user) ? 0 : $user->id).
' OR ac.fk_soc IS NULL)';
495 if (!empty($user) && !$user->hasRight(
'agenda',
'allactions',
'read')) {
496 $this->export_sql_end[$r] .=
' AND acr.fk_element = '.(empty($user) ? 0 : $user->id);
498 $this->export_sql_end[$r] .=
' AND ac.entity IN ('.getEntity(
'agenda').
')';
499 $this->export_sql_order[$r] =
' ORDER BY ac.datep';
506 $this->import_code[$r] = $this->rights_class.
'_'.$r;
507 $this->import_label[$r] =
"ExportDataset_event1";
508 $this->import_icon[$r] = $this->picto;
509 $this->import_entities_array[$r] = array();
510 $this->import_tables_array[$r] = array(
'ac' => MAIN_DB_PREFIX.
'actioncomm',
'extra' => MAIN_DB_PREFIX.
'actioncomm_extrafields');
511 $this->import_tables_creator_array[$r] = array(
'ac' =>
'fk_user_author');
512 $this->import_fields_array[$r] = array(
513 'ac.ref_ext' =>
'ExternalRef',
515 'ac.datec' =>
'DateCreation',
516 'ac.datep' =>
'DateActionBegin',
517 'ac.datep2' =>
'DateActionEnd',
518 'ac.location' =>
'Location',
519 'ac.label' =>
'Title*',
521 'ac.percent' =>
'Percentage*',
522 'ac.transparency' =>
'Transparency',
523 'ac.priority' =>
'Priority',
524 'ac.fk_action' =>
'Code*',
525 'ac.fk_soc' =>
'ThirdPartyName',
526 'ac.fk_project' =>
'ProjectRef',
527 'ac.fk_user_mod' =>
'ModifiedBy',
528 'ac.fk_user_action' =>
'AffectedTo*',
529 'ac.fk_element' =>
'ElementID',
530 'ac.elementtype' =>
'ElementType',
532 $import_sample = array();
535 $import_extrafield_sample = array();
536 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE elementtype = 'actioncomm' AND entity IN (0, ".$conf->entity.
")";
537 $resql = $this->db->query(
$sql);
540 while ($obj = $this->db->fetch_object($resql)) {
541 $fieldname =
'extra.'.$obj->name;
542 $fieldlabel = ucfirst($obj->label);
543 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
548 $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
549 $this->import_fieldshidden_array[$r] = array(
'extra.fk_object' =>
'lastrowid-'.MAIN_DB_PREFIX.
'actioncomm');
551 $this->import_convertvalue_array[$r] = array(
552 'ac.fk_soc' => array(
553 'rule' =>
'fetchidfromref',
554 'file' =>
'/societe/class/societe.class.php',
555 'class' =>
'Societe',
557 'element' =>
'ThirdParty'
559 'ac.fk_user_action' => array(
560 'rule' =>
'fetchidfromref',
561 'file' =>
'/user/class/user.class.php',
566 'ac.fk_user_mod' => array(
567 'rule' =>
'fetchidfromref',
568 'file' =>
'/user/class/user.class.php',
573 'ac.fk_action' => array(
574 'rule' =>
'fetchidfromcodeid',
575 'classfile' =>
'/comm/action/class/cactioncomm.class.php',
576 'class' =>
'CActionComm',
578 'dict' =>
'DictionaryActions'
583 $keyforselect =
'actioncomm';
584 $keyforelement =
'action';
585 $keyforaliasextra =
'extra';
586 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
Class to describe and enable/disable module Agenda.
__construct($db)
Constructor.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
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...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
$conf db name
Only used if Module[ID]Name translation string is not found.