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 1188-1194 sub ModReserveCancelAll { Link Here
1188
    #step 1 : cancel the reservation
1203
    #step 1 : cancel the reservation
1189
    my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber });
1204
    my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber });
1190
    return unless $holds->count;
1205
    return unless $holds->count;
1191
    $holds->next->cancel;
1206
    my $hold = $holds->next;
1207
    my $hold_branchcode = $hold->branchcode;
1208
    my $hold_biblionumber = $hold->biblionumber;
1209
    my $hold_borrowernumber = $hold->borrowernumber;
1210
    my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber );
1211
    $hold->cancel;
1212
1213
    # send notice to user that their hold has been cancelled
1214
    my $letter = C4::Letters::GetPreparedLetter (
1215
        module => 'reserves',
1216
        letter_code => 'HOLD_MANUAL_CANCEL',
1217
        branchcode => $hold_branchcode,
1218
        tables => {
1219
            'biblio', $hold_biblionumber,
1220
            'borrowers', $hold_borrowernumber
1221
        }
1222
    );
1223
    C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email');
1192
1224
1193
    #step 2 launch the subroutine of the others reserves
1225
    #step 2 launch the subroutine of the others reserves
1194
    ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber);
1226
    ( $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