From a12d572e16b1471195d78846050e8e6be5d10c2a Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Mon, 26 Apr 2021 16:08:36 +0200 Subject: [PATCH] Order contributions and transaction per id; closes #1502 --- galette/lib/Galette/Filters/ContributionsList.php | 8 ++++---- galette/lib/Galette/Filters/TransactionsList.php | 7 ++++--- galette/lib/Galette/Repository/Contributions.php | 11 +++++++---- galette/lib/Galette/Repository/Transactions.php | 9 ++++++--- galette/templates/default/gestion_contributions.tpl | 12 +++++++++++- galette/templates/default/gestion_transactions.tpl | 12 +++++++++++- 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/galette/lib/Galette/Filters/ContributionsList.php b/galette/lib/Galette/Filters/ContributionsList.php index 9ad9b911a..b2e9ef2c8 100644 --- a/galette/lib/Galette/Filters/ContributionsList.php +++ b/galette/lib/Galette/Filters/ContributionsList.php @@ -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 - * @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 - * @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; diff --git a/galette/lib/Galette/Filters/TransactionsList.php b/galette/lib/Galette/Filters/TransactionsList.php index 623274725..5f86c7676 100644 --- a/galette/lib/Galette/Filters/TransactionsList.php +++ b/galette/lib/Galette/Filters/TransactionsList.php @@ -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 - * @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 - * @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; diff --git a/galette/lib/Galette/Repository/Contributions.php b/galette/lib/Galette/Repository/Contributions.php index aa9dd9ea8..9e236af41 100644 --- a/galette/lib/Galette/Repository/Contributions.php +++ b/galette/lib/Galette/Repository/Contributions.php @@ -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 - * @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 - * @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; diff --git a/galette/lib/Galette/Repository/Transactions.php b/galette/lib/Galette/Repository/Transactions.php index 910fa216b..ff7cf3748 100644 --- a/galette/lib/Galette/Repository/Transactions.php +++ b/galette/lib/Galette/Repository/Transactions.php @@ -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 - * @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 - * @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; diff --git a/galette/templates/default/gestion_contributions.tpl b/galette/templates/default/gestion_contributions.tpl index e9aca8968..3bf521706 100644 --- a/galette/templates/default/gestion_contributions.tpl +++ b/galette/templates/default/gestion_contributions.tpl @@ -67,7 +67,17 @@ - +
# + "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')} + + {else} + + {/if} + {/if} + + "contributions", "option" => "order", "value" => "Galette\Filters\ContributionsList::ORDERBY_DATE"|constant]}">{_T string="Date"} {if $filters->orderby eq constant('Galette\Filters\ContributionsList::ORDERBY_DATE')} diff --git a/galette/templates/default/gestion_transactions.tpl b/galette/templates/default/gestion_transactions.tpl index 8a8205618..ff64ffb99 100644 --- a/galette/templates/default/gestion_transactions.tpl +++ b/galette/templates/default/gestion_transactions.tpl @@ -44,7 +44,17 @@ - +
# + "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')} + + {else} + + {/if} + {/if} + + "transactions", "option" => "order", "value" => "Galette\Filters\TransactionsList::ORDERBY_DATE"|constant]}">{_T string="Date"} {if $filters->orderby eq constant('Galette\Filters\TransactionsList::ORDERBY_DATE')} -- 2.39.2