Code Duplication    Length = 52-52 lines in 2 locations

programs/vacadmcet.php 1 location

@@ 187-238 (lines=52) @@
184
185
186
187
function absences_CetEdit()
188
{
189
	$W = bab_Widgets();
190
	$page = $W->BabPage();
191
	
192
	
193
	if (isset($_POST['cet']))
194
	{
195
		if ( isset($_POST['cet']['cancel']) )
196
		{
197
			absences_CETgotoList();
198
		}
199
	
200
	
201
		if( isset($_POST['cet']['save'] ))
202
		{
203
	
204
			// modification uniquement
205
	
206
			$values = $_POST['cet'];
207
			$deposit = absences_CetDepositRequest::getById($values['id']);
208
	
209
			if (!$deposit->getRow())
210
			{
211
				throw new Exception('Deposit not found');
212
			}
213
	
214
			try {
215
				absences_saveCetdepositRequestAdm($deposit, $values);
216
				absences_CETgotoList();
217
			} catch(Exception $e)
218
			{
219
				$page->addError($e->getMessage());
220
			}
221
		}
222
	}
223
	
224
	$id = bab_gp('id', null);
225
	
226
	if ($id)
227
	{
228
		$deposit = absences_CetDepositRequest::getById($id);
229
	} else {
230
		$deposit = null;
231
	}
232
	
233
	$editor = new absences_CetDepositRequestEditor($deposit);
234
	
235
	$page->setTitle(absences_translate('Time saving account deposit request'));
236
	$page->addItem($editor);
237
	$page->displayHtml();
238
}
239
240
241

programs/vacadmwd.php 1 location

@@ 215-266 (lines=52) @@
212
}
213
214
215
function absences_WorkingDayEdit()
216
{
217
	$W = bab_Widgets();
218
	$page = $W->BabPage();
219
	
220
	
221
	if (isset($_POST['workperiod']))
222
	{
223
		if ( isset($_POST['workperiod']['cancel']) )
224
		{
225
			absences_WDgotoList();
226
		}
227
		
228
		
229
		if( isset($_POST['workperiod']['save'] ))
230
		{
231
		
232
			// modification uniquement
233
			
234
			$values = $_POST['workperiod'];
235
			$wd = absences_WorkperiodRecoverRequest::getById($values['id']);
236
			
237
			if (!$wd->getRow())
238
			{
239
				throw new Exception('Work period not found');
240
			}
241
			
242
			try {
243
				absences_saveWorkperiodRecoverRequestAdm($wd, $values);
244
				absences_WDgotoList();
245
			} catch(Exception $e)
246
			{
247
				$page->addError($e->getMessage());
248
			}
249
		}
250
	}
251
	
252
	$id = bab_gp('id', null);
253
	
254
	if ($id)
255
	{
256
		$wd = absences_WorkperiodRecoverRequest::getById($id);
257
	} else {
258
		$wd = null;
259
	}
260
	
261
	$editor = new absences_WorkperiodRecoverRequestEditor($wd);
262
	
263
	$page->setTitle(absences_translate('Worked day entitling recovery'));
264
	$page->addItem($editor);
265
	$page->displayHtml();
266
}
267
268
269