View | Details | Raw Unified | Return to bug 10554
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_10554.perl (+33 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
use strict;
4
use warnings;
5
use C4::Context;
6
7
my $dbh = C4::Context->dbh;
8
9
my $DBversion = "XXX";
10
11
#if ( CheckVersion($DBversion) ) {
12
13
#get current value
14
my $newval = 0;
15
my $oldval = $dbh->selectcol_arrayref(
16
"SELECT value from systempreferences where variable = 'AllowSelfCheckReturns'"
17
);
18
19
$newval = ($oldval->[0] =~ /1/ ? 'nonblocked' : 'none');
20
21
# update syspref
22
my $sth_update = $dbh->prepare(
23
    "UPDATE systempreferences
24
     SET value=?, options='all|nonblocked|none', type='Choice' WHERE variable='AllowSelfCheckReturns'"
25
);
26
$sth_update->execute($newval);
27
28
print
29
"Upgrade to $DBversion done (BZ-10544 added 'nonblocked' to AllowSelfCheckReturns syspref)\n";
30
31
#    SetVersion($DBversion);
32
#}
33
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 30-36 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
30
('AllowRenewalIfOtherItemsAvailable','0',NULL,'If enabled, allow a patron to renew an item with unfilled holds if other available items can fill that hold.','YesNo'),
30
('AllowRenewalIfOtherItemsAvailable','0',NULL,'If enabled, allow a patron to renew an item with unfilled holds if other available items can fill that hold.','YesNo'),
31
('AllowRenewalLimitOverride','0',NULL,'if ON, allows renewal limits to be overridden on the circulation screen','YesNo'),
31
('AllowRenewalLimitOverride','0',NULL,'if ON, allows renewal limits to be overridden on the circulation screen','YesNo'),
32
('AllowReturnToBranch','anywhere','anywhere|homebranch|holdingbranch|homeorholdingbranch','Where an item may be returned','Choice'),
32
('AllowReturnToBranch','anywhere','anywhere|homebranch|holdingbranch|homeorholdingbranch','Where an item may be returned','Choice'),
33
('AllowSelfCheckReturns','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
33
('AllowSelfCheckReturns','none','If enabled, patrons may return items through the Web-based Self Checkout','all|nonblocked|none','Choice');
34
('AllowTooManyOverride','1','','If on, allow staff to override and check out items when the patron has reached the maximum number of allowed checkouts','YesNo'),
34
('AllowTooManyOverride','1','','If on, allow staff to override and check out items when the patron has reached the maximum number of allowed checkouts','YesNo'),
35
('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z',NULL,'Alphabet than can be expanded into browse links, e.g. on Home > Patrons','free'),
35
('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z',NULL,'Alphabet than can be expanded into browse links, e.g. on Home > Patrons','free'),
36
('AlternateHoldingsField','',NULL,'The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).','free'),
36
('AlternateHoldingsField','',NULL,'The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).','free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-2 / +3 lines)
Lines 657-664 Circulation: Link Here
657
        -
657
        -
658
            - pref: AllowSelfCheckReturns
658
            - pref: AllowSelfCheckReturns
659
              choices:
659
              choices:
660
                  yes: Allow
660
                    all: "Allow all"
661
                  no: "Don't allow"
661
                    nonblocked: "Allow non-blocked"
662
                    none: "Don't allow"
662
            - patrons to return items through web-based self checkout system. 
663
            - patrons to return items through web-based self checkout system. 
663
        -
664
        -
664
            - "Include the following HTML in the Help page of the web-based self checkout system:"
665
            - "Include the following HTML in the Help page of the web-based self checkout system:"
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt (-2 / +6 lines)
Lines 75-81 Link Here
75
                                Please see a member of the library staff.
75
                                Please see a member of the library staff.
76
                            </p>
76
                            </p>
77
77
78
                            [% IF ( returnitem && AllowSelfCheckReturns ) %]
78
                            [% IF  (AllowSelfCheckReturns == 'nonblocked' and returnitem ) or AllowSelfCheckReturns  == 'all' %]
79
79
                                <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
80
                                <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
80
                                    <input type="hidden" name="op" value="returnbook" />
81
                                    <input type="hidden" name="op" value="returnbook" />
81
                                    <input type="hidden" name="patronid" value="[% patronid %]" />
82
                                    <input type="hidden" name="patronid" value="[% patronid %]" />
Lines 99-105 Link Here
99
                                <p>This item is already checked out to you.</p>
100
                                <p>This item is already checked out to you.</p>
100
                            [% END %]
101
                            [% END %]
101
102
102
                            [% IF ( renew && AllowSelfCheckReturns ) %]
103
                            [% IF ( renew ) %]
104
                                    [% IF  (AllowSelfCheckReturns == 'nonblocked' or AllowSelfCheckReturns  == 'all') %]
105
103
                                <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
106
                                <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
104
                                    <input type="hidden" name="op" value="returnbook" />
107
                                    <input type="hidden" name="op" value="returnbook" />
105
                                    <input type="hidden" name="patronid" value="[% patronid %]" />
108
                                    <input type="hidden" name="patronid" value="[% patronid %]" />
Lines 107-112 Link Here
107
                                    <input type="hidden" name="confirmed" value="" />
110
                                    <input type="hidden" name="confirmed" value="" />
108
                                    <button type="submit" name="returnbook" class="btn"><i class="icon return"></i> Return this item</button>
111
                                    <button type="submit" name="returnbook" class="btn"><i class="icon return"></i> Return this item</button>
109
                                </form>
112
                                </form>
113
                                    [% END %]
110
                            [% END %]
114
                            [% END %]
111
115
112
                            [% UNLESS ( renew ) %]
116
                            [% UNLESS ( renew ) %]
(-)a/opac/sco/sco-main.pl (-3 / +5 lines)
Lines 83-89 if (C4::Context->preference('SelfCheckTimeout')) { Link Here
83
$template->param(SelfCheckTimeout => $selfchecktimeout);
83
$template->param(SelfCheckTimeout => $selfchecktimeout);
84
84
85
# Checks policy laid out by AllowSelfCheckReturns, defaults to 'on' if preference is undefined
85
# Checks policy laid out by AllowSelfCheckReturns, defaults to 'on' if preference is undefined
86
my $allowselfcheckreturns = 1;
86
my $allowselfcheckreturns = 'nonblocked';
87
87
if (defined C4::Context->preference('AllowSelfCheckReturns')) {
88
if (defined C4::Context->preference('AllowSelfCheckReturns')) {
88
    $allowselfcheckreturns = C4::Context->preference('AllowSelfCheckReturns');
89
    $allowselfcheckreturns = C4::Context->preference('AllowSelfCheckReturns');
89
}
90
}
Lines 124-130 my $return_only = 0; Link Here
124
if ($op eq "logout") {
125
if ($op eq "logout") {
125
    $query->param( patronid => undef, patronlogin => undef, patronpw => undef );
126
    $query->param( patronid => undef, patronlogin => undef, patronpw => undef );
126
}
127
}
127
elsif ( $op eq "returnbook" && $allowselfcheckreturns ) {
128
elsif ( $op eq "returnbook" && $allowselfcheckreturns =~ /nonblocked|all/) {
129
128
    my ($doreturn) = AddReturn( $barcode, $branch );
130
    my ($doreturn) = AddReturn( $barcode, $branch );
129
    #warn "returnbook: " . $doreturn;
131
    #warn "returnbook: " . $doreturn;
130
    $borrower = GetMemberDetails(undef,$patronid);
132
    $borrower = GetMemberDetails(undef,$patronid);
Lines 180-185 elsif ( $op eq "checkout" ) { Link Here
180
                confirm             => 1,
182
                confirm             => 1,
181
                confirm_renew_issue => 1,
183
                confirm_renew_issue => 1,
182
                hide_main           => 1,
184
                hide_main           => 1,
185
                barcode             => $barcode,
183
            );
186
            );
184
        }
187
        }
185
    } elsif ( $confirm_required && !$confirmed ) {
188
    } elsif ( $confirm_required && !$confirmed ) {
186
- 

Return to bug 10554