Code Duplication    Length = 30-30 lines in 2 locations

programs/utilit/entry.class.php 2 locations

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