Bug 15084: Add Koha::Acquisition::Currenc[y|ies] classes
The first step of this patch set is to move the business logic code from admin/currencies.pl to Koha::Acquisition::Currenc[y|ies]. Then a foreign key will be created on aqorders.currency as we want to assure data integrity. Note that a aqbooksellers.currency also exists but is never used. It could be removed in another bug report. This update has to care about possible breaking relation. For instance an old order has been made using a currency which is now deleted. To be sure the update process won't break a new column currency.archived is created and leave open the door for a further improvement (marked a currency as archived from the interface: this won't be provided by this enhancement). These archived currencies won't appear on the interface for newly created items (order/suggestion). Once this is done it becomes easy to remove the subroutine from C4::Budgets: GetCurrencies and GetCurrency. ConvertCurrency will also be removed but is not used anymore. Note that none of these subroutines were covered by tests. Now they are. Test plan: 0/ Don't apply this patch 1/ Create a temporary currency and an order using it 2/ Remove the currency from your CLI 3/ Apply the patch and execute the DB entry 4/ Note that the currency is inserted and marked as archived. 5/ Edit the previous order and confirm that the correct currency is still selected. It won't never be displayed anywhere else. 6/ Test the admin script: on admin/currency.pl add/remove/edit currencies. You could not have 2 active currencies at the same time. 7/ Then on the different scripts of the acquisition module, focus on the currencies values and create a new order, receive it. Create/edit a suggestion Other changes must be checked by the QAer. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
parent
676d1e53b3
commit
6cd3975f64
2 changed files with 94 additions and 0 deletions
50
Koha/Acquisition/Currencies.pm
Normal file
50
Koha/Acquisition/Currencies.pm
Normal file
|
@ -0,0 +1,50 @@
|
|||
package Koha::Acquisition::Currencies;
|
||||
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with Koha; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use Carp;
|
||||
|
||||
use Koha::Database;
|
||||
|
||||
use Koha::Acquisition::Currency;
|
||||
|
||||
use base qw(Koha::Objects);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Koha::Acquisition::Currencies - Koha Acquisition Currency Object set class
|
||||
|
||||
=head1 API
|
||||
|
||||
=head2 Class Methods
|
||||
|
||||
=cut
|
||||
|
||||
=head3 type
|
||||
|
||||
=cut
|
||||
|
||||
sub type {
|
||||
return 'Currency';
|
||||
}
|
||||
|
||||
sub object_class {
|
||||
return 'Koha::Acquisition::Currency';
|
||||
}
|
||||
|
||||
1;
|
44
Koha/Acquisition/Currency.pm
Normal file
44
Koha/Acquisition/Currency.pm
Normal file
|
@ -0,0 +1,44 @@
|
|||
package Koha::Acquisition::Currency;
|
||||
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with Koha; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use Carp;
|
||||
|
||||
use Koha::Database;
|
||||
|
||||
use base qw(Koha::Object);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Koha::Acquisition::Currency - Koha Acquisition Currency Object class
|
||||
|
||||
=head1 API
|
||||
|
||||
=head2 Class Methods
|
||||
|
||||
=cut
|
||||
|
||||
=head3 type
|
||||
|
||||
=cut
|
||||
|
||||
sub type {
|
||||
return 'Currency';
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in a new issue