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

(-)a/acqui/basket.pl (-1 / +21 lines)
Lines 110-116 $template->param( skip_confirm_reopen => 1) if $confirm_pref eq '2'; Link Here
110
110
111
if ( $op eq 'delete_confirm' ) {
111
if ( $op eq 'delete_confirm' ) {
112
    my $basketno = $query->param('basketno');
112
    my $basketno = $query->param('basketno');
113
    DelBasket($basketno);
113
    my $delbiblio = $query->param('delbiblio');
114
    my @orders = GetOrders($basketno);
115
#Delete all orders included in that basket, and all items received.
116
    foreach my $myorder (@orders){
117
        DelOrder($myorder->{biblionumber},$myorder->{ordernumber});
118
        warn "suppression de ".$myorder->{biblionumber}.'  '.$myorder->{ordernumber};
119
    }
120
# if $delbiblio = 1, delete the records if possible
121
    if ((defined $delbiblio)and ($delbiblio ==1)){
122
        foreach my $myorder (@orders){
123
            my $biblionumber = $myorder->{'biblionumber'};
124
            my $countbiblio = CountBiblioInOrders($biblionumber);
125
            my $ordernumber = $myorder->{'ordernumber'};
126
            my @subscriptions = GetSubscriptionsId ($biblionumber);
127
            my $itemcount = GetItemsCount($biblionumber);
128
            DelBiblio($myorder->{biblionumber}) if ($countbiblio == 0 && $itemcount == 0 && !(@subscriptions));
129
        warn "suppression de la notice ".$myorder->{biblionumber}};
130
    }
131
132
 # delete the basket
133
    DelBasket($basketno,);
114
    $template->param( delete_confirmed => 1 );
134
    $template->param( delete_confirmed => 1 );
115
} elsif ( !$bookseller ) {
135
} elsif ( !$bookseller ) {
116
    $template->param( NO_BOOKSELLER => 1 );
136
    $template->param( NO_BOOKSELLER => 1 );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-13 / +26 lines)
Lines 43-54 Link Here
43
                    window.location = "[% script_name %]?op=close&basketno=[% basketno %]";
43
                    window.location = "[% script_name %]?op=close&basketno=[% basketno %]";
44
                }
44
                }
45
            }
45
            }
46
            function confirm_deletion() {
46
47
                var is_confirmed = confirm(_("Are you sure you want to delete this basket?"));
47
            function delete_basket(basketno,booksellerid,delbiblio) {
48
                if (is_confirmed) {
48
                window.location = "[% script_name %]?op=delete_confirm&delbiblio="+delbiblio+"&basketno="+basketno+"&booksellerid="+booksellerid;
49
                    window.location = "[% script_name %]?op=delete_confirm&basketno=[% basketno %]&booksellerid=[% booksellerid %]";
50
                }
51
            }
49
            }
50
52
            function confirm_delete_item(ordernumber, biblionumber) {
51
            function confirm_delete_item(ordernumber, biblionumber) {
53
                var is_confirmed = confirm(_("Are you sure you want to delete this order ?"));
52
                var is_confirmed = confirm(_("Are you sure you want to delete this order ?"));
54
                if (is_confirmed) {
53
                if (is_confirmed) {
Lines 113-122 Link Here
113
        var cancelledorderst = $("#cancelledorderst").dataTable($.extend(true, {}, dataTablesDefaults, {
112
        var cancelledorderst = $("#cancelledorderst").dataTable($.extend(true, {}, dataTablesDefaults, {
114
            "sPaginationType": "four_button"
113
            "sPaginationType": "four_button"
115
        } ) );
114
        } ) );
116
        $("#delbasketbutton").on("click",function(e){
117
            e.preventDefault();
118
            confirm_deletion();
119
        });
120
        $("#reopenbutton").on("click",function(e){
115
        $("#reopenbutton").on("click",function(e){
121
            e.preventDefault();
116
            e.preventDefault();
122
            confirm_reopen();
117
            confirm_reopen();
Lines 185-192 Link Here
185
                <div id="toolbar" class="btn-toolbar">
180
                <div id="toolbar" class="btn-toolbar">
186
                    <div class="btn-group"><a href="#addtoBasket" role="button" class="btn btn-small" data-toggle="modal"><i class="icon-plus"></i> Add to basket</a></div>
181
                    <div class="btn-group"><a href="#addtoBasket" role="button" class="btn btn-small" data-toggle="modal"><i class="icon-plus"></i> Add to basket</a></div>
187
                    <div class="btn-group"><a href="basketheader.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;op=add_form" class="btn btn-small" id="basketheadbutton"><i class="icon-pencil"></i> Edit basket</a></div>
182
                    <div class="btn-group"><a href="basketheader.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;op=add_form" class="btn btn-small" id="basketheadbutton"><i class="icon-pencil"></i> Edit basket</a></div>
188
                    <div class="btn-group"><a href="#" class="btn btn-small" id="delbasketbutton"><i class="icon-remove"></i> Delete this basket</a></div>
183
                    <div class="btn-group"><a href="#deleteBasketModal" role="button" class="btn btn-small" data-toggle="modal" id="delbasketbutton"><i class="icon-remove"></i> Delete this basket</a></div>
189
                    [% IF ( unclosable ) %]
184
                   [% IF ( unclosable ) %]
190
                    [% ELSIF ( uncertainprices ) %]
185
                    [% ELSIF ( uncertainprices ) %]
191
                        <div class="btn-group"><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&amp;owner=1" class="btn btn-small" id="uncertpricesbutton">Uncertain prices</a></div>
186
                        <div class="btn-group"><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&amp;owner=1" class="btn btn-small" id="uncertpricesbutton">Uncertain prices</a></div>
192
                    [% ELSE %]
187
                    [% ELSE %]
Lines 195-202 Link Here
195
                        </div>
190
                        </div>
196
                    [% END %]
191
                    [% END %]
197
                        <div class="btn-group"><a href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="icon-download"></i> Export this basket as CSV</a></div>
192
                        <div class="btn-group"><a href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="icon-download"></i> Export this basket as CSV</a></div>
198
199
                </div>
193
                </div>
194
            <!-- Modal for confirm deletion box-->
195
                <div class="modal hide" id="deleteBasketModal" tabindex="-1" role="dialog" aria-labelledby="delbasketModalLabel" aria-hidden="true">
196
                    <div class="modal-header">
197
                        <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
198
                        <h3>Confirm deletion</h3>
199
                    </div>
200
                    <div class="modal-body">
201
                       <p>Are you sure you want to delete this basket?</p>
202
                       <p>Warning:</p>
203
                       <p>All orders of this basket will be cancelled and used funds will be refunded.</p>
204
                       <p>If items have been created at ordering or receipt stage, they will be deleted.</p>
205
                       <p>You can choose to delete records if possible (if they don't have any item attached, any subscription and any other order).</p>
206
                    </div>
207
                    <div class="modal-footer">
208
                        <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
209
                        <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;" >Delete basket and orders</button>
210
                        <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],1); return false;">Delete basket, orders and records</button>
211
                    </div>
212
                </div>
213
            <!-- End of Modal-->
200
            [% ELSE %]
214
            [% ELSE %]
201
                [% UNLESS ( grouped ) %]
215
                [% UNLESS ( grouped ) %]
202
                <div id="toolbar" class="btn-toolbar">
216
                <div id="toolbar" class="btn-toolbar">
203
- 

Return to bug 7791