Bugzilla – Attachment 103358 Details for
Bug 25089
Add checkout_type to circulation rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25089: Add checkout_type to get_effective_rule
Bug-25089-Add-checkouttype-to-geteffectiverule.patch (text/plain), 27.25 KB, created by
Lari Taskula
on 2020-04-21 10:51:57 UTC
(
hide
)
Description:
Bug 25089: Add checkout_type to get_effective_rule
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2020-04-21 10:51:57 UTC
Size:
27.25 KB
patch
obsolete
>From c75ea5e3262edeb6a480192bbe188bdd2e51aca4 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Wed, 8 Apr 2020 19:10:32 +0000 >Subject: [PATCH] Bug 25089: Add checkout_type to get_effective_rule > >To test: >1. Find all occurrences of get_effective_rule that are missing > checkout_type where required > >grep --exclude-dir '.git' --exclude-dir 'misc/translator' \ >--exclude-dir 'koha-tmpl' \ >-Przo '(?s)(::|->)get_effective_rule(?!s).*?\)' | \ >grep -avz 'checkout_type' | \ >grep -Pavz 'hold|reserves|article_requests' && echo "" > > The only occasions this should return anything are cases where > a HASH or HASHref is given to get_effective_rule(), or that we > are explicitly testing missing parameters in an unit test. > > 1.2 Verify the HASH/HASHref cases. The hash should contain > a checkout_type (unless the rule is related to holds) > > 1.3 Verify the other cases. If you find another result than > what is mentioned above, then this test fails. > >2. Find all subroutines using get_effective_rule() > >git grep --no-index -n -p -P 'get_effective_rule\s*\(' \ >| grep -v 'sub {' | grep -P 'sub .*' > > This list should be returned: > > C4/Circulation.pm=376=sub TooMany { > C4/Circulation.pm=1300=sub AddIssue { > C4/Circulation.pm=1633=sub GetBranchBorrowerCircRule { > C4/Circulation.pm=1689=sub GetBranchItemRule { > C4/Circulation.pm=3030=sub GetRenewCount { > C4/Reserves.pm=348=sub CanItemBeReserved { > C4/Reserves.pm=2230=sub GetHoldRule { > Koha/Biblio.pm=294=sub article_request_type_for_bib { > Koha/Charges/Fees.pm=98=sub accumulate_rentalcharge { > Koha/CirculationRules.pm=218=sub get_effective_rules { > Koha/CirculationRules.pm=390=sub get_opacitemholds_policy { > Koha/CirculationRules.pm=416=sub get_onshelfholds_policy { > Koha/Item.pm=571=sub article_request_type { > Koha/REST/V1/Checkouts.pm=192=sub allows_renewal { > Koha/Template/Plugin/CirculationRules.pm=26=sub Get { > > Check these subroutines and make sure they are using > get_effective_rule() with the new scope, unless not needed. > When fetching a hold-related rules, checkout_type is not needed. > > These subroutines and classes need changes to sub params: > > 2.1. Check modifications to Koha::Charges::Fees > 2.2. Check modification made to C4::Circulation::_debar_user_on_return(). > 2.3. Check modification made to C4::Circulation::_calculate_new_debar_dt(). > >3. Find all occurrences of get_effective_rule with the following command: > grep --exclude-dir='.git' -Prn 'get_effective_rule(?!s)' > > Make sure all matches (where rule scope allows checkout_type) are > updated. > >Sponsored-by: The National Library of Finland >--- > C4/Circulation.pm | 33 +++++++++---- > Koha/Charges/Fees.pm | 30 ++++++++++++ > Koha/REST/V1/Checkouts.pm | 1 + > Koha/Template/Plugin/CirculationRules.pm | 8 +++- > .../swagger/definitions/circ-rule-kind.json | 2 +- > .../IssuingRules/maxsuspensiondays.t | 6 ++- > t/db_dependent/Koha/Charges/Fees.t | 18 ++++++- > t/db_dependent/Koha/IssuingRules.t | 47 ++++++++++++++++--- > 8 files changed, 123 insertions(+), 22 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index acc1f14786..38662f993f 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -391,13 +391,14 @@ sub TooMany { > : $Koha::Checkouts::type->{onsite_checkout} > : $Koha::Checkouts::type->{checkout}; > >- # given branch, patron category, and item type, determine >+ # given branch, patron category, item type, and checkout type, determine > # applicable issuing rule > my $maxissueqty_rule = Koha::CirculationRules->get_effective_rule( > { > categorycode => $cat_borrower, > itemtype => $type, > branchcode => $branch, >+ checkout_type => $checkout_type, > rule_name => 'maxissueqty', > } > ); >@@ -676,6 +677,9 @@ sub CanBookBeIssued { > my $onsite_checkout = $params->{onsite_checkout} || 0; > my $override_high_holds = $params->{override_high_holds} || 0; > >+ my $checkout_type = $onsite_checkout >+ ? $Koha::Checkouts::type->{onsite_checkout} >+ : $Koha::Checkouts::type->{checkout}; > my $item_object = Koha::Items->find({barcode => $barcode }); > > # MANDATORY CHECKS - unless item exists, nothing else matters >@@ -1301,6 +1305,11 @@ sub AddIssue { > my $auto_renew = $params && $params->{auto_renew}; > my $dbh = C4::Context->dbh; > my $barcodecheck = CheckValidBarcode($barcode); >+ my $checkout_type = $onsite_checkout >+ ? $switch_onsite_checkout >+ ? $Koha::Checkouts::type->{checkout} >+ : $Koha::Checkouts::type->{onsite_checkout} >+ : $Koha::Checkouts::type->{checkout}; > > my $issue; > >@@ -1357,6 +1366,7 @@ sub AddIssue { > patron => $patron, > library => $library, > item => $item_object, >+ checkout_type => $checkout_type, > to_date => $datedue, > } > ); >@@ -1394,6 +1404,7 @@ sub AddIssue { > categorycode => $borrower->{categorycode}, > itemtype => $item_object->effective_itemtype, > branchcode => $branchcode, >+ checkout_type => $checkout_type, > rule_name => 'auto_renew' > } > ); >@@ -1414,9 +1425,7 @@ sub AddIssue { > issuedate => $issuedate->strftime('%Y-%m-%d %H:%M:%S'), > date_due => $datedue->strftime('%Y-%m-%d %H:%M:%S'), > branchcode => C4::Context->userenv->{'branch'}, >- checkout_type => $onsite_checkout ? >- $Koha::Checkouts::type->{onsite_checkout} >- : $Koha::Checkouts::type->{checkout}, >+ checkout_type => $checkout_type, > auto_renew => $auto_renew ? 1 : 0, > }; > >@@ -1991,7 +2000,7 @@ sub AddReturn { > > if ( $issue and $issue->is_overdue ) { > # fix fine days >- my ($debardate,$reminder) = _debar_user_on_return( $patron_unblessed, $item->unblessed, dt_from_string($issue->date_due), $return_date ); >+ my ($debardate,$reminder) = _debar_user_on_return( $patron_unblessed, $item->unblessed, $issue->checkout_type, dt_from_string($issue->date_due), $return_date ); > if ($reminder){ > $messages->{'PrevDebarred'} = $debardate; > } else { >@@ -2191,12 +2200,14 @@ sub MarkIssueReturned { > > =head2 _debar_user_on_return > >- _debar_user_on_return($borrower, $item, $datedue, $returndate); >+ _debar_user_on_return($borrower, $item, $checkout_type, $datedue, $returndate); > > C<$borrower> borrower hashref > > C<$item> item hashref > >+C<$checkout_type> One of $Koha::Checkouts::type values >+ > C<$datedue> date due DateTime object > > C<$returndate> DateTime object representing the return time >@@ -2212,7 +2223,7 @@ to ease testing. > =cut > > sub _calculate_new_debar_dt { >- my ( $borrower, $item, $dt_due, $return_date ) = @_; >+ my ( $borrower, $item, $checkout_type, $dt_due, $return_date ) = @_; > > my $branchcode = _GetCircControlBranch( $item, $borrower ); > my $circcontrol = C4::Context->preference('CircControl'); >@@ -2220,6 +2231,7 @@ sub _calculate_new_debar_dt { > { categorycode => $borrower->{categorycode}, > itemtype => $item->{itype}, > branchcode => $branchcode, >+ checkout_type => $checkout_type, > rules => [ > 'finedays', > 'lengthunit', >@@ -2293,11 +2305,11 @@ sub _calculate_new_debar_dt { > } > > sub _debar_user_on_return { >- my ( $borrower, $item, $dt_due, $return_date ) = @_; >+ my ( $borrower, $item, $checkout_type, $dt_due, $return_date ) = @_; > > $return_date //= dt_from_string(); > >- my $new_debar_dt = _calculate_new_debar_dt ($borrower, $item, $dt_due, $return_date); >+ my $new_debar_dt = _calculate_new_debar_dt ($borrower, $item, $checkout_type, $dt_due, $return_date); > > return unless $new_debar_dt; > >@@ -2925,6 +2937,7 @@ sub AddRenewal { > patron => $patron, > library => $circ_library, > item => $item_object, >+ checkout_type => $issue->checkout_type, > from_date => dt_from_string( $issue->date_due, 'sql' ), > to_date => dt_from_string($datedue), > } >@@ -3040,12 +3053,14 @@ sub GetRenewCount { > $renewcount = $data->{'renewals'} if $data->{'renewals'}; > # $item and $borrower should be calculated > my $branchcode = _GetCircControlBranch($item->unblessed, $patron->unblessed); >+ my $checkout_type = $data->{'checkout_type'}; > > my $rule = Koha::CirculationRules->get_effective_rule( > { > categorycode => $patron->categorycode, > itemtype => $item->effective_itemtype, > branchcode => $branchcode, >+ checkout_type => $checkout_type, > rule_name => 'renewalsallowed', > } > ); >diff --git a/Koha/Charges/Fees.pm b/Koha/Charges/Fees.pm >index 7eff76ba79..9770bae6ff 100644 >--- a/Koha/Charges/Fees.pm >+++ b/Koha/Charges/Fees.pm >@@ -22,6 +22,7 @@ use Modern::Perl; > use Carp qw( carp confess ); > > use Koha::Calendar; >+use Koha::Checkouts; > use Koha::DateUtils qw( dt_from_string ); > use Koha::Exceptions; > >@@ -38,6 +39,7 @@ Koha::Charges::Fees->new( > patron => $patron, > library => $library, > item => $item, >+ [ checkout_type => $checkout_type, ] > to_date => $to_dt, > [ from_date => $from_dt, ] > } >@@ -57,12 +59,19 @@ sub new { > Koha::Exceptions::MissingParameter->throw("Missing mandatory parameter: to_date") > unless $params->{to_date}; > >+ $params->{checkout_type} = exists $params->{checkout_type} >+ ? $params->{checkout_type} >+ : $Koha::Checkouts::type->{checkout}; >+ > Carp::confess("Key 'patron' is not a Koha::Patron object!") > unless $params->{patron}->isa('Koha::Patron'); > Carp::confess("Key 'library' is not a Koha::Library object!") > unless $params->{library}->isa('Koha::Library'); > Carp::confess("Key 'item' is not a Koha::Item object!") > unless $params->{item}->isa('Koha::Item'); >+ my @valid_types = values %$Koha::Checkouts::type; >+ Carp::confess("Key 'checkout_type' is not valid! Valid are: " . join(', ', @valid_types)) >+ unless grep { $_ eq $params->{checkout_type} } @valid_types; > Carp::confess("Key 'to_date' is not a DateTime object!") > unless $params->{to_date}->isa('DateTime'); > >@@ -95,6 +104,7 @@ sub accumulate_rentalcharge { > categorycode => $self->patron->categorycode, > itemtype => $itemtype->id, > branchcode => $self->library->id, >+ checkout_type => $self->checkout_type, > rule_name => 'lengthunit', > } > ); >@@ -188,6 +198,26 @@ sub item { > return $self->{item}; > } > >+=head3 checkout_type >+ >+my $item = $fees->checkout_type( $checkout_type ); >+ >+=cut >+ >+sub checkout_type { >+ my ( $self, $checkout_type ) = @_; >+ >+ if ( $checkout_type ) { >+ my @valid_types = values %$Koha::Checkouts::type; >+ Carp::carp("Given 'checkout_type' is not valid! Valid are: " . join(', ', @valid_types)) >+ unless grep { $_ eq $checkout_type } @valid_types; >+ >+ $self->{checkout_type} = $checkout_type if $checkout_type; >+ } >+ >+ return $self->{checkout_type}; >+} >+ > =head3 to_date > > my $to_date = $fees->to_date( $to_date ); >diff --git a/Koha/REST/V1/Checkouts.pm b/Koha/REST/V1/Checkouts.pm >index 3a5f448cc6..1924223091 100644 >--- a/Koha/REST/V1/Checkouts.pm >+++ b/Koha/REST/V1/Checkouts.pm >@@ -213,6 +213,7 @@ sub allows_renewal { > categorycode => $checkout->patron->categorycode, > itemtype => $checkout->item->effective_itemtype, > branchcode => $checkout->branchcode, >+ checkout_type => $checkout->checkout_type, > rule_name => 'renewalsallowed', > } > ); >diff --git a/Koha/Template/Plugin/CirculationRules.pm b/Koha/Template/Plugin/CirculationRules.pm >index e82dce01ed..969e4f6687 100644 >--- a/Koha/Template/Plugin/CirculationRules.pm >+++ b/Koha/Template/Plugin/CirculationRules.pm >@@ -24,17 +24,19 @@ use base qw( Template::Plugin ); > use Koha::CirculationRules; > > sub Get { >- my ( $self, $branchcode, $categorycode, $itemtype, $rule_name ) = @_; >+ my ( $self, $branchcode, $categorycode, $itemtype, $checkout_type, $rule_name ) = @_; > > $branchcode = undef if $branchcode eq q{} or $branchcode eq q{*}; > $categorycode = undef if $categorycode eq q{} or $categorycode eq q{*}; > $itemtype = undef if $itemtype eq q{} or $itemtype eq q{*}; >+ $checkout_type = undef if $checkout_type eq {} or $checkout_type eq q{*}; > > my $rule = Koha::CirculationRules->get_effective_rule( > { > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => $rule_name, > } > ); >@@ -43,17 +45,19 @@ sub Get { > } > > sub Search { >- my ( $self, $branchcode, $categorycode, $itemtype, $rule_name ) = @_; >+ my ( $self, $branchcode, $categorycode, $itemtype, $checkout_type, $rule_name ) = @_; > > $branchcode = undef if $branchcode eq q{} or $branchcode eq q{*}; > $categorycode = undef if $categorycode eq q{} or $categorycode eq q{*}; > $itemtype = undef if $itemtype eq q{} or $itemtype eq q{*}; >+ $checkout_type = undef if $checkout_type eq q{} or $checkout_type eq q{*}; > > my $rule = Koha::CirculationRules->search( > { > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => $rule_name, > } > )->next; >diff --git a/api/v1/swagger/definitions/circ-rule-kind.json b/api/v1/swagger/definitions/circ-rule-kind.json >index 90b956f9f6..4ecc9f00ca 100644 >--- a/api/v1/swagger/definitions/circ-rule-kind.json >+++ b/api/v1/swagger/definitions/circ-rule-kind.json >@@ -6,7 +6,7 @@ > "type": "array", > "items": { > "type": "string", >- "enum": [ "branchcode", "categorycode", "itemtype" ] >+ "enum": [ "branchcode", "categorycode", "itemtype", "checkout_type" ] > } > } > }, >diff --git a/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t b/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t >index 0e51662f04..85bb4819b8 100644 >--- a/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t >+++ b/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t >@@ -33,6 +33,7 @@ Koha::CirculationRules->set_rules( > categorycode => undef, > itemtype => undef, > branchcode => undef, >+ checkout_type => undef, > rules => { > firstremind => 0, > finedays => 2, >@@ -90,6 +91,7 @@ Koha::CirculationRules->set_rules( > categorycode => undef, > itemtype => undef, > branchcode => undef, >+ checkout_type => undef, > rules => { > maxsuspensiondays => 10, > } >@@ -128,7 +130,7 @@ subtest "suspension_chargeperiod" => sub { > > my $last_year = dt_from_string->clone->subtract( years => 1 ); > my $today = dt_from_string; >- my $new_debar_dt = C4::Circulation::_calculate_new_debar_dt( $patron->unblessed, $item->unblessed, $last_year, $today ); >+ my $new_debar_dt = C4::Circulation::_calculate_new_debar_dt( $patron->unblessed, $item->unblessed, undef, $last_year, $today ); > is( $new_debar_dt->truncate( to => 'day' ), > $today->clone->add( days => 365 / 15 * 7 )->truncate( to => 'day' ) ); > >@@ -155,7 +157,7 @@ subtest "maxsuspensiondays" => sub { > > my $last_year = dt_from_string->clone->subtract( years => 1 ); > my $today = dt_from_string; >- my $new_debar_dt = C4::Circulation::_calculate_new_debar_dt( $patron->unblessed, $item->unblessed, $last_year, $today ); >+ my $new_debar_dt = C4::Circulation::_calculate_new_debar_dt( $patron->unblessed, $item->unblessed, undef, $last_year, $today ); > is( $new_debar_dt->truncate( to => 'day' ), > $today->clone->add( days => 333 )->truncate( to => 'day' ) ); > }; >diff --git a/t/db_dependent/Koha/Charges/Fees.t b/t/db_dependent/Koha/Charges/Fees.t >index a204521b9a..c351c906f9 100644 >--- a/t/db_dependent/Koha/Charges/Fees.t >+++ b/t/db_dependent/Koha/Charges/Fees.t >@@ -28,6 +28,7 @@ use t::lib::TestBuilder; > > use Time::Fake; > use C4::Calendar; >+use Koha::Checkouts; > use Koha::DateUtils qw(dt_from_string); > > BEGIN { >@@ -99,7 +100,7 @@ my $dt_from = $now->clone->subtract( days => 2 ); > my $dt_to = $now->clone->add( days => 4 ); > > subtest 'new' => sub { >- plan tests => 9; >+ plan tests => 10; > > # Mandatory parameters missing > throws_ok { >@@ -177,6 +178,18 @@ subtest 'new' => sub { > ) > } > 'dies for bad item'; >+ dies_ok { >+ Koha::Charges::Fees->new( >+ { >+ patron => $patron, >+ library => $library, >+ item => $item, >+ checkout_type => 'NON-EXISTENT-CHECKOUT-TYPE:)', >+ to_date => $dt_to, >+ } >+ ) >+ } >+ 'dies for bad checkout_type'; > dies_ok { > Koha::Charges::Fees->new( > { >@@ -326,6 +339,7 @@ subtest 'accumulate_rentalcharge tests' => sub { > categorycode => $patron->categorycode, > itemtype => $itemtype->id, > branchcode => $library->id, >+ checkout_type => undef, > rules => { > lengthunit => 'days', > } >@@ -387,6 +401,7 @@ subtest 'accumulate_rentalcharge tests' => sub { > categorycode => $patron->categorycode, > itemtype => $itemtype->id, > branchcode => $library->id, >+ checkout_type => undef, > rules => { > lengthunit => 'hours', > } >@@ -403,6 +418,7 @@ subtest 'accumulate_rentalcharge tests' => sub { > patron => $patron, > library => $library, > item => $item, >+ checkout_type => $Koha::Checkouts::type->{checkout}, > to_date => $dt_to, > from_date => $dt_from, > } >diff --git a/t/db_dependent/Koha/IssuingRules.t b/t/db_dependent/Koha/IssuingRules.t >index 40ddb58e12..555042d84f 100644 >--- a/t/db_dependent/Koha/IssuingRules.t >+++ b/t/db_dependent/Koha/IssuingRules.t >@@ -25,6 +25,7 @@ use Test::Exception; > > use Benchmark; > >+use Koha::Checkouts; > use Koha::CirculationRules; > > use t::lib::TestBuilder; >@@ -41,6 +42,7 @@ subtest 'get_effective_issuing_rule' => sub { > my $categorycode = $builder->build({ source => 'Category' })->{'categorycode'}; > my $itemtype = $builder->build({ source => 'Itemtype' })->{'itemtype'}; > my $branchcode = $builder->build({ source => 'Branch' })->{'branchcode'}; >+ my $checkout_type = $Koha::Checkouts::type->{checkout}; > > subtest 'Call with undefined values' => sub { > plan tests => 5; >@@ -54,6 +56,7 @@ subtest 'get_effective_issuing_rule' => sub { > branchcode => undef, > categorycode => undef, > itemtype => undef, >+ checkout_type => undef, > rule_name => 'fine', > rule_value => 1, > }); >@@ -67,6 +70,7 @@ subtest 'get_effective_issuing_rule' => sub { > branchcode => undef, > categorycode => undef, > itemtype => undef, >+ checkout_type => undef, > rule_name => 'fine', > rule_value => 2, > } >@@ -77,6 +81,7 @@ subtest 'get_effective_issuing_rule' => sub { > branchcode => undef, > categorycode => undef, > itemtype => undef, >+ checkout_type => undef, > rule_name => 'fine', > }); > _is_row_match( >@@ -85,6 +90,7 @@ subtest 'get_effective_issuing_rule' => sub { > branchcode => undef, > categorycode => undef, > itemtype => undef, >+ checkout_type => undef, > rule_name => 'fine', > rule_value => 2, > }, >@@ -95,31 +101,44 @@ subtest 'get_effective_issuing_rule' => sub { > }; > > subtest 'Performance' => sub { >- plan tests => 4; >+ plan tests => 5; > > my $worst_case = timethis(500, > sub { Koha::CirculationRules->get_effective_rule({ > branchcode => 'nonexistent', > categorycode => 'nonexistent', > itemtype => 'nonexistent', >+ checkout_type => 'nonexistent', > rule_name => 'nonexistent', > }); > } > ); >- my $mid_case = timethis(500, >+ my $mid_case1 = timethis(500, > sub { Koha::CirculationRules->get_effective_rule({ > branchcode => $branchcode, > categorycode => 'nonexistent', > itemtype => 'nonexistent', >+ checkout_type => 'nonexistent', > rule_name => 'nonexistent', > }); > } > ); >- my $sec_best_case = timethis(500, >+ my $mid_case2 = timethis(500, > sub { Koha::CirculationRules->get_effective_rule({ > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => 'nonexistent', >+ checkout_type => 'nonexistent', >+ rule_name => 'nonexistent', >+ }); >+ } >+ ); >+ my $mid_case3 = timethis(500, >+ sub { Koha::CirculationRules->get_effective_rule({ >+ branchcode => $branchcode, >+ categorycode => $categorycode, >+ itemtype => $itemtype, >+ checkout_type => 'nonexistent', > rule_name => 'nonexistent', > }); > } >@@ -129,6 +148,7 @@ subtest 'get_effective_issuing_rule' => sub { > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => 'nonexistent', > }); > } >@@ -136,11 +156,14 @@ subtest 'get_effective_issuing_rule' => sub { > ok($worst_case, 'In worst case, get_effective_issuing_rule finds matching' > .' rule '.sprintf('%.2f', $worst_case->iters/$worst_case->cpu_a) > .' times per second.'); >- ok($mid_case, 'In mid case, get_effective_issuing_rule finds matching' >- .' rule '.sprintf('%.2f', $mid_case->iters/$mid_case->cpu_a) >+ ok($mid_case1, 'In mid case 1, get_effective_issuing_rule finds matching' >+ .' rule '.sprintf('%.2f', $mid_case1->iters/$mid_case1->cpu_a) >+ .' times per second.'); >+ ok($mid_case2, 'In mid case 2, get_effective_issuing_rule finds matching' >+ .' rule '.sprintf('%.2f', $mid_case2->iters/$mid_case2->cpu_a) > .' times per second.'); >- ok($sec_best_case, 'In second best case, get_effective_issuing_rule finds matching' >- .' rule '.sprintf('%.2f', $sec_best_case->iters/$sec_best_case->cpu_a) >+ ok($mid_case3, 'In mid case 3, get_effective_issuing_rule finds matching' >+ .' rule '.sprintf('%.2f', $mid_case3->iters/$mid_case3->cpu_a) > .' times per second.'); > ok($best_case, 'In best case, get_effective_issuing_rule finds matching' > .' rule '.sprintf('%.2f', $best_case->iters/$best_case->cpu_a) >@@ -292,6 +315,7 @@ subtest 'clone' => sub { > my $branchcode = $builder->build({ source => 'Branch' })->{'branchcode'}; > my $categorycode = $builder->build({ source => 'Category' })->{'categorycode'}; > my $itemtype = $builder->build({ source => 'Itemtype' })->{'itemtype'}; >+ my $checkout_type = $Koha::Checkouts::type->{checkout}; > > subtest 'Clone multiple rules' => sub { > plan tests => 4; >@@ -302,6 +326,7 @@ subtest 'clone' => sub { > branchcode => undef, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => 'fine', > rule_value => 5, > })->store; >@@ -310,6 +335,7 @@ subtest 'clone' => sub { > branchcode => undef, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => 'lengthunit', > rule_value => 'days', > })->store; >@@ -320,12 +346,14 @@ subtest 'clone' => sub { > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => 'fine', > }); > my $rule_lengthunit = Koha::CirculationRules->get_effective_rule({ > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => 'lengthunit', > }); > >@@ -335,6 +363,7 @@ subtest 'clone' => sub { > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => 'fine', > rule_value => 5, > }, >@@ -347,6 +376,7 @@ subtest 'clone' => sub { > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => 'lengthunit', > rule_value => 'days', > }, >@@ -365,6 +395,7 @@ subtest 'clone' => sub { > branchcode => undef, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => 'fine', > rule_value => 5, > })->store; >@@ -376,6 +407,7 @@ subtest 'clone' => sub { > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => 'fine', > }); > >@@ -385,6 +417,7 @@ subtest 'clone' => sub { > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => $itemtype, >+ checkout_type => $checkout_type, > rule_name => 'fine', > rule_value => '5', > }, >-- >2.17.1
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 25089
:
103046
|
103047
|
103048
|
103049
|
103050
|
103051
|
103052
|
103053
|
103054
|
103239
|
103240
|
103241
|
103242
|
103243
|
103244
|
103245
|
103246
|
103247
|
103248
|
103283
|
103284
|
103285
|
103286
|
103287
|
103288
|
103289
|
103290
|
103291
|
103292
|
103339
|
103340
|
103341
|
103342
|
103343
|
103344
|
103345
|
103346
|
103347
|
103348
|
103349
|
103351
|
103352
|
103353
|
103354
|
103355
|
103356
|
103357
|
103358
|
103359
|
103360
|
103361
|
103537
|
103538
|
103539
|
103540
|
103541
|
103542
|
103543
|
103544
|
103545
|
103546
|
103547
|
104274
|
104275
|
107523
|
107524
|
107525
|
107526
|
107527
|
107528
|
107529
|
107530
|
107531
|
107532
|
107533