Tris des types de paniers par valeur dans les listes d'une livraison

This commit is contained in:
Adrien RENARD 2024-02-13 14:01:51 +01:00
parent e9a95d2829
commit 7f1201e3da
2 changed files with 5 additions and 2 deletions

View File

@ -471,6 +471,7 @@ function getLivraisonsPaniersSelectBaseSQL() {
.CONTRATS_PANIERS_STATUT.".`nb_paniers_restants`," .CONTRATS_PANIERS_STATUT.".`nb_paniers_restants`,"
.CONTRATS_TABLE.".`panier_type` as 'panier_type_ref'," .CONTRATS_TABLE.".`panier_type` as 'panier_type_ref',"
.PANIERS_TYPES_TABLE.".`nom` as 'panier_type_nom'," .PANIERS_TYPES_TABLE.".`nom` as 'panier_type_nom',"
.PANIERS_TYPES_TABLE.".`valeur` as 'panier_type_valeur',"
.CONTRATS_TABLE.".`lieu_depot` as 'lieu_depot_ref'," .CONTRATS_TABLE.".`lieu_depot` as 'lieu_depot_ref',"
.LIEUX_TABLE.".`nom` as 'lieu_depot_nom'," .LIEUX_TABLE.".`nom` as 'lieu_depot_nom',"
.LIVRAISONS_PANIERS_TABLE.".`complement`," .LIVRAISONS_PANIERS_TABLE.".`complement`,"

View File

@ -389,6 +389,7 @@ function getLivraisonPaniersEligibles($paniers_groupe, $date, $quinz_groupe, $pa
$list[$lieu]["paniers"][$pType] = array( $list[$lieu]["paniers"][$pType] = array(
"type_ref" => $pType, "type_ref" => $pType,
"type_nom" => $i['panier_type_nom'], "type_nom" => $i['panier_type_nom'],
"type_valeur" => $i['panier_type_valeur'],
"nb_paniers" => 0, "nb_paniers" => 0,
"paniers" => array() "paniers" => array()
); );
@ -410,7 +411,7 @@ function getLivraisonPaniersEligibles($paniers_groupe, $date, $quinz_groupe, $pa
// ORDER // ORDER
$list = orderListByKey($list, "nom", "ASC"); $list = orderListByKey($list, "nom", "ASC");
for($i =0; $i<count($list); $i++) { $list[$i]["paniers"] = orderListByKey($list[$i]["paniers"], "type_nom", "ASC"); } for($i =0; $i<count($list); $i++) { $list[$i]["paniers"] = orderListByKey($list[$i]["paniers"], "type_valeur", "ASC"); }
return $list; return $list;
} }
@ -456,6 +457,7 @@ function getLivraisonPaniers($livraison, $lieu=0, $group_by_type=false) {
$list[$i["panier_type_ref"]] = array( $list[$i["panier_type_ref"]] = array(
"type_ref" => $i["panier_type_ref"], "type_ref" => $i["panier_type_ref"],
"type_nom" => $i["panier_type_nom"], "type_nom" => $i["panier_type_nom"],
"type_valeur" => $i["panier_type_valeur"],
"paniers" => array() "paniers" => array()
); );
} }
@ -469,7 +471,7 @@ function getLivraisonPaniers($livraison, $lieu=0, $group_by_type=false) {
$GLOBALS['errors'][] = "Une erreur est survenue durant la récupération de la liste des paniers de la livraison dans le base de données !".$er; $GLOBALS['errors'][] = "Une erreur est survenue durant la récupération de la liste des paniers de la livraison dans le base de données !".$er;
} }
if($group_by_type) $list = orderListByKey($list, "type_nom", "ASC"); if($group_by_type) $list = orderListByKey($list, "type_valeur", "ASC");
return $list; return $list;
} }