Code Duplication    Length = 8-11 lines in 4 locations

programs/utilit/agent_cet.class.php 4 locations

@@ 513-521 (lines=9) @@
510
		
511
		// verifier que la quantite est disponible dans le droit
512
		
513
		if ($available < $quantity)
514
		{
515
			throw new Exception(sprintf(
516
					absences_translate('The requested quantity is not available in the specified right, the right %s contain only %s available'),
517
					$right->description,
518
					absences_quantity($available, $right->quantity_unit)
519
				)
520
			);
521
		}
522
		
523
		$cet_quantity = $agent_right->getCetMaxQuantity();
524
		if ($cet_quantity < $quantity)
@@ 524-534 (lines=11) @@
521
		}
522
		
523
		$cet_quantity = $agent_right->getCetMaxQuantity();
524
		if ($cet_quantity < $quantity)
525
		{
526
			
527
			throw new Exception(sprintf(
528
					//TRANSLATORS: Vous ne pouvez deposer plus de %s de "%s" sur le compte epargne temps
529
					absences_translate('You cant deposit more than %s of "%s" one the time saving account'),
530
					$right->description,
531
					absences_quantity($cet_quantity, $right->quantity_unit)
532
				)
533
			);
534
		}
535
		
536
		
537
		
@@ 549-556 (lines=8) @@
546
			$max += (float) $deposit->quantity;
547
		}
548
		
549
		if ($max > 0 && $quantity > $max)
550
		{
551
			throw new Exception(sprintf(
552
					absences_translate('The time saving account does not allow more than %s to reach the ceilling'),
553
					absences_quantity($max, $right->quantity_unit)
554
				)
555
			);
556
		}
557
		
558
		$max = $this->getYearlyMaxDeposit();
559
		
@@ 567-574 (lines=8) @@
564
			$max += (float) $deposit->quantity;
565
		}
566
		
567
		if ($max > 0 && $quantity > $max)
568
		{
569
			throw new Exception(sprintf(
570
					absences_translate('The time saving account does not allow more than %s to reach the yearly maximum deposit'),
571
					absences_quantity($max, $right->quantity_unit)
572
				)
573
			);
574
		}
575
		
576
		
577
		return true;