From cd7af5dc149a4441a28bc7ce7d965f4c3d5704f3 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Sun, 6 May 2012 11:50:43 +1200 Subject: [PATCH] bug8058 Circulation empty barcode field redirect to pay fines screen if borrower has outstanding fines --- circ/circulation.pl | 1 + installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../en/modules/admin/preferences/circulation.pref | 7 +++++++ .../prog/en/modules/circ/circulation.tt | 17 +++++++++++++++-- 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index bcbcb6f..e8d1abf 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -705,6 +705,7 @@ $template->param( fast_cataloging => $fast_cataloging, CircAutoPrintQuickSlip => C4::Context->preference("CircAutoPrintQuickSlip"), activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), + CircPayFinesRedirect => (C4::Context->preference('CircPayFinesRedirect') ? $total : 0), ); # save stickyduedate to session diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 1edf08e..826db02 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -363,3 +363,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SvcMaxReportRows','10','Maximum number of rows to return via the report web service.',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 035e1e6..08806b8 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5239,6 +5239,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.08.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')"); + print "Upgrade to $DBversion done\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 471aa0e..52b37fc 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 @@ -99,6 +99,13 @@ Circulation: no: "clear the screen" - . - + - When an empty barcode field is submitted in circulation (and after any quick slip printing, if enabled) + - pref: CircPayFinesRedirect + choices: + yes: "redirect to pay fines screen if borrower has fines to pay" + no: "do nothing" + - . + - - Include the stylesheet at - pref: NoticeCSS class: url 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 fa92507..dba10af 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -50,8 +50,21 @@ // listen submit to trigger qslip on empty checkout $('#mainform').bind('submit',function() { if ($('#barcode').val() == '') { - return printx_window('qslip'); } - });[% END %] + var code = printx_window('qslip'); + [% IF (CircPayFinesRedirect) %] + window.location = "/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrowernumber %];"; + [% END %] + return code; + } + }); + [% ELSIF ( CircPayFinesRedirect ) %] + $('#mainform').bind('submit', function(){ + if ($('#barcode').val() == '') { + window.location = "/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrowernumber %]"; + return false; + } + }); + [% END %] var allcheckboxes = $(".checkboxed"); -- 1.7.4.1