From 0a57a45cd71543136cf02e427df96512a45b81b6 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 | 15 +++++++++++++++ .../en/modules/admin/preferences/circulation.pref | 12 ++++++++++-- .../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 f15d4ce..0b4d355 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -104,7 +104,6 @@ for (@failedreturns) { $return_failed{$_} = 1; } my $findborrower = $query->param('findborrower'); $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'); +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 = ''; } @@ -716,6 +724,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 178ff40..d71f397 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -326,7 +326,7 @@ 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 ('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|ClearAndPrin','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'); @@ -386,3 +386,4 @@ INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidy INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdidyoumean',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'); INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer'); +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 fb389da..dad9b03 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6002,6 +6002,21 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.09.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; + print "REST IS (@result)\n"; + + # 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 91eb1ac..f28aef8 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 @@ -121,6 +122,13 @@ Circulation: yes: Export no: "Don't export" - fields for csv or iso2709 export + - + - 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: - - pref: AllowNotForLoanOverride 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 652cbf8..9429619 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -54,12 +54,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"); @@ -574,6 +585,7 @@ No patron matched [% message %] [% END %] + [% IF ( SpecifyDueDate ) %]
Specify due date [% INCLUDE 'date-format.inc' %]:
-- 1.7.4.1