Bugzilla – Attachment 87742 Details for
Bug 17171
Add a syspref to allow currently issued items to be issued to a new patron without staff confirmation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17171: Add a syspref to allow currently issued items to be issued to a new patron without staff confirmation
Bug-17171-Add-a-syspref-to-allow-currently-issued-.patch (text/plain), 9.44 KB, created by
Katrin Fischer
on 2019-04-10 22:55:04 UTC
(
hide
)
Description:
Bug 17171: Add a syspref to allow currently issued items to be issued to a new patron without staff confirmation
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2019-04-10 22:55:04 UTC
Size:
9.44 KB
patch
obsolete
>From 7e05999c9bbdca557b5b6d03e17819cadf5767cd Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Sun, 11 Jun 2017 09:10:17 +0000 >Subject: [PATCH] Bug 17171: Add a syspref to allow currently issued items to > be issued to a new patron without staff confirmation > >Some libraries don't want to force the librarians to manually confirm >each checkout when the item is checked out to another. Instead, they >would prefer to be alerted after the fact. > >Test Plan: >1) Apply this patch >2) Run updatedatabase.pl >3) Enable the new syspref AutoReturnCheckedOutItems >4) Check an item out to a patron >5) Check the same item out to another patron >6) Note you are not prompted to confirm the checkout, > but are instead alerted that is had been checked out to another patron! > >Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org> >Signed-off-by: BWS Sandboxes <ByWaterSandboxes@gmail.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Circulation.pm | 4 ++ > installer/data/mysql/atomicupdate/bug_17171.perl | 10 ++++ > installer/data/mysql/sysprefs.sql | 1 + > .../en/modules/admin/preferences/circulation.pref | 6 +++ > .../prog/en/modules/circ/circulation.tt | 4 ++ > t/db_dependent/Circulation.t | 62 +++++++++++++++++++++- > 6 files changed, 86 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_17171.perl > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index cf4077db11..13f25bf2fb 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -886,11 +886,15 @@ sub CanBookBeIssued { > $issuingimpossible{RETURN_IMPOSSIBLE} = 1; > $issuingimpossible{branch_to_return} = $message; > } else { >+ if ( C4::Context->preference('AutoReturnCheckedOutItems') ) { >+ $alerts{RETURNED_FROM_ANOTHER} = { patron => $patron }; >+ } else { > $needsconfirmation{ISSUED_TO_ANOTHER} = 1; > $needsconfirmation{issued_firstname} = $patron->firstname; > $needsconfirmation{issued_surname} = $patron->surname; > $needsconfirmation{issued_cardnumber} = $patron->cardnumber; > $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber; >+ } > } > } > >diff --git a/installer/data/mysql/atomicupdate/bug_17171.perl b/installer/data/mysql/atomicupdate/bug_17171.perl >new file mode 100644 >index 0000000000..c1a6fe3cf2 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_17171.perl >@@ -0,0 +1,10 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{ >+ INSERT IGNORE INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES >+ ('AutoReturnCheckedOutItems', '0', '', 'If disabled, librarian must confirm return of checked out item when checking out to another.', 'YesNo'); >+ }); >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 17171 - Add a syspref to allow currently issued items to be issued to a new patron without staff confirmation)\n"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 0a983e35ef..777d11746a 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -72,6 +72,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('autoMemberNum','0','','If ON, patron number is auto-calculated','YesNo'), > ('AutoRemoveOverduesRestrictions','0',NULL,'Defines whether an OVERDUES debarment should be lifted automatically if all overdue items are returned by the patron.','YesNo'), > ('AutoResumeSuspendedHolds','1',NULL,'Allow suspended holds to be automatically resumed by a set date.','YesNo'), >+('AutoReturnCheckedOutItems', '0', '', 'If disabled, librarian must confirm return of checked out item when checking out to another.', 'YesNo'), > ('AutoSelfCheckAllowed','0','','For corporate and special libraries which want web-based self-check available from any PC without the need for a manual staff login. Most libraries will want to leave this turned off. If on, requires self-check ID and password to be entered in AutoSelfCheckID and AutoSelfCheckPass sysprefs.','YesNo'), > ('AutoSelfCheckID','','','Staff ID with circulation rights to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'), > ('AutoSelfCheckPass','','','Password to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'), >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 9720430bf3..58ec152850 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 >@@ -168,6 +168,12 @@ Circulation: > > Checkout Policy: > - >+ - pref: AutoReturnCheckedOutItems >+ choices: >+ yes: Don't >+ no: Do >+ - require librarians to manually confirm a checkout where the item is already checked out to another patron. >+ - > - pref: AllowTooManyOverride > choices: > yes: Allow >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 5490ea64f6..52ba77c2e2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -74,6 +74,10 @@ > <div class="dialog message">High demand item. <b>Loan period was not shortened due to override.</b> Shortened due date would have been [% alert.HIGHHOLDS.returndate | $KohaDates %] ([% alert.HIGHHOLDS.duration | html %] days).</div> > [% END %] > >+[% IF alert.RETURNED_FROM_ANOTHER %] >+ <div class="dialog alert">Item was checked out to [% alert.RETURNED_FROM_ANOTHER.patron.firstname %] [% alert.RETURNED_FROM_ANOTHER.patron.surname %] ([% alert.RETURNED_FROM_ANOTHER.patron.cardnumber %]) and was returned automatically.</div> >+[% END %] >+ > [% IF ( nopermission ) %] > <div class="dialog alert">Staff members are not allowed to discharge borrowers, nor borrowers to request a discharge.</div> > [% END %] >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 9dac067f77..88f9519953 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 125; >+use Test::More tests => 126; > use Test::MockModule; > > use Data::Dumper; >@@ -105,6 +105,8 @@ my $borrower = { > branchcode => $library2->{branchcode} > }; > >+t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); >+ > # No userenv, PickupLibrary > t::lib::Mocks::mock_preference('IndependentBranches', '0'); > t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary'); >@@ -1904,6 +1906,64 @@ subtest 'AddReturn + suspension_chargeperiod' => sub { > ); > }; > >+subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub { >+ plan tests => 2; >+ >+ my $library = $builder->build( { source => 'Branch' } ); >+ my $patron1 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $library->{branchcode}, >+ firstname => "Happy", >+ surname => "Gilmore", >+ } >+ } >+ ); >+ my $patron2 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $library->{branchcode}, >+ firstname => "Billy", >+ surname => "Madison", >+ } >+ } >+ ); >+ >+ C4::Context->_new_userenv('xxx'); >+ C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Random Library', '', '', ''); >+ >+ my $biblioitem = $builder->build( { source => 'Biblioitem' } ); >+ my $biblionumber = $biblioitem->{biblionumber}; >+ my $item = $builder->build( >+ { source => 'Item', >+ value => { >+ homebranch => $library->{branchcode}, >+ holdingbranch => $library->{branchcode}, >+ notforloan => 0, >+ itemlost => 0, >+ withdrawn => 0, >+ biblionumber => $biblionumber, >+ } >+ } >+ ); >+ >+ my ( $error, $question, $alerts ); >+ my $issue = AddIssue( $patron1->unblessed, $item->{barcode} ); >+ >+ t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); >+ ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} ); >+ is( $question->{ISSUED_TO_ANOTHER}, 1, 'ISSUED_TO_ANOTHER question flag should be set if AutoReturnCheckedOutItems is disabled and item is checked out to another' ); >+ >+ t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 1); >+ ( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} ); >+ is( $alerts->{RETURNED_FROM_ANOTHER}->{patron}->borrowernumber, $patron1->borrowernumber, 'RETURNED_FROM_ANOTHER alert flag should be set if AutoReturnCheckedOutItems is enabled and item is checked out to another' ); >+ >+ t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); >+}; >+ >+ > subtest 'AddReturn | is_overdue' => sub { > plan tests => 5; > >-- >2.11.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 17171
:
64260
|
65924
|
65925
|
70766
|
73258
|
73315
|
87302
|
87303
|
87304
| 87742 |
87743
|
87744
|
87745