my ( $self, $params ) = @_;
$self->_result->result_source->schema->txn_do(
sub {
- $self->cancellationdate(dt_from_string);
+ $self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) );
$self->priority(0);
$self->_move_to_old;
$self->SUPER::delete(); # Do not add a DELETE log
my $deleted;
$self->_result->result_source->schema->txn_do(
sub {
- # Delete Patron's holds
- $self->holds->delete;
+ # Cancel Patron's holds
+ my $holds = $self->holds;
+ while( my $hold = $holds->next ){
+ $hold->cancel;
+ }
# Delete all lists and all shares of this borrower
# Consistent with the approach Koha uses on deleting individual lists
[% ELSIF op == 'delete_confirm' and patron %]
[%# TODO add "patron does not exist" unless patron %]
<div class="dialog alert">
+ [% IF ( ItemsOnHold ) %]
+ <h3>Patron has [% ItemsOnHold | html %] hold(s). Deleting patron cancels all their holds.</h3></br>
+ [% END %]
<h3>Are you sure you want to delete the patron [% patron.firstname | html %] [% patron.surname | html %]? This cannot be undone.</h3>
<form action="/cgi-bin/koha/members/deletemem.pl">
<input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
my $op = $input->param('op') || 'delete_confirm';
my $dbh = C4::Context->dbh;
my $is_guarantor = $dbh->selectrow_array("SELECT COUNT(*) FROM borrowers WHERE guarantorid=?", undef, $member);
+my $countholds = $dbh->selectrow_array("SELECT COUNT(*) FROM reserves WHERE borrowernumber=?", undef, $member);
if ( $op eq 'delete_confirm' or $countissues > 0 or $charges or $is_guarantor ) {
$template->param(
if ($is_guarantor) {
$template->param(guarantees => 1);
}
-
+ if($countholds > 0){
+ $template->param(ItemsOnHold => $countholds);
+ }
# This is silly written but reflect the same conditions as above
if ( not $countissues > 0 and not $charges and not $is_guarantor ) {
$template->param(