From 9bc0c11225b7f6c69f5a5e85695151271e5348bc Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Tue, 8 May 2012 10:32:51 +1200 Subject: [PATCH] Bug 8058 allow empty barcode in circulation to redirect to pay fines screen Also adds the option for printing the quickslip and then clearing the screen. --- circ/circulation.pl | 11 ++++++++++- installer/data/mysql/sysprefs.sql | 3 ++- installer/data/mysql/updatedatabase.pl | 14 ++++++++++++++ .../en/modules/admin/preferences/circulation.pref | 13 +++++++++++-- .../prog/en/modules/circ/circulation.tt | 18 +++++++++++++++--- 5 files changed, 52 insertions(+), 7 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index bdf0362..46f9777 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -104,7 +104,6 @@ for (@failedreturns) { $return_failed{$_} = 1; } my $findborrower = $query->param('findborrower') || q{}; $findborrower =~ s|,| |g; my $borrowernumber = $query->param('borrowernumber'); - $branch = C4::Context->userenv->{'branch'}; $printer = C4::Context->userenv->{'branchprinter'}; @@ -132,6 +131,7 @@ my $issueconfirmed = $query->param('issueconfirmed'); my $cancelreserve = $query->param('cancelreserve'); my $organisation = $query->param('organisations'); my $print = $query->param('print') || q{}; +my $finesredirect = $query->param('finesredirect'); my $newexpiry = $query->param('dateexpiry'); my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice @@ -180,6 +180,14 @@ if ( $print eq 'yes' && $borrowernumber ne '' ) { NetworkPrint($letter->{content}); } $query->param( 'borrowernumber', '' ); +} + +if ( $finesredirect && $borrowernumber ne '' && $barcode eq '' ){ + print $query->redirect("/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber"); +} + +# this was initially inside the previous if with the same conditions but was interfering with $finesredirect +if ( $print eq 'yes' && $borrowernumber ne '' ) { $borrowernumber = ''; } @@ -712,6 +720,7 @@ $template->param( activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), + CircPayFinesRedirect => (C4::Context->preference('CircPayFinesRedirect') ? $total > 0 : 0 ), ); # save stickyduedate to session diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ca9b6bd..2651d6e 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -327,9 +327,9 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo'); -INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('RentalsInNoissuesCharge', '1', 'Rental charges block checkouts (added to noissuescharge).',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ManInvInNoissuesCharge', '1', 'MANUAL_INV charges block checkouts (added to noissuescharge).',NULL,'YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.','Clear|Print|PrintAndClear','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('TransferWhenCancelAllWaitingHolds','0','Transfer items when cancelling all waiting holds',NULL,'YesNo'); @@ -416,3 +416,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('IntranetNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number staff client searches', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UNIMARCField100Language', 'fre','UNIMARC field 100 default language',NULL,'short'); INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('Persona',0,'Use Mozilla Persona for login','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CircPayFinesRedirect','0','When an empty barcode is entered into the checkout field will redirect to pay fines page if borrowser has fines to pay (after quickslip if enabled)',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a44e4e8..89103b3 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6438,6 +6438,20 @@ if ( CheckVersion($DBversion) ) { } +$DBversion = "3.11.00.XXX"; +if( C4::Context->preference("Version") < TransformToNum($DBversion) ){ + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CircPayFinesRedirect',' 0','When an empty barcode is entered into the checkout field will redirect to pay fines page if borrowser has fines to pay (after quickslip if enabled)',NULL,'YesNo')"); + + my $sth = $dbh->prepare("SELECT value FROM systempreferences WHERE variable='CircAutoPrintQuickSlip'"); + $sth->execute; + my @result = $sth->fetchrow_array; + + # a value of 1 maps to the new value of 'Print', a value of 0 maps to the new value 'Clear' + $dbh->do("UPDATE systempreferences SET type='Choice', options='Clear|Print|PrintAndClear', value=? WHERE variable='CircAutoPrintQuickSlip'", undef, ($result[0] ? 'Print' : 'Clear') ); + print "Upgrade to $DBversion done (added syspref CircPayFinesRedirect and updated CircAutoPrintQuickSlip)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) 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 82c1c02..eb6a35f 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 @@ -101,8 +101,9 @@ Circulation: - When an empty barcode field is submitted in circulation - pref: CircAutoPrintQuickSlip choices: - yes: "open a print quick slip window" - no: "clear the screen" + Print: "open a print quick slip window" + Clear: "clear the screen" + PrintAndClear: "open a print quick slip window and clear the screen" - . - - Include the stylesheet at @@ -123,6 +124,14 @@ Circulation: - The following fields should be excluded from the patron checkout history CSV or iso2709 export - pref: ExportRemoveFields - (separate fields with space, e.g. 100a 200b 300c) + - + + - When an empty barcode field is submitted in circulation and a patron has outstanding fines + - pref: CircPayFinesRedirect + choices: + yes: "Redirect to pay to fines screen" + no: "do nothing" + - . Checkout Policy: - 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 39548f8..70ba21f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -55,12 +55,23 @@ $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show(); } } ).attr( 'checked', false ); - [% END %][% IF ( CircAutoPrintQuickSlip ) %] + [% END %] + + [% IF ( CircAutoPrintQuickSlip != 'Clear') %] // listen submit to trigger qslip on empty checkout $('#mainform').bind('submit',function() { if ($('#barcode').val() == '') { - return printx_window('qslip'); } - });[% END %] + [% IF CircAutoPrintQuickSlip == 'PrintAndClear' || CircPayFinesRedirect %] + /* if we want to continue submitting the form, needed for redirect (return false will stop this) */ + printx_window('qslip'); + [% ELSE %] + /* show quick slip window and do not redirect or clear screen */ + return printx_window('qslip'); + [% END %] + } + }); + [% END %] + var allcheckboxes = $(".checkboxed"); @@ -572,6 +583,7 @@ No patron matched [% message %] [% END %] + [% IF ( SpecifyDueDate ) %]
Specify due date [% INCLUDE 'date-format.inc' %]:
-- 1.7.10.4