Bugzilla – Attachment 146558 Details for
Bug 25560
Define itemtype specific rules in the UpdateNotForLoanStatusOnCheckin system preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25560: Define item-type specific rules in UpdateNotForLoanStatusOnCheckin
Bug-25560-Define-item-type-specific-rules-in-Updat.patch (text/plain), 3.76 KB, created by
Alex Buckley
on 2023-02-12 22:57:13 UTC
(
hide
)
Description:
Bug 25560: Define item-type specific rules in UpdateNotForLoanStatusOnCheckin
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2023-02-12 22:57:13 UTC
Size:
3.76 KB
patch
obsolete
>From 3b97d0ff15e83c48a6d4fcf6c082d4508f7c9000 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Tue, 2 Aug 2022 17:05:39 +1200 >Subject: [PATCH] Bug 25560: Define item-type specific rules in > UpdateNotForLoanStatusOnCheckin > >This enhancement respects the 'item-level_itypes' syspref, so will look >at the authoritative item type when determining to update the notforloan >status. > >Test plan: >1. Set -1 to 'Ordered', and 1 to 'Not for Loan' in Administration > Authorised values > NOT_LOAN > >2. Make sure the 'item-level_itypes' syspref is set to 'specific item' > >3. Add the following rules in UpdateNotForLoanStatusOnCheckin system >preference: >-1: 0 > >4. Apply patch & update database >cd installer/data/mysql >sudo koha-shell <instancename> >./updatedatabase.pl > >5. Restart plack > >6. Observe the UpdateNotForLoanStatusOnCheckin syspref values have >updated to the following format: >_ALL_: > -1: 0 > >7. Check in an 'Ordered' item of any item type and confirm it is changed >to 'Available for loan' (NOT_LOAN=0) > >8. Reset the UpdateNotForLoanStatusOnCheckin syspref to: >_ALL_: > -1: 0 > >CD: > -1: 2 > 2: 0 > >9. Check-in an 'ordered' (NOT_LOAN=-1) CD item (item level itype='CD') and observe the item's notforloan status updates to 'Staff collection' (NOT_LOAN=2). This is because the _ALL_ rule does not override all other rules. > >10. Check-in a 'Staff collection' (NOT_LOAN=2) CD item (item level itype='CD') and >observe the item's notforloan status updates to 'Available for loan' >(NOT_LOAN=0) > >11. Check-in a 'Staff collection' (NOT_LOAN=2) DVD item (item level itype='DVD') and observe >the items notforloan status does not change > >12. Check-in an 'ordered' (NOT_LOAN=-1) DVD item (item level itype='DVD') and observe the items notforloan status updates to 'Available for loan' (NOT_LOAN=0) > >Sponsored-By: Waikato Institute of Technology, NZ >--- > C4/Circulation.pm | 20 +++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 6fcd491820..71868e2494 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2153,11 +2153,21 @@ sub AddReturn { > warn "Unable to parse UpdateNotForLoanStatusOnCheckin syspref : $@"; > } > else { >- foreach my $key ( keys %$rules ) { >- if ( $item->notforloan eq $key ) { >- $messages->{'NotForLoanStatusUpdated'} = { from => $item->notforloan, to => $rules->{$key} }; >- $item->notforloan($rules->{$key})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1 }) unless $rules->{$key} eq 'ONLYMESSAGE'; >- last; >+ if ( defined $rules->{$item->itype} ) { >+ foreach my $notloan_rule_key (keys %{ $rules->{$item->itype}} ) { >+ if ( $item->notforloan eq $notloan_rule_key ) { >+ $messages->{'NotForLoanStatusUpdated'} = { from => $item->notforloan, to => $rules->{$item->itype}->{$notloan_rule_key} }; >+ $item->notforloan($rules->{$item->itype}->{$notloan_rule_key})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1 }); >+ last; >+ } >+ } >+ } elsif ( defined $rules->{'_ALL_'} ) { >+ foreach my $notloan_rule_key (keys %{ $rules->{'_ALL_'}} ) { >+ if ( $item->notforloan eq $notloan_rule_key ) { >+ $messages->{'NotForLoanStatusUpdated'} = { from => $item->notforloan, to => $rules->{'_ALL_'}->{$notloan_rule_key} }; >+ $item->notforloan($rules->{'_ALL_'}->{$notloan_rule_key})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1 }); >+ last; >+ } > } > } > } >-- >2.20.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 25560
:
105236
|
105237
|
105238
|
105239
|
105240
|
105241
|
105242
|
105243
|
105244
|
105245
|
109562
|
109563
|
109564
|
109565
|
109566
|
109567
|
112492
|
112887
|
113161
|
113212
|
113213
|
113214
|
113215
|
113216
|
113217
|
131816
|
131817
|
131818
|
131819
|
131820
|
135742
|
135743
|
136079
|
136080
|
136081
|
136082
|
136083
|
136084
|
138494
|
138495
|
138496
|
138497
|
138498
|
138499
|
146556
|
146557
|
146558
|
146559
|
146993
|
148679
|
148680
|
148681
|
148682
|
148683