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

(-)a/acqui/basket.pl (-1 / +21 lines)
Lines 97-103 $template->param( skip_confirm_reopen => 1) if $confirm_pref eq '2'; Link Here
97
97
98
if ( $op eq 'delete_confirm' ) {
98
if ( $op eq 'delete_confirm' ) {
99
    my $basketno = $query->param('basketno');
99
    my $basketno = $query->param('basketno');
100
    DelBasket($basketno);
100
    my $delbiblio = $query->param('delbiblio');
101
    my @orders = GetOrders($basketno);
102
#Delete all orders included in that basket, and all items received.
103
    foreach my $myorder (@orders){
104
        DelOrder($myorder->{biblionumber},$myorder->{ordernumber});
105
        warn "suppression de ".$myorder->{biblionumber}.'  '.$myorder->{ordernumber};
106
    }
107
# if $delbiblio = 1, delete the records if possible
108
    if ((defined $delbiblio)and ($delbiblio ==1)){
109
        foreach my $myorder (@orders){
110
            my $biblionumber = $myorder->{'biblionumber'};
111
            my $countbiblio = CountBiblioInOrders($biblionumber);
112
            my $ordernumber = $myorder->{'ordernumber'};
113
            my @subscriptions = GetSubscriptionsId ($biblionumber);
114
            my $itemcount = GetItemsCount($biblionumber);
115
            DelBiblio($myorder->{biblionumber}) if ($countbiblio == 0 && $itemcount == 0 && !(@subscriptions));
116
        warn "suppression de la notice ".$myorder->{biblionumber}};
117
    }
118
119
 # delete the basket
120
    DelBasket($basketno,);
101
    $template->param( delete_confirmed => 1 );
121
    $template->param( delete_confirmed => 1 );
102
} elsif ( !$bookseller ) {
122
} elsif ( !$bookseller ) {
103
    $template->param( NO_BOOKSELLER => 1 );
123
    $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 147-154 Link Here
147
                <div id="toolbar" class="btn-toolbar">
142
                <div id="toolbar" class="btn-toolbar">
148
                    <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>
143
                    <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>
149
                    <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>
144
                    <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>
150
                    <div class="btn-group"><a href="#" class="btn btn-small" id="delbasketbutton"><i class="icon-remove"></i> Delete this basket</a></div>
145
                    <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>
151
                    [% IF ( unclosable ) %]
146
                   [% IF ( unclosable ) %]
152
                    [% ELSIF ( uncertainprices ) %]
147
                    [% ELSIF ( uncertainprices ) %]
153
                        <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>
148
                        <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>
154
                    [% ELSE %]
149
                    [% ELSE %]
Lines 157-164 Link Here
157
                        </div>
152
                        </div>
158
                    [% END %]
153
                    [% END %]
159
                        <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>
154
                        <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>
160
161
                </div>
155
                </div>
156
            <!-- Modal for confirm deletion box-->
157
                <div class="modal hide" id="deleteBasketModal" tabindex="-1" role="dialog" aria-labelledby="delbasketModalLabel" aria-hidden="true">
158
                    <div class="modal-header">
159
                        <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
160
                        <h3>Confirm deletion</h3>
161
                    </div>
162
                    <div class="modal-body">
163
                       <p>Are you sure you want to delete this basket?</p>
164
                       <p>Warning:</p>
165
                       <p>All orders of this basket will be cancelled and used funds will be refunded.</p>
166
                       <p>If items have been created at ordering or receipt stage, they will be deleted.</p>
167
                       <p>You can choose to delete records if possible (if they don't have any item attached, any subscription and any other order).</p>
168
                    </div>
169
                    <div class="modal-footer">
170
                        <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
171
                        <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;" >Delete basket and orders</button>
172
                        <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],1); return false;">Delete basket, orders and records</button>
173
                    </div>
174
                </div>
175
            <!-- End of Modal-->
162
            [% ELSE %]
176
            [% ELSE %]
163
                [% UNLESS ( grouped ) %]
177
                [% UNLESS ( grouped ) %]
164
                <div id="toolbar" class="btn-toolbar">
178
                <div id="toolbar" class="btn-toolbar">
165
- 

Return to bug 7791