Bugzilla – Attachment 131819 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: Exclude itemtypes from UpdateNotForLoanStatusOnCheckin
Bug-25560-Exclude-itemtypes-from-UpdateNotForLoanS.patch (text/plain), 5.50 KB, created by
Alex Buckley
on 2022-03-16 23:56:48 UTC
(
hide
)
Description:
Bug 25560: Exclude itemtypes from UpdateNotForLoanStatusOnCheckin
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2022-03-16 23:56:48 UTC
Size:
5.50 KB
patch
obsolete
>From 5aef107aa9a8a3163cc88891168a4a7eddc9b116 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Thu, 21 May 2020 23:56:15 +0000 >Subject: [PATCH] Bug 25560: Exclude itemtypes from > UpdateNotForLoanStatusOnCheckin > >Adds a boolean flag itemtypes.updatenotforloanstatusoncheckin, enabled by default. >When disabled (if the UpdateNoForLoanStatusOnCheckin syspref is >configured) when an item of the type if checked in the notforloan status >does not update. > >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. Paste into UpdateNotForLoanStatusOnCheckin syspref > 0 : 1 >2. Issue and return an item and observe the item's notforloan status updates >3. Apply patch & update database >cd installer/data/mysql >sudo koha-shell <instancename> >./updatedatabase.pl >4. Restart plack >5. Go to BK (Book) item type page (Administration > Item types > BK). >6. Observe the 'Update not for loan status on check-in' checkbox is >selected by default. Untick it. >7. Make sure the 'item-level_itypes' syspref is set to 'specific item' >8. Issue and return a BK item (item level itype='BK') and observe item's >notforloan status does not update >9. Issue and return a CR (Continuing Resources) item (item level >itype='CR') and observe the item's notforloan status updates > >10. Change 'item-level_itypes' syspref to 'bibliographic record' >11. Issue and return an item (with biblio-level itemtype='BK' & >item-level itype='CR') and observe the item's notforloan status does not >update >12. Issue and return an item (with biblio-level itemtype='CR' & >item-level itype='BK') and observe the item's notforloan status >updates > >Sponsored-By: Waikato Institute of Technology, NZ > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/Circulation.pm | 32 ++++++++++++++++++-------------- > admin/itemtypes.pl | 3 +++ > 2 files changed, 21 insertions(+), 14 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index bbddb00fb9..c40d4db0c0 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2013,20 +2013,24 @@ sub AddReturn { > } > } > >- my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); >- if ($yaml) { >- $yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt >- my $rules; >- eval { $rules = YAML::XS::Load(Encode::encode_utf8($yaml)); }; >- if ($@) { >- 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 }); >- last; >+ # check if the item should have it's notforloan status changed >+ my $itemtype_object = Koha::ItemTypes->find( $itemtype ); >+ if ( defined $itemtype_object && $itemtype_object->updatenotforloan ) { >+ my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); >+ if ($yaml) { >+ $yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt >+ my $rules; >+ eval { $rules = YAML::XS::Load(Encode::encode_utf8($yaml)); }; >+ if ($@) { >+ 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 }); >+ last; >+ } > } > } > } >diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl >index 44e9ad5445..00c2999e73 100755 >--- a/admin/itemtypes.pl >+++ b/admin/itemtypes.pl >@@ -94,6 +94,7 @@ if ( $op eq 'add_form' ) { > my $checkinmsg = $input->param('checkinmsg'); > my $checkinmsgtype = $input->param('checkinmsgtype'); > my $hideinopac = $input->param('hideinopac') // 0; >+ my $updatenotforloan = $input->param('updatenotforloan') // 0; > my $searchcategory = $input->param('searchcategory'); > my $rentalcharge_daily_calendar = $input->param('rentalcharge_daily_calendar') // 0; > my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0; >@@ -114,6 +115,7 @@ if ( $op eq 'add_form' ) { > $itemtype->checkinmsgtype($checkinmsgtype); > $itemtype->sip_media_type($sip_media_type); > $itemtype->hideinopac($hideinopac); >+ $itemtype->updatenotforloan($updatenotforloan); > $itemtype->searchcategory($searchcategory); > $itemtype->rentalcharge_daily_calendar($rentalcharge_daily_calendar); > $itemtype->rentalcharge_hourly_calendar($rentalcharge_hourly_calendar); >@@ -147,6 +149,7 @@ if ( $op eq 'add_form' ) { > checkinmsgtype => $checkinmsgtype, > sip_media_type => $sip_media_type, > hideinopac => $hideinopac, >+ updatenotforloan => $updatenotforloan, > searchcategory => $searchcategory, > rentalcharge_daily_calendar => $rentalcharge_daily_calendar, > rentalcharge_hourly_calendar => $rentalcharge_hourly_calendar, >-- >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