Code Duplication    Length = 30-30 lines in 2 locations

programs/utilit/entry.class.php 2 locations

@@ 1688-1717 (lines=30) @@
1685
	 *
1686
	 * @return float (days)
1687
	 */
1688
	public function getPlannedDaysBetween($begin, $end, $id_type = null)
1689
	{
1690
	    if (empty($this->elements))
1691
	    {
1692
	        $this->loadElements();
1693
	    }
1694
1695
	    $total = 0.0;
1696
	    foreach($this->elements as $elem)
1697
	    {
1698
	        /*@var $elem absences_EntryElem */
1699
	        $right = $elem->getRight();
1700
1701
	        if (isset($id_type) && (int) $id_type !== (int) $right->id_type) {
1702
	            continue;
1703
	        }
1704
1705
	        $quantity = $elem->getPlannedQuantityBetween($begin, $end);
1706
1707
	        if ('H' === $right->quantity_unit) {
1708
	            $days = $this->hoursToDays($quantity);
1709
	        } else {
1710
	            $days = $quantity;
1711
	        }
1712
1713
	        $total += $days;
1714
	    }
1715
1716
	    return $total;
1717
	}
1718
1719
1720
@@ 1734-1763 (lines=30) @@
1731
	 *
1732
	 * @return float (hours)
1733
	 */
1734
	public function getPlannedHoursBetween($begin, $end, $id_type = null)
1735
	{
1736
	    if (empty($this->elements))
1737
	    {
1738
	        $this->loadElements();
1739
	    }
1740
1741
	    $total = 0.0;
1742
	    foreach($this->elements as $elem)
1743
	    {
1744
	        /*@var $elem absences_EntryElem */
1745
	        $right = $elem->getRight();
1746
1747
	        if (isset($id_type) && (int) $id_type !== (int) $right->id_type) {
1748
	            continue;
1749
	        }
1750
1751
	        $quantity = $elem->getPlannedQuantityBetween($begin, $end);
1752
1753
	        if ('D' === $right->quantity_unit) {
1754
	            $hours = $this->daysToHours($quantity);
1755
	        } else {
1756
	            $hours = $quantity;
1757
	        }
1758
1759
	        $total += $hours;
1760
	    }
1761
1762
	    return $total;
1763
	}
1764
1765
1766