]> git.agnieray.net Git - galette.git/commitdiff
Order contributions and transaction per id; closes #1502
authorJohan Cwiklinski <johan@x-tnd.be>
Mon, 26 Apr 2021 14:08:36 +0000 (16:08 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Mon, 26 Apr 2021 14:08:36 +0000 (16:08 +0200)
galette/lib/Galette/Filters/ContributionsList.php
galette/lib/Galette/Filters/TransactionsList.php
galette/lib/Galette/Repository/Contributions.php
galette/lib/Galette/Repository/Transactions.php
galette/templates/default/gestion_contributions.tpl
galette/templates/default/gestion_transactions.tpl

index 9ad9b911af182b580bb182dc16bb7e33c57d9125..b2e9ef2c84b528644342881218ac870daade8d1a 100644 (file)
@@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2016 The Galette Team
+ * Copyright © 2016-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 2016 The Galette Team
+ * @copyright 2016-202 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     june, 12th 2016
@@ -48,14 +48,13 @@ use Galette\Core\Pagination;
  * @package   Galette
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2016 The Galette Team
+ * @copyright 2016-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
  */
 
 class ContributionsList extends Pagination
 {
-
     public const ORDERBY_DATE = 0;
     public const ORDERBY_BEGIN_DATE = 1;
     public const ORDERBY_END_DATE = 2;
@@ -64,6 +63,7 @@ class ContributionsList extends Pagination
     public const ORDERBY_AMOUNT = 5;
     public const ORDERBY_DURATION = 6;
     public const ORDERBY_PAYMENT_TYPE = 7;
+    public const ORDERBY_ID = 8;
 
     public const DATE_BEGIN = 0;
     public const DATE_END = 1;
index 623274725dc5bcb28366c4ab60595429e3ff4199..5f86c76760409b8110d6f7e646dbdda817123e66 100644 (file)
@@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2016 The Galette Team
+ * Copyright © 2016-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 2016 The Galette Team
+ * @copyright 2016-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     june, 12th 2016
@@ -48,7 +48,7 @@ use Galette\Core\Pagination;
  * @package   Galette
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2016 The Galette Team
+ * @copyright 2016-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
  */
@@ -59,6 +59,7 @@ class TransactionsList extends Pagination
     public const ORDERBY_DATE = 0;
     public const ORDERBY_MEMBER = 3;
     public const ORDERBY_AMOUNT = 5;
+    public const ORDERBY_ID = 8;
 
     //filters
     private $start_date_filter;
index aa9dd9ea8712511fdbbdf36f488d377816f57fd8..9e236af412156fd8f3ebbbbc938fcdbba66619ad 100644 (file)
@@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2010-2014 The Galette Team
+ * Copyright © 2010-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 2010-2014 The Galette Team
+ * @copyright 2010-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 - 2010-03-11
@@ -57,7 +57,7 @@ use Laminas\Db\Sql\Select;
  * @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
  */
@@ -136,7 +136,7 @@ class Contributions
                 'Cannot list contributions | ' . $e->getMessage(),
                 Analog::WARNING
             );
-            return false;
+            throw $e;
         }
     }
 
@@ -264,6 +264,9 @@ class Contributions
         $order = array();
 
         switch ($this->filters->orderby) {
+            case ContributionsList::ORDERBY_ID:
+                $order[] = Contribution::PK . ' ' . $this->filters->ordered;
+                break;
             case ContributionsList::ORDERBY_DATE:
                 $order[] = 'date_enreg ' . $this->filters->ordered;
                 break;
index 910fa216b2a30bbbdde29517b70266dc79d2dcfb..ff7cf3748d74c9360557b5c9a5e61bba08cccc0b 100644 (file)
@@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2011-2014 The Galette Team
+ * Copyright © 2011-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 2011-2014 The Galette Team
+ * @copyright 2011-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 - 2011-07-31
@@ -54,7 +54,7 @@ use Galette\Filters\TransactionsList;
  * @package   Galette
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2011-2014 The Galette Team
+ * @copyright 2011-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
  */
@@ -218,6 +218,9 @@ class Transactions
         $order = array();
 
         switch ($this->filters->orderby) {
+            case TransactionsList::ORDERBY_ID:
+                $order[] = Transaction::PK . ' ' . $this->filters->ordered;
+                break;
             case TransactionsList::ORDERBY_DATE:
                 $order[] = 'trans_date' . ' ' . $this->filters->ordered;
                 break;
index e9aca8968ead430c473f207948792ce5e2048438..3bf5217063fa54371601eba7d40175d4b89f03f3 100644 (file)
         <table class="listing">
             <thead>
                 <tr>
-                    <th class="id_row">#</th>
+                    <th class="id_row">
+                        <a href="{path_for name="contributions" data=["type" => "contributions", "option" => "order", "value" => "Galette\Filters\ContributionsList::ORDERBY_ID"|constant]}">#
+                        {if $filters->orderby eq constant('Galette\Filters\ContributionsList::ORDERBY_ID')}
+                            {if $filters->ordered eq constant('Galette\Filters\ContributionsList::ORDER_ASC')}
+                            <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt=""/>
+                            {else}
+                            <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt=""/>
+                            {/if}
+                        {/if}
+                        </a>
+                    </th>
                     <th class="left date_row">
                         <a href="{path_for name="contributions" data=["type" => "contributions", "option" => "order", "value" => "Galette\Filters\ContributionsList::ORDERBY_DATE"|constant]}">{_T string="Date"}
                         {if $filters->orderby eq constant('Galette\Filters\ContributionsList::ORDERBY_DATE')}
index 8a8205618beaec78b9eed65b53f4d9fc5fb1871a..ff64ffb99a64edb51993eb7d3537aacdf2f97d43 100644 (file)
         <table class="listing">
             <thead>
                 <tr>
-                    <th class="id_row">#</th>
+                    <th class="id_row">
+                        <a href="{path_for name="contributions" data=["type" => "transactions", "option" => "order", "value" => "Galette\Filters\TransactionsList::ORDERBY_ID"|constant]}">#
+                        {if $filters->orderby eq constant('Galette\Filters\TransactionsList::ORDERBY_ID')}
+                            {if $filters->ordered eq constant('Galette\Filters\TransactionsList::ORDER_ASC')}
+                            <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt=""/>
+                            {else}
+                            <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt=""/>
+                            {/if}
+                        {/if}
+                        </a>
+                    </th>
                     <th class="left date_row">
                         <a href="{path_for name="contributions" data=["type" => "transactions", "option" => "order", "value" => "Galette\Filters\TransactionsList::ORDERBY_DATE"|constant]}">{_T string="Date"}
                         {if $filters->orderby eq constant('Galette\Filters\TransactionsList::ORDERBY_DATE')}