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

(-)a/acqui/basket.pl (-2 / +20 lines)
Lines 105-118 if ( $op eq 'delete_confirm' ) { Link Here
105
    }
105
    }
106
# if $delbiblio = 1, delete the records if possible
106
# if $delbiblio = 1, delete the records if possible
107
    if ((defined $delbiblio)and ($delbiblio ==1)){
107
    if ((defined $delbiblio)and ($delbiblio ==1)){
108
        my @cannotdelbiblios ;
108
        foreach my $myorder (@orders){
109
        foreach my $myorder (@orders){
109
            my $biblionumber = $myorder->{'biblionumber'};
110
            my $biblionumber = $myorder->{'biblionumber'};
110
            my $countbiblio = CountBiblioInOrders($biblionumber);
111
            my $countbiblio = CountBiblioInOrders($biblionumber);
111
            my $ordernumber = $myorder->{'ordernumber'};
112
            my $ordernumber = $myorder->{'ordernumber'};
112
            my @subscriptions = GetSubscriptionsId ($biblionumber);
113
            my $subscriptions = scalar GetSubscriptionsId ($biblionumber);
113
            my $itemcount = GetItemsCount($biblionumber);
114
            my $itemcount = GetItemsCount($biblionumber);
114
            DelBiblio($myorder->{biblionumber}) if ($countbiblio == 0 && $itemcount == 0 && !(@subscriptions));
115
            my $error;
116
            if ($countbiblio == 0 && $itemcount == 0 && $subscriptions == 0) {
117
                $error = DelBiblio($myorder->{biblionumber}) }
118
            else {
119
                push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}),
120
                                         title=> $myorder->{'title'},
121
                                         author=> $myorder->{'author'},
122
                                         countbiblio=> $countbiblio,
123
                                         itemcount=>$itemcount,
124
                                         subscriptions=>$subscriptions};
125
            }
126
            if ($error) {
127
                push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}),
128
                                         title=> $myorder->{'title'},
129
                                         author=> $myorder->{'author'},
130
                                         othererror=> $error};
131
            }
115
        }
132
        }
133
        $template->param( cannotdelbiblios => \@cannotdelbiblios );
116
    }
134
    }
117
 # delete the basket
135
 # delete the basket
118
    DelBasket($basketno,);
136
    DelBasket($basketno,);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-3 / +22 lines)
Lines 173-183 Link Here
173
                           <p>Warning:</p>
173
                           <p>Warning:</p>
174
                           <p>All orders of this basket will be cancelled and used funds will be refunded.</p>
174
                           <p>All orders of this basket will be cancelled and used funds will be refunded.</p>
175
                           <p>If items have been created when ordering or receiving, they will be deleted.</p>
175
                           <p>If items have been created when ordering or receiving, they will be deleted.</p>
176
                           <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>
176
                           <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>
177
                        </div>
177
                        </div>
178
                        <div class="modal-footer">
178
                        <div class="modal-footer">
179
                            <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
179
                            <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
180
                            <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;" >Delete basket and orders</button>
180
                            <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;">Delete basket and orders</button>
181
                            <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],1); return false;">Delete basket, orders and records</button>
181
                            <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],1); return false;">Delete basket, orders and records</button>
182
                        </div>
182
                        </div>
183
                    [% END %]
183
                    [% END %]
Lines 198-204 Link Here
198
    [% ELSE %]
198
    [% ELSE %]
199
        [% IF ( delete_confirmed ) %]
199
        [% IF ( delete_confirmed ) %]
200
            <h3>Basket deleted</h3>
200
            <h3>Basket deleted</h3>
201
            [% IF (cannotdelbiblios) %]
202
                <div class="dialog alert">
203
                    <p><strong>Warning:</strong></p>
204
                    <p><strong>The following records could not be deleted:</strong></p>
205
                    <ul>
206
                    [% FOREACH cannotdelbiblio IN cannotdelbiblios %]
207
                        <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cannotdelbiblio.biblionumber %]">[% cannotdelbiblio.title |html %]</a> by [% cannotdelbiblio.author %]:
208
                            <ul>
209
                            [% IF (cannotdelbiblio.itemcount) %]<li>[% cannotdelbiblio.itemcount %] item(s) attached.</li>[% END %]
210
                            [% IF (cannotdelbiblio.subscriptions) %]<li>[% cannotdelbiblio.subscriptions %] subscription(s) attached.</li>[% END %]
211
                            [% IF (cannotdelbiblio.countbiblio) %]<li>[% cannotdelbiblio.countbiblio %] order(s) attached.</li>[% END %]
212
                            [% IF (cannotdelbiblio.othererror) %]<li>Unknown error.</li>[% END %]
213
                            </ul>
214
                        </li>
215
                    [% END %]
216
                    </ul>
217
                </div>
218
                <a href="booksellers.pl">Click here to go back to booksellers page</a>
219
            [% ELSE %]
201
            <META HTTP-EQUIV=Refresh CONTENT="0; url=booksellers.pl">
220
            <META HTTP-EQUIV=Refresh CONTENT="0; url=booksellers.pl">
221
            [% END %]
202
        [% ELSE %]
222
        [% ELSE %]
203
        <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>
223
        <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>
204
        [% IF ( delete_confirm ) %]
224
        [% IF ( delete_confirm ) %]
205
- 

Return to bug 7791