From 3ca887bed227d70a3cde38a5352cdca0019a9ccc Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 15 Oct 2012 15:49:30 +0200 Subject: [PATCH] Bug 8832: Update the gist pref and hide the tax rate value if not needed The gist system preference will be updated with the existing values and with the supplier's gstrate values. The "Tax rate" part becomes hidden if the syspref is not filled. Signed-off-by: Kyle M Hall Passed-QA-by: Paul Poulain Signed-off-by: Jared Camins-Esakov --- installer/data/mysql/updatedatabase.pl | 21 +++++++++++ .../prog/en/modules/acqui/neworderempty.tt | 36 ++++++++++--------- .../prog/en/modules/acqui/supplier.tt | 12 ++++--- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 7ab48eea70..51905ee27a 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6020,6 +6020,27 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.09.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + my $gst_booksellers = $dbh->selectcol_arrayref("SELECT DISTINCT(gstrate) FROM aqbooksellers"); + my $gist_syspref = C4::Context->preference("gist"); + # remove the undef values and construct and array with the syspref and the supplier values + my @gstrates = map { defined $_ ? $_ : () } @$gst_booksellers; + push @gstrates, split ('\|', $gist_syspref); + # we want to compare integer (or float) + $_ = $_ + 0 for @gstrates; + use List::MoreUtils qw/uniq/; + # remove duplicate values + @gstrates = uniq sort @gstrates; + my $new_syspref_value = join '|', @gstrates; + # update the syspref with the new values + my $sth = $dbh->prepare("UPDATE systempreferences set value=? WHERE variable='gist'"); + $sth->execute( $new_syspref_value ); + + print "Upgrade to $DBversion done (Bug 8832, Set the syspref gist with the existing values)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) 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 96c6fb6a00..5533ebc807 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -451,23 +451,27 @@ $(document).ready(function() [% END %] [% END %] -
  • - [% IF ( close ) %] - Tax rate: - [% gstrate %]% - [% ELSE %] - - [% gstrate %]% + [% ELSE %] + + [% END %] - - [% END %] -
  • + [% ELSE %] + + + [% END %]
  • [% IF ( close ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt index 9cbc169a95..201c08043b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt @@ -156,8 +156,9 @@ if (f.company.value == "") { [% END %]
  • -
      -
    1. + [% IF gst_values %] +
        +
      1. -
      2. -
      +
    2. +
    + [% ELSE %] + + [% END %]
    1. %
    2. -- 2.39.5