80 lines
3.3 KiB
PHP
Executable File
80 lines
3.3 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
$tabNum=array();
|
|
$tabActiv=array();
|
|
$tabPrio=array();
|
|
$tabDesc=array();
|
|
$tabC1=array();
|
|
$tabC2=array();
|
|
$tabC3=array();
|
|
$theAvantage='';
|
|
$montantReducLigneAvantage=0;
|
|
$_SESSION['conditionsRemplies'] = 0;
|
|
|
|
// ---------------------------------------------------
|
|
// D'abord recup des regles qui s'appliquent
|
|
// ---------------------------------------------------
|
|
$reqSelect="SELECT * FROM `rRegles` WHERE activ=1 AND typeAvantage='panier' order by prio ;";
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (2, ['reqSelect REGLES '=> $reqSelect ],'reglePanier.regleSelect.php'); }
|
|
$resConn=$idPdo->query($reqSelect);
|
|
if ($resConn) {
|
|
$j=0;
|
|
while($tabResult=$resConn->fetch(PDO::FETCH_ASSOC)) {
|
|
$tabNum[$j]=$tabResult['num'];
|
|
$tabActiv[$j]=$tabResult['activ'];
|
|
$tabPrio[$j]=$tabResult['prio'];
|
|
$tabDesc[$j]=$tabResult['description'];
|
|
$tabC1[$j]=$tabResult['C1'];
|
|
$tabC2[$j]=$tabResult['C2'];
|
|
$tabC3[$j]=$tabResult['C3'];
|
|
$tabAvantR[$j]=$tabResult['avantage'];
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (1,['tabNum' => $tabNum[$j], 'tabPrio' => $tabPrio[$j], 'tabActiv' => $tabActiv[$j], 'tabDesc' => $tabDesc[$j], 'tabC1' => $tabC1[$j], 'tabC2' => $tabC2[$j], 'tabC3' => $tabC3[$j], ],''); }
|
|
$j++;
|
|
}
|
|
}
|
|
else {
|
|
if (isset($debug[2]) && $debug[2] == '1' ) {
|
|
{ $debugMsg .= monDebug (1,['Il est impossible de retrouver les données des règles' => '', ],''); }
|
|
}
|
|
}
|
|
|
|
// ---------------------------------------------------
|
|
// Recup des conditions
|
|
// ---------------------------------------------------
|
|
include ('regleMoteurPanier.php');
|
|
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (1,['conditionsRemplies reglePanier.select' => $_SESSION['conditionsRemplies'], 'theAvantage' => $theAvantage ],''); }
|
|
|
|
// ---------------------------------------------------
|
|
// Ensuite appliquer avantage
|
|
// ---------------------------------------------------
|
|
if ($_SESSION['conditionsRemplies']==1) {
|
|
switch ($theAvantage) {
|
|
case "artOffert":
|
|
$prixUnitHT==0;
|
|
$continuer=1;
|
|
break;
|
|
|
|
case strpos($theAvantage, "rem") >= 0 :
|
|
$test=strpos($theAvantage,"=");
|
|
$rmTmp=substr($theAvantage, $test+1);
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (1,['TEST si remise' => $test, 'prixUnitHT avant' => $prixUnitHT, 'taux remise' => $rmTmp ],''); }
|
|
$montantReducLigneAvantage= ($prixUnitHT * (float) $rmTmp ) / 100;
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= "<br>montantReducLigneAvantage = " .$montantReducLigneAvantage;}
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (1,['montantReducLigneAvantage' => $montantReducLigneAvantage ], ''); }
|
|
|
|
$continuer=1;
|
|
break;
|
|
|
|
default:
|
|
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (1,['pas trouvé de code Avantage = strpos($theAvantage, \'rem\')' => strpos($theAvantage, 'rem') ], ''); }
|
|
break;
|
|
}
|
|
$continuer=1;
|
|
}
|
|
$montantReducLigneAvantage = formatNB($montantReducLigneAvantage , 'MYSQL');
|
|
|
|
// ---------------------------------------------------
|
|
// A faire flag edt : table de jointure libelles site avantage par langue
|
|
// ---------------------------------------------------
|
|
?>
|