55 $this->numero = 20000;
57 $this->rights_class =
'holiday';
62 $this->module_position =
'42';
64 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
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();
123 [
'file' =>
'box_holidays_to_approve.php',
'enabledbydefaulton' =>
'Home'],
130 $datestart =
dol_mktime(4, 0, 0, $arraydate[
'mon'], $arraydate[
'mday'], $arraydate[
'year']);
131 $this->cronjobs = array(
133 'label' =>
'HolidayBalanceMonthlyUpdate:holiday',
134 'jobtype' =>
'method',
135 'class' =>
'holiday/class/holiday.class.php',
136 'objectname' =>
'Holiday',
137 'method' =>
'updateBalance',
139 'comment' =>
'Update holiday balance every month',
141 'unitfrequency' => 3600 * 24,
144 'test' =>
'$conf->holiday->enabled',
145 'datestart' => $datestart
148 'label' =>
'SendPreviousMonthHRInformations:holiday',
149 'jobtype' =>
'method',
150 'class' =>
'holiday/class/holiday.class.php',
151 'objectname' =>
'Holiday',
152 'method' =>
'sendPreviousMonthHRInformations',
153 'parameters' =>
'emailaddress, HolidayHrInformationsPreviousMonth',
154 '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)',
156 'unitfrequency' => 3600 * 24 * 31,
159 'test' =>
'isModEnabled("holiday")',
160 'datestart' => $datestart
166 $this->rights = array();
169 $this->rights[$r][0] = 20001;
170 $this->rights[$r][1] =
'Read leave requests (yours and your subordinates)';
171 $this->rights[$r][3] = 0;
172 $this->rights[$r][4] =
'read';
173 $this->rights[$r][5] =
'';
176 $this->rights[$r][0] = 20002;
177 $this->rights[$r][1] =
'Create/modify leave requests';
178 $this->rights[$r][3] = 0;
179 $this->rights[$r][4] =
'write';
180 $this->rights[$r][5] =
'';
183 $this->rights[$r][0] = 20003;
184 $this->rights[$r][1] =
'Delete leave requests';
185 $this->rights[$r][3] = 0;
186 $this->rights[$r][4] =
'delete';
187 $this->rights[$r][5] =
'';
190 $this->rights[$r][0] = 20007;
191 $this->rights[$r][1] =
'Approve leave requests';
192 $this->rights[$r][2] =
'w';
193 $this->rights[$r][3] = 0;
194 $this->rights[$r][4] =
'approve';
197 $this->rights[$r][0] = 20004;
198 $this->rights[$r][1] =
'Read leave requests for everybody';
199 $this->rights[$r][3] = 0;
200 $this->rights[$r][4] =
'readall';
201 $this->rights[$r][5] =
'';
204 $this->rights[$r][0] = 20005;
205 $this->rights[$r][1] =
'Create/modify leave requests for everybody';
206 $this->rights[$r][3] = 0;
207 $this->rights[$r][4] =
'writeall';
208 $this->rights[$r][5] =
'';
211 $this->rights[$r][0] = 20006;
212 $this->rights[$r][1] =
'Setup leave requests of users (setup and update balance)';
213 $this->rights[$r][3] = 0;
214 $this->rights[$r][4] =
'define_holiday';
215 $this->rights[$r][5] =
'';
228 $this->export_code[$r] =
'leaverequest_'.$r;
229 $this->export_label[$r] =
'ListeCP';
230 $this->export_icon[$r] =
'holiday';
231 $this->export_permission[$r] = array(array(
"holiday",
"readall"));
232 $this->export_fields_array[$r] = array(
233 'd.rowid' =>
"LeaveId",
'd.fk_type' =>
'TypeOfLeaveId',
't.code' =>
'TypeOfLeaveCode',
't.label' =>
'TypeOfLeaveLabel',
'd.fk_user' =>
'UserID',
234 'd.date_debut' =>
'DateStart',
'd.date_fin' =>
'DateEnd',
'd.halfday' =>
'HalfDay',
'none.num_open_days' =>
'NbUseDaysCP',
235 'd.date_valid' =>
'DateApprove',
'd.fk_validator' =>
"UserForApprovalID",
236 'u.lastname' =>
'Lastname',
'u.firstname' =>
'Firstname',
'u.login' =>
"Login",
'u.fk_country' =>
"CountyID",
237 'ua.lastname' =>
"UserForApprovalLastname",
'ua.firstname' =>
"UserForApprovalFirstname",
238 'ua.login' =>
"UserForApprovalLogin",
'd.description' =>
'Description',
'd.statut' =>
'Status'
240 $this->export_TypeFields_array[$r] = array(
241 'd.rowid' =>
"Numeric",
't.code' =>
'Text',
't.label' =>
'Text',
'd.fk_user' =>
'Numeric',
242 'd.date_debut' =>
'Date',
'd.date_fin' =>
'Date',
'none.num_open_days' =>
'NumericCompute',
243 'd.date_valid' =>
'Date',
'd.fk_validator' =>
"Numeric",
244 'u.lastname' =>
'Text',
'u.firstname' =>
'Text',
'u.login' =>
"Text",
'u.fk_country' =>
'Numeric',
245 'ua.lastname' =>
"Text",
'ua.firstname' =>
"Text",
246 'ua.login' =>
"Text",
'd.description' =>
'Text',
'd.statut' =>
'Numeric'
248 $this->export_entities_array[$r] = array(
249 'u.lastname' =>
'user',
'u.firstname' =>
'user',
'u.login' =>
'user',
'ua.lastname' =>
'user',
'ua.firstname' =>
'user',
'ua.login' =>
'user'
252 $this->export_special_array[$r] = array(
'none.num_open_days' =>
'getNumOpenDays');
253 $this->export_dependencies_array[$r] = array(
'none.num_open_days' =>
'u.fk_country');
256 $keyforselect =
'holiday';
257 $keyforelement =
'holiday';
258 $keyforaliasextra =
'extra';
259 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
260 $keyforselect =
'user';
261 $keyforelement =
'user';
262 $keyforaliasextra =
'extrau';
263 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
265 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
266 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'holiday as d';
267 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'holiday_extrafields as extra on d.rowid = extra.fk_object';
268 $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').
')';
269 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as ua ON ua.rowid = d.fk_validator,';
270 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'user as u';
271 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user_extrafields as extrau ON u.rowid = extrau.fk_object';
272 $this->export_sql_end[$r] .=
' WHERE d.fk_user = u.rowid';
273 $this->export_sql_end[$r] .=
' AND d.entity IN ('.getEntity(
'holiday').
')';
309 $this->import_code[$r] = $this->rights_class.
'_'.$r;
310 $this->import_label[$r] =
"ListeCP";
311 $this->import_icon[$r] =
'holiday';
312 $this->import_tables_array[$r] = array(
'd' => MAIN_DB_PREFIX.
'holiday');
313 $this->import_fields_array[$r] = array(
314 'd.ref' =>
'Ref*',
'd.fk_user' =>
'UserID*',
'd.fk_type' =>
'TypeOfLeaveId*',
'd.fk_validator' =>
'ApprovedBy*',
315 'd.date_debut' =>
'DateStart*',
'd.date_fin' =>
'DateEnd*',
'd.halfday' =>
'HalfDay',
'd.description' =>
'Description*',
316 'd.date_create' =>
'DateCreation*'
321 $this->import_code[$r] = $this->rights_class.
'_'.$r;
322 $this->import_label[$r] =
"ListeLB";
323 $this->import_icon[$r] =
'holiday';
324 $this->import_tables_array[$r] = array(
'd' => MAIN_DB_PREFIX.
'holiday_users');
325 $this->import_fields_array[$r] = array(
326 'd.fk_user' =>
"Employee*",
'd.nb_holiday' =>
"LeaveBalance*",
'd.fk_type' =>
"LeaveType*"
329 $keyforselect =
'holiday';
330 $keyforelement =
'holiday';
331 $keyforaliasextra =
'extra';
332 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinimport.inc.php';