|
Lines 24-29
Link Here
|
| 24 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
24 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 25 |
|
25 |
|
| 26 |
use Modern::Perl; |
26 |
use Modern::Perl; |
|
|
27 |
use Try::Tiny; |
| 27 |
|
28 |
|
| 28 |
use CGI qw ( -utf8 ); |
29 |
use CGI qw ( -utf8 ); |
| 29 |
use C4::Auth qw( checkauth ); |
30 |
use C4::Auth qw( checkauth ); |
|
Lines 47-59
my $dateexpiry;
Link Here
|
| 47 |
my $logged_in_user = Koha::Patrons->find( { userid => $loggedinuserid } ); |
48 |
my $logged_in_user = Koha::Patrons->find( { userid => $loggedinuserid } ); |
| 48 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
49 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
| 49 |
|
50 |
|
|
|
51 |
my $cannot_renew = '0'; |
| 52 |
|
| 50 |
# Ideally we should display a warning on the interface if the logged in user is |
53 |
# Ideally we should display a warning on the interface if the logged in user is |
| 51 |
# not allowed to modify this patron. |
54 |
# not allowed to modify this patron. |
| 52 |
# But a librarian is not supposed to hack the system |
55 |
# But a librarian is not supposed to hack the system |
| 53 |
if ( $logged_in_user->can_see_patron_infos($patron) ) { |
56 |
if ( $logged_in_user->can_see_patron_infos($patron) ) { |
| 54 |
if ( $reregistration eq 'y' ) { |
57 |
if ( $reregistration eq 'y' ) { |
|
|
58 |
|
| 55 |
# re-reregistration function to automatic calcul of date expiry |
59 |
# re-reregistration function to automatic calcul of date expiry |
| 56 |
$dateexpiry = $patron->renew_account; |
60 |
try { |
|
|
61 |
$dateexpiry = $patron->renew_account; |
| 62 |
} catch { |
| 63 |
if ( ref($_) eq 'Koha::Exceptions::Patron::Relationship::NoGuarantor' ) { |
| 64 |
$cannot_renew = '1'; |
| 65 |
} else { |
| 66 |
$_->rethrow(); |
| 67 |
} |
| 68 |
} |
| 57 |
} else { |
69 |
} else { |
| 58 |
my $sth = $dbh->prepare("UPDATE borrowers SET debarred = ?, debarredcomment = '' WHERE borrowernumber = ?"); |
70 |
my $sth = $dbh->prepare("UPDATE borrowers SET debarred = ?, debarredcomment = '' WHERE borrowernumber = ?"); |
| 59 |
$sth->execute( $status, $borrowernumber ); |
71 |
$sth->execute( $status, $borrowernumber ); |
|
Lines 62-74
if ( $logged_in_user->can_see_patron_infos($patron) ) {
Link Here
|
| 62 |
} |
74 |
} |
| 63 |
|
75 |
|
| 64 |
if($destination eq "circ"){ |
76 |
if($destination eq "circ"){ |
| 65 |
if($dateexpiry){ |
77 |
if ($cannot_renew) { |
|
|
78 |
print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber&noguarantor=1"); |
| 79 |
} elsif ($dateexpiry) { |
| 66 |
print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber&was_renewed=1"); |
80 |
print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber&was_renewed=1"); |
| 67 |
} else { |
81 |
} else { |
| 68 |
print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); |
82 |
print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); |
| 69 |
} |
83 |
} |
| 70 |
} else { |
84 |
} else { |
| 71 |
if($dateexpiry){ |
85 |
if ($cannot_renew) { |
|
|
86 |
print $input->redirect( |
| 87 |
"/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber&error=CANT_RENEW_CHILD_WITHOUT_GUARANTOR" |
| 88 |
); |
| 89 |
} elsif ($dateexpiry) { |
| 72 |
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber&was_renewed=1"); |
90 |
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber&was_renewed=1"); |
| 73 |
} else { |
91 |
} else { |
| 74 |
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); |
92 |
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); |
| 75 |
- |
|
|