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

View File

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

View File

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