Code Duplication    Length = 18-18 lines in 2 locations

programs/utilit/agent_right.class.php 2 locations

@@ 1125-1142 (lines=18) @@
1122
		
1123
		$agent = $this->getAgent();
1124
		
1125
		if ($right->earlier)
1126
		{
1127
			$date = $agent->getDirEntryDate($right->earlier);
1128
			if (!isset($date))
1129
			{
1130
				return false;
1131
			}
1132
			
1133
			$year = (int) date('Y', bab_mktime($date));
1134
			$age = (((int)date('Y')) - $year);
1135
			
1136
			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));
1137
1138
			if ($right->earlier_begin_valid > $age || $right->earlier_end_valid < $age)
1139
			{
1140
				return false;
1141
			}
1142
		}
1143
		
1144
		
1145
		if ($right->later)
@@ 1145-1162 (lines=18) @@
1142
		}
1143
		
1144
		
1145
		if ($right->later)
1146
		{
1147
			$date = $agent->getDirEntryDate($right->later);
1148
			if (!isset($date))
1149
			{
1150
				return false;
1151
			}
1152
			
1153
			$year = (int) date('Y', bab_mktime($date));
1154
			$last = ($year - (int) date('Y'));
1155
			
1156
			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));
1157
		
1158
			if ($right->later_begin_valid < $last || $right->later_end_valid > $last)
1159
			{
1160
				return false;
1161
			}
1162
		}
1163
		
1164
		
1165