Bugzilla – Attachment 116679 Details for
Bug 8137
Checkout limit for all libraries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8137: (follow-up) Fix error on the rules cloning functionality
Bug-8137-follow-up-Fix-error-on-the-rules-cloning-.patch (text/plain), 7.15 KB, created by
Kyle M Hall (khall)
on 2021-02-10 15:41:01 UTC
(
hide
)
Description:
Bug 8137: (follow-up) Fix error on the rules cloning functionality
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-02-10 15:41:01 UTC
Size:
7.15 KB
patch
obsolete
>From e16a090b2e793cef716b76887b751d178a9c980b Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Tue, 17 Nov 2020 22:36:51 +0100 >Subject: [PATCH] Bug 8137: (follow-up) Fix error on the rules cloning > functionality > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/CirculationRule.pm | 1 + > Koha/CirculationRules.pm | 4 ++-- > Koha/Schema/Result/CirculationRule.pm | 7 +++++-- > .../intranet-tmpl/prog/en/modules/admin/smart-rules.tt | 9 +++++---- > t/db_dependent/Circulation.t | 4 ++++ > 5 files changed, 17 insertions(+), 8 deletions(-) > >diff --git a/Koha/CirculationRule.pm b/Koha/CirculationRule.pm >index 818ca513e8..7c04324223 100644 >--- a/Koha/CirculationRule.pm >+++ b/Koha/CirculationRule.pm >@@ -92,6 +92,7 @@ sub clone { > > my $cloned_rule = $self->unblessed; > $cloned_rule->{branchcode} = $to_branch; >+ $cloned_rule->{has_priority} = undef; > delete $cloned_rule->{id}; > return Koha::CirculationRule->new( $cloned_rule )->store; > } >diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm >index 938ff92cd4..21a90f9c8b 100644 >--- a/Koha/CirculationRules.pm >+++ b/Koha/CirculationRules.pm >@@ -298,7 +298,7 @@ sub set_rule { > my $branchcode = $params->{branchcode}; > my $categorycode = $params->{categorycode}; > my $itemtype = $params->{itemtype}; >- my $has_priority = $params->{has_priority}; >+ my $has_priority = $params->{has_priority} ? 1 : undef; > my $rule_name = $params->{rule_name}; > my $rule_value = $params->{rule_value}; > my $can_be_blank = defined $kind_info->{can_be_blank} ? $kind_info->{can_be_blank} : 1; >@@ -313,13 +313,13 @@ sub set_rule { > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => $itemtype, >- has_priority => $has_priority, > } > )->next(); > > if ($rule) { > if ( defined $rule_value ) { > $rule->rule_value($rule_value); >+ $rule->has_priority($has_priority); > $rule->update(); > } > else { >diff --git a/Koha/Schema/Result/CirculationRule.pm b/Koha/Schema/Result/CirculationRule.pm >index 4284c3894a..e78869b1b0 100644 >--- a/Koha/Schema/Result/CirculationRule.pm >+++ b/Koha/Schema/Result/CirculationRule.pm >@@ -52,7 +52,8 @@ __PACKAGE__->table("circulation_rules"); > > =head2 has_priority > >- data_type: 'integer' >+ data_type: 'tinyint' >+ default_value: 0 > is_nullable: 1 > > =head2 rule_name >@@ -79,7 +80,7 @@ __PACKAGE__->add_columns( > "itemtype", > { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, > "has_priority", >- { data_type => "integer", is_nullable => 1, is_boolean => 1 }, >+ { data_type => "tinyint", default_value => 0, is_nullable => 1 }, > "rule_name", > { data_type => "varchar", is_nullable => 0, size => 32 }, > "rule_value", >@@ -187,6 +188,8 @@ __PACKAGE__->belongs_to( > # Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-07-22 13:19:28 > # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1mg3weVQdfPTJ+jX6X5K+Q > >+__PACKAGE__->add_columns( '+has_priority' => { is_boolean => 1 }); >+ > sub koha_objects_class { > 'Koha::CirculationRules'; > } >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 e29d182214..c4172d4ec9 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 >@@ -1120,10 +1120,15 @@ > itm = $(this).text(); > itm = itm.replace(/^\s*|\s*$/g,''); > var current_column = $("#edit_row td:eq("+i+")"); >+ var may_have_priority = (0 == $('select#branch option[selected]').length); >+ if ( i > 4) i+=may_have_priority; > if ( i == 3 ) { > // specific processing for the Note column > var note = $(this).find("a[name='viewnote']").data("content"); > $(current_column).find("input[type='text']").val(note); >+ } else if ( i == 4 && may_have_priority ) { >+ var has_priority = $(this).find("input[type='checkbox']"); >+ $('#has_priority').prop('checked', has_priority.is(':checked') ); > } else if ( i == 9 ) { > // specific processing for the Hard due date column > var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val(); >@@ -1140,10 +1145,6 @@ > var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']"); > $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') ); > $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') ); >- } else if ( i == 3 ) { >- var has_priority = $(this).find("input[type='checkbox']"); >- $('#has_priority').prop('checked', has_priority.is(':checked') ); >- //$('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') ); > } else { > $(current_column).find("input[type='text']").val(itm); > // select the corresponding option >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 6258ed80a8..60d40da032 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -2791,6 +2791,7 @@ subtest 'AddReturn | is_overdue' => sub { > branchcode => $branchcode_false, > categorycode => undef, > itemtype => undef, >+ has_priority => undef, > rule_name => 'lostreturn', > rule_value => 0 > } >@@ -2805,6 +2806,7 @@ subtest 'AddReturn | is_overdue' => sub { > branchcode => $branchcode_refund, > categorycode => undef, > itemtype => undef, >+ has_priority => undef, > rule_name => 'lostreturn', > rule_value => 'refund' > } >@@ -2819,6 +2821,7 @@ subtest 'AddReturn | is_overdue' => sub { > branchcode => $branchcode_restore, > categorycode => undef, > itemtype => undef, >+ has_priority => undef, > rule_name => 'lostreturn', > rule_value => 'restore' > } >@@ -2833,6 +2836,7 @@ subtest 'AddReturn | is_overdue' => sub { > branchcode => $branchcode_charge, > categorycode => undef, > itemtype => undef, >+ has_priority => undef, > rule_name => 'lostreturn', > rule_value => 'charge' > } >-- >2.24.1 (Apple Git-126)
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 8137
:
9705
|
9706
|
11079
|
64703
|
64704
|
64791
|
64891
|
72831
|
72832
|
107207
|
107208
|
107209
|
107459
|
111368
|
111369
|
111370
|
112640
|
113797
|
113882
|
114531
|
114532
|
114533
|
114534
|
116676
|
116677
|
116678
|
116679
|
116680
|
145476
|
145477
|
145478
|
145479
|
145480
|
152040
|
152041
|
152042
|
152043
|
152044
|
152045
|
156316
|
156317
|
156318
|
156319
|
156320
|
156321
|
156322
|
159712
|
162367
|
167208
|
167923
|
168119
|
169084
|
169696
|
169700
|
169727
|
169927
|
169928
|
170411
|
173605
|
173608
|
175837
|
175838
|
177464