Completed
Push — master ( 520222...50fc26 )
by Paul
03:23
created

absences_PersonalOptionsEditor::addFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 7

Duplication

Lines 14
Ratio 100 %
Metric Value
dl 14
loc 14
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
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__).'/base.ui.php';
26
bab_Widgets()->includePhpClass('Widget_Form');
27
28
29
class absences_AgentCardFrame extends absences_CardFrame
30
{
31
	protected $agent;
32
	
33
	public function __construct(absences_Agent $agent, $layout = null)
34
	{
35
		parent::__construct(null, $layout);
36
		
37
		$this->agent = $agent;
38
		
39
		$this->loadPage();
40
	}
41
	
42
	protected function initClasses()
43
	{
44
		$this->addClass('absences-agent-cardframe');
45
		$this->addClass(Func_Icons::ICON_LEFT_16);
46
	}
47
	
48
	protected function loadPage()
49
	{
50
		$this->initClasses();
51
		
52
		$W = bab_Widgets();
53
		$cols = $W->HBoxItems(
54
			$col1 = $W->VBoxLayout(), // photo
55
			$W->Items(
56
				$W->Title($this->agent->getName(),3),
57
				$W->HBoxItems(
58
					$col2 = $W->VBoxLayout()->setVerticalSpacing(.2,'em'), 	// nom, regime, fonction, service
59
					$col3 = $W->VBoxLayout()->setVerticalSpacing(.2,'em')	// positions dans l'organigramme / responsable hierarchique
60
				)->setHorizontalSpacing(3,'em')
61
			)
62
		)->setHorizontalSpacing(1,'em');
63
		
64
		$this->addItem($cols);
65
		
66
		if ($photo = $this->getPhoto())
67
		{
68
			$col1->addItem($photo);
69
		}
70
		
71
		
72
		if ($nickname = $this->getNickname())
73
		{
74
			$col2->addItem($nickname);
75
		}
76
		
77
		if ($disabled = $this->getDisabled())
78
		{
79
			$col2->addItem($disabled);
80
		}
81
		
82
		if ($email = $this->getEmail())
83
		{
84
			$col2->addItem($email);
85
		}
86
		
87
		if ($btel = $this->getDirField('btel'))
88
		{
89
			$col2->addItem($btel);
90
		}
91
		
92
		$this->addPersonnelInfos($col2);
93
		
94
		
95
		if ($direntry = $this->getDirEntry())
96
		{
97
			$col3->addItem($direntry);
98
		}
99
		
100
		if ($planning = $this->getPlanning())
101
		{
102
			$col3->addItem($planning);
103
		}
104
		
105
		/*
106
		if ($workinghours = $this->getWorkingHours())
107
		{
108
			$col3->addItem($workinghours);
109
		}
110
		*/
111
		
112
		$superior = absences_Agent::getCurrentUser()->isSuperiorOf($this->agent);
113
		
114
		
115
		if (absences_Agent::getCurrentUser()->isManager())
116
		{
117
            if ('rights' !== bab_rp('idx'))
118
            {
119
		        $col3->addItem($W->Link($W->Icon(absences_translate('Rights'), Func_Icons::APPS_VACATIONS), 
120
		            absences_addon()->getUrl().'vacadm&idx=rights&idu='.$this->agent->getIdUser())->setOpenMode(Widget_Link::OPEN_POPUP)
121
		        );
122
            }
123
		    $col3->addItem($W->Link($W->Icon(absences_translate('Export'), Func_Icons::MIMETYPES_OFFICE_SPREADSHEET), absences_addon()->getUrl().'vacadm&idx=export&id_user='.$this->agent->getIdUser()));
124
		
125
		} 
126
		else if ($superior && absences_getVacationOption('chart_superiors_set_rights'))
127
		{
128
		    $entity = $this->agent->getMainEntity();
129
		    $col3->addItem($W->Link($W->Icon(absences_translate('Rights'), Func_Icons::APPS_VACATIONS), 
130
		        absences_addon()->getUrl().'vacchart&idx=rights&idu='.$this->agent->getIdUser().'&ide='.$entity['id'].'&popup=1')->setOpenMode(Widget_Link::OPEN_POPUP)
131
		    );
132
		} 
133
		else if ($superior)
134
		{
135
		    $col3->addItem($W->Link($W->Icon(absences_translate('Balance'), Func_Icons::APPS_VACATIONS),
136
		            absences_addon()->getUrl().'vacuser&idx=viewrights&id_user='.$this->agent->getIdUser().'&popup=1')->setOpenMode(Widget_Link::OPEN_POPUP)
137
		    );
138
		}
139
		
140
		
141
		
142
		if ($superior = $this->agent->getSuperior())
143
		{
144
			//TRANSLATORS: Supervisor in organizational chart
145
			$col2->addItem($this->titledLabel(absences_translate('Supervisor'), $superior['name'][0]));
146
		}
147
		
148
		
149
		if ($organization = $this->agent->getOrganization())
150
		{
151
		    $col2->addItem($this->titledLabel(absences_translate('Organization'), $organization->name));
152
		}
153
		
154
		
155
		if ($entity = $this->agent->getMainEntity())
156
		{
157
			if (absences_Agent::getCurrentUser()->canViewEntityPlanning($entity['id']))
158
			{
159
			
160
				$col2->addItem(
161
					$W->FlowItems(
162
						$W->Label(absences_translate('Position'))->addClass('widget-strong')->colon(),
163
						$W->Items(
164
								$W->Label($entity['name']), 
165
								$W->Label(' ('),
166
								$W->Link(absences_translate('planning'), absences_addon()->getUrl().'planning&idx=entity_cal&popup=1&ide='.$entity['id'])->setOpenMode(Widget_Link::OPEN_POPUP),
167
								$W->Label(')')
168
						)
169
					)->addClass('widget-small')->setSpacing(.2,'em', .3,'em')
170
				);
171
			
172
			
173
			} else {
174
				
175
				$col2->addItem($this->titledLabel(absences_translate('Position'), $entity['name']));
176
			}
177
			
178
			
179
			//TRANSLATORS: Main role in organizational chart entity
180
			$col2->addItem($this->titledLabel(absences_translate('Role'), $entity['role_name']));
181
		}
182
		
183
		
184
		if (!$superior && !$entity)
185
		{
186
			// no organizational chart, replace with directory fields
187
			
188
			if ($departmentnumber = $this->getDirField('departmentnumber'))
189
			{
190
				$col2->addItem($departmentnumber);
191
			}
192
		}
193
194
	}
195
	
196
	
197
	/**
198
	 * 
199
	 */
200
	protected function addPersonnelInfos($col2)
201
	{
202
		if ($approbation = $this->agent->getApprobation())
203
		{
204
			$col2->addItem($this->titledLabel(absences_translate('Approbation'), $approbation['name'].sprintf(' (%s)', $approbation['type'])));
205
		}
206
		
207
		if ($collection = $this->agent->getCollection())
208
		{
209
			$col2->addItem($this->titledLabel(absences_translate('Collection'), $collection->name));
210
		}
211
	}
212
	
213
	
214
	
215
	protected function getPhoto()
216
	{
217
		if ($photo = $this->agent->getPhoto())
218
		{
219
			$W = bab_Widgets();
220
			return $W->Image($photo, $this->agent->getName());
221
		}
222
		
223
		return null;
224
	}
225
	
226
	/**
227
	 * 
228
	 * @param string $fieldname
229
	 */
230
	protected function getDirField($fieldname)
231
	{
232
		$direntry = $this->agent->getDirEntry();
233
		
234
		if (!isset($direntry[$fieldname]))
235
		{
236
			return null;
237
		}
238
		
239
		if (empty($direntry[$fieldname]['value']))
240
		{
241
			return null;
242
		}
243
		
244
		return $this->titledLabel(
245
			$direntry[$fieldname]['name'], 
246
			$direntry[$fieldname]['value']
247
		);
248
	}
249
	
250
251
	protected function getNickname()
252
	{
253
		return $this->titledLabel(
254
				absences_translate('Login ID'),
255
				bab_getUserNickname($this->agent->id_user)
256
		);
257
	}
258
	
259
	
260
	
261
	protected function getDisabled()
262
	{
263
		require_once $GLOBALS['babInstallPath'].'utilit/userinfosincl.php';
264
		
265
		if (bab_userInfos::isValid($this->agent->getIdUser()))
266
		{
267
			return null;
268
		}
269
		
270
		bab_functionality::includeOriginal('Icons');
271
		$W = bab_Widgets();
272
		return $W->Icon(absences_translate('This account is disabled'), Func_Icons::STATUS_DIALOG_WARNING);
273
	}
274
	
275
	
276
	/**
277
	 *
278
	 *
279
	 */
280
	protected function getEmail()
281
	{
282
		$W = bab_Widgets();
283
		$direntry = $this->agent->getDirEntry();
284
	
285
		if (!isset($direntry['email']))
286
		{
287
			return null;
288
		}
289
	
290
		if (empty($direntry['email']['value']))
291
		{
292
			return null;
293
		}
294
		
295
		return $W->FlowItems(
296
				$W->Label($direntry['email']['name'])->addClass('widget-strong')->colon(),
297
				$W->Link($direntry['email']['value'], 'mailto:'.$direntry['email']['value'])
298
		)->addClass('widget-small')->setSpacing(.2,'em', .3,'em');
299
	}
300
	
301
	
302
303
	
304
	
305
	
306
	protected function getDirEntry()
307
	{
308
		$W = bab_Widgets();
309
		$link = bab_getUserDirEntryLink($this->agent->id_user, BAB_DIR_ENTRY_ID_USER);
0 ignored issues
show
Documentation introduced by
$this->agent->id_user is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
310
	
311
		if (!$link)
312
		{
313
			return null;
314
		}
315
	
316
		return $W->Link($W->Icon(absences_translate('View directory entry'), Func_Icons::OBJECTS_CONTACT), $link)->setOpenMode(Widget_Link::OPEN_POPUP);
317
	}
318
	
319
	
320
	
321
	
322
	protected function getPlanning()
323
	{
324
		$W = bab_Widgets();
325
		
326
		$addon = bab_getAddonInfosInstance('absences');
327
		
328
		return $W->Link($W->Icon(absences_translate('View planning'), Func_Icons::APPS_CALENDAR), $addon->getUrl().'planning&idx=cal&popup=1&idu='.$this->agent->id_user)->setOpenMode(Widget_Link::OPEN_POPUP);
329
	}
330
	
331
	
332
	
333
	protected function getWorkingHours()
334
	{
335
		$W = bab_Widgets();
336
		
337
		$func = bab_functionality::get('WorkingHours');
338
		
339
		if (false === $func)
340
		{
341
			return null;
342
		}
343
		
344
		$url = $func->getUserSettingsPopupUrl($this->agent->getIdUser());
345
		
346
		if (null === $url)
347
		{
348
			return null;
349
		}
350
		
351
		return $W->Link($W->Icon(absences_translate('Working hours'), Func_Icons::APPS_CALENDAR), $url)->setOpenMode(Widget_Link::OPEN_POPUP);
352
	}
353
}
354
355
356
357
class absences_AgentFullFrame extends absences_AgentCardFrame
358
{
359
	/**
360
	 *
361
	 */
362
	protected function addPersonnelInfos($col2)
363
	{
364
		// do not display personnel info because exists in edit form
365
		// show link to directory entry instead 
366
	}
367
	
368
	
369
	protected function initClasses()
370
	{
371
		$this->addClass('absences-agent-fullframe');
372
		$this->addClass(Func_Icons::ICON_LEFT_16);
373
	}
374
375
}
376
377
378
379
380
381
382
383
class absences_AgentMovementList extends absences_Paginate 
384
{
385
	const MAX = 20;
386
	
387
	public $altbg = true;
388
	
389
	public $t_date;
390
	public $date;
391
	
392
	public $t_author;
393
	public $author;
394
	
395
	public $t_message;
396
	public $message;
397
	
398
	public $t_comment;
399
	public $comment;
400
	
401
	private $res;
402
	
403
	public function __construct(absences_Agent $agent)
404
	{
405
		$this->t_date = absences_translate('Date');
406
		$this->t_author = absences_translate('Author');
407
		$this->t_request = absences_translate('Object');
0 ignored issues
show
Bug introduced by
The property t_request does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
408
		$this->t_message = absences_translate('Message');
409
		$this->t_comment = absences_translate('Regularization or approval comment by the author');
410
		
411
		
412
		$this->res = $agent->getMovementIterator();
413
		$this->res->rewind();
414
		
415
		$this->paginate($this->res->count(), self::MAX);
416
		$this->res->seek($this->pos);
417
		
418
		bab_functionality::includeOriginal('Icons');
419
	}
420
	
421 View Code Duplication
	public function getnext()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
422
	{
423
		if (($this->res->key() - $this->pos) >= self::MAX)
424
		{
425
			return false;
426
		}
427
		
428
		if ($this->res->valid())
429
		{
430
			$W = bab_Widgets();
431
			$movement = $this->res->current();
432
			/*@var $movement absences_Movement */
433
			
434
			$this->altbg = !$this->altbg;
435
		
436
			$this->author = bab_toHtml(bab_getUserName($movement->id_author));
437
			$this->date = bab_toHtml(bab_shortDate(bab_mktime($movement->createdOn)));
438
			if ($request = $movement->getRequest())
439
			{
440
				$this->request = $request->getManagerFrame()->addClass(Func_Icons::ICON_LEFT_16)->display($W->HtmlCanvas());
0 ignored issues
show
Bug introduced by
The property request does not seem to exist. Did you mean t_request?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
441
			} else {
442
				$this->request = '';
0 ignored issues
show
Bug introduced by
The property request does not seem to exist. Did you mean t_request?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
443
			}
444
			$this->message = bab_toHtml($movement->message);
445
			$this->comment = bab_toHtml($movement->comment);
446
			
447
			$this->res->next();
448
			return true;
449
		}
450
		
451
		return false;
452
	}
453
	
454 View Code Duplication
	public function getHtml()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
455
	{
456
		$babBody = bab_getInstance('babBody');
457
		
458
		if ($this->res->count() === 0)
459
		{
460
			$babBody->addError(absences_translate('There are no records yet for this user'));
461
			return '';
462
		}
463
		
464
		return bab_printTemplate($this, absences_addon()->getRelativePath()."agent.html", "movement");
0 ignored issues
show
Deprecated Code introduced by
The method bab_addonInfos::getRelativePath() has been deprecated with message: Do not use relative path in addons Addons are subject to move out of the core folder in futures version for bab_printTemplate, replace with $addon->printTemplate() for babBody->addStyleSheet use $addon->getStylePath() instead of relative path the addStyleSheet method support full path starting with vendor/ since the 8.1.98 version

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
465
	}
466
}
467
468
469
470
471
472
473
474
475
476
477
478
479
class absences_AgentRightsList
480
{
481
	public $nametxt;
482
	public $urlname;
483
	public $url;
484
	public $descriptiontxt;
485
	public $description;
486
	public $consumedtxt;
487
	public $consumed;
488
	public $fullname;
489
	public $titletxt;
490
491
	public $arr = array();
492
	public $babDB;
493
	private $res;
494
495
	public $iduser;
496
	public $idcoll;
497
	public $bview;
498
499
	public $updatetxt;
500
	public $invalidentry;
501
	public $invalidentry1;
502
	public $invalidentry2;
503
504
	public function __construct($id)
505
	{
506
		global $babDB;
507
		$this->iduser = $id;
508
		$this->idu = $id;
0 ignored issues
show
Bug introduced by
The property idu does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
509
		$this->ide = bab_rp('ide');
0 ignored issues
show
Bug introduced by
The property ide does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
510
		$this->updatetxt = absences_translate("Update");
511
		$this->desctxt = absences_translate("Description");
0 ignored issues
show
Bug introduced by
The property desctxt does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
512
		$this->typetxt = absences_translate("Type");
0 ignored issues
show
Bug introduced by
The property typetxt does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
513
		$this->consumedtxt = absences_translate("Consumed");
514
		$this->waitingtxt = absences_translate("Waiting");
0 ignored issues
show
Bug introduced by
The property waitingtxt does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
515
		$this->datebtxt = absences_translate("Begin date");
0 ignored issues
show
Bug introduced by
The property datebtxt does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
516
		$this->dateetxt = absences_translate("End date");
0 ignored issues
show
Bug introduced by
The property dateetxt does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
517
		$this->quantitytxt = absences_translate("Rights");
0 ignored issues
show
Bug introduced by
The property quantitytxt does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
518
		$this->balancetxt = absences_translate("Balance");
0 ignored issues
show
Bug introduced by
The property balancetxt does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
519
		$this->previsionaltxt = absences_translate("Previsional");
0 ignored issues
show
Bug introduced by
The property previsionaltxt does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
520
		$this->previsionalbalancetxt = absences_translate("Previ. Bal.");
0 ignored issues
show
Bug introduced by
The property previsionalbalancetxt does not seem to exist. Did you mean balancetxt?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
521
		$this->datetxt = absences_translate("Entry date");
0 ignored issues
show
Bug introduced by
The property datetxt does not seem to exist. Did you mean updatetxt?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
522
		$this->invalidentry = bab_toHtml(absences_translate("Invalid entry!  Only numbers are accepted or . !"), BAB_HTML_JS);
523
		$this->invalidentry1 = absences_translate("Invalid entry");
524
		$this->invalidentry2 = absences_translate("Days must be multiple of 0.5");
525
		$this->t_comment = absences_translate("Comment on quantities modification for user history:");
0 ignored issues
show
Bug introduced by
The property t_comment does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
526
		$GLOBALS['babBody']->title = absences_translate("Vacation rights of:").' '.bab_getUserName($id);
527
528
		$infos = bab_getUserInfos($id);
529
		$this->currentUserLastname = $infos['sn'];
0 ignored issues
show
Bug introduced by
The property currentUserLastname does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
530
		$this->currentUserFirstname = $infos['givenname'];
0 ignored issues
show
Bug introduced by
The property currentUserFirstname does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
531
532
		$this->tg = bab_rp('tg');
0 ignored issues
show
Bug introduced by
The property tg does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
533
534
		require_once dirname(__FILE__).'/agent.class.php';
535
		require_once dirname(__FILE__).'/agent.ui.php';
536
		$agent = absences_Agent::getFromIdUser($id);
537
		$cardframe = new absences_AgentCardFrame($agent);
538
		$this->header = $cardframe->display(bab_Widgets()->HtmlCanvas());
0 ignored issues
show
Bug introduced by
The property header does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
539
540
		$this->res = $agent->getAgentRightManagerIterator();
541
		$this->res->rewind();
542
543
		$this->not_in_collection = sprintf(absences_translate('This right is not in collection %s'), $agent->getCollection()->name);
0 ignored issues
show
Bug introduced by
The property not_in_collection does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
544
545
		$this->agentRight = (absences_Agent::getCurrentUser()->isManager() && !bab_rp('ide'));
0 ignored issues
show
Bug introduced by
The property agentRight does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
546
	}
547
548
	public function getnextright(&$ignore)
0 ignored issues
show
Unused Code introduced by
The parameter $ignore is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
549
	{
550
		static $y = '';
551
		static $label = '';
552
553
		if( $this->res->valid())
554
		{
555
556
			$agentRight = $this->res->current();
557
			/*@var $agentRight absences_AgentRight */
558
			$right = $agentRight->getRight();
559
560
			$right->monthlyQuantityUpdate();
561
			
562
			$type = $right->getType();
563
564
			$this->res->next();
565
566
567
			$this->idright = $right->id;
0 ignored issues
show
Bug introduced by
The property idright does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
568
			$this->description = bab_toHtml($right->description);
569
			$this->type = bab_toHtml($type->name);
0 ignored issues
show
Bug introduced by
The property type does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
570
			$this->color = bab_toHtml($type->color);
0 ignored issues
show
Bug introduced by
The property color does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
571
			$this->quantity = absences_editQuantity($agentRight->getQuantity(), $right->quantity_unit);
0 ignored issues
show
Bug introduced by
The property quantity does not seem to exist. Did you mean quantitytxt?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
572
			
573
			$this->unit = bab_toHtml($right->getUnitLabel());
0 ignored issues
show
Bug introduced by
The property unit does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
574
			
575
			$this->dynamic_quantity = null;
0 ignored issues
show
Bug introduced by
The property dynamic_quantity does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
576
			$dyn = $agentRight->getDynamicQuantity();
577 View Code Duplication
			if (abs($dyn) > 0.01) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
578
			    $this->dynamic_quantity = bab_toHtml(
579
			        sprintf(
580
			            absences_translate(
581
			                'The quantity include %s because of the balance modification according to the consumed amount rule',
582
			                'The quantity include %s because of the balance modification according to the consumed amount rule',
583
			                $dyn
584
			            ),
585
			            absences_quantity($dyn, $right->quantity_unit)
586
	               )
587
	            );
588
			}
589
			
590
			
591
			$this->increment_quantity = null;
0 ignored issues
show
Bug introduced by
The property increment_quantity does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
592
			$dyn = $agentRight->getIncrementQuantity();
593 View Code Duplication
			if (abs($dyn) > 0.01) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
594
			    $this->increment_quantity = bab_toHtml(
595
			            sprintf(
596
			                    absences_translate(
597
			                        'The quantity include %s because of the monthly modifications',
598
			                        'The quantity include %s because of the monthly modifications',
599
			                        $dyn
600
			                    ),
601
			                    absences_quantity($dyn, $right->quantity_unit)
602
			            )
603
			    );
604
			}
605
			
606
			$this->disp_quantity = absences_quantity($agentRight->getQuantity(), $right->quantity_unit);
0 ignored issues
show
Bug introduced by
The property disp_quantity does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
607
608
			if ($message = $agentRight->getQuantityAlert())
609
			{
610
				$this->alert = bab_toHtml($message);
0 ignored issues
show
Bug introduced by
The property alert does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
611
			} else {
612
				$this->alert = null;
613
			}
614
615
616
			if ($right->getYear() !== $y)
617
			{
618
				$this->year = null === $right->getYear() ? absences_translate('No theoretical period') : $right->getYear();
0 ignored issues
show
Bug introduced by
The property year does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
619
			} else {
620
				$this->year = '';
621
			}
622
			$y = $right->getYear();
623
624
			$rgrouplabel = $right->getRgroupLabel();
625
			$this->rgroup = $rgrouplabel !== $label && !empty($rgrouplabel) ? $rgrouplabel : '';
0 ignored issues
show
Bug introduced by
The property rgroup does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
626
			$label = $rgrouplabel;
627
628
			$this->in_rgroup = null !== $right->getRgroup();
0 ignored issues
show
Bug introduced by
The property in_rgroup does not seem to exist. Did you mean rgroup?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
629
630
			$this->dateb = bab_shortDate(bab_mktime($right->date_begin), false);
0 ignored issues
show
Bug introduced by
The property dateb does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
631
			$this->datee = bab_shortDate(bab_mktime($right->date_end), false);
0 ignored issues
show
Bug introduced by
The property datee does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
632
633
			$this->consumed = absences_quantity($agentRight->getConfirmedQuantity(), $right->quantity_unit);
634
			$this->waiting = absences_quantity($agentRight->getWaitingQuantity(), $right->quantity_unit);
0 ignored issues
show
Bug introduced by
The property waiting does not seem to exist. Did you mean waitingtxt?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
635
			$this->previsional = absences_quantity($agentRight->getPrevisionalQuantity(), $right->quantity_unit);
0 ignored issues
show
Bug introduced by
The property previsional does not seem to exist. Did you mean previsionaltxt?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
636
637
			$balance = $agentRight->getQuantity()-$agentRight->getWaitingQuantity()-$agentRight->getConfirmedQuantity();
638
			$this->balance = absences_quantity($balance, $right->quantity_unit);
0 ignored issues
show
Bug introduced by
The property balance does not seem to exist. Did you mean balancetxt?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
639
			$this->previsional_balance = absences_quantity($balance - $agentRight->getPrevisionalQuantity(), $right->quantity_unit);
0 ignored issues
show
Bug introduced by
The property previsional_balance does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
640
641
			$this->readonly = ($right->getKind() === absences_Right::FIXED);
0 ignored issues
show
Bug introduced by
The property readonly does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
642
			$this->agent_right_url = bab_toHtml(absences_addon()->getUrl().'vacadm&idx=agentright&ar='.$agentRight->id);
0 ignored issues
show
Bug introduced by
The property agent_right_url does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
643
			$this->in_collection = $agentRight->isRightInAgentCollection();
0 ignored issues
show
Bug introduced by
The property in_collection does not seem to exist. Did you mean not_in_collection?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
644
645
			return true;
646
		}
647
		else
648
			return false;
649
650
	}
651
652
653
654
655
656
	/**
657
	 * get previous or next user in manager list
658
	 * @param	string	$sign
659
	 * @param	string	$sqlOrderType
660
	 * @return 	int|false
661
	 */
662
	private function getUserInManagerList($sign, $sqlOrderType) {
663
664
665
		global $babDB;
666
667
668
		$ide = bab_rp('ide');
669
670
		// delegation administration list
671
		if ($ide && absences_isAccessibleEntityAsSuperior($ide)) {
672
673
674
			$users = bab_OCGetCollaborators($ide);
675
			$superior = bab_OCGetSuperior($ide);
676
677
			if (((int)$superior['id_user']) !== (int)$GLOBALS['BAB_SESS_USERID'] && false === absences_isAccessibleEntityAsCoManager($ide)) {
678
				$users[] = $superior;
679
			}
680
681
682
			$ordering = array();
683
			foreach($users as $key => $user) {
684
				$ordering[$key] = $user['lastname'].' '.$user['firstname'];
685
			}
686
687
			bab_sort::natcasesort($ordering);
688
689
690
			$previous = false;
691
			$next = false;
692
693
			$next_prev_index = array();
694
695
			foreach($ordering as $key => $dummy) {
696
697
				if (false !== $previous) {
698
					$next_prev_index[$previous]['next'] = $users[$key]['id_user'];
699
				}
700
701
				$next_prev_index[$users[$key]['id_user']] = array(
702
						'previous' => $previous,
703
						'next' => $next
704
				);
705
706
				$previous = $users[$key]['id_user'];
707
			}
708
709
			reset($ordering);
710
			$firstuser = $users[key($ordering)]['id_user'];
711
			next($ordering);
712
			$seconduser = $users[key($ordering)]['id_user'];
713
714
			$next_prev_index[$firstuser]['next'] = $seconduser;
715
716
717
718
			switch($sign) {
719
				case '<':
720
					return $next_prev_index[$this->iduser]['previous'];
721
722
				case '>':
723
					return $next_prev_index[$this->iduser]['next'];
724
			}
725
726
727
			return false;
728
		}
729
730
731
732
733
734
735
		// manager list
736
737
		$acclevel = absences_vacationsAccess();
738
		if( true === $acclevel['manager'])
739
		{
740
741
			$res = $babDB->db_query('
742
					SELECT
743
					p.id_user
744
					FROM
745
					'.ABSENCES_PERSONNEL_TBL.' p, '.BAB_USERS_TBL.' u
746
747
					WHERE
748
					u.id = p.id_user
749
					AND (u.lastname '.$sign.' '.$babDB->quote($this->currentUserLastname).'
750
					OR (u.lastname = '.$babDB->quote($this->currentUserLastname).'
751
					AND u.firstname '.$sign.' '.$babDB->quote($this->currentUserFirstname).')
752
			)
753
754
					ORDER BY u.lastname '.$sqlOrderType.', u.firstname '.$sqlOrderType.'
755
756
					LIMIT 0,2
757
					');
758
759
760
761
			if ($arr = $babDB->db_fetch_assoc($res)) {
762
				return (int) $arr['id_user'];
763
			}
764
765
		}
766
767
768
769
770
771
		return false;
772
	}
773
774
775
776
777 View Code Duplication
	public function previoususer() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
778
779
		static $i = 0;
780
781
		if (0 === $i) {
782
783
			$id_user = $this->getUserInManagerList('<','DESC');
784
			if (!$id_user) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $id_user of type integer|false is loosely compared to false; this is ambiguous if the integer can be zero. You might want to explicitly use === null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
785
				return false;
786
			}
787
788
			$this->previous = bab_toHtml(bab_getUserName($id_user));
0 ignored issues
show
Bug introduced by
The property previous does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
789
790
			require_once $GLOBALS['babInstallPath'] . 'utilit/urlincl.php';
791
			$url = bab_url::request_gp();
792
793
			if (bab_rp('idu')) {
794
				$url = bab_url::mod($url, 'idu', $id_user);
795
			}
796
797
			if (bab_rp('id_user')) {
798
				$url = bab_url::mod($url, 'id_user', $id_user);
799
			}
800
801
			$this->previousurl = bab_toHtml($url);
0 ignored issues
show
Bug introduced by
The property previousurl does not seem to exist. Did you mean previous?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
802
803
804
			$i++;
805
			return true;
806
		}
807
808
		return false;
809
	}
810
811 View Code Duplication
	public function nextuser() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
812
813
		static $i = 0;
814
815
		if (0 === $i) {
816
817
			$id_user = $this->getUserInManagerList('>','ASC');
818
			if (!$id_user) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $id_user of type integer|false is loosely compared to false; this is ambiguous if the integer can be zero. You might want to explicitly use === null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
819
				return false;
820
			}
821
822
			$this->next = bab_toHtml(bab_getUserName($id_user));
0 ignored issues
show
Bug introduced by
The property next does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
823
824
			require_once $GLOBALS['babInstallPath'] . 'utilit/urlincl.php';
825
			$url = bab_url::request_gp();
826
			if (bab_rp('idu')) {
827
				$url = bab_url::mod($url, 'idu', $id_user);
828
			}
829
830
			if (bab_rp('id_user')) {
831
				$url = bab_url::mod($url, 'id_user', $id_user);
832
			}
833
			$this->nexturl = bab_toHtml($url);
0 ignored issues
show
Bug introduced by
The property nexturl does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
834
835
836
			$i++;
837
			return true;
838
		}
839
840
		return false;
841
	}
842
843
}
844
845
846
847
848
849
850
851
852
853
854
class absences_PersonalOptionsEditor extends Widget_Form
855
{
856
857
	public function __construct()
858
	{
859
		$W = bab_Widgets();
860
861
		parent::__construct(null, $W->VBoxLayout()->setVerticalSpacing(1,'em'));
862
863
864
		$this->setName('options');
865
		$this->addClass('widget-bordered');
866
		$this->addClass('BabLoginMenuBackground');
867
		$this->addClass('widget-centered');
868
		$this->colon();
869
870
		$this->setCanvasOptions($this->Options()->width(70,'em'));
871
872
		$this->addFields();
873
		$this->loadFormValues();
874
875
		$this->addButtons();
876
		$this->setSelfPageHiddenFields();
877
	}
878
879
880
881 View Code Duplication
	protected function addFields()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
882
	{
883
		$W = bab_Widgets();
884
885
886
		$this->addItem($W->LabelledWidget(
887
				absences_translate('Email to notify when a vacation request is accepted (other than me)'),
888
				$W->TextEdit()->setColumns(80)->setLines(2),
889
				'emails',
890
				absences_translate('Comma separated values')
891
		));
892
893
		
894
	}
895
896
897
898
899
900
	protected function loadFormValues()
901
	{
902
		global $babDB;
903
904
		
905
		$values = array();
906
		$agent = absences_Agent::getCurrentUser();
907
		
908
		$values['emails'] = $agent->emails;
909
910
		$this->setValues($values, array('options'));
911
	}
912
913
914 View Code Duplication
	protected function addButtons()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
915
	{
916
		$W = bab_Widgets();
917
918
		$button = $W->FlowItems(
919
				$W->SubmitButton()->setName('save')->setLabel(absences_translate('Save'))
920
		)->setSpacing(1,'em');
921
922
		$this->addItem($button);
923
	}
924
}
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
class absences_AgentEdit
946
{
947
    public $usertext;
948
    public $grouptext;
949
    public $userval;
950
    public $userid;
951
    public $groupval;
952
    public $groupid;
953
    public $collection;
954
    public $idcollection;
955
    public $collname;
956
    public $appschema;
957
    public $idsapp;
958
    public $saname;
959
    public $selected;
960
    public $add;
961
    public $bdel;
962
    public $delete;
963
    public $groupsbrowurl;
964
    public $usersbrowurl;
965
966
    public $orand;
967
    public $reset;
968
    
969
    
970
    /**
971
     * @var bool
972
     */
973
    public $changeorganization = true;
974
975
    /**
976
     * @var int
977
     */
978
    private $id_organization;
979
    
980
    /**
981
     * @var absences_OrganizationIterator
982
     */
983
    private $organizations;
984
    
985
    
986
    /**
987
     * @var array
988
     */
989
    private $wsprofiles;
990
    
991
    /**
992
     * @var ORM_Iterator
993
     */
994
    private $profiles;
995
    
996
    
997
    /**
998
     * @var int
999
     */
1000
    private $loop_selectedProfile = 0;
1001
    
1002
    
1003
    public $canuseprofiles = false;
1004
1005
1006
    public function __construct($idp)
1007
    {
1008
        require_once dirname(__FILE__).'/organization.class.php';
1009
        
1010
        $this->usertext = absences_translate("User");
1011
        $this->collection = absences_translate("Collection:");
1012
        $this->appschema = absences_translate("Approbation schema for vacation requests:");
1013
        $this->t_id_sa_cet = absences_translate("Approbation schema for deposit into the time savings account:");
0 ignored issues
show
Bug introduced by
The property t_id_sa_cet does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1014
        $this->t_id_sa_recover = absences_translate("Approbation schema for declaration of worked days entitling recovery:");
0 ignored issues
show
Bug introduced by
The property t_id_sa_recover does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1015
        $this->t_use_vr = absences_translate("Use schema for vacation requests");
0 ignored issues
show
Bug introduced by
The property t_use_vr does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1016
        $this->t_list_request = absences_translate("List absence requests");
0 ignored issues
show
Bug introduced by
The property t_list_request does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1017
        $this->t_create_request = absences_translate("Create a vacation request");
0 ignored issues
show
Bug introduced by
The property t_create_request does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1018
        $this->t_emails = absences_translate('Email to notify when a vacation request is accepted, comma separated');
0 ignored issues
show
Bug introduced by
The property t_emails does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1019
        $this->t_organization = absences_translate('Organization:');
0 ignored issues
show
Bug introduced by
The property t_organization does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1020
        $this->t_workschedule = absences_translate('Work schedule profile');
0 ignored issues
show
Bug introduced by
The property t_workschedule does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1021
        $this->t_from = absences_translate('From');
0 ignored issues
show
Bug introduced by
The property t_from does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1022
        $this->t_to = absences_translate('To');
0 ignored issues
show
Bug introduced by
The property t_to does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1023
1024
        $this->listrequesturl = bab_toHtml(absences_addon()->getUrl()."vacadmb&idx=lreq&userid=".urlencode($idp));
0 ignored issues
show
Bug introduced by
The property listrequesturl does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1025
        $this->createrequesturl = bab_toHtml(absences_addon()->getUrl()."vacuser&idx=period&rfrom=1&id_user=".urlencode($idp));
0 ignored issues
show
Bug introduced by
The property createrequesturl does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1026
1027
        $this->delete = absences_translate("Delete");
1028
        $this->usersbrowurl = absences_addon()->getUrl()."vacadm&idx=browu&cb=";
1029
        $this->tg = bab_rp('tg');
0 ignored issues
show
Bug introduced by
The property tg does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1030
        $this->ide = isset($_REQUEST['ide']) ? $_REQUEST['ide'] : false;
0 ignored issues
show
Bug introduced by
The property ide does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1031
1032
        global $babDB;
1033
        $W = bab_Widgets();
1034
        $this->idp = $idp;
0 ignored issues
show
Bug introduced by
The property idp does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1035
         
1036
        $userpicker = $W->UserPicker()->setName('userid');
1037
        bab_functionality::includeOriginal('Icons');
1038
        $this->userpicker = $W->Frame()->addClass(Func_Icons::ICON_LEFT_16)->addItem($userpicker)->display($W->HtmlCanvas());
0 ignored issues
show
Bug introduced by
The property userpicker does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1039
         
1040
1041
        list($n) = $babDB->db_fetch_array($babDB->db_query("SELECT COUNT(*) FROM ".ABSENCES_ENTRIES_TBL." WHERE id_user='".$babDB->db_escape_string($this->idp)."' AND status=''"));
1042
1043
        if ($n > 0) {
1044
            $waiting = absences_translate(
1045
                'Modification are disabled, the user have %d waiting request' ,
1046
                'Modification are disabled, the user have %d waiting requests',
1047
                $n);
1048
            $this->waiting = sprintf($waiting, $n);
0 ignored issues
show
Bug introduced by
The property waiting does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1049
        }
1050
1051
        if (isset($_POST['action']) && $_POST['action'] == 'changeuser')
1052
        {
1053
            $this->userid = $_POST['userid'];
1054
            $this->idsa = $_POST['idsa'];
0 ignored issues
show
Bug introduced by
The property idsa does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1055
            $this->id_sa_cet = $_POST['id_sa_cet'];
0 ignored issues
show
Bug introduced by
The property id_sa_cet does not seem to exist. Did you mean t_id_sa_cet?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1056
            $this->id_sa_recover = $_POST['id_sa_recover'];
0 ignored issues
show
Bug introduced by
The property id_sa_recover does not seem to exist. Did you mean t_id_sa_recover?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1057
            $this->idcol = $_POST['idcol'];
0 ignored issues
show
Bug introduced by
The property idcol does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1058
            $this->idp = $_POST['idp'];
1059
            $this->id_organization = bab_pp('id_organization');
1060
        }
1061
1062
        if( !empty($this->idp))
1063
        {
1064
            require_once dirname(__FILE__).'/agent.class.php';
1065
            require_once dirname(__FILE__).'/agent.ui.php';
1066
            $this->add = absences_translate("Modify");
1067
            $agent = absences_Agent::getFromIdUser($this->idp);
1068
1069
            if (!$agent->exists())
1070
            {
1071
                // T7680 apres suppression d'une fiche d'annuaire
1072
                $url = bab_url::get_request('tg');
1073
                $url->idx = 'lper';
1074
                $url->location();
1075
            }
1076
1077
            $this->userid = $agent->getIdUser();
1078
1079
1080
            $frame = new absences_AgentFullFrame($agent);
1081
1082
            $this->userval = $frame->display($W->HtmlCanvas());
1083
            $this->idcol = $agent->id_coll;
1084
            $this->idsa = $agent->id_sa;
1085
            $this->id_sa_cet = $agent->id_sa_cet;
0 ignored issues
show
Bug introduced by
The property id_sa_cet does not seem to exist. Did you mean t_id_sa_cet?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1086
            $this->id_sa_recover = $agent->id_sa_recover;
0 ignored issues
show
Bug introduced by
The property id_sa_recover does not seem to exist. Did you mean t_id_sa_recover?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1087
            $this->emails = bab_toHtml($agent->emails);
0 ignored issues
show
Bug introduced by
The property emails does not seem to exist. Did you mean t_emails?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1088
            $this->id_organization = $agent->id_organization;
1089
        }
1090
        else
1091
        {
1092
            $this->add = absences_translate("Add");
1093
            $this->idcol = '';
1094
            $this->idsa = '';
1095
            $this->id_sa_cet = '';
0 ignored issues
show
Bug introduced by
The property id_sa_cet does not seem to exist. Did you mean t_id_sa_cet?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1096
            $this->id_sa_recover = '';
0 ignored issues
show
Bug introduced by
The property id_sa_recover does not seem to exist. Did you mean t_id_sa_recover?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1097
            $this->userval = '';
1098
            $this->userid = '';
1099
            $this->emails = '';
0 ignored issues
show
Bug introduced by
The property emails does not seem to exist. Did you mean t_emails?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1100
            $this->id_organization = 0;
1101
        }
1102
1103
        $this->groupval = "";
1104
        $this->groupid = "";
1105
1106
        $this->sares = bab_WFGetApprobationsList();
0 ignored issues
show
Bug introduced by
The property sares does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1107
1108
1109
        $this->colres = $babDB->db_query("select * from ".ABSENCES_COLLECTIONS_TBL." order by name asc");
0 ignored issues
show
Bug introduced by
The property colres does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1110
        $this->countcol = $babDB->db_num_rows($this->colres);
0 ignored issues
show
Bug introduced by
The property countcol does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1111
         
1112
        $this->organizations = new absences_OrganizationIterator();
1113
        $this->organizations->rewind();
1114
        
1115
        $this->changeorganization = !(bool) absences_getVacationOption('organization_sync');
1116
        
1117
        $defaultWh = bab_functionality::get('WorkingHours');
1118
        
1119
        if ($workschedules = bab_functionality::get('WorkingHours/Workschedules')) {
1120
            /*@var $workschedules Func_WorkingHours_Workschedules */
1121
            $this->wsprofiles = $workschedules->getProfiles($this->idp);
1122
            
1123
            if (count($this->wsprofiles) > 0 && $workschedules instanceof $defaultWh) {
1124
                $this->canuseprofiles = true;
1125
            }
1126
            
1127
            
1128
            $this->profiles = $workschedules->getUserProfiles($this->idp);
1129
            $this->profiles->rewind();
1130
        }
1131
    }
1132
1133
1134
    public function getnextorganization()
1135
    {
1136
        if ($this->organizations->valid()) {
1137
            $organization = $this->organizations->current();
1138
            $this->organizations->next();
1139
            
1140
            $this->value = bab_toHtml($organization->id);
0 ignored issues
show
Bug introduced by
The property value does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1141
            $this->name = bab_toHtml($organization->name);
0 ignored issues
show
Bug introduced by
The property name does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1142
            $this->selected = ($this->id_organization == $organization->id);
1143
            
1144
            return true;
1145
        }
1146
    }
1147
1148
    public function getnextsa()
1149
    {
1150
1151
        if( list(,$arr) = each($this->sares) )
1152
        {
1153
            $this->saname = $arr['name'];
1154
            $this->idsapp = $arr['id'];
1155
            $this->selected = ( $this->idsa == $this->idsapp ) ? "selected" : '';
1156
            $this->selected_cet = ( $this->id_sa_cet == $this->idsapp ) ? "selected" : '';
0 ignored issues
show
Bug introduced by
The property selected_cet does not seem to exist. Did you mean selected?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
Bug introduced by
The property id_sa_cet does not seem to exist. Did you mean t_id_sa_cet?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1157
            $this->selected_recover = ( $this->id_sa_recover == $this->idsapp ) ? "selected" : '';
0 ignored issues
show
Bug introduced by
The property selected_recover does not seem to exist. Did you mean selected?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
Bug introduced by
The property id_sa_recover does not seem to exist. Did you mean t_id_sa_recover?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1158
1159
            return true;
1160
        }
1161
        reset($this->sares);
1162
        return false;
1163
1164
    }
1165
1166 View Code Duplication
    public function getnextcol()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1167
    {
1168
        static $j= 0;
1169
        if( $j < $this->countcol )
1170
        {
1171
            global $babDB;
1172
            $arr = $babDB->db_fetch_array($this->colres);
1173
            $this->collname = $arr['name'];
1174
            $this->idcollection = $arr['id'];
1175
            if( $this->idcol == $this->idcollection )
1176
                $this->selected = "selected";
1177
            else
1178
                $this->selected = "";
1179
            $j++;
1180
            return true;
1181
        }
1182
        else
1183
            return false;
1184
    }
1185
1186
    
1187
    public function getnextwsprofile()
1188
    {
1189
        if (list($id, $name) = each($this->wsprofiles)) {
1190
            $this->id = bab_toHtml($id);
0 ignored issues
show
Bug introduced by
The property id does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1191
            $this->name = bab_toHtml($name);
1192
            $this->selected = ($this->loop_selectedProfile === $id);
1193
            
1194
            return true;
1195
        }
1196
        
1197
        reset($this->wsprofiles);
1198
        return false;
1199
    }
1200
    
1201
    
1202
    public function getnextprofile()
1203
    {
1204
        static $firstRow = null;
1205
        
1206
        if (!isset($firstRow) && 0 === $this->profiles->count()) {
1207
            $firstRow = true;
1208
            $this->profileRow();
1209
            return true;
1210
        }
1211
        
1212
        
1213
        if ($this->profiles->valid()) {
1214
            $userProfile = $this->profiles->current();
1215
            $this->profileRow($userProfile);
1216
            
1217
            
1218
            $this->profiles->next();
1219
            return true;
1220
        }
1221
        
1222
        return false;
1223
    }
1224
    
1225
    
1226
    private function profileRow(workschedules_UserProfile $userProfile = null)
1227
    {
1228
        $W = bab_Widgets();
1229
        $canvas = $W->HtmlCanvas();
1230
        
1231
        $this->userProfileId = '0';
0 ignored issues
show
Bug introduced by
The property userProfileId does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1232
        
1233
        $from = $W->DatePicker()->setName(array('profiles', 'from', ''));
1234
        $to = $W->DatePicker()->setName(array('profiles', 'to', ''));
1235
        
1236
        if (isset($userProfile)) {
1237
            $this->userProfileId = $userProfile->id;
1238
            $this->loop_selectedProfile = (int) $userProfile->profile->id;
1239
            
1240
            $from->setValue($userProfile->from);
1241
            $to->setValue($userProfile->to);
1242
        }
1243
        
1244
        $this->datepicker_from = $from->display($canvas);
0 ignored issues
show
Bug introduced by
The property datepicker_from does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1245
        $this->datepicker_to = $to->display($canvas);
0 ignored issues
show
Bug introduced by
The property datepicker_to does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1246
        
1247
        $this->userProfileId = isset($userProfile) ? $userProfile->id : '0';
1248
    }
1249
    
1250
1251
    public function printhtml()
1252
    {
1253
        $babBody = bab_getBody();
1254
        
1255
        $babBody->addJavascriptFile(absences_addon()->getTemplatePath().'workschedules.js', true);
1256
        
1257
        $babBody->addStyleSheet(absences_addon()->getStylePath().'vacation.css');
1258
        $babBody->babecho(bab_printTemplate($this, absences_addon()->getRelativePath()."vacadm.html", "personnelcreate"));
0 ignored issues
show
Deprecated Code introduced by
The method bab_addonInfos::getRelativePath() has been deprecated with message: Do not use relative path in addons Addons are subject to move out of the core folder in futures version for bab_printTemplate, replace with $addon->printTemplate() for babBody->addStyleSheet use $addon->getStylePath() instead of relative path the addStyleSheet method support full path starting with vendor/ since the 8.1.98 version

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
1259
    }
1260
}
1261
1262
1263
1264