55 $this->numero = 20000;
57 $this->rights_class =
'holiday';
62 $this->module_position =
'42';
64 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
68 $this->version =
'dolibarr';
70 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
74 $this->picto =
'holiday';
78 $this->dirs = array(
"/holiday/temp");
82 $this->config_page_url = array(
"holiday.php");
85 $this->hidden =
false;
86 $this->depends = array();
87 $this->requiredby = array();
88 $this->conflictwith = array();
89 $this->langfiles = array(
"holiday");
97 "mod_holiday_madonna",
98 'Nom du gestionnaire de numerotation des congés',
105 'Name of PDF model of holiday',
109 "HOLIDAY_ADDON_PDF_ODT_PATH",
111 "DOL_DATA_ROOT".($conf->entity > 1 ?
'/'.$conf->entity :
'').
"/doctemplates/holiday",
119 $this->tabs[] = array();
122 $this->boxes = array();
135 $datestart =
dol_mktime(4, 0, 0, $arraydate[
'mon'], $arraydate[
'mday'], $arraydate[
'year']);
136 $this->cronjobs = array(
138 'label' =>
'HolidayBalanceMonthlyUpdate:holiday',
139 'jobtype' =>
'method',
140 'class' =>
'holiday/class/holiday.class.php',
141 'objectname' =>
'Holiday',
142 'method' =>
'updateBalance',
144 'comment' =>
'Update holiday balance every month',
146 'unitfrequency' => 3600 * 24,
149 'test' =>
'$conf->holiday->enabled',
150 'datestart' => $datestart
153 'label' =>
'SendPreviousMonthHRInformations:holiday',
154 'jobtype' =>
'method',
155 'class' =>
'holiday/class/holiday.class.php',
156 'objectname' =>
'Holiday',
157 'method' =>
'sendPreviousMonthHRInformations',
158 'parameters' =>
'emailaddress, HolidayHrInformationsPreviousMonth',
159 'comment' =>
'Send HR information to the defined email address in first parameter. Second parameter must be the email template code (can be id or label of emailtemplate to send)',
161 'unitfrequency' => 3600 * 24 * 31,
164 'test' =>
'isModEnabled("holiday")',
165 'datestart' => $datestart
171 $this->rights = array();
174 $this->rights[$r][0] = 20001;
175 $this->rights[$r][1] =
'Read leave requests (yours and your subordinates)';
176 $this->rights[$r][3] = 0;
177 $this->rights[$r][4] =
'read';
178 $this->rights[$r][5] =
'';
181 $this->rights[$r][0] = 20002;
182 $this->rights[$r][1] =
'Create/modify leave requests';
183 $this->rights[$r][3] = 0;
184 $this->rights[$r][4] =
'write';
185 $this->rights[$r][5] =
'';
188 $this->rights[$r][0] = 20003;
189 $this->rights[$r][1] =
'Delete leave requests';
190 $this->rights[$r][3] = 0;
191 $this->rights[$r][4] =
'delete';
192 $this->rights[$r][5] =
'';
195 $this->rights[$r][0] = 20007;
196 $this->rights[$r][1] =
'Approve leave requests';
197 $this->rights[$r][2] =
'w';
198 $this->rights[$r][3] = 0;
199 $this->rights[$r][4] =
'approve';
202 $this->rights[$r][0] = 20004;
203 $this->rights[$r][1] =
'Read leave requests for everybody';
204 $this->rights[$r][3] = 0;
205 $this->rights[$r][4] =
'readall';
206 $this->rights[$r][5] =
'';
209 $this->rights[$r][0] = 20005;
210 $this->rights[$r][1] =
'Create/modify leave requests for everybody';
211 $this->rights[$r][3] = 0;
212 $this->rights[$r][4] =
'writeall';
213 $this->rights[$r][5] =
'';
216 $this->rights[$r][0] = 20006;
217 $this->rights[$r][1] =
'Setup leave requests of users (setup and update balance)';
218 $this->rights[$r][3] = 0;
219 $this->rights[$r][4] =
'define_holiday';
220 $this->rights[$r][5] =
'';
233 $this->export_code[$r] =
'leaverequest_'.$r;
234 $this->export_label[$r] =
'ListeCP';
235 $this->export_icon[$r] =
'holiday';
236 $this->export_permission[$r] = array(array(
"holiday",
"readall"));
237 $this->export_fields_array[$r] = array(
238 'd.rowid' =>
"LeaveId",
'd.fk_type' =>
'TypeOfLeaveId',
't.code' =>
'TypeOfLeaveCode',
't.label' =>
'TypeOfLeaveLabel',
'd.fk_user' =>
'UserID',
239 'd.date_debut' =>
'DateStart',
'd.date_fin' =>
'DateEnd',
'd.halfday' =>
'HalfDay',
'none.num_open_days' =>
'NbUseDaysCP',
240 'd.date_valid' =>
'DateApprove',
'd.fk_validator' =>
"UserForApprovalID",
241 'u.lastname' =>
'Lastname',
'u.firstname' =>
'Firstname',
'u.login' =>
"Login",
'u.fk_country' =>
"CountyID",
242 'ua.lastname' =>
"UserForApprovalLastname",
'ua.firstname' =>
"UserForApprovalFirstname",
243 'ua.login' =>
"UserForApprovalLogin",
'd.description' =>
'Description',
'd.statut' =>
'Status'
245 $this->export_TypeFields_array[$r] = array(
246 'd.rowid' =>
"Numeric",
't.code' =>
'Text',
't.label' =>
'Text',
'd.fk_user' =>
'Numeric',
247 'd.date_debut' =>
'Date',
'd.date_fin' =>
'Date',
'none.num_open_days' =>
'NumericCompute',
248 'd.date_valid' =>
'Date',
'd.fk_validator' =>
"Numeric",
249 'u.lastname' =>
'Text',
'u.firstname' =>
'Text',
'u.login' =>
"Text",
'u.fk_country' =>
'Numeric',
250 'ua.lastname' =>
"Text",
'ua.firstname' =>
"Text",
251 'ua.login' =>
"Text",
'd.description' =>
'Text',
'd.statut' =>
'Numeric'
253 $this->export_entities_array[$r] = array(
254 'u.lastname' =>
'user',
'u.firstname' =>
'user',
'u.login' =>
'user',
'ua.lastname' =>
'user',
'ua.firstname' =>
'user',
'ua.login' =>
'user'
257 $this->export_special_array[$r] = array(
'none.num_open_days' =>
'getNumOpenDays');
258 $this->export_dependencies_array[$r] = array(
'none.num_open_days' =>
'u.fk_country');
261 $keyforselect =
'holiday';
262 $keyforelement =
'holiday';
263 $keyforaliasextra =
'extra';
264 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
265 $keyforselect =
'user';
266 $keyforelement =
'user';
267 $keyforaliasextra =
'extrau';
268 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
270 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
271 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'holiday as d';
272 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'holiday_extrafields as extra on d.rowid = extra.fk_object';
273 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_holiday_types as t ON t.rowid = d.fk_type AND t.entity IN (0, '.
getEntity(
'c_holiday_types').
')';
274 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as ua ON ua.rowid = d.fk_validator,';
275 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'user as u';
276 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user_extrafields as extrau ON u.rowid = extrau.fk_object';
277 $this->export_sql_end[$r] .=
' WHERE d.fk_user = u.rowid';
278 $this->export_sql_end[$r] .=
' AND d.entity IN ('.getEntity(
'holiday').
')';
314 $this->import_code[$r] = $this->rights_class.
'_'.$r;
315 $this->import_label[$r] =
"ListeCP";
316 $this->import_icon[$r] =
'holiday';
317 $this->import_tables_array[$r] = array(
'd' => MAIN_DB_PREFIX.
'holiday');
318 $this->import_fields_array[$r] = array(
319 'd.ref' =>
'Ref*',
'd.fk_user' =>
'UserID*',
'd.fk_type' =>
'TypeOfLeaveId*',
'd.fk_validator' =>
'ApprovedBy*',
320 'd.date_debut' =>
'DateStart*',
'd.date_fin' =>
'DateEnd*',
'd.halfday' =>
'HalfDay',
'd.description' =>
'Description*',
321 'd.date_create' =>
'DateCreation*'
326 $this->import_code[$r] = $this->rights_class.
'_'.$r;
327 $this->import_label[$r] =
"ListeLB";
328 $this->import_icon[$r] =
'holiday';
329 $this->import_tables_array[$r] = array(
'd' => MAIN_DB_PREFIX.
'holiday_users');
330 $this->import_fields_array[$r] = array(
331 'd.fk_user' =>
"Employee*",
'd.nb_holiday' =>
"LeaveBalance*",
'd.fk_type' =>
"LeaveType*"
334 $keyforselect =
'holiday';
335 $keyforelement =
'holiday';
336 $keyforaliasextra =
'extra';
337 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinimport.inc.php';