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

(-)a/C4/Output.pm (+25 lines)
Lines 50-55 BEGIN { Link Here
50
    );
50
    );
51
    push @EXPORT, qw(
51
    push @EXPORT, qw(
52
        &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers
52
        &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers
53
        &output_and_exit_if_error
53
    );
54
    );
54
55
55
}
56
}
Lines 306-311 sub is_ajax { Link Here
306
    return ( $x_req and $x_req =~ /XMLHttpRequest/i ) ? 1 : 0;
307
    return ( $x_req and $x_req =~ /XMLHttpRequest/i ) ? 1 : 0;
307
}
308
}
308
309
310
sub output_and_exit_if_error {
311
    my ( $query, $cookie, $template, $params ) = @_;
312
    my $error;
313
    if ( $params and exists $params->{module} ) {
314
        if ( $params->{module} eq 'members' ) {
315
            my $logged_in_user = $params->{logged_in_user};
316
            my $current_patron = $params->{current_patron};
317
            if ( not $current_patron ) {
318
                $error = 'unknown_patron';
319
            }
320
            elsif( not $logged_in_user->can_see_patron_infos( $current_patron ) ) {
321
                $error = 'cannot_see_patron_infos';
322
            }
323
        }
324
    }
325
326
    if ( $error ) {
327
        $template->param( blocking_error => $error );
328
        output_html_with_http_headers ( $query, $cookie, $template->output );
329
        exit;
330
    }
331
    return;
332
}
333
309
sub parametrized_url {
334
sub parametrized_url {
310
    my $url = shift || ''; # ie page.pl?ln={LANG}
335
    my $url = shift || ''; # ie page.pl?ln={LANG}
311
    my $vars = shift || {}; # ie { LANG => en }
336
    my $vars = shift || {}; # ie { LANG => en }
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc (+1 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
1
<script type="text/javascript">
2
<script type="text/javascript">
2
//<![CDATA[
3
//<![CDATA[
3
function confirm_deletion() {
4
function confirm_deletion() {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc (+1 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
1
<script type="text/javascript">
2
<script type="text/javascript">
2
//<![CDATA[
3
//<![CDATA[
3
    $(document).ready(function() {
4
    $(document).ready(function() {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc (+10 lines)
Line 0 Link Here
1
[% IF blocking_error %]
2
    [% SWITCH blocking_error %]
3
    [% CASE 'unknown_patron' %]
4
        <div class="dialog message">This patron does not exist. <a href="/cgi-bin/koha/members/members-home.pl">Find another patron?</a></div>
5
    [% CASE 'cannot_see_patron_infos' %]You are not allowed to see the information of this patron.
6
    [% CASE %][% blocking_error %]
7
    [% END %]
8
9
    [% STOP %] [%# Will stop gracefully without processing any more of the template document.%]
10
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/budgets-admin-toolbar.inc (+1 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
1
<div id="toolbar" class="btn-toolbar">
2
<div id="toolbar" class="btn-toolbar">
2
    [% IF ( budget_period_id ) %]
3
    [% IF ( budget_period_id ) %]
3
        <div class="btn-group">
4
        <div class="btn-group">
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (+1 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
1
<div id="toolbar" class="btn-toolbar">
2
<div id="toolbar" class="btn-toolbar">
2
3
3
[% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items ||
4
[% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items ||
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/labels-toolbar.inc (+1 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
1
<div id="toolbar" class="btn-toolbar">
2
<div id="toolbar" class="btn-toolbar">
2
    <div class="btn-group">
3
    <div class="btn-group">
3
        <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New <span class="caret"></span></button>
4
        <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New <span class="caret"></span></button>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (+1 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
1
[% USE Koha %]
2
[% USE Koha %]
2
[% USE Borrowers %]
3
[% USE Borrowers %]
3
[% USE Branches %]
4
[% USE Branches %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc (+1 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
1
[% USE Categories %]
2
[% USE Categories %]
2
[% USE Koha %]
3
[% USE Koha %]
3
[% SET categories = Categories.all %]
4
[% SET categories = Categories.all %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patroncards-toolbar.inc (+1 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
1
<div id="toolbar" class="btn-toolbar">
2
<div id="toolbar" class="btn-toolbar">
2
    <div class="btn-group">
3
    <div class="btn-group">
3
        <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New <span class="caret"></span></button>
4
        <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New <span class="caret"></span></button>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc (+1 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
1
<div id="toolbar" class="btn-toolbar">
2
<div id="toolbar" class="btn-toolbar">
2
    [% IF ( CAN_user_reports_create_reports ) %]
3
    [% IF ( CAN_user_reports_create_reports ) %]
3
        <div class="btn-group">
4
        <div class="btn-group">
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/rotating-collections-toolbar.inc (+1 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
1
<div id="toolbar" class="btn-toolbar">
2
<div id="toolbar" class="btn-toolbar">
2
    <div class="btn-group">
3
    <div class="btn-group">
3
        <a class="btn btn-default btn-sm" href="/cgi-bin/koha/rotating_collections/editCollections.pl?action=new"><i class="fa fa-plus"></i> New collection</a>
4
        <a class="btn btn-default btn-sm" href="/cgi-bin/koha/rotating_collections/editCollections.pl?action=new"><i class="fa fa-plus"></i> New collection</a>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc (+1 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
1
[% IF subscriptionid and ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription || CAN_user_serials_receive_serials ) %]
2
[% IF subscriptionid and ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription || CAN_user_serials_receive_serials ) %]
2
    <div id="toolbar" class="btn-toolbar">
3
    <div id="toolbar" class="btn-toolbar">
3
        [% IF CAN_user_serials_create_subscription %]
4
        [% IF CAN_user_serials_create_subscription %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc (+2 lines)
Lines 1-3 Link Here
1
[% INCLUDE 'blocking_errors.inc' %]
2
1
<div id="toolbar" class="btn-toolbar">
3
<div id="toolbar" class="btn-toolbar">
2
    <div class="btn-group"><a id="newshelf" class="btn btn-default btn-sm" href="/cgi-bin/koha/virtualshelves/shelves.pl?op=add_form&amp;referer=[% op %]"><i class="fa fa-plus"></i> New list</a></div>
4
    <div class="btn-group"><a id="newshelf" class="btn btn-default btn-sm" href="/cgi-bin/koha/virtualshelves/shelves.pl?op=add_form&amp;referer=[% op %]"><i class="fa fa-plus"></i> New list</a></div>
3
5
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt (-2 / +2 lines)
Lines 2-8 Link Here
2
[% USE AuthorisedValues %]
2
[% USE AuthorisedValues %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Patrons &rsaquo; [% IF (unknowuser) %]Patron does not exist[% ELSE %]Discharge for [% firstname %] [% surname %] ([% cardnumber %])[% END %]</title>
5
<title>Koha &rsaquo; Patrons &rsaquo; [% UNLESS blocking_error  %]Discharge for [% firstname %] [% surname %] ([% cardnumber %])[% END %]</title>
6
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
7
</head>
7
</head>
8
<body id="discharge" class="discharge">
8
<body id="discharge" class="discharge">
Lines 12-18 Link Here
12
<div id="breadcrumbs">
12
<div id="breadcrumbs">
13
         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
13
         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
14
&rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
14
&rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
15
&rsaquo; [% IF (unknowuser) %]Patron does not exist[% ELSE %]Discharge for [% firstname %] [% surname %] ([% cardnumber %])[% END %]
15
&rsaquo; [% UNLESS blocking_error  %]Discharge for [% firstname %] [% surname %] ([% cardnumber %])[% END %]
16
</div>
16
</div>
17
17
18
<div id="doc3" class="yui-t1">
18
<div id="doc3" class="yui-t1">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt (-4 lines)
Lines 30-38 Link Here
30
    <div id="yui-main">
30
    <div id="yui-main">
31
      <div class="yui-b">
31
      <div class="yui-b">
32
32
33
        [% UNLESS ( unknowuser ) %]
34
        [% INCLUDE 'members-toolbar.inc' %]
33
        [% INCLUDE 'members-toolbar.inc' %]
35
        [% END %]
36
34
37
        <div class="yui-g">
35
        <div class="yui-g">
38
36
Lines 43-50 Link Here
43
            [% FOR m IN messages %]
41
            [% FOR m IN messages %]
44
                <div class="dialog [% m.type %]">
42
                <div class="dialog [% m.type %]">
45
                    [% SWITCH m.code %]
43
                    [% SWITCH m.code %]
46
                    [% CASE 'error_on_patron_load' %]
47
                        An error occurred whilst loading the patron details.
48
                    [% CASE 'error_on_profile_store' %]
44
                    [% CASE 'error_on_profile_store' %]
49
                        An error occurred whilst updating this housebound profile.
45
                        An error occurred whilst updating this housebound profile.
50
                    [% CASE 'error_on_profile_create' %]
46
                    [% CASE 'error_on_profile_create' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-11 / +2 lines)
Lines 5-13 Link Here
5
[% USE ColumnsSettings %]
5
[% USE ColumnsSettings %]
6
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
7
<title>Koha &rsaquo; Patrons &rsaquo;
7
<title>Koha &rsaquo; Patrons &rsaquo;
8
[% IF ( unknowuser ) %]
8
[% UNLESS blocking_error %]
9
    Patron does not exist
10
[% ELSE %]
11
    Patron details for [% INCLUDE 'patron-title.inc' no_html = 1 %]
9
    Patron details for [% INCLUDE 'patron-title.inc' no_html = 1 %]
12
[% END %]
10
[% END %]
13
</title>
11
</title>
Lines 144-150 function validate1(date) { Link Here
144
<div id="breadcrumbs">
142
<div id="breadcrumbs">
145
         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
143
         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
146
&rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
144
&rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
147
&rsaquo; [% IF ( unknowuser ) %]Patron does not exist[% ELSE %]Patron details for [% INCLUDE 'patron-title.inc' %][% END %]
145
&rsaquo; [% UNLESS blocking_error %]Patron details for [% INCLUDE 'patron-title.inc' %][% END %]
148
</div>
146
</div>
149
147
150
<div id="doc3" class="yui-t2">
148
<div id="doc3" class="yui-t2">
Lines 153-161 function validate1(date) { Link Here
153
	<div id="yui-main">
151
	<div id="yui-main">
154
	<div class="yui-b">
152
	<div class="yui-b">
155
153
156
[% UNLESS ( unknowuser ) %]
157
[% INCLUDE 'members-toolbar.inc' %]
154
[% INCLUDE 'members-toolbar.inc' %]
158
[% END %]
159
155
160
[% IF ( error ) %]
156
[% IF ( error ) %]
161
<div class="dialog alert">
157
<div class="dialog alert">
Lines 179-187 function validate1(date) { Link Here
179
[% END %]
175
[% END %]
180
<div class="yui-g">
176
<div class="yui-g">
181
177
182
[% IF ( unknowuser ) %]
183
   <div class="dialog message">This patron does not exist. <a href="/cgi-bin/koha/members/members-home.pl">Find another patron?</a></div>
184
[% ELSE %]
185
    [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% dateexpiry | $KohaDates %]</div>[% END %]
178
    [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% dateexpiry | $KohaDates %]</div>[% END %]
186
179
187
    [% IF fines %]
180
    [% IF fines %]
Lines 657-664 function validate1(date) { Link Here
657
[% END %]
650
[% END %]
658
651
659
</div>
652
</div>
660
[% END %] <!-- unknowuser -->
661
662
653
663
</div>
654
</div>
664
</div>
655
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt (-2 / +4 lines)
Lines 3-9 Link Here
3
[% USE Branches %]
3
[% USE Branches %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Patrons &rsaquo;
5
<title>Koha &rsaquo; Patrons &rsaquo;
6
Statistics for [% INCLUDE 'patron-title.inc' no_html = 1 %]
6
[% UNLESS blocking_error %]
7
    Statistics for [% INCLUDE 'patron-title.inc' no_html = 1 %]
8
[% END %]
7
</title>
9
</title>
8
[% INCLUDE 'doc-head-close.inc' %]
10
[% INCLUDE 'doc-head-close.inc' %]
9
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
11
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
Lines 26-32 Statistics for [% INCLUDE 'patron-title.inc' no_html = 1 %] Link Here
26
<div id="breadcrumbs">
28
<div id="breadcrumbs">
27
         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
29
         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
28
&rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
30
&rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
29
&rsaquo; [% IF ( unknowuser ) %]Patron does not exist[% ELSE %]Statistics for [% INCLUDE 'patron-title.inc' invert_name = 1 %][% END %]
31
&rsaquo; [% UNLESS blocking_error %]Statistics for [% INCLUDE 'patron-title.inc' invert_name = 1 %][% END %]
30
</div>
32
</div>
31
33
32
<div id="doc3" class="yui-t1">
34
<div id="doc3" class="yui-t1">
(-)a/members/boraccount.pl (-1 / +3 lines)
Lines 51-63 my ($template, $loggedinuser, $cookie) = get_template_and_user( Link Here
51
my $borrowernumber=$input->param('borrowernumber');
51
my $borrowernumber=$input->param('borrowernumber');
52
my $action = $input->param('action') || '';
52
my $action = $input->param('action') || '';
53
53
54
#get patron details
54
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
55
my $patron = Koha::Patrons->find( $borrowernumber );
55
my $patron = Koha::Patrons->find( $borrowernumber );
56
unless ( $patron ) {
56
unless ( $patron ) {
57
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
57
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
58
    exit;
58
    exit;
59
}
59
}
60
60
61
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
62
61
if ( $action eq 'reverse' ) {
63
if ( $action eq 'reverse' ) {
62
  ReversePayment( scalar $input->param('accountlines_id') );
64
  ReversePayment( scalar $input->param('accountlines_id') );
63
}
65
}
(-)a/members/deletemem.pl (-7 / +6 lines)
Lines 38-44 if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preferen Link Here
38
38
39
my $input = new CGI;
39
my $input = new CGI;
40
40
41
my ($template, $borrowernumber, $cookie)
41
my ($template, $loggedinuser, $cookie)
42
                = get_template_and_user({template_name => "members/deletemem.tt",
42
                = get_template_and_user({template_name => "members/deletemem.tt",
43
                                        query => $input,
43
                                        query => $input,
44
                                        type => "intranet",
44
                                        type => "intranet",
Lines 51-61 my ($template, $borrowernumber, $cookie) Link Here
51
my $member       = $input->param('member');
51
my $member       = $input->param('member');
52
52
53
#Do not delete yourself...
53
#Do not delete yourself...
54
if ($borrowernumber == $member ) {
54
if ( $loggedinuser == $member ) {
55
    print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_YOURSELF");
55
    print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_YOURSELF");
56
    exit 0; # Exit without error
56
    exit 0; # Exit without error
57
}
57
}
58
58
59
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
60
my $patron         = Koha::Patrons->find( $member );
61
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
62
59
# Handle deletion from the Norwegian national patron database, if it is enabled
63
# Handle deletion from the Norwegian national patron database, if it is enabled
60
# If the "deletelocal" parameter is set to "false", the regular deletion will be
64
# If the "deletelocal" parameter is set to "false", the regular deletion will be
61
# short circuited, and only a deletion from the national database can be carried
65
# short circuited, and only a deletion from the national database can be carried
Lines 73-83 if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preferen Link Here
73
my $issues = GetPendingIssues($member);     # FIXME: wasteful call when really, we only want the count
77
my $issues = GetPendingIssues($member);     # FIXME: wasteful call when really, we only want the count
74
my $countissues = scalar(@$issues);
78
my $countissues = scalar(@$issues);
75
79
76
my $patron = Koha::Patrons->find( $member );
77
unless ( $patron ) {
78
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$member");
79
    exit;
80
}
81
my $flags = C4::Members::patronflags( $patron->unblessed );
80
my $flags = C4::Members::patronflags( $patron->unblessed );
82
my $userenv = C4::Context->userenv;
81
my $userenv = C4::Context->userenv;
83
82
(-)a/members/discharge.pl (-6 / +2 lines)
Lines 58-70 unless ( C4::Context->preference('useDischarge') ) { Link Here
58
   exit;
58
   exit;
59
}
59
}
60
60
61
$borrowernumber = $input->param('borrowernumber');
61
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
62
63
my $patron = Koha::Patrons->find( $borrowernumber );
62
my $patron = Koha::Patrons->find( $borrowernumber );
64
unless ( $patron ) {
63
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
65
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
66
    exit;
67
}
68
64
69
my $can_be_discharged = Koha::Patron::Discharge::can_be_discharged({
65
my $can_be_discharged = Koha::Patron::Discharge::can_be_discharged({
70
    borrowernumber => $borrowernumber
66
    borrowernumber => $borrowernumber
(-)a/members/discharges.pl (+3 lines)
Lines 44-49 my $branchcode = Link Here
44
44
45
if( $op eq 'allow' ) {
45
if( $op eq 'allow' ) {
46
    my $borrowernumber = $input->param('borrowernumber');
46
    my $borrowernumber = $input->param('borrowernumber');
47
    my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
48
    my $patron         = Koha::Patrons->find($borrowernumber);
49
    output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
47
    Koha::Patron::Discharge::discharge({
50
    Koha::Patron::Discharge::discharge({
48
        borrowernumber => $borrowernumber
51
        borrowernumber => $borrowernumber
49
    }) if $borrowernumber;
52
    }) if $borrowernumber;
(-)a/members/files.pl (-6 / +6 lines)
Lines 46-52 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
46
$template->param( 'borrower_files' => 1 );
46
$template->param( 'borrower_files' => 1 );
47
47
48
my $borrowernumber = $cgi->param('borrowernumber');
48
my $borrowernumber = $cgi->param('borrowernumber');
49
my $bf = Koha::Patron::Files->new( borrowernumber => $borrowernumber );
49
50
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
51
my $patron         = Koha::Patrons->find($borrowernumber);
52
output_and_exit_if_error( $cgi, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
53
54
my $bf = Koha::Patron::Files->new( borrowernumber => $borrowernumber ); # FIXME Should be $patron->get_files. Koha::Patron::Files needs to be Koha::Objects based first
50
55
51
my $op = $cgi->param('op') || '';
56
my $op = $cgi->param('op') || '';
52
57
Lines 62-72 if ( $op eq 'download' ) { Link Here
62
    print $file->{'file_content'};
67
    print $file->{'file_content'};
63
}
68
}
64
else {
69
else {
65
    my $patron = Koha::Patrons->find( $borrowernumber );
66
    unless ( $patron ) {
67
        print $cgi->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
68
        exit;
69
    }
70
70
71
    my $patron_category = $patron->category;
71
    my $patron_category = $patron->category;
72
    $template->param(%{ $patron->unblessed});
72
    $template->param(%{ $patron->unblessed});
(-)a/members/housebound.pl (-6 / +4 lines)
Lines 56-67 my $method = $input->param('method') // q{}; Link Here
56
my $visit_id = $input->param('visit_id') // q{};
56
my $visit_id = $input->param('visit_id') // q{};
57
57
58
# Get patron
58
# Get patron
59
my $patron = eval {
59
my $borrowernumber = $input->param('borrowernumber');
60
    my $borrowernumber = $input->param('borrowernumber') // q{};
60
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
61
    return Koha::Patrons->find($borrowernumber);
61
my $patron = Koha::Patrons->find($borrowernumber);
62
};
62
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
63
push @messages, { type => 'error', code => 'error_on_patron_load' }
64
    if ( $@ or !$patron );
65
63
66
# Get supporting cast
64
# Get supporting cast
67
my ( $branch, $category, $houseboundprofile, $visit, $patron_image );
65
my ( $branch, $category, $houseboundprofile, $visit, $patron_image );
(-)a/members/mancredit.pl (-1 / +4 lines)
Lines 50-55 my $add=$input->param('add'); Link Here
50
50
51
if ($add){
51
if ($add){
52
    if ( checkauth( $input, 0, $flagsrequired, 'intranet' ) ) {
52
    if ( checkauth( $input, 0, $flagsrequired, 'intranet' ) ) {
53
        # Note: If the logged in user is not allowed to see this patron an invoice can be forced
54
        # Here we are trusting librarians not to hack the system
53
        my $barcode = $input->param('barcode');
55
        my $barcode = $input->param('barcode');
54
        my $itemnum;
56
        my $itemnum;
55
        if ($barcode) {
57
        if ($barcode) {
Lines 75-81 if ($add){ Link Here
75
            debug           => 1,
77
            debug           => 1,
76
        }
78
        }
77
    );
79
    );
78
					  
80
    my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
81
    output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
79
    if ( $patron->category->category_type eq 'C') {
82
    if ( $patron->category->category_type eq 'C') {
80
        my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
83
        my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
81
        $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
84
        $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
(-)a/members/maninvoice.pl (-2 / +7 lines)
Lines 50-56 unless ( $patron ) { Link Here
50
my $add=$input->param('add');
50
my $add=$input->param('add');
51
if ($add){
51
if ($add){
52
    if ( checkauth( $input, 0, $flagsrequired, 'intranet' ) ) {
52
    if ( checkauth( $input, 0, $flagsrequired, 'intranet' ) ) {
53
        #  print $input->header;
53
        # Note: If the logged in user is not allowed to see this patron an invoice can be forced
54
        # Here we are trusting librarians not to hack the system
54
        my $barcode=$input->param('barcode');
55
        my $barcode=$input->param('barcode');
55
        my $itemnum;
56
        my $itemnum;
56
        if ($barcode) {
57
        if ($barcode) {
Lines 92-98 if ($add){ Link Here
92
                             updatecharges => 'remaining_permissions' },
93
                             updatecharges => 'remaining_permissions' },
93
        debug           => 1,
94
        debug           => 1,
94
    });
95
    });
95
					
96
97
    my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
98
    my $patron         = Koha::Patrons->find($borrowernumber);
99
    output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
100
96
  # get authorised values with type of MANUAL_INV
101
  # get authorised values with type of MANUAL_INV
97
  my @invoice_types;
102
  my @invoice_types;
98
  my $dbh = C4::Context->dbh;
103
  my $dbh = C4::Context->dbh;
(-)a/members/member-flags.pl (-1 / +3 lines)
Lines 33-39 unless ( $patron ) { Link Here
33
33
34
my $category_type = $patron->category->category_type;
34
my $category_type = $patron->category->category_type;
35
my $bor = $patron->unblessed;
35
my $bor = $patron->unblessed;
36
if( $category_type eq 'S' )  {
36
if( $category_type eq 'S' )  { # FIXME Is this really needed?
37
    $flagsrequired->{'staffaccess'} = 1;
37
    $flagsrequired->{'staffaccess'} = 1;
38
}
38
}
39
my ($template, $loggedinuser, $cookie) = get_template_and_user({
39
my ($template, $loggedinuser, $cookie) = get_template_and_user({
Lines 45-50 my ($template, $loggedinuser, $cookie) = get_template_and_user({ Link Here
45
        debug           => 1,
45
        debug           => 1,
46
});
46
});
47
47
48
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
49
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
48
50
49
my %member2;
51
my %member2;
50
$member2{'borrowernumber'}=$member;
52
$member2{'borrowernumber'}=$member;
(-)a/members/member-password.pl (-4 / +2 lines)
Lines 45-55 my $newpassword2 = $input->param('newpassword2'); Link Here
45
45
46
my @errors;
46
my @errors;
47
47
48
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
48
my $patron = Koha::Patrons->find( $member );
49
my $patron = Koha::Patrons->find( $member );
49
unless ( $patron ) {
50
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
50
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$member");
51
    exit;
52
}
53
51
54
my $category_type = $patron->category->category_type;
52
my $category_type = $patron->category->category_type;
55
my $bor = $patron->unblessed;
53
my $bor = $patron->unblessed;
(-)a/members/memberentry.pl (-8 / +5 lines)
Lines 75-87 my ($template, $loggedinuser, $cookie) Link Here
75
           debug => ($debug) ? 1 : 0,
75
           debug => ($debug) ? 1 : 0,
76
       });
76
       });
77
77
78
my $borrowernumber = $input->param('borrowernumber');
79
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
80
my $patron         = Koha::Patrons->find($borrowernumber);
81
78
if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
82
if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
79
    my @providers = Koha::SMS::Providers->search();
83
    my @providers = Koha::SMS::Providers->search();
80
    $template->param( sms_providers => \@providers );
84
    $template->param( sms_providers => \@providers );
81
}
85
}
82
86
83
my $guarantorid    = $input->param('guarantorid');
87
my $guarantorid    = $input->param('guarantorid');
84
my $borrowernumber = $input->param('borrowernumber');
85
my $actionType     = $input->param('actionType') || '';
88
my $actionType     = $input->param('actionType') || '';
86
my $modify         = $input->param('modify');
89
my $modify         = $input->param('modify');
87
my $delete         = $input->param('delete');
90
my $delete         = $input->param('delete');
Lines 151-162 $template->param( "quickadd" => 1 ) if ( $quickadd ); Link Here
151
$template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' );
154
$template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' );
152
$template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 );
155
$template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 );
153
if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) {
156
if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) {
154
    my $patron = Koha::Patrons->find( $borrowernumber );
157
    output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
155
    unless ( $patron ) {
156
        print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
157
        exit;
158
    }
159
160
    $borrower_data = $patron->unblessed;
158
    $borrower_data = $patron->unblessed;
161
    $borrower_data->{category_type} = $patron->category->category_type;
159
    $borrower_data->{category_type} = $patron->category->category_type;
162
}
160
}
Lines 315-321 if ($op eq 'save' || $op eq 'insert'){ Link Here
315
313
316
    my $dateofbirth;
314
    my $dateofbirth;
317
    if ($op eq 'save' && $step == 3) {
315
    if ($op eq 'save' && $step == 3) {
318
        my $patron = Koha::Patrons->find( $borrowernumber );
319
        $dateofbirth = $patron->dateofbirth;
316
        $dateofbirth = $patron->dateofbirth;
320
    }
317
    }
321
    else {
318
    else {
(-)a/members/members-update-do.pl (+6 lines)
Lines 27-32 use Koha::Patron::Modifications; Link Here
27
27
28
my $query = new CGI;
28
my $query = new CGI;
29
29
30
# FIXME Should be a checkauth call
30
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31
    {
32
    {
32
        template_name   => "about.tt",
33
        template_name   => "about.tt",
Lines 38-49 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
38
    }
39
    }
39
);
40
);
40
41
42
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
43
41
my @params = $query->param;
44
my @params = $query->param;
42
45
43
foreach my $param (@params) {
46
foreach my $param (@params) {
44
    if ( $param =~ "^modify_" ) {
47
    if ( $param =~ "^modify_" ) {
45
        my (undef, $borrowernumber) = split( /_/, $param );
48
        my (undef, $borrowernumber) = split( /_/, $param );
46
49
50
        my $patron = Koha::Patrons->find($borrowernumber);
51
        next unless $logged_in_user->can_see_patron_infos( $patron );
52
47
        my $action = $query->param($param);
53
        my $action = $query->param($param);
48
54
49
        if ( $action eq 'approve' ) {
55
        if ( $action eq 'approve' ) {
(-)a/members/mod_debarment.pl (+8 lines)
Lines 32-37 my ( $loggedinuser, $cookie, $sessionID ) = checkauth( $cgi, 0, { borrowers => ' Link Here
32
my $borrowernumber = $cgi->param('borrowernumber');
32
my $borrowernumber = $cgi->param('borrowernumber');
33
my $action         = $cgi->param('action');
33
my $action         = $cgi->param('action');
34
34
35
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
36
my $patron         = Koha::Patrons->find($borrowernumber);
37
38
# Ideally we should display a warning on the interface if the patron is not allowed
39
# to modify a debarment
40
# But a librarian is not supposed to hack the system
41
$action = '' unless $logged_in_user->can_see_patron_infos( $patron );
42
35
if ( $action eq 'del' ) {
43
if ( $action eq 'del' ) {
36
    DelDebarment( scalar $cgi->param('borrower_debarment_id') );
44
    DelDebarment( scalar $cgi->param('borrower_debarment_id') );
37
} elsif ( $action eq 'add' ) {
45
} elsif ( $action eq 'add' ) {
(-)a/members/moremember.pl (-6 / +3 lines)
Lines 121-132 $borrowernumber = HTML::Entities::encode($borrowernumber); Link Here
121
my $error = $input->param('error');
121
my $error = $input->param('error');
122
$template->param( error => $error ) if ( $error );
122
$template->param( error => $error ) if ( $error );
123
123
124
my $patron        = Koha::Patrons->find($borrowernumber);
124
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
125
unless ( $patron ) {
125
my $patron         = Koha::Patrons->find( $borrowernumber );
126
    $template->param (unknowuser => 1);
126
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
127
    output_html_with_http_headers $input, $cookie, $template->output;
128
    exit;
129
}
130
127
131
my $issues        = $patron->checkouts;
128
my $issues        = $patron->checkouts;
132
my $balance       = $patron->account->balance;
129
my $balance       = $patron->account->balance;
(-)a/members/notices.pl (+3 lines)
Lines 48-53 my ($template, $loggedinuser, $cookie) Link Here
48
				debug => 1,
48
				debug => 1,
49
				});
49
				});
50
50
51
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
52
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
53
51
$template->param( $borrower );
54
$template->param( $borrower );
52
$template->param( picture => 1 ) if $patron->image;
55
$template->param( picture => 1 ) if $patron->image;
53
56
(-)a/members/pay.pl (-5 / +4 lines)
Lines 66-76 if ( !$borrowernumber ) { Link Here
66
}
66
}
67
67
68
# get borrower details
68
# get borrower details
69
my $patron = Koha::Patrons->find( $borrowernumber );
69
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
70
unless ( $patron ) {
70
my $patron         = Koha::Patrons->find($borrowernumber);
71
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
71
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
72
    exit;
72
73
}
74
my $category = $patron->category;
73
my $category = $patron->category;
75
our $borrower = $patron->unblessed;
74
our $borrower = $patron->unblessed;
76
$borrower->{description} = $category->description;
75
$borrower->{description} = $category->description;
(-)a/members/paycollect.pl (-4 / +3 lines)
Lines 49-59 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
49
49
50
# get borrower details
50
# get borrower details
51
my $borrowernumber = $input->param('borrowernumber');
51
my $borrowernumber = $input->param('borrowernumber');
52
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
52
my $patron         = Koha::Patrons->find( $borrowernumber );
53
my $patron         = Koha::Patrons->find( $borrowernumber );
53
unless ( $patron ) {
54
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
54
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
55
55
    exit;
56
}
57
my $borrower       = $patron->unblessed;
56
my $borrower       = $patron->unblessed;
58
my $category       = $patron->category;
57
my $category       = $patron->category;
59
$borrower->{description} = $category->description;
58
$borrower->{description} = $category->description;
(-)a/members/print_overdues.pl (+6 lines)
Lines 27-32 use C4::Output; Link Here
27
use C4::Members qw(GetOverduesForPatron);
27
use C4::Members qw(GetOverduesForPatron);
28
use C4::Overdues qw(parse_overdues_letter);
28
use C4::Overdues qw(parse_overdues_letter);
29
29
30
use Koha::Patrons;
31
30
my $input = new CGI;
32
my $input = new CGI;
31
33
32
my $flagsrequired = { circulate => "circulate_remaining_permissions" };
34
my $flagsrequired = { circulate => "circulate_remaining_permissions" };
Lines 45-50 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
45
my $borrowernumber = $input->param('borrowernumber');
47
my $borrowernumber = $input->param('borrowernumber');
46
my $branchcode     = C4::Context->userenv->{'branch'};
48
my $branchcode     = C4::Context->userenv->{'branch'};
47
49
50
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
51
my $patron         = Koha::Patrons->find( $borrowernumber );
52
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
53
48
my $overdues = GetOverduesForPatron($borrowernumber);
54
my $overdues = GetOverduesForPatron($borrowernumber);
49
55
50
my $letter = parse_overdues_letter(
56
my $letter = parse_overdues_letter(
(-)a/members/printfeercpt.pl (-5 / +4 lines)
Lines 49-59 my $borrowernumber=$input->param('borrowernumber'); Link Here
49
my $action = $input->param('action') || '';
49
my $action = $input->param('action') || '';
50
my $accountlines_id = $input->param('accountlines_id');
50
my $accountlines_id = $input->param('accountlines_id');
51
51
52
my $patron = Koha::Patrons->find( $borrowernumber );
52
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
53
unless ( $patron ) {
53
my $patron         = Koha::Patrons->find( $borrowernumber );
54
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
54
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
55
    exit;
55
56
}
57
my $category = $patron->category;
56
my $category = $patron->category;
58
my $data = $patron->unblessed;
57
my $data = $patron->unblessed;
59
$data->{description} = $category->description;
58
$data->{description} = $category->description;
(-)a/members/printinvoice.pl (-5 / +4 lines)
Lines 48-58 my $borrowernumber = $input->param('borrowernumber'); Link Here
48
my $action          = $input->param('action') || '';
48
my $action          = $input->param('action') || '';
49
my $accountlines_id = $input->param('accountlines_id');
49
my $accountlines_id = $input->param('accountlines_id');
50
50
51
my $patron = Koha::Patrons->find( $borrowernumber );
51
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
52
unless ( $patron ) {
52
my $patron         = Koha::Patrons->find( $borrowernumber );
53
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
53
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
54
    exit;
54
55
}
56
my $category = $patron->category;
55
my $category = $patron->category;
57
my $data = $patron->unblessed;
56
my $data = $patron->unblessed;
58
$data->{description} = $category->description;
57
$data->{description} = $category->description;
(-)a/members/printslip.pl (+5 lines)
Lines 73-78 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
73
);
73
);
74
74
75
my $borrowernumber = $input->param('borrowernumber');
75
my $borrowernumber = $input->param('borrowernumber');
76
77
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
78
my $patron         = Koha::Patrons->find( $borrowernumber );
79
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
80
76
my $branch=C4::Context->userenv->{'branch'};
81
my $branch=C4::Context->userenv->{'branch'};
77
my ($slip, $is_html);
82
my ($slip, $is_html);
78
if (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) {
83
if (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) {
(-)a/members/purchase-suggestions.pl (-5 / +4 lines)
Lines 42-52 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
42
42
43
my $borrowernumber = $input->param('borrowernumber');
43
my $borrowernumber = $input->param('borrowernumber');
44
44
45
my $patron = Koha::Patrons->find( $borrowernumber );
45
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
46
unless ( $patron ) {
46
my $patron         = Koha::Patrons->find( $borrowernumber );
47
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
47
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
48
    exit;
48
49
}
50
my $category = $patron->category;
49
my $category = $patron->category;
51
my $data = $patron->unblessed;
50
my $data = $patron->unblessed;
52
$data->{description} = $category->description;
51
$data->{description} = $category->description;
(-)a/members/readingrec.pl (-4 / +4 lines)
Lines 60-69 if ($input->param('borrowernumber')) { Link Here
60
    $patron = Koha::Patrons->find( $borrowernumber );
60
    $patron = Koha::Patrons->find( $borrowernumber );
61
}
61
}
62
62
63
unless ( $patron ) {
63
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
64
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
64
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
65
    exit;
65
66
}
67
$data = $patron->unblessed;
66
$data = $patron->unblessed;
68
$borrowernumber = $patron->borrowernumber;
67
$borrowernumber = $patron->borrowernumber;
69
68
Lines 81-86 if ( $borrowernumber eq C4::Context->preference('AnonymousPatron') ){ Link Here
81
80
82
#   barcode export
81
#   barcode export
83
if ( $op eq 'export_barcodes' ) {
82
if ( $op eq 'export_barcodes' ) {
83
    # FIXME This should be moved out of this script
84
    if ( $data->{'privacy'} < 2) {
84
    if ( $data->{'privacy'} < 2) {
85
        my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
85
        my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
86
        my @barcodes =
86
        my @barcodes =
(-)a/members/routing-lists.pl (-6 / +3 lines)
Lines 47-58 my $borrowernumber = $query->param('borrowernumber'); Link Here
47
47
48
my $branch = C4::Context->userenv->{'branch'};
48
my $branch = C4::Context->userenv->{'branch'};
49
49
50
my $patron;
50
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
51
$patron = Koha::Patrons->find( $borrowernumber ) if $borrowernumber;
51
my $patron         = Koha::Patrons->find( $borrowernumber );
52
unless ( $patron ) {
52
output_and_exit_if_error( $query, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
53
    print $query->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
54
    exit;
55
}
56
53
57
my $category = $patron->category;
54
my $category = $patron->category;
58
my $patron_info = $patron->unblessed;
55
my $patron_info = $patron->unblessed;
(-)a/members/setstatus.pl (-9 / +17 lines)
Lines 34-40 use Koha::Patrons; Link Here
34
34
35
my $input = new CGI;
35
my $input = new CGI;
36
36
37
checkauth($input, 0, { borrowers => 'edit_borrowers' }, 'intranet');
37
my ( $loggedinuser ) = checkauth($input, 0, { borrowers => 'edit_borrowers' }, 'intranet');
38
38
39
my $destination = $input->param("destination") || '';
39
my $destination = $input->param("destination") || '';
40
my $borrowernumber=$input->param('borrowernumber');
40
my $borrowernumber=$input->param('borrowernumber');
Lines 44-57 my $reregistration = $input->param('reregistration') || ''; Link Here
44
my $dbh = C4::Context->dbh;
44
my $dbh = C4::Context->dbh;
45
my $dateexpiry;
45
my $dateexpiry;
46
46
47
if ( $reregistration eq 'y' ) {
47
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
48
    # re-reregistration function to automatic calcul of date expiry
48
my $patron         = Koha::Patrons->find( $borrowernumber );
49
    $dateexpiry = Koha::Patrons->find( $borrowernumber )->renew_account;
49
50
} else {
50
# Ideally we should display a warning on the interface if the logged in user is
51
    my $sth = $dbh->prepare("UPDATE borrowers SET debarred = ?, debarredcomment = '' WHERE borrowernumber = ?");
51
# not allowed to modify this patron.
52
    $sth->execute( $status, $borrowernumber );
52
# But a librarian is not supposed to hack the system
53
	$sth->finish;
53
unless ( $logged_in_user->can_see_patron_infos($patron) ) {
54
	}
54
    if ( $reregistration eq 'y' ) {
55
        # re-reregistration function to automatic calcul of date expiry
56
        $dateexpiry = $patron->renew_account;
57
    } else {
58
        my $sth = $dbh->prepare("UPDATE borrowers SET debarred = ?, debarredcomment = '' WHERE borrowernumber = ?");
59
        $sth->execute( $status, $borrowernumber );
60
        $sth->finish;
61
    }
62
}
55
63
56
if($destination eq "circ"){
64
if($destination eq "circ"){
57
    if($dateexpiry){
65
    if($dateexpiry){
(-)a/members/statistics.pl (-6 / +3 lines)
Lines 47-58 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
47
47
48
my $borrowernumber = $input->param('borrowernumber');
48
my $borrowernumber = $input->param('borrowernumber');
49
49
50
# Set informations for the patron
50
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
51
my $patron = Koha::Patrons->find( $borrowernumber );
51
my $patron         = Koha::Patrons->find( $borrowernumber );
52
unless ( $patron ) {
52
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
53
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
54
    exit;
55
}
56
53
57
my $category = $patron->category;
54
my $category = $patron->category;
58
my $borrower= $patron->unblessed;
55
my $borrower= $patron->unblessed;
(-)a/members/summary-print.pl (-5 / +4 lines)
Lines 43-53 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
43
    }
43
    }
44
);
44
);
45
45
46
my $patron = Koha::Patrons->find( $borrowernumber );
46
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
47
unless ( $patron ) {
47
my $patron         = Koha::Patrons->find( $borrowernumber );
48
    print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
48
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
49
    exit;
49
50
}
51
my $category = $patron->category;
50
my $category = $patron->category;
52
my $data = $patron->unblessed;
51
my $data = $patron->unblessed;
53
$data->{description} = $category->description;
52
$data->{description} = $category->description;
(-)a/members/update-child.pl (-6 / +5 lines)
Lines 57-62 my $cattype = $input->param('cattype'); Link Here
57
my $catcode_multi = $input->param('catcode_multi');
57
my $catcode_multi = $input->param('catcode_multi');
58
my $op             = $input->param('op');
58
my $op             = $input->param('op');
59
59
60
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
61
60
if ( $op eq 'multi' ) {
62
if ( $op eq 'multi' ) {
61
    # FIXME - what are the possible upgrade paths?  C -> A , C -> S ...
63
    # FIXME - what are the possible upgrade paths?  C -> A , C -> S ...
62
    #   currently just allowing C -> A
64
    #   currently just allowing C -> A
Lines 71-81 if ( $op eq 'multi' ) { Link Here
71
}
73
}
72
74
73
elsif ( $op eq 'update' ) {
75
elsif ( $op eq 'update' ) {
74
    my $patron = Koha::Patrons->find( $borrowernumber );
76
    my $patron         = Koha::Patrons->find( $borrowernumber );
75
    unless ( $patron ) {
77
    output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
76
        print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
78
77
        exit;
78
    }
79
    my $member = $patron->unblessed;
79
    my $member = $patron->unblessed;
80
    $member->{'guarantorid'}  = 0;
80
    $member->{'guarantorid'}  = 0;
81
    $member->{'categorycode'} = $catcode;
81
    $member->{'categorycode'} = $catcode;
82
- 

Return to bug 18403