Bugzilla – Attachment 78885 Details for
Bug 18925
Move maxissueqty and maxonsiteissueqty to circulation_rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18925: (follow-up) Fix null/empty behavior
Bug-18925-follow-up-Fix-nullempty-behavior.patch (text/plain), 9.03 KB, created by
Jonathan Druart
on 2018-09-15 20:19:54 UTC
(
hide
)
Description:
Bug 18925: (follow-up) Fix null/empty behavior
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-09-15 20:19:54 UTC
Size:
9.03 KB
patch
obsolete
>From b6049ccc52fc57d5a56053690dbed913e29d59cb Mon Sep 17 00:00:00 2001 >From: Jesse Weaver <pianohacker@gmail.com> >Date: Mon, 29 Jan 2018 15:30:29 -0700 >Subject: [PATCH] Bug 18925: (follow-up) Fix null/empty behavior > >--- > C4/Circulation.pm | 4 +-- > admin/smart-rules.pl | 8 +++--- > installer/data/mysql/atomicupdate/bug_18925.perl | 30 ++++++---------------- > .../prog/en/modules/admin/smart-rules.tt | 4 +-- > 4 files changed, 16 insertions(+), 30 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 9925672add..558a02cf35 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -503,7 +503,7 @@ sub TooMany { > > # Now count total loans against the limit for the branch > my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower); >- if (defined($branch_borrower_circ_rule->{patron_maxissueqty})) { >+ if (defined($branch_borrower_circ_rule->{patron_maxissueqty}) and $branch_borrower_circ_rule->{patron_maxissueqty} ne '') { > my @bind_params = (); > my $branch_count_query = q| > SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts >@@ -526,7 +526,7 @@ sub TooMany { > my $max_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxissueqty}; > my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxonsiteissueqty}; > >- if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) { >+ if ( $onsite_checkout and $max_onsite_checkouts_allowed ne '' ) { > if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed ) { > return { > reason => 'TOO_MANY_ONSITE_CHECKOUTS', >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 308a898305..620c4b6577 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -230,9 +230,9 @@ elsif ($op eq "set-branch-defaults") { > my $returnbranch = $input->param('returnbranch'); > my $max_holds = $input->param('max_holds'); > $patron_maxissueqty =~ s/\s//g; >- $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/; >+ $patron_maxissueqty = '' if $patron_maxissueqty !~ /^\d+/; > $patron_maxonsiteissueqty =~ s/\s//g; >- $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/; >+ $patron_maxonsiteissueqty = '' if $patron_maxonsiteissueqty !~ /^\d+/; > $holdallowed =~ s/\s//g; > $holdallowed = undef if $holdallowed !~ /^\d+/; > $max_holds =~ s/\s//g; >@@ -312,9 +312,9 @@ elsif ($op eq "add-branch-cat") { > my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty'); > my $max_holds = $input->param('max_holds'); > $patron_maxissueqty =~ s/\s//g; >- $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/; >+ $patron_maxissueqty = '' if $patron_maxissueqty !~ /^\d+/; > $patron_maxonsiteissueqty =~ s/\s//g; >- $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/; >+ $patron_maxonsiteissueqty = '' if $patron_maxonsiteissueqty !~ /^\d+/; > $max_holds =~ s/\s//g; > $max_holds = undef if $max_holds !~ /^\d+/; > >diff --git a/installer/data/mysql/atomicupdate/bug_18925.perl b/installer/data/mysql/atomicupdate/bug_18925.perl >index cafd0af504..3e5075fbe5 100644 >--- a/installer/data/mysql/atomicupdate/bug_18925.perl >+++ b/installer/data/mysql/atomicupdate/bug_18925.perl >@@ -3,12 +3,12 @@ if( CheckVersion( $DBversion ) ) { > if ( column_exists( 'branch_borrower_circ_rules', 'maxissueqty' ) ) { > $dbh->do(" > INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT categorycode, branchcode, NULL, 'patron_maxissueqty', maxissueqty >+ SELECT categorycode, branchcode, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' ) > FROM branch_borrower_circ_rules > "); > $dbh->do(" > INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT categorycode, branchcode, NULL, 'patron_maxonsiteissueqty', maxonsiteissueqty >+ SELECT categorycode, branchcode, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' ) > FROM branch_borrower_circ_rules > "); > $dbh->do("DROP TABLE branch_borrower_circ_rules"); >@@ -17,12 +17,12 @@ if( CheckVersion( $DBversion ) ) { > if ( column_exists( 'default_borrower_circ_rules', 'maxissueqty' ) ) { > $dbh->do(" > INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT categorycode, NULL, NULL, 'patron_maxissueqty', maxissueqty >+ SELECT categorycode, NULL, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' ) > FROM default_borrower_circ_rules > "); > $dbh->do(" > INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT categorycode, NULL, NULL, 'patron_maxonsiteissueqty', maxonsiteissueqty >+ SELECT categorycode, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' ) > FROM default_borrower_circ_rules > "); > $dbh->do("DROP TABLE default_borrower_circ_rules"); >@@ -31,12 +31,12 @@ if( CheckVersion( $DBversion ) ) { > if ( column_exists( 'default_circ_rules', 'maxissueqty' ) ) { > $dbh->do(" > INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, NULL, NULL, 'patron_maxissueqty', maxissueqty >+ SELECT NULL, NULL, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' ) > FROM default_circ_rules > "); > $dbh->do(" > INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', maxonsiteissueqty >+ SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' ) > FROM default_circ_rules > "); > $dbh->do("ALTER TABLE default_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty"); >@@ -45,31 +45,17 @@ if( CheckVersion( $DBversion ) ) { > if ( column_exists( 'default_branch_circ_rules', 'maxissueqty' ) ) { > $dbh->do(" > INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, branchcode, NULL, 'patron_maxissueqty', maxissueqty >+ SELECT NULL, branchcode, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' ) > FROM default_branch_circ_rules > "); > $dbh->do(" > INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', maxonsiteissueqty >+ SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' ) > FROM default_branch_circ_rules > "); > $dbh->do("ALTER TABLE default_branch_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty"); > } > >- if ( column_exists( 'issuingrules', 'maxissueqty' ) ) { >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT categorycode, branchcode, itemtype, 'maxissueqty', maxissueqty >- FROM issuingrules >- "); >- $dbh->do(" >- INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) >- SELECT categorycode, branchcode, itemtype, 'maxonsiteissueqty', maxonsiteissueqty >- FROM issuingrules >- "); >- $dbh->do("ALTER TABLE issuingrules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty"); >- } >- > SetVersion( $DBversion ); > print "Upgrade to $DBversion done (Bug 18925 - Move maxissueqty and maxonsiteissueqty to circulation_rules)\n"; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index c0921c0abd..efa89c31e6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -528,14 +528,14 @@ > [% END %] > </td> > <td> >- [% IF patron_maxissueqty %] >+ [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %] > [% patron_maxissueqty | html %] > [% ELSE %] > <span>Unlimited</span> > [% END %] > </td> > <td> >- [% IF patron_maxonsiteissueqty %] >+ [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %] > [% patron_maxonsiteissueqty | html %] > [% ELSE %] > <span>Unlimited</span> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18925
:
65238
|
65239
|
65240
|
67024
|
67025
|
67026
|
67621
|
70992
|
70993
|
70994
|
70995
|
70996
|
71032
|
71033
|
71043
|
71044
|
71045
|
71046
|
71047
|
72225
|
72226
|
72227
|
72228
|
72229
|
77225
|
77226
|
77227
|
77228
|
77229
|
78881
|
78882
|
78883
|
78884
|
78885
|
78886
|
79642
|
79643
|
79644
|
79645
|
79646
|
81091
|
81092
|
81093
|
81094
|
81095
|
82927
|
82928
|
82929
|
82930
|
82931
|
85480
|
85481
|
85482
|
85483
|
85484
|
85485
|
85486
|
85939
|
85940
|
85941
|
85942
|
85943
|
85944
|
85945
|
85946
|
85947
|
85948
|
85949
|
85950
|
85951
|
85953
|
85954
|
85955
|
85956
|
85957
|
85958
|
85959
|
85960
|
85961
|
85962
|
85963
|
85964
|
85965
|
86068
|
86069
|
86070
|
86071
|
86072
|
86073
|
86074
|
86075
|
86076
|
86077
|
86078
|
86079
|
86080
|
86081
|
86121
|
86165
|
86206
|
86207