54 $this->numero = 20000;
56 $this->rights_class =
'holiday';
61 $this->module_position =
'42';
63 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
67 $this->version =
'dolibarr';
69 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
73 $this->picto =
'holiday';
77 $this->dirs = array(
"/holiday/temp");
81 $this->config_page_url = array(
"holiday.php");
84 $this->hidden =
false;
85 $this->depends = array();
86 $this->requiredby = array();
87 $this->conflictwith = array();
88 $this->phpmin = array(7, 0);
89 $this->need_dolibarr_version = array(3, 0);
90 $this->langfiles = array(
"holiday");
98 "mod_holiday_madonna",
99 'Nom du gestionnaire de numerotation des congés',
106 'Name of PDF model of holiday',
110 "HOLIDAY_ADDON_PDF_ODT_PATH",
112 "DOL_DATA_ROOT".($conf->entity > 1 ?
'/'.$conf->entity :
'').
"/doctemplates/holiday",
120 $this->tabs[] = array();
123 $this->boxes = array();
136 $datestart =
dol_mktime(4, 0, 0, $arraydate[
'mon'], $arraydate[
'mday'], $arraydate[
'year']);
137 $this->cronjobs = array(
139 'label' =>
'HolidayBalanceMonthlyUpdate:holiday',
140 'jobtype' =>
'method',
141 'class' =>
'holiday/class/holiday.class.php',
142 'objectname' =>
'Holiday',
143 'method' =>
'updateBalance',
145 'comment' =>
'Update holiday balance every month',
147 'unitfrequency' => 3600 * 24,
150 'test' =>
'$conf->holiday->enabled',
151 'datestart' => $datestart
157 $this->rights = array();
160 $this->rights[$r][0] = 20001;
161 $this->rights[$r][1] =
'Read leave requests (yours and your subordinates)';
162 $this->rights[$r][3] = 0;
163 $this->rights[$r][4] =
'read';
164 $this->rights[$r][5] =
'';
167 $this->rights[$r][0] = 20002;
168 $this->rights[$r][1] =
'Create/modify leave requests';
169 $this->rights[$r][3] = 0;
170 $this->rights[$r][4] =
'write';
171 $this->rights[$r][5] =
'';
174 $this->rights[$r][0] = 20003;
175 $this->rights[$r][1] =
'Delete leave requests';
176 $this->rights[$r][3] = 0;
177 $this->rights[$r][4] =
'delete';
178 $this->rights[$r][5] =
'';
181 $this->rights[$r][0] = 20007;
182 $this->rights[$r][1] =
'Approve leave requests';
183 $this->rights[$r][2] =
'w';
184 $this->rights[$r][3] = 0;
185 $this->rights[$r][4] =
'approve';
188 $this->rights[$r][0] = 20004;
189 $this->rights[$r][1] =
'Read leave requests for everybody';
190 $this->rights[$r][3] = 0;
191 $this->rights[$r][4] =
'readall';
192 $this->rights[$r][5] =
'';
195 $this->rights[$r][0] = 20005;
196 $this->rights[$r][1] =
'Create/modify leave requests for everybody';
197 $this->rights[$r][3] = 0;
198 $this->rights[$r][4] =
'writeall';
199 $this->rights[$r][5] =
'';
202 $this->rights[$r][0] = 20006;
203 $this->rights[$r][1] =
'Setup leave requests of users (setup and update balance)';
204 $this->rights[$r][3] = 0;
205 $this->rights[$r][4] =
'define_holiday';
206 $this->rights[$r][5] =
'';
219 $this->export_code[$r] =
'leaverequest_'.$r;
220 $this->export_label[$r] =
'ListeCP';
221 $this->export_icon[$r] =
'holiday';
222 $this->export_permission[$r] = array(array(
"holiday",
"readall"));
223 $this->export_fields_array[$r] = array(
224 'd.rowid' =>
"LeaveId",
'd.fk_type' =>
'TypeOfLeaveId',
't.code' =>
'TypeOfLeaveCode',
't.label' =>
'TypeOfLeaveLabel',
'd.fk_user' =>
'UserID',
225 'd.date_debut' =>
'DateStart',
'd.date_fin' =>
'DateEnd',
'd.halfday' =>
'HalfDay',
'none.num_open_days' =>
'NbUseDaysCP',
226 'd.date_valid' =>
'DateApprove',
'd.fk_validator' =>
"UserForApprovalID",
227 'u.lastname' =>
'Lastname',
'u.firstname' =>
'Firstname',
'u.login' =>
"Login",
'u.fk_country' =>
"CountyID",
228 'ua.lastname' =>
"UserForApprovalLastname",
'ua.firstname' =>
"UserForApprovalFirstname",
229 'ua.login' =>
"UserForApprovalLogin",
'd.description' =>
'Description',
'd.statut' =>
'Status'
231 $this->export_TypeFields_array[$r] = array(
232 'd.rowid' =>
"Numeric",
't.code' =>
'Text',
't.label' =>
'Text',
'd.fk_user' =>
'Numeric',
233 'd.date_debut' =>
'Date',
'd.date_fin' =>
'Date',
'none.num_open_days' =>
'NumericCompute',
234 'd.date_valid' =>
'Date',
'd.fk_validator' =>
"Numeric",
235 'u.lastname' =>
'Text',
'u.firstname' =>
'Text',
'u.login' =>
"Text",
'u.fk_country' =>
'Numeric',
236 'ua.lastname' =>
"Text",
'ua.firstname' =>
"Text",
237 'ua.login' =>
"Text",
'd.description' =>
'Text',
'd.statut' =>
'Numeric'
239 $this->export_entities_array[$r] = array(
240 'u.lastname' =>
'user',
'u.firstname' =>
'user',
'u.login' =>
'user',
'ua.lastname' =>
'user',
'ua.firstname' =>
'user',
'ua.login' =>
'user'
243 $this->export_special_array[$r] = array(
'none.num_open_days' =>
'getNumOpenDays');
244 $this->export_dependencies_array[$r] = array(
'none.num_open_days' =>
'u.fk_country');
247 $keyforselect =
'holiday';
248 $keyforelement =
'holiday';
249 $keyforaliasextra =
'extra';
250 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
251 $keyforselect =
'user';
252 $keyforelement =
'user';
253 $keyforaliasextra =
'extrau';
254 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
256 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
257 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'holiday as d';
258 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'holiday_extrafields as extra on d.rowid = extra.fk_object';
259 $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').
')';
260 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as ua ON ua.rowid = d.fk_validator,';
261 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'user as u';
262 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user_extrafields as extrau ON u.rowid = extrau.fk_object';
263 $this->export_sql_end[$r] .=
' WHERE d.fk_user = u.rowid';
264 $this->export_sql_end[$r] .=
' AND d.entity IN ('.getEntity(
'holiday').
')';
300 $this->import_code[$r] = $this->rights_class.
'_'.$r;
301 $this->import_label[$r] =
"ListeCP";
302 $this->import_icon[$r] =
'holiday';
303 $this->import_tables_array[$r] = array(
'd' => MAIN_DB_PREFIX.
'holiday');
304 $this->import_fields_array[$r] = array(
305 'd.ref' =>
'Ref*',
'd.fk_user' =>
'UserID*',
'd.fk_type' =>
'TypeOfLeaveId*',
'd.fk_validator' =>
'ApprovedBy*',
306 'd.date_debut' =>
'DateStart*',
'd.date_fin' =>
'DateEnd*',
'd.halfday' =>
'HalfDay',
'd.description' =>
'Description*',
307 'd.date_create' =>
'DateCreation*'
310 $keyforselect =
'holiday';
311 $keyforelement =
'holiday';
312 $keyforaliasextra =
'extra';
313 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinimport.inc.php';