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

(-)a/opac/svc/patron/show_checkouts_to_relatives (-56 lines)
Lines 1-56 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2014 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
24
use C4::Auth;
25
use C4::Context;
26
use Koha::Database;
27
28
use JSON qw( to_json );
29
30
my $cgi = CGI->new();
31
32
my $privacy_guarantor_checkouts = $cgi->param('privacy_guarantor_checkouts');
33
34
my ( $userid, $cookie, $sessionID, $flags ) = checkauth( $cgi, 1, {}, 'opac' );
35
36
my $borrowernumber = C4::Context->userenv ? C4::Context->userenv->{number} : undef;
37
38
my $success = 0;
39
if ( $borrowernumber && defined($privacy_guarantor_checkouts) ) {
40
    my $patron = Koha::Database->new()->schema()->resultset('Borrower')->find($borrowernumber);
41
42
    $success = $patron->update( { privacy_guarantor_checkouts => $privacy_guarantor_checkouts } );
43
}
44
45
binmode STDOUT, ":encoding(UTF-8)";
46
print $cgi->header(
47
    -type    => 'application/json',
48
    -charset => 'UTF-8'
49
);
50
51
print to_json(
52
    {
53
        success => $success ? 1 : 0,
54
        privacy_guarantor_checkouts => $privacy_guarantor_checkouts,
55
    }
56
);
(-)a/opac/svc/patron/show_fines_to_relatives (-60 lines)
Lines 1-59 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2014 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
use JSON qw( to_json );
24
25
use C4::Auth;
26
use C4::Context;
27
28
use Koha::Patrons;
29
30
my $cgi = CGI->new();
31
32
my $privacy_guarantor_fines = $cgi->param('privacy_guarantor_fines');
33
34
my ( $userid, $cookie, $sessionID, $flags ) = checkauth( $cgi, 1, {}, 'opac' );
35
36
my $borrowernumber = C4::Context->userenv ? C4::Context->userenv->{number} : undef;
37
38
my $success = 0;
39
if ( $borrowernumber && defined($privacy_guarantor_fines) ) {
40
    my $patron = Koha::Patrons->find($borrowernumber);
41
42
    if ( $patron ) {
43
        $patron->privacy_guarantor_fines($privacy_guarantor_fines);
44
        $success = $patron->store();
45
    }
46
}
47
48
binmode STDOUT, ":encoding(UTF-8)";
49
print $cgi->header(
50
    -type    => 'application/json',
51
    -charset => 'UTF-8'
52
);
53
54
print to_json(
55
    {
56
        success => $success ? 1 : 0,
57
        privacy_guarantor_fines => $privacy_guarantor_fines,
58
    }
59
);
60
- 

Return to bug 23623