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

(-)a/acqui/basket.pl (-2 / +20 lines)
Lines 118-131 if ( $op eq 'delete_confirm' ) { Link Here
118
    }
118
    }
119
# if $delbiblio = 1, delete the records if possible
119
# if $delbiblio = 1, delete the records if possible
120
    if ((defined $delbiblio)and ($delbiblio ==1)){
120
    if ((defined $delbiblio)and ($delbiblio ==1)){
121
        my @cannotdelbiblios ;
121
        foreach my $myorder (@orders){
122
        foreach my $myorder (@orders){
122
            my $biblionumber = $myorder->{'biblionumber'};
123
            my $biblionumber = $myorder->{'biblionumber'};
123
            my $countbiblio = CountBiblioInOrders($biblionumber);
124
            my $countbiblio = CountBiblioInOrders($biblionumber);
124
            my $ordernumber = $myorder->{'ordernumber'};
125
            my $ordernumber = $myorder->{'ordernumber'};
125
            my @subscriptions = GetSubscriptionsId ($biblionumber);
126
            my $subscriptions = scalar GetSubscriptionsId ($biblionumber);
126
            my $itemcount = GetItemsCount($biblionumber);
127
            my $itemcount = GetItemsCount($biblionumber);
127
            DelBiblio($myorder->{biblionumber}) if ($countbiblio == 0 && $itemcount == 0 && !(@subscriptions));
128
            my $error;
129
            if ($countbiblio == 0 && $itemcount == 0 && $subscriptions == 0) {
130
                $error = DelBiblio($myorder->{biblionumber}) }
131
            else {
132
                push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}),
133
                                         title=> $myorder->{'title'},
134
                                         author=> $myorder->{'author'},
135
                                         countbiblio=> $countbiblio,
136
                                         itemcount=>$itemcount,
137
                                         subscriptions=>$subscriptions};
138
            }
139
            if ($error) {
140
                push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}),
141
                                         title=> $myorder->{'title'},
142
                                         author=> $myorder->{'author'},
143
                                         othererror=> $error};
144
            }
128
        }
145
        }
146
        $template->param( cannotdelbiblios => \@cannotdelbiblios );
129
    }
147
    }
130
 # delete the basket
148
 # delete the basket
131
    DelBasket($basketno,);
149
    DelBasket($basketno,);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-3 / +22 lines)
Lines 211-221 Link Here
211
                           <p>Warning:</p>
211
                           <p>Warning:</p>
212
                           <p>All orders of this basket will be cancelled and used funds will be refunded.</p>
212
                           <p>All orders of this basket will be cancelled and used funds will be refunded.</p>
213
                           <p>If items have been created when ordering or receiving, they will be deleted.</p>
213
                           <p>If items have been created when ordering or receiving, they will be deleted.</p>
214
                           <p>You can choose to delete records if possible (if they don't have any item attached, any subscription and are not used in any other order).</p>
214
                           <p>You can choose to delete records if possible (records with some items, used in a subscription, or an other order will not be deleted).</p>
215
                        </div>
215
                        </div>
216
                        <div class="modal-footer">
216
                        <div class="modal-footer">
217
                            <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
217
                            <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
218
                            <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;" >Delete basket and orders</button>
218
                            <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;">Delete basket and orders</button>
219
                            <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],1); return false;">Delete basket, orders and records</button>
219
                            <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],1); return false;">Delete basket, orders and records</button>
220
                        </div>
220
                        </div>
221
                    [% END %]
221
                    [% END %]
Lines 236-242 Link Here
236
    [% ELSE %]
236
    [% ELSE %]
237
        [% IF ( delete_confirmed ) %]
237
        [% IF ( delete_confirmed ) %]
238
            <h3>Basket deleted</h3>
238
            <h3>Basket deleted</h3>
239
            [% IF (cannotdelbiblios) %]
240
                <div class="dialog alert">
241
                    <p><strong>Warning:</strong></p>
242
                    <p><strong>The following records could not be deleted:</strong></p>
243
                    <ul>
244
                    [% FOREACH cannotdelbiblio IN cannotdelbiblios %]
245
                        <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cannotdelbiblio.biblionumber %]">[% cannotdelbiblio.title |html %]</a> by [% cannotdelbiblio.author %]:
246
                            <ul>
247
                            [% IF (cannotdelbiblio.itemcount) %]<li>[% cannotdelbiblio.itemcount %] item(s) attached.</li>[% END %]
248
                            [% IF (cannotdelbiblio.subscriptions) %]<li>[% cannotdelbiblio.subscriptions %] subscription(s) attached.</li>[% END %]
249
                            [% IF (cannotdelbiblio.countbiblio) %]<li>[% cannotdelbiblio.countbiblio %] order(s) attached.</li>[% END %]
250
                            [% IF (cannotdelbiblio.othererror) %]<li>Unknown error.</li>[% END %]
251
                            </ul>
252
                        </li>
253
                    [% END %]
254
                    </ul>
255
                </div>
256
                <a href="booksellers.pl">Click here to go back to booksellers page</a>
257
            [% ELSE %]
239
            <META HTTP-EQUIV=Refresh CONTENT="0; url=booksellers.pl">
258
            <META HTTP-EQUIV=Refresh CONTENT="0; url=booksellers.pl">
259
            [% END %]
240
        [% ELSE %]
260
        [% ELSE %]
241
        <h1>[% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for <a href="supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a></h1>
261
        <h1>[% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for <a href="supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a></h1>
242
        [% IF ( delete_confirm ) %]
262
        [% IF ( delete_confirm ) %]
243
- 

Return to bug 7791