@@ -, +, @@ - 'allow patrons', dont allow patrons' - 'allow all patrons', 'allow non-blocked patrons' , allow no patrons' - 'Allow all' allows all patrons to return items (including blocked patrons) - 'Allow non-blocked' allows only non-blocked patrons to return items (note: this is the current 'allow' behavior) ---------- - set syspref to 'dont allow' - issue an item to a patron - attempt to return item via SCO, return should FAIL - set syspref to 'allow all' - issue an item to a patron - attempt to return item via SCO, return should SUCCEED - set syspref to 'allow nonblocked' - issue an item to a patron - attempt to return item via SCO, return should SUCCEED - issue an item to a patron, with a returndate of '2001-01-01' - attempt to return item via SCO, return should FAIL --- installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 25 ++++++++++++++++++++ .../en/modules/admin/preferences/circulation.pref | 5 ++- .../opac-tmpl/prog/en/modules/sco/sco-main.tt | 6 +--- opac/sco/sco-main.pl | 5 ++- 5 files changed, 34 insertions(+), 9 deletions(-) --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -142,7 +142,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES -- LDAP ? required fields? INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckTimeout',120,'Define the number of seconds before the Web-based Self Checkout times out a patron','','Integer'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns','none','If enabled, patrons may return items through the Web-based Self Checkout','all|nonblocked|none','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACnumSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -7036,6 +7036,31 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.13.00.XXX"; +if ( CheckVersion($DBversion) ) { + + #get current value + my $sth = $dbh->prepare("SELECT * from systempreferences where variable = 'AllowSelfCheckReturns'"); + $sth->execute; + my $row = $sth->fetchrow_hashref; + my $val = $row->{value}; + my $newval; + + if ($val =~ /1/ ) { + $newval = 'nonblocked'; + } else { + $newval = 'none'; + } + + # update syspref + my $sth_update = $dbh->prepare("UPDATE systempreferences + SET value=?, options='all|nonblocked|none', type='Choice' WHERE variable='AllowSelfCheckReturns'"); + $sth_update->execute($newval); + + print "Upgrade to $DBversion done (added 'nonblocked' to AllowSelfCheckReturns syspref)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -532,8 +532,9 @@ Circulation: - - pref: AllowSelfCheckReturns choices: - yes: Allow - no: "Don't allow" + all: "Allow all" + nonblocked: "Allow non-blocked" + none: "Don't allow" - patrons to return items through web-based self checkout system. - - "Include the following HTML in the Help page of the web-based self checkout system:" --- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt @@ -149,8 +149,7 @@ $(document).ready(function(){ [% END %] Please see a member of the library staff.

-[% IF ( returnitem ) %] -[% IF ( AllowSelfCheckReturns ) %] +[% IF (AllowSelfCheckReturns == 'nonblocked' and returnitem ) or AllowSelfCheckReturns == 'all' %]
@@ -158,7 +157,6 @@ $(document).ready(function(){
[% END %] -[% END %]
@@ -171,7 +169,7 @@ $(document).ready(function(){

[% IF ( confirm_renew_issue ) %]This item is already checked out to you.[% END %]

[% IF ( renew ) %] -[% IF ( AllowSelfCheckReturns ) %] +[% IF (AllowSelfCheckReturns == 'nonblocked' or AllowSelfCheckReturns == 'all') %] --- a/opac/sco/sco-main.pl +++ a/opac/sco/sco-main.pl @@ -83,7 +83,7 @@ if (C4::Context->preference('SelfCheckTimeout')) { $template->param(SelfCheckTimeout => $selfchecktimeout); # Checks policy laid out by AllowSelfCheckReturns, defaults to 'on' if preference is undefined -my $allowselfcheckreturns = 1; +my $allowselfcheckreturns = 'nonblocked'; if (defined C4::Context->preference('AllowSelfCheckReturns')) { $allowselfcheckreturns = C4::Context->preference('AllowSelfCheckReturns'); } @@ -120,7 +120,7 @@ my $return_only = 0; if ($op eq "logout") { $query->param( patronid => undef, patronlogin => undef, patronpw => undef ); } -elsif ( $op eq "returnbook" && $allowselfcheckreturns ) { +elsif ( $op eq "returnbook" && $allowselfcheckreturns =~ /nonblocked|all/) { my ($doreturn) = AddReturn( $barcode, $branch ); #warn "returnbook: " . $doreturn; $borrower = GetMemberDetails(undef,$patronid); @@ -152,6 +152,7 @@ elsif ( $op eq "checkout" ) { "circ_error_$issue_error" => 1, title => $item->{title}, hide_main => 1, + barcode => $barcode, ); if ($issue_error eq 'DEBT') { $template->param(amount => C4::Budgets->GetCurrency()->{symbol}.$impossible->{DEBT}); --