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

(-)a/C4/Reserves.pm (-3 / +35 lines)
Lines 1004-1012 sub ModReserve { Link Here
1004
    $hold ||= Koha::Holds->find($reserve_id);
1004
    $hold ||= Koha::Holds->find($reserve_id);
1005
1005
1006
    if ( $rank eq "del" ) {
1006
    if ( $rank eq "del" ) {
1007
        my $hold_branchcode = $hold->branchcode;
1008
        my $hold_biblionumber = $hold->biblionumber;
1009
        my $hold_borrowernumber = $hold->borrowernumber;
1010
        my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber );
1007
        $hold->cancel;
1011
        $hold->cancel;
1008
    }
1012
1009
    elsif ($rank =~ /^\d+/ and $rank > 0) {
1013
        # send notice to user that their hold has been cancelled
1014
        my $letter = C4::Letters::GetPreparedLetter (
1015
            module => 'reserves',
1016
            letter_code => 'HOLD_MANUAL_CANCEL',
1017
            branchcode => $hold_branchcode,
1018
            tables => {
1019
                'biblio', $hold_biblionumber,
1020
                'borrowers', $hold_borrowernumber
1021
            }
1022
        );
1023
        C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email');
1024
    } elsif ($rank =~ /^\d+/ and $rank > 0) {
1010
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) )
1025
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) )
1011
            if C4::Context->preference('HoldsLog');
1026
            if C4::Context->preference('HoldsLog');
1012
1027
Lines 1203-1209 sub ModReserveCancelAll { Link Here
1203
    #step 1 : cancel the reservation
1218
    #step 1 : cancel the reservation
1204
    my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber });
1219
    my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber });
1205
    return unless $holds->count;
1220
    return unless $holds->count;
1206
    $holds->next->cancel;
1221
    my $hold = $holds->next;
1222
    my $hold_branchcode = $hold->branchcode;
1223
    my $hold_biblionumber = $hold->biblionumber;
1224
    my $hold_borrowernumber = $hold->borrowernumber;
1225
    my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber );
1226
    $hold->cancel;
1227
1228
    # send notice to user that their hold has been cancelled
1229
    my $letter = C4::Letters::GetPreparedLetter (
1230
        module => 'reserves',
1231
        letter_code => 'HOLD_MANUAL_CANCEL',
1232
        branchcode => $hold_branchcode,
1233
        tables => {
1234
            'biblio', $hold_biblionumber,
1235
            'borrowers', $hold_borrowernumber
1236
        }
1237
    );
1238
    C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email');
1207
1239
1208
    #step 2 launch the subroutine of the others reserves
1240
    #step 2 launch the subroutine of the others reserves
1209
    ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber);
1241
    ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber);
(-)a/circ/pendingreserves.pl (-1 / +31 lines)
Lines 56-70 my @messages; Link Here
56
if ( $op eq 'cancel_reserve' and $reserve_id ) {
56
if ( $op eq 'cancel_reserve' and $reserve_id ) {
57
    my $hold = Koha::Holds->find( $reserve_id );
57
    my $hold = Koha::Holds->find( $reserve_id );
58
    if ( $hold ) {
58
    if ( $hold ) {
59
        my $hold_branchcode = $hold->branchcode;
60
        my $hold_biblionumber = $hold->biblionumber;
61
        my $hold_borrowernumber = $hold->borrowernumber;
62
        my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber );
59
        $hold->cancel;
63
        $hold->cancel;
60
        push @messages, { type => 'message', code => 'hold_cancelled' };
64
        push @messages, { type => 'message', code => 'hold_cancelled' };
65
66
        # send notice to user that their hold has been cancelled
67
        my $letter = C4::Letters::GetPreparedLetter (
68
            module => 'reserves',
69
            letter_code => 'HOLD_MANUAL_CANCEL',
70
            branchcode => $hold_branchcode,
71
            tables => {
72
                'biblio', $hold_biblionumber,
73
                'borrowers', $hold_borrowernumber
74
            }
75
        );
76
        C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email');
61
    }
77
    }
62
} elsif ( $op =~ m|^mark_as_lost| ) {
78
} elsif ( $op =~ m|^mark_as_lost| ) {
63
    my $hold = Koha::Holds->find( $reserve_id );
79
    my $hold = Koha::Holds->find( $reserve_id );
80
    my $hold_branchcode = $hold->branchcode;
81
    my $hold_biblionumber = $hold->biblionumber;
82
    my $hold_borrowernumber = $hold->borrowernumber;
83
    my $patron = $hold->borrower;
64
    die "wrong reserve_id" unless $hold; # This is a bit rude, but we are not supposed to get a wrong reserve_id
84
    die "wrong reserve_id" unless $hold; # This is a bit rude, but we are not supposed to get a wrong reserve_id
65
    my $item = $hold->item;
85
    my $item = $hold->item;
66
    if ( $item and C4::Context->preference('CanMarkHoldsToPullAsLost') =~ m|^allow| ) {
86
    if ( $item and C4::Context->preference('CanMarkHoldsToPullAsLost') =~ m|^allow| ) {
67
        my $patron = $hold->borrower;
68
        C4::Circulation::LostItem( $item->itemnumber, "pendingreserves" );
87
        C4::Circulation::LostItem( $item->itemnumber, "pendingreserves" );
69
        if ( $op eq 'mark_as_lost_and_notify' and C4::Context->preference('CanMarkHoldsToPullAsLost') eq 'allow_and_notify' ) {
88
        if ( $op eq 'mark_as_lost_and_notify' and C4::Context->preference('CanMarkHoldsToPullAsLost') eq 'allow_and_notify' ) {
70
            my $library = $hold->branch;
89
            my $library = $hold->branch;
Lines 123-128 if ( $op eq 'cancel_reserve' and $reserve_id ) { Link Here
123
            }
142
            }
124
        }
143
        }
125
144
145
        # send notice to user that their hold has been cancelled
146
        my $letter = C4::Letters::GetPreparedLetter (
147
            module => 'reserves',
148
            letter_code => 'HOLD_MANUAL_CANCEL',
149
            branchcode => $hold_branchcode,
150
            tables => {
151
                'biblio', $hold_biblionumber,
152
                'borrowers', $hold_borrowernumber
153
            }
154
        );
155
        C4::Message->enqueue($letter, $patron->unblessed, 'email');
126
    } elsif ( not $item ) {
156
    } elsif ( not $item ) {
127
        push @messages, { type => 'alert', code => 'hold_placed_at_biblio_level'};
157
        push @messages, { type => 'alert', code => 'hold_placed_at_biblio_level'};
128
    } # else the url parameters have been modified and the user is not allowed to continue
158
    } # else the url parameters have been modified and the user is not allowed to continue
(-)a/reserve/request.pl (-1 / +16 lines)
Lines 107-113 if ( $action eq 'move' ) { Link Here
107
} elsif ( $action eq 'cancel' ) {
107
} elsif ( $action eq 'cancel' ) {
108
  my $reserve_id = $input->param('reserve_id');
108
  my $reserve_id = $input->param('reserve_id');
109
  my $hold = Koha::Holds->find( $reserve_id );
109
  my $hold = Koha::Holds->find( $reserve_id );
110
  my $hold_branchcode = $hold->branchcode;
111
  my $hold_biblionumber = $hold->biblionumber;
112
  my $hold_borrowernumber = $hold->borrowernumber;
113
  my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber );
110
  $hold->cancel if $hold;
114
  $hold->cancel if $hold;
115
116
  # send notice to user that their hold has been cancelled
117
  my $letter = C4::Letters::GetPreparedLetter (
118
    module => 'reserves',
119
    letter_code => 'HOLD_MANUAL_CANCEL',
120
    branchcode => $hold_branchcode,
121
    tables => {
122
      'biblio', $hold_biblionumber,
123
      'borrowers', $hold_borrowernumber
124
    }
125
  );
126
  C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email');
111
} elsif ( $action eq 'setLowestPriority' ) {
127
} elsif ( $action eq 'setLowestPriority' ) {
112
  my $reserve_id = $input->param('reserve_id');
128
  my $reserve_id = $input->param('reserve_id');
113
  ToggleLowestPriority( $reserve_id );
129
  ToggleLowestPriority( $reserve_id );
114
- 

Return to bug 20453