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

(-)a/C4/Reserves.pm (-3 / +35 lines)
Lines 982-990 sub ModReserve { Link Here
982
    $hold ||= Koha::Holds->find($reserve_id);
982
    $hold ||= Koha::Holds->find($reserve_id);
983
983
984
    if ( $rank eq "del" ) {
984
    if ( $rank eq "del" ) {
985
        my $hold_branchcode = $hold->branchcode;
986
        my $hold_biblionumber = $hold->biblionumber;
987
        my $hold_borrowernumber = $hold->borrowernumber;
988
        my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber );
985
        $hold->cancel;
989
        $hold->cancel;
986
    }
990
987
    elsif ($rank =~ /^\d+/ and $rank > 0) {
991
        # send notice to user that their hold has been cancelled
992
        my $letter = C4::Letters::GetPreparedLetter (
993
            module => 'reserves',
994
            letter_code => 'HOLD_MANUAL_CANCEL',
995
            branchcode => $hold_branchcode,
996
            tables => {
997
                'biblio', $hold_biblionumber,
998
                'borrowers', $hold_borrowernumber
999
            }
1000
        );
1001
        C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email');
1002
    } elsif ($rank =~ /^\d+/ and $rank > 0) {
988
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) )
1003
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) )
989
            if C4::Context->preference('HoldsLog');
1004
            if C4::Context->preference('HoldsLog');
990
1005
Lines 1166-1172 sub ModReserveCancelAll { Link Here
1166
    #step 1 : cancel the reservation
1181
    #step 1 : cancel the reservation
1167
    my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber });
1182
    my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber });
1168
    return unless $holds->count;
1183
    return unless $holds->count;
1169
    $holds->next->cancel;
1184
    my $hold = $holds->next;
1185
    my $hold_branchcode = $hold->branchcode;
1186
    my $hold_biblionumber = $hold->biblionumber;
1187
    my $hold_borrowernumber = $hold->borrowernumber;
1188
    my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber );
1189
    $hold->cancel;
1190
1191
    # send notice to user that their hold has been cancelled
1192
    my $letter = C4::Letters::GetPreparedLetter (
1193
        module => 'reserves',
1194
        letter_code => 'HOLD_MANUAL_CANCEL',
1195
        branchcode => $hold_branchcode,
1196
        tables => {
1197
            'biblio', $hold_biblionumber,
1198
            'borrowers', $hold_borrowernumber
1199
        }
1200
    );
1201
    C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email');
1170
1202
1171
    #step 2 launch the subroutine of the others reserves
1203
    #step 2 launch the subroutine of the others reserves
1172
    ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber);
1204
    ( $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 120-125 if ( $op eq 'cancel_reserve' and $reserve_id ) { Link Here
120
            }
139
            }
121
        }
140
        }
122
141
142
        # send notice to user that their hold has been cancelled
143
        my $letter = C4::Letters::GetPreparedLetter (
144
            module => 'reserves',
145
            letter_code => 'HOLD_MANUAL_CANCEL',
146
            branchcode => $hold_branchcode,
147
            tables => {
148
                'biblio', $hold_biblionumber,
149
                'borrowers', $hold_borrowernumber
150
            }
151
        );
152
        C4::Message->enqueue($letter, $patron->unblessed, 'email');
123
    } elsif ( not $item ) {
153
    } elsif ( not $item ) {
124
        push @messages, { type => 'alert', code => 'hold_placed_at_biblio_level'};
154
        push @messages, { type => 'alert', code => 'hold_placed_at_biblio_level'};
125
    } # else the url parameters have been modified and the user is not allowed to continue
155
    } # 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