Bugzilla – Attachment 152925 Details for
Bug 34101
Limit items types that can be checked out via SIP2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34101: Limit items types that can be checked out via SIP2
Bug-34101-Limit-items-types-that-can-be-checked-ou.patch (text/plain), 4.26 KB, created by
Martin Renvoize (ashimema)
on 2023-07-03 10:30:04 UTC
(
hide
)
Description:
Bug 34101: Limit items types that can be checked out via SIP2
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-07-03 10:30:04 UTC
Size:
4.26 KB
patch
obsolete
>From eff7f4bccb7a88c49828e4ebfac7a297b4da24e8 Mon Sep 17 00:00:00 2001 >From: Sam Lau <samalau@gmail.com> >Date: Tue, 27 Jun 2023 22:10:32 +0000 >Subject: [PATCH] Bug 34101: Limit items types that can be checked out via SIP2 > >This bug adds the ability to define a list of item types that are blocked from being issued at that SIP account > >To test: >1) Apply this patch >2) Visit Administration->Item types and select edit on the music item type >3) Make the rental charge 0 and save changes (this allows for the item to be checked out via SIP) >4) In the terminal, vim /etc/koha/sites/kohadev/SIPconfig.xml >5) Edit the term1 account and add the following *inside* the login section: > blocked_item_types="BK|MU" > You should have something similar to this: <login id ="term1" ........... checked_in_ok="1" blocked_item_types="BK|MU" /> >6) Restart SIP (sudo koha-sip --restart <instancename>) >7) Run a checkout query for an item with the item type book. Here is an example you could use: > perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529001000463 --item 39999000011418-m checkout >8) Notice the checkout failed and you are given the screen msg "Item type cannot be checked out at this checkout location" >9) Run a checkout query for an item with the item type music. Here is an example you could use: > perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529001000463 --item 39999000008715 -m checkout >10) Notice the checkout failed and you are given the screen msg "Item type cannot be checked out at this checkout location" >11) vim /etc/koha/sites/kohadev/SIPconfig.xml and delete the BK from the blocked_item >12) Delete the BK from blocked_item_types. It should now look like : > blocked_item_types="MU" >13) Restart SIP (sudo koha-sip --restart <instancename>) >14) Run a checkout query for the item with the item type book > perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529001000463 --item 39999000011418 -m checkout >15) Checkout succesful >16) Run a checkout query for the item with the item type music > perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529001000463 --item 39999000008715 -m checkout >17) Still fails (because it is blocked) >18) prove t/db_dependent/SIP/Message.t >19) Congratulate yourself for making it through the long test and sign-off :) > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/SIP/ILS.pm | 7 +++++++ > etc/SIPconfig.xml | 1 + > 2 files changed, 8 insertions(+) > >diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm >index e6ff28cf5b..0c58b07f15 100644 >--- a/C4/SIP/ILS.pm >+++ b/C4/SIP/ILS.pm >@@ -124,6 +124,10 @@ sub offline_ok { > sub checkout { > my ( $self, $patron_id, $item_id, $sc_renew, $fee_ack, $account, $no_block_due_date ) = @_; > my ( $patron, $item, $circ ); >+ my @blocked_item_types; >+ if (defined $account->{blocked_item_types}) { >+ @blocked_item_types = split /\|/, $account->{blocked_item_types}; >+ } > $circ = C4::SIP::ILS::Transaction::Checkout->new(); > # BEGIN TRANSACTION > $circ->patron( $patron = C4::SIP::ILS::Patron->new($patron_id) ); >@@ -161,6 +165,9 @@ sub checkout { > { > $circ->screen_msg("Item checked out to another patron"); > } >+ elsif (grep { $_ eq $item->{itemtype} } @blocked_item_types) { >+ $circ->screen_msg("Item type cannot be checked out at this checkout location"); >+ } > else { > $circ->do_checkout($account, $no_block_due_date); > if ( $circ->ok ) { >diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml >index d17e2ff94b..5264c2674c 100644 >--- a/etc/SIPconfig.xml >+++ b/etc/SIPconfig.xml >@@ -78,6 +78,7 @@ > format_due_date="0" > inhouse_item_types="" > inhouse_patron_categories="" >+ blocked_item_types="VM|MU" > seen_on_item_information="mark_found"> <!-- could be "keep_lost", empty to disable --> > <!-- lost_block_checkout sets flag if patron has more than the given current checkouts that are lost ( itemlost > 0 by default ) --> > <!-- lost_block_checkout_value determines the minimum lost item value to count ( that is, the value in items.itemlost ) --> >-- >2.41.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 34101
:
152773
|
152774
|
152798
|
152799
|
152924
| 152925