Project

General

Profile

Actions

Anomalie #1618

closed

Query error sorting by status

Added by Johan Cwiklinski almost 3 years ago. Updated over 1 year ago.

Status:
Fermé
Priority:
Normal
Category:
Core
Target version:
Start date:
01/16/2022
Due date:
% Done:

100%

Estimated time:
Version utilisée:

Description

As a group manager, the following error appears trying to sort by status:

Query error: SELECT DISTINCT `a`.*, `status`.* FROM `oitar_adherents` AS `a` LEFT JOIN `oitar_socials` AS `so` ON `a`.`id_adh`=`so`.`id_adh` INNER JOIN `oitar_statuts` AS `status` ON `a`.`id_statut`=`status`.`id_statut` INNER JOIN `oitar_groups_members` AS `gr` ON `a`.`id_adh`=`gr`.`id_adh` INNER JOIN `oitar_groups_managers` AS `m` ON `gr`.`id_group`=`m`.`id_group` WHERE `m`.`id_adh` = '17' ORDER BY `id_statut` ASC, `nom_adh` ASC, `prenom_adh` ASC LIMIT 100 OFFSET 0 PDOException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id_statut' in order clause is ambiguous

This seems an issue in Members::getMembersList()

Actions #1

Updated by Johan Cwiklinski almost 3 years ago

Fix proposal:

diff --git a/galette/lib/Galette/Repository/Members.php b/galette/lib/Galette/Repository/Members.php
index 8b70514f0..26453a534 100644
--- a/galette/lib/Galette/Repository/Members.php
+++ b/galette/lib/Galette/Repository/Members.php
@@ -940,7 +940,7 @@ class Members
                 break;
             default:
                 if ($this->canOrderBy($this->filters->orderby, $fields)) {
-                    $order[] = $this->filters->orderby . ' ' . $this->filters->getDirection();
+                    $order[] = 'a.' . $this->filters->orderby . ' ' . $this->filters->getDirection();
                 }
                 break;
         }

Actions #2

Updated by Johan Cwiklinski almost 3 years ago

  • Status changed from Nouveau to Résolu
  • % Done changed from 0 to 100
Actions #3

Updated by Johan Cwiklinski over 1 year ago

  • Status changed from Résolu to Fermé
Actions

Also available in: Atom PDF