Correction des règles + ajout de différentes conditions

This commit is contained in:
Michael RICOIS 2013-09-06 05:53:54 +00:00
parent 3099cde6dd
commit 2264faacbe
3 changed files with 27 additions and 13 deletions

View File

@ -105,7 +105,7 @@ return array(
'params' => array( 'params' => array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'), 0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'), 1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2,1'), 2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2.1'),
3 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '36'), 3 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '36'),
), ),
), ),
@ -118,8 +118,8 @@ return array(
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'), 0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'), 1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
2 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'), 2 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'),
3 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4,9'), 3 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
4 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7,1'), 4 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'), 5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
6 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'), 6 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'),
), ),

View File

@ -2,7 +2,7 @@
return array( return array(
0 => array( 0 => array(
'name' => 'VORp-1.0', 'name' => 'VORp-1.0',
'value' => 'CONTINUE', 'value' => 'DEFINE',
'comment' => "", 'comment' => "",
'po' => 0, 'po' => 0,
'params' => array( 'params' => array(

View File

@ -327,7 +327,7 @@ class Metier_Sfr
* Age du plus vieux contrat en mois * Age du plus vieux contrat en mois
* @var int * @var int
*/ */
protected $ValContratAge = 0; protected $ValContratAge = null;
/** /**
* Valeur de l'Indice de Recouvrement * Valeur de l'Indice de Recouvrement
@ -502,7 +502,6 @@ class Metier_Sfr
//Indiscore - aller chercher scores dans l'historique moins de 3 mois //Indiscore - aller chercher scores dans l'historique moins de 3 mois
$histo = getIndiscoreCache($siren); $histo = getIndiscoreCache($siren);
if ($this->debug) file_put_contents('sfr.log', "INDISCORE = ".print_r($histo,1)."\n", FILE_APPEND);
if ( count($histo)>0 ) { if ( count($histo)>0 ) {
$dateIndiscore = new Zend_Date($histo[0]['indiScoreDate'], 'yyyy-MM-dd'); $dateIndiscore = new Zend_Date($histo[0]['indiScoreDate'], 'yyyy-MM-dd');
@ -569,13 +568,13 @@ class Metier_Sfr
if ($this->debug) file_put_contents('sfr.log', "\nREGLE - ".$rule['name']."\n", FILE_APPEND); if ($this->debug) file_put_contents('sfr.log', "\nREGLE - ".$rule['name']."\n", FILE_APPEND);
$all = false; $all = false;
if ( $rule['value'] == 'CONTINUE' ) { if ( $rule['value'] == 'DEFINE' ) {
$all = true; $all = true;
} }
$return = $this->params($rule['params'], $all); $return = $this->params($rule['params'], $all);
// Continue always // Continue always
if ( $rule['value'] == 'CONTINUE' ) { if ( $rule['value'] == 'CONTINUE' || $rule['value'] == 'DEFINE' ) {
continue; continue;
} }
@ -591,13 +590,23 @@ class Metier_Sfr
//Set Value //Set Value
else { else {
if( $type == 'PO' && $this->displayPo ) { if( $type == 'PO' ) {
$this->ValPO = $this->paramValue($rule['value']);
if ( $this->displayPo ) {
$this->ValPO = $this->paramValue($rule['value']);
}
} else { } else {
$this->RuleLabel = $rule['name']; $this->RuleLabel = $rule['name'];
$this->displayPo = intval($rule['po']); $this->displayPo = intval($rule['po']);
$this->ValFEU = $this->paramValue($rule['value']); $this->ValFEU = $this->paramValue($rule['value']);
if ($this->debug) file_put_contents('sfr.log', "VALIDATION : ValFEU = ".$this->ValFEU."\n", FILE_APPEND);
$this->ValComment = $rule['comment']; $this->ValComment = $rule['comment'];
} }
break; break;
} }
@ -688,14 +697,14 @@ class Metier_Sfr
switch ($type) { switch ($type) {
case 'MIN': case 'MIN':
if ( $this->{'Val'.$var} > $valueReal ) { if ( $this->{'Val'.$var}!==null && $this->{'Val'.$var} > $valueReal ) {
return true; return true;
} }
return false; return false;
break; break;
case 'MAX': case 'MAX':
if ( $this->{'Val'.$var} < $valueReal ) { if ( $this->{'Val'.$var}!==null && $this->{'Val'.$var} < $valueReal ) {
return true; return true;
} }
return false; return false;
@ -806,7 +815,12 @@ class Metier_Sfr
public function setVal($name, $value) public function setVal($name, $value)
{ {
$this->{'Val'.$name} = $value; if ( empty($value) ) {
$this->{'Val'.$name} = self::UNDEFINE;
} else {
$this->{'Val'.$name} = $value;
}
} }