31 include_once DOL_DOCUMENT_ROOT.
"/core/modules/DolibarrModules.class.php";
52 $this->numero = 20000;
54 $this->rights_class =
'holiday';
59 $this->module_position =
'42';
61 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
65 $this->version =
'dolibarr';
67 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
71 $this->picto =
'holiday';
75 $this->dirs = array(
"/holiday/temp");
79 $this->config_page_url = array(
"holiday.php");
86 $this->hidden =
false;
87 $this->depends = array();
88 $this->requiredby = array();
89 $this->conflictwith = array();
90 $this->phpmin = array(5, 6);
91 $this->need_dolibarr_version = array(3, 0);
92 $this->langfiles = array(
"holiday");
98 $this->
const = array();
101 $this->
const[$r][0] =
"HOLIDAY_ADDON";
102 $this->
const[$r][1] =
"chaine";
103 $this->
const[$r][2] =
"mod_holiday_madonna";
104 $this->
const[$r][3] =
'Nom du gestionnaire de numerotation des congés';
105 $this->
const[$r][4] = 0;
108 $this->
const[$r][0] =
"HOLIDAY_ADDON_PDF";
109 $this->
const[$r][1] =
"chaine";
110 $this->
const[$r][2] =
"celebrate";
111 $this->
const[$r][3] =
'Name of PDF model of holiday';
112 $this->
const[$r][4] = 0;
115 $this->
const[$r][0] =
"HOLIDAY_ADDON_PDF_ODT_PATH";
116 $this->
const[$r][1] =
"chaine";
117 $this->
const[$r][2] =
"DOL_DATA_ROOT/doctemplates/holiday";
118 $this->
const[$r][3] =
"";
119 $this->
const[$r][4] = 0;
124 $this->tabs[] = array();
127 $this->boxes = array();
140 $datestart =
dol_mktime(4, 0, 0, $arraydate[
'mon'], $arraydate[
'mday'], $arraydate[
'year']);
141 $this->cronjobs = array(
143 'label' =>
'HolidayBalanceMonthlyUpdate',
144 'jobtype' =>
'method',
145 'class' =>
'holiday/class/holiday.class.php',
146 'objectname' =>
'Holiday',
147 'method' =>
'updateBalance',
149 'comment' =>
'Update holiday balance every month',
151 'unitfrequency' => 3600 * 24,
154 'test' =>
'$conf->holiday->enabled',
155 'datestart' => $datestart
161 $this->rights = array();
164 $this->rights[$r][0] = 20001;
165 $this->rights[$r][1] =
'Read leave requests (yours and your subordinates)';
166 $this->rights[$r][3] = 0;
167 $this->rights[$r][4] =
'read';
168 $this->rights[$r][5] =
'';
171 $this->rights[$r][0] = 20002;
172 $this->rights[$r][1] =
'Create/modify leave requests';
173 $this->rights[$r][3] = 0;
174 $this->rights[$r][4] =
'write';
175 $this->rights[$r][5] =
'';
178 $this->rights[$r][0] = 20003;
179 $this->rights[$r][1] =
'Delete leave requests';
180 $this->rights[$r][3] = 0;
181 $this->rights[$r][4] =
'delete';
182 $this->rights[$r][5] =
'';
185 $this->rights[$r][0] = 20007;
186 $this->rights[$r][1] =
'Approve leave requests';
187 $this->rights[$r][2] =
'w';
188 $this->rights[$r][3] = 0;
189 $this->rights[$r][4] =
'approve';
192 $this->rights[$r][0] = 20004;
193 $this->rights[$r][1] =
'Read leave requests for everybody';
194 $this->rights[$r][3] = 0;
195 $this->rights[$r][4] =
'readall';
196 $this->rights[$r][5] =
'';
199 $this->rights[$r][0] = 20005;
200 $this->rights[$r][1] =
'Create/modify leave requests for everybody';
201 $this->rights[$r][3] = 0;
202 $this->rights[$r][4] =
'writeall';
203 $this->rights[$r][5] =
'';
206 $this->rights[$r][0] = 20006;
207 $this->rights[$r][1] =
'Setup leave requests of users (setup and update balance)';
208 $this->rights[$r][3] = 0;
209 $this->rights[$r][4] =
'define_holiday';
210 $this->rights[$r][5] =
'';
223 $this->export_code[$r] =
'leaverequest_'.$r;
224 $this->export_label[$r] =
'ListeCP';
225 $this->export_icon[$r] =
'holiday';
226 $this->export_permission[$r] = array(array(
"holiday",
"readall"));
227 $this->export_fields_array[$r] = array(
228 'd.rowid'=>
"LeaveId",
'd.fk_type'=>
'TypeOfLeaveId',
't.code'=>
'TypeOfLeaveCode',
't.label'=>
'TypeOfLeaveLabel',
'd.fk_user'=>
'UserID',
229 'd.date_debut'=>
'DateStart',
'd.date_fin'=>
'DateEnd',
'd.halfday'=>
'HalfDay',
'none.num_open_days'=>
'NbUseDaysCP',
230 'd.date_valid'=>
'DateApprove',
'd.fk_validator'=>
"UserForApprovalID",
231 'u.lastname'=>
'Lastname',
'u.firstname'=>
'Firstname',
'u.login'=>
"Login",
232 'ua.lastname'=>
"UserForApprovalLastname",
'ua.firstname'=>
"UserForApprovalFirstname",
233 'ua.login'=>
"UserForApprovalLogin",
'd.description'=>
'Description',
'd.statut'=>
'Status'
235 $this->export_TypeFields_array[$r] = array(
236 'd.rowid'=>
"Numeric",
't.code'=>
'Text',
't.label'=>
'Text',
'd.fk_user'=>
'Numeric',
237 'd.date_debut'=>
'Date',
'd.date_fin'=>
'Date',
'none.num_open_days'=>
'NumericCompute',
238 'd.date_valid'=>
'Date',
'd.fk_validator'=>
"Numeric",
239 'u.lastname'=>
'Text',
'u.firstname'=>
'Text',
'u.login'=>
"Text",
240 'ua.lastname'=>
"Text",
'ua.firstname'=>
"Text",
241 'ua.login'=>
"Text",
'd.description'=>
'Text',
'd.statut'=>
'Numeric'
243 $this->export_entities_array[$r] = array(
244 'u.lastname'=>
'user',
'u.firstname'=>
'user',
'u.login'=>
'user',
'ua.lastname'=>
'user',
'ua.firstname'=>
'user',
'ua.login'=>
'user'
246 $this->export_alias_array[$r] = array(
'd.rowid'=>
"idholiday");
247 $this->export_special_array[$r] = array(
'none.num_open_days'=>
'getNumOpenDays');
248 $this->export_dependencies_array[$r] = array();
250 $keyforselect =
'holiday';
251 $keyforelement =
'holiday';
252 $keyforaliasextra =
'extra';
253 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
254 $keyforselect =
'user'; $keyforelement =
'user'; $keyforaliasextra =
'extrau';
255 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
257 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
258 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'holiday as d';
259 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'holiday_extrafields as extra on d.rowid = extra.fk_object';
260 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_holiday_types as t ON t.rowid = d.fk_type';
261 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as ua ON ua.rowid = d.fk_validator,';
262 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'user as u';
263 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user_extrafields as extrau ON u.rowid = extrau.fk_object';
264 $this->export_sql_end[$r] .=
' WHERE d.fk_user = u.rowid';
265 $this->export_sql_end[$r] .=
' AND d.entity IN ('.getEntity(
'holiday').
')';
312 public function init($options =
'')
317 $this->
remove($options);
343 return $this->
_init($sql, $options);