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

(-)a/circ/waitingreserves.pl (-6 / +23 lines)
Lines 68-81 my $transfer_when_cancel_all = C4::Context->preference('TransferWhenCancelAllWai Link Here
68
$template->param( TransferWhenCancelAllWaitingHolds => 1 ) if $transfer_when_cancel_all;
68
$template->param( TransferWhenCancelAllWaitingHolds => 1 ) if $transfer_when_cancel_all;
69
69
70
my @cancel_result;
70
my @cancel_result;
71
my @messages;
72
my $number_of_holds_cancelled;
71
# if we have a return from the form we cancel the holds
73
# if we have a return from the form we cancel the holds
72
if ( $op eq 'cancel_reserve' and $item) {
74
if ( $op eq 'cancel_reserve' and $item) {
73
    my $res = cancel( $item, $borrowernumber, $fbr, $tbr );
75
    my $next_res = cancel( $item, $borrowernumber, $fbr, $tbr );
74
    push @cancel_result, $res if $res;
76
    push @cancel_result, $next_res if $next_res;
77
    $number_of_holds_cancelled++;
75
} elsif ( $op =~ m|^mark_as_lost| ) {
78
} elsif ( $op =~ m|^mark_as_lost| ) {
76
    my $reserve_id = $input->param('reserve_id');
79
    my $reserve_id = $input->param('reserve_id');
77
    my $hold = Koha::Holds->find( $reserve_id );
80
    my $hold = Koha::Holds->find( $reserve_id );
78
    die "wrong reserve_id" unless $hold;
81
    die "wrong reserve_id" unless $hold; # This is a bit rude, but we are not supposed to get a wrong reserve_id
79
    if ( C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') =~ m|^yes| ) {
82
    if ( C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') =~ m|^yes| ) {
80
        my $itemnumber = $hold->item->itemnumber;
83
        my $itemnumber = $hold->item->itemnumber;
81
        my $patron = $hold->borrower;
84
        my $patron = $hold->borrower;
Lines 106-117 if ( $op eq 'cancel_reserve' and $item) { Link Here
106
                        from_address           => $admin_email_address,
109
                        from_address           => $admin_email_address,
107
                    }
110
                    }
108
                );
111
                );
112
                unless ( C4::Members::GetNoticeEmailAddress( $patron->borrowernumber ) ) {
113
                    push @messages, {type => 'alert', code => 'no_email_address', };
114
                }
115
                push @messages, { type => 'message', code => 'letter_enqueued' };
116
            } else {
117
                push @messages, { type => 'error', code => 'no_template_notice' };
109
            }
118
            }
110
        }
119
        }
111
        my $res = cancel( $itemnumber, $patron->borrowernumber, $fbr, $tbr );
120
        my $next_res = cancel( $itemnumber, $patron->borrowernumber, $fbr, $tbr );
112
        push @cancel_result, $res if $res;
121
        push @cancel_result, $next_res if $next_res;
113
    }# else the url parameters have been modified and the user is not allowed to continue
122
    }# else the url parameters have been modified and the user is not allowed to continue
114
115
}
123
}
116
124
117
if ( C4::Context->preference('IndependentBranches') ) {
125
if ( C4::Context->preference('IndependentBranches') ) {
Lines 182-187 foreach my $num (@getreserves) { Link Here
182
        if ($op eq 'cancel_all') {
190
        if ($op eq 'cancel_all') {
183
            my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
191
            my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
184
            push @cancel_result, $res if $res;
192
            push @cancel_result, $res if $res;
193
            $number_of_holds_cancelled++;
185
            next;
194
            next;
186
        } else {
195
        } else {
187
            push @overloop,   \%getreserv;
196
            push @overloop,   \%getreserv;
Lines 194-199 foreach my $num (@getreserves) { Link Here
194
    
203
    
195
}
204
}
196
205
206
if ( $number_of_holds_cancelled ) {
207
    if ( $number_of_holds_cancelled == 1 ) {
208
        push @messages, { type => 'message', code => 'hold_cancelled' };
209
    } else {
210
        push @messages, { type => 'message', code => 'holds_cancelled' };
211
    }
212
}
197
$template->param(cancel_result => \@cancel_result) if @cancel_result;
213
$template->param(cancel_result => \@cancel_result) if @cancel_result;
198
$template->param(
214
$template->param(
199
    reserveloop => \@reservloop,
215
    reserveloop => \@reservloop,
Lines 203-208 $template->param( Link Here
203
    show_date   => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
219
    show_date   => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
204
    ReservesMaxPickUpDelay => $max_pickup_delay,
220
    ReservesMaxPickUpDelay => $max_pickup_delay,
205
    tab => $tab,
221
    tab => $tab,
222
    messages => \@messages,
206
);
223
);
207
224
208
# Checking if there is a Fast Cataloging Framework
225
# Checking if there is a Fast Cataloging Framework
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt (-7 / +26 lines)
Lines 40-51 Link Here
40
    [% IF Koha.Preference('CircSidebar') %]<div class="yui-b">[% END %]
40
    [% IF Koha.Preference('CircSidebar') %]<div class="yui-b">[% END %]
41
    <div class="yui-g">
41
    <div class="yui-g">
42
42
43
        <h2>Holds awaiting pickup for your library on: [% show_date | $KohaDates %]
43
        [% FOR m IN messages %]
44
            [% IF ( all_branches_link ) %]
44
            <div class="dialog [% m.type %]">
45
            <span style="margin-left:20px"><a href="[% all_branches_link %]">
45
                [% SWITCH m.code %]
46
            View all libraries</a></span>
46
                [% CASE 'letter_enqueued' %]
47
            [% END %]
47
                    The notice has been correctly enqueued.
48
        </h2>
48
                [% CASE 'no_email_address' %]
49
                    The patron does not have an email address defined.
50
                [% CASE 'no_template_notice' %]
51
                    There is no notice template with a code 'CANCEL_HOLD_ON_LOST' defined in your system.
52
                [% CASE 'hold_cancelled' %]
53
                    The hold has been correctly cancelled.
54
                [% CASE 'holds_cancelled' %]
55
                    All the holds has been correctly cancelled..
56
                [% CASE %]
57
                    [% m.code %]
58
                [% END %]
59
            </div>
60
        [% END %]
61
49
    [% IF ( cancel_result ) %]
62
    [% IF ( cancel_result ) %]
50
        [% FOREACH cancel_result %]
63
        [% FOREACH cancel_result %]
51
            [% IF ( messagetransfert ) %]
64
            [% IF ( messagetransfert ) %]
Lines 72-77 Link Here
72
            [% END %]
85
            [% END %]
73
        [% END %]
86
        [% END %]
74
    [% ELSE %]
87
    [% ELSE %]
88
        <h2>Holds awaiting pickup for your library on: [% show_date | $KohaDates %]
89
            [% IF ( all_branches_link ) %]
90
            <span style="margin-left:20px"><a href="[% all_branches_link %]">
91
            View all libraries</a></span>
92
            [% END %]
93
        </h2>
94
75
        <div id="resultlist" class="toptabs">
95
        <div id="resultlist" class="toptabs">
76
            <ul>
96
            <ul>
77
                <li><a href="#holdswaiting">Holds waiting: [% reservecount %]</a></li>
97
                <li><a href="#holdswaiting">Holds waiting: [% reservecount %]</a></li>
78
- 

Return to bug 19287