@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | { |
32 | 32 | |
33 | 33 | /** |
34 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
35 | - * |
|
36 | - * @param DoliDB $db Database handler |
|
34 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
35 | + * |
|
36 | + * @param DoliDB $db Database handler |
|
37 | 37 | */ |
38 | 38 | function __construct($db) |
39 | 39 | { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
45 | 45 | $this->name = preg_replace('/^mod/i','',get_class($this)); |
46 | 46 | $this->description = "Enable the Dolibarr web services server"; |
47 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
47 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
48 | 48 | $this->version = 'dolibarr'; |
49 | 49 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
50 | 50 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | |
60 | 60 | // Dependencies |
61 | 61 | $this->hidden = false; // A condition to hide module |
62 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
63 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
64 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
65 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
62 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
63 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
64 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
65 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
66 | 66 | $this->langfiles = array("other"); |
67 | 67 | |
68 | 68 | // Constants |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \ingroup webservices |
23 | 23 | * \brief File to describe webservices module |
24 | 24 | */ |
25 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
25 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Class to describe a WebServices module |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | |
43 | 43 | $this->family = "interface"; |
44 | 44 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
45 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
45 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
46 | 46 | $this->description = "Enable the Dolibarr web services server"; |
47 | 47 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
48 | 48 | $this->version = 'dolibarr'; |
49 | 49 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
50 | 50 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
51 | 51 | // Name of image file used for this module. |
52 | - $this->picto='technic'; |
|
52 | + $this->picto = 'technic'; |
|
53 | 53 | |
54 | 54 | // Data directories to create when module is enabled |
55 | 55 | $this->dirs = array(); |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | $this->config_page_url = array("index.php@webservices"); |
59 | 59 | |
60 | 60 | // Dependencies |
61 | - $this->hidden = false; // A condition to hide module |
|
62 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
63 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
64 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
65 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
61 | + $this->hidden = false; // A condition to hide module |
|
62 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
63 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
64 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
65 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
66 | 66 | $this->langfiles = array("other"); |
67 | 67 | |
68 | 68 | // Constants |
@@ -77,6 +77,6 @@ discard block |
||
77 | 77 | // Permissions |
78 | 78 | $this->rights = array(); |
79 | 79 | $this->rights_class = 'webservices'; |
80 | - $r=0; |
|
80 | + $r = 0; |
|
81 | 81 | } |
82 | 82 | } |
@@ -31,121 +31,121 @@ discard block |
||
31 | 31 | */ |
32 | 32 | class modEmailCollector extends DolibarrModules |
33 | 33 | { |
34 | - /** |
|
35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | - * |
|
37 | - * @param DoliDB $db Database handler |
|
38 | - */ |
|
39 | - public function __construct($db) |
|
40 | - { |
|
34 | + /** |
|
35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | + * |
|
37 | + * @param DoliDB $db Database handler |
|
38 | + */ |
|
39 | + public function __construct($db) |
|
40 | + { |
|
41 | 41 | global $langs,$conf; |
42 | 42 | |
43 | 43 | $this->db = $db; |
44 | 44 | |
45 | - // Id for module (must be unique). |
|
46 | - // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
47 | - $this->numero = 50320; |
|
48 | - // Key text used to identify module (for permissions, menus, etc...) |
|
49 | - $this->rights_class = 'emailcollector'; |
|
50 | - |
|
51 | - // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' |
|
52 | - // It is used to group modules by family in module setup page |
|
53 | - $this->family = "interface"; |
|
54 | - // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
55 | - $this->module_position = '12'; |
|
56 | - // Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) |
|
57 | - //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); |
|
58 | - |
|
59 | - // Module label (no space allowed), used if translation string 'ModuledavName' not found (MyModue is name of module). |
|
60 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
61 | - // Module description, used if translation string 'ModuledavDesc' not found (MyModue is name of module). |
|
62 | - $this->description = "EmailCollectorDescription"; |
|
63 | - // Used only if file README.md and README-LL.md not found. |
|
64 | - $this->descriptionlong = "EmailCollectorDescription"; |
|
65 | - |
|
66 | - // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' |
|
67 | - $this->version = 'experimental'; |
|
68 | - // Key used in llx_const table to save module status enabled/disabled (where DAV is value of property name of module in uppercase) |
|
69 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
70 | - // Name of image file used for this module. |
|
71 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
72 | - // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
73 | - $this->picto='email'; |
|
74 | - |
|
75 | - // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
76 | - // for default path (eg: /dav/core/xxxxx) (0=disable, 1=enable) |
|
77 | - // for specific path of parts (eg: /dav/core/modules/barcode) |
|
78 | - // for specific css file (eg: /dav/css/dav.css.php) |
|
79 | - $this->module_parts = array(); |
|
80 | - |
|
81 | - // Data directories to create when module is enabled. |
|
82 | - // Example: this->dirs = array("/dav/temp","/dav/subdir"); |
|
83 | - $this->dirs = array(); |
|
84 | - |
|
85 | - // Config pages. Put here list of php page, stored into dav/admin directory, to use to setup module. |
|
86 | - $this->config_page_url = array("emailcollector_list.php"); |
|
87 | - |
|
88 | - // Dependencies |
|
89 | - $this->hidden = false; // A condition to hide module |
|
90 | - $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
91 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
92 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
93 | - $this->langfiles = array("admin"); |
|
94 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
95 | - $this->need_dolibarr_version = array(7,0); // Minimum version of Dolibarr required by module |
|
96 | - $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
97 | - $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
98 | - //$this->automatic_activation = array('FR'=>'davWasAutomaticallyActivatedBecauseOfYourCountryChoice'); |
|
99 | - //$this->always_enabled = true; // If true, can't be disabled |
|
100 | - |
|
101 | - // Constants |
|
102 | - // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
103 | - // Example: $this->const=array(0=>array('DAV_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
|
104 | - // 1=>array('DAV_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
|
105 | - // ); |
|
106 | - $this->const = array( |
|
107 | - //1=>array('DAV_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) |
|
108 | - ); |
|
109 | - |
|
110 | - |
|
111 | - if (! isset($conf->dav) || ! isset($conf->dav->enabled)) |
|
112 | - { |
|
113 | - $conf->dav=new stdClass(); |
|
114 | - $conf->dav->enabled=0; |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - // Array to add new pages in new tabs |
|
45 | + // Id for module (must be unique). |
|
46 | + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
47 | + $this->numero = 50320; |
|
48 | + // Key text used to identify module (for permissions, menus, etc...) |
|
49 | + $this->rights_class = 'emailcollector'; |
|
50 | + |
|
51 | + // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' |
|
52 | + // It is used to group modules by family in module setup page |
|
53 | + $this->family = "interface"; |
|
54 | + // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
55 | + $this->module_position = '12'; |
|
56 | + // Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) |
|
57 | + //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); |
|
58 | + |
|
59 | + // Module label (no space allowed), used if translation string 'ModuledavName' not found (MyModue is name of module). |
|
60 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
61 | + // Module description, used if translation string 'ModuledavDesc' not found (MyModue is name of module). |
|
62 | + $this->description = "EmailCollectorDescription"; |
|
63 | + // Used only if file README.md and README-LL.md not found. |
|
64 | + $this->descriptionlong = "EmailCollectorDescription"; |
|
65 | + |
|
66 | + // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' |
|
67 | + $this->version = 'experimental'; |
|
68 | + // Key used in llx_const table to save module status enabled/disabled (where DAV is value of property name of module in uppercase) |
|
69 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
70 | + // Name of image file used for this module. |
|
71 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
72 | + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
73 | + $this->picto='email'; |
|
74 | + |
|
75 | + // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
76 | + // for default path (eg: /dav/core/xxxxx) (0=disable, 1=enable) |
|
77 | + // for specific path of parts (eg: /dav/core/modules/barcode) |
|
78 | + // for specific css file (eg: /dav/css/dav.css.php) |
|
79 | + $this->module_parts = array(); |
|
80 | + |
|
81 | + // Data directories to create when module is enabled. |
|
82 | + // Example: this->dirs = array("/dav/temp","/dav/subdir"); |
|
83 | + $this->dirs = array(); |
|
84 | + |
|
85 | + // Config pages. Put here list of php page, stored into dav/admin directory, to use to setup module. |
|
86 | + $this->config_page_url = array("emailcollector_list.php"); |
|
87 | + |
|
88 | + // Dependencies |
|
89 | + $this->hidden = false; // A condition to hide module |
|
90 | + $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
91 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
92 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
93 | + $this->langfiles = array("admin"); |
|
94 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
95 | + $this->need_dolibarr_version = array(7,0); // Minimum version of Dolibarr required by module |
|
96 | + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
97 | + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
98 | + //$this->automatic_activation = array('FR'=>'davWasAutomaticallyActivatedBecauseOfYourCountryChoice'); |
|
99 | + //$this->always_enabled = true; // If true, can't be disabled |
|
100 | + |
|
101 | + // Constants |
|
102 | + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
103 | + // Example: $this->const=array(0=>array('DAV_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
|
104 | + // 1=>array('DAV_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
|
105 | + // ); |
|
106 | + $this->const = array( |
|
107 | + //1=>array('DAV_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) |
|
108 | + ); |
|
109 | + |
|
110 | + |
|
111 | + if (! isset($conf->dav) || ! isset($conf->dav->enabled)) |
|
112 | + { |
|
113 | + $conf->dav=new stdClass(); |
|
114 | + $conf->dav->enabled=0; |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + // Array to add new pages in new tabs |
|
119 | 119 | $this->tabs = array(); |
120 | - // Example: |
|
121 | - // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@dav:$user->rights->dav->read:/dav/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 |
|
120 | + // Example: |
|
121 | + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@dav:$user->rights->dav->read:/dav/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 |
|
122 | 122 | // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@dav:$user->rights->othermodule->read:/dav/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. |
123 | 123 | // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname |
124 | 124 | // |
125 | 125 | // Where objecttype can be |
126 | - // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
127 | - // 'contact' to add a tab in contact view |
|
128 | - // 'contract' to add a tab in contract view |
|
129 | - // 'group' to add a tab in group view |
|
130 | - // 'intervention' to add a tab in intervention view |
|
131 | - // 'invoice' to add a tab in customer invoice view |
|
132 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
133 | - // 'member' to add a tab in fundation member view |
|
134 | - // 'opensurveypoll' to add a tab in opensurvey poll view |
|
135 | - // 'order' to add a tab in customer order view |
|
136 | - // 'order_supplier' to add a tab in supplier order view |
|
137 | - // 'payment' to add a tab in payment view |
|
138 | - // 'payment_supplier' to add a tab in supplier payment view |
|
139 | - // 'product' to add a tab in product view |
|
140 | - // 'propal' to add a tab in propal view |
|
141 | - // 'project' to add a tab in project view |
|
142 | - // 'stock' to add a tab in stock view |
|
143 | - // 'thirdparty' to add a tab in third party view |
|
144 | - // 'user' to add a tab in user view |
|
126 | + // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
127 | + // 'contact' to add a tab in contact view |
|
128 | + // 'contract' to add a tab in contract view |
|
129 | + // 'group' to add a tab in group view |
|
130 | + // 'intervention' to add a tab in intervention view |
|
131 | + // 'invoice' to add a tab in customer invoice view |
|
132 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
133 | + // 'member' to add a tab in fundation member view |
|
134 | + // 'opensurveypoll' to add a tab in opensurvey poll view |
|
135 | + // 'order' to add a tab in customer order view |
|
136 | + // 'order_supplier' to add a tab in supplier order view |
|
137 | + // 'payment' to add a tab in payment view |
|
138 | + // 'payment_supplier' to add a tab in supplier payment view |
|
139 | + // 'product' to add a tab in product view |
|
140 | + // 'propal' to add a tab in propal view |
|
141 | + // 'project' to add a tab in project view |
|
142 | + // 'stock' to add a tab in stock view |
|
143 | + // 'thirdparty' to add a tab in third party view |
|
144 | + // 'user' to add a tab in user view |
|
145 | 145 | |
146 | 146 | |
147 | 147 | // Dictionaries |
148 | - $this->dictionaries=array(); |
|
148 | + $this->dictionaries=array(); |
|
149 | 149 | /* Example: |
150 | 150 | $this->dictionaries=array( |
151 | 151 | 'langs'=>'mylangfile@dav', |
@@ -163,25 +163,25 @@ discard block |
||
163 | 163 | |
164 | 164 | |
165 | 165 | // Boxes/Widgets |
166 | - // Add here list of php file(s) stored in dav/core/boxes that contains class to show a widget. |
|
166 | + // Add here list of php file(s) stored in dav/core/boxes that contains class to show a widget. |
|
167 | 167 | $this->boxes = array( |
168 | - //0=>array('file'=>'davwidget1.php@dav','note'=>'Widget provided by dav','enabledbydefaulton'=>'Home'), |
|
169 | - //1=>array('file'=>'davwidget2.php@dav','note'=>'Widget provided by dav'), |
|
170 | - //2=>array('file'=>'davwidget3.php@dav','note'=>'Widget provided by dav') |
|
168 | + //0=>array('file'=>'davwidget1.php@dav','note'=>'Widget provided by dav','enabledbydefaulton'=>'Home'), |
|
169 | + //1=>array('file'=>'davwidget2.php@dav','note'=>'Widget provided by dav'), |
|
170 | + //2=>array('file'=>'davwidget3.php@dav','note'=>'Widget provided by dav') |
|
171 | 171 | ); |
172 | 172 | |
173 | 173 | |
174 | - // Cronjobs (List of cron jobs entries to add when module is enabled) |
|
175 | - // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week |
|
176 | - $this->cronjobs = array( |
|
177 | - 0=>array('label'=>'Email collector', 'priority'=>50, 'jobtype'=>'method', 'class'=>'/emailcollector/class/emailcollector.class.php', 'objectname'=>'EmailCollector', 'method'=>'doCollect', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>5, 'unitfrequency'=>60, 'status'=>1, 'test'=>'$conf->emailcollector->enabled') |
|
178 | - ); |
|
174 | + // Cronjobs (List of cron jobs entries to add when module is enabled) |
|
175 | + // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week |
|
176 | + $this->cronjobs = array( |
|
177 | + 0=>array('label'=>'Email collector', 'priority'=>50, 'jobtype'=>'method', 'class'=>'/emailcollector/class/emailcollector.class.php', 'objectname'=>'EmailCollector', 'method'=>'doCollect', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>5, 'unitfrequency'=>60, 'status'=>1, 'test'=>'$conf->emailcollector->enabled') |
|
178 | + ); |
|
179 | 179 | |
180 | 180 | |
181 | - // Permissions |
|
182 | - $this->rights = array(); // Permission array used by this module |
|
181 | + // Permissions |
|
182 | + $this->rights = array(); // Permission array used by this module |
|
183 | 183 | |
184 | - /* |
|
184 | + /* |
|
185 | 185 | $r=0; |
186 | 186 | $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) |
187 | 187 | $this->rights[$r][1] = 'Read myobject of dav'; // Permission label |
@@ -204,14 +204,14 @@ discard block |
||
204 | 204 | $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->dav->level1->level2) |
205 | 205 | */ |
206 | 206 | |
207 | - // Main menu entries |
|
208 | - $this->menu = array(); // List of menus to add |
|
209 | - $r=0; |
|
207 | + // Main menu entries |
|
208 | + $this->menu = array(); // List of menus to add |
|
209 | + $r=0; |
|
210 | 210 | |
211 | - // Add here entries to declare new menus |
|
211 | + // Add here entries to declare new menus |
|
212 | 212 | |
213 | - /* BEGIN MODULEBUILDER TOPMENU */ |
|
214 | - /*$this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
213 | + /* BEGIN MODULEBUILDER TOPMENU */ |
|
214 | + /*$this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
215 | 215 | 'type'=>'top', // This is a Top menu entry |
216 | 216 | 'titre'=>'dav', |
217 | 217 | 'mainmenu'=>'dav', |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | 'target'=>'', |
225 | 225 | 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
226 | 226 | */ |
227 | - /* END MODULEBUILDER TOPMENU */ |
|
227 | + /* END MODULEBUILDER TOPMENU */ |
|
228 | 228 | |
229 | - /* BEGIN MODULEBUILDER LEFTMENU MYOBJECT |
|
229 | + /* BEGIN MODULEBUILDER LEFTMENU MYOBJECT |
|
230 | 230 | $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=dav', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
231 | 231 | 'type'=>'left', // This is a Left menu entry |
232 | 232 | 'titre'=>'List MyObject', |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | END MODULEBUILDER LEFTMENU MYOBJECT */ |
255 | 255 | |
256 | 256 | |
257 | - // Exports |
|
258 | - $r=1; |
|
257 | + // Exports |
|
258 | + $r=1; |
|
259 | 259 | |
260 | - /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ |
|
261 | - /* |
|
260 | + /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ |
|
261 | + /* |
|
262 | 262 | $langs->load("dav@dav"); |
263 | 263 | $this->export_code[$r]=$this->rights_class.'_'.$r; |
264 | 264 | $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) |
@@ -273,48 +273,48 @@ discard block |
||
273 | 273 | $this->export_sql_end[$r] .=' WHERE 1 = 1'; |
274 | 274 | $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')'; |
275 | 275 | $r++; */ |
276 | - /* END MODULEBUILDER EXPORT MYOBJECT */ |
|
277 | - } |
|
278 | - |
|
279 | - /** |
|
280 | - * Function called when module is enabled. |
|
281 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
282 | - * It also creates data directories |
|
283 | - * |
|
276 | + /* END MODULEBUILDER EXPORT MYOBJECT */ |
|
277 | + } |
|
278 | + |
|
279 | + /** |
|
280 | + * Function called when module is enabled. |
|
281 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
282 | + * It also creates data directories |
|
283 | + * |
|
284 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
285 | + * @return int 1 if OK, 0 if KO |
|
286 | + */ |
|
287 | + public function init($options='') |
|
288 | + { |
|
289 | + //$this->_load_tables('/dav/sql/'); |
|
290 | + |
|
291 | + // Create extrafields |
|
292 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
293 | + $extrafields = new ExtraFields($this->db); |
|
294 | + |
|
295 | + //$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
296 | + //$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
297 | + //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
298 | + //$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1 '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
299 | + //$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
300 | + |
|
301 | + $sql = array(); |
|
302 | + |
|
303 | + return $this->_init($sql, $options); |
|
304 | + } |
|
305 | + |
|
306 | + /** |
|
307 | + * Function called when module is disabled. |
|
308 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
309 | + * Data directories are not deleted |
|
310 | + * |
|
284 | 311 | * @param string $options Options when enabling module ('', 'noboxes') |
285 | - * @return int 1 if OK, 0 if KO |
|
286 | - */ |
|
287 | - public function init($options='') |
|
288 | - { |
|
289 | - //$this->_load_tables('/dav/sql/'); |
|
290 | - |
|
291 | - // Create extrafields |
|
292 | - include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
293 | - $extrafields = new ExtraFields($this->db); |
|
294 | - |
|
295 | - //$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
296 | - //$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
297 | - //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
298 | - //$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1 '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
299 | - //$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
300 | - |
|
301 | - $sql = array(); |
|
302 | - |
|
303 | - return $this->_init($sql, $options); |
|
304 | - } |
|
305 | - |
|
306 | - /** |
|
307 | - * Function called when module is disabled. |
|
308 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
309 | - * Data directories are not deleted |
|
310 | - * |
|
311 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
312 | - * @return int 1 if OK, 0 if KO |
|
313 | - */ |
|
314 | - public function remove($options = '') |
|
315 | - { |
|
316 | - $sql = array(); |
|
317 | - |
|
318 | - return $this->_remove($sql, $options); |
|
319 | - } |
|
312 | + * @return int 1 if OK, 0 if KO |
|
313 | + */ |
|
314 | + public function remove($options = '') |
|
315 | + { |
|
316 | + $sql = array(); |
|
317 | + |
|
318 | + return $this->_remove($sql, $options); |
|
319 | + } |
|
320 | 320 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup dav |
24 | 24 | * \brief Description and activation file for module dav |
25 | 25 | */ |
26 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
26 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function __construct($db) |
40 | 40 | { |
41 | - global $langs,$conf; |
|
41 | + global $langs, $conf; |
|
42 | 42 | |
43 | 43 | $this->db = $db; |
44 | 44 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); |
58 | 58 | |
59 | 59 | // Module label (no space allowed), used if translation string 'ModuledavName' not found (MyModue is name of module). |
60 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
60 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
61 | 61 | // Module description, used if translation string 'ModuledavDesc' not found (MyModue is name of module). |
62 | 62 | $this->description = "EmailCollectorDescription"; |
63 | 63 | // Used only if file README.md and README-LL.md not found. |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | // Name of image file used for this module. |
71 | 71 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
72 | 72 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
73 | - $this->picto='email'; |
|
73 | + $this->picto = 'email'; |
|
74 | 74 | |
75 | 75 | // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
76 | 76 | // for default path (eg: /dav/core/xxxxx) (0=disable, 1=enable) |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | $this->config_page_url = array("emailcollector_list.php"); |
87 | 87 | |
88 | 88 | // Dependencies |
89 | - $this->hidden = false; // A condition to hide module |
|
90 | - $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
91 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
92 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
89 | + $this->hidden = false; // A condition to hide module |
|
90 | + $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
91 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
92 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
93 | 93 | $this->langfiles = array("admin"); |
94 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
95 | - $this->need_dolibarr_version = array(7,0); // Minimum version of Dolibarr required by module |
|
96 | - $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
97 | - $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
94 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
95 | + $this->need_dolibarr_version = array(7, 0); // Minimum version of Dolibarr required by module |
|
96 | + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
97 | + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
98 | 98 | //$this->automatic_activation = array('FR'=>'davWasAutomaticallyActivatedBecauseOfYourCountryChoice'); |
99 | 99 | //$this->always_enabled = true; // If true, can't be disabled |
100 | 100 | |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | ); |
109 | 109 | |
110 | 110 | |
111 | - if (! isset($conf->dav) || ! isset($conf->dav->enabled)) |
|
111 | + if (!isset($conf->dav) || !isset($conf->dav->enabled)) |
|
112 | 112 | { |
113 | - $conf->dav=new stdClass(); |
|
114 | - $conf->dav->enabled=0; |
|
113 | + $conf->dav = new stdClass(); |
|
114 | + $conf->dav->enabled = 0; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | |
147 | 147 | // Dictionaries |
148 | - $this->dictionaries=array(); |
|
148 | + $this->dictionaries = array(); |
|
149 | 149 | /* Example: |
150 | 150 | $this->dictionaries=array( |
151 | 151 | 'langs'=>'mylangfile@dav', |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | |
181 | 181 | // Permissions |
182 | - $this->rights = array(); // Permission array used by this module |
|
182 | + $this->rights = array(); // Permission array used by this module |
|
183 | 183 | |
184 | 184 | /* |
185 | 185 | $r=0; |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | */ |
206 | 206 | |
207 | 207 | // Main menu entries |
208 | - $this->menu = array(); // List of menus to add |
|
209 | - $r=0; |
|
208 | + $this->menu = array(); // List of menus to add |
|
209 | + $r = 0; |
|
210 | 210 | |
211 | 211 | // Add here entries to declare new menus |
212 | 212 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | |
257 | 257 | // Exports |
258 | - $r=1; |
|
258 | + $r = 1; |
|
259 | 259 | |
260 | 260 | /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ |
261 | 261 | /* |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * @param string $options Options when enabling module ('', 'noboxes') |
285 | 285 | * @return int 1 if OK, 0 if KO |
286 | 286 | */ |
287 | - public function init($options='') |
|
287 | + public function init($options = '') |
|
288 | 288 | { |
289 | 289 | //$this->_load_tables('/dav/sql/'); |
290 | 290 |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | abstract class ModeleAction extends CommonDocGenerator |
30 | 30 | { |
31 | 31 | /** |
32 | - * @var string Error code (or message) |
|
33 | - */ |
|
34 | - public $error=''; |
|
32 | + * @var string Error code (or message) |
|
33 | + */ |
|
34 | + public $error=''; |
|
35 | 35 | |
36 | 36 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
37 | 37 | /** |
@@ -72,86 +72,86 @@ discard block |
||
72 | 72 | function action_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) |
73 | 73 | { |
74 | 74 | // phpcs:enable |
75 | - global $conf,$langs,$user; |
|
76 | - $langs->load("action"); |
|
77 | - |
|
78 | - $error=0; |
|
79 | - |
|
80 | - $srctemplatepath=''; |
|
81 | - |
|
82 | - // Positionne modele sur le nom du modele de fichinter a utiliser |
|
83 | - if (! dol_strlen($modele)) |
|
84 | - { |
|
85 | - if (! empty($conf->global->ACTION_EVENT_ADDON_PDF)) |
|
86 | - { |
|
87 | - $modele = $conf->global->ACTION_EVENT_ADDON_PDF; |
|
88 | - } |
|
89 | - else |
|
90 | - { |
|
91 | - $modele = 'soleil'; |
|
92 | - } |
|
93 | - } |
|
94 | - |
|
95 | - // If selected modele is a filename template (then $modele="modelname:filename") |
|
96 | - $tmp=explode(':',$modele,2); |
|
75 | + global $conf,$langs,$user; |
|
76 | + $langs->load("action"); |
|
77 | + |
|
78 | + $error=0; |
|
79 | + |
|
80 | + $srctemplatepath=''; |
|
81 | + |
|
82 | + // Positionne modele sur le nom du modele de fichinter a utiliser |
|
83 | + if (! dol_strlen($modele)) |
|
84 | + { |
|
85 | + if (! empty($conf->global->ACTION_EVENT_ADDON_PDF)) |
|
86 | + { |
|
87 | + $modele = $conf->global->ACTION_EVENT_ADDON_PDF; |
|
88 | + } |
|
89 | + else |
|
90 | + { |
|
91 | + $modele = 'soleil'; |
|
92 | + } |
|
93 | + } |
|
94 | + |
|
95 | + // If selected modele is a filename template (then $modele="modelname:filename") |
|
96 | + $tmp=explode(':',$modele,2); |
|
97 | 97 | if (! empty($tmp[1])) |
98 | 98 | { |
99 | 99 | $modele=$tmp[0]; |
100 | 100 | $srctemplatepath=$tmp[1]; |
101 | 101 | } |
102 | 102 | |
103 | - // Search template files |
|
104 | - $file=''; $classname=''; $filefound=0; |
|
105 | - $dirmodels=array('/'); |
|
106 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
107 | - foreach($dirmodels as $reldir) |
|
108 | - { |
|
109 | - foreach(array('doc','pdf') as $prefix) |
|
110 | - { |
|
111 | - $file = $prefix."_".$modele.".modules.php"; |
|
112 | - |
|
113 | - // On verifie l'emplacement du modele |
|
114 | - $file=dol_buildpath($reldir."core/modules/action/doc/".$file,0); |
|
115 | - if (file_exists($file)) |
|
116 | - { |
|
117 | - $filefound=1; |
|
118 | - $classname=$prefix.'_'.$modele; |
|
119 | - break; |
|
120 | - } |
|
121 | - } |
|
122 | - if ($filefound) break; |
|
103 | + // Search template files |
|
104 | + $file=''; $classname=''; $filefound=0; |
|
105 | + $dirmodels=array('/'); |
|
106 | + if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
107 | + foreach($dirmodels as $reldir) |
|
108 | + { |
|
109 | + foreach(array('doc','pdf') as $prefix) |
|
110 | + { |
|
111 | + $file = $prefix."_".$modele.".modules.php"; |
|
112 | + |
|
113 | + // On verifie l'emplacement du modele |
|
114 | + $file=dol_buildpath($reldir."core/modules/action/doc/".$file,0); |
|
115 | + if (file_exists($file)) |
|
116 | + { |
|
117 | + $filefound=1; |
|
118 | + $classname=$prefix.'_'.$modele; |
|
119 | + break; |
|
120 | + } |
|
121 | + } |
|
122 | + if ($filefound) break; |
|
123 | 123 | } |
124 | 124 | |
125 | - // Charge le modele |
|
126 | - if ($filefound) |
|
127 | - { |
|
128 | - require_once $file; |
|
129 | - |
|
130 | - $obj = new $classname($db); |
|
131 | - |
|
132 | - // We save charset_output to restore it because write_file can change it if needed for |
|
133 | - // output format that does not support UTF8. |
|
134 | - $sav_charset_output=$outputlangs->charset_output; |
|
135 | - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
|
136 | - { |
|
137 | - $outputlangs->charset_output=$sav_charset_output; |
|
138 | - |
|
139 | - // We delete old preview |
|
140 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
141 | - dol_delete_preview($object); |
|
142 | - |
|
143 | - return 1; |
|
144 | - } |
|
145 | - else |
|
146 | - { |
|
147 | - $outputlangs->charset_output=$sav_charset_output; |
|
148 | - dol_print_error($db,"action_pdf_create Error: ".$obj->error); |
|
149 | - return 0; |
|
150 | - } |
|
151 | - } |
|
152 | - else |
|
153 | - { |
|
154 | - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
|
155 | - return 0; |
|
156 | - } |
|
125 | + // Charge le modele |
|
126 | + if ($filefound) |
|
127 | + { |
|
128 | + require_once $file; |
|
129 | + |
|
130 | + $obj = new $classname($db); |
|
131 | + |
|
132 | + // We save charset_output to restore it because write_file can change it if needed for |
|
133 | + // output format that does not support UTF8. |
|
134 | + $sav_charset_output=$outputlangs->charset_output; |
|
135 | + if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
|
136 | + { |
|
137 | + $outputlangs->charset_output=$sav_charset_output; |
|
138 | + |
|
139 | + // We delete old preview |
|
140 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
141 | + dol_delete_preview($object); |
|
142 | + |
|
143 | + return 1; |
|
144 | + } |
|
145 | + else |
|
146 | + { |
|
147 | + $outputlangs->charset_output=$sav_charset_output; |
|
148 | + dol_print_error($db,"action_pdf_create Error: ".$obj->error); |
|
149 | + return 0; |
|
150 | + } |
|
151 | + } |
|
152 | + else |
|
153 | + { |
|
154 | + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
|
155 | + return 0; |
|
156 | + } |
|
157 | 157 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @var string Error code (or message) |
33 | 33 | */ |
34 | - public $error=''; |
|
34 | + public $error = ''; |
|
35 | 35 | |
36 | 36 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
37 | 37 | /** |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | * @param integer $maxfilenamelength Max length of value to show |
42 | 42 | * @return array List of templates |
43 | 43 | */ |
44 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
44 | + static function liste_modeles($db, $maxfilenamelength = 0) |
|
45 | 45 | { |
46 | 46 | // phpcs:enable |
47 | 47 | global $conf; |
48 | 48 | |
49 | - $type='action'; |
|
50 | - $liste=array(); |
|
49 | + $type = 'action'; |
|
50 | + $liste = array(); |
|
51 | 51 | |
52 | 52 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
53 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
53 | + $liste = getListOfModels($db, $type, $maxfilenamelength); |
|
54 | 54 | |
55 | 55 | return $liste; |
56 | 56 | } |
@@ -69,20 +69,20 @@ discard block |
||
69 | 69 | * @param int $hideref Hide ref |
70 | 70 | * @return int 0 if KO, 1 if OK |
71 | 71 | */ |
72 | -function action_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) |
|
72 | +function action_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
73 | 73 | { |
74 | 74 | // phpcs:enable |
75 | - global $conf,$langs,$user; |
|
75 | + global $conf, $langs, $user; |
|
76 | 76 | $langs->load("action"); |
77 | 77 | |
78 | - $error=0; |
|
78 | + $error = 0; |
|
79 | 79 | |
80 | - $srctemplatepath=''; |
|
80 | + $srctemplatepath = ''; |
|
81 | 81 | |
82 | 82 | // Positionne modele sur le nom du modele de fichinter a utiliser |
83 | - if (! dol_strlen($modele)) |
|
83 | + if (!dol_strlen($modele)) |
|
84 | 84 | { |
85 | - if (! empty($conf->global->ACTION_EVENT_ADDON_PDF)) |
|
85 | + if (!empty($conf->global->ACTION_EVENT_ADDON_PDF)) |
|
86 | 86 | { |
87 | 87 | $modele = $conf->global->ACTION_EVENT_ADDON_PDF; |
88 | 88 | } |
@@ -93,29 +93,29 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | // If selected modele is a filename template (then $modele="modelname:filename") |
96 | - $tmp=explode(':',$modele,2); |
|
97 | - if (! empty($tmp[1])) |
|
96 | + $tmp = explode(':', $modele, 2); |
|
97 | + if (!empty($tmp[1])) |
|
98 | 98 | { |
99 | - $modele=$tmp[0]; |
|
100 | - $srctemplatepath=$tmp[1]; |
|
99 | + $modele = $tmp[0]; |
|
100 | + $srctemplatepath = $tmp[1]; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // Search template files |
104 | - $file=''; $classname=''; $filefound=0; |
|
105 | - $dirmodels=array('/'); |
|
106 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
107 | - foreach($dirmodels as $reldir) |
|
104 | + $file = ''; $classname = ''; $filefound = 0; |
|
105 | + $dirmodels = array('/'); |
|
106 | + if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
|
107 | + foreach ($dirmodels as $reldir) |
|
108 | 108 | { |
109 | - foreach(array('doc','pdf') as $prefix) |
|
109 | + foreach (array('doc', 'pdf') as $prefix) |
|
110 | 110 | { |
111 | 111 | $file = $prefix."_".$modele.".modules.php"; |
112 | 112 | |
113 | 113 | // On verifie l'emplacement du modele |
114 | - $file=dol_buildpath($reldir."core/modules/action/doc/".$file,0); |
|
114 | + $file = dol_buildpath($reldir."core/modules/action/doc/".$file, 0); |
|
115 | 115 | if (file_exists($file)) |
116 | 116 | { |
117 | - $filefound=1; |
|
118 | - $classname=$prefix.'_'.$modele; |
|
117 | + $filefound = 1; |
|
118 | + $classname = $prefix.'_'.$modele; |
|
119 | 119 | break; |
120 | 120 | } |
121 | 121 | } |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | |
132 | 132 | // We save charset_output to restore it because write_file can change it if needed for |
133 | 133 | // output format that does not support UTF8. |
134 | - $sav_charset_output=$outputlangs->charset_output; |
|
134 | + $sav_charset_output = $outputlangs->charset_output; |
|
135 | 135 | if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
136 | 136 | { |
137 | - $outputlangs->charset_output=$sav_charset_output; |
|
137 | + $outputlangs->charset_output = $sav_charset_output; |
|
138 | 138 | |
139 | 139 | // We delete old preview |
140 | 140 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | } |
145 | 145 | else |
146 | 146 | { |
147 | - $outputlangs->charset_output=$sav_charset_output; |
|
148 | - dol_print_error($db,"action_pdf_create Error: ".$obj->error); |
|
147 | + $outputlangs->charset_output = $sav_charset_output; |
|
148 | + dol_print_error($db, "action_pdf_create Error: ".$obj->error); |
|
149 | 149 | return 0; |
150 | 150 | } |
151 | 151 | } |
152 | 152 | else |
153 | 153 | { |
154 | - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
|
154 | + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file); |
|
155 | 155 | return 0; |
156 | 156 | } |
157 | 157 | } |
@@ -85,8 +85,7 @@ discard block |
||
85 | 85 | if (! empty($conf->global->ACTION_EVENT_ADDON_PDF)) |
86 | 86 | { |
87 | 87 | $modele = $conf->global->ACTION_EVENT_ADDON_PDF; |
88 | - } |
|
89 | - else |
|
88 | + } else |
|
90 | 89 | { |
91 | 90 | $modele = 'soleil'; |
92 | 91 | } |
@@ -103,7 +102,9 @@ discard block |
||
103 | 102 | // Search template files |
104 | 103 | $file=''; $classname=''; $filefound=0; |
105 | 104 | $dirmodels=array('/'); |
106 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
105 | + if (is_array($conf->modules_parts['models'])) { |
|
106 | + $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
107 | + } |
|
107 | 108 | foreach($dirmodels as $reldir) |
108 | 109 | { |
109 | 110 | foreach(array('doc','pdf') as $prefix) |
@@ -119,7 +120,9 @@ discard block |
||
119 | 120 | break; |
120 | 121 | } |
121 | 122 | } |
122 | - if ($filefound) break; |
|
123 | + if ($filefound) { |
|
124 | + break; |
|
125 | + } |
|
123 | 126 | } |
124 | 127 | |
125 | 128 | // Charge le modele |
@@ -141,15 +144,13 @@ discard block |
||
141 | 144 | dol_delete_preview($object); |
142 | 145 | |
143 | 146 | return 1; |
144 | - } |
|
145 | - else |
|
147 | + } else |
|
146 | 148 | { |
147 | 149 | $outputlangs->charset_output=$sav_charset_output; |
148 | 150 | dol_print_error($db,"action_pdf_create Error: ".$obj->error); |
149 | 151 | return 0; |
150 | 152 | } |
151 | - } |
|
152 | - else |
|
153 | + } else |
|
153 | 154 | { |
154 | 155 | print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
155 | 156 | return 0; |
@@ -35,115 +35,115 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class CommActionRapport |
37 | 37 | { |
38 | - /** |
|
38 | + /** |
|
39 | 39 | * @var DoliDB Database handler. |
40 | 40 | */ |
41 | 41 | public $db; |
42 | 42 | |
43 | - /** |
|
44 | - * @var string description |
|
45 | - */ |
|
46 | - public $description; |
|
43 | + /** |
|
44 | + * @var string description |
|
45 | + */ |
|
46 | + public $description; |
|
47 | 47 | |
48 | - public $date_edition; |
|
48 | + public $date_edition; |
|
49 | 49 | |
50 | - public $year; |
|
50 | + public $year; |
|
51 | 51 | |
52 | - public $month; |
|
52 | + public $month; |
|
53 | 53 | |
54 | - public $title; |
|
54 | + public $title; |
|
55 | 55 | |
56 | - public $subject; |
|
56 | + public $subject; |
|
57 | 57 | |
58 | - public $marge_gauche; |
|
58 | + public $marge_gauche; |
|
59 | 59 | |
60 | - public $marge_droite; |
|
60 | + public $marge_droite; |
|
61 | 61 | |
62 | - public $marge_haute; |
|
62 | + public $marge_haute; |
|
63 | 63 | |
64 | - public $marge_basse; |
|
64 | + public $marge_basse; |
|
65 | 65 | |
66 | 66 | |
67 | - /** |
|
68 | - * Constructor |
|
69 | - * |
|
70 | - * @param DoliDB $db Database handler |
|
71 | - * @param int $month Month |
|
72 | - * @param int $year Year |
|
73 | - */ |
|
74 | - function __construct($db, $month, $year) |
|
75 | - { |
|
76 | - global $conf, $langs; |
|
67 | + /** |
|
68 | + * Constructor |
|
69 | + * |
|
70 | + * @param DoliDB $db Database handler |
|
71 | + * @param int $month Month |
|
72 | + * @param int $year Year |
|
73 | + */ |
|
74 | + function __construct($db, $month, $year) |
|
75 | + { |
|
76 | + global $conf, $langs; |
|
77 | 77 | |
78 | - // Load translation files required by the page |
|
78 | + // Load translation files required by the page |
|
79 | 79 | $langs->loadLangs(array("commercial","projects")); |
80 | 80 | |
81 | - $this->db = $db; |
|
82 | - $this->description = ""; |
|
83 | - $this->date_edition = time(); |
|
84 | - $this->month = $month; |
|
85 | - $this->year = $year; |
|
86 | - |
|
87 | - // Dimension page pour format A4 |
|
88 | - $this->type = 'pdf'; |
|
89 | - $formatarray=pdf_getFormat(); |
|
90 | - $this->page_largeur = $formatarray['width']; |
|
91 | - $this->page_hauteur = $formatarray['height']; |
|
92 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
93 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
94 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
95 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
96 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
81 | + $this->db = $db; |
|
82 | + $this->description = ""; |
|
83 | + $this->date_edition = time(); |
|
84 | + $this->month = $month; |
|
85 | + $this->year = $year; |
|
86 | + |
|
87 | + // Dimension page pour format A4 |
|
88 | + $this->type = 'pdf'; |
|
89 | + $formatarray=pdf_getFormat(); |
|
90 | + $this->page_largeur = $formatarray['width']; |
|
91 | + $this->page_hauteur = $formatarray['height']; |
|
92 | + $this->format = array($this->page_largeur,$this->page_hauteur); |
|
93 | + $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
94 | + $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
95 | + $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
96 | + $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
97 | 97 | |
98 | 98 | $this->title=$langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month; |
99 | 99 | $this->subject=$langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month; |
100 | - } |
|
100 | + } |
|
101 | 101 | |
102 | 102 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
103 | - /** |
|
103 | + /** |
|
104 | 104 | * Write the object to document file to disk |
105 | 105 | * |
106 | 106 | * @param int $socid Thirdparty id |
107 | 107 | * @param int $catid Cat id |
108 | 108 | * @param Translate $outputlangs Lang object for output language |
109 | 109 | * @return int 1=OK, 0=KO |
110 | - */ |
|
111 | - function write_file($socid = 0, $catid = 0, $outputlangs='') |
|
112 | - { |
|
110 | + */ |
|
111 | + function write_file($socid = 0, $catid = 0, $outputlangs='') |
|
112 | + { |
|
113 | 113 | // phpcs:enable |
114 | - global $user,$conf,$langs,$hookmanager; |
|
114 | + global $user,$conf,$langs,$hookmanager; |
|
115 | 115 | |
116 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
117 | - // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
|
118 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
116 | + if (! is_object($outputlangs)) $outputlangs=$langs; |
|
117 | + // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
|
118 | + if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
119 | 119 | |
120 | - // Load traductions files requiredby by page |
|
121 | - $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products")); |
|
120 | + // Load traductions files requiredby by page |
|
121 | + $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products")); |
|
122 | 122 | |
123 | 123 | $dir = $conf->agenda->dir_temp."/"; |
124 | - $file = $dir . "actions-".$this->month."-".$this->year.".pdf"; |
|
125 | - |
|
126 | - if (! file_exists($dir)) |
|
127 | - { |
|
128 | - if (dol_mkdir($dir) < 0) |
|
129 | - { |
|
130 | - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
|
131 | - return 0; |
|
132 | - } |
|
133 | - } |
|
134 | - |
|
135 | - if (file_exists($dir)) |
|
136 | - { |
|
137 | - // Add pdfgeneration hook |
|
138 | - if (! is_object($hookmanager)) |
|
139 | - { |
|
140 | - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
141 | - $hookmanager=new HookManager($this->db); |
|
142 | - } |
|
143 | - $hookmanager->initHooks(array('pdfgeneration')); |
|
144 | - $parameters=array('file'=>$file, 'outputlangs'=>$outputlangs); |
|
145 | - global $action; |
|
146 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
124 | + $file = $dir . "actions-".$this->month."-".$this->year.".pdf"; |
|
125 | + |
|
126 | + if (! file_exists($dir)) |
|
127 | + { |
|
128 | + if (dol_mkdir($dir) < 0) |
|
129 | + { |
|
130 | + $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
|
131 | + return 0; |
|
132 | + } |
|
133 | + } |
|
134 | + |
|
135 | + if (file_exists($dir)) |
|
136 | + { |
|
137 | + // Add pdfgeneration hook |
|
138 | + if (! is_object($hookmanager)) |
|
139 | + { |
|
140 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
141 | + $hookmanager=new HookManager($this->db); |
|
142 | + } |
|
143 | + $hookmanager->initHooks(array('pdfgeneration')); |
|
144 | + $parameters=array('file'=>$file, 'outputlangs'=>$outputlangs); |
|
145 | + global $action; |
|
146 | + $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
147 | 147 | |
148 | 148 | $pdf=pdf_getInstance($this->format); |
149 | 149 | $heightforinfotot = 50; // Height reserved to output the info and total part |
@@ -158,204 +158,204 @@ discard block |
||
158 | 158 | } |
159 | 159 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
160 | 160 | |
161 | - $pdf->Open(); |
|
162 | - $pagenb=0; |
|
163 | - $pdf->SetDrawColor(128,128,128); |
|
164 | - $pdf->SetFillColor(220,220,220); |
|
161 | + $pdf->Open(); |
|
162 | + $pagenb=0; |
|
163 | + $pdf->SetDrawColor(128,128,128); |
|
164 | + $pdf->SetFillColor(220,220,220); |
|
165 | 165 | |
166 | - $pdf->SetTitle($outputlangs->convToOutputCharset($this->title)); |
|
167 | - $pdf->SetSubject($outputlangs->convToOutputCharset($this->subject)); |
|
168 | - $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
|
169 | - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
|
170 | - $pdf->SetKeywords($outputlangs->convToOutputCharset($this->title." ".$this->subject)); |
|
166 | + $pdf->SetTitle($outputlangs->convToOutputCharset($this->title)); |
|
167 | + $pdf->SetSubject($outputlangs->convToOutputCharset($this->subject)); |
|
168 | + $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
|
169 | + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
|
170 | + $pdf->SetKeywords($outputlangs->convToOutputCharset($this->title." ".$this->subject)); |
|
171 | 171 | |
172 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
172 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
173 | 173 | |
174 | - $nbpage = $this->_pages($pdf, $outputlangs); |
|
174 | + $nbpage = $this->_pages($pdf, $outputlangs); |
|
175 | 175 | |
176 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
177 | - $pdf->Close(); |
|
176 | + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
177 | + $pdf->Close(); |
|
178 | 178 | |
179 | - $pdf->Output($file,'F'); |
|
179 | + $pdf->Output($file,'F'); |
|
180 | 180 | |
181 | - // Add pdfgeneration hook |
|
182 | - if (! is_object($hookmanager)) |
|
183 | - { |
|
184 | - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
185 | - $hookmanager=new HookManager($this->db); |
|
186 | - } |
|
187 | - $hookmanager->initHooks(array('pdfgeneration')); |
|
188 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
189 | - global $action; |
|
190 | - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
181 | + // Add pdfgeneration hook |
|
182 | + if (! is_object($hookmanager)) |
|
183 | + { |
|
184 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
185 | + $hookmanager=new HookManager($this->db); |
|
186 | + } |
|
187 | + $hookmanager->initHooks(array('pdfgeneration')); |
|
188 | + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
189 | + global $action; |
|
190 | + $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
191 | 191 | |
192 | - if (! empty($conf->global->MAIN_UMASK)) |
|
193 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
192 | + if (! empty($conf->global->MAIN_UMASK)) |
|
193 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
194 | 194 | |
195 | - $this->result = array('fullpath'=>$file); |
|
195 | + $this->result = array('fullpath'=>$file); |
|
196 | 196 | |
197 | - return 1; |
|
198 | - } |
|
199 | - } |
|
197 | + return 1; |
|
198 | + } |
|
199 | + } |
|
200 | 200 | |
201 | - /** |
|
202 | - * Write content of pages |
|
203 | - * |
|
204 | - * @param PDF $pdf Object pdf |
|
201 | + /** |
|
202 | + * Write content of pages |
|
203 | + * |
|
204 | + * @param PDF $pdf Object pdf |
|
205 | 205 | * @param Translate $outputlangs Object langs |
206 | - * @return int 1 |
|
207 | - */ |
|
208 | - function _pages(&$pdf, $outputlangs) |
|
209 | - { |
|
210 | - global $conf; |
|
211 | - |
|
212 | - $height=3; // height for text separation |
|
213 | - $pagenb=1; |
|
214 | - |
|
215 | - $y=$this->_pagehead($pdf, $outputlangs, $pagenb); |
|
216 | - $y++; |
|
217 | - $pdf->SetFont('','',8); |
|
218 | - |
|
219 | - $sql = "SELECT s.nom as thirdparty, s.rowid as socid, s.client,"; |
|
220 | - $sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; |
|
221 | - $sql.= " a.fk_contact, a.note, a.percent as percent, a.label, a.fk_project,"; |
|
222 | - $sql.= " c.code, c.libelle,"; |
|
223 | - $sql.= " u.login"; |
|
224 | - $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; |
|
206 | + * @return int 1 |
|
207 | + */ |
|
208 | + function _pages(&$pdf, $outputlangs) |
|
209 | + { |
|
210 | + global $conf; |
|
211 | + |
|
212 | + $height=3; // height for text separation |
|
213 | + $pagenb=1; |
|
214 | + |
|
215 | + $y=$this->_pagehead($pdf, $outputlangs, $pagenb); |
|
216 | + $y++; |
|
217 | + $pdf->SetFont('','',8); |
|
218 | + |
|
219 | + $sql = "SELECT s.nom as thirdparty, s.rowid as socid, s.client,"; |
|
220 | + $sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; |
|
221 | + $sql.= " a.fk_contact, a.note, a.percent as percent, a.label, a.fk_project,"; |
|
222 | + $sql.= " c.code, c.libelle,"; |
|
223 | + $sql.= " u.login"; |
|
224 | + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; |
|
225 | 225 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
226 | - $sql.= " WHERE c.id=a.fk_action AND a.fk_user_author = u.rowid"; |
|
227 | - $sql.= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($this->year,$this->month,false))."'"; |
|
228 | - $sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'"; |
|
229 | - $sql.= " AND a.entity = ".$conf->entity; |
|
230 | - $sql.= " ORDER BY a.datep DESC"; |
|
231 | - |
|
232 | - $eventstatic=new ActionComm($this->db); |
|
233 | - $projectstatic=new Project($this->db); |
|
234 | - |
|
235 | - dol_syslog(get_class($this)."::_page", LOG_DEBUG); |
|
236 | - $resql=$this->db->query($sql); |
|
237 | - if ($resql) |
|
238 | - { |
|
239 | - $num = $this->db->num_rows($resql); |
|
240 | - $i = 0; |
|
241 | - $y0=$y1=$y2=$y3=0; |
|
242 | - |
|
243 | - while ($i < $num) |
|
244 | - { |
|
245 | - $obj = $this->db->fetch_object($resql); |
|
246 | - |
|
247 | - $eventstatic->id=$obj->id; |
|
248 | - $eventstatic->percentage=$obj->percent; |
|
249 | - $eventstatic->fulldayevent=$obj->fulldayevent; |
|
250 | - $eventstatic->punctual=$obj->punctual; |
|
251 | - |
|
252 | - $y = max($y, $pdf->GetY(), $y0, $y1, $y2, $y3); |
|
253 | - |
|
254 | - // Calculate height of text |
|
255 | - $text=''; |
|
256 | - if (! preg_match('/^'.preg_quote($obj->label).'/',$obj->note)) $text=$obj->label."\n"; |
|
257 | - $text.=$obj->note; |
|
258 | - $text=dol_trunc(dol_htmlentitiesbr_decode($text),150); |
|
259 | - // Add status to text |
|
260 | - $text.="\n"; |
|
261 | - $status=dol_htmlentitiesbr_decode($eventstatic->getLibStatut(1,1)); |
|
262 | - $text.=$status; |
|
263 | - if ($obj->fk_project > 0) |
|
264 | - { |
|
265 | - $projectstatic->fetch($obj->fk_project); |
|
266 | - $text.=($status?' - ':'').$outputlangs->transnoentitiesnoconv("Project").": ".dol_htmlentitiesbr_decode($projectstatic->getNomUrl(0, 'nolink')); |
|
267 | - } |
|
268 | - |
|
269 | - //print 'd'.$text; exit; |
|
270 | - $nboflines=dol_nboflines($text); |
|
271 | - $heightlinemax=max(2*$height,$nboflines*$height); |
|
272 | - // Check if there is enough space to print record |
|
273 | - if ((1+$y+$heightlinemax) >= ($this->page_hauteur - $this->marge_haute)) |
|
274 | - { |
|
275 | - // We need to break page |
|
276 | - $pagenb++; |
|
277 | - $y=$this->_pagehead($pdf, $outputlangs, $pagenb); |
|
278 | - $y++; |
|
279 | - $pdf->SetFont('','',8); |
|
280 | - } |
|
281 | - $y++; |
|
282 | - |
|
283 | - // Date |
|
284 | - $pdf->SetXY($this->marge_gauche, $y); |
|
285 | - $textdate = dol_print_date($this->db->jdate($obj->dp),"day")."\n".dol_print_date($this->db->jdate($obj->dp),"hour"); |
|
286 | - if ($obj->dp2) { |
|
287 | - if (dol_print_date($this->db->jdate($obj->dp),"day") != dol_print_date($this->db->jdate($obj->dp2),"day")) |
|
288 | - $textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "day")." - ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
289 | - else |
|
290 | - $textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
291 | - } |
|
292 | - $pdf->MultiCell(22, $height, $textdate, 0, 'L', 0); |
|
293 | - $y0 = $pdf->GetY(); |
|
294 | - |
|
295 | - // Third party |
|
296 | - $pdf->SetXY(26, $y); |
|
297 | - $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($obj->thirdparty),32), 0, 'L', 0); |
|
298 | - $y1 = $pdf->GetY(); |
|
299 | - |
|
300 | - // Action code |
|
301 | - $code=$obj->code; |
|
302 | - if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) |
|
303 | - { |
|
304 | - if ($code == 'AC_OTH') $code='AC_MANUAL'; |
|
305 | - if ($code == 'AC_OTH_AUTO') $code='AC_AUTO'; |
|
306 | - } |
|
307 | - $pdf->SetXY(60,$y); |
|
308 | - $labelactiontype = $outputlangs->transnoentitiesnoconv("Action".$code); |
|
309 | - $labelactiontypeshort = $outputlangs->transnoentitiesnoconv("Action".$code.'Short'); |
|
310 | - $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($labelactiontypeshort == "Action".$code.'Short' ? $labelactiontype : $labelactiontypeshort),32), 0, 'L', 0); |
|
311 | - $y2 = $pdf->GetY(); |
|
312 | - |
|
313 | - // Description of event |
|
314 | - $pdf->SetXY(106,$y); |
|
315 | - $pdf->MultiCell(94, $height, $outputlangs->convToOutputCharset($text), 0, 'L', 0); |
|
316 | - $y3 = $pdf->GetY(); |
|
317 | - |
|
318 | - $i++; |
|
319 | - } |
|
320 | - } |
|
321 | - |
|
322 | - return 1; |
|
323 | - } |
|
324 | - |
|
325 | - /** |
|
326 | - * Show top header of page. |
|
327 | - * |
|
328 | - * @param PDF $pdf Object PDF |
|
329 | - * @param Translate $outputlangs Object lang for output |
|
330 | - * @param int $pagenb Page nb |
|
331 | - * @return integer |
|
332 | - */ |
|
333 | - function _pagehead(&$pdf, $outputlangs, $pagenb) |
|
334 | - { |
|
335 | - global $conf,$langs; |
|
336 | - |
|
337 | - // Do not add the BACKGROUND as this is a report |
|
338 | - //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
339 | - |
|
340 | - // New page |
|
341 | - $pdf->AddPage(); |
|
342 | - |
|
343 | - // Show title |
|
344 | - $pdf->SetFont('','B',10); |
|
345 | - $pdf->SetXY($this->marge_gauche, $this->marge_haute); |
|
346 | - $pdf->MultiCell(120, 1, $outputlangs->convToOutputCharset($this->title), 0, 'L', 0); |
|
226 | + $sql.= " WHERE c.id=a.fk_action AND a.fk_user_author = u.rowid"; |
|
227 | + $sql.= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($this->year,$this->month,false))."'"; |
|
228 | + $sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'"; |
|
229 | + $sql.= " AND a.entity = ".$conf->entity; |
|
230 | + $sql.= " ORDER BY a.datep DESC"; |
|
231 | + |
|
232 | + $eventstatic=new ActionComm($this->db); |
|
233 | + $projectstatic=new Project($this->db); |
|
234 | + |
|
235 | + dol_syslog(get_class($this)."::_page", LOG_DEBUG); |
|
236 | + $resql=$this->db->query($sql); |
|
237 | + if ($resql) |
|
238 | + { |
|
239 | + $num = $this->db->num_rows($resql); |
|
240 | + $i = 0; |
|
241 | + $y0=$y1=$y2=$y3=0; |
|
242 | + |
|
243 | + while ($i < $num) |
|
244 | + { |
|
245 | + $obj = $this->db->fetch_object($resql); |
|
246 | + |
|
247 | + $eventstatic->id=$obj->id; |
|
248 | + $eventstatic->percentage=$obj->percent; |
|
249 | + $eventstatic->fulldayevent=$obj->fulldayevent; |
|
250 | + $eventstatic->punctual=$obj->punctual; |
|
251 | + |
|
252 | + $y = max($y, $pdf->GetY(), $y0, $y1, $y2, $y3); |
|
253 | + |
|
254 | + // Calculate height of text |
|
255 | + $text=''; |
|
256 | + if (! preg_match('/^'.preg_quote($obj->label).'/',$obj->note)) $text=$obj->label."\n"; |
|
257 | + $text.=$obj->note; |
|
258 | + $text=dol_trunc(dol_htmlentitiesbr_decode($text),150); |
|
259 | + // Add status to text |
|
260 | + $text.="\n"; |
|
261 | + $status=dol_htmlentitiesbr_decode($eventstatic->getLibStatut(1,1)); |
|
262 | + $text.=$status; |
|
263 | + if ($obj->fk_project > 0) |
|
264 | + { |
|
265 | + $projectstatic->fetch($obj->fk_project); |
|
266 | + $text.=($status?' - ':'').$outputlangs->transnoentitiesnoconv("Project").": ".dol_htmlentitiesbr_decode($projectstatic->getNomUrl(0, 'nolink')); |
|
267 | + } |
|
268 | + |
|
269 | + //print 'd'.$text; exit; |
|
270 | + $nboflines=dol_nboflines($text); |
|
271 | + $heightlinemax=max(2*$height,$nboflines*$height); |
|
272 | + // Check if there is enough space to print record |
|
273 | + if ((1+$y+$heightlinemax) >= ($this->page_hauteur - $this->marge_haute)) |
|
274 | + { |
|
275 | + // We need to break page |
|
276 | + $pagenb++; |
|
277 | + $y=$this->_pagehead($pdf, $outputlangs, $pagenb); |
|
278 | + $y++; |
|
279 | + $pdf->SetFont('','',8); |
|
280 | + } |
|
281 | + $y++; |
|
282 | + |
|
283 | + // Date |
|
284 | + $pdf->SetXY($this->marge_gauche, $y); |
|
285 | + $textdate = dol_print_date($this->db->jdate($obj->dp),"day")."\n".dol_print_date($this->db->jdate($obj->dp),"hour"); |
|
286 | + if ($obj->dp2) { |
|
287 | + if (dol_print_date($this->db->jdate($obj->dp),"day") != dol_print_date($this->db->jdate($obj->dp2),"day")) |
|
288 | + $textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "day")." - ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
289 | + else |
|
290 | + $textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
291 | + } |
|
292 | + $pdf->MultiCell(22, $height, $textdate, 0, 'L', 0); |
|
293 | + $y0 = $pdf->GetY(); |
|
294 | + |
|
295 | + // Third party |
|
296 | + $pdf->SetXY(26, $y); |
|
297 | + $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($obj->thirdparty),32), 0, 'L', 0); |
|
298 | + $y1 = $pdf->GetY(); |
|
299 | + |
|
300 | + // Action code |
|
301 | + $code=$obj->code; |
|
302 | + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) |
|
303 | + { |
|
304 | + if ($code == 'AC_OTH') $code='AC_MANUAL'; |
|
305 | + if ($code == 'AC_OTH_AUTO') $code='AC_AUTO'; |
|
306 | + } |
|
307 | + $pdf->SetXY(60,$y); |
|
308 | + $labelactiontype = $outputlangs->transnoentitiesnoconv("Action".$code); |
|
309 | + $labelactiontypeshort = $outputlangs->transnoentitiesnoconv("Action".$code.'Short'); |
|
310 | + $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($labelactiontypeshort == "Action".$code.'Short' ? $labelactiontype : $labelactiontypeshort),32), 0, 'L', 0); |
|
311 | + $y2 = $pdf->GetY(); |
|
312 | + |
|
313 | + // Description of event |
|
314 | + $pdf->SetXY(106,$y); |
|
315 | + $pdf->MultiCell(94, $height, $outputlangs->convToOutputCharset($text), 0, 'L', 0); |
|
316 | + $y3 = $pdf->GetY(); |
|
317 | + |
|
318 | + $i++; |
|
319 | + } |
|
320 | + } |
|
321 | + |
|
322 | + return 1; |
|
323 | + } |
|
324 | + |
|
325 | + /** |
|
326 | + * Show top header of page. |
|
327 | + * |
|
328 | + * @param PDF $pdf Object PDF |
|
329 | + * @param Translate $outputlangs Object lang for output |
|
330 | + * @param int $pagenb Page nb |
|
331 | + * @return integer |
|
332 | + */ |
|
333 | + function _pagehead(&$pdf, $outputlangs, $pagenb) |
|
334 | + { |
|
335 | + global $conf,$langs; |
|
336 | + |
|
337 | + // Do not add the BACKGROUND as this is a report |
|
338 | + //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
339 | + |
|
340 | + // New page |
|
341 | + $pdf->AddPage(); |
|
342 | + |
|
343 | + // Show title |
|
344 | + $pdf->SetFont('','B',10); |
|
345 | + $pdf->SetXY($this->marge_gauche, $this->marge_haute); |
|
346 | + $pdf->MultiCell(120, 1, $outputlangs->convToOutputCharset($this->title), 0, 'L', 0); |
|
347 | 347 | // Show page nb only on iso languages (so default Helvetica font) |
348 | 348 | if (pdf_getPDFFont($outputlangs) == 'Helvetica') |
349 | 349 | { |
350 | - $pdf->SetXY($this->page_largeur-$this->marge_droite-40, $this->marge_haute); |
|
350 | + $pdf->SetXY($this->page_largeur-$this->marge_droite-40, $this->marge_haute); |
|
351 | 351 | $pdf->MultiCell(40, 1, $pagenb.'/'.$pdf->getAliasNbPages(), 0, 'R', 0); |
352 | 352 | } |
353 | 353 | |
354 | - $y=$pdf->GetY()+2; |
|
354 | + $y=$pdf->GetY()+2; |
|
355 | 355 | |
356 | - $pdf->Rect($this->marge_gauche, $y, ($this->page_largeur - $this->marge_gauche - $this->marge_droite), ($this->page_hauteur - $this->marge_haute - $this->marge_basse)); |
|
357 | - $y=$pdf->GetY()+1; |
|
356 | + $pdf->Rect($this->marge_gauche, $y, ($this->page_largeur - $this->marge_gauche - $this->marge_droite), ($this->page_hauteur - $this->marge_haute - $this->marge_basse)); |
|
357 | + $y=$pdf->GetY()+1; |
|
358 | 358 | |
359 | - return $y; |
|
360 | - } |
|
359 | + return $y; |
|
360 | + } |
|
361 | 361 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | global $conf, $langs; |
77 | 77 | |
78 | 78 | // Load translation files required by the page |
79 | - $langs->loadLangs(array("commercial","projects")); |
|
79 | + $langs->loadLangs(array("commercial", "projects")); |
|
80 | 80 | |
81 | 81 | $this->db = $db; |
82 | 82 | $this->description = ""; |
@@ -86,17 +86,17 @@ discard block |
||
86 | 86 | |
87 | 87 | // Dimension page pour format A4 |
88 | 88 | $this->type = 'pdf'; |
89 | - $formatarray=pdf_getFormat(); |
|
89 | + $formatarray = pdf_getFormat(); |
|
90 | 90 | $this->page_largeur = $formatarray['width']; |
91 | 91 | $this->page_hauteur = $formatarray['height']; |
92 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
93 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
94 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
95 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
96 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
97 | - |
|
98 | - $this->title=$langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month; |
|
99 | - $this->subject=$langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month; |
|
92 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
93 | + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; |
|
94 | + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; |
|
95 | + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; |
|
96 | + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; |
|
97 | + |
|
98 | + $this->title = $langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month; |
|
99 | + $this->subject = $langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -108,26 +108,26 @@ discard block |
||
108 | 108 | * @param Translate $outputlangs Lang object for output language |
109 | 109 | * @return int 1=OK, 0=KO |
110 | 110 | */ |
111 | - function write_file($socid = 0, $catid = 0, $outputlangs='') |
|
111 | + function write_file($socid = 0, $catid = 0, $outputlangs = '') |
|
112 | 112 | { |
113 | 113 | // phpcs:enable |
114 | - global $user,$conf,$langs,$hookmanager; |
|
114 | + global $user, $conf, $langs, $hookmanager; |
|
115 | 115 | |
116 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
116 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
117 | 117 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
118 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
118 | + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
119 | 119 | |
120 | 120 | // Load traductions files requiredby by page |
121 | 121 | $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products")); |
122 | 122 | |
123 | 123 | $dir = $conf->agenda->dir_temp."/"; |
124 | - $file = $dir . "actions-".$this->month."-".$this->year.".pdf"; |
|
124 | + $file = $dir."actions-".$this->month."-".$this->year.".pdf"; |
|
125 | 125 | |
126 | - if (! file_exists($dir)) |
|
126 | + if (!file_exists($dir)) |
|
127 | 127 | { |
128 | 128 | if (dol_mkdir($dir) < 0) |
129 | 129 | { |
130 | - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
|
130 | + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); |
|
131 | 131 | return 0; |
132 | 132 | } |
133 | 133 | } |
@@ -135,21 +135,21 @@ discard block |
||
135 | 135 | if (file_exists($dir)) |
136 | 136 | { |
137 | 137 | // Add pdfgeneration hook |
138 | - if (! is_object($hookmanager)) |
|
138 | + if (!is_object($hookmanager)) |
|
139 | 139 | { |
140 | 140 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
141 | - $hookmanager=new HookManager($this->db); |
|
141 | + $hookmanager = new HookManager($this->db); |
|
142 | 142 | } |
143 | 143 | $hookmanager->initHooks(array('pdfgeneration')); |
144 | - $parameters=array('file'=>$file, 'outputlangs'=>$outputlangs); |
|
144 | + $parameters = array('file'=>$file, 'outputlangs'=>$outputlangs); |
|
145 | 145 | global $action; |
146 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
146 | + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
147 | 147 | |
148 | - $pdf=pdf_getInstance($this->format); |
|
149 | - $heightforinfotot = 50; // Height reserved to output the info and total part |
|
150 | - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
151 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
152 | - $pdf->SetAutoPageBreak(1,0); |
|
148 | + $pdf = pdf_getInstance($this->format); |
|
149 | + $heightforinfotot = 50; // Height reserved to output the info and total part |
|
150 | + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page |
|
151 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
152 | + $pdf->SetAutoPageBreak(1, 0); |
|
153 | 153 | |
154 | 154 | if (class_exists('TCPDF')) |
155 | 155 | { |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
160 | 160 | |
161 | 161 | $pdf->Open(); |
162 | - $pagenb=0; |
|
163 | - $pdf->SetDrawColor(128,128,128); |
|
164 | - $pdf->SetFillColor(220,220,220); |
|
162 | + $pagenb = 0; |
|
163 | + $pdf->SetDrawColor(128, 128, 128); |
|
164 | + $pdf->SetFillColor(220, 220, 220); |
|
165 | 165 | |
166 | 166 | $pdf->SetTitle($outputlangs->convToOutputCharset($this->title)); |
167 | 167 | $pdf->SetSubject($outputlangs->convToOutputCharset($this->subject)); |
@@ -169,27 +169,27 @@ discard block |
||
169 | 169 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
170 | 170 | $pdf->SetKeywords($outputlangs->convToOutputCharset($this->title." ".$this->subject)); |
171 | 171 | |
172 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
172 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
173 | 173 | |
174 | 174 | $nbpage = $this->_pages($pdf, $outputlangs); |
175 | 175 | |
176 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
176 | + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
177 | 177 | $pdf->Close(); |
178 | 178 | |
179 | - $pdf->Output($file,'F'); |
|
179 | + $pdf->Output($file, 'F'); |
|
180 | 180 | |
181 | 181 | // Add pdfgeneration hook |
182 | - if (! is_object($hookmanager)) |
|
182 | + if (!is_object($hookmanager)) |
|
183 | 183 | { |
184 | 184 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
185 | - $hookmanager=new HookManager($this->db); |
|
185 | + $hookmanager = new HookManager($this->db); |
|
186 | 186 | } |
187 | 187 | $hookmanager->initHooks(array('pdfgeneration')); |
188 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
188 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
189 | 189 | global $action; |
190 | - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
190 | + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
191 | 191 | |
192 | - if (! empty($conf->global->MAIN_UMASK)) |
|
192 | + if (!empty($conf->global->MAIN_UMASK)) |
|
193 | 193 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
194 | 194 | |
195 | 195 | $this->result = array('fullpath'=>$file); |
@@ -209,109 +209,109 @@ discard block |
||
209 | 209 | { |
210 | 210 | global $conf; |
211 | 211 | |
212 | - $height=3; // height for text separation |
|
213 | - $pagenb=1; |
|
212 | + $height = 3; // height for text separation |
|
213 | + $pagenb = 1; |
|
214 | 214 | |
215 | - $y=$this->_pagehead($pdf, $outputlangs, $pagenb); |
|
215 | + $y = $this->_pagehead($pdf, $outputlangs, $pagenb); |
|
216 | 216 | $y++; |
217 | - $pdf->SetFont('','',8); |
|
217 | + $pdf->SetFont('', '', 8); |
|
218 | 218 | |
219 | 219 | $sql = "SELECT s.nom as thirdparty, s.rowid as socid, s.client,"; |
220 | - $sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; |
|
221 | - $sql.= " a.fk_contact, a.note, a.percent as percent, a.label, a.fk_project,"; |
|
222 | - $sql.= " c.code, c.libelle,"; |
|
223 | - $sql.= " u.login"; |
|
224 | - $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; |
|
225 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
|
226 | - $sql.= " WHERE c.id=a.fk_action AND a.fk_user_author = u.rowid"; |
|
227 | - $sql.= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($this->year,$this->month,false))."'"; |
|
228 | - $sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'"; |
|
229 | - $sql.= " AND a.entity = ".$conf->entity; |
|
230 | - $sql.= " ORDER BY a.datep DESC"; |
|
231 | - |
|
232 | - $eventstatic=new ActionComm($this->db); |
|
233 | - $projectstatic=new Project($this->db); |
|
220 | + $sql .= " a.id, a.datep as dp, a.datep2 as dp2,"; |
|
221 | + $sql .= " a.fk_contact, a.note, a.percent as percent, a.label, a.fk_project,"; |
|
222 | + $sql .= " c.code, c.libelle,"; |
|
223 | + $sql .= " u.login"; |
|
224 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; |
|
225 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
|
226 | + $sql .= " WHERE c.id=a.fk_action AND a.fk_user_author = u.rowid"; |
|
227 | + $sql .= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($this->year, $this->month, false))."'"; |
|
228 | + $sql .= " AND '".$this->db->idate(dol_get_last_day($this->year, $this->month, false))."'"; |
|
229 | + $sql .= " AND a.entity = ".$conf->entity; |
|
230 | + $sql .= " ORDER BY a.datep DESC"; |
|
231 | + |
|
232 | + $eventstatic = new ActionComm($this->db); |
|
233 | + $projectstatic = new Project($this->db); |
|
234 | 234 | |
235 | 235 | dol_syslog(get_class($this)."::_page", LOG_DEBUG); |
236 | - $resql=$this->db->query($sql); |
|
236 | + $resql = $this->db->query($sql); |
|
237 | 237 | if ($resql) |
238 | 238 | { |
239 | 239 | $num = $this->db->num_rows($resql); |
240 | 240 | $i = 0; |
241 | - $y0=$y1=$y2=$y3=0; |
|
241 | + $y0 = $y1 = $y2 = $y3 = 0; |
|
242 | 242 | |
243 | 243 | while ($i < $num) |
244 | 244 | { |
245 | 245 | $obj = $this->db->fetch_object($resql); |
246 | 246 | |
247 | - $eventstatic->id=$obj->id; |
|
248 | - $eventstatic->percentage=$obj->percent; |
|
249 | - $eventstatic->fulldayevent=$obj->fulldayevent; |
|
250 | - $eventstatic->punctual=$obj->punctual; |
|
247 | + $eventstatic->id = $obj->id; |
|
248 | + $eventstatic->percentage = $obj->percent; |
|
249 | + $eventstatic->fulldayevent = $obj->fulldayevent; |
|
250 | + $eventstatic->punctual = $obj->punctual; |
|
251 | 251 | |
252 | 252 | $y = max($y, $pdf->GetY(), $y0, $y1, $y2, $y3); |
253 | 253 | |
254 | 254 | // Calculate height of text |
255 | - $text=''; |
|
256 | - if (! preg_match('/^'.preg_quote($obj->label).'/',$obj->note)) $text=$obj->label."\n"; |
|
257 | - $text.=$obj->note; |
|
258 | - $text=dol_trunc(dol_htmlentitiesbr_decode($text),150); |
|
255 | + $text = ''; |
|
256 | + if (!preg_match('/^'.preg_quote($obj->label).'/', $obj->note)) $text = $obj->label."\n"; |
|
257 | + $text .= $obj->note; |
|
258 | + $text = dol_trunc(dol_htmlentitiesbr_decode($text), 150); |
|
259 | 259 | // Add status to text |
260 | - $text.="\n"; |
|
261 | - $status=dol_htmlentitiesbr_decode($eventstatic->getLibStatut(1,1)); |
|
262 | - $text.=$status; |
|
260 | + $text .= "\n"; |
|
261 | + $status = dol_htmlentitiesbr_decode($eventstatic->getLibStatut(1, 1)); |
|
262 | + $text .= $status; |
|
263 | 263 | if ($obj->fk_project > 0) |
264 | 264 | { |
265 | 265 | $projectstatic->fetch($obj->fk_project); |
266 | - $text.=($status?' - ':'').$outputlangs->transnoentitiesnoconv("Project").": ".dol_htmlentitiesbr_decode($projectstatic->getNomUrl(0, 'nolink')); |
|
266 | + $text .= ($status ? ' - ' : '').$outputlangs->transnoentitiesnoconv("Project").": ".dol_htmlentitiesbr_decode($projectstatic->getNomUrl(0, 'nolink')); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | //print 'd'.$text; exit; |
270 | - $nboflines=dol_nboflines($text); |
|
271 | - $heightlinemax=max(2*$height,$nboflines*$height); |
|
270 | + $nboflines = dol_nboflines($text); |
|
271 | + $heightlinemax = max(2 * $height, $nboflines * $height); |
|
272 | 272 | // Check if there is enough space to print record |
273 | - if ((1+$y+$heightlinemax) >= ($this->page_hauteur - $this->marge_haute)) |
|
273 | + if ((1 + $y + $heightlinemax) >= ($this->page_hauteur - $this->marge_haute)) |
|
274 | 274 | { |
275 | 275 | // We need to break page |
276 | 276 | $pagenb++; |
277 | - $y=$this->_pagehead($pdf, $outputlangs, $pagenb); |
|
277 | + $y = $this->_pagehead($pdf, $outputlangs, $pagenb); |
|
278 | 278 | $y++; |
279 | - $pdf->SetFont('','',8); |
|
279 | + $pdf->SetFont('', '', 8); |
|
280 | 280 | } |
281 | 281 | $y++; |
282 | 282 | |
283 | 283 | // Date |
284 | 284 | $pdf->SetXY($this->marge_gauche, $y); |
285 | - $textdate = dol_print_date($this->db->jdate($obj->dp),"day")."\n".dol_print_date($this->db->jdate($obj->dp),"hour"); |
|
285 | + $textdate = dol_print_date($this->db->jdate($obj->dp), "day")."\n".dol_print_date($this->db->jdate($obj->dp), "hour"); |
|
286 | 286 | if ($obj->dp2) { |
287 | - if (dol_print_date($this->db->jdate($obj->dp),"day") != dol_print_date($this->db->jdate($obj->dp2),"day")) |
|
288 | - $textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "day")." - ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
287 | + if (dol_print_date($this->db->jdate($obj->dp), "day") != dol_print_date($this->db->jdate($obj->dp2), "day")) |
|
288 | + $textdate .= " -> ".dol_print_date($this->db->jdate($obj->dp2), "day")." - ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
289 | 289 | else |
290 | - $textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
290 | + $textdate .= " -> ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
291 | 291 | } |
292 | 292 | $pdf->MultiCell(22, $height, $textdate, 0, 'L', 0); |
293 | 293 | $y0 = $pdf->GetY(); |
294 | 294 | |
295 | 295 | // Third party |
296 | 296 | $pdf->SetXY(26, $y); |
297 | - $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($obj->thirdparty),32), 0, 'L', 0); |
|
297 | + $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($obj->thirdparty), 32), 0, 'L', 0); |
|
298 | 298 | $y1 = $pdf->GetY(); |
299 | 299 | |
300 | 300 | // Action code |
301 | - $code=$obj->code; |
|
301 | + $code = $obj->code; |
|
302 | 302 | if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) |
303 | 303 | { |
304 | - if ($code == 'AC_OTH') $code='AC_MANUAL'; |
|
305 | - if ($code == 'AC_OTH_AUTO') $code='AC_AUTO'; |
|
304 | + if ($code == 'AC_OTH') $code = 'AC_MANUAL'; |
|
305 | + if ($code == 'AC_OTH_AUTO') $code = 'AC_AUTO'; |
|
306 | 306 | } |
307 | - $pdf->SetXY(60,$y); |
|
307 | + $pdf->SetXY(60, $y); |
|
308 | 308 | $labelactiontype = $outputlangs->transnoentitiesnoconv("Action".$code); |
309 | 309 | $labelactiontypeshort = $outputlangs->transnoentitiesnoconv("Action".$code.'Short'); |
310 | - $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($labelactiontypeshort == "Action".$code.'Short' ? $labelactiontype : $labelactiontypeshort),32), 0, 'L', 0); |
|
310 | + $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($labelactiontypeshort == "Action".$code.'Short' ? $labelactiontype : $labelactiontypeshort), 32), 0, 'L', 0); |
|
311 | 311 | $y2 = $pdf->GetY(); |
312 | 312 | |
313 | 313 | // Description of event |
314 | - $pdf->SetXY(106,$y); |
|
314 | + $pdf->SetXY(106, $y); |
|
315 | 315 | $pdf->MultiCell(94, $height, $outputlangs->convToOutputCharset($text), 0, 'L', 0); |
316 | 316 | $y3 = $pdf->GetY(); |
317 | 317 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | function _pagehead(&$pdf, $outputlangs, $pagenb) |
334 | 334 | { |
335 | - global $conf,$langs; |
|
335 | + global $conf, $langs; |
|
336 | 336 | |
337 | 337 | // Do not add the BACKGROUND as this is a report |
338 | 338 | //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
@@ -341,20 +341,20 @@ discard block |
||
341 | 341 | $pdf->AddPage(); |
342 | 342 | |
343 | 343 | // Show title |
344 | - $pdf->SetFont('','B',10); |
|
344 | + $pdf->SetFont('', 'B', 10); |
|
345 | 345 | $pdf->SetXY($this->marge_gauche, $this->marge_haute); |
346 | 346 | $pdf->MultiCell(120, 1, $outputlangs->convToOutputCharset($this->title), 0, 'L', 0); |
347 | 347 | // Show page nb only on iso languages (so default Helvetica font) |
348 | 348 | if (pdf_getPDFFont($outputlangs) == 'Helvetica') |
349 | 349 | { |
350 | - $pdf->SetXY($this->page_largeur-$this->marge_droite-40, $this->marge_haute); |
|
350 | + $pdf->SetXY($this->page_largeur - $this->marge_droite - 40, $this->marge_haute); |
|
351 | 351 | $pdf->MultiCell(40, 1, $pagenb.'/'.$pdf->getAliasNbPages(), 0, 'R', 0); |
352 | 352 | } |
353 | 353 | |
354 | - $y=$pdf->GetY()+2; |
|
354 | + $y = $pdf->GetY() + 2; |
|
355 | 355 | |
356 | 356 | $pdf->Rect($this->marge_gauche, $y, ($this->page_largeur - $this->marge_gauche - $this->marge_droite), ($this->page_hauteur - $this->marge_haute - $this->marge_basse)); |
357 | - $y=$pdf->GetY()+1; |
|
357 | + $y = $pdf->GetY() + 1; |
|
358 | 358 | |
359 | 359 | return $y; |
360 | 360 | } |
@@ -113,9 +113,13 @@ discard block |
||
113 | 113 | // phpcs:enable |
114 | 114 | global $user,$conf,$langs,$hookmanager; |
115 | 115 | |
116 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
116 | + if (! is_object($outputlangs)) { |
|
117 | + $outputlangs=$langs; |
|
118 | + } |
|
117 | 119 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
118 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
120 | + if (! empty($conf->global->MAIN_USE_FPDF)) { |
|
121 | + $outputlangs->charset_output='ISO-8859-1'; |
|
122 | + } |
|
119 | 123 | |
120 | 124 | // Load traductions files requiredby by page |
121 | 125 | $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products")); |
@@ -173,7 +177,9 @@ discard block |
||
173 | 177 | |
174 | 178 | $nbpage = $this->_pages($pdf, $outputlangs); |
175 | 179 | |
176 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
180 | + if (method_exists($pdf,'AliasNbPages')) { |
|
181 | + $pdf->AliasNbPages(); |
|
182 | + } |
|
177 | 183 | $pdf->Close(); |
178 | 184 | |
179 | 185 | $pdf->Output($file,'F'); |
@@ -189,8 +195,9 @@ discard block |
||
189 | 195 | global $action; |
190 | 196 | $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
191 | 197 | |
192 | - if (! empty($conf->global->MAIN_UMASK)) |
|
193 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
198 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
199 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
200 | + } |
|
194 | 201 | |
195 | 202 | $this->result = array('fullpath'=>$file); |
196 | 203 | |
@@ -253,7 +260,9 @@ discard block |
||
253 | 260 | |
254 | 261 | // Calculate height of text |
255 | 262 | $text=''; |
256 | - if (! preg_match('/^'.preg_quote($obj->label).'/',$obj->note)) $text=$obj->label."\n"; |
|
263 | + if (! preg_match('/^'.preg_quote($obj->label).'/',$obj->note)) { |
|
264 | + $text=$obj->label."\n"; |
|
265 | + } |
|
257 | 266 | $text.=$obj->note; |
258 | 267 | $text=dol_trunc(dol_htmlentitiesbr_decode($text),150); |
259 | 268 | // Add status to text |
@@ -284,10 +293,11 @@ discard block |
||
284 | 293 | $pdf->SetXY($this->marge_gauche, $y); |
285 | 294 | $textdate = dol_print_date($this->db->jdate($obj->dp),"day")."\n".dol_print_date($this->db->jdate($obj->dp),"hour"); |
286 | 295 | if ($obj->dp2) { |
287 | - if (dol_print_date($this->db->jdate($obj->dp),"day") != dol_print_date($this->db->jdate($obj->dp2),"day")) |
|
288 | - $textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "day")." - ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
289 | - else |
|
290 | - $textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
296 | + if (dol_print_date($this->db->jdate($obj->dp),"day") != dol_print_date($this->db->jdate($obj->dp2),"day")) { |
|
297 | + $textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "day")." - ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
298 | + } else { |
|
299 | + $textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "hour"); |
|
300 | + } |
|
291 | 301 | } |
292 | 302 | $pdf->MultiCell(22, $height, $textdate, 0, 'L', 0); |
293 | 303 | $y0 = $pdf->GetY(); |
@@ -301,8 +311,12 @@ discard block |
||
301 | 311 | $code=$obj->code; |
302 | 312 | if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) |
303 | 313 | { |
304 | - if ($code == 'AC_OTH') $code='AC_MANUAL'; |
|
305 | - if ($code == 'AC_OTH_AUTO') $code='AC_AUTO'; |
|
314 | + if ($code == 'AC_OTH') { |
|
315 | + $code='AC_MANUAL'; |
|
316 | + } |
|
317 | + if ($code == 'AC_OTH_AUTO') { |
|
318 | + $code='AC_AUTO'; |
|
319 | + } |
|
306 | 320 | } |
307 | 321 | $pdf->SetXY(60,$y); |
308 | 322 | $labelactiontype = $outputlangs->transnoentitiesnoconv("Action".$code); |
@@ -210,15 +210,15 @@ |
||
210 | 210 | */ |
211 | 211 | public function init($options = '') |
212 | 212 | { |
213 | - global $langs; |
|
213 | + global $langs; |
|
214 | 214 | |
215 | - $this->_load_tables('/datapolicy/sql/'); |
|
215 | + $this->_load_tables('/datapolicy/sql/'); |
|
216 | 216 | |
217 | 217 | // Create extrafields |
218 | 218 | include_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
219 | 219 | $extrafields = new ExtraFields($this->db); |
220 | 220 | |
221 | - /* |
|
221 | + /* |
|
222 | 222 | // Extrafield contact |
223 | 223 | $result1 = $extrafields->addExtraField('datapolicy_consentement', $langs->trans("DATAPOLICY_consentement"), 'boolean', 101, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled'); |
224 | 224 | $result1 = $extrafields->addExtraField('datapolicy_opposition_traitement', $langs->trans("DATAPOLICY_opposition_traitement"), 'boolean', 102, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled'); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \ingroup datapolicy |
26 | 26 | * \brief Description and activation file for module DATAPOLICY |
27 | 27 | */ |
28 | -include_once DOL_DOCUMENT_ROOT . '/core/modules/DolibarrModules.class.php'; |
|
28 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' |
73 | 73 | $this->version = 'development'; |
74 | 74 | // Key used in llx_const table to save module status enabled/disabled (where datapolicy is value of property name of module in uppercase) |
75 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
75 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
76 | 76 | // Name of image file used for this module. |
77 | 77 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
78 | 78 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | $this->config_page_url = array("setup.php@datapolicy"); |
103 | 103 | |
104 | 104 | // Dependencies |
105 | - $this->hidden = false; // A condition to hide module |
|
106 | - $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
105 | + $this->hidden = false; // A condition to hide module |
|
106 | + $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
107 | 107 | $this->requiredby = array(); // List of module ids to disable if this one is disabled |
108 | 108 | $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
109 | 109 | $this->langfiles = array("datapolicy@datapolicy"); |
110 | - $this->phpmin = array(5, 3); // Minimum version of PHP required by module |
|
110 | + $this->phpmin = array(5, 3); // Minimum version of PHP required by module |
|
111 | 111 | $this->need_dolibarr_version = array(4, 0); // Minimum version of Dolibarr required by module |
112 | - $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
113 | - $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
112 | + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
113 | + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
114 | 114 | //$this->automatic_activation = array('FR'=>'datapolicyWasAutomaticallyActivatedBecauseOfYourCountryChoice'); |
115 | 115 | //$this->always_enabled = true; // If true, can't be disabled |
116 | 116 | // Constants |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true) |
195 | 195 | // ); |
196 | 196 | // Permissions |
197 | - $this->rights = array(); // Permission array used by this module |
|
197 | + $this->rights = array(); // Permission array used by this module |
|
198 | 198 | // Main menu entries |
199 | - $this->menu = array(); // List of menus to add |
|
199 | + $this->menu = array(); // List of menus to add |
|
200 | 200 | $r = 0; |
201 | 201 | } |
202 | 202 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $this->_load_tables('/datapolicy/sql/'); |
216 | 216 | |
217 | 217 | // Create extrafields |
218 | - include_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
218 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
219 | 219 | $extrafields = new ExtraFields($this->db); |
220 | 220 | |
221 | 221 | /* |
@@ -38,386 +38,386 @@ |
||
38 | 38 | class modAgenda extends DolibarrModules |
39 | 39 | { |
40 | 40 | |
41 | - /** |
|
42 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
43 | - * |
|
44 | - * @param DoliDB $db Database handler |
|
45 | - */ |
|
46 | - function __construct($db) |
|
47 | - { |
|
48 | - global $conf, $user; |
|
41 | + /** |
|
42 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
43 | + * |
|
44 | + * @param DoliDB $db Database handler |
|
45 | + */ |
|
46 | + function __construct($db) |
|
47 | + { |
|
48 | + global $conf, $user; |
|
49 | 49 | |
50 | - $this->db = $db; |
|
51 | - $this->numero = 2400; |
|
50 | + $this->db = $db; |
|
51 | + $this->numero = 2400; |
|
52 | 52 | |
53 | - $this->family = "projects"; |
|
54 | - $this->module_position = '15'; |
|
55 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
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."; |
|
58 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
59 | - $this->version = 'dolibarr'; |
|
60 | - // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
61 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
62 | - $this->picto='action'; |
|
53 | + $this->family = "projects"; |
|
54 | + $this->module_position = '15'; |
|
55 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
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."; |
|
58 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
59 | + $this->version = 'dolibarr'; |
|
60 | + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
61 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
62 | + $this->picto='action'; |
|
63 | 63 | |
64 | - // Data directories to create when module is enabled |
|
65 | - $this->dirs = array("/agenda/temp"); |
|
64 | + // Data directories to create when module is enabled |
|
65 | + $this->dirs = array("/agenda/temp"); |
|
66 | 66 | |
67 | - // Config pages |
|
68 | - $this->config_page_url = array("agenda_other.php"); |
|
67 | + // Config pages |
|
68 | + $this->config_page_url = array("agenda_other.php"); |
|
69 | 69 | |
70 | - // Dependencies |
|
71 | - $this->hidden = false; // A condition to hide module |
|
72 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
73 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
75 | - $this->langfiles = array("companies"); |
|
76 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
70 | + // Dependencies |
|
71 | + $this->hidden = false; // A condition to hide module |
|
72 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
73 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
75 | + $this->langfiles = array("companies"); |
|
76 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
77 | 77 | |
78 | - // Module parts |
|
78 | + // Module parts |
|
79 | 79 | $this->module_parts = array(); |
80 | 80 | |
81 | - // Constants |
|
81 | + // Constants |
|
82 | 82 | //----------- |
83 | 83 | // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
84 | 84 | // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
85 | 85 | // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
86 | 86 | // ); |
87 | - $this->const = array(); |
|
88 | - //$this->const[] = array('AGENDA_DEFAULT_FILTER_TYPE', 'chaine', 'AC_NON_AUTO', 'Default filter for type of event on agenda', 0, 'current'); |
|
89 | - $sqlreadactions="SELECT code, label, description FROM ".MAIN_DB_PREFIX."c_action_trigger ORDER by rang"; |
|
90 | - $resql = $this->db->query($sqlreadactions); |
|
91 | - if ($resql) |
|
92 | - { |
|
93 | - while ($obj = $this->db->fetch_object($resql)) |
|
94 | - { |
|
95 | - //if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). |
|
96 | - if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. |
|
97 | - //if (preg_match('/^_MODIFY/',$obj->code)) continue; // We don't track such events by default. |
|
98 | - $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1", '', 0, 'current'); |
|
99 | - } |
|
100 | - } |
|
101 | - else |
|
102 | - { |
|
103 | - dol_print_error($this->db->lasterror()); |
|
104 | - } |
|
87 | + $this->const = array(); |
|
88 | + //$this->const[] = array('AGENDA_DEFAULT_FILTER_TYPE', 'chaine', 'AC_NON_AUTO', 'Default filter for type of event on agenda', 0, 'current'); |
|
89 | + $sqlreadactions="SELECT code, label, description FROM ".MAIN_DB_PREFIX."c_action_trigger ORDER by rang"; |
|
90 | + $resql = $this->db->query($sqlreadactions); |
|
91 | + if ($resql) |
|
92 | + { |
|
93 | + while ($obj = $this->db->fetch_object($resql)) |
|
94 | + { |
|
95 | + //if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). |
|
96 | + if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. |
|
97 | + //if (preg_match('/^_MODIFY/',$obj->code)) continue; // We don't track such events by default. |
|
98 | + $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1", '', 0, 'current'); |
|
99 | + } |
|
100 | + } |
|
101 | + else |
|
102 | + { |
|
103 | + dol_print_error($this->db->lasterror()); |
|
104 | + } |
|
105 | 105 | |
106 | - // New pages on tabs |
|
107 | - // ----------------- |
|
108 | - $this->tabs = array(); |
|
106 | + // New pages on tabs |
|
107 | + // ----------------- |
|
108 | + $this->tabs = array(); |
|
109 | 109 | |
110 | - // Boxes |
|
111 | - //------ |
|
112 | - $this->boxes = array(0=>array('file'=>'box_actions.php','enabledbydefaulton'=>'Home')); |
|
110 | + // Boxes |
|
111 | + //------ |
|
112 | + $this->boxes = array(0=>array('file'=>'box_actions.php','enabledbydefaulton'=>'Home')); |
|
113 | 113 | |
114 | - // Cronjobs |
|
115 | - //------------ |
|
116 | - $datestart=dol_now(); |
|
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'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'$conf->agenda->enabled', 'datestart'=>$datestart), |
|
119 | - ); |
|
114 | + // Cronjobs |
|
115 | + //------------ |
|
116 | + $datestart=dol_now(); |
|
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'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'$conf->agenda->enabled', 'datestart'=>$datestart), |
|
119 | + ); |
|
120 | 120 | |
121 | - // Permissions |
|
122 | - //------------ |
|
123 | - $this->rights = array(); |
|
124 | - $this->rights_class = 'agenda'; |
|
125 | - $r=0; |
|
121 | + // Permissions |
|
122 | + //------------ |
|
123 | + $this->rights = array(); |
|
124 | + $this->rights_class = 'agenda'; |
|
125 | + $r=0; |
|
126 | 126 | |
127 | - // $this->rights[$r][0] Id permission (unique tous modules confondus) |
|
128 | - // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission) |
|
129 | - // $this->rights[$r][2] Non utilise |
|
130 | - // $this->rights[$r][3] 1=Permis par defaut, 0=Non permis par defaut |
|
131 | - // $this->rights[$r][4] Niveau 1 pour nommer permission dans code |
|
132 | - // $this->rights[$r][5] Niveau 2 pour nommer permission dans code |
|
133 | - // $r++; |
|
127 | + // $this->rights[$r][0] Id permission (unique tous modules confondus) |
|
128 | + // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission) |
|
129 | + // $this->rights[$r][2] Non utilise |
|
130 | + // $this->rights[$r][3] 1=Permis par defaut, 0=Non permis par defaut |
|
131 | + // $this->rights[$r][4] Niveau 1 pour nommer permission dans code |
|
132 | + // $this->rights[$r][5] Niveau 2 pour nommer permission dans code |
|
133 | + // $r++; |
|
134 | 134 | |
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'; |
|
141 | - $r++; |
|
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'; |
|
141 | + $r++; |
|
142 | 142 | |
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'; |
|
149 | - $r++; |
|
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'; |
|
149 | + $r++; |
|
150 | 150 | |
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'; |
|
157 | - $r++; |
|
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'; |
|
157 | + $r++; |
|
158 | 158 | |
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'; |
|
165 | - $r++; |
|
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'; |
|
165 | + $r++; |
|
166 | 166 | |
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'; |
|
173 | - $r++; |
|
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'; |
|
173 | + $r++; |
|
174 | 174 | |
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'; |
|
181 | - $r++; |
|
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'; |
|
181 | + $r++; |
|
182 | 182 | |
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'; |
|
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'; |
|
188 | 188 | |
189 | - // Main menu entries |
|
190 | - $this->menu = array(); // List of menus to add |
|
191 | - $r=0; |
|
189 | + // Main menu entries |
|
190 | + $this->menu = array(); // List of menus to add |
|
191 | + $r=0; |
|
192 | 192 | |
193 | - // Add here entries to declare new menus |
|
194 | - // Example to declare the Top Menu entry: |
|
195 | - // $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu |
|
196 | - // 'type'=>'top', // This is a Top menu entry |
|
197 | - // 'titre'=>'MyModule top menu', |
|
198 | - // 'mainmenu'=>'mymodule', |
|
199 | - // 'url'=>'/mymodule/pagetop.php', |
|
200 | - // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
201 | - // 'position'=>100, |
|
202 | - // 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. |
|
203 | - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
204 | - // 'target'=>'', |
|
205 | - // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
206 | - // $r++; |
|
207 | - $this->menu[$r]=array('fk_menu'=>0, |
|
208 | - 'type'=>'top', |
|
209 | - 'titre'=>'TMenuAgenda', |
|
210 | - 'mainmenu'=>'agenda', |
|
211 | - 'url'=>'/comm/action/index.php', |
|
212 | - 'langs'=>'agenda', |
|
213 | - 'position'=>86, |
|
214 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
215 | - 'enabled'=>'$conf->agenda->enabled', |
|
216 | - 'target'=>'', |
|
217 | - 'user'=>2); |
|
218 | - $r++; |
|
193 | + // Add here entries to declare new menus |
|
194 | + // Example to declare the Top Menu entry: |
|
195 | + // $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu |
|
196 | + // 'type'=>'top', // This is a Top menu entry |
|
197 | + // 'titre'=>'MyModule top menu', |
|
198 | + // 'mainmenu'=>'mymodule', |
|
199 | + // 'url'=>'/mymodule/pagetop.php', |
|
200 | + // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
201 | + // 'position'=>100, |
|
202 | + // 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. |
|
203 | + // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
204 | + // 'target'=>'', |
|
205 | + // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
206 | + // $r++; |
|
207 | + $this->menu[$r]=array('fk_menu'=>0, |
|
208 | + 'type'=>'top', |
|
209 | + 'titre'=>'TMenuAgenda', |
|
210 | + 'mainmenu'=>'agenda', |
|
211 | + 'url'=>'/comm/action/index.php', |
|
212 | + 'langs'=>'agenda', |
|
213 | + 'position'=>86, |
|
214 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
215 | + 'enabled'=>'$conf->agenda->enabled', |
|
216 | + 'target'=>'', |
|
217 | + 'user'=>2); |
|
218 | + $r++; |
|
219 | 219 | |
220 | - $this->menu[$r]=array('fk_menu'=>'r=0', |
|
221 | - 'type'=>'left', |
|
222 | - 'titre'=>'Actions', |
|
223 | - 'mainmenu'=>'agenda', |
|
224 | - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda', |
|
225 | - 'langs'=>'agenda', |
|
226 | - 'position'=>100, |
|
227 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
228 | - 'enabled'=>'$conf->agenda->enabled', |
|
229 | - 'target'=>'', |
|
230 | - 'user'=>2); |
|
231 | - $r++; |
|
232 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
233 | - 'type'=>'left', |
|
234 | - 'titre'=>'NewAction', |
|
235 | - 'mainmenu'=>'agenda', |
|
236 | - 'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create', |
|
237 | - 'langs'=>'commercial', |
|
238 | - 'position'=>101, |
|
239 | - 'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)', |
|
240 | - 'enabled'=>'$conf->agenda->enabled', |
|
241 | - 'target'=>'', |
|
242 | - 'user'=>2); |
|
243 | - $r++; |
|
244 | - // Calendar |
|
245 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
246 | - 'type'=>'left', |
|
247 | - 'titre'=>'Calendar', |
|
248 | - 'mainmenu'=>'agenda', |
|
249 | - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda', |
|
250 | - 'langs'=>'agenda', |
|
251 | - 'position'=>140, |
|
252 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
253 | - 'enabled'=>'$conf->agenda->enabled', |
|
254 | - 'target'=>'', |
|
255 | - 'user'=>2); |
|
256 | - $r++; |
|
257 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
258 | - 'type'=>'left', |
|
259 | - 'titre'=>'MenuToDoMyActions', |
|
260 | - 'mainmenu'=>'agenda', |
|
261 | - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', |
|
262 | - 'langs'=>'agenda', |
|
263 | - 'position'=>141, |
|
264 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
265 | - 'enabled'=>'$conf->agenda->enabled', |
|
266 | - 'target'=>'', |
|
267 | - 'user'=>2); |
|
268 | - $r++; |
|
269 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
270 | - 'type'=>'left', |
|
271 | - 'titre'=>'MenuDoneMyActions', |
|
272 | - 'mainmenu'=>'agenda', |
|
273 | - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', |
|
274 | - 'langs'=>'agenda', |
|
275 | - 'position'=>142, |
|
276 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
277 | - 'enabled'=>'$conf->agenda->enabled', |
|
278 | - 'target'=>'', |
|
279 | - 'user'=>2); |
|
280 | - $r++; |
|
281 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
282 | - 'type'=>'left', |
|
283 | - 'titre'=>'MenuToDoActions', |
|
284 | - 'mainmenu'=>'agenda', |
|
285 | - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', |
|
286 | - 'langs'=>'agenda', |
|
287 | - 'position'=>143, |
|
288 | - 'perms'=>'$user->rights->agenda->allactions->read', |
|
289 | - 'enabled'=>'$user->rights->agenda->allactions->read', |
|
290 | - 'target'=>'', |
|
291 | - 'user'=>2); |
|
292 | - $r++; |
|
293 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
294 | - 'type'=>'left', |
|
295 | - 'titre'=>'MenuDoneActions', |
|
296 | - 'mainmenu'=>'agenda', |
|
297 | - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', |
|
298 | - 'langs'=>'agenda', |
|
299 | - 'position'=>144, |
|
300 | - 'perms'=>'$user->rights->agenda->allactions->read', |
|
301 | - 'enabled'=>'$user->rights->agenda->allactions->read', |
|
302 | - 'target'=>'', |
|
303 | - 'user'=>2); |
|
220 | + $this->menu[$r]=array('fk_menu'=>'r=0', |
|
221 | + 'type'=>'left', |
|
222 | + 'titre'=>'Actions', |
|
223 | + 'mainmenu'=>'agenda', |
|
224 | + 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda', |
|
225 | + 'langs'=>'agenda', |
|
226 | + 'position'=>100, |
|
227 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
228 | + 'enabled'=>'$conf->agenda->enabled', |
|
229 | + 'target'=>'', |
|
230 | + 'user'=>2); |
|
231 | + $r++; |
|
232 | + $this->menu[$r]=array('fk_menu'=>'r=1', |
|
233 | + 'type'=>'left', |
|
234 | + 'titre'=>'NewAction', |
|
235 | + 'mainmenu'=>'agenda', |
|
236 | + 'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create', |
|
237 | + 'langs'=>'commercial', |
|
238 | + 'position'=>101, |
|
239 | + 'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)', |
|
240 | + 'enabled'=>'$conf->agenda->enabled', |
|
241 | + 'target'=>'', |
|
242 | + 'user'=>2); |
|
243 | + $r++; |
|
244 | + // Calendar |
|
245 | + $this->menu[$r]=array('fk_menu'=>'r=1', |
|
246 | + 'type'=>'left', |
|
247 | + 'titre'=>'Calendar', |
|
248 | + 'mainmenu'=>'agenda', |
|
249 | + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda', |
|
250 | + 'langs'=>'agenda', |
|
251 | + 'position'=>140, |
|
252 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
253 | + 'enabled'=>'$conf->agenda->enabled', |
|
254 | + 'target'=>'', |
|
255 | + 'user'=>2); |
|
256 | + $r++; |
|
257 | + $this->menu[$r]=array('fk_menu'=>'r=3', |
|
258 | + 'type'=>'left', |
|
259 | + 'titre'=>'MenuToDoMyActions', |
|
260 | + 'mainmenu'=>'agenda', |
|
261 | + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', |
|
262 | + 'langs'=>'agenda', |
|
263 | + 'position'=>141, |
|
264 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
265 | + 'enabled'=>'$conf->agenda->enabled', |
|
266 | + 'target'=>'', |
|
267 | + 'user'=>2); |
|
268 | + $r++; |
|
269 | + $this->menu[$r]=array('fk_menu'=>'r=3', |
|
270 | + 'type'=>'left', |
|
271 | + 'titre'=>'MenuDoneMyActions', |
|
272 | + 'mainmenu'=>'agenda', |
|
273 | + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', |
|
274 | + 'langs'=>'agenda', |
|
275 | + 'position'=>142, |
|
276 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
277 | + 'enabled'=>'$conf->agenda->enabled', |
|
278 | + 'target'=>'', |
|
279 | + 'user'=>2); |
|
280 | + $r++; |
|
281 | + $this->menu[$r]=array('fk_menu'=>'r=3', |
|
282 | + 'type'=>'left', |
|
283 | + 'titre'=>'MenuToDoActions', |
|
284 | + 'mainmenu'=>'agenda', |
|
285 | + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', |
|
286 | + 'langs'=>'agenda', |
|
287 | + 'position'=>143, |
|
288 | + 'perms'=>'$user->rights->agenda->allactions->read', |
|
289 | + 'enabled'=>'$user->rights->agenda->allactions->read', |
|
290 | + 'target'=>'', |
|
291 | + 'user'=>2); |
|
292 | + $r++; |
|
293 | + $this->menu[$r]=array('fk_menu'=>'r=3', |
|
294 | + 'type'=>'left', |
|
295 | + 'titre'=>'MenuDoneActions', |
|
296 | + 'mainmenu'=>'agenda', |
|
297 | + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', |
|
298 | + 'langs'=>'agenda', |
|
299 | + 'position'=>144, |
|
300 | + 'perms'=>'$user->rights->agenda->allactions->read', |
|
301 | + 'enabled'=>'$user->rights->agenda->allactions->read', |
|
302 | + 'target'=>'', |
|
303 | + 'user'=>2); |
|
304 | 304 | |
305 | - // List |
|
306 | - $r++; |
|
307 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
308 | - 'type'=>'left', |
|
309 | - 'titre'=>'List', |
|
310 | - 'mainmenu'=>'agenda', |
|
311 | - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda', |
|
312 | - 'langs'=>'agenda', |
|
313 | - 'position'=>110, |
|
314 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
315 | - 'enabled'=>'$conf->agenda->enabled', |
|
316 | - 'target'=>'', |
|
317 | - 'user'=>2); |
|
318 | - $r++; |
|
319 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
320 | - 'type'=>'left', |
|
321 | - 'titre'=>'MenuToDoMyActions', |
|
322 | - 'mainmenu'=>'agenda', |
|
323 | - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', |
|
324 | - 'langs'=>'agenda', |
|
325 | - 'position'=>111, |
|
326 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
327 | - 'enabled'=>'$conf->agenda->enabled', |
|
328 | - 'target'=>'', |
|
329 | - 'user'=>2); |
|
330 | - $r++; |
|
331 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
332 | - 'type'=>'left', |
|
333 | - 'titre'=>'MenuDoneMyActions', |
|
334 | - 'mainmenu'=>'agenda', |
|
335 | - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', |
|
336 | - 'langs'=>'agenda', |
|
337 | - 'position'=>112, |
|
338 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
339 | - 'enabled'=>'$conf->agenda->enabled', |
|
340 | - 'target'=>'', |
|
341 | - 'user'=>2); |
|
342 | - $r++; |
|
343 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
344 | - 'type'=>'left', |
|
345 | - 'titre'=>'MenuToDoActions', |
|
346 | - 'mainmenu'=>'agenda', |
|
347 | - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', |
|
348 | - 'langs'=>'agenda', |
|
349 | - 'position'=>113, |
|
350 | - 'perms'=>'$user->rights->agenda->allactions->read', |
|
351 | - 'enabled'=>'$user->rights->agenda->allactions->read', |
|
352 | - 'target'=>'', |
|
353 | - 'user'=>2); |
|
354 | - $r++; |
|
355 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
356 | - 'type'=>'left', |
|
357 | - 'titre'=>'MenuDoneActions', |
|
358 | - 'mainmenu'=>'agenda', |
|
359 | - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', |
|
360 | - 'langs'=>'agenda', |
|
361 | - 'position'=>114, |
|
362 | - 'perms'=>'$user->rights->agenda->allactions->read', |
|
363 | - 'enabled'=>'$user->rights->agenda->allactions->read', |
|
364 | - 'target'=>'', |
|
365 | - 'user'=>2); |
|
366 | - $r++; |
|
367 | - // Reports |
|
368 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
369 | - 'type'=>'left', |
|
370 | - 'titre'=>'Reportings', |
|
371 | - 'mainmenu'=>'agenda', |
|
372 | - 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda', |
|
373 | - 'langs'=>'agenda', |
|
374 | - 'position'=>160, |
|
375 | - 'perms'=>'$user->rights->agenda->allactions->read', |
|
376 | - 'enabled'=>'$conf->agenda->enabled', |
|
377 | - 'target'=>'', |
|
378 | - 'user'=>2); |
|
379 | - $r++; |
|
305 | + // List |
|
306 | + $r++; |
|
307 | + $this->menu[$r]=array('fk_menu'=>'r=1', |
|
308 | + 'type'=>'left', |
|
309 | + 'titre'=>'List', |
|
310 | + 'mainmenu'=>'agenda', |
|
311 | + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda', |
|
312 | + 'langs'=>'agenda', |
|
313 | + 'position'=>110, |
|
314 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
315 | + 'enabled'=>'$conf->agenda->enabled', |
|
316 | + 'target'=>'', |
|
317 | + 'user'=>2); |
|
318 | + $r++; |
|
319 | + $this->menu[$r]=array('fk_menu'=>'r=8', |
|
320 | + 'type'=>'left', |
|
321 | + 'titre'=>'MenuToDoMyActions', |
|
322 | + 'mainmenu'=>'agenda', |
|
323 | + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', |
|
324 | + 'langs'=>'agenda', |
|
325 | + 'position'=>111, |
|
326 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
327 | + 'enabled'=>'$conf->agenda->enabled', |
|
328 | + 'target'=>'', |
|
329 | + 'user'=>2); |
|
330 | + $r++; |
|
331 | + $this->menu[$r]=array('fk_menu'=>'r=8', |
|
332 | + 'type'=>'left', |
|
333 | + 'titre'=>'MenuDoneMyActions', |
|
334 | + 'mainmenu'=>'agenda', |
|
335 | + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', |
|
336 | + 'langs'=>'agenda', |
|
337 | + 'position'=>112, |
|
338 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
339 | + 'enabled'=>'$conf->agenda->enabled', |
|
340 | + 'target'=>'', |
|
341 | + 'user'=>2); |
|
342 | + $r++; |
|
343 | + $this->menu[$r]=array('fk_menu'=>'r=8', |
|
344 | + 'type'=>'left', |
|
345 | + 'titre'=>'MenuToDoActions', |
|
346 | + 'mainmenu'=>'agenda', |
|
347 | + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', |
|
348 | + 'langs'=>'agenda', |
|
349 | + 'position'=>113, |
|
350 | + 'perms'=>'$user->rights->agenda->allactions->read', |
|
351 | + 'enabled'=>'$user->rights->agenda->allactions->read', |
|
352 | + 'target'=>'', |
|
353 | + 'user'=>2); |
|
354 | + $r++; |
|
355 | + $this->menu[$r]=array('fk_menu'=>'r=8', |
|
356 | + 'type'=>'left', |
|
357 | + 'titre'=>'MenuDoneActions', |
|
358 | + 'mainmenu'=>'agenda', |
|
359 | + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', |
|
360 | + 'langs'=>'agenda', |
|
361 | + 'position'=>114, |
|
362 | + 'perms'=>'$user->rights->agenda->allactions->read', |
|
363 | + 'enabled'=>'$user->rights->agenda->allactions->read', |
|
364 | + 'target'=>'', |
|
365 | + 'user'=>2); |
|
366 | + $r++; |
|
367 | + // Reports |
|
368 | + $this->menu[$r]=array('fk_menu'=>'r=1', |
|
369 | + 'type'=>'left', |
|
370 | + 'titre'=>'Reportings', |
|
371 | + 'mainmenu'=>'agenda', |
|
372 | + 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda', |
|
373 | + 'langs'=>'agenda', |
|
374 | + 'position'=>160, |
|
375 | + 'perms'=>'$user->rights->agenda->allactions->read', |
|
376 | + 'enabled'=>'$conf->agenda->enabled', |
|
377 | + 'target'=>'', |
|
378 | + 'user'=>2); |
|
379 | + $r++; |
|
380 | 380 | |
381 | 381 | |
382 | - // Exports |
|
383 | - //-------- |
|
384 | - $r=0; |
|
382 | + // Exports |
|
383 | + //-------- |
|
384 | + $r=0; |
|
385 | 385 | |
386 | - $r++; |
|
387 | - $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
388 | - $this->export_label[$r]="ExportDataset_event1"; |
|
389 | - $this->export_permission[$r]=array(array("agenda","export")); |
|
390 | - $this->export_fields_array[$r]=array('ac.id'=>"IdAgenda",'ac.ref_ext'=>"ExternalRef",'ac.datec'=>"DateCreation",'ac.datep'=>"DateActionBegin", |
|
391 | - 'ac.datep2'=>"DateActionEnd",'ac.label'=>"Title",'ac.note'=>"Note",'ac.percent'=>"Percent",'ac.durationp'=>"Duration", |
|
392 | - 'cac.libelle'=>"ActionType", |
|
393 | - 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town', |
|
394 | - 'co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6', |
|
395 | - 's.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra'); |
|
396 | - $this->export_TypeFields_array[$r]=array('ac.ref_ext'=>"Text",'ac.datec'=>"Date",'ac.datep'=>"Date", |
|
397 | - 'ac.datep2'=>"Date",'ac.label'=>"Text",'ac.note'=>"Text",'ac.percent'=>"Numeric", |
|
398 | - 'ac.durationp'=>"Duree", |
|
399 | - 'cac.libelle'=>"List:c_actioncomm:libelle:id", |
|
400 | - 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text', |
|
401 | - 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text', |
|
402 | - 's.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text'); |
|
403 | - $this->export_entities_array[$r]=array('ac.id'=>"action",'ac.ref_ext'=>"action",'ac.datec'=>"action",'ac.datep'=>"action", |
|
404 | - 'ac.datep2'=>"action",'ac.label'=>"action",'ac.note'=>"action",'ac.percent'=>"action",'ac.durationp'=>"action", |
|
405 | - 'cac.libelle'=>"action", |
|
406 | - 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company', |
|
407 | - 'co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company', |
|
408 | - 's.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company',); |
|
386 | + $r++; |
|
387 | + $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
388 | + $this->export_label[$r]="ExportDataset_event1"; |
|
389 | + $this->export_permission[$r]=array(array("agenda","export")); |
|
390 | + $this->export_fields_array[$r]=array('ac.id'=>"IdAgenda",'ac.ref_ext'=>"ExternalRef",'ac.datec'=>"DateCreation",'ac.datep'=>"DateActionBegin", |
|
391 | + 'ac.datep2'=>"DateActionEnd",'ac.label'=>"Title",'ac.note'=>"Note",'ac.percent'=>"Percent",'ac.durationp'=>"Duration", |
|
392 | + 'cac.libelle'=>"ActionType", |
|
393 | + 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town', |
|
394 | + 'co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6', |
|
395 | + 's.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra'); |
|
396 | + $this->export_TypeFields_array[$r]=array('ac.ref_ext'=>"Text",'ac.datec'=>"Date",'ac.datep'=>"Date", |
|
397 | + 'ac.datep2'=>"Date",'ac.label'=>"Text",'ac.note'=>"Text",'ac.percent'=>"Numeric", |
|
398 | + 'ac.durationp'=>"Duree", |
|
399 | + 'cac.libelle'=>"List:c_actioncomm:libelle:id", |
|
400 | + 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text', |
|
401 | + 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text', |
|
402 | + 's.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text'); |
|
403 | + $this->export_entities_array[$r]=array('ac.id'=>"action",'ac.ref_ext'=>"action",'ac.datec'=>"action",'ac.datep'=>"action", |
|
404 | + 'ac.datep2'=>"action",'ac.label'=>"action",'ac.note'=>"action",'ac.percent'=>"action",'ac.durationp'=>"action", |
|
405 | + 'cac.libelle'=>"action", |
|
406 | + 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company', |
|
407 | + 'co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company', |
|
408 | + 's.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company',); |
|
409 | 409 | |
410 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
411 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; |
|
412 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; |
|
413 | - if (! empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
414 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; |
|
415 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; |
|
416 | - if (! empty($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
417 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; |
|
418 | - $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; |
|
419 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; |
|
420 | - if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); |
|
421 | - $this->export_sql_end[$r] .=' ORDER BY ac.datep'; |
|
422 | - } |
|
410 | + $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
411 | + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; |
|
412 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; |
|
413 | + if (! empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
414 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; |
|
415 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; |
|
416 | + if (! empty($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
417 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; |
|
418 | + $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; |
|
419 | + if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; |
|
420 | + if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); |
|
421 | + $this->export_sql_end[$r] .=' ORDER BY ac.datep'; |
|
422 | + } |
|
423 | 423 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * \ingroup agenda |
31 | 31 | * \brief File of class to describe and enable/disable module Agenda |
32 | 32 | */ |
33 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
33 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Class to describe and enable/disable module Agenda |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | $this->family = "projects"; |
54 | 54 | $this->module_position = '15'; |
55 | 55 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
56 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
56 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
57 | 57 | $this->description = "Follow events or rendez-vous. Record manual events into Agendas or let application record automatic events for log tracking."; |
58 | 58 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
59 | 59 | $this->version = 'dolibarr'; |
60 | 60 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
61 | 61 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
62 | - $this->picto='action'; |
|
62 | + $this->picto = 'action'; |
|
63 | 63 | |
64 | 64 | // Data directories to create when module is enabled |
65 | 65 | $this->dirs = array("/agenda/temp"); |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | $this->config_page_url = array("agenda_other.php"); |
69 | 69 | |
70 | 70 | // Dependencies |
71 | - $this->hidden = false; // A condition to hide module |
|
72 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
73 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
71 | + $this->hidden = false; // A condition to hide module |
|
72 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
73 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
75 | 75 | $this->langfiles = array("companies"); |
76 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
76 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
77 | 77 | |
78 | 78 | // Module parts |
79 | 79 | $this->module_parts = array(); |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | // ); |
87 | 87 | $this->const = array(); |
88 | 88 | //$this->const[] = array('AGENDA_DEFAULT_FILTER_TYPE', 'chaine', 'AC_NON_AUTO', 'Default filter for type of event on agenda', 0, 'current'); |
89 | - $sqlreadactions="SELECT code, label, description FROM ".MAIN_DB_PREFIX."c_action_trigger ORDER by rang"; |
|
89 | + $sqlreadactions = "SELECT code, label, description FROM ".MAIN_DB_PREFIX."c_action_trigger ORDER by rang"; |
|
90 | 90 | $resql = $this->db->query($sqlreadactions); |
91 | 91 | if ($resql) |
92 | 92 | { |
93 | 93 | while ($obj = $this->db->fetch_object($resql)) |
94 | 94 | { |
95 | 95 | //if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). |
96 | - if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. |
|
96 | + if (preg_match('/^TASK_/', $obj->code)) continue; // We don't track such events by default. |
|
97 | 97 | //if (preg_match('/^_MODIFY/',$obj->code)) continue; // We don't track such events by default. |
98 | 98 | $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1", '', 0, 'current'); |
99 | 99 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | |
110 | 110 | // Boxes |
111 | 111 | //------ |
112 | - $this->boxes = array(0=>array('file'=>'box_actions.php','enabledbydefaulton'=>'Home')); |
|
112 | + $this->boxes = array(0=>array('file'=>'box_actions.php', 'enabledbydefaulton'=>'Home')); |
|
113 | 113 | |
114 | 114 | // Cronjobs |
115 | 115 | //------------ |
116 | - $datestart=dol_now(); |
|
116 | + $datestart = dol_now(); |
|
117 | 117 | $this->cronjobs = array( |
118 | 118 | 0=>array('label'=>'SendEmailsReminders', 'jobtype'=>'method', 'class'=>'comm/action/class/actioncomm.class.php', 'objectname'=>'ActionComm', 'method'=>'sendEmailsReminder', 'parameters'=>'', 'comment'=>'SendEMailsReminder', 'frequency'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'$conf->agenda->enabled', 'datestart'=>$datestart), |
119 | 119 | ); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | //------------ |
123 | 123 | $this->rights = array(); |
124 | 124 | $this->rights_class = 'agenda'; |
125 | - $r=0; |
|
125 | + $r = 0; |
|
126 | 126 | |
127 | 127 | // $this->rights[$r][0] Id permission (unique tous modules confondus) |
128 | 128 | // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission) |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | $this->rights[$r][4] = 'export'; |
188 | 188 | |
189 | 189 | // Main menu entries |
190 | - $this->menu = array(); // List of menus to add |
|
191 | - $r=0; |
|
190 | + $this->menu = array(); // List of menus to add |
|
191 | + $r = 0; |
|
192 | 192 | |
193 | 193 | // Add here entries to declare new menus |
194 | 194 | // Example to declare the Top Menu entry: |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | // 'target'=>'', |
205 | 205 | // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
206 | 206 | // $r++; |
207 | - $this->menu[$r]=array('fk_menu'=>0, |
|
207 | + $this->menu[$r] = array('fk_menu'=>0, |
|
208 | 208 | 'type'=>'top', |
209 | 209 | 'titre'=>'TMenuAgenda', |
210 | 210 | 'mainmenu'=>'agenda', |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | 'user'=>2); |
218 | 218 | $r++; |
219 | 219 | |
220 | - $this->menu[$r]=array('fk_menu'=>'r=0', |
|
220 | + $this->menu[$r] = array('fk_menu'=>'r=0', |
|
221 | 221 | 'type'=>'left', |
222 | 222 | 'titre'=>'Actions', |
223 | 223 | 'mainmenu'=>'agenda', |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | 'target'=>'', |
230 | 230 | 'user'=>2); |
231 | 231 | $r++; |
232 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
232 | + $this->menu[$r] = array('fk_menu'=>'r=1', |
|
233 | 233 | 'type'=>'left', |
234 | 234 | 'titre'=>'NewAction', |
235 | 235 | 'mainmenu'=>'agenda', |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | 'user'=>2); |
243 | 243 | $r++; |
244 | 244 | // Calendar |
245 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
245 | + $this->menu[$r] = array('fk_menu'=>'r=1', |
|
246 | 246 | 'type'=>'left', |
247 | 247 | 'titre'=>'Calendar', |
248 | 248 | 'mainmenu'=>'agenda', |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | 'target'=>'', |
255 | 255 | 'user'=>2); |
256 | 256 | $r++; |
257 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
257 | + $this->menu[$r] = array('fk_menu'=>'r=3', |
|
258 | 258 | 'type'=>'left', |
259 | 259 | 'titre'=>'MenuToDoMyActions', |
260 | 260 | 'mainmenu'=>'agenda', |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | 'target'=>'', |
267 | 267 | 'user'=>2); |
268 | 268 | $r++; |
269 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
269 | + $this->menu[$r] = array('fk_menu'=>'r=3', |
|
270 | 270 | 'type'=>'left', |
271 | 271 | 'titre'=>'MenuDoneMyActions', |
272 | 272 | 'mainmenu'=>'agenda', |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | 'target'=>'', |
279 | 279 | 'user'=>2); |
280 | 280 | $r++; |
281 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
281 | + $this->menu[$r] = array('fk_menu'=>'r=3', |
|
282 | 282 | 'type'=>'left', |
283 | 283 | 'titre'=>'MenuToDoActions', |
284 | 284 | 'mainmenu'=>'agenda', |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | 'target'=>'', |
291 | 291 | 'user'=>2); |
292 | 292 | $r++; |
293 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
293 | + $this->menu[$r] = array('fk_menu'=>'r=3', |
|
294 | 294 | 'type'=>'left', |
295 | 295 | 'titre'=>'MenuDoneActions', |
296 | 296 | 'mainmenu'=>'agenda', |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | // List |
306 | 306 | $r++; |
307 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
307 | + $this->menu[$r] = array('fk_menu'=>'r=1', |
|
308 | 308 | 'type'=>'left', |
309 | 309 | 'titre'=>'List', |
310 | 310 | 'mainmenu'=>'agenda', |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | 'target'=>'', |
317 | 317 | 'user'=>2); |
318 | 318 | $r++; |
319 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
319 | + $this->menu[$r] = array('fk_menu'=>'r=8', |
|
320 | 320 | 'type'=>'left', |
321 | 321 | 'titre'=>'MenuToDoMyActions', |
322 | 322 | 'mainmenu'=>'agenda', |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | 'target'=>'', |
329 | 329 | 'user'=>2); |
330 | 330 | $r++; |
331 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
331 | + $this->menu[$r] = array('fk_menu'=>'r=8', |
|
332 | 332 | 'type'=>'left', |
333 | 333 | 'titre'=>'MenuDoneMyActions', |
334 | 334 | 'mainmenu'=>'agenda', |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | 'target'=>'', |
341 | 341 | 'user'=>2); |
342 | 342 | $r++; |
343 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
343 | + $this->menu[$r] = array('fk_menu'=>'r=8', |
|
344 | 344 | 'type'=>'left', |
345 | 345 | 'titre'=>'MenuToDoActions', |
346 | 346 | 'mainmenu'=>'agenda', |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | 'target'=>'', |
353 | 353 | 'user'=>2); |
354 | 354 | $r++; |
355 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
355 | + $this->menu[$r] = array('fk_menu'=>'r=8', |
|
356 | 356 | 'type'=>'left', |
357 | 357 | 'titre'=>'MenuDoneActions', |
358 | 358 | 'mainmenu'=>'agenda', |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | 'user'=>2); |
366 | 366 | $r++; |
367 | 367 | // Reports |
368 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
368 | + $this->menu[$r] = array('fk_menu'=>'r=1', |
|
369 | 369 | 'type'=>'left', |
370 | 370 | 'titre'=>'Reportings', |
371 | 371 | 'mainmenu'=>'agenda', |
@@ -381,43 +381,43 @@ discard block |
||
381 | 381 | |
382 | 382 | // Exports |
383 | 383 | //-------- |
384 | - $r=0; |
|
384 | + $r = 0; |
|
385 | 385 | |
386 | 386 | $r++; |
387 | - $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
388 | - $this->export_label[$r]="ExportDataset_event1"; |
|
389 | - $this->export_permission[$r]=array(array("agenda","export")); |
|
390 | - $this->export_fields_array[$r]=array('ac.id'=>"IdAgenda",'ac.ref_ext'=>"ExternalRef",'ac.datec'=>"DateCreation",'ac.datep'=>"DateActionBegin", |
|
391 | - 'ac.datep2'=>"DateActionEnd",'ac.label'=>"Title",'ac.note'=>"Note",'ac.percent'=>"Percent",'ac.durationp'=>"Duration", |
|
387 | + $this->export_code[$r] = $this->rights_class.'_'.$r; |
|
388 | + $this->export_label[$r] = "ExportDataset_event1"; |
|
389 | + $this->export_permission[$r] = array(array("agenda", "export")); |
|
390 | + $this->export_fields_array[$r] = array('ac.id'=>"IdAgenda", 'ac.ref_ext'=>"ExternalRef", 'ac.datec'=>"DateCreation", 'ac.datep'=>"DateActionBegin", |
|
391 | + 'ac.datep2'=>"DateActionEnd", 'ac.label'=>"Title", 'ac.note'=>"Note", 'ac.percent'=>"Percent", 'ac.durationp'=>"Duration", |
|
392 | 392 | 'cac.libelle'=>"ActionType", |
393 | - 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town', |
|
394 | - 'co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6', |
|
395 | - 's.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra'); |
|
396 | - $this->export_TypeFields_array[$r]=array('ac.ref_ext'=>"Text",'ac.datec'=>"Date",'ac.datep'=>"Date", |
|
397 | - 'ac.datep2'=>"Date",'ac.label'=>"Text",'ac.note'=>"Text",'ac.percent'=>"Numeric", |
|
393 | + 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', |
|
394 | + 'co.code'=>'CountryCode', 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.idprof5'=>'ProfId5', 's.idprof6'=>'ProfId6', |
|
395 | + 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra'); |
|
396 | + $this->export_TypeFields_array[$r] = array('ac.ref_ext'=>"Text", 'ac.datec'=>"Date", 'ac.datep'=>"Date", |
|
397 | + 'ac.datep2'=>"Date", 'ac.label'=>"Text", 'ac.note'=>"Text", 'ac.percent'=>"Numeric", |
|
398 | 398 | 'ac.durationp'=>"Duree", |
399 | 399 | 'cac.libelle'=>"List:c_actioncomm:libelle:id", |
400 | - 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text', |
|
401 | - 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text', |
|
402 | - 's.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text'); |
|
403 | - $this->export_entities_array[$r]=array('ac.id'=>"action",'ac.ref_ext'=>"action",'ac.datec'=>"action",'ac.datep'=>"action", |
|
404 | - 'ac.datep2'=>"action",'ac.label'=>"action",'ac.note'=>"action",'ac.percent'=>"action",'ac.durationp'=>"action", |
|
400 | + 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', |
|
401 | + 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.idprof5'=>'Text', 's.idprof6'=>'Text', |
|
402 | + 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text'); |
|
403 | + $this->export_entities_array[$r] = array('ac.id'=>"action", 'ac.ref_ext'=>"action", 'ac.datec'=>"action", 'ac.datep'=>"action", |
|
404 | + 'ac.datep2'=>"action", 'ac.label'=>"action", 'ac.note'=>"action", 'ac.percent'=>"action", 'ac.durationp'=>"action", |
|
405 | 405 | 'cac.libelle'=>"action", |
406 | - 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company', |
|
407 | - 'co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company', |
|
408 | - 's.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company',); |
|
406 | + 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', |
|
407 | + 'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', |
|
408 | + 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.tva_intra'=>'company',); |
|
409 | 409 | |
410 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
411 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; |
|
412 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; |
|
413 | - if (! empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
414 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; |
|
415 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; |
|
416 | - if (! empty($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
417 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; |
|
418 | - $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; |
|
419 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; |
|
420 | - if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); |
|
421 | - $this->export_sql_end[$r] .=' ORDER BY ac.datep'; |
|
410 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
411 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; |
|
412 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; |
|
413 | + if (!empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
414 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; |
|
415 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; |
|
416 | + if (!empty($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
417 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; |
|
418 | + $this->export_sql_end[$r] .= ' WHERE ac.entity IN ('.getEntity('agenda').')'; |
|
419 | + if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND (sc.fk_user = '.(empty($user) ? 0 : $user->id).' OR ac.fk_soc IS NULL)'; |
|
420 | + if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .= ' AND acr.fk_element = '.(empty($user) ? 0 : $user->id); |
|
421 | + $this->export_sql_end[$r] .= ' ORDER BY ac.datep'; |
|
422 | 422 | } |
423 | 423 | } |
@@ -93,12 +93,14 @@ discard block |
||
93 | 93 | while ($obj = $this->db->fetch_object($resql)) |
94 | 94 | { |
95 | 95 | //if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). |
96 | - if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. |
|
96 | + if (preg_match('/^TASK_/',$obj->code)) { |
|
97 | + continue; |
|
98 | + } |
|
99 | + // We don't track such events by default. |
|
97 | 100 | //if (preg_match('/^_MODIFY/',$obj->code)) continue; // We don't track such events by default. |
98 | 101 | $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1", '', 0, 'current'); |
99 | 102 | } |
100 | - } |
|
101 | - else |
|
103 | + } else |
|
102 | 104 | { |
103 | 105 | dol_print_error($this->db->lasterror()); |
104 | 106 | } |
@@ -410,14 +412,22 @@ discard block |
||
410 | 412 | $this->export_sql_start[$r]='SELECT DISTINCT '; |
411 | 413 | $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; |
412 | 414 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; |
413 | - if (! empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
415 | + if (! empty($user) && empty($user->rights->agenda->allactions->read)) { |
|
416 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
417 | + } |
|
414 | 418 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; |
415 | 419 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; |
416 | - if (! empty($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
420 | + if (! empty($user) && empty($user->rights->societe->client->voir)) { |
|
421 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
422 | + } |
|
417 | 423 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; |
418 | 424 | $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; |
419 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; |
|
420 | - if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); |
|
425 | + if (empty($user->rights->societe->client->voir)) { |
|
426 | + $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; |
|
427 | + } |
|
428 | + if (empty($user->rights->agenda->allactions->read)) { |
|
429 | + $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); |
|
430 | + } |
|
421 | 431 | $this->export_sql_end[$r] .=' ORDER BY ac.datep'; |
422 | 432 | } |
423 | 433 | } |
@@ -27,117 +27,117 @@ |
||
27 | 27 | */ |
28 | 28 | class modHRM extends DolibarrModules |
29 | 29 | { |
30 | - /** |
|
31 | - * Constructor. |
|
32 | - * Define names, constants, directories, boxes, permissions |
|
33 | - * |
|
34 | - * @param DoliDB $db Database handler |
|
35 | - */ |
|
36 | - public function __construct($db) |
|
37 | - { |
|
38 | - global $langs, $conf; |
|
39 | - |
|
40 | - $this->db = $db; |
|
41 | - |
|
42 | - $this->numero = 4000; |
|
43 | - $this->rights_class = 'hrm'; |
|
44 | - |
|
45 | - $this->family = "hr"; |
|
46 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
47 | - $this->name = preg_replace( '/^mod/i', '', get_class($this)); |
|
48 | - $this->description = "Management of employees carrier and feelings (department, employment contract)"; |
|
49 | - |
|
50 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
51 | - $this->version = 'development'; |
|
52 | - |
|
53 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
54 | - // Name of image file used for this module. |
|
55 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
56 | - // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
57 | - $this->picto='generic'; |
|
58 | - |
|
59 | - // define triggers |
|
60 | - $this->module_parts = array(); |
|
61 | - |
|
62 | - // Data directories to create when module is enabled |
|
63 | - $this->dirs = array(); |
|
64 | - |
|
65 | - // Config pages |
|
66 | - $this->config_page_url = array('admin_hrm.php@hrm'); |
|
67 | - |
|
68 | - // Dependencies |
|
69 | - $this->hidden = false; // A condition to hide module |
|
70 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(/*"modSalaries, modExpenseReport, modHoliday"*/); // List of module ids to disable if this one is disabled |
|
72 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
74 | - $this->need_dolibarr_version = array (3,9); // Minimum version of Dolibarr required by module |
|
75 | - $this->langfiles = array ("hrm"); |
|
76 | - |
|
77 | - // Dictionaries |
|
78 | - $this->dictionaries=array(); |
|
79 | - |
|
80 | - // Constantes |
|
81 | - $this->const = array (); |
|
82 | - $r = 0; |
|
83 | - |
|
84 | - // Boxes |
|
85 | - $this->boxes = array (); |
|
86 | - |
|
87 | - // Permissions |
|
88 | - $this->rights = array(); // Permission array used by this module |
|
89 | - $r = 0; |
|
90 | - |
|
91 | - $this->rights[$r][0] = 4001; |
|
92 | - $this->rights[$r][1] = 'See employees'; |
|
93 | - $this->rights[$r][3] = 0; |
|
94 | - $this->rights[$r][4] = 'employee'; |
|
95 | - $this->rights[$r][5] = 'read'; |
|
96 | - $r ++; |
|
97 | - |
|
98 | - $this->rights[$r][0] = 4002; |
|
99 | - $this->rights[$r][1] = 'Create employees'; |
|
100 | - $this->rights[$r][3] = 0; |
|
101 | - $this->rights[$r][4] = 'employee'; |
|
102 | - $this->rights[$r][5] = 'write'; |
|
103 | - $r ++; |
|
104 | - |
|
105 | - $this->rights[$r][0] = 4003; |
|
106 | - $this->rights[$r][1] = 'Delete employees'; |
|
107 | - $this->rights[$r][3] = 0; |
|
108 | - $this->rights[$r][4] = 'employee'; |
|
109 | - $this->rights[$r][5] = 'delete'; |
|
110 | - $r ++; |
|
111 | - |
|
112 | - $this->rights[$r][0] = 4004; |
|
113 | - $this->rights[$r][1] = 'Export employees'; |
|
114 | - $this->rights[$r][3] = 0; |
|
115 | - $this->rights[$r][4] = 'employee'; |
|
116 | - $this->rights[$r][5] = 'export'; |
|
117 | - $r ++; |
|
118 | - |
|
119 | - |
|
120 | - // Menus |
|
121 | - //------- |
|
122 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Function called when module is enabled. |
|
127 | - * The init function add constants, boxes, permissions and menus |
|
128 | - * (defined in constructor) into Dolibarr database. |
|
129 | - * It also creates data directories |
|
130 | - * |
|
131 | - * @param string $options Enabling module ('', 'noboxes') |
|
132 | - * @return int if OK, 0 if KO |
|
133 | - */ |
|
134 | - function init($options='') |
|
135 | - { |
|
136 | - // Permissions |
|
137 | - $this->remove($options); |
|
138 | - |
|
139 | - $sql = array(); |
|
140 | - |
|
141 | - return $this->_init($sql,$options); |
|
142 | - } |
|
30 | + /** |
|
31 | + * Constructor. |
|
32 | + * Define names, constants, directories, boxes, permissions |
|
33 | + * |
|
34 | + * @param DoliDB $db Database handler |
|
35 | + */ |
|
36 | + public function __construct($db) |
|
37 | + { |
|
38 | + global $langs, $conf; |
|
39 | + |
|
40 | + $this->db = $db; |
|
41 | + |
|
42 | + $this->numero = 4000; |
|
43 | + $this->rights_class = 'hrm'; |
|
44 | + |
|
45 | + $this->family = "hr"; |
|
46 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
47 | + $this->name = preg_replace( '/^mod/i', '', get_class($this)); |
|
48 | + $this->description = "Management of employees carrier and feelings (department, employment contract)"; |
|
49 | + |
|
50 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
51 | + $this->version = 'development'; |
|
52 | + |
|
53 | + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
54 | + // Name of image file used for this module. |
|
55 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
56 | + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
57 | + $this->picto='generic'; |
|
58 | + |
|
59 | + // define triggers |
|
60 | + $this->module_parts = array(); |
|
61 | + |
|
62 | + // Data directories to create when module is enabled |
|
63 | + $this->dirs = array(); |
|
64 | + |
|
65 | + // Config pages |
|
66 | + $this->config_page_url = array('admin_hrm.php@hrm'); |
|
67 | + |
|
68 | + // Dependencies |
|
69 | + $this->hidden = false; // A condition to hide module |
|
70 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(/*"modSalaries, modExpenseReport, modHoliday"*/); // List of module ids to disable if this one is disabled |
|
72 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
74 | + $this->need_dolibarr_version = array (3,9); // Minimum version of Dolibarr required by module |
|
75 | + $this->langfiles = array ("hrm"); |
|
76 | + |
|
77 | + // Dictionaries |
|
78 | + $this->dictionaries=array(); |
|
79 | + |
|
80 | + // Constantes |
|
81 | + $this->const = array (); |
|
82 | + $r = 0; |
|
83 | + |
|
84 | + // Boxes |
|
85 | + $this->boxes = array (); |
|
86 | + |
|
87 | + // Permissions |
|
88 | + $this->rights = array(); // Permission array used by this module |
|
89 | + $r = 0; |
|
90 | + |
|
91 | + $this->rights[$r][0] = 4001; |
|
92 | + $this->rights[$r][1] = 'See employees'; |
|
93 | + $this->rights[$r][3] = 0; |
|
94 | + $this->rights[$r][4] = 'employee'; |
|
95 | + $this->rights[$r][5] = 'read'; |
|
96 | + $r ++; |
|
97 | + |
|
98 | + $this->rights[$r][0] = 4002; |
|
99 | + $this->rights[$r][1] = 'Create employees'; |
|
100 | + $this->rights[$r][3] = 0; |
|
101 | + $this->rights[$r][4] = 'employee'; |
|
102 | + $this->rights[$r][5] = 'write'; |
|
103 | + $r ++; |
|
104 | + |
|
105 | + $this->rights[$r][0] = 4003; |
|
106 | + $this->rights[$r][1] = 'Delete employees'; |
|
107 | + $this->rights[$r][3] = 0; |
|
108 | + $this->rights[$r][4] = 'employee'; |
|
109 | + $this->rights[$r][5] = 'delete'; |
|
110 | + $r ++; |
|
111 | + |
|
112 | + $this->rights[$r][0] = 4004; |
|
113 | + $this->rights[$r][1] = 'Export employees'; |
|
114 | + $this->rights[$r][3] = 0; |
|
115 | + $this->rights[$r][4] = 'employee'; |
|
116 | + $this->rights[$r][5] = 'export'; |
|
117 | + $r ++; |
|
118 | + |
|
119 | + |
|
120 | + // Menus |
|
121 | + //------- |
|
122 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Function called when module is enabled. |
|
127 | + * The init function add constants, boxes, permissions and menus |
|
128 | + * (defined in constructor) into Dolibarr database. |
|
129 | + * It also creates data directories |
|
130 | + * |
|
131 | + * @param string $options Enabling module ('', 'noboxes') |
|
132 | + * @return int if OK, 0 if KO |
|
133 | + */ |
|
134 | + function init($options='') |
|
135 | + { |
|
136 | + // Permissions |
|
137 | + $this->remove($options); |
|
138 | + |
|
139 | + $sql = array(); |
|
140 | + |
|
141 | + return $this->_init($sql,$options); |
|
142 | + } |
|
143 | 143 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * \ingroup HRM |
21 | 21 | * \brief Description and activation file for module HRM |
22 | 22 | */ |
23 | -include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php"; |
|
23 | +include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php"; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Class to describe and activate the HRM module |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | |
45 | 45 | $this->family = "hr"; |
46 | 46 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
47 | - $this->name = preg_replace( '/^mod/i', '', get_class($this)); |
|
47 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
48 | 48 | $this->description = "Management of employees carrier and feelings (department, employment contract)"; |
49 | 49 | |
50 | 50 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
51 | 51 | $this->version = 'development'; |
52 | 52 | |
53 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
53 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
54 | 54 | // Name of image file used for this module. |
55 | 55 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
56 | 56 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
57 | - $this->picto='generic'; |
|
57 | + $this->picto = 'generic'; |
|
58 | 58 | |
59 | 59 | // define triggers |
60 | 60 | $this->module_parts = array(); |
@@ -66,23 +66,23 @@ discard block |
||
66 | 66 | $this->config_page_url = array('admin_hrm.php@hrm'); |
67 | 67 | |
68 | 68 | // Dependencies |
69 | - $this->hidden = false; // A condition to hide module |
|
70 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(/*"modSalaries, modExpenseReport, modHoliday"*/); // List of module ids to disable if this one is disabled |
|
72 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
74 | - $this->need_dolibarr_version = array (3,9); // Minimum version of Dolibarr required by module |
|
75 | - $this->langfiles = array ("hrm"); |
|
69 | + $this->hidden = false; // A condition to hide module |
|
70 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(/*"modSalaries, modExpenseReport, modHoliday"*/); // List of module ids to disable if this one is disabled |
|
72 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
74 | + $this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module |
|
75 | + $this->langfiles = array("hrm"); |
|
76 | 76 | |
77 | 77 | // Dictionaries |
78 | - $this->dictionaries=array(); |
|
78 | + $this->dictionaries = array(); |
|
79 | 79 | |
80 | 80 | // Constantes |
81 | - $this->const = array (); |
|
81 | + $this->const = array(); |
|
82 | 82 | $r = 0; |
83 | 83 | |
84 | 84 | // Boxes |
85 | - $this->boxes = array (); |
|
85 | + $this->boxes = array(); |
|
86 | 86 | |
87 | 87 | // Permissions |
88 | 88 | $this->rights = array(); // Permission array used by this module |
@@ -93,33 +93,33 @@ discard block |
||
93 | 93 | $this->rights[$r][3] = 0; |
94 | 94 | $this->rights[$r][4] = 'employee'; |
95 | 95 | $this->rights[$r][5] = 'read'; |
96 | - $r ++; |
|
96 | + $r++; |
|
97 | 97 | |
98 | 98 | $this->rights[$r][0] = 4002; |
99 | 99 | $this->rights[$r][1] = 'Create employees'; |
100 | 100 | $this->rights[$r][3] = 0; |
101 | 101 | $this->rights[$r][4] = 'employee'; |
102 | 102 | $this->rights[$r][5] = 'write'; |
103 | - $r ++; |
|
103 | + $r++; |
|
104 | 104 | |
105 | 105 | $this->rights[$r][0] = 4003; |
106 | 106 | $this->rights[$r][1] = 'Delete employees'; |
107 | 107 | $this->rights[$r][3] = 0; |
108 | 108 | $this->rights[$r][4] = 'employee'; |
109 | 109 | $this->rights[$r][5] = 'delete'; |
110 | - $r ++; |
|
110 | + $r++; |
|
111 | 111 | |
112 | 112 | $this->rights[$r][0] = 4004; |
113 | 113 | $this->rights[$r][1] = 'Export employees'; |
114 | 114 | $this->rights[$r][3] = 0; |
115 | 115 | $this->rights[$r][4] = 'employee'; |
116 | 116 | $this->rights[$r][5] = 'export'; |
117 | - $r ++; |
|
117 | + $r++; |
|
118 | 118 | |
119 | 119 | |
120 | 120 | // Menus |
121 | 121 | //------- |
122 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
122 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | * @param string $options Enabling module ('', 'noboxes') |
132 | 132 | * @return int if OK, 0 if KO |
133 | 133 | */ |
134 | - function init($options='') |
|
134 | + function init($options = '') |
|
135 | 135 | { |
136 | 136 | // Permissions |
137 | 137 | $this->remove($options); |
138 | 138 | |
139 | 139 | $sql = array(); |
140 | 140 | |
141 | - return $this->_init($sql,$options); |
|
141 | + return $this->_init($sql, $options); |
|
142 | 142 | } |
143 | 143 | } |
@@ -32,33 +32,33 @@ discard block |
||
32 | 32 | { |
33 | 33 | |
34 | 34 | /** |
35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | - * |
|
37 | - * @param DoliDB $db Database handler |
|
35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | + * |
|
37 | + * @param DoliDB $db Database handler |
|
38 | 38 | */ |
39 | 39 | function __construct($db) |
40 | 40 | { |
41 | - global $langs,$conf; |
|
41 | + global $langs,$conf; |
|
42 | 42 | |
43 | 43 | $this->db = $db; |
44 | 44 | $this->numero = 30000; |
45 | 45 | |
46 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
47 | - // It is used to group modules in module setup page |
|
46 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
47 | + // It is used to group modules in module setup page |
|
48 | 48 | $this->family = "portal"; |
49 | 49 | $this->module_position = '51'; |
50 | 50 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
51 | 51 | $this->name = preg_replace('/^mod/i','',get_class($this)); |
52 | 52 | $this->description = "Enable the public collaboration features, like shared pad, shared online sheets, etc..."; |
53 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
53 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
54 | 54 | $this->version = 'development'; |
55 | 55 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
56 | 56 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
57 | 57 | // Name of image file used for this module. |
58 | 58 | $this->picto='globe'; |
59 | 59 | |
60 | - // Data directories to create when module is enabled |
|
61 | - $this->dirs = array("/collab/temp"); |
|
60 | + // Data directories to create when module is enabled |
|
61 | + $this->dirs = array("/collab/temp"); |
|
62 | 62 | |
63 | 63 | // Config pages |
64 | 64 | //------------- |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | |
67 | 67 | // Dependancies |
68 | 68 | //------------- |
69 | - $this->hidden = ! empty($conf->global->MODULE_COLLAB_DISABLED); // A condition to disable module |
|
70 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
69 | + $this->hidden = ! empty($conf->global->MODULE_COLLAB_DISABLED); // A condition to disable module |
|
70 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
71 | 71 | $this->requiredby = array(); // List of modules id to disable if this one is disabled |
72 | - $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
72 | + $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
73 | 73 | $this->langfiles = array("collab"); |
74 | 74 | |
75 | 75 | // Constants |
76 | 76 | //----------- |
77 | - $this->const = array(); |
|
77 | + $this->const = array(); |
|
78 | 78 | |
79 | 79 | // New pages on tabs |
80 | 80 | // ----------------- |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | //------ |
85 | 85 | $this->boxes = array(); |
86 | 86 | |
87 | - // Permissions |
|
88 | - $this->rights = array(); // Permission array used by this module |
|
89 | - $this->rights_class = 'collab'; |
|
90 | - $r=0; |
|
87 | + // Permissions |
|
88 | + $this->rights = array(); // Permission array used by this module |
|
89 | + $this->rights_class = 'collab'; |
|
90 | + $r=0; |
|
91 | 91 | |
92 | - /*$this->rights[$r][0] = 30001; |
|
92 | + /*$this->rights[$r][0] = 30001; |
|
93 | 93 | $this->rights[$r][1] = 'Read website content'; |
94 | 94 | $this->rights[$r][3] = 0; |
95 | 95 | $this->rights[$r][4] = 'read'; |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | // Main menu entries |
111 | 111 | $r=0; |
112 | 112 | $this->menu[$r]=array( 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
113 | - 'type'=>'top', // This is a Left menu entry |
|
114 | - 'titre'=>'Collab', |
|
113 | + 'type'=>'top', // This is a Left menu entry |
|
114 | + 'titre'=>'Collab', |
|
115 | 115 | 'mainmenu'=>'collab', |
116 | - 'url'=>'/collab/index.php', |
|
117 | - 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
118 | - 'position'=>100, |
|
119 | - 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
120 | - 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
121 | - 'target'=>'', |
|
122 | - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
116 | + 'url'=>'/collab/index.php', |
|
117 | + 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
118 | + 'position'=>100, |
|
119 | + 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
120 | + 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
121 | + 'target'=>'', |
|
122 | + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
123 | 123 | $r++; |
124 | 124 | } |
125 | 125 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \ingroup collab |
23 | 23 | * \brief Description and activation file for module Collab |
24 | 24 | */ |
25 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
25 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function __construct($db) |
40 | 40 | { |
41 | - global $langs,$conf; |
|
41 | + global $langs, $conf; |
|
42 | 42 | |
43 | 43 | $this->db = $db; |
44 | 44 | $this->numero = 30000; |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | $this->family = "portal"; |
49 | 49 | $this->module_position = '51'; |
50 | 50 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
51 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
52 | 52 | $this->description = "Enable the public collaboration features, like shared pad, shared online sheets, etc..."; |
53 | 53 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
54 | 54 | $this->version = 'development'; |
55 | 55 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
56 | 56 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
57 | 57 | // Name of image file used for this module. |
58 | - $this->picto='globe'; |
|
58 | + $this->picto = 'globe'; |
|
59 | 59 | |
60 | 60 | // Data directories to create when module is enabled |
61 | 61 | $this->dirs = array("/collab/temp"); |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | |
67 | 67 | // Dependancies |
68 | 68 | //------------- |
69 | - $this->hidden = ! empty($conf->global->MODULE_COLLAB_DISABLED); // A condition to disable module |
|
70 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
72 | - $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
69 | + $this->hidden = !empty($conf->global->MODULE_COLLAB_DISABLED); // A condition to disable module |
|
70 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
72 | + $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
73 | 73 | $this->langfiles = array("collab"); |
74 | 74 | |
75 | 75 | // Constants |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | $this->boxes = array(); |
86 | 86 | |
87 | 87 | // Permissions |
88 | - $this->rights = array(); // Permission array used by this module |
|
88 | + $this->rights = array(); // Permission array used by this module |
|
89 | 89 | $this->rights_class = 'collab'; |
90 | - $r=0; |
|
90 | + $r = 0; |
|
91 | 91 | |
92 | 92 | /*$this->rights[$r][0] = 30001; |
93 | 93 | $this->rights[$r][1] = 'Read website content'; |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | $r++;*/ |
109 | 109 | |
110 | 110 | // Main menu entries |
111 | - $r=0; |
|
112 | - $this->menu[$r]=array( 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
113 | - 'type'=>'top', // This is a Left menu entry |
|
111 | + $r = 0; |
|
112 | + $this->menu[$r] = array('fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
113 | + 'type'=>'top', // This is a Left menu entry |
|
114 | 114 | 'titre'=>'Collab', |
115 | 115 | 'mainmenu'=>'collab', |
116 | 116 | 'url'=>'/collab/index.php', |
117 | - 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
117 | + 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
118 | 118 | 'position'=>100, |
119 | - 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
120 | - 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
119 | + 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
120 | + 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
121 | 121 | 'target'=>'', |
122 | - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
122 | + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
123 | 123 | $r++; |
124 | 124 | } |
125 | 125 | } |
@@ -33,59 +33,59 @@ |
||
33 | 33 | class modMailmanSpip extends DolibarrModules |
34 | 34 | { |
35 | 35 | |
36 | - /** |
|
37 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
38 | - * |
|
39 | - * @param DoliDB $db Database handler |
|
40 | - */ |
|
41 | - function __construct($db) |
|
42 | - { |
|
43 | - $this->db = $db; |
|
44 | - $this->numero = 105; |
|
36 | + /** |
|
37 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
38 | + * |
|
39 | + * @param DoliDB $db Database handler |
|
40 | + */ |
|
41 | + function __construct($db) |
|
42 | + { |
|
43 | + $this->db = $db; |
|
44 | + $this->numero = 105; |
|
45 | 45 | |
46 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
47 | - // It is used to group modules in module setup page |
|
48 | - $this->family = "interface"; |
|
49 | - // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
50 | - $this->module_position = '70'; |
|
51 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
52 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
53 | - $this->description = "Mailman or Spip interface for member module"; |
|
46 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
47 | + // It is used to group modules in module setup page |
|
48 | + $this->family = "interface"; |
|
49 | + // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
50 | + $this->module_position = '70'; |
|
51 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
52 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
53 | + $this->description = "Mailman or Spip interface for member module"; |
|
54 | 54 | |
55 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
|
56 | - $this->version = 'dolibarr'; |
|
55 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
|
56 | + $this->version = 'dolibarr'; |
|
57 | 57 | |
58 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
59 | - $this->picto='technic'; |
|
58 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
59 | + $this->picto='technic'; |
|
60 | 60 | |
61 | - // Data directories to create when module is enabled |
|
62 | - $this->dirs = array(); |
|
61 | + // Data directories to create when module is enabled |
|
62 | + $this->dirs = array(); |
|
63 | 63 | |
64 | - // Dependencies |
|
65 | - $this->hidden = false; // A condition to hide module |
|
66 | - $this->depends = array('modAdherent'); // List of module class names as string that must be enabled if this module is enabled |
|
67 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
64 | + // Dependencies |
|
65 | + $this->hidden = false; // A condition to hide module |
|
66 | + $this->depends = array('modAdherent'); // List of module class names as string that must be enabled if this module is enabled |
|
67 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
70 | 70 | |
71 | - // Config pages |
|
72 | - $this->config_page_url = array('mailman.php'); |
|
71 | + // Config pages |
|
72 | + $this->config_page_url = array('mailman.php'); |
|
73 | 73 | |
74 | - // Constants |
|
75 | - $this->const = array(); |
|
76 | - $this->const[1] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de désinscription aux listes mailman"); |
|
77 | - $this->const[2] = array("ADHERENT_MAILMAN_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%","Url pour les inscriptions mailman"); |
|
78 | - $this->const[3] = array("ADHERENT_MAILMAN_LISTS","chaine","","Mailing-list to subscribe new members to"); |
|
74 | + // Constants |
|
75 | + $this->const = array(); |
|
76 | + $this->const[1] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de désinscription aux listes mailman"); |
|
77 | + $this->const[2] = array("ADHERENT_MAILMAN_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%","Url pour les inscriptions mailman"); |
|
78 | + $this->const[3] = array("ADHERENT_MAILMAN_LISTS","chaine","","Mailing-list to subscribe new members to"); |
|
79 | 79 | |
80 | - // Boxes |
|
81 | - $this->boxes = array(); |
|
80 | + // Boxes |
|
81 | + $this->boxes = array(); |
|
82 | 82 | |
83 | - // Permissions |
|
84 | - $this->rights = array(); |
|
85 | - $this->rights_class = 'clicktodial'; |
|
83 | + // Permissions |
|
84 | + $this->rights = array(); |
|
85 | + $this->rights_class = 'clicktodial'; |
|
86 | 86 | |
87 | - // Menus |
|
88 | - //------- |
|
89 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
90 | - } |
|
87 | + // Menus |
|
88 | + //------- |
|
89 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
90 | + } |
|
91 | 91 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * \brief Fichier de description et activation du module de click to Dial |
25 | 25 | */ |
26 | 26 | |
27 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
27 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | /** |
@@ -49,33 +49,33 @@ discard block |
||
49 | 49 | // Module position in the family on 2 digits ('01', '10', '20', ...) |
50 | 50 | $this->module_position = '70'; |
51 | 51 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
52 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
52 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
53 | 53 | $this->description = "Mailman or Spip interface for member module"; |
54 | 54 | |
55 | 55 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
56 | 56 | $this->version = 'dolibarr'; |
57 | 57 | |
58 | 58 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
59 | - $this->picto='technic'; |
|
59 | + $this->picto = 'technic'; |
|
60 | 60 | |
61 | 61 | // Data directories to create when module is enabled |
62 | 62 | $this->dirs = array(); |
63 | 63 | |
64 | 64 | // Dependencies |
65 | - $this->hidden = false; // A condition to hide module |
|
66 | - $this->depends = array('modAdherent'); // List of module class names as string that must be enabled if this module is enabled |
|
67 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
65 | + $this->hidden = false; // A condition to hide module |
|
66 | + $this->depends = array('modAdherent'); // List of module class names as string that must be enabled if this module is enabled |
|
67 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
70 | 70 | |
71 | 71 | // Config pages |
72 | 72 | $this->config_page_url = array('mailman.php'); |
73 | 73 | |
74 | 74 | // Constants |
75 | 75 | $this->const = array(); |
76 | - $this->const[1] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de désinscription aux listes mailman"); |
|
77 | - $this->const[2] = array("ADHERENT_MAILMAN_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%","Url pour les inscriptions mailman"); |
|
78 | - $this->const[3] = array("ADHERENT_MAILMAN_LISTS","chaine","","Mailing-list to subscribe new members to"); |
|
76 | + $this->const[1] = array("ADHERENT_MAILMAN_UNSUB_URL", "chaine", "http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%", "Url de désinscription aux listes mailman"); |
|
77 | + $this->const[2] = array("ADHERENT_MAILMAN_URL", "chaine", "http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%", "Url pour les inscriptions mailman"); |
|
78 | + $this->const[3] = array("ADHERENT_MAILMAN_LISTS", "chaine", "", "Mailing-list to subscribe new members to"); |
|
79 | 79 | |
80 | 80 | // Boxes |
81 | 81 | $this->boxes = array(); |
@@ -86,6 +86,6 @@ discard block |
||
86 | 86 | |
87 | 87 | // Menus |
88 | 88 | //------- |
89 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
89 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
90 | 90 | } |
91 | 91 | } |