Bugzilla – Attachment 132554 Details for
Bug 30407
Add ability to syspref UpdateNotForLoanStatusOnCheckin to show only the notforloan values description
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30407: Add ability to syspref UpdateNotForLoanStatusOnCheckin to show only the notforloan values description
0001-Bug-30407-Add-ability-to-syspref-UpdateNotForLoanSta.patch (text/plain), 9.81 KB, created by
Emmi Takkinen
on 2022-03-30 10:32:43 UTC
(
hide
)
Description:
Bug 30407: Add ability to syspref UpdateNotForLoanStatusOnCheckin to show only the notforloan values description
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2022-03-30 10:32:43 UTC
Size:
9.81 KB
patch
obsolete
>From 4ff25389bc11710076a0741b2207f0520e213d7f Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Wed, 30 Mar 2022 11:58:46 +0300 >Subject: [PATCH] Bug 30407: Add ability to syspref > UpdateNotForLoanStatusOnCheckin to show only the notforloan values > description > >This can be used to instruct staff how the item should handled when >it's checked in. For example items notforloan status has been >changed as "Invoiced item" while item has been on loan. When it's >checked in staff sees that they should put item aside for further >processing. > >To test: >1. Apply patch and update database if needed >2. Set items notforloan status as -1 (or create new one) >3. Add line "-1: ONLYMESSAGE" to UpdateNotForLoanStatusOnCheckin >4. Check item out for patron. >5. Check item in. >=> Description of notforloan status should be displayed. >=> Confirm notforloan status hasn't changed. > >Also prove t/db_dependent/Circulation/issue.t > >Sponsored-by: Koha-Suomi Oy >--- > C4/Circulation.pm | 2 +- > installer/data/mysql/atomicupdate/bug_30407.pl | 13 +++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 2 +- > .../en/modules/admin/preferences/circulation.pref | 1 + > .../intranet-tmpl/prog/en/modules/circ/returns.tt | 4 ++++ > t/db_dependent/Circulation/issue.t | 8 +++++++- > 6 files changed, 27 insertions(+), 3 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_30407.pl > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index c6baf4892f..a8a04b06e1 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2131,7 +2131,7 @@ sub AddReturn { > 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 }); >+ $item->notforloan($rules->{$key})->store({ log_action => 0, skip_record_index => 1 }) unless $rules->{$key} eq 'ONLYMESSAGE'; > last; > } > } >diff --git a/installer/data/mysql/atomicupdate/bug_30407.pl b/installer/data/mysql/atomicupdate/bug_30407.pl >new file mode 100755 >index 0000000000..c8b875d24b >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_30407.pl >@@ -0,0 +1,13 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "30407", >+ description => "Add ability to syspref UpdateNotForLoanStatusOnCheckin to show only the notforloan values message", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ # Do you stuffs here >+ $dbh->do(q{UPDATE IGNORE systempreferences SET explanation = "This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan. Can be used for showing only the not for loan message E.g. '-1: ONLYMESSAGE'. Each pair of values should be on a separate line." WHERE variable = "UpdateNotForLoanStatusOnCheckin"}); >+ say $out "Update is going well so far"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 94e2463434..efb64bb25d 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -695,7 +695,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('UnseenRenewals','0','','Allow renewals to be recorded as "unseen" by the library, and count against the patrons unseen renewals limit.','YesNo'), > ('UnsubscribeReflectionDelay','',NULL,'Delay for locking unsubscribers', 'Integer'), > ('UpdateItemLocationOnCheckin', '', 'NULL', 'This is a list of value pairs.\n Examples:\n\nPROC: FIC - causes an item in the Processing Center location to be updated into the Fiction location on check in.\nFIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check in.\n_BLANK_:FIC - causes an item that has no location to be updated into the Fiction location on check in.\nFIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check in.\n_ALL_:FIC - causes all items to be updated into the Fiction location on check in.\nPROC: _PERM_ - causes an item that is in the Processing Center to be updated to it''s permanent location.\n\nGeneral rule: if the location value on the left matches the item''s current location, it will be updated to match the location value on the right.\nNote: PROC and CART are special values, for these locations only can location and permanent_location differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.\n\nThe special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no location assigned.\nThe special term _ALL_ is used on the left side of the colon (:) to affect all items.\nThe special term _PERM_ is used on the right side of the colon (:) to return items to their permanent location.', 'Free'), >-('UpdateNotForLoanStatusOnCheckin', '', 'NULL', 'This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. ''-1: 0'' will cause an item that was set to ''Ordered'' to now be available for loan. Each pair of values should be on a separate line.', 'Free'), >+('UpdateNotForLoanStatusOnCheckin', '', 'NULL', 'This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan. Can be used for showing only the not for loan message E.g. '-1: ONLYMESSAGE'. Each pair of values should be on a separate line.', 'Free'), > ('UpdateTotalIssuesOnCirc','0',NULL,'Whether to update the totalissues field in the biblio on each circ.','YesNo'), > ('UploadPurgeTemporaryFilesDays','',NULL,'If not empty, number of days used when automatically deleting temporary uploads','integer'), > ('uppercasesurnames','0',NULL,'If ON, surnames are converted to upper case in patron entry form','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 3e81898de6..442cd61d01 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -632,6 +632,7 @@ Circulation: > class: code > - This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value > - "it will be updated to the right-hand value. For example, '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan." >+ - "Can be used for showing only the not for loan message E.g. '-1: ONLYMESSAGE'." > - Each pair of values should be on a separate line. > - > - pref: CumulativeRestrictionPeriods >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index 467109cb19..e07d7bd934 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -227,6 +227,9 @@ > [% FOREACH errmsgloo IN errmsgloop %] > [% IF ( errmsgloo.NotForLoanStatusUpdated ) %] > <p class="problem ret_nflupdate"> >+ [% IF errmsgloo.NotForLoanStatusUpdated.to == 'ONLYMESSAGE' %] >+ [% AuthorisedValues.GetByCode( 'NOT_LOAN', errmsgloo.NotForLoanStatusUpdated.from ) %] >+ [% ELSE %] > Not for loan status updated. > <br />Old value: > [% IF errmsgloo.NotForLoanStatusUpdated.from %] >@@ -244,6 +247,7 @@ > [% ELSE %] > Available for loan. > [% END %] >+ [% END %] > </p> > [% END %] > [% IF ( errmsgloo.ItemLocationUpdated ) %] >diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t >index f953b04dc5..ebd0b7eb5b 100755 >--- a/t/db_dependent/Circulation/issue.t >+++ b/t/db_dependent/Circulation/issue.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 48; >+use Test::More tests => 49; > use DateTime::Duration; > > use t::lib::Mocks; >@@ -409,6 +409,12 @@ AddReturn( 'barcode_3', $branchcode_1 ); > $item = Koha::Items->find( $itemnumber ); > ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} ); > >+t::lib::Mocks::mock_preference( 'UpdateNotForLoanStatusOnCheckin', '1: ONLYMESSAGE' ); >+$item->notforloan(1)->store; >+AddReturn( 'barcode_3', $branchcode_1 ); >+$item = Koha::Items->find( $itemnumber ); >+ok( $item->notforloan eq 1, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 1 with setting "1: ONLYMESSAGE"} ); >+ > my $itemnumber2 = Koha::Item->new( > { > biblionumber => $biblionumber, >-- >2.25.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 30407
:
132554
|
138168
|
138171
|
141211
|
141212
|
141213
|
142724