From 3830b722f9fda28a50c2299f6935d4d437382562 Mon Sep 17 00:00:00 2001 From: Mazen Khallaf Date: Wed, 20 Jan 2021 21:23:28 +0000 Subject: [PATCH] Bug 27485: Rename system preference gist to TaxRates Content-Type: text/plain; charset=utf-8 Test Plan: 1. Create a vendor 2. Create a basket 3. Add an order to the basket (note the existence of the option 'gist' 4 Apply patch 5. Create another order (note the existence of the option 'TaxRates' instead) 6. Run 'prove t/Prices.t' to confirm the tests were successful 7. If everything above is correct then patch was successful Signed-off-by: Katrin Fischer Signed-off-by: Marcel de Rooy --- acqui/basketgroup.pl | 2 +- acqui/neworderempty.pl | 4 ++-- acqui/orderreceive.pl | 4 ++-- acqui/parcels.pl | 2 +- acqui/supplier.pl | 4 ++-- .../data/mysql/atomicupdate/bug_27485-rename_syspref.perl | 13 +++++++++++++ installer/data/mysql/localization/de-DE/custom.sql | 2 +- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../system_preferences_full_optimal_for_install_only.sql | 2 +- .../system_preferences_optimal_values_insert_only.sql | 2 +- .../intranet-tmpl/prog/en/modules/acqui/neworderempty.tt | 2 +- .../prog/en/modules/admin/preferences/acquisitions.pref | 2 +- t/Prices.t | 2 +- 13 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_27485-rename_syspref.perl diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index 3b53bd9602..69cf5b0378 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -208,7 +208,7 @@ sub printbasketgrouppdf{ -type => 'application/pdf', -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf' ); - my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->tax_rate // C4::Context->preference("gist")) || die "pdf generation failed"; + my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->tax_rate // C4::Context->preference("TaxRates")) || die "pdf generation failed"; print $pdf; } diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 75624751fe..d3638f27af 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -405,10 +405,10 @@ if ( defined $from_subscriptionid ) { my (undef, $barcode_subfield) = GetMarcFromKohaField( 'items.barcode' ); -# get option values for gist syspref +# get option values for TaxRates syspref my @gst_values = map { option => $_ + 0.0 -}, split( '\|', C4::Context->preference("gist") ); +}, split( '\|', C4::Context->preference("TaxRates") ); my $quantity = $input->param('rr_quantity_to_order') ? $input->param('rr_quantity_to_order') : diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index d3902de3bd..9d9028c64f 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -124,10 +124,10 @@ my $budget = GetBudget( $order->budget_id ); my $datereceived = $order->datereceived ? dt_from_string( $order->datereceived ) : dt_from_string; -# get option values for gist syspref +# get option values for TaxRates syspref my @gst_values = map { option => $_ + 0.0 -}, split( '\|', C4::Context->preference("gist") ); +}, split( '\|', C4::Context->preference("TaxRates") ); my $order_internalnote = $order->order_internalnote; my $order_vendornote = $order->order_vendornote; diff --git a/acqui/parcels.pl b/acqui/parcels.pl index 03d5ed0dfc..139cc0bb2e 100755 --- a/acqui/parcels.pl +++ b/acqui/parcels.pl @@ -201,7 +201,7 @@ $template->param( name => $bookseller->name, shipmentdate_today => dt_from_string, booksellerid => $booksellerid, - GST => C4::Context->preference('gist'), + GST => C4::Context->preference('TaxRates'), budgets => $budget_loop, ); diff --git a/acqui/supplier.pl b/acqui/supplier.pl index 1d436ac3a9..18e9b705dd 100755 --- a/acqui/supplier.pl +++ b/acqui/supplier.pl @@ -100,10 +100,10 @@ if ( $op eq 'display' ) { } else { my @currencies = Koha::Acquisition::Currencies->search; - # get option values from gist syspref + # get option values from TaxRates syspref my @gst_values = map { option => $_ + 0.0 - }, split( '\|', C4::Context->preference("gist") ); + }, split( '\|', C4::Context->preference("TaxRates") ); $template->param( # set active ON by default for supplier add (id empty for add) diff --git a/installer/data/mysql/atomicupdate/bug_27485-rename_syspref.perl b/installer/data/mysql/atomicupdate/bug_27485-rename_syspref.perl new file mode 100644 index 0000000000..2887d5d82a --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_27485-rename_syspref.perl @@ -0,0 +1,13 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + # you can use $dbh here like: + $dbh->do(q{UPDATE systempreferences set variable="TaxRates" WHERE variable="gist"}); + + # or perform some test and warn + # if( !column_exists( 'biblio', 'biblionumber' ) ) { + # warn "There is something wrong"; + # } + + # Always end with this (adjust the bug info) + NewVersion( $DBversion, XXXXX, "Description"); +} diff --git a/installer/data/mysql/localization/de-DE/custom.sql b/installer/data/mysql/localization/de-DE/custom.sql index 812a86b6c2..22696e0641 100644 --- a/installer/data/mysql/localization/de-DE/custom.sql +++ b/installer/data/mysql/localization/de-DE/custom.sql @@ -33,7 +33,7 @@ UPDATE systempreferences SET value = WHERE variable = 'OPACSearchForTitleIn'; -- Sunday = 0, Monday = 1, etc. UPDATE systempreferences SET value = '1' WHERE variable = 'CalendarFirstDayOfWeek'; -UPDATE systempreferences SET value = '0.07|0.19|0.00' WHERE variable = 'gist'; +UPDATE systempreferences SET value = '0.07|0.19|0.00' WHERE variable = 'TaxRates'; UPDATE systempreferences SET value = 'Dieser Text wird über den Systemparameter RoutingListNote konfiguriert.' where variable = 'RoutingListNote'; UPDATE systempreferences SET value = 'barcode stocknumber' WHERE variable = 'uniqueitemfields'; UPDATE systempreferences SET value = 'de-DE,en' WHERE variable = 'language'; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 7f0afaa594..b52a6bbfb3 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -211,7 +211,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines). Requires accruefines cronjob.','Choice'), ('FRBRizeEditions','0','','If ON, Koha will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'), ('GDPR_Policy','','Enforced|Permissive|Disabled','General Data Protection Regulation - policy', 'Choice'), -('gist','0','','Default Goods and Services tax rate NOT in %, but in numeric form (0.12 for 12%), set to 0 to disable GST','Integer'), +('TaxRates','0','','Default Goods and Services tax rate NOT in %, but in numeric form (0.12 for 12%), set to 0 to disable GST','Integer'), ('GoogleJackets','0',NULL,'if ON, displays jacket covers from Google Books API','YesNo'), ('GoogleOpenIDConnect', '0', NULL, 'if ON, allows the use of Google OpenID Connect for login', 'YesNo'), ('GoogleOAuth2ClientID', '', NULL, 'Client ID for the web app registered with Google', 'Free'), diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql index 24af488cfa..1b574c6254 100644 --- a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql +++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql @@ -22,7 +22,7 @@ UPDATE systempreferences SET value = 'Господин|Госпожа|Мисте UPDATE systempreferences SET value = 'metric' WHERE variable = 'dateformat'; UPDATE systempreferences SET value = 'udc' WHERE variable = 'DefaultClassificationSource'; UPDATE systempreferences SET value = '1' WHERE variable = 'ExtendedPatronAttributes'; -UPDATE systempreferences SET value = '0.20' WHERE variable = 'gist'; +UPDATE systempreferences SET value = '0.20' WHERE variable = 'TaxRates'; UPDATE systempreferences SET value = '942hv' WHERE variable = 'itemcallnumber'; UPDATE systempreferences SET value = 'ru-RU,uk-UA,en,fr-FR,de-DE' WHERE variable = 'language'; UPDATE systempreferences SET value = 'ru-RU,uk-UA,en,fr-FR,de-DE' WHERE variable = 'opaclanguages'; diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal_values_insert_only.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal_values_insert_only.sql index eb34a8d2b7..52376a4027 100644 --- a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal_values_insert_only.sql +++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal_values_insert_only.sql @@ -6,7 +6,7 @@ UPDATE systempreferences SET value='OPENOFFICE.ORG' WHERE variable='MIME'; -- Acquisitions - Поступления -UPDATE systempreferences SET value='0.20' WHERE variable='gist'; +UPDATE systempreferences SET value='0.20' WHERE variable='TaxRates'; -- EnhancedContent - Расширенное содержимое diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index 37d4f99cce..dad68a0ad4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -406,7 +406,7 @@ [% END %] - [% IF !gst_found %]Tax rate not defined in system preference gist![% END %] + [% IF !gst_found %]Tax rate not defined in system preference TaxRates![% END %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref index 1c2249946e..1885d4cc1a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref @@ -36,7 +36,7 @@ Acquisitions: CH: 360'000.00 (CH) - - Tax rates are - - pref: gist + - pref: TaxRates - . Enter in numeric form, 0.12 for 12%. The first item in the list will be selected by default. For more than one value, separate with | (pipe). - "Please note: The database will only accept values up to 4 decimals precision, further values will be rounded." - diff --git a/t/Prices.t b/t/Prices.t index b7e2aa0d20..5c2c861306 100755 --- a/t/Prices.t +++ b/t/Prices.t @@ -18,7 +18,7 @@ use_ok('C4::Acquisition'); use_ok('C4::Context'); use_ok('Koha::Number::Price'); -t::lib::Mocks::mock_preference( 'gist', '0.02|0.05|0.196' ); +t::lib::Mocks::mock_preference( 'TaxRates', '0.02|0.05|0.196' ); use Test::DBIx::Class; -- 2.11.0