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 <kyle@bywatersolutions.com> Passed-QA-by: Paul Poulain <paul.poulain@biblibre.com> Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
parent
92bdb73677
commit
3ca887bed2
3 changed files with 49 additions and 20 deletions
|
@ -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)
|
||||
|
|
|
@ -451,6 +451,7 @@ $(document).ready(function()
|
|||
[% END %]
|
||||
</li>
|
||||
[% END %]
|
||||
[% IF ( gst_values ) %]
|
||||
<li>
|
||||
[% IF ( close ) %]
|
||||
<span class="label">Tax rate: </span>
|
||||
|
@ -467,7 +468,10 @@ $(document).ready(function()
|
|||
[% END %]
|
||||
</select>
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
<input type="hidden" name="gstrate" value="0" />
|
||||
</li>
|
||||
[% END %]
|
||||
<li>
|
||||
<label for="discount">Discount: </label>
|
||||
[% IF ( close ) %]
|
||||
|
|
|
@ -156,6 +156,7 @@ if (f.company.value == "") {
|
|||
<label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
|
||||
[% END %]</li>
|
||||
</ol>
|
||||
[% IF gst_values %]
|
||||
<ol>
|
||||
<li>
|
||||
<label for="gst">Tax rate</label>
|
||||
|
@ -170,6 +171,9 @@ if (f.company.value == "") {
|
|||
</select>
|
||||
</li>
|
||||
</ol>
|
||||
[% ELSE %]
|
||||
<input type="hidden" name="gstrate" value="0" />
|
||||
[% END %]
|
||||
<ol>
|
||||
<li><label for="discount">Discount</label>
|
||||
<input type="text" size="6" id="discount" name="discount" value="[% discount %]" />%</li>
|
||||
|
|
Loading…
Reference in a new issue