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");
82 $this->hidden =
false;
83 $this->depends = array();
84 $this->requiredby = array();
85 $this->conflictwith = array();
86 $this->phpmin = array(7, 0);
87 $this->need_dolibarr_version = array(3, 0);
88 $this->langfiles = array(
"holiday");
94 $this->
const = array();
97 $this->
const[$r][0] =
"HOLIDAY_ADDON";
98 $this->
const[$r][1] =
"chaine";
99 $this->
const[$r][2] =
"mod_holiday_madonna";
100 $this->
const[$r][3] =
'Nom du gestionnaire de numerotation des congés';
101 $this->
const[$r][4] = 0;
104 $this->
const[$r][0] =
"HOLIDAY_ADDON_PDF";
105 $this->
const[$r][1] =
"chaine";
106 $this->
const[$r][2] =
"celebrate";
107 $this->
const[$r][3] =
'Name of PDF model of holiday';
108 $this->
const[$r][4] = 0;
111 $this->
const[$r][0] =
"HOLIDAY_ADDON_PDF_ODT_PATH";
112 $this->
const[$r][1] =
"chaine";
113 $this->
const[$r][2] =
"DOL_DATA_ROOT/doctemplates/holiday";
114 $this->
const[$r][3] =
"";
115 $this->
const[$r][4] = 0;
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",
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",
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();
246 $keyforselect =
'holiday';
247 $keyforelement =
'holiday';
248 $keyforaliasextra =
'extra';
249 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
250 $keyforselect =
'user'; $keyforelement =
'user'; $keyforaliasextra =
'extrau';
251 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
253 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
254 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'holiday as d';
255 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'holiday_extrafields as extra on d.rowid = extra.fk_object';
256 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_holiday_types as t ON t.rowid = d.fk_type';
257 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as ua ON ua.rowid = d.fk_validator,';
258 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'user as u';
259 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user_extrafields as extrau ON u.rowid = extrau.fk_object';
260 $this->export_sql_end[$r] .=
' WHERE d.fk_user = u.rowid';
261 $this->export_sql_end[$r] .=
' AND d.entity IN ('.getEntity(
'holiday').
')';