|
1
|
|
|
<?php |
|
2
|
|
|
/************************************************************************ |
|
3
|
|
|
* OVIDENTIA http://www.ovidentia.org * |
|
4
|
|
|
************************************************************************ |
|
5
|
|
|
* Copyright (c) 2003 by CANTICO ( http://www.cantico.fr ) * |
|
6
|
|
|
* * |
|
7
|
|
|
* This file is part of Ovidentia. * |
|
8
|
|
|
* * |
|
9
|
|
|
* Ovidentia is free software; you can redistribute it and/or modify * |
|
10
|
|
|
* it under the terms of the GNU General Public License as published by * |
|
11
|
|
|
* the Free Software Foundation; either version 2, or (at your option) * |
|
12
|
|
|
* any later version. * |
|
13
|
|
|
* * |
|
14
|
|
|
* This program is distributed in the hope that it will be useful, but * |
|
15
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of * |
|
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * |
|
17
|
|
|
* See the GNU General Public License for more details. * |
|
18
|
|
|
* * |
|
19
|
|
|
* You should have received a copy of the GNU General Public License * |
|
20
|
|
|
* along with this program; if not, write to the Free Software * |
|
21
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,* |
|
22
|
|
|
* USA. * |
|
23
|
|
|
************************************************************************/ |
|
24
|
|
|
|
|
25
|
|
|
require_once dirname(__FILE__).'/agent.class.php'; |
|
26
|
|
|
require_once dirname(__FILE__).'/agent.ui.php'; |
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
class absences_requestDetail |
|
30
|
|
|
{ |
|
31
|
|
|
public $daterequesttxt; |
|
32
|
|
|
public $daterequest; |
|
33
|
|
|
|
|
34
|
|
|
public $commenttxt; |
|
35
|
|
|
public $comment; |
|
36
|
|
|
public $remarktxt; |
|
37
|
|
|
public $remark; |
|
38
|
|
|
public $statustxt; |
|
39
|
|
|
public $status; |
|
40
|
|
|
|
|
41
|
|
|
public $t_history; |
|
42
|
|
|
public $t_author; |
|
43
|
|
|
public $t_message; |
|
44
|
|
|
|
|
45
|
|
|
public $agentcard = false; |
|
46
|
|
|
|
|
47
|
|
|
public $disp_movements; |
|
48
|
|
|
private $movements; |
|
49
|
|
|
|
|
50
|
|
|
public $altbg = true; |
|
51
|
|
|
|
|
52
|
|
|
protected $request; |
|
53
|
|
|
|
|
54
|
|
|
public function __construct(absences_Request $request, $withCardFrame = null) |
|
55
|
|
|
{ |
|
56
|
|
|
$this->request = $request; |
|
57
|
|
|
|
|
58
|
|
|
$this->daterequesttxt = absences_translate("Request date"); |
|
59
|
|
|
$this->t_createdOn = absences_translate('Date'); |
|
|
|
|
|
|
60
|
|
|
$this->t_comment = absences_translate('Applicant comment'); |
|
|
|
|
|
|
61
|
|
|
$this->statustxt = absences_translate("Status"); |
|
62
|
|
|
$this->commenttxt = absences_translate("Appliquant comments"); |
|
63
|
|
|
$this->remarktxt = absences_translate("Approvers comment"); |
|
64
|
|
|
$this->t_history = absences_translate('History'); |
|
65
|
|
|
$this->t_author = absences_translate('Author'); |
|
66
|
|
|
$this->t_message = absences_translate('Message'); |
|
67
|
|
|
$this->t_mvt_comment = absences_translate('Regularization or approval comment by the author'); |
|
|
|
|
|
|
68
|
|
|
|
|
69
|
|
|
|
|
70
|
|
|
$W = bab_Widgets(); |
|
71
|
|
|
$agent = absences_Agent::getFromIdUser($request->id_user); |
|
72
|
|
|
$this->owner = bab_toHtml($agent->getName()); |
|
|
|
|
|
|
73
|
|
|
|
|
74
|
|
|
if (!isset($withCardFrame)) |
|
75
|
|
|
{ |
|
76
|
|
|
$withCardFrame = ($agent->getIdUser() !== bab_getUserId()); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
if ($withCardFrame) |
|
80
|
|
|
{ |
|
81
|
|
|
$card = new absences_AgentCardFrame($agent); |
|
82
|
|
|
$this->agentcard = $card->display($W->HtmlCanvas()); |
|
|
|
|
|
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
|
|
86
|
|
|
$this->daterequest = bab_toHtml(bab_longDate(bab_mktime($request->createdOn()))); |
|
87
|
|
|
|
|
88
|
|
|
$this->comment = bab_toHtml($request->comment, BAB_HTML_ALL); |
|
|
|
|
|
|
89
|
|
|
$this->remark = bab_toHtml($request->comment2, BAB_HTML_ALL); |
|
90
|
|
|
$this->status = bab_toHtml($request->getStatusStr()); |
|
91
|
|
|
|
|
92
|
|
|
|
|
93
|
|
|
$this->movements = $request->getMovementIterator(); |
|
94
|
|
|
|
|
95
|
|
|
$this->movements->rewind(); |
|
96
|
|
|
$this->disp_movements = true; |
|
97
|
|
|
|
|
98
|
|
|
if ($this->movements->count() == 0) |
|
99
|
|
|
{ |
|
100
|
|
|
$this->disp_movements = false; |
|
101
|
|
|
} |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* |
|
107
|
|
|
* @var bool $manager_view |
|
108
|
|
|
*/ |
|
109
|
|
|
protected function initDelete($manager_view) |
|
110
|
|
|
{ |
|
111
|
|
|
$this->url = isset($_REQUEST['from']) ? $_REQUEST['from'] : $_SERVER['HTTP_REFERER']; |
|
|
|
|
|
|
112
|
|
|
$this->t_delete = absences_translate("Delete"); |
|
|
|
|
|
|
113
|
|
|
$this->delete_with_approval = false; |
|
|
|
|
|
|
114
|
|
|
$this->rfrom = $manager_view ? '1' : '0'; |
|
|
|
|
|
|
115
|
|
|
|
|
116
|
|
|
if ('Y' === $this->request->status && !$manager_view) { |
|
117
|
|
|
$this->delete_with_approval = absences_translate('The request will be deleted after approval'); |
|
118
|
|
|
} |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
|
|
122
|
|
|
|
|
123
|
|
|
|
|
124
|
|
|
public function getnextmvt() |
|
125
|
|
|
{ |
|
126
|
|
|
if ($this->movements->valid()) |
|
127
|
|
|
{ |
|
128
|
|
|
$movement = $this->movements->current(); |
|
129
|
|
|
/*@var $movement absences_Movement */ |
|
130
|
|
|
|
|
131
|
|
|
$this->altbg = !$this->altbg; |
|
132
|
|
|
|
|
133
|
|
|
$this->createdOn = bab_toHtml(bab_shortDate(bab_mktime($movement->createdOn), true)); |
|
|
|
|
|
|
134
|
|
|
$this->author = bab_toHtml(bab_getUserName($movement->id_author)); |
|
|
|
|
|
|
135
|
|
|
$this->comment = bab_toHtml($movement->comment); |
|
136
|
|
|
$this->message = bab_toHtml($movement->message); |
|
|
|
|
|
|
137
|
|
|
|
|
138
|
|
|
$this->movements->next(); |
|
139
|
|
|
return true; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
return false; |
|
143
|
|
|
} |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
|
|
147
|
|
|
|
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* Visualisation popup |
|
151
|
|
|
*/ |
|
152
|
|
|
class absences_vacationRequestDetail extends absences_requestDetail |
|
153
|
|
|
{ |
|
154
|
|
|
public $datebegintxt; |
|
155
|
|
|
public $datebegin; |
|
156
|
|
|
public $halfnamebegin; |
|
157
|
|
|
public $dateendtxt; |
|
158
|
|
|
public $dateend; |
|
159
|
|
|
public $halfnameend; |
|
160
|
|
|
public $nbdaystxt; |
|
161
|
|
|
public $typename; |
|
162
|
|
|
public $nbdays; |
|
163
|
|
|
public $totaltxt; |
|
164
|
|
|
public $totalval; |
|
165
|
|
|
|
|
166
|
|
|
|
|
167
|
|
|
public $arr = array(); |
|
168
|
|
|
public $count; |
|
169
|
|
|
public $res; |
|
170
|
|
|
public $veid; |
|
171
|
|
|
public $wusers = array(); |
|
172
|
|
|
|
|
173
|
|
|
public $approb; |
|
174
|
|
|
|
|
175
|
|
|
public $altbg = true; |
|
176
|
|
|
|
|
177
|
|
|
public function __construct($id, $withCardFrame = null) |
|
178
|
|
|
{ |
|
179
|
|
|
require_once dirname(__FILE__).'/agent.class.php'; |
|
180
|
|
|
require_once dirname(__FILE__).'/agent.ui.php'; |
|
181
|
|
|
require_once dirname(__FILE__).'/entry.class.php'; |
|
182
|
|
|
require_once $GLOBALS['babInstallPath'].'/utilit/urlincl.php'; |
|
183
|
|
|
|
|
184
|
|
|
|
|
185
|
|
|
$this->datebegintxt = absences_translate("Begin date"); |
|
186
|
|
|
$this->dateendtxt = absences_translate("End date"); |
|
187
|
|
|
$this->nbdaystxt = absences_translate("Quantities"); |
|
188
|
|
|
$this->totaltxt = absences_translate("Total"); |
|
189
|
|
|
$this->t_approb = absences_translate("Approver"); |
|
|
|
|
|
|
190
|
|
|
$this->t_folder = absences_translate('Others dates in the same recurring request:'); |
|
|
|
|
|
|
191
|
|
|
$this->t_createdby = absences_translate("Created by"); |
|
|
|
|
|
|
192
|
|
|
|
|
193
|
|
|
|
|
194
|
|
|
$entry = absences_Entry::getById($id); |
|
195
|
|
|
|
|
196
|
|
|
if (!$entry->getRow()) { |
|
197
|
|
|
throw new Exception(absences_translate('This entry does not exists')); |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
parent::__construct($entry, $withCardFrame); |
|
201
|
|
|
|
|
202
|
|
|
|
|
203
|
|
|
switch($entry->creation_type) |
|
204
|
|
|
{ |
|
205
|
|
|
case absences_Entry::CREATION_FIXED: |
|
206
|
|
|
$this->info = absences_translate('This request has been automatically created with a fixed vacation right'); |
|
|
|
|
|
|
207
|
|
|
break; |
|
208
|
|
|
|
|
209
|
|
|
default: |
|
210
|
|
|
case absences_Entry::CREATION_USER: |
|
|
|
|
|
|
211
|
|
|
$this->info = false; |
|
212
|
|
|
break; |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
View Code Duplication |
if ($entry->createdby == $entry->id_user) |
|
|
|
|
|
|
216
|
|
|
{ |
|
217
|
|
|
$this->createdby = false; |
|
|
|
|
|
|
218
|
|
|
} elseif($entry->createdby) { |
|
|
|
|
|
|
219
|
|
|
$this->createdby = bab_toHtml(bab_getUserName($entry->createdby)); |
|
|
|
|
|
|
220
|
|
|
} else { |
|
221
|
|
|
$this->createdby = false; |
|
|
|
|
|
|
222
|
|
|
} |
|
223
|
|
|
|
|
224
|
|
|
$this->datebegin = bab_toHtml(absences_longDate(bab_mktime($entry->date_begin))); |
|
225
|
|
|
$this->dateend = bab_toHtml(absences_longDate(bab_mktime($entry->date_end))); |
|
226
|
|
|
|
|
227
|
|
|
$this->approb = ''; |
|
228
|
|
|
if ($entry->id_approver > 0) { |
|
229
|
|
|
$this->approb = bab_toHtml(bab_getUserName($entry->id_approver)); |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
$this->res = $entry->getElementsIterator(); |
|
233
|
|
|
$this->res->rewind(); |
|
234
|
|
|
|
|
235
|
|
|
$this->totalval = absences_vacEntryQuantity($id); |
|
236
|
|
|
$this->veid = $id; |
|
237
|
|
|
|
|
238
|
|
|
if ($this->folder = $entry->getFolderEntriesIterator()) |
|
|
|
|
|
|
239
|
|
|
{ |
|
240
|
|
|
$this->folder->rewind(); |
|
|
|
|
|
|
241
|
|
|
} |
|
242
|
|
|
} |
|
243
|
|
|
|
|
244
|
|
|
|
|
245
|
|
|
|
|
246
|
|
|
|
|
247
|
|
|
public function getnexttype() |
|
248
|
|
|
{ |
|
249
|
|
|
|
|
250
|
|
|
if( $this->res->valid()) |
|
251
|
|
|
{ |
|
252
|
|
|
$this->altbg = !$this->altbg; |
|
253
|
|
|
|
|
254
|
|
|
$elem = $this->res->current(); |
|
255
|
|
|
/*@var $elem absences_EntryElem */ |
|
256
|
|
|
$right = $elem->getRight(); |
|
257
|
|
|
$type = $right->getType(); |
|
258
|
|
|
$rgroup = $right->getRgroup(); |
|
259
|
|
|
|
|
260
|
|
|
if ($rgroup && $rgroup->getRow()) |
|
261
|
|
|
{ |
|
262
|
|
|
$this->rgroup_name = $rgroup->name; |
|
|
|
|
|
|
263
|
|
|
} else { |
|
264
|
|
|
$this->rgroup_name = ''; |
|
265
|
|
|
} |
|
266
|
|
|
|
|
267
|
|
|
$this->typename = bab_toHtml($type->name); |
|
268
|
|
|
$this->typecolor = bab_toHtml($type->color); |
|
|
|
|
|
|
269
|
|
|
|
|
270
|
|
|
$this->period = bab_toHtml(absences_DateTimePeriod($elem->date_begin, $elem->date_end)); |
|
|
|
|
|
|
271
|
|
|
$this->rightname = bab_toHtml($right->description); |
|
|
|
|
|
|
272
|
|
|
$this->nbdays = bab_toHtml(absences_quantity($elem->quantity, $right->quantity_unit)); |
|
273
|
|
|
$this->res->next(); |
|
274
|
|
|
return true; |
|
275
|
|
|
} |
|
276
|
|
|
|
|
277
|
|
|
return false; |
|
278
|
|
|
|
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
|
|
282
|
|
|
public function getnextfe() |
|
283
|
|
|
{ |
|
284
|
|
|
|
|
285
|
|
|
if ($this->folder->valid()) |
|
|
|
|
|
|
286
|
|
|
{ |
|
287
|
|
|
$entry = $this->folder->current(); |
|
|
|
|
|
|
288
|
|
|
/*@var $entry absences_Entry */ |
|
289
|
|
|
$this->date = bab_toHtml(bab_shortDate(bab_mktime($entry->date_begin), false)); |
|
|
|
|
|
|
290
|
|
|
|
|
291
|
|
|
$url = bab_url::get_request_gp(); |
|
292
|
|
|
$url->id = $entry->id; |
|
293
|
|
|
$this->url = bab_toHtml($url->toString()); |
|
|
|
|
|
|
294
|
|
|
$this->folder->next(); |
|
|
|
|
|
|
295
|
|
|
return true; |
|
296
|
|
|
} |
|
297
|
|
|
|
|
298
|
|
|
return false; |
|
299
|
|
|
} |
|
300
|
|
|
|
|
301
|
|
|
|
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
|
|
305
|
|
|
|
|
306
|
|
|
|
|
307
|
|
|
|
|
308
|
|
|
|
|
309
|
|
|
class absences_CetDepositRequestDetail extends absences_requestDetail |
|
310
|
|
|
{ |
|
311
|
|
|
public function __construct($id) |
|
312
|
|
|
{ |
|
313
|
|
|
require_once dirname(__FILE__).'/cet_deposit_request.class.php'; |
|
314
|
|
|
$request = absences_CetDepositRequest::getById($id); |
|
315
|
|
|
|
|
316
|
|
|
parent::__construct($request); |
|
317
|
|
|
|
|
318
|
|
|
|
|
319
|
|
|
$this->t_rightsource = absences_translate('Right source'); |
|
|
|
|
|
|
320
|
|
|
$this->t_quantity = absences_translate('Quantity'); |
|
|
|
|
|
|
321
|
|
|
|
|
322
|
|
|
|
|
323
|
|
|
$source = $request->getAgentRightSource()->getRight(); |
|
324
|
|
|
|
|
325
|
|
|
$this->rightsource = bab_toHtml($source->description); |
|
|
|
|
|
|
326
|
|
|
$this->quantity = bab_toHtml(absences_quantity($request->quantity, $source->quantity_unit)); |
|
|
|
|
|
|
327
|
|
|
} |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
|
|
|
|
331
|
|
|
|
|
332
|
|
|
|
|
333
|
|
|
|
|
334
|
|
|
|
|
335
|
|
|
class absences_WpRecoveryDetail extends absences_requestDetail |
|
336
|
|
|
{ |
|
337
|
|
|
public function __construct($id) |
|
338
|
|
|
{ |
|
339
|
|
|
require_once dirname(__FILE__).'/workperiod_recover_request.class.php'; |
|
340
|
|
|
$request = absences_WorkperiodRecoverRequest::getById($id); |
|
341
|
|
|
|
|
342
|
|
|
parent::__construct($request); |
|
343
|
|
|
|
|
344
|
|
|
|
|
345
|
|
|
$this->t_period = absences_translate('Worked period'); |
|
|
|
|
|
|
346
|
|
|
$this->period = absences_DateTimePeriod($request->date_begin, $request->date_end); |
|
|
|
|
|
|
347
|
|
|
|
|
348
|
|
|
$this->t_type = absences_translate('Type'); |
|
|
|
|
|
|
349
|
|
|
$this->type = $request->getType()->name; |
|
|
|
|
|
|
350
|
|
|
|
|
351
|
|
|
|
|
352
|
|
|
$this->t_quantity = absences_translate('Quantity'); |
|
|
|
|
|
|
353
|
|
|
$this->quantity = bab_toHtml(absences_quantity($request->quantity, $request->quantity_unit)); |
|
|
|
|
|
|
354
|
|
|
} |
|
355
|
|
|
} |
|
356
|
|
|
|
|
357
|
|
|
|
|
358
|
|
|
|
|
359
|
|
|
|
|
360
|
|
|
/** |
|
361
|
|
|
* Display a vacation request |
|
362
|
|
|
* @param int $id |
|
363
|
|
|
* |
|
364
|
|
|
*/ |
|
365
|
|
|
function absences_viewVacationRequestDetail($id, $withCardFrame = null) { |
|
366
|
|
|
global $babBody; |
|
367
|
|
|
/*@var $babBody babBody */ |
|
368
|
|
|
|
|
369
|
|
|
try { |
|
370
|
|
|
$temp = new absences_vacationRequestDetail($id, $withCardFrame); |
|
371
|
|
|
$babBody->setTitle(absences_translate('Vacation request')); |
|
372
|
|
|
$html = bab_printTemplate($temp, absences_addon()->getRelativePath()."request.html", "ventrydetail"); |
|
|
|
|
|
|
373
|
|
|
|
|
374
|
|
|
if (bab_rp('popup')) { |
|
375
|
|
|
$babBody->menu = new babMenu(); // remove menu |
|
376
|
|
|
$babBody->babPopup($html); |
|
377
|
|
|
} else { |
|
378
|
|
|
$babBody->babEcho($html); |
|
379
|
|
|
} |
|
380
|
|
|
|
|
381
|
|
|
return $temp->count; |
|
382
|
|
|
|
|
383
|
|
|
} catch(Exception $e) { |
|
384
|
|
|
$babBody->addError($e->getMessage()); |
|
385
|
|
|
} |
|
386
|
|
|
|
|
387
|
|
|
|
|
388
|
|
|
|
|
389
|
|
|
|
|
390
|
|
|
} |
|
391
|
|
|
|
|
392
|
|
|
|
|
393
|
|
|
|
|
394
|
|
View Code Duplication |
function absences_viewCetDepositDetail($id) { |
|
|
|
|
|
|
395
|
|
|
global $babBody; |
|
396
|
|
|
$temp = new absences_CetDepositRequestDetail($id); |
|
397
|
|
|
$babBody->setTitle(absences_translate('Time saving account deposit request')); |
|
398
|
|
|
$babBody->babEcho(bab_printTemplate($temp, absences_addon()->getRelativePath()."request.html", "cetdeposit")); |
|
|
|
|
|
|
399
|
|
|
} |
|
400
|
|
|
|
|
401
|
|
View Code Duplication |
function absences_viewWpRecoveryDetail($id) { |
|
|
|
|
|
|
402
|
|
|
global $babBody; |
|
403
|
|
|
$temp = new absences_WpRecoveryDetail($id); |
|
404
|
|
|
$babBody->setTitle(absences_translate('Working day recovery request')); |
|
405
|
|
|
$babBody->babEcho(bab_printTemplate($temp, absences_addon()->getRelativePath()."request.html", "wprecovery")); |
|
|
|
|
|
|
406
|
|
|
} |
|
407
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: