From 8785dddc9d532be950af23d36b6f4771564049e8 Mon Sep 17 00:00:00 2001 From: Adrien RENARD Date: Wed, 13 Mar 2024 01:15:11 +0100 Subject: [PATCH] Debug auto archive contrat Debug panier eligible livraison --- functions/functions_contrats.php | 5 +++-- functions/functions_livraisons.php | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/functions/functions_contrats.php b/functions/functions_contrats.php index 463e943..cc3d8c5 100644 --- a/functions/functions_contrats.php +++ b/functions/functions_contrats.php @@ -150,7 +150,7 @@ function getContratPaniersLivres($id) { function getContratLastPanier($id) { $i = false; - $sql = getLivraisonsPaniersSelectBaseSQL()." WHERE ".CONTRATS_TABLE.".`ref`=$id ORDER BY ".LIVRAISONS_TABLE.".`date` ASC LIMIT 0,1"; + $sql = getLivraisonsPaniersSelectBaseSQL()." WHERE ".CONTRATS_TABLE.".`ref`=$id ORDER BY ".LIVRAISONS_TABLE.".`date` DESC LIMIT 0,1"; $r = $GLOBALS['db_admin']['man']->select($sql); if(!$r['erreur']) { @@ -223,7 +223,8 @@ function archiveOldContrat() { ." LEFT JOIN ".CONTRATS_PANIERS_STATUT." ON ".CONTRATS_TABLE.".`ref`=".CONTRATS_PANIERS_STATUT.".`ref`" ." WHERE ".CONTRATS_PANIERS_STATUT.".`nb_paniers_restants`<=0" ." AND ".CONTRATS_TABLE.".`force_eligible`=0" - ." AND ".CONTRATS_TABLE.".`archive`=0"; + ." AND ".CONTRATS_TABLE.".`archive`=0" + ." AND ".CONTRATS_TABLE.".`del`=0"; $r = $GLOBALS['db_admin']['man']->select($sql); diff --git a/functions/functions_livraisons.php b/functions/functions_livraisons.php index d68d66b..1e230ee 100644 --- a/functions/functions_livraisons.php +++ b/functions/functions_livraisons.php @@ -163,6 +163,8 @@ function getLivraisonEmargementList($paniers_eligibles, $date, $lieu=0) { $p["complement_regle_print"] = ""; if($p["present"]) { + $p["nb_paniers_livres"] += 1; + // COMPLEMENT DU $p["complement_du"] = getClientComplementDuAtDate($p["client_ref"], $date); if($p["complement_du"] > 0) $p["complement_du_print"] = number_format($p["complement_du"], 2, '.', ' ')." €"; @@ -422,7 +424,7 @@ function getNbLivraisonForContratAtDate($contrat, $date) { $sql = "SELECT count(*) as nb FROM ".LIVRAISONS_PANIERS_TABLE ." LEFT JOIN ".LIVRAISONS_TABLE." ON ".LIVRAISONS_PANIERS_TABLE.".`livraison`=".LIVRAISONS_TABLE.".`ref`" ." WHERE ".LIVRAISONS_PANIERS_TABLE.".contrat=".intval($contrat) - ." AND ".LIVRAISONS_TABLE.".date<='".$date."'"; + ." AND ".LIVRAISONS_TABLE.".date<'".$date."'"; $r = $GLOBALS['db_admin']['man']->select($sql,1);