Code Duplication    Length = 30-30 lines in 2 locations

programs/utilit/entry.class.php 2 locations

@@ 1333-1362 (lines=30) @@
1330
	 *
1331
	 * @return float (days)
1332
	 */
1333
	public function getPlannedDaysBetween($begin, $end, $id_type = null)
1334
	{
1335
	    if (empty($this->elements))
1336
	    {
1337
	        $this->loadElements();
1338
	    }
1339
1340
	    $total = 0.0;
1341
	    foreach($this->elements as $elem)
1342
	    {
1343
	        /*@var $elem absences_EntryElem */
1344
	        $right = $elem->getRight();
1345
1346
	        if (isset($id_type) && (int) $id_type !== (int) $right->id_type) {
1347
	            continue;
1348
	        }
1349
1350
	        $quantity = $elem->getPlannedQuantityBetween($begin, $end);
1351
1352
	        if ('H' === $right->quantity_unit) {
1353
	            $days = $this->hoursToDays($quantity);
1354
	        } else {
1355
	            $days = $quantity;
1356
	        }
1357
1358
	        $total += $days;
1359
	    }
1360
1361
	    return $total;
1362
	}
1363
1364
1365
@@ 1379-1408 (lines=30) @@
1376
	 *
1377
	 * @return float (hours)
1378
	 */
1379
	public function getPlannedHoursBetween($begin, $end, $id_type = null)
1380
	{
1381
	    if (empty($this->elements))
1382
	    {
1383
	        $this->loadElements();
1384
	    }
1385
1386
	    $total = 0.0;
1387
	    foreach($this->elements as $elem)
1388
	    {
1389
	        /*@var $elem absences_EntryElem */
1390
	        $right = $elem->getRight();
1391
1392
	        if (isset($id_type) && (int) $id_type !== (int) $right->id_type) {
1393
	            continue;
1394
	        }
1395
1396
	        $quantity = $elem->getPlannedQuantityBetween($begin, $end);
1397
1398
	        if ('D' === $right->quantity_unit) {
1399
	            $hours = $this->daysToHours($quantity);
1400
	        } else {
1401
	            $hours = $quantity;
1402
	        }
1403
1404
	        $total += $hours;
1405
	    }
1406
1407
	    return $total;
1408
	}
1409
1410
1411