absences_requestDetail::initDelete()   B
last analyzed

Complexity

Conditions 5
Paths 8

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 7
nc 8
nop 1
dl 0
loc 11
rs 8.8571
c 0
b 0
f 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__).'/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');
0 ignored issues
show
Bug introduced by
The property t_createdOn 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...
60
		$this->t_comment = absences_translate('Applicant comment');
0 ignored issues
show
Bug introduced by
The property t_comment does not seem to exist. Did you mean comment?

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...
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');
0 ignored issues
show
Bug introduced by
The property t_mvt_comment does not seem to exist. Did you mean comment?

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...
68
		
69
		
70
		$W = bab_Widgets();
71
		$agent = absences_Agent::getFromIdUser($request->id_user);
72
		$this->owner = bab_toHtml($agent->getName());
0 ignored issues
show
Bug introduced by
The property owner 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...
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());
0 ignored issues
show
Documentation Bug introduced by
The property $agentcard was declared of type boolean, but $card->display($W->HtmlCanvas()) is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
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);
0 ignored issues
show
Bug introduced by
The property comment does not seem to exist. Did you mean comment2?

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...
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'];
0 ignored issues
show
Bug introduced by
The property 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...
112
	    $this->t_delete = absences_translate("Delete");
0 ignored issues
show
Bug introduced by
The property t_delete 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...
113
	    $this->delete_with_approval = false;
0 ignored issues
show
Bug introduced by
The property delete_with_approval 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...
114
	    $this->rfrom = $manager_view ? '1' : '0';
0 ignored issues
show
Bug introduced by
The property rfrom 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...
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));
0 ignored issues
show
Bug introduced by
The property createdOn does not seem to exist. Did you mean t_createdOn?

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...
134
			$this->author = bab_toHtml(bab_getUserName($movement->id_author));
0 ignored issues
show
Bug introduced by
The property author does not seem to exist. Did you mean t_author?

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...
135
			$this->comment = bab_toHtml($movement->comment);
136
			$this->message = bab_toHtml($movement->message);
0 ignored issues
show
Bug introduced by
The property message does not seem to exist. Did you mean t_message?

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...
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");
0 ignored issues
show
Bug introduced by
The property t_approb does not seem to exist. Did you mean approb?

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...
190
		$this->t_folder = absences_translate('Others dates in the same recurring request:');
0 ignored issues
show
Bug introduced by
The property t_folder 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...
191
		$this->t_createdby = absences_translate("Created by");
0 ignored issues
show
Bug introduced by
The property t_createdby 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...
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');
0 ignored issues
show
Bug introduced by
The property info 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...
207
				break;
208
				
209
			default:
210
			case absences_Entry::CREATION_USER:
0 ignored issues
show
Unused Code introduced by
case \absences_Entry::CR...nfo = false; break; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
211
				$this->info = false;
212
				break;
213
		}
214
		
215 View Code Duplication
		if ($entry->createdby == $entry->id_user)
0 ignored issues
show
Bug introduced by
The property createdby does not seem to exist. Did you mean createdBy?

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...
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...
216
		{
217
			$this->createdby = false;
0 ignored issues
show
Bug introduced by
The property createdby does not seem to exist. Did you mean t_createdby?

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...
218
		} elseif($entry->createdby) {
0 ignored issues
show
Bug introduced by
The property createdby does not seem to exist. Did you mean createdBy?

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...
219
			$this->createdby = bab_toHtml(bab_getUserName($entry->createdby));
0 ignored issues
show
Bug introduced by
The property createdby does not seem to exist. Did you mean t_createdby?

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 createdby does not seem to exist. Did you mean createdBy?

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...
220
		} else {
221
		    $this->createdby = false;
0 ignored issues
show
Bug introduced by
The property createdby does not seem to exist. Did you mean t_createdby?

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...
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())
0 ignored issues
show
Bug introduced by
The property folder does not seem to exist. Did you mean t_folder?

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...
239
		{
240
			$this->folder->rewind();
0 ignored issues
show
Bug introduced by
The property folder does not seem to exist. Did you mean t_folder?

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...
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;
0 ignored issues
show
Bug introduced by
The property rgroup_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...
263
			} else {
264
				$this->rgroup_name = '';
265
			}
266
			
267
			$this->typename = bab_toHtml($type->name);
268
			$this->typecolor = bab_toHtml($type->color);
0 ignored issues
show
Bug introduced by
The property typecolor 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...
269
			
270
			$this->period = bab_toHtml(absences_DateTimePeriod($elem->date_begin, $elem->date_end));
0 ignored issues
show
Bug introduced by
The property period 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...
271
			$this->rightname = bab_toHtml($right->description);
0 ignored issues
show
Bug introduced by
The property rightname 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...
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())
0 ignored issues
show
Bug introduced by
The property folder does not seem to exist. Did you mean t_folder?

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...
286
		{
287
			$entry = $this->folder->current();
0 ignored issues
show
Bug introduced by
The property folder does not seem to exist. Did you mean t_folder?

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...
288
			/*@var $entry absences_Entry */
289
			$this->date = bab_toHtml(bab_shortDate(bab_mktime($entry->date_begin), false));
0 ignored issues
show
Bug introduced by
The property date 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...
290
			
291
			$url = bab_url::get_request_gp();
292
			$url->id = $entry->id;
293
			$this->url = bab_toHtml($url->toString());
0 ignored issues
show
Bug introduced by
The property 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...
294
			$this->folder->next();
0 ignored issues
show
Bug introduced by
The property folder does not seem to exist. Did you mean t_folder?

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...
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');
0 ignored issues
show
Bug introduced by
The property t_rightsource 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...
320
		$this->t_quantity = absences_translate('Quantity');
0 ignored issues
show
Bug introduced by
The property t_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...
321
		
322
		
323
		$source = $request->getAgentRightSource()->getRight();
324
		
325
		$this->rightsource = bab_toHtml($source->description);
0 ignored issues
show
Bug introduced by
The property rightsource does not seem to exist. Did you mean t_rightsource?

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...
326
		$this->quantity = bab_toHtml(absences_quantity($request->quantity, $source->quantity_unit));
0 ignored issues
show
Bug introduced by
The property quantity does not seem to exist. Did you mean t_quantity?

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...
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');
0 ignored issues
show
Bug introduced by
The property t_period 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...
346
		$this->period = absences_DateTimePeriod($request->date_begin, $request->date_end);
0 ignored issues
show
Bug introduced by
The property period does not seem to exist. Did you mean t_period?

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...
347
		
348
		$this->t_type = absences_translate('Type');
0 ignored issues
show
Bug introduced by
The property t_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...
349
		$this->type = $request->getType()->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...
Documentation introduced by
The property name does not exist on object<absences_WorkperiodType>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
350
351
		
352
		$this->t_quantity = absences_translate('Quantity');
0 ignored issues
show
Bug introduced by
The property t_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...
353
		$this->quantity = bab_toHtml(absences_quantity($request->quantity, $request->quantity_unit));
0 ignored issues
show
Bug introduced by
The property quantity does not seem to exist. Did you mean t_quantity?

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...
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");
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...
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) {
0 ignored issues
show
Duplication introduced by
This function 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...
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"));
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...
399
}
400
401 View Code Duplication
function absences_viewWpRecoveryDetail($id) {
0 ignored issues
show
Duplication introduced by
This function 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...
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"));
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...
406
}
407