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

(-)a/circ/waitingreserves.pl (+41 lines)
Lines 72-77 my @cancel_result; Link Here
72
if ( $op eq 'cancel_reserve' and $item) {
72
if ( $op eq 'cancel_reserve' and $item) {
73
    my $res = cancel( $item, $borrowernumber, $fbr, $tbr );
73
    my $res = cancel( $item, $borrowernumber, $fbr, $tbr );
74
    push @cancel_result, $res if $res;
74
    push @cancel_result, $res if $res;
75
} elsif ( $op =~ m|^mark_as_lost| ) {
76
    my $reserve_id = $input->param('reserve_id');
77
    my $hold = Koha::Holds->find( $reserve_id );
78
    die "wrong reserve_id" unless $hold;
79
    if ( C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') =~ m|^yes| ) {
80
        my $itemnumber = $hold->item->itemnumber;
81
        my $patron = $hold->borrower;
82
        C4::Circulation::LostItem( $itemnumber, 'MARK RETURNED' ); # FIXME Do we have to mark it returned? There is no pref for that? See other occurrences of 'LostItem('
83
        if ( $op eq 'mark_as_lost_and_notify' and C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') eq 'yes_and_notify' ) {
84
            my $library = $hold->branch;
85
            my $letter = C4::Letters::GetPreparedLetter(
86
                module => 'reserves',
87
                letter_code => 'CANCEL_HOLD_ON_LOST',
88
                branchcode => $library->branchcode, # FIXME Is it what we want?
89
                lang => $patron->lang,
90
                tables => {
91
                    branches    => $library->branchcode,
92
                    borrowers   => $patron->borrowernumber,
93
                    items       => $itemnumber,
94
                    biblio      => $hold->biblionumber,
95
                    biblioitems => $hold->biblionumber,
96
                    reserves    => $hold->unblessed,
97
                },
98
            );
99
            if ( $letter ) {
100
                my $admin_email_address = $library->branchemail || C4::Context->preference('KohaAdminEmailAddress');
101
102
                C4::Letters::EnqueueLetter(
103
                    {   letter                 => $letter,
104
                        borrowernumber         => $patron->borrowernumber,
105
                        message_transport_type => 'email',
106
                        from_address           => $admin_email_address,
107
                    }
108
                );
109
            }
110
        }
111
        my $res = cancel( $itemnumber, $patron->borrowernumber, $fbr, $tbr );
112
        push @cancel_result, $res if $res;
113
    }# else the url parameters have been modified and the user is not allowed to continue
114
75
}
115
}
76
116
77
if ( C4::Context->preference('IndependentBranches') ) {
117
if ( C4::Context->preference('IndependentBranches') ) {
Lines 103-108 foreach my $num (@getreserves) { Link Here
103
    my %getreserv = (
143
    my %getreserv = (
104
        itemnumber => $itemnumber,
144
        itemnumber => $itemnumber,
105
        borrowernum => $borrowernum,
145
        borrowernum => $borrowernum,
146
        reserve_id => $num->{reserve_id},
106
    );
147
    );
107
148
108
    my $patron = Koha::Patrons->find( $num->{borrowernumber} );
149
    my $patron = Koha::Patrons->find( $num->{borrowernumber} );
(-)a/installer/data/mysql/atomicupdate/bug_19287.sql (+2 lines)
Line 1 Link Here
1
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('CanMarkHoldsAwaitingPickupAsLost','no','no|yes|yes_and_notify','Add a button on the "Holds awaiting pickup" screen to mark an item as lost and notify the patron.','Choice');
1
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('CanMarkHoldsAwaitingPickupAsLost','no','no|yes|yes_and_notify','Add a button on the "Holds awaiting pickup" screen to mark an item as lost and notify the patron.','Choice');
2
3
INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('reserves', 'CANCEL_HOLD_ON_LOST', '', 'Hold has been cancelled', 0, "Hold has been cancelled", "Dear [% borrower.firstname %] [% borrower.surname %],\n\nWe regret to inform you that the following item cannot longer be placed on hold, it has been marked as lost\n\nTitle: [% biblio.title %]\nAuthor: [% biblio.author %]\nCopy: [% item.copynumber %]\nLocation: [% branch.branchname %]", 'email', 'default');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt (-3 / +34 lines)
Lines 17-23 Link Here
17
                { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
17
                { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
18
                { "sType": "title-string", "aTargets" : [ "title-string" ] }
18
                { "sType": "title-string", "aTargets" : [ "title-string" ] }
19
            ],
19
            ],
20
            "sPaginationType": "four_button"
20
            "sPaginationType": "four_button",
21
            "autoWidth": true,
21
        }));
22
        }));
22
      });
23
      });
23
//]]>
24
//]]>
Lines 127-132 Link Here
127
                            <input type="submit" value="Cancel hold" />
128
                            <input type="submit" value="Cancel hold" />
128
                            [% END %]
129
                            [% END %]
129
                        </form>
130
                        </form>
131
                        [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') != 'no' %]
132
                            <form name="cancelReserve" action="waitingreserves.pl" method="post">
133
                                <input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id %]" />
134
                                <input type="hidden" name="fbr" value="[% reserveloo.holdingbranch %]" />
135
                                <input type="hidden" name="tbr" value="[% reserveloo.homebranch %]" />
136
                                <input type="hidden" name="tab" value="holdswaiting">
137
                                [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes' %]
138
                                    <input type="hidden" name="op" value="mark_as_lost" />
139
                                    <input type="submit" value="Mark item as lost" />
140
                                [% ELSIF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes_and_notify' %]
141
                                    <input type="hidden" name="op" value="mark_as_lost_and_notify" />
142
                                    <input type="submit" value="Mark item as lost and notify the patron" />
143
                                [% END %]
144
                            </form>
145
                        [% END %]
130
                    </td>
146
                    </td>
131
                </tr>
147
                </tr>
132
                [% END %]</tbody>
148
                [% END %]</tbody>
Lines 194-200 Link Here
194
                            [% ELSE %]
210
                            [% ELSE %]
195
                            <input type="submit" value="Cancel hold" />
211
                            <input type="submit" value="Cancel hold" />
196
                            [% END %]
212
                            [% END %]
197
                       </form>
213
                        </form>
214
                        [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') != 'no' %]
215
                            <form name="cancelReserve" action="waitingreserves.pl" method="post">
216
                                <input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id %]" />
217
                                <input type="hidden" name="fbr" value="[% reserveloo.holdingbranch %]" />
218
                                <input type="hidden" name="tbr" value="[% reserveloo.homebranch %]" />
219
                                <input type="hidden" name="tab" value="holdswaiting">
220
                                [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes' %]
221
                                    <input type="hidden" name="op" value="mark_as_lost" />
222
                                    <input type="submit" value="Mark item as lost" />
223
                                [% ELSIF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes_and_notify' %]
224
                                    <input type="hidden" name="op" value="mark_as_lost_and_notify" />
225
                                    <input type="submit" value="Mark item as lost and notify the patron" />
226
                                [% END %]
227
                            </form>
228
                        [% END %]
229
198
                    </td>
230
                    </td>
199
                </tr>
231
                </tr>
200
                [% END %]</tbody>
232
                [% END %]</tbody>
201
- 

Return to bug 19287