From c3d96efdab0092291b90525fb972da3f8822a2e8 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. --- 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 e67bf3e..cf78d89 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6011,6 +6011,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 96c6fb6..5533ebc 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 9cbc169..201c080 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. -- 1.7.10.4