From 35b7d69b4a0ad5ae0814321ef204513c384ddc63 Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Thu, 7 Feb 2019 17:52:49 +0100 Subject: [PATCH] change basket_res_order by default + fix error confirm_status in indexingBasket --- apps/maarch_entreprise/actions/confirm_status.php | 11 ++++++++--- sql/1810.sql | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/maarch_entreprise/actions/confirm_status.php b/apps/maarch_entreprise/actions/confirm_status.php index f0fce1715ab..cbad3d0a407 100755 --- a/apps/maarch_entreprise/actions/confirm_status.php +++ b/apps/maarch_entreprise/actions/confirm_status.php @@ -65,9 +65,14 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $templatesControler = new templates_controler(); $templates = array(); - $stmt = $db->query("SELECT destination FROM res_letterbox WHERE res_id = (?)", [$res_id]); - $resultDest = $stmt->fetchObject(); - $destination = $resultDest->destination; + if(is_integer($res_id)){ + $stmt = $db->query("SELECT destination FROM res_letterbox WHERE res_id = (?)", [$res_id]); + $resultDest = $stmt->fetchObject(); + $destination = $resultDest->destination; + } else { + $destination = ''; + } + if ($destination <> '') { $templates = $templatesControler->getAllTemplatesForProcess($destination); } else { diff --git a/sql/1810.sql b/sql/1810.sql index 133df706fcc..5fc978ddaa5 100755 --- a/sql/1810.sql +++ b/sql/1810.sql @@ -19,9 +19,9 @@ ALTER TABLE groupbasket_status DROP COLUMN IF EXISTS "order"; ALTER TABLE groupbasket_status ADD COLUMN "order" integer; UPDATE groupbasket_status SET "order" = 0 WHERE status_id = 'NEW'; UPDATE groupbasket_status SET "order" = 1 WHERE status_id != 'NEW'; -UPDATE baskets SET basket_res_order = 'res_id' WHERE basket_res_order IS NULL; +UPDATE baskets SET basket_res_order = 'res_id desc' WHERE basket_res_order IS NULL; ALTER TABLE baskets ALTER COLUMN basket_res_order SET NOT NULL; -ALTER TABLE baskets ALTER COLUMN basket_res_order SET DEFAULT 'res_id'; +ALTER TABLE baskets ALTER COLUMN basket_res_order SET DEFAULT 'res_id desc'; ALTER TABLE groupbasket_status ALTER COLUMN "order" SET NOT NULL; DO $$ BEGIN IF (SELECT count(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'users_baskets') = 1 THEN -- GitLab