Code Duplication    Length = 18-18 lines in 2 locations

programs/utilit/agent_right.class.php 2 locations

@@ 1126-1143 (lines=18) @@
1123
		
1124
		$agent = $this->getAgent();
1125
		
1126
		if ($right->earlier)
1127
		{
1128
			$date = $agent->getDirEntryDate($right->earlier);
1129
			if (!isset($date))
1130
			{
1131
				return false;
1132
			}
1133
			
1134
			$year = (int) date('Y', bab_mktime($date));
1135
			$age = (((int)date('Y')) - $year);
1136
			
1137
			bab_debug(sprintf("Filtre par date anterieure pour le droit %s | age=%d (intervale %d - %d)", $right->description,$age, $right->earlier_begin_valid, $right->earlier_end_valid));
1138
1139
			if ($right->earlier_begin_valid > $age || $right->earlier_end_valid < $age)
1140
			{
1141
				return false;
1142
			}
1143
		}
1144
		
1145
		
1146
		if ($right->later)
@@ 1146-1163 (lines=18) @@
1143
		}
1144
		
1145
		
1146
		if ($right->later)
1147
		{
1148
			$date = $agent->getDirEntryDate($right->later);
1149
			if (!isset($date))
1150
			{
1151
				return false;
1152
			}
1153
			
1154
			$year = (int) date('Y', bab_mktime($date));
1155
			$last = ($year - (int) date('Y'));
1156
			
1157
			bab_debug(sprintf("Filtre par date posterieure pour le droit %s | reste=%d (intervale %d - %d)", $right->description, $last, $right->earlier_begin_valid, $right->earlier_end_valid));
1158
		
1159
			if ($right->later_begin_valid < $last || $right->later_end_valid > $last)
1160
			{
1161
				return false;
1162
			}
1163
		}
1164
		
1165
		
1166