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

(-)a/Koha/Acquisition/Basket.pm (+37 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::Acquisition::BasketGroups;
23
use Koha::Acquisition::BasketGroups;
24
use Koha::Acquisition::Orders;
24
25
25
use base qw( Koha::Object );
26
use base qw( Koha::Object );
26
27
Lines 71-76 sub effective_create_items { Link Here
71
    return $self->create_items || C4::Context->preference('AcqCreateItem');
72
    return $self->create_items || C4::Context->preference('AcqCreateItem');
72
}
73
}
73
74
75
=head3 orders
76
77
Returns basket's orders
78
79
    # As an arrayref
80
    my $orders = $basket->orders;
81
82
    # As an array
83
    my @orders = $basket->orders;
84
85
=cut
86
87
sub orders {
88
    my ($self) = @_;
89
90
    $self->{_orders} ||= Koha::Acquisition::Orders->search({ basketno => $self->basketno });
91
92
    return wantarray ? $self->{_orders}->as_list : $self->{_orders};
93
}
94
95
sub total {
96
    my ($self) = @_;
97
98
    my $total = 0;
99
    for my $order ($self->orders){
100
        # FIXME The following is wrong
101
        if ( $self->bookseller->listincgst ) {
102
            $total = $total + ( $order->ecost_tax_included * $order->quantity );
103
        } else {
104
            $total = $total + ( $order->ecost_tax_excluded * $order->quantity );
105
        }
106
    }
107
    return $total;
108
}
109
110
74
=head2 Internal methods
111
=head2 Internal methods
75
112
76
=head3 _type
113
=head3 _type
(-)a/Koha/Acquisition/BasketGroup.pm (-1 / +91 lines)
Lines 17-23 package Koha::Acquisition::BasketGroup; Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use List::MoreUtils qw/uniq/;
21
20
use Koha::Database;
22
use Koha::Database;
23
use Koha::Acquisition::Baskets;
21
24
22
use base qw( Koha::Object );
25
use base qw( Koha::Object );
23
26
Lines 27-36 Koha::Acquisition::BasketGroup - Koha Basket group Object class Link Here
27
30
28
=head1 API
31
=head1 API
29
32
30
=head2 Class Methods
33
=head2 Methods
34
35
=head3 vendor
36
37
Returns the basketgroup's vendor (Koha::Acquisition::Bookseller)
38
39
    my $vendor = $basketgroup->vendor;
40
41
=cut
42
43
sub vendor {
44
    my ($self) = @_;
45
46
    return scalar Koha::Acquisition::Booksellers->find($self->booksellerid);
47
}
48
49
=head3 baskets
50
51
Returns the basketgroup's baskets
52
53
    my $baskets = $basketgroup->baskets;    # Koha::Acquisition::Baskets
54
    my @baskets = $basketgroup->baskets;    # array of Koha::Acquisition::Basket
55
56
=cut
57
58
sub baskets {
59
    my ($self) = @_;
60
61
    my $baskets = Koha::Acquisition::Baskets->search({ basketgroupid => $self->id });
62
63
    return wantarray ? $baskets->as_list : $baskets;
64
}
65
66
=head3 baskets_count
67
68
Returns the number of baskets contained in a basket group
69
70
    my $count = $basketgroup->baskets_count;
31
71
32
=cut
72
=cut
33
73
74
sub baskets_count {
75
    my ($self) = @_;
76
77
    return $self->baskets->count;
78
}
79
80
=head3 ordered_titles_count
81
82
Returns the number of ordered titles contained in a basket group
83
84
    my $count = $basketgroup->ordered_titles_count;
85
86
=cut
87
88
sub ordered_titles_count {
89
    my ($self) = @_;
90
91
    my @biblionumbers;
92
    foreach my $basket ($self->baskets) {
93
        foreach my $order ($basket->orders) {
94
            push @biblionumbers, $order->biblionumber;
95
        }
96
    }
97
98
    return scalar uniq @biblionumbers;
99
}
100
101
=head3 received_titles_count
102
103
Returns the number of received titles contained in a basket group
104
105
    my $count = $basketgroup->ordered_titles_count;
106
107
=cut
108
109
sub received_titles_count {
110
    my ($self) = @_;
111
112
    my @biblionumbers;
113
    foreach my $basket ($self->baskets) {
114
        foreach my $order ($basket->orders) {
115
            if ($order->datereceived) {
116
                push @biblionumbers, $order->biblionumber;
117
            }
118
        }
119
    }
120
121
    return scalar uniq @biblionumbers;
122
}
123
34
=head2 Internal methods
124
=head2 Internal methods
35
125
36
=head3 _type
126
=head3 _type
(-)a/acqui/basket.pl (-2 / +2 lines)
Lines 208-214 if ( $op eq 'delete_confirm' ) { Link Here
208
                            });
208
                            });
209
            ModBasket( { basketno => $basketno,
209
            ModBasket( { basketno => $basketno,
210
                         basketgroupid => $basketgroupid } );
210
                         basketgroupid => $basketgroupid } );
211
            print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid.'&closed=1');
211
            print $query->redirect('/cgi-bin/koha/acqui/basketgroups.pl?booksellerid='.$booksellerid);
212
        } else {
212
        } else {
213
            print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid);
213
            print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid);
214
        }
214
        }
Lines 556-562 sub edi_close_and_order { Link Here
556
                }
556
                }
557
            );
557
            );
558
            print $query->redirect(
558
            print $query->redirect(
559
"/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=$booksellerid&closed=1"
559
                "/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=$booksellerid"
560
            );
560
            );
561
        }
561
        }
562
        else {
562
        else {
(-)a/acqui/basketgroup.pl (-184 / +85 lines)
Lines 56-126 use Koha::EDI qw/create_edi_order get_edifact_ean/; Link Here
56
56
57
use Koha::Biblioitems;
57
use Koha::Biblioitems;
58
use Koha::Acquisition::Booksellers;
58
use Koha::Acquisition::Booksellers;
59
use Koha::Acquisition::BasketGroups;
59
use Koha::ItemTypes;
60
use Koha::ItemTypes;
60
use Koha::Patrons;
61
use Koha::Patrons;
61
62
62
our $input=new CGI;
63
my $input = new CGI;
63
64
our ($template, $loggedinuser, $cookie)
65
    = get_template_and_user({template_name => "acqui/basketgroup.tt",
66
			     query => $input,
67
			     type => "intranet",
68
			     authnotrequired => 0,
69
			     flagsrequired => {acquisition => 'group_manage'},
70
			     debug => 1,
71
                });
72
73
sub BasketTotal {
74
    my $basketno = shift;
75
    my $bookseller = shift;
76
    my $total = 0;
77
    my @orders = GetOrders($basketno);
78
    for my $order (@orders){
79
        # FIXME The following is wrong
80
        if ( $bookseller->listincgst ) {
81
            $total = $total + ( $order->{ecost_tax_included} * $order->{quantity} );
82
        } else {
83
            $total = $total + ( $order->{ecost_tax_excluded} * $order->{quantity} );
84
        }
85
    }
86
    return $total;
87
}
88
64
89
#displays all basketgroups and all closed baskets (in their respective groups)
65
our ($template, $loggedinuser, $cookie) = get_template_and_user({
90
sub displaybasketgroups {
66
    template_name => "acqui/basketgroup.tt",
91
    my $basketgroups = shift;
67
    query => $input,
92
    my $bookseller = shift;
68
    type => "intranet",
93
    my $baskets = shift;
69
    authnotrequired => 0,
94
    if (scalar @$basketgroups != 0) {
70
    flagsrequired => {acquisition => 'group_manage'},
95
        foreach my $basketgroup (@$basketgroups){
71
    debug => 1,
96
            my $i = 0;
72
});
97
            my $basketsqty = 0;
98
            while($i < scalar(@$baskets)){
99
                my $basket = @$baskets[$i];
100
                if($basket->{'basketgroupid'} && $basket->{'basketgroupid'} == $basketgroup->{'id'}){
101
                    $basket->{total} = BasketTotal($basket->{basketno}, $bookseller);
102
                    push(@{$basketgroup->{'baskets'}}, $basket);
103
                    splice(@$baskets, $i, 1);
104
                    ++$basketsqty;
105
                    --$i;
106
                }
107
                ++$i;
108
            }
109
            $basketgroup -> {'basketsqty'} = $basketsqty;
110
        }
111
        $template->param(basketgroups => $basketgroups);
112
    }
113
    for(my $i=0; $i < scalar @$baskets; ++$i) {
114
        if( ! @$baskets[$i]->{'closedate'} ) {
115
            splice(@$baskets, $i, 1);
116
            --$i;
117
        }else{
118
            @$baskets[$i]->{total} = BasketTotal(@$baskets[$i]->{basketno}, $bookseller);
119
        }
120
    }
121
    $template->param(baskets => $baskets);
122
    $template->param( booksellername => $bookseller->name);
123
}
124
73
125
sub printbasketgrouppdf{
74
sub printbasketgrouppdf{
126
    my ($basketgroupid) = @_;
75
    my ($basketgroupid) = @_;
Lines 211-217 sub printbasketgrouppdf{ Link Here
211
    );
160
    );
212
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->tax_rate // C4::Context->preference("gist")) || die "pdf generation failed";
161
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->tax_rate // C4::Context->preference("gist")) || die "pdf generation failed";
213
    print $pdf;
162
    print $pdf;
214
215
}
163
}
216
164
217
sub generate_edifact_orders {
165
sub generate_edifact_orders {
Lines 232-335 sub generate_edifact_orders { Link Here
232
    return;
180
    return;
233
}
181
}
234
182
235
my $op = $input->param('op') || 'display';
236
# possible values of $op :
183
# possible values of $op :
237
# - add : adds a new basketgroup, or edit an open basketgroup, or display a closed basketgroup
238
# - mod_basket : modify an individual basket of the basketgroup
184
# - mod_basket : modify an individual basket of the basketgroup
239
# - closeandprint : close and print an closed basketgroup in pdf. called by clicking on "Close and print" button in closed basketgroups list
185
# - closeandprint : close and print an closed basketgroup in pdf. called by
240
# - print : print a closed basketgroup. called by clicking on "Print" button in closed basketgroups list
186
#   clicking on "Close and print" button in closed basketgroups list
187
# - print : print a closed basketgroup. called by clicking on "Print" button in
188
#   closed basketgroups list
241
# - ediprint : generate edi order messages for the baskets in the group
189
# - ediprint : generate edi order messages for the baskets in the group
242
# - export : export in CSV a closed basketgroup. called by clicking on "Export" button in closed basketgroups list
190
# - export : export in CSV a closed basketgroup. called by clicking on "Export"
243
# - delete : delete an open basketgroup. called by clicking on "Delete" button in open basketgroups list
191
#   button in closed basketgroups list
244
# - reopen : reopen a closed basketgroup. called by clicking on "Reopen" button in closed basketgroup list
192
# - delete : delete an open basketgroup. called by clicking on "Delete" button
245
# - attachbasket : save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page
193
#   in open basketgroups list
246
# - display : display the list of all basketgroups for a vendor
194
# - reopen : reopen a closed basketgroup. called by clicking on "Reopen" button
195
#   in closed basketgroup list
196
# - attachbasket : save a modified basketgroup, or creates a new basketgroup
197
#   when a basket is closed. called from basket page
198
my $op = $input->param('op');
199
my $basketgroupid = $input->param('basketgroupid');
247
my $booksellerid = $input->param('booksellerid');
200
my $booksellerid = $input->param('booksellerid');
248
$template->param(booksellerid => $booksellerid);
201
249
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
202
my $basketgroup;
203
my $bookseller;
204
if ($basketgroupid) {
205
    $basketgroup = Koha::Acquisition::BasketGroups->find($basketgroupid);
206
    $bookseller = $basketgroup->vendor;
207
} elsif ($booksellerid) {
208
    $bookseller = Koha::Acquisition::Booksellers->find($booksellerid);
209
}
250
210
251
my $schema = Koha::Database->new()->schema();
211
my $schema = Koha::Database->new()->schema();
252
my $rs = $schema->resultset('VendorEdiAccount')->search(
212
my $rs = $schema->resultset('VendorEdiAccount')->search(
253
    { vendor_id => $booksellerid, } );
213
    { vendor_id => $booksellerid, } );
254
$template->param( ediaccount => ($rs->count > 0));
214
$template->param( ediaccount => ($rs->count > 0));
255
215
256
if ( $op eq "add" ) {
216
if ($op eq 'mod_basket') {
257
#
217
    # edit an individual basket contained in this basketgroup
258
# if no param('basketgroupid') is not defined, adds a new basketgroup
218
259
# else, edit (if it is open) or display (if it is close) the basketgroup basketgroupid
219
    my $basketno=$input->param('basketno');
260
# the template will know if basketgroup must be displayed or edited, depending on the value of closed key
220
    ModBasket( { basketno => $basketno,
261
#
221
                           basketgroupid => $basketgroupid } );
262
    my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
222
    print $input->redirect("basket.pl?basketno=" . $basketno);
263
    my $basketgroupid = $input->param('basketgroupid');
264
    my $billingplace;
265
    my $deliveryplace;
266
    my $freedeliveryplace;
267
    if ( $basketgroupid ) {
268
        # Get the selected baskets in the basketgroup to display them
269
        my $selecteds = GetBasketsByBasketgroup($basketgroupid);
270
        foreach my $basket(@{$selecteds}){
271
            $basket->{total} = BasketTotal($basket->{basketno}, $bookseller);
272
        }
273
        $template->param(basketgroupid => $basketgroupid,
274
                         selectedbaskets => $selecteds);
275
276
        # Get general informations about the basket group to prefill the form
277
        my $basketgroup = GetBasketgroup($basketgroupid);
278
        $template->param(
279
            name            => $basketgroup->{name},
280
            deliverycomment => $basketgroup->{deliverycomment},
281
            freedeliveryplace => $basketgroup->{freedeliveryplace},
282
        );
283
        $billingplace  = $basketgroup->{billingplace};
284
        $deliveryplace = $basketgroup->{deliveryplace};
285
        $freedeliveryplace = $basketgroup->{freedeliveryplace};
286
        $template->param( closedbg => ($basketgroup ->{'closed'}) ? 1 : 0);
287
    } else {
288
        $template->param( closedbg => 0);
289
    }
290
    # determine default billing and delivery places depending on librarian homebranch and existing basketgroup data
291
    my $patron = Koha::Patrons->find( $loggedinuser ); # FIXME Not needed if billingplace and deliveryplace are set
292
    $billingplace  = $billingplace  || $patron->branchcode;
293
    $deliveryplace = $deliveryplace || $patron->branchcode;
294
295
    $template->param( billingplace => $billingplace );
296
    $template->param( deliveryplace => $deliveryplace );
297
    $template->param( booksellerid => $booksellerid );
298
299
    # the template will display a unique basketgroup
300
    $template->param(grouping => 1);
301
    my $basketgroups = &GetBasketgroups($booksellerid);
302
    my $baskets = &GetBasketsByBookseller($booksellerid);
303
    displaybasketgroups($basketgroups, $bookseller, $baskets);
304
} elsif ($op eq 'mod_basket') {
305
#
306
# edit an individual basket contained in this basketgroup
307
#
308
  my $basketno=$input->param('basketno');
309
  my $basketgroupid=$input->param('basketgroupid');
310
  ModBasket( { basketno => $basketno,
311
                         basketgroupid => $basketgroupid } );
312
  print $input->redirect("basket.pl?basketno=" . $basketno);
313
} elsif ( $op eq 'closeandprint') {
223
} elsif ( $op eq 'closeandprint') {
314
#
224
    # close an open basketgroup and generates a pdf
315
# close an open basketgroup and generates a pdf
225
316
#
317
    my $basketgroupid = $input->param('basketgroupid');
318
    CloseBasketgroup($basketgroupid);
226
    CloseBasketgroup($basketgroupid);
319
    printbasketgrouppdf($basketgroupid);
227
    printbasketgrouppdf($basketgroupid);
320
    exit;
228
    exit;
321
}elsif ($op eq 'print'){
229
}elsif ($op eq 'print'){
322
#
230
    # print a closed basketgroup
323
# print a closed basketgroup
231
324
#
325
    my $basketgroupid = $input->param('basketgroupid');
326
    printbasketgrouppdf($basketgroupid);
232
    printbasketgrouppdf($basketgroupid);
327
    exit;
233
    exit;
328
}elsif ( $op eq "export" ) {
234
}elsif ( $op eq "export" ) {
329
#
235
    # export a closed basketgroup in csv
330
# export a closed basketgroup in csv
236
331
#
332
    my $basketgroupid = $input->param('basketgroupid');
333
    print $input->header(
237
    print $input->header(
334
        -type       => 'text/csv',
238
        -type       => 'text/csv',
335
        -attachment => 'basketgroup' . $basketgroupid . '.csv',
239
        -attachment => 'basketgroup' . $basketgroupid . '.csv',
Lines 337-365 if ( $op eq "add" ) { Link Here
337
    print GetBasketGroupAsCSV( $basketgroupid, $input );
241
    print GetBasketGroupAsCSV( $basketgroupid, $input );
338
    exit;
242
    exit;
339
}elsif( $op eq "delete"){
243
}elsif( $op eq "delete"){
340
#
244
    # delete an closed basketgroup
341
# delete an closed basketgroup
245
342
#
343
    my $basketgroupid = $input->param('basketgroupid');
344
    DelBasketgroup($basketgroupid);
246
    DelBasketgroup($basketgroupid);
345
    print $input->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . $booksellerid.'&amp;listclosed=1');
247
    print $input->redirect('/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=' . $bookseller->id);
248
    exit;
346
}elsif ( $op eq 'reopen'){
249
}elsif ( $op eq 'reopen'){
347
#
250
    # reopen a closed basketgroup
348
# reopen a closed basketgroup
251
349
#
350
    my $basketgroupid   = $input->param('basketgroupid');
351
    my $booksellerid    = $input->param('booksellerid');
352
    ReOpenBasketgroup($basketgroupid);
252
    ReOpenBasketgroup($basketgroupid);
353
    my $redirectpath = ((defined $input->param('mode'))&& ($input->param('mode') eq 'singlebg')) ?'/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;basketgroupid='.$basketgroupid.'&amp;booksellerid='.$booksellerid : '/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' .$booksellerid.'&amp;listclosed=1';
253
    my $redirectpath;
254
    my $mode = $input->param('mode');
255
    if (defined $mode && $mode eq 'singlebg') {
256
        $redirectpath = '/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;basketgroupid='.$basketgroupid.'&amp;booksellerid='.$bookseller->id;
257
    } else {
258
        $redirectpath = '/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=' .$bookseller->id;
259
    }
354
    print $input->redirect($redirectpath);
260
    print $input->redirect($redirectpath);
261
    exit;
355
} elsif ( $op eq 'attachbasket') {
262
} elsif ( $op eq 'attachbasket') {
356
#
263
    # save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page
357
# save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page
264
358
#
359
    # Getting parameters
360
    my $basketgroup       = {};
265
    my $basketgroup       = {};
361
    my @baskets           = $input->multi_param('basket');
266
    my @baskets           = $input->multi_param('basket');
362
    my $basketgroupid     = $input->param('basketgroupid');
363
    my $basketgroupname   = $input->param('basketgroupname');
267
    my $basketgroupname   = $input->param('basketgroupname');
364
    my $booksellerid      = $input->param('booksellerid');
268
    my $booksellerid      = $input->param('booksellerid');
365
    my $billingplace      = $input->param('billingplace');
269
    my $billingplace      = $input->param('billingplace');
Lines 368-374 if ( $op eq "add" ) { Link Here
368
    my $deliverycomment   = $input->param('deliverycomment');
272
    my $deliverycomment   = $input->param('deliverycomment');
369
    my $closedbg          = $input->param('closedbg') ? 1 : 0;
273
    my $closedbg          = $input->param('closedbg') ? 1 : 0;
370
    if ($basketgroupid) {
274
    if ($basketgroupid) {
371
    # If we have a basketgroupid we edit the basketgroup
275
        # If we have a basketgroupid we edit the basketgroup
372
        $basketgroup = {
276
        $basketgroup = {
373
              name              => $basketgroupname,
277
              name              => $basketgroupname,
374
              id                => $basketgroupid,
278
              id                => $basketgroupid,
Lines 380-393 if ( $op eq "add" ) { Link Here
380
              closed            => $closedbg,
284
              closed            => $closedbg,
381
        };
285
        };
382
        ModBasketgroup($basketgroup);
286
        ModBasketgroup($basketgroup);
383
        if($closedbg){
287
    } else {
384
# FIXME
288
        # we create a new basketgroup (with a closed basket)
385
        }
386
    }else{
387
    # we create a new basketgroup (with a closed basket)
388
        $basketgroup = {
289
        $basketgroup = {
389
            name              => $basketgroupname,
290
            name              => $basketgroupname,
390
            booksellerid      => $booksellerid,
291
            booksellerid      => $bookseller->id,
391
            basketlist        => \@baskets,
292
            basketlist        => \@baskets,
392
            billingplace      => $billingplace,
293
            billingplace      => $billingplace,
393
            deliveryplace     => $deliveryplace,
294
            deliveryplace     => $deliveryplace,
Lines 397-427 if ( $op eq "add" ) { Link Here
397
        };
298
        };
398
        $basketgroupid = NewBasketgroup($basketgroup);
299
        $basketgroupid = NewBasketgroup($basketgroup);
399
    }
300
    }
400
    my $redirectpath = ((defined $input->param('mode')) && ($input->param('mode') eq 'singlebg')) ?'/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;basketgroupid='.$basketgroupid.'&amp;booksellerid='.$booksellerid : '/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . $booksellerid;
301
    my $redirectpath;
401
    $redirectpath .=  "&amp;listclosed=1" if $closedbg ;
302
    my $mode = $input->param('mode');
402
    print $input->redirect($redirectpath );
303
    if (defined $mode && $mode eq 'singlebg') {
403
    
304
        $redirectpath = '/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;basketgroupid='.$basketgroupid.'&amp;booksellerid='.$booksellerid;
305
    } else {
306
        $redirectpath = '/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=' . $booksellerid;
307
    }
308
    print $input->redirect($redirectpath);
309
    exit;
404
} elsif ( $op eq 'ediprint') {
310
} elsif ( $op eq 'ediprint') {
405
    my $basketgroupid = $input->param('basketgroupid');
406
    if ($template->param( 'ediaccount' )) {
311
    if ($template->param( 'ediaccount' )) {
407
        generate_edifact_orders( $basketgroupid );
312
        generate_edifact_orders( $basketgroupid );
408
        exit;
313
        exit;
409
    } else {
314
    } else {
410
        $template->param('NoEDIMessage' => 1);
315
        $template->param('NoEDIMessage' => 1);
411
        my $basketgroups = &GetBasketgroups($booksellerid);
412
        my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
413
        my $baskets = &GetBasketsByBookseller($booksellerid);
414
415
        displaybasketgroups($basketgroups, $bookseller, $baskets);
416
    }
316
    }
417
}else{
418
# no param : display the list of all basketgroups for a given vendor
419
    my $basketgroups = &GetBasketgroups($booksellerid);
420
    my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
421
    my $baskets = &GetBasketsByBookseller($booksellerid);
422
423
    displaybasketgroups($basketgroups, $bookseller, $baskets);
424
}
317
}
425
$template->param(listclosed => ((defined $input->param('listclosed')) && ($input->param('listclosed') eq '1'))? 1:0 );
318
426
#prolly won't use all these, maybe just use print, the rest can be done inside validate
319
my $borrower = Koha::Patrons->find( $loggedinuser );
320
$template->param(
321
    bookseller => $bookseller,
322
    basketgroup => $basketgroup,
323
    billingplace => $basketgroup ? $basketgroup->billingplace : $borrower->branchcode,
324
    deliveryplace => $basketgroup ? $basketgroup->deliveryplace : $borrower->branchcode,
325
    baskets => [ Koha::Acquisition::Baskets->search({booksellerid => $bookseller->id, basketgroupid => undef}) ],
326
);
327
427
output_html_with_http_headers $input, $cookie, $template->output;
328
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/basketgroups.pl (+52 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use CGI qw(-utf8);
21
22
use C4::Auth;
23
use C4::Output;
24
25
use Koha::Acquisition::BasketGroups;
26
use Koha::Acquisition::Booksellers;
27
28
my $cgi = new CGI;
29
30
my ($template, $loggedinuser, $cookie) = get_template_and_user({
31
    template_name => 'acqui/basketgroups.tt',
32
    query => $cgi,
33
    type => 'intranet',
34
    flagsrequired => { acquisition => 'group_manage' },
35
});
36
37
my $booksellerid = $cgi->param('booksellerid');
38
39
my $params = {};
40
if ($booksellerid) {
41
    $params->{booksellerid} = $booksellerid;
42
    my $bookseller = Koha::Acquisition::Booksellers->find($booksellerid);
43
    $template->param(bookseller => $bookseller);
44
}
45
46
my @basketgroups = Koha::Acquisition::BasketGroups->search($params);
47
48
$template->param(
49
    basketgroups => \@basketgroups,
50
);
51
52
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc (+3 lines)
Lines 3-8 Link Here
3
        <h5>Acquisitions</h5>
3
        <h5>Acquisitions</h5>
4
        <ul>
4
        <ul>
5
            <li><a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions home</a></li>
5
            <li><a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions home</a></li>
6
            [% IF ( CAN_user_acquisition_group_manage ) %]
7
              <li><a href="/cgi-bin/koha/acqui/basketgroups.pl">Basket groups</a></li>
8
            [% END %]
6
            [% IF ( CAN_user_acquisition_order_receive ) %]<li><a href="/cgi-bin/koha/acqui/lateorders.pl">Late orders</a></li>[% END %]
9
            [% IF ( CAN_user_acquisition_order_receive ) %]<li><a href="/cgi-bin/koha/acqui/lateorders.pl">Late orders</a></li>[% END %]
7
            [% IF ( suggestion && CAN_user_acquisition_suggestions_manage ) %]<li><a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a></li>[% END %]
10
            [% IF ( suggestion && CAN_user_acquisition_suggestions_manage ) %]<li><a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a></li>[% END %]
8
            <li><a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a></li>
11
            <li><a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a></li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc (+2 lines)
Lines 23-28 Link Here
23
    var MSG_DT_SEARCH = _("Search:");
23
    var MSG_DT_SEARCH = _("Search:");
24
    var MSG_DT_ZERO_RECORDS = _("No matching records found");
24
    var MSG_DT_ZERO_RECORDS = _("No matching records found");
25
    var MSG_DT_ALL = _("All");
25
    var MSG_DT_ALL = _("All");
26
    var MSG_DT_SORT_ASC = _(": activate to sort column ascending");
27
    var MSG_DT_SORT_DESC = _(": activate to sort column descending");
26
    var CONFIG_EXCLUDE_ARTICLES_FROM_SORT = _("a an the");
28
    var CONFIG_EXCLUDE_ARTICLES_FROM_SORT = _("a an the");
27
    var MSG_DT_COPY_TITLE = _("Copy to clipboard");
29
    var MSG_DT_COPY_TITLE = _("Copy to clipboard");
28
    var MSG_DT_COPY_KEYS = _("Press ctrl or ⌘ + C to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.");
30
    var MSG_DT_COPY_KEYS = _("Press ctrl or ⌘ + C to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.");
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc (-1 / +1 lines)
Lines 2-8 Link Here
2
<div id="menu">
2
<div id="menu">
3
    <ul>
3
    <ul>
4
        [% IF ( CAN_user_acquisition_order_manage ) %]<li><a href="/cgi-bin/koha/acqui/booksellers.pl?booksellerid=[% booksellerid | uri %]">Baskets</a></li>[% END %]
4
        [% IF ( CAN_user_acquisition_order_manage ) %]<li><a href="/cgi-bin/koha/acqui/booksellers.pl?booksellerid=[% booksellerid | uri %]">Baskets</a></li>[% END %]
5
        [% IF ( CAN_user_acquisition_group_manage ) %]<li><a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | uri %]">Basket groups</a></li>[% END %]
5
        [% IF ( CAN_user_acquisition_group_manage ) %]<li><a href="/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=[% booksellerid | uri %]">Basket groups</a></li>[% END %]
6
        [% IF ( CAN_user_acquisition_contracts_manage ) %]<li><a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid | uri %]">Contracts</a></li>[% END %]
6
        [% IF ( CAN_user_acquisition_contracts_manage ) %]<li><a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid | uri %]">Contracts</a></li>[% END %]
7
        <li><a href="/cgi-bin/koha/acqui/invoices.pl?supplierid=[% booksellerid | uri %]&amp;op=do_search">Invoices</a></li>
7
        <li><a href="/cgi-bin/koha/acqui/invoices.pl?supplierid=[% booksellerid | uri %]&amp;op=do_search">Invoices</a></li>
8
        [% IF ( CAN_user_acquisition_order_manage ) %][% IF ( basketno ) %]
8
        [% IF ( CAN_user_acquisition_order_manage ) %][% IF ( basketno ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-1 / +1 lines)
Lines 879-885 Link Here
879
            $(document).ready(function(){
879
            $(document).ready(function(){
880
                $("#basketgroupid").change(function(){
880
                $("#basketgroupid").change(function(){
881
                    if($(this).val() == "new"){
881
                    if($(this).val() == "new"){
882
                        location.href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid | html %]";
882
                        location.href="/cgi-bin/koha/acqui/basketgroups.pl?op=add&booksellerid=[% booksellerid | html %]";
883
                    } else {
883
                    } else {
884
                        $(this).parent().submit();
884
                        $(this).parent().submit();
885
                    }
885
                    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt (-169 / +45 lines)
Lines 2-9 Link Here
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% USE Price %]
4
[% USE Price %]
5
[% USE KohaDates %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Koha &rsaquo; Basket grouping for [% booksellername | html %]</title>
7
<title>Koha &rsaquo; Basket groups for [% booksellername | html %]</title>
7
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'datatables.inc' %]
9
[% INCLUDE 'datatables.inc' %]
9
[% Asset.js("lib/yui/utilities/utilities.js") | $raw %]
10
[% Asset.js("lib/yui/utilities/utilities.js") | $raw %]
Lines 11-17 Link Here
11
[% Asset.js("lib/yui/container/container_core-min.js") | $raw %]
12
[% Asset.js("lib/yui/container/container_core-min.js") | $raw %]
12
[% Asset.js("lib/yui/menu/menu-min.js") | $raw %]
13
[% Asset.js("lib/yui/menu/menu-min.js") | $raw %]
13
[% Asset.js("js/basketgroup.js") | $raw %]
14
[% Asset.js("js/basketgroup.js") | $raw %]
14
[% IF ( grouping ) %]
15
[% Asset.js("lib/yui/yahoo-dom-event/yahoo-dom-event.js") | $raw %]
15
[% Asset.js("lib/yui/yahoo-dom-event/yahoo-dom-event.js") | $raw %]
16
[% Asset.js("lib/yui/animation/animation-min.js") | $raw %]
16
[% Asset.js("lib/yui/animation/animation-min.js") | $raw %]
17
[% Asset.js("lib/yui/dragdrop/dragdrop-min.js") | $raw %]
17
[% Asset.js("lib/yui/dragdrop/dragdrop-min.js") | $raw %]
Lines 85-91 fieldset.various li { Link Here
85
}
85
}
86
86
87
</style>
87
</style>
88
 [% END %]
89
<script type="text/javascript">
88
<script type="text/javascript">
90
//<![CDATA[
89
//<![CDATA[
91
	YAHOO.util.Event.onDOMReady(DDApp.init, DDApp, true);
90
	YAHOO.util.Event.onDOMReady(DDApp.init, DDApp, true);
Lines 96-125 var MSG_SAVE_BEFORE_PRINTING = _("You need to save the page before printing"); Link Here
96
var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
95
var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
97
var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
96
var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
98
97
99
function submitForm(form) {
100
    if (form.close.checked == true) {
101
	var input = document.createElement("input");
102
	input.setAttribute("type", "hidden");
103
	input.setAttribute("name", "closed");
104
	input.setAttribute("value", "1");
105
	form.appendChild(input);
106
    }
107
}
108
109
 $(document).ready(function() {
110
    $("#basket_groups").tabs();
111
112
    $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
113
        "aoColumnDefs": [
114
            { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
115
        ],
116
        "bAutoWidth": false,
117
        "sPaginationType": "four_button"
118
    } ));
119
120
 });
121
122
123
//]]>
98
//]]>
124
</script>
99
</script>
125
</head>
100
</head>
Lines 128-138 function submitForm(form) { Link Here
128
[% INCLUDE 'acquisitions-search.inc' %]
103
[% INCLUDE 'acquisitions-search.inc' %]
129
104
130
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
105
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
131
[% IF ( grouping ) %]
106
    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | uri %]">[% bookseller.name | html %]</a>
132
    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | html %]">Basket grouping</a> &rsaquo; Add basket group for [% booksellername | html %]</div>
107
    &rsaquo;
133
[% ELSE %]
108
    <a href="/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=[% bookseller.id | uri %]">Basket groups</a>
134
    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a> &rsaquo; Basket grouping</div>
109
    &rsaquo;
135
[% END %]
110
    Add basket group for [% bookseller.name | html %]
111
</div>
136
112
137
113
138
<div class="main container-fluid">
114
<div class="main container-fluid">
Lines 140-165 function submitForm(form) { Link Here
140
        <div class="col-sm-10 col-sm-push-2">
116
        <div class="col-sm-10 col-sm-push-2">
141
            <main>
117
            <main>
142
118
143
                [% IF ( grouping ) %]
119
                    [% IF (basketgroup.closeddate) %]
144
                    [% IF (closedbg) %]
145
                        <div id="toolbar" class="btn-toolbar">
120
                        <div id="toolbar" class="btn-toolbar">
146
                            <div class="btn-group"><a href="[% script_name | url %]?op=reopen&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]&amp;mode=singlebg" class="btn btn-default btn-sm" id="reopenbutton"><i class="fa fa-download"></i> Reopen this basket group</a></div>
121
                            <div class="btn-group"><a href="[% script_name | url %]?op=reopen&amp;basketgroupid=[% basketgroup.id | uri %]&amp;booksellerid=[% bookseller.id | uri %]&amp;mode=singlebg" class="btn btn-default btn-sm" id="reopenbutton"><i class="fa fa-download"></i> Reopen this basket group</a></div>
147
                            <div class="btn-group"><a href="[% script_name | url %]?op=export&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-sm" id="exportbutton"><i class="fa fa-download"></i> Export this basket group as CSV</a></div>
122
                            <div class="btn-group"><a href="[% script_name | url %]?op=export&amp;basketgroupid=[% basketgroup.id | uri %]&amp;booksellerid=[% bookseller.id | uri %]" class="btn btn-default btn-sm" id="exportbutton"><i class="fa fa-download"></i> Export this basket group as CSV</a></div>
148
                            <div class="btn-group"><a href="[% script_name | url %]?op=print&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Print this basket group in PDF</a></div>
123
                            <div class="btn-group"><a href="[% script_name | url %]?op=print&amp;basketgroupid=[% basketgroup.id | uri %]&amp;booksellerid=[% bookseller.id | uri %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Print this basket group in PDF</a></div>
149
                        [% IF (ediaccount) %]
124
                        [% IF (ediaccount) %]
150
                            <div class="btn-group"><a href="[% script_name | url %]?op=ediprint&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div>
125
                            <div class="btn-group"><a href="[% script_name | url %]?op=ediprint&amp;basketgroupid=[% basketgroup.id | uri %]&amp;booksellerid=[% bookseller.id | uri %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div>
151
                        [% END %]
126
                        [% END %]
152
                        </div>
127
                        </div>
153
                    [% END %]
128
                    [% END %]
154
                    [% IF (name && closedbg) %]
129
                    [% IF (basketgroup && basketgroup.closeddate) %]
155
                        <h1>Basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
130
                        <h1>Basket group [% basketgroup.name | html %] ([% basketgroup.id | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | uri %]">[% bookseller.name | html %]</a></h1>
156
                    [% ELSIF (name) %]
131
                    [% ELSIF (basketgroup) %]
157
                        <h1>Edit basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
132
                        <h1>Edit basket group [% basketgroup.name | html %] ([% basketgroup.id | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | uri %]">[% bookseller.name | html %]</a></h1>
158
                    [% ELSE %]
133
                    [% ELSE %]
159
                        <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
134
                        <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | uri %]">[% bookseller.name | html %]</a></h1>
160
                    [% END %]
135
                    [% END %]
136
                    [% IF NoEDIMessage %]<div><strong>No EDIFACT configuration for [% bookseller.name | html %]</strong></div>[% END %]
161
                    <div id="basketgroupcolumns" class="row">
137
                    <div id="basketgroupcolumns" class="row">
162
                        [% UNLESS (closedbg) %]
138
                        [% UNLESS (basketgroup.closeddate) %]
163
                            <div class="col-xs-6 col-xs-push-6">
139
                            <div class="col-xs-6 col-xs-push-6">
164
                                <form action="[% scriptname | html %]" method="post" name="basketgroups" id="basketgroups">
140
                                <form action="[% scriptname | html %]" method="post" name="basketgroups" id="basketgroups">
165
                                    <div id="groups">
141
                                    <div id="groups">
Lines 189-212 function submitForm(form) { Link Here
189
                                </form>
165
                                </form>
190
                            </div>
166
                            </div>
191
                        [% END %]
167
                        [% END %]
192
                        [% IF ( closedbg ) %]
168
                        [% IF ( basketgroup.closeddate ) %]
193
                            <div class="col-xs-12">
169
                            <div class="col-xs-12">
194
                        [% ELSE %]
170
                        [% ELSE %]
195
                            <div class="col-xs-6 col-xs-pull-6">
171
                            <div class="col-xs-6 col-xs-pull-6">
196
                        [% END %]
172
                        [% END %]
197
                            <form action="" method="post" id="groupingform" onsubmit="return submitForm(this)">
173
                            <form action="" method="post" id="groupingform">
198
                                <fieldset id="various" class="brief">
174
                                <fieldset id="various" class="brief">
199
                                    <ol>
175
                                    <ol>
200
                                        [% UNLESS (closedbg) %]
176
                                        [% UNLESS (basketgroup.closeddate) %]
201
                                            <li>
177
                                            <li>
202
                                                <label for="basketgroupname">Basket group name:</label>
178
                                                <label for="basketgroupname">Basket group name:</label>
203
                                                <input type="text" name="basketgroupname" id="basketgroupname" value="[% name | html %]" class="focus" />
179
                                                <input type="text" name="basketgroupname" id="basketgroupname" value="[% basketgroup.name | html %]" class="focus" />
204
                                            </li>
180
                                            </li>
205
                                        [% ELSE %]
181
                                        [% ELSE %]
206
                                            <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% name | html %]" />
182
                                            <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% basketgroup.name | html %]" />
207
                                        [% END %]
183
                                        [% END %]
208
                                        <li>
184
                                        <li>
209
                                            [% UNLESS (closedbg) %]
185
                                            [% UNLESS (basketgroup.closeddate) %]
210
                                                <label for="billingplace">Billing place:</label>
186
                                                <label for="billingplace">Billing place:</label>
211
                                                <select name="billingplace" id="billingplace">
187
                                                <select name="billingplace" id="billingplace">
212
                                                    <option value="">--</option>
188
                                                    <option value="">--</option>
Lines 214-223 function submitForm(form) { Link Here
214
                                                </select>
190
                                                </select>
215
                                            [% ELSE %]
191
                                            [% ELSE %]
216
                                                <span class="label">Billing place:</span>
192
                                                <span class="label">Billing place:</span>
217
                                                <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace | html %]" />[% Branches.GetName( billingplace ) | html %]
193
                                                <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace | html %]" />[% Branches.GetName( basketgroup.billingplace ) | html %]
218
                                            [% END %]
194
                                            [% END %]
219
                                        </li>
195
                                        </li>
220
                                        [% UNLESS (closedbg) %]
196
                                        [% UNLESS (basketgroup.closeddate) %]
221
                                            <li>
197
                                            <li>
222
                                                <label for="deliveryplace">Delivery place:</label>
198
                                                <label for="deliveryplace">Delivery place:</label>
223
                                                <select name="deliveryplace" id="deliveryplace">
199
                                                <select name="deliveryplace" id="deliveryplace">
Lines 228-264 function submitForm(form) { Link Here
228
                                            <li><p>or</p></li>
204
                                            <li><p>or</p></li>
229
                                            <li>
205
                                            <li>
230
                                                <label for="freedeliveryplace">Delivery place:</label>
206
                                                <label for="freedeliveryplace">Delivery place:</label>
231
                                                <textarea cols="26" rows="3" name="freedeliveryplace" id="freedeliveryplace">[% freedeliveryplace | html %]</textarea>
207
                                                <textarea cols="26" rows="3" name="freedeliveryplace" id="freedeliveryplace">[% basketgroup.freedeliveryplace | html %]</textarea>
232
                                            </li>
208
                                            </li>
233
                                            [% ELSE %]
209
                                            [% ELSE %]
234
                                                <li>
210
                                                <li>
235
                                                    <span class="label">Delivery place:</span>
211
                                                    <span class="label">Delivery place:</span>
236
                                                    [% IF (freedeliveryplace) %]
212
                                                    [% IF (basketgroup.freedeliveryplace) %]
237
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% freedeliveryplace | html %]" />[% freedeliveryplace | html %]
213
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% basketgroup.freedeliveryplace | html %]" />[% basketgroup.freedeliveryplace | html %]
238
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
214
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
239
                                                    [% ELSE %]
215
                                                    [% ELSE %]
240
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% deliveryplace | html %]" />[% Branches.GetName( deliveryplace ) | html %]
216
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% basketgroup.deliveryplace | html %]" />[% Branches.GetName( basketgroup.deliveryplace ) | html %]
241
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
217
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
242
                                                    [% END %]
218
                                                    [% END %]
243
                                                </li>
219
                                                </li>
244
                                            [% END %]
220
                                            [% END %]
245
                                            <li>
221
                                            <li>
246
                                                [% UNLESS (closedbg) %]
222
                                                [% UNLESS (basketgroup.closeddate) %]
247
                                                    <label for="deliverycomment">Delivery comment:</label>
223
                                                    <label for="deliverycomment">Delivery comment:</label>
248
                                                    <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% deliverycomment | html %]</textarea>
224
                                                    <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% basketgroup.deliverycomment | html %]</textarea>
249
                                                [% ELSE %]
225
                                                [% ELSE %]
250
                                                    <span class="label">Delivery comment:</span>[% deliverycomment | html %]
226
                                                    <span class="label">Delivery comment:</span>[% basketgroup.deliverycomment | html %]
251
                                                    <input name="deliverycomment" id="deliverycomment" type="hidden" value = "[% deliverycomment | html %]" />
227
                                                    <input name="deliverycomment" id="deliverycomment" type="hidden" value = "[% basketgroup.deliverycomment | html %]" />
252
                                                [% END %]
228
                                                [% END %]
253
                                            </li>
229
                                            </li>
254
                                            <li>
230
                                            <li>
255
                                                <span class="label">Baskets in this group:</span>
231
                                                <span class="label">Baskets in this group:</span>
256
                                                [% UNLESS (closedbg) %]
232
                                                [% UNLESS (basketgroup.closeddate) %]
257
                                                    <ul class="draglist" id="bg">
233
                                                    <ul class="draglist" id="bg">
258
                                                [% ELSE %]
234
                                                [% ELSE %]
259
                                                    <ul>
235
                                                    <ul>
260
                                                [% END %]
236
                                                [% END %]
261
                                                [% FOREACH selectedbasket IN selectedbaskets %]
237
                                                [% FOREACH selectedbasket IN basketgroup.baskets %]
262
                                                    <li class="grouped" id="b-[% selectedbasket.basketno | html %]" >
238
                                                    <li class="grouped" id="b-[% selectedbasket.basketno | html %]" >
263
                                                        <a href="basket.pl?basketno=[% selectedbasket.basketno | uri %]">
239
                                                        <a href="basket.pl?basketno=[% selectedbasket.basketno | uri %]">
264
                                                            [% IF ( selectedbasket.basketname ) %]
240
                                                            [% IF ( selectedbasket.basketname ) %]
Lines 273-403 function submitForm(form) { Link Here
273
                                                [% END %]
249
                                                [% END %]
274
                                            </ul>
250
                                            </ul>
275
                                        </li>
251
                                        </li>
276
                                            [% UNLESS (closedbg) %]
252
                                            [% UNLESS (basketgroup.closeddate) %]
277
                                                <li><label><input type="checkbox" id="closedbg" name="closedbg" />Close basket group</label></li>
253
                                                <li><label><input type="checkbox" id="closedbg" name="closedbg" />Close basket group</label></li>
278
                                            [% ELSE %]
254
                                            [% ELSE %]
279
                                                <input type="hidden" id="closedbg" name="closedbg" value ="1"/>
255
                                                <input type="hidden" id="closedbg" name="closedbg" value ="1"/>
280
                                            [% END %]
256
                                            [% END %]
281
                                    </ol>
257
                                    </ol>
282
                                </fieldset>
258
                                </fieldset>
283
                                [% UNLESS (closedbg) %]
259
                                [% UNLESS (basketgroup.closeddate) %]
284
                                    <fieldset class="action"><input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
260
                                    <fieldset class="action"><input type="hidden" name="booksellerid" value="[% bookseller.id | html %]" />
285
                                        [% IF ( basketgroupid ) %]
261
                                        [% IF ( basketgroup ) %]
286
                                            <input type="hidden" name="basketgroupid" value="[% basketgroupid | html %]" />
262
                                            <input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" />
287
                                        [% END %]
263
                                        [% END %]
288
                                        <input type="hidden" name="op" value="attachbasket" />
264
                                        <input type="hidden" name="op" value="attachbasket" />
289
                                        <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | uri %]" class="cancel">Cancel</a>
265
                                        <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=[% bookseller.id | uri %]" class="cancel">Cancel</a>
290
                                    </fieldset>
266
                                    </fieldset>
291
                                [% END %]
267
                                [% END %]
292
                            </form>
268
                            </form>
293
                        </div>
269
                        </div>
294
                    </div>
270
                    </div>
295
                [% ELSE %]
296
                    <div id="toolbar" class="btn-toolbar">
297
                        <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-sm" id="newbasketgroup"><i class="fa fa-plus"></i> New basket group</a></div>
298
                    </div>
299
                    <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
300
                    [% IF (NoEDIMessage) %]<div><strong>No EDIFACT configuration for [% booksellername | html %]</strong></div>[% END %]
301
                    <div id="basket_groups" class="toptabs">
302
                        <ul class="ui-tabs-nav">
303
                            [% UNLESS ( listclosed) %]<li class="ui-tabs-active"><a href="#opened">Open</a></li>
304
                            [% ELSE%]<li><a href="#opened">Open</a></li>[% END %]
305
                            [% IF ( listclosed) %]<li class="ui-tabs-active"><a href="#closed">Closed</a></li>
306
                            [% ELSE %]<li><a href="#closed">Closed</a></li>[% END %]
307
                        </ul>
308
                        <div id="opened">
309
                            <table id="basket_group_opened">
310
                                <thead>
311
                                    <tr>
312
                                        <th>Name</th>
313
                                        <th>Number</th>
314
                                        <th>Billing place</th>
315
                                        <th>Delivery place</th>
316
                                        <th>Number of baskets</th>
317
                                        <th>Action</th>
318
                                    </tr>
319
                                </thead>
320
                                <tbody>
321
                                    [% FOREACH basketgroup IN basketgroups %]
322
                                        [% UNLESS ( basketgroup.closed ) %]
323
                                            <tr>
324
                                                <td>[% IF ( basketgroup.name ) %]
325
                                                    [% basketgroup.name | html %]
326
                                                    [% ELSE %]
327
                                                        Basket group no. [% basketgroup.id | html %]
328
                                                    [% END %]
329
                                                </td>
330
                                                <td>[% basketgroup.id | html %]</td>
331
                                                <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
332
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
333
                                                <td>[% basketgroup.basketsqty | html %]</td>
334
                                                <td>
335
                                                    <input type="button" onclick="closeandprint('[% basketgroup.id | html %]');" value="Close and export as PDF" />
336
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Edit" /></form>
337
                                                    [% UNLESS basketgroup.basketsqty %]
338
                                                        <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="delete" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Delete" /></form>
339
                                                    [% END %]
340
                                                </td>
341
                                            </tr>
342
                                        [% END %]
343
                                    [% END %]
344
                                </tbody>
345
                            </table>
346
                        </div>
347
                        <div id="closed">
348
                            <table id="basket_group_closed">
349
                                <thead>
350
                                    <tr>
351
                                        <th>Name</th>
352
                                        <th>Number</th>
353
                                        <th>Billing place</th>
354
                                        <th>Delivery place</th>
355
                                        <th>Number of baskets</th>
356
                                        <th>Action</th>
357
                                    </tr>
358
                                </thead>
359
                                <tbody>
360
                                    [% FOREACH basketgroup IN basketgroups %]
361
                                        [% IF ( basketgroup.closed ) %]
362
                                            <tr>
363
                                                <td>
364
                                                    [% IF ( basketgroup.name ) %]
365
                                                        [% basketgroup.name | html %]
366
                                                        [% ELSE %]
367
                                                            Basket group no. [% basketgroup.id | html %]
368
                                                        [% END %]
369
                                                </td>
370
                                                <td>[% basketgroup.id | html %]</td>
371
                                                <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
372
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
373
                                                <td>[% basketgroup.basketsqty | html %]</td>
374
                                                <td>
375
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="View" /></form>
376
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="reopen" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Reopen" /></form>
377
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="print" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Export as PDF" /></form>
378
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="export" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Export as CSV" /></form>
379
                                            [% IF (ediaccount) %]
380
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="ediprint" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Generate EDIFACT order" /></form>
381
                                            [% ELSE %]
382
                                                    <div>No EDIFACT configuration for [% booksellername | html %]</div>
383
                                            [% END %]
384
                                                </td>
385
                                            </tr>
386
                                        [% END %]
387
                                    [% END %]
388
                                </tbody>
389
                            </table>
390
                        </div>
391
                    </div>
392
                [% END %]
393
            </main>
271
            </main>
394
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
272
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
395
273
396
        <div class="col-sm-2 col-sm-pull-10">
274
        <div class="col-sm-2 col-sm-pull-10">
397
            <aside>
275
            <aside>
398
                [% IF ( booksellerid ) %]
276
                [% INCLUDE 'vendor-menu.inc' %]
399
                    [% INCLUDE 'vendor-menu.inc' %]
400
                [% END %]
401
                [% INCLUDE 'acquisitions-menu.inc' %]
277
                [% INCLUDE 'acquisitions-menu.inc' %]
402
            </aside>
278
            </aside>
403
        </div>
279
        </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt (+168 lines)
Line 0 Link Here
1
[% USE Asset %]
2
[% USE Branches %]
3
[% USE KohaDates %]
4
[% USE raw %]
5
6
[% SET footerjs = 1 %]
7
[% INCLUDE 'doc-head-open.inc' %]
8
    [% IF bookseller %]
9
        <title>Koha &rsaquo; Basket groups for [% bookseller.name |html %]</title>
10
    [% ELSE %]
11
        <title>Koha &rsaquo; Basket groups</title>
12
    [% END %]
13
[% INCLUDE 'doc-head-close.inc' %]
14
[% Asset.css('css/datatables.css') | $raw %]
15
</head>
16
<body id="acq_basketgroup" class="acq">
17
    [% INCLUDE 'header.inc' %]
18
    [% INCLUDE 'acquisitions-search.inc' %]
19
20
    <div id="breadcrumbs">
21
        <a href="/cgi-bin/koha/mainpage.pl">Home</a>
22
        &rsaquo;
23
        <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
24
        &rsaquo;
25
        [% IF (bookseller) %]
26
            <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | $raw %]">[% bookseller.name | html %]</a>
27
            &rsaquo;
28
        [% END %]
29
        Basket groups
30
    </div>
31
32
    <div id="doc3" class="yui-t2">
33
        <div id="bd">
34
            <div id="yui-main">
35
                <div class="yui-b">
36
                    [% IF bookseller %]
37
                        <div id="toolbar" class="btn-toolbar">
38
                            <div class="btn-group">
39
                                <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% bookseller.id | $raw %]" class="btn btn-default btn-sm" id="newbasketgroup"><i class="fa fa-plus"></i> New basket group</a>
40
                            </div>
41
                        </div>
42
43
                        <h1>Basket groups for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | $raw %]">[% bookseller.name | html %]</a></h1>
44
                    [% END %]
45
46
                    [% IF basketgroups.size > 0 %]
47
                        <table id="basketgroups-table" class="group">
48
                            <thead>
49
                                <tr>
50
                                    <th>Name</th>
51
                                    <th>Vendor</th>
52
                                    <th>Billing place</th>
53
                                    <th>Delivery place</th>
54
                                    <th>No. of baskets</th>
55
                                    <th>No. of ordered titles</th>
56
                                    <th>No. of received titles</th>
57
                                    <th>Date closed</th>
58
                                    <th>Action</th>
59
                                </tr>
60
                            </thead>
61
                            <tbody>
62
                                [% FOREACH basketgroup IN basketgroups %]
63
                                    <tr>
64
                                        <td>
65
                                            [% IF ( basketgroup.name ) %]
66
                                                [% basketgroup.name | html %]
67
                                            [% ELSE %]
68
                                                Basket group no. [% basketgroup.id | $raw %]
69
                                            [% END %]
70
                                        </td>
71
                                        <td>[% basketgroup.vendor.name | html %]</td>
72
                                        <td>[% Branches.GetName(basketgroup.billingplace) | html %]</td>
73
                                        <td>
74
                                            [% IF (basketgroup.freedeliveryplace) %]
75
                                                [% basketgroup.freedeliveryplace | html %]
76
                                            [% ELSE %]
77
                                                [% Branches.GetName(basketgroup.deliveryplace) | html %]
78
                                            [% END %]
79
                                        </td>
80
                                        <td>[% basketgroup.baskets_count | $raw %]</td>
81
                                        <td>[% basketgroup.ordered_titles_count | $raw %]</td>
82
                                        <td>[% basketgroup.received_titles_count | $raw %]</td>
83
                                        <td>[% basketgroup.closeddate | $KohaDates %]</td>
84
                                        <td>
85
                                            <div class="dropdown">
86
                                            <a class="btn btn-default btn-xs dropdown-toggle" id="actions-[% basketgroup.id | $raw %]" role="button" data-toggle="dropdown">Actions <b class="caret"></b></a>
87
                                            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="actions-[% basketgroup.id | $raw %]">
88
                                            [% IF basketgroup.closeddate %]
89
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% basketgroup.booksellerid | $raw %]&basketgroupid=[% basketgroup.id | $raw %]"><i class="fa fa-eye"></i> View</a></li>
90
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=reopen&booksellerid=[% basketgroup.booksellerid | $raw %]&basketgroupid=[% basketgroup.id | $raw %]"><i class="fa fa-folder-open"></i> Reopen</a></li>
91
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=print&basketgroupid=[% basketgroup.id | $raw %]"><i class="fa fa-print"></i> Export as PDF</a></li>
92
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=export&basketgroupid=[% basketgroup.id | $raw %]"><i class="fa fa-file-text"></i> Export as CSV</a></li>
93
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=ediprint&booksellerid=[% basketgroup.booksellerid | $raw %]&basketgroupid=[% basketgroup.id | $raw %]">Generate EDIFACT order</a></li>
94
                                            [% ELSE %]
95
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% basketgroup.booksellerid | $raw %]&basketgroupid=[% basketgroup.id | $raw %]"><i class="fa fa-pencil"></i> Edit</a></li>
96
                                                <li><a class="closeandprint" href="/cgi-bin/koha/acqui/basketgroup.pl?op=closeandprint&basketgroupid=[% basketgroup.id | $raw %]"><i class="fa fa-print"></i> Close and export as PDF</a></li>
97
                                                [% UNLESS basketgroup.baskets_count %]
98
                                                    <li><a class="delete" href="/cgi-bin/koha/acqui/basketgroup.pl?op=delete&booksellerid=[% basketgroup.booksellerid | $raw %]&basketgroupid=[% basketgroup.id | $raw %]"><i class="fa fa-trash"></i> Delete</a></li>
99
                                                [% END %]
100
                                            [% END %]
101
                                            </ul>
102
                                            </div>
103
                                        </td>
104
                                    </tr>
105
                                [% END %]
106
                            </tbody>
107
                        </table>
108
                    [% END %]
109
                </div>
110
            </div>
111
            <div class="yui-b">
112
                [% IF bookseller %]
113
                    [% INCLUDE 'vendor-menu.inc' booksellerid = bookseller.id %]
114
                [% END %]
115
                [% INCLUDE 'acquisitions-menu.inc' %]
116
            </div>
117
        </div>
118
119
        [% MACRO jsinclude BLOCK %]
120
            [% INCLUDE 'datatables.inc' %]
121
            [% Asset.js('lib/jquery/plugins/jquery.dataTables.columnFilter.js') | $raw %]
122
            <script type="text/javascript">
123
                $(document).ready(function() {
124
                    var options = {
125
                        "paging": false,
126
                        "autoWidth": false,
127
                        "columnDefs": [
128
                            { "visible": false, "targets": 1 },
129
                            { "orderable": false, "targets": -1 }
130
                        ],
131
                        "orderFixed": [[ 1, 'asc' ]]
132
                    };
133
                    [% UNLESS bookseller %]
134
                        options.drawCallback = function(settings) {
135
                            var api = this.api();
136
                            var rows = api.rows({page: 'current'}).nodes();
137
                            var last = null;
138
139
                            api.column(1, {page: 'current'}).data().each(function(group, i) {
140
                                if (last !== group) {
141
                                    $(rows).eq(i).before(
142
                                        '<tr><td class="group" colspan="8">' + group + '</td></tr>'
143
                                    );
144
                                    last = group;
145
                                }
146
                            });
147
                        };
148
                    [% END %]
149
                    $("#basketgroups-table").kohaDataTable(options);
150
151
                    $('#basketgroups-table').on('click', '.closeandprint', function(e) {
152
                        e.preventDefault();
153
                        var w = window.open($(this).attr('href'));
154
                        var timer = setInterval(function() {
155
                            if (w.closed === true) {
156
                                clearInterval(timer);
157
                                window.location.reload(true);
158
                            }
159
                        }, 1000);
160
                    });
161
                    $('#basketgroups-table').on('click', '.delete', function() {
162
                        return confirm(_("Are you sure you want to delete this basketgroup ?"));
163
                    });
164
                });
165
            </script>
166
        [% END %]
167
168
    [% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-2 / +2 lines)
Lines 132-138 Link Here
132
                <td class="basketfilterclass">[% loop_order.basketname | html %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno | uri %]">[% loop_order.basketno | html %]</a>)</td>
132
                <td class="basketfilterclass">[% loop_order.basketname | html %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno | uri %]">[% loop_order.basketno | html %]</a>)</td>
133
                <td>
133
                <td>
134
                  [% IF loop_order.basketgroupid %]
134
                  [% IF loop_order.basketgroupid %]
135
                    [% loop_order.basketgroupname | html %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% loop_order.booksellerid | uri %]">[% loop_order.basketgroupid | html %]</a>)
135
                    [% loop_order.basketgroupname | html %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% loop_order.booksellerid | uri %]&basketgroupid=[% loop_order.basketgroupid | uri %]">[% loop_order.basketgroupid | html %]</a>)
136
                  [% ELSE %]
136
                  [% ELSE %]
137
                    No basket group
137
                    No basket group
138
                  [% END %]
138
                  [% END %]
Lines 279-285 Link Here
279
                <td>[% order.basketname | html %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | uri %]">[% order.basketno | html %]</a>)</td>
279
                <td>[% order.basketname | html %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | uri %]">[% order.basketno | html %]</a>)</td>
280
                <td>
280
                <td>
281
                  [% IF order.basketgroupid %]
281
                  [% IF order.basketgroupid %]
282
                    [% order.basketgroupname | html %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% order.booksellerid | uri %]">[% order.basketgroupid | html %]</a>)
282
                    [% order.basketgroupname | html %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% order.booksellerid | uri %]&basketgroupid=[% order.basketgroupid | uri %]">[% order.basketgroupid | html %]</a>)
283
                  [% ELSE %]
283
                  [% ELSE %]
284
                    No basket group
284
                    No basket group
285
                  [% END %]
285
                  [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/basketgroup.js (-8 lines)
Lines 233-246 function closebasketgroup(bgid) { Link Here
233
    div.appendChild(unclosegroup);
233
    div.appendChild(unclosegroup);
234
}
234
}
235
235
236
function closeandprint(bg){
237
    if(document.location = '/cgi-bin/koha/acqui/basketgroup.pl?op=closeandprint&amp;basketgroupid=' + bg ){
238
        setTimeout("window.location.reload();",3000);
239
    }else{
240
        alert(MSG_FILE_DOWNLOAD_ERROR);
241
    }
242
}
243
244
//function that lets the user unclose a basketgroup
236
//function that lets the user unclose a basketgroup
245
//as long as they haven't submitted the changes to the page.
237
//as long as they haven't submitted the changes to the page.
246
function unclosegroup(bgid){
238
function unclosegroup(bgid){
(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-24 / +71 lines)
Lines 1-42 Link Here
1
// These default options are for translation but can be used
1
// These default options are for translation but can be used
2
// for any other datatables settings
2
// for any other datatables settings
3
// MSG_DT_* variables comes from datatables.inc
3
// MSG_DT_* variables comes from datatables.inc
4
// To use it, write:
4
// Since version 1.10, DataTables has a new API while still providing the older
5
//  $("#table_id").dataTable($.extend(true, {}, dataTableDefaults, {
5
// one.
6
//      // other settings
6
// You can use the new API with these defaults by writing:
7
//  } ) );
7
//
8
//   $('#table_id').kohaDataTable({ ... });
9
//
10
// To use the older API, write:
11
//
12
//   $("#table_id").dataTable($.extend(true, {}, dataTablesDefaults, { ... });
13
14
var DataTableDefaults = {
15
    "language": {
16
        "emptyTable":     window.MSG_DT_EMPTY_TABLE || "No data available in table",
17
        "info":           window.MSG_DT_INFO || "Showing _START_ to _END_ of _TOTAL_ entries",
18
        "infoEmpty":      window.MSG_DT_INFO_EMPTY || "No entries to show",
19
        "infoFiltered":   window.MSG_DT_INFO_FILTERED || "(filtered from _MAX_ total entries)",
20
        "lengthMenu":     window.MSG_DT_LENGTH_MENU || "Show _MENU_ entries",
21
        "loadingRecords": window.MSG_DT_LOADING_RECORDS || "Loading...",
22
        "processing":     window.MSG_DT_PROCESSING || "Processing...",
23
        "search":         window.MSG_DT_SEARCH || "Search:",
24
        "zeroRecords":    window.MSG_DT_ZERO_RECORDS || "No matching records found",
25
        "paginate": {
26
            "first":      window.MSG_DT_FIRST || "First",
27
            "last":       window.MSG_DT_LAST || "Last",
28
            "next":       window.MSG_DT_NEXT || "Next",
29
            "previous":   window.MSG_DT_PREVIOUS || "Previous"
30
        },
31
        "aria": {
32
            "sortAscending":  window.MSG_DT_SORT_ASC || ": activate to sort column ascending",
33
            "sortDescending": window.MSG_DT_SORT_DESC || ": activate to sort column descending"
34
        },
35
        "buttons": {
36
            "copyTitle"     : window.MSG_DT_COPY_TITLE || "Copy to clipboard",
37
            "copyKeys"      : window.MSG_DT_COPY_KEYS || "Press <i>ctrl</i> or <i>⌘</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.",
38
            "copySuccess": {
39
                "_": window.MSG_DT_COPY_SUCCESS_X || "Copied %d rows to clipboard",
40
                "1": window.MSG_DT_COPY_SUCCESS_ONE || "Copied one row to clipboard"
41
            }
42
        }
43
    },
44
    "dom": '<"top pager"ilpf>tr<"bottom pager"ip>',
45
    "lengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, window.MSG_DT_ALL || "All"]],
46
    "pageLength": 20
47
};
48
8
var dataTablesDefaults = {
49
var dataTablesDefaults = {
9
    "oLanguage": {
50
    "oLanguage": {
10
        "oPaginate": {
51
        "oPaginate": {
11
            "sFirst"    : window.MSG_DT_FIRST || "First",
52
            "sFirst"    : DataTableDefaults.language.paginate.first,
12
            "sLast"     : window.MSG_DT_LAST || "Last",
53
            "sLast"     : DataTableDefaults.language.paginate.last,
13
            "sNext"     : window.MSG_DT_NEXT || "Next",
54
            "sNext"     : DataTableDefaults.language.paginate.next,
14
            "sPrevious" : window.MSG_DT_PREVIOUS || "Previous"
55
            "sPrevious" : DataTableDefaults.language.paginate.previous,
15
        },
56
        },
16
        "sEmptyTable"       : window.MSG_DT_EMPTY_TABLE || "No data available in table",
57
        "sEmptyTable"       : DataTableDefaults.language.emptyTable,
17
        "sInfo"             : window.MSG_DT_INFO || "Showing _START_ to _END_ of _TOTAL_ entries",
58
        "sInfo"             : DataTableDefaults.language.info,
18
        "sInfoEmpty"        : window.MSG_DT_INFO_EMPTY || "No entries to show",
59
        "sInfoEmpty"        : DataTableDefaults.language.infoEmpty,
19
        "sInfoFiltered"     : window.MSG_DT_INFO_FILTERED || "(filtered from _MAX_ total entries)",
60
        "sInfoFiltered"     : DataTableDefaults.language.infoFiltered,
20
        "sLengthMenu"       : window.MSG_DT_LENGTH_MENU || "Show _MENU_ entries",
61
        "sLengthMenu"       : DataTableDefaults.language.lengthMenu,
21
        "sLoadingRecords"   : window.MSG_DT_LOADING_RECORDS || "Loading...",
62
        "sLoadingRecords"   : DataTableDefaults.language.loadingRecords,
22
        "sProcessing"       : window.MSG_DT_PROCESSING || "Processing...",
63
        "sProcessing"       : DataTableDefaults.language.processing,
23
        "sSearch"           : window.MSG_DT_SEARCH || "Search:",
64
        "sSearch"           : DataTableDefaults.language.search,
24
        "sZeroRecords"      : window.MSG_DT_ZERO_RECORDS || "No matching records found",
65
        "sZeroRecords"      : DataTableDefaults.language.zeroRecords,
25
        buttons: {
66
        "buttons": {
26
            "copyTitle"     : window.MSG_DT_COPY_TITLE || "Copy to clipboard",
67
            "copyTitle"     : DataTableDefaults.language.buttons.copyTitle,
27
            "copyKeys"      : window.MSG_DT_COPY_KEYS || "Press <i>ctrl</i> or <i>⌘</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.",
68
            "copyKeys"      : DataTableDefaults.language.buttons.copyKeys,
28
            "copySuccess": {
69
            "copySuccess": {
29
                _: window.MSG_DT_COPY_SUCCESS_X || "Copied %d rows to clipboard",
70
                "_": DataTableDefaults.language.buttons.copySuccess["_"],
30
                1: window.MSG_DT_COPY_SUCCESS_ONE || "Copied one row to clipboard"
71
                "1": DataTableDefaults.language.buttons.copySuccess["1"]
31
            }
72
            }
32
        }
73
        }
33
    },
74
    },
34
    "dom": '<"top pager"ilpfB>tr<"bottom pager"ip>',
75
    "dom": '<"top pager"ilpfB>tr<"bottom pager"ip>',
35
    "buttons": [],
76
    "buttons": [],
36
    "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, window.MSG_DT_ALL || "All"]],
77
    "aLengthMenu": DataTableDefaults.lengthMenu,
37
    "iDisplayLength": 20
78
    "iDisplayLength": DataTableDefaults.pageLength
38
};
79
};
39
80
81
(function($) {
82
    $.fn.kohaDataTable = function(options) {
83
        return this.DataTable($.extend(true, {}, DataTableDefaults, options));
84
    };
85
})(jQuery);
86
40
87
41
// Return an array of string containing the values of a particular column
88
// Return an array of string containing the values of a particular column
42
$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
89
$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
(-)a/t/db_dependent/Koha/Acquisition/Basket.t (-2 / +45 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 4;
22
use Test::More tests => 5;
23
use t::lib::TestBuilder;
23
use t::lib::TestBuilder;
24
use t::lib::Mocks;
24
use t::lib::Mocks;
25
25
Lines 107-109 subtest 'basket_group' => sub { Link Here
107
107
108
    $schema->storage->txn_rollback;
108
    $schema->storage->txn_rollback;
109
};
109
};
110
- 
110
111
subtest 'total' => sub {
112
    plan tests => 2;
113
114
    $schema->storage->txn_begin;
115
    my $bookseller = $builder->build_object({
116
        class => 'Koha::Acquisition::Booksellers',
117
        value => {
118
            listincgst => 0,
119
        },
120
    });
121
    my $basket = $builder->build_object({
122
        class => 'Koha::Acquisition::Baskets',
123
        value => {
124
            booksellerid => $bookseller->id,
125
        },
126
    });
127
    my $order1 = $builder->build_object({
128
        class => 'Koha::Acquisition::Orders',
129
        value => {
130
            basketno => $basket->basketno,
131
            ecost_tax_excluded => 1.5,
132
            ecost_tax_included => 2,
133
            quantity => 2,
134
        }
135
    });
136
    my $order2 = $builder->build_object({
137
        class => 'Koha::Acquisition::Orders',
138
        value => {
139
            basketno => $basket->basketno,
140
            ecost_tax_excluded => 1.5,
141
            ecost_tax_included => 2,
142
            quantity => 2,
143
        }
144
    });
145
146
    is ($basket->total, 6);
147
148
    $bookseller->listincgst(1)->store();
149
    $basket = Koha::Acquisition::Baskets->find($basket->basketno);
150
    is ($basket->total, 8);
151
152
    $schema->storage->txn_rollback;
153
};

Return to bug 11708