]> git.agnieray.net Git - galette.git/commitdiff
Fix member list ordering; closes #1586 and refs #1580
authorJohan Cwiklinski <johan@x-tnd.be>
Thu, 28 Oct 2021 05:45:29 +0000 (07:45 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Thu, 28 Oct 2021 05:45:35 +0000 (07:45 +0200)
galette/includes/routes/public_pages.routes.php
galette/lib/Galette/Repository/Members.php

index c15552a2caa47947d73f0696ffa7d1dd641b987a..4f904915961826871ce96b7a262989fe3eeb0f54 100644 (file)
@@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2014-2020 The Galette Team
+ * Copyright © 2014-2021 The Galette Team
  *
  * This file is part of Galette (http://galette.tuxfamily.org).
  *
@@ -28,7 +28,7 @@
  * @package   Galette
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2014-2020 The Galette Team
+ * @copyright 2014-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  * @since     0.8.2dev 2014-11-11
@@ -57,7 +57,7 @@ $showPublicPages = function ($request, $response, $next) use ($container) {
 $app->group('/public', function () {
     //public members list
     $this->get(
-        '/{type:list|trombi}[/{option:page|order}/{value:\d+}]',
+        '/{type:list|trombi}[/{option:page|order}/{value:\d+|\w+}]',
         [Crud\MembersController::class, 'publicList']
     )->setName('publicList');
 
@@ -68,9 +68,13 @@ $app->group('/public', function () {
     )->setName('filterPublicList');
 
     $this->get(
-        '/members[/{option:page|order}/{value:\d+}]',
-        function ($request, $response) {
+        '/members[/{option:page|order}/{value:\d+|\w+}]',
+        function ($request, $response, string $option = null, string $value = null) {
             $args = ['type' => 'list'];
+            if ($option !== null && $value !== null) {
+                $args['option'] = $option;
+                $args['value'] = $value;
+            }
             return $response
                 ->withStatus(301)
                 ->withHeader('Location', $this->get('router')->pathFor('publicList', $args));
index 26717c621b628ca30379fce9caad39b0d8777b3d..51227cdc3507fad5a4edcf179a338730a1df5e2f 100644 (file)
@@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2009-2014 The Galette Team
+ * Copyright © 2009-2021 The Galette Team
  *
  * This file is part of Galette (http://galette.tuxfamily.org).
  *
@@ -28,7 +28,7 @@
  * @package   Galette
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2009-2014 The Galette Team
+ * @copyright 2009-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  * @since     Available since 0.7dev - 2009-02-28
@@ -65,7 +65,7 @@ use Galette\Core\Db;
  * @package   Galette
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2009-2014 The Galette Team
+ * @copyright 2009-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  */
@@ -108,12 +108,12 @@ class Members
     public const MEMBERSHIP_ADMIN = 6;
     public const MEMBERSHIP_NONE = 7;
 
-    public const ORDERBY_NAME = 0;
-    public const ORDERBY_NICKNAME = 1;
-    public const ORDERBY_STATUS = 2;
-    public const ORDERBY_FEE_STATUS = 3;
-    public const ORDERBY_MODIFDATE = 4;
-    public const ORDERBY_ID = 5;
+    public const ORDERBY_NAME = 'name';
+    public const ORDERBY_NICKNAME = 'nickname';
+    public const ORDERBY_STATUS = 'status';
+    public const ORDERBY_FEE_STATUS = 'fee_status';
+    public const ORDERBY_MODIFDATE = 'modif_date';
+    public const ORDERBY_ID = 'id';
 
     public const NON_STAFF_MEMBERS = 30;
 
@@ -888,7 +888,7 @@ class Members
      *
      * @param Select $select Original select
      * @param array  $fields Fields list to ensure ORDER clause
-     *                       references selected fields. Optionnal.
+     *                       references selected fields. Optional.
      *
      * @return Select
      */