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

(-)a/Koha/Acquisition/Basket.pm (+36 lines)
Lines 22-27 use Modern::Perl; Link Here
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::DateUtils qw( dt_from_string );
23
use Koha::DateUtils qw( dt_from_string );
24
use Koha::Acquisition::BasketGroups;
24
use Koha::Acquisition::BasketGroups;
25
use Koha::Acquisition::Orders;
25
use Koha::Patrons;
26
use Koha::Patrons;
26
27
27
use base qw( Koha::Object Koha::Object::Mixin::AdditionalFields );
28
use base qw( Koha::Object Koha::Object::Mixin::AdditionalFields );
Lines 186-191 sub to_api_mapping { Link Here
186
    };
187
    };
187
}
188
}
188
189
190
=head3 orders
191
192
Returns basket's orders
193
194
    # As an arrayref
195
    my $orders = $basket->orders;
196
197
    # As an array
198
    my @orders = $basket->orders;
199
200
=cut
201
202
sub orders {
203
    my ($self) = @_;
204
205
    $self->{_orders} ||= Koha::Acquisition::Orders->search({ basketno => $self->basketno });
206
207
    return wantarray ? $self->{_orders}->as_list : $self->{_orders};
208
}
209
210
sub total {
211
    my ($self) = @_;
212
213
    my $total = 0;
214
    for my $order ($self->orders){
215
        # FIXME The following is wrong
216
        if ( $self->bookseller->listincgst ) {
217
            $total = $total + ( $order->ecost_tax_included * $order->quantity );
218
        } else {
219
            $total = $total + ( $order->ecost_tax_excluded * $order->quantity );
220
        }
221
    }
222
    return $total;
223
}
224
189
=head2 Internal methods
225
=head2 Internal methods
190
226
191
=head3 _type
227
=head3 _type
(-)a/Koha/Acquisition/BasketGroup.pm (+94 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 47-52 sub to_api_mapping { Link Here
47
    };
50
    };
48
}
51
}
49
52
53
=head2 Methods
54
55
=head3 vendor
56
57
Returns the basketgroup's vendor (Koha::Acquisition::Bookseller)
58
59
    my $vendor = $basketgroup->vendor;
60
61
=cut
62
63
sub vendor {
64
    my ($self) = @_;
65
66
    return scalar Koha::Acquisition::Booksellers->find($self->booksellerid);
67
}
68
69
=head3 baskets
70
71
Returns the basketgroup's baskets
72
73
    my $baskets = $basketgroup->baskets;    # Koha::Acquisition::Baskets
74
    my @baskets = $basketgroup->baskets;    # array of Koha::Acquisition::Basket
75
76
=cut
77
78
sub baskets {
79
    my ($self) = @_;
80
81
    my $baskets = Koha::Acquisition::Baskets->search({ basketgroupid => $self->id });
82
83
    return wantarray ? $baskets->as_list : $baskets;
84
}
85
86
=head3 baskets_count
87
88
Returns the number of baskets contained in a basket group
89
90
    my $count = $basketgroup->baskets_count;
91
92
=cut
93
94
sub baskets_count {
95
    my ($self) = @_;
96
97
    return $self->baskets->count;
98
}
99
100
=head3 ordered_titles_count
101
102
Returns the number of ordered titles contained in a basket group
103
104
    my $count = $basketgroup->ordered_titles_count;
105
106
=cut
107
108
sub ordered_titles_count {
109
    my ($self) = @_;
110
111
    my @biblionumbers;
112
    foreach my $basket ($self->baskets) {
113
        foreach my $order ($basket->orders) {
114
            push @biblionumbers, $order->biblionumber;
115
        }
116
    }
117
118
    return scalar uniq @biblionumbers;
119
}
120
121
=head3 received_titles_count
122
123
Returns the number of received titles contained in a basket group
124
125
    my $count = $basketgroup->ordered_titles_count;
126
127
=cut
128
129
sub received_titles_count {
130
    my ($self) = @_;
131
132
    my @biblionumbers;
133
    foreach my $basket ($self->baskets) {
134
        foreach my $order ($basket->orders) {
135
            if ($order->datereceived) {
136
                push @biblionumbers, $order->biblionumber;
137
            }
138
        }
139
    }
140
141
    return scalar uniq @biblionumbers;
142
}
143
50
=head2 Internal methods
144
=head2 Internal methods
51
145
52
=head3 _type
146
=head3 _type
(-)a/acqui/basket.pl (-2 / +2 lines)
Lines 210-216 if ( $op eq 'delete_confirm' ) { Link Here
210
                            });
210
                            });
211
            ModBasket( { basketno => $basketno,
211
            ModBasket( { basketno => $basketno,
212
                         basketgroupid => $basketgroupid } );
212
                         basketgroupid => $basketgroupid } );
213
            print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid.'&closed=1');
213
            print $query->redirect('/cgi-bin/koha/acqui/basketgroups.pl?booksellerid='.$booksellerid);
214
        } else {
214
        } else {
215
            print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid);
215
            print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid);
216
        }
216
        }
Lines 563-569 sub edi_close_and_order { Link Here
563
                }
563
                }
564
            );
564
            );
565
            print $query->redirect(
565
            print $query->redirect(
566
"/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=$booksellerid&closed=1"
566
                "/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=$booksellerid"
567
            );
567
            );
568
        }
568
        }
569
        else {
569
        else {
(-)a/acqui/basketgroup.pl (-185 / +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 + ( get_rounded_price($order->{ecost_tax_included}) * $order->{quantity} );
82
        } else {
83
            $total = $total + ( get_rounded_price($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-366 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
259
# else, edit (if it is open) or display (if it is close) the basketgroup basketgroupid
260
# the template will know if basketgroup must be displayed or edited, depending on the value of closed key
261
#
262
    my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
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
        # When creating a new basket group preselect billing and delivery place based on logged-in user
289
        my $patron = Koha::Patrons->find( $loggedinuser );
290
        $billingplace  = $patron->branchcode;
291
        $deliveryplace = $patron->branchcode;
292
        $template->param( closedbg => 0);
293
    }
294
218
295
    $template->param( billingplace => $billingplace );
219
    my $basketno=$input->param('basketno');
296
    $template->param( deliveryplace => $deliveryplace );
220
    ModBasket( { basketno => $basketno,
297
    $template->param( booksellerid => $booksellerid );
221
                           basketgroupid => $basketgroupid } );
298
222
    print $input->redirect("basket.pl?basketno=" . $basketno);
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
    my $basketgroup = GetBasketgroup($basketgroupid);
334
    print $input->header(
237
    print $input->header(
335
        -type       => 'text/csv',
238
        -type       => 'text/csv',
336
        -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.csv'
239
        -attachment => ( $basketgroup->name || $basketgroupid ) . '.csv'
337
    );
240
    );
338
    print GetBasketGroupAsCSV( $basketgroupid, $input );
241
    print GetBasketGroupAsCSV( $basketgroupid, $input );
339
    exit;
242
    exit;
340
}elsif( $op eq "delete"){
243
}elsif( $op eq "delete"){
341
#
244
    # delete an closed basketgroup
342
# delete an closed basketgroup
245
343
#
344
    my $basketgroupid = $input->param('basketgroupid');
345
    DelBasketgroup($basketgroupid);
246
    DelBasketgroup($basketgroupid);
346
    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;
347
}elsif ( $op eq 'reopen'){
249
}elsif ( $op eq 'reopen'){
348
#
250
    # reopen a closed basketgroup
349
# reopen a closed basketgroup
251
350
#
351
    my $basketgroupid   = $input->param('basketgroupid');
352
    my $booksellerid    = $input->param('booksellerid');
353
    ReOpenBasketgroup($basketgroupid);
252
    ReOpenBasketgroup($basketgroupid);
354
    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
    }
355
    print $input->redirect($redirectpath);
260
    print $input->redirect($redirectpath);
261
    exit;
356
} elsif ( $op eq 'attachbasket') {
262
} elsif ( $op eq 'attachbasket') {
357
#
263
    # save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page
358
# save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page
264
359
#
360
    # Getting parameters
361
    my $basketgroup       = {};
265
    my $basketgroup       = {};
362
    my @baskets           = $input->multi_param('basket');
266
    my @baskets           = $input->multi_param('basket');
363
    my $basketgroupid     = $input->param('basketgroupid');
364
    my $basketgroupname   = $input->param('basketgroupname');
267
    my $basketgroupname   = $input->param('basketgroupname');
365
    my $booksellerid      = $input->param('booksellerid');
268
    my $booksellerid      = $input->param('booksellerid');
366
    my $billingplace      = $input->param('billingplace');
269
    my $billingplace      = $input->param('billingplace');
Lines 369-375 if ( $op eq "add" ) { Link Here
369
    my $deliverycomment   = $input->param('deliverycomment');
272
    my $deliverycomment   = $input->param('deliverycomment');
370
    my $closedbg          = $input->param('closedbg') ? 1 : 0;
273
    my $closedbg          = $input->param('closedbg') ? 1 : 0;
371
    if ($basketgroupid) {
274
    if ($basketgroupid) {
372
    # If we have a basketgroupid we edit the basketgroup
275
        # If we have a basketgroupid we edit the basketgroup
373
        $basketgroup = {
276
        $basketgroup = {
374
              name              => $basketgroupname,
277
              name              => $basketgroupname,
375
              id                => $basketgroupid,
278
              id                => $basketgroupid,
Lines 381-394 if ( $op eq "add" ) { Link Here
381
              closed            => $closedbg,
284
              closed            => $closedbg,
382
        };
285
        };
383
        ModBasketgroup($basketgroup);
286
        ModBasketgroup($basketgroup);
384
        if($closedbg){
287
    } else {
385
# FIXME
288
        # we create a new basketgroup (with a closed basket)
386
        }
387
    }else{
388
    # we create a new basketgroup (with a closed basket)
389
        $basketgroup = {
289
        $basketgroup = {
390
            name              => $basketgroupname,
290
            name              => $basketgroupname,
391
            booksellerid      => $booksellerid,
291
            booksellerid      => $bookseller->id,
392
            basketlist        => \@baskets,
292
            basketlist        => \@baskets,
393
            billingplace      => $billingplace,
293
            billingplace      => $billingplace,
394
            deliveryplace     => $deliveryplace,
294
            deliveryplace     => $deliveryplace,
Lines 398-428 if ( $op eq "add" ) { Link Here
398
        };
298
        };
399
        $basketgroupid = NewBasketgroup($basketgroup);
299
        $basketgroupid = NewBasketgroup($basketgroup);
400
    }
300
    }
401
    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;
402
    $redirectpath .=  "&amp;listclosed=1" if $closedbg ;
302
    my $mode = $input->param('mode');
403
    print $input->redirect($redirectpath );
303
    if (defined $mode && $mode eq 'singlebg') {
404
    
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;
405
} elsif ( $op eq 'ediprint') {
310
} elsif ( $op eq 'ediprint') {
406
    my $basketgroupid = $input->param('basketgroupid');
407
    if ($template->param( 'ediaccount' )) {
311
    if ($template->param( 'ediaccount' )) {
408
        generate_edifact_orders( $basketgroupid );
312
        generate_edifact_orders( $basketgroupid );
409
        exit;
313
        exit;
410
    } else {
314
    } else {
411
        $template->param('NoEDIMessage' => 1);
315
        $template->param('NoEDIMessage' => 1);
412
        my $basketgroups = &GetBasketgroups($booksellerid);
413
        my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
414
        my $baskets = &GetBasketsByBookseller($booksellerid);
415
416
        displaybasketgroups($basketgroups, $bookseller, $baskets);
417
    }
316
    }
418
}else{
419
# no param : display the list of all basketgroups for a given vendor
420
    my $basketgroups = &GetBasketgroups($booksellerid);
421
    my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
422
    my $baskets = &GetBasketsByBookseller($booksellerid);
423
424
    displaybasketgroups($basketgroups, $bookseller, $baskets);
425
}
317
}
426
$template->param(listclosed => ((defined $input->param('listclosed')) && ($input->param('listclosed') eq '1'))? 1:0 );
318
427
#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
428
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_suggestions_suggestions_manage ) %]<li><a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a></li>[% END %]
10
            [% IF ( suggestion && CAN_user_suggestions_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/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 904-910 Link Here
904
            $(document).ready(function(){
904
            $(document).ready(function(){
905
                $("#basketgroupid").change(function(){
905
                $("#basketgroupid").change(function(){
906
                    if($(this).val() == "new"){
906
                    if($(this).val() == "new"){
907
                        location.href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid | html %]";
907
                        location.href="/cgi-bin/koha/acqui/basketgroups.pl?op=add&booksellerid=[% booksellerid | html %]";
908
                    } else {
908
                    } else {
909
                        $(this).parent().submit();
909
                        $(this).parent().submit();
910
                    }
910
                    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt (-166 / +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>
88
<script>
90
    YAHOO.util.Event.onDOMReady(DDApp.init, DDApp, true);
89
    YAHOO.util.Event.onDOMReady(DDApp.init, DDApp, true);
91
90
Lines 95-121 fieldset.various li { Link Here
95
    var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
94
    var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
96
    var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
95
    var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
97
96
98
    function submitForm(form) {
99
        if (form.close.checked == true) {
100
            var input = document.createElement("input");
101
            input.setAttribute("type", "hidden");
102
            input.setAttribute("name", "closed");
103
            input.setAttribute("value", "1");
104
            form.appendChild(input);
105
        }
106
    }
107
108
    $(document).ready(function() {
109
        $("#basket_groups").tabs();
110
111
        $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
112
            "aoColumnDefs": [
113
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
114
            ],
115
            "bAutoWidth": false,
116
            "sPaginationType": "full"
117
        } ));
118
    });
119
</script>
97
</script>
120
98
121
</head>
99
</head>
Lines 124-134 fieldset.various li { Link Here
124
[% INCLUDE 'acquisitions-search.inc' %]
102
[% INCLUDE 'acquisitions-search.inc' %]
125
103
126
<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;
104
<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;
127
[% IF ( grouping ) %]
105
    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | uri %]">[% bookseller.name | html %]</a>
128
    <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>
106
    &rsaquo;
129
[% ELSE %]
107
    <a href="/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=[% bookseller.id | uri %]">Basket groups</a>
130
    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a> &rsaquo; Basket grouping</div>
108
    &rsaquo;
131
[% END %]
109
    Add basket group for [% bookseller.name | html %]
110
</div>
132
111
133
112
134
<div class="main container-fluid">
113
<div class="main container-fluid">
Lines 136-161 fieldset.various li { Link Here
136
        <div class="col-sm-10 col-sm-push-2">
115
        <div class="col-sm-10 col-sm-push-2">
137
            <main>
116
            <main>
138
117
139
                [% IF ( grouping ) %]
118
                    [% IF (basketgroup.closeddate) %]
140
                    [% IF (closedbg) %]
141
                        <div id="toolbar" class="btn-toolbar">
119
                        <div id="toolbar" class="btn-toolbar">
142
                            <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" id="reopenbutton"><i class="fa fa-download"></i> Reopen this basket group</a></div>
120
                            <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" id="reopenbutton"><i class="fa fa-download"></i> Reopen this basket group</a></div>
143
                            <div class="btn-group"><a href="[% script_name | url %]?op=export&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default" id="exportbutton"><i class="fa fa-download"></i> Export this basket group as CSV</a></div>
121
                            <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" id="exportbutton"><i class="fa fa-download"></i> Export this basket group as CSV</a></div>
144
                            <div class="btn-group"><a href="[% script_name | url %]?op=print&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default" id="printbutton"><i class="fa fa-download"></i> Print this basket group in PDF</a></div>
122
                            <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" id="printbutton"><i class="fa fa-download"></i> Print this basket group in PDF</a></div>
145
                        [% IF (ediaccount) %]
123
                        [% IF (ediaccount) %]
146
                            <div class="btn-group"><a href="[% script_name | url %]?op=ediprint&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div>
124
                            <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" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div>
147
                        [% END %]
125
                        [% END %]
148
                        </div>
126
                        </div>
149
                    [% END %]
127
                    [% END %]
150
                    [% IF (name && closedbg) %]
128
                    [% IF (basketgroup && basketgroup.closeddate) %]
151
                        <h1>Basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
129
                        <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>
152
                    [% ELSIF (name) %]
130
                    [% ELSIF (basketgroup) %]
153
                        <h1>Edit basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
131
                        <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>
154
                    [% ELSE %]
132
                    [% ELSE %]
155
                        <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
133
                        <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | uri %]">[% bookseller.name | html %]</a></h1>
156
                    [% END %]
134
                    [% END %]
135
                    [% IF NoEDIMessage %]<div><strong>No EDIFACT configuration for [% bookseller.name | html %]</strong></div>[% END %]
157
                    <div id="basketgroupcolumns" class="row">
136
                    <div id="basketgroupcolumns" class="row">
158
                        [% UNLESS (closedbg) %]
137
                        [% UNLESS (basketgroup.closeddate) %]
159
                            <div class="col-xs-6 col-xs-push-6">
138
                            <div class="col-xs-6 col-xs-push-6">
160
                                <form action="[% scriptname | html %]" method="post" name="basketgroups" id="basketgroups">
139
                                <form action="[% scriptname | html %]" method="post" name="basketgroups" id="basketgroups">
161
                                    <div id="groups">
140
                                    <div id="groups">
Lines 185-208 fieldset.various li { Link Here
185
                                </form>
164
                                </form>
186
                            </div>
165
                            </div>
187
                        [% END %]
166
                        [% END %]
188
                        [% IF ( closedbg ) %]
167
                        [% IF ( basketgroup.closeddate ) %]
189
                            <div class="col-xs-12">
168
                            <div class="col-xs-12">
190
                        [% ELSE %]
169
                        [% ELSE %]
191
                            <div class="col-xs-6 col-xs-pull-6">
170
                            <div class="col-xs-6 col-xs-pull-6">
192
                        [% END %]
171
                        [% END %]
193
                            <form action="" method="post" id="groupingform" onsubmit="return submitForm(this)">
172
                            <form action="" method="post" id="groupingform">
194
                                <fieldset id="various" class="brief">
173
                                <fieldset id="various" class="brief">
195
                                    <ol>
174
                                    <ol>
196
                                        [% UNLESS (closedbg) %]
175
                                        [% UNLESS (basketgroup.closeddate) %]
197
                                            <li>
176
                                            <li>
198
                                                <label for="basketgroupname">Basket group name:</label>
177
                                                <label for="basketgroupname">Basket group name:</label>
199
                                                <input type="text" name="basketgroupname" id="basketgroupname" value="[% name | html %]" class="focus" />
178
                                                <input type="text" name="basketgroupname" id="basketgroupname" value="[% basketgroup.name | html %]" class="focus" />
200
                                            </li>
179
                                            </li>
201
                                        [% ELSE %]
180
                                        [% ELSE %]
202
                                            <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% name | html %]" />
181
                                            <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% basketgroup.name | html %]" />
203
                                        [% END %]
182
                                        [% END %]
204
                                        <li>
183
                                        <li>
205
                                            [% UNLESS (closedbg) %]
184
                                            [% UNLESS (basketgroup.closeddate) %]
206
                                                <label for="billingplace">Billing place:</label>
185
                                                <label for="billingplace">Billing place:</label>
207
                                                <select name="billingplace" id="billingplace">
186
                                                <select name="billingplace" id="billingplace">
208
                                                    <option value="">--</option>
187
                                                    <option value="">--</option>
Lines 210-219 fieldset.various li { Link Here
210
                                                </select>
189
                                                </select>
211
                                            [% ELSE %]
190
                                            [% ELSE %]
212
                                                <span class="label">Billing place:</span>
191
                                                <span class="label">Billing place:</span>
213
                                                <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace | html %]" />[% Branches.GetName( billingplace ) | html %]
192
                                                <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace | html %]" />[% Branches.GetName( basketgroup.billingplace ) | html %]
214
                                            [% END %]
193
                                            [% END %]
215
                                        </li>
194
                                        </li>
216
                                        [% UNLESS (closedbg) %]
195
                                        [% UNLESS (basketgroup.closeddate) %]
217
                                            <li>
196
                                            <li>
218
                                                <label for="deliveryplace">Delivery place:</label>
197
                                                <label for="deliveryplace">Delivery place:</label>
219
                                                <select name="deliveryplace" id="deliveryplace">
198
                                                <select name="deliveryplace" id="deliveryplace">
Lines 224-260 fieldset.various li { Link Here
224
                                            <li><p>or</p></li>
203
                                            <li><p>or</p></li>
225
                                            <li>
204
                                            <li>
226
                                                <label for="freedeliveryplace">Delivery place:</label>
205
                                                <label for="freedeliveryplace">Delivery place:</label>
227
                                                <textarea cols="26" rows="3" name="freedeliveryplace" id="freedeliveryplace">[% freedeliveryplace | html %]</textarea>
206
                                                <textarea cols="26" rows="3" name="freedeliveryplace" id="freedeliveryplace">[% basketgroup.freedeliveryplace | html %]</textarea>
228
                                            </li>
207
                                            </li>
229
                                            [% ELSE %]
208
                                            [% ELSE %]
230
                                                <li>
209
                                                <li>
231
                                                    <span class="label">Delivery place:</span>
210
                                                    <span class="label">Delivery place:</span>
232
                                                    [% IF (freedeliveryplace) %]
211
                                                    [% IF (basketgroup.freedeliveryplace) %]
233
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% freedeliveryplace | html %]" />[% freedeliveryplace | html %]
212
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% basketgroup.freedeliveryplace | html %]" />[% basketgroup.freedeliveryplace | html %]
234
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
213
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
235
                                                    [% ELSE %]
214
                                                    [% ELSE %]
236
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% deliveryplace | html %]" />[% Branches.GetName( deliveryplace ) | html %]
215
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% basketgroup.deliveryplace | html %]" />[% Branches.GetName( basketgroup.deliveryplace ) | html %]
237
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
216
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
238
                                                    [% END %]
217
                                                    [% END %]
239
                                                </li>
218
                                                </li>
240
                                            [% END %]
219
                                            [% END %]
241
                                            <li>
220
                                            <li>
242
                                                [% UNLESS (closedbg) %]
221
                                                [% UNLESS (basketgroup.closeddate) %]
243
                                                    <label for="deliverycomment">Delivery comment:</label>
222
                                                    <label for="deliverycomment">Delivery comment:</label>
244
                                                    <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% deliverycomment | html %]</textarea>
223
                                                    <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% basketgroup.deliverycomment | html %]</textarea>
245
                                                [% ELSE %]
224
                                                [% ELSE %]
246
                                                    <span class="label">Delivery comment:</span>[% deliverycomment | html %]
225
                                                    <span class="label">Delivery comment:</span>[% basketgroup.deliverycomment | html %]
247
                                                    <input name="deliverycomment" id="deliverycomment" type="hidden" value = "[% deliverycomment | html %]" />
226
                                                    <input name="deliverycomment" id="deliverycomment" type="hidden" value = "[% basketgroup.deliverycomment | html %]" />
248
                                                [% END %]
227
                                                [% END %]
249
                                            </li>
228
                                            </li>
250
                                            <li>
229
                                            <li>
251
                                                <span class="label">Baskets in this group:</span>
230
                                                <span class="label">Baskets in this group:</span>
252
                                                [% UNLESS (closedbg) %]
231
                                                [% UNLESS (basketgroup.closeddate) %]
253
                                                    <ul class="draglist" id="bg">
232
                                                    <ul class="draglist" id="bg">
254
                                                [% ELSE %]
233
                                                [% ELSE %]
255
                                                    <ul>
234
                                                    <ul>
256
                                                [% END %]
235
                                                [% END %]
257
                                                [% FOREACH selectedbasket IN selectedbaskets %]
236
                                                [% FOREACH selectedbasket IN basketgroup.baskets %]
258
                                                    <li class="grouped" id="b-[% selectedbasket.basketno | html %]" >
237
                                                    <li class="grouped" id="b-[% selectedbasket.basketno | html %]" >
259
                                                        <a href="basket.pl?basketno=[% selectedbasket.basketno | uri %]">
238
                                                        <a href="basket.pl?basketno=[% selectedbasket.basketno | uri %]">
260
                                                            [% IF ( selectedbasket.basketname ) %]
239
                                                            [% IF ( selectedbasket.basketname ) %]
Lines 269-399 fieldset.various li { Link Here
269
                                                [% END %]
248
                                                [% END %]
270
                                            </ul>
249
                                            </ul>
271
                                        </li>
250
                                        </li>
272
                                            [% UNLESS (closedbg) %]
251
                                            [% UNLESS (basketgroup.closeddate) %]
273
                                                <li><label><input type="checkbox" id="closedbg" name="closedbg" />Close basket group</label></li>
252
                                                <li><label><input type="checkbox" id="closedbg" name="closedbg" />Close basket group</label></li>
274
                                            [% ELSE %]
253
                                            [% ELSE %]
275
                                                <input type="hidden" id="closedbg" name="closedbg" value ="1"/>
254
                                                <input type="hidden" id="closedbg" name="closedbg" value ="1"/>
276
                                            [% END %]
255
                                            [% END %]
277
                                    </ol>
256
                                    </ol>
278
                                </fieldset>
257
                                </fieldset>
279
                                [% UNLESS (closedbg) %]
258
                                [% UNLESS (basketgroup.closeddate) %]
280
                                    <fieldset class="action"><input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
259
                                    <fieldset class="action"><input type="hidden" name="booksellerid" value="[% bookseller.id | html %]" />
281
                                        [% IF ( basketgroupid ) %]
260
                                        [% IF ( basketgroup ) %]
282
                                            <input type="hidden" name="basketgroupid" value="[% basketgroupid | html %]" />
261
                                            <input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" />
283
                                        [% END %]
262
                                        [% END %]
284
                                        <input type="hidden" name="op" value="attachbasket" />
263
                                        <input type="hidden" name="op" value="attachbasket" />
285
                                        <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | uri %]" class="cancel">Cancel</a>
264
                                        <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=[% bookseller.id | uri %]" class="cancel">Cancel</a>
286
                                    </fieldset>
265
                                    </fieldset>
287
                                [% END %]
266
                                [% END %]
288
                            </form>
267
                            </form>
289
                        </div>
268
                        </div>
290
                    </div>
269
                    </div>
291
                [% ELSE %]
292
                    <div id="toolbar" class="btn-toolbar">
293
                        <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default" id="newbasketgroup"><i class="fa fa-plus"></i> New basket group</a></div>
294
                    </div>
295
                    <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
296
                    [% IF (NoEDIMessage) %]<div><strong>No EDIFACT configuration for [% booksellername | html %]</strong></div>[% END %]
297
                    <div id="basket_groups" class="toptabs">
298
                        <ul class="ui-tabs-nav">
299
                            [% UNLESS ( listclosed) %]<li class="ui-tabs-active"><a href="#opened">Open</a></li>
300
                            [% ELSE%]<li><a href="#opened">Open</a></li>[% END %]
301
                            [% IF ( listclosed) %]<li class="ui-tabs-active"><a href="#closed">Closed</a></li>
302
                            [% ELSE %]<li><a href="#closed">Closed</a></li>[% END %]
303
                        </ul>
304
                        <div id="opened">
305
                            <table id="basket_group_opened">
306
                                <thead>
307
                                    <tr>
308
                                        <th>Name</th>
309
                                        <th>Number</th>
310
                                        <th>Billing place</th>
311
                                        <th>Delivery place</th>
312
                                        <th>Number of baskets</th>
313
                                        <th>Action</th>
314
                                    </tr>
315
                                </thead>
316
                                <tbody>
317
                                    [% FOREACH basketgroup IN basketgroups %]
318
                                        [% UNLESS ( basketgroup.closed ) %]
319
                                            <tr>
320
                                                <td>[% IF ( basketgroup.name ) %]
321
                                                    [% basketgroup.name | html %]
322
                                                    [% ELSE %]
323
                                                        Basket group no. [% basketgroup.id | html %]
324
                                                    [% END %]
325
                                                </td>
326
                                                <td>[% basketgroup.id | html %]</td>
327
                                                <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
328
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
329
                                                <td>[% basketgroup.basketsqty | html %]</td>
330
                                                <td>
331
                                                    <input type="button" onclick="closeandprint('[% basketgroup.id | html %]');" value="Close and export as PDF" />
332
                                                    <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>
333
                                                    [% UNLESS basketgroup.basketsqty %]
334
                                                        <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>
335
                                                    [% END %]
336
                                                </td>
337
                                            </tr>
338
                                        [% END %]
339
                                    [% END %]
340
                                </tbody>
341
                            </table>
342
                        </div>
343
                        <div id="closed">
344
                            <table id="basket_group_closed">
345
                                <thead>
346
                                    <tr>
347
                                        <th>Name</th>
348
                                        <th>Number</th>
349
                                        <th>Billing place</th>
350
                                        <th>Delivery place</th>
351
                                        <th>Number of baskets</th>
352
                                        <th>Action</th>
353
                                    </tr>
354
                                </thead>
355
                                <tbody>
356
                                    [% FOREACH basketgroup IN basketgroups %]
357
                                        [% IF ( basketgroup.closed ) %]
358
                                            <tr>
359
                                                <td>
360
                                                    [% IF ( basketgroup.name ) %]
361
                                                        [% basketgroup.name | html %]
362
                                                        [% ELSE %]
363
                                                            Basket group no. [% basketgroup.id | html %]
364
                                                        [% END %]
365
                                                </td>
366
                                                <td>[% basketgroup.id | html %]</td>
367
                                                <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
368
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
369
                                                <td>[% basketgroup.basketsqty | html %]</td>
370
                                                <td>
371
                                                    <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>
372
                                                    <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>
373
                                                    <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>
374
                                                    <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>
375
                                            [% IF (ediaccount) %]
376
                                                    <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>
377
                                            [% ELSE %]
378
                                                    <div>No EDIFACT configuration for [% booksellername | html %]</div>
379
                                            [% END %]
380
                                                </td>
381
                                            </tr>
382
                                        [% END %]
383
                                    [% END %]
384
                                </tbody>
385
                            </table>
386
                        </div>
387
                    </div>
388
                [% END %]
389
            </main>
270
            </main>
390
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
271
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
391
272
392
        <div class="col-sm-2 col-sm-pull-10">
273
        <div class="col-sm-2 col-sm-pull-10">
393
            <aside>
274
            <aside>
394
                [% IF ( booksellerid ) %]
275
                [% INCLUDE 'vendor-menu.inc' %]
395
                    [% INCLUDE 'vendor-menu.inc' %]
396
                [% END %]
397
                [% INCLUDE 'acquisitions-menu.inc' %]
276
                [% INCLUDE 'acquisitions-menu.inc' %]
398
            </aside>
277
            </aside>
399
        </div>
278
        </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt (+167 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
</head>
15
<body id="acq_basketgroup" class="acq">
16
    [% INCLUDE 'header.inc' %]
17
    [% INCLUDE 'acquisitions-search.inc' %]
18
19
    <div id="breadcrumbs">
20
        <a href="/cgi-bin/koha/mainpage.pl">Home</a>
21
        &rsaquo;
22
        <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
23
        &rsaquo;
24
        [% IF (bookseller) %]
25
            <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | $raw %]">[% bookseller.name | html %]</a>
26
            &rsaquo;
27
        [% END %]
28
        Basket groups
29
    </div>
30
31
    <div id="doc3" class="yui-t2">
32
        <div id="bd">
33
            <div id="yui-main">
34
                <div class="yui-b">
35
                    [% IF bookseller %]
36
                        <div id="toolbar" class="btn-toolbar">
37
                            <div class="btn-group">
38
                                <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>
39
                            </div>
40
                        </div>
41
42
                        <h1>Basket groups for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | $raw %]">[% bookseller.name | html %]</a></h1>
43
                    [% END %]
44
45
                    [% IF basketgroups.size > 0 %]
46
                        <table id="basketgroups-table" class="group">
47
                            <thead>
48
                                <tr>
49
                                    <th>Name</th>
50
                                    <th>Vendor</th>
51
                                    <th>Billing place</th>
52
                                    <th>Delivery place</th>
53
                                    <th>No. of baskets</th>
54
                                    <th>No. of ordered titles</th>
55
                                    <th>No. of received titles</th>
56
                                    <th>Date closed</th>
57
                                    <th>Action</th>
58
                                </tr>
59
                            </thead>
60
                            <tbody>
61
                                [% FOREACH basketgroup IN basketgroups %]
62
                                    <tr>
63
                                        <td>
64
                                            [% IF ( basketgroup.name ) %]
65
                                                [% basketgroup.name | html %]
66
                                            [% ELSE %]
67
                                                Basket group no. [% basketgroup.id | $raw %]
68
                                            [% END %]
69
                                        </td>
70
                                        <td>[% basketgroup.vendor.name | html %]</td>
71
                                        <td>[% Branches.GetName(basketgroup.billingplace) | html %]</td>
72
                                        <td>
73
                                            [% IF (basketgroup.freedeliveryplace) %]
74
                                                [% basketgroup.freedeliveryplace | html %]
75
                                            [% ELSE %]
76
                                                [% Branches.GetName(basketgroup.deliveryplace) | html %]
77
                                            [% END %]
78
                                        </td>
79
                                        <td>[% basketgroup.baskets_count | $raw %]</td>
80
                                        <td>[% basketgroup.ordered_titles_count | $raw %]</td>
81
                                        <td>[% basketgroup.received_titles_count | $raw %]</td>
82
                                        <td>[% basketgroup.closeddate | $KohaDates %]</td>
83
                                        <td>
84
                                            <div class="dropdown">
85
                                            <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>
86
                                            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="actions-[% basketgroup.id | $raw %]">
87
                                            [% IF basketgroup.closeddate %]
88
                                                <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>
89
                                                <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>
90
                                                <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>
91
                                                <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>
92
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=ediprint&booksellerid=[% basketgroup.booksellerid | $raw %]&basketgroupid=[% basketgroup.id | $raw %]">Generate EDIFACT order</a></li>
93
                                            [% ELSE %]
94
                                                <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>
95
                                                <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>
96
                                                [% UNLESS basketgroup.baskets_count %]
97
                                                    <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>
98
                                                [% END %]
99
                                            [% END %]
100
                                            </ul>
101
                                            </div>
102
                                        </td>
103
                                    </tr>
104
                                [% END %]
105
                            </tbody>
106
                        </table>
107
                    [% END %]
108
                </div>
109
            </div>
110
            <div class="yui-b">
111
                [% IF bookseller %]
112
                    [% INCLUDE 'vendor-menu.inc' booksellerid = bookseller.id %]
113
                [% END %]
114
                [% INCLUDE 'acquisitions-menu.inc' %]
115
            </div>
116
        </div>
117
118
        [% MACRO jsinclude BLOCK %]
119
            [% INCLUDE 'datatables.inc' %]
120
            [% Asset.js('lib/jquery/plugins/jquery.dataTables.columnFilter.js') | $raw %]
121
            <script type="text/javascript">
122
                $(document).ready(function() {
123
                    var options = {
124
                        "paging": false,
125
                        "autoWidth": false,
126
                        "columnDefs": [
127
                            { "visible": false, "targets": 1 },
128
                            { "orderable": false, "targets": -1 }
129
                        ],
130
                        "orderFixed": [[ 1, 'asc' ]]
131
                    };
132
                    [% UNLESS bookseller %]
133
                        options.drawCallback = function(settings) {
134
                            var api = this.api();
135
                            var rows = api.rows({page: 'current'}).nodes();
136
                            var last = null;
137
138
                            api.column(1, {page: 'current'}).data().each(function(group, i) {
139
                                if (last !== group) {
140
                                    $(rows).eq(i).before(
141
                                        '<tr><td class="group" colspan="8">' + group + '</td></tr>'
142
                                    );
143
                                    last = group;
144
                                }
145
                            });
146
                        };
147
                    [% END %]
148
                    $("#basketgroups-table").kohaDataTable(options);
149
150
                    $('#basketgroups-table').on('click', '.closeandprint', function(e) {
151
                        e.preventDefault();
152
                        var w = window.open($(this).attr('href'));
153
                        var timer = setInterval(function() {
154
                            if (w.closed === true) {
155
                                clearInterval(timer);
156
                                window.location.reload(true);
157
                            }
158
                        }, 1000);
159
                    });
160
                    $('#basketgroups-table').on('click', '.delete', function() {
161
                        return confirm(_("Are you sure you want to delete this basketgroup ?"));
162
                    });
163
                });
164
            </script>
165
        [% END %]
166
167
    [% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-1 / +1 lines)
Lines 279-285 Link Here
279
                <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | uri %]"> [% order.basketname | html %] ([% order.basketno | html %])</a></td>
279
                <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | uri %]"> [% order.basketname | html %] ([% order.basketno | html %])</a></td>
280
                <td>
280
                <td>
281
                  [% IF order.basketgroupid %]
281
                  [% IF order.basketgroupid %]
282
                  <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid | uri %]">[% order.basketgroupname | html %] ([% order.basketgroupid | html %])</a>
282
                  <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid | uri %]&amp;basketgroupid=[% order.basketgroupid | uri %]">[% order.basketgroupname | html %] ([% 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 (-28 / +77 lines)
Lines 1-32 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
// To use it, write:
3
// Since version 1.10, DataTables has a new API while still providing the older
4
//  $("#table_id").dataTable($.extend(true, {}, dataTableDefaults, {
4
// one.
5
//      // other settings
5
// You can use the new API with these defaults by writing:
6
//  } ) );
6
//
7
var dataTablesDefaults = {
7
//   $('#table_id').kohaDataTable({ ... });
8
    "oLanguage": {
8
//
9
        "oPaginate": {
9
// To use the older API, write:
10
            "sFirst"    : __('First'),
10
//
11
            "sLast"     : __('Last'),
11
//   $("#table_id").dataTable($.extend(true, {}, dataTablesDefaults, { ... });
12
            "sNext"     : __('Next'),
12
13
            "sPrevious" : __('Previous'),
13
var DataTableDefaults = {
14
    "language": {
15
        "emptyTable":     __("No data available in table"),
16
        "info":           __("Showing _START_ to _END_ of _TOTAL_ entries"),
17
        "infoEmpty":      __("No entries to show"),
18
        "infoFiltered":   __("(filtered from _MAX_ total entries)"),
19
        "lengthMenu":     __("Show _MENU_ entries"),
20
        "loadingRecords": __("Loading..."),
21
        "processing":     __("Processing..."),
22
        "search":         __("Search:"),
23
        "zeroRecords":    __("No matching records found"),
24
        "paginate": {
25
            "first":      __("First"),
26
            "last":       __("Last"),
27
            "next":       __("Next"),
28
            "previous":   __("Previous")
14
        },
29
        },
15
        "sEmptyTable"       : __('No data available in table'),
30
        "aria": {
16
        "sInfo"             : __('Showing _START_ to _END_ of _TOTAL_ entries'),
31
            "sortAscending":  __(": activate to sort column ascending"),
17
        "sInfoEmpty"        : __('No entries to show'),
32
            "sortDescending": __(": activate to sort column descending")
18
        "sInfoFiltered"     : __('(filtered from _MAX_ total entries)'),
33
        },
19
        "sLengthMenu"       : __('Show _MENU_ entries'),
34
        "buttons": {
20
        "sLoadingRecords"   : __('Loading...'),
35
            "copyTitle"     : __("Copy to clipboard"),
21
        "sProcessing"       : __('Processing...'),
36
            "copyKeys"      : __("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."),
22
        "sSearch"           : __('Search:'),
23
        "sZeroRecords"      : __('No matching records found'),
24
        buttons: {
25
            "copyTitle"     : __('Copy to clipboard'),
26
            "copyKeys"      : __('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.'),
27
            "copySuccess": {
37
            "copySuccess": {
28
                _: __('Copied %d rows to clipboard'),
38
                "_": __("Copied %d rows to clipboard"),
29
                1: __('Copied one row to clipboard'),
39
                "1": __("Copied one row to clipboard")
30
            }
40
            }
31
        }
41
        }
32
    },
42
    },
Lines 48-55 var dataTablesDefaults = { Link Here
48
            node.addClass("disabled");
58
            node.addClass("disabled");
49
        }
59
        }
50
    }],
60
    }],
51
    "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, __('All')]],
61
    "lengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, __('All')]],
52
    "iDisplayLength": 20,
62
    "pageLength": 20,
53
    initComplete: function( settings) {
63
    initComplete: function( settings) {
54
        var tableId = settings.nTable.id
64
        var tableId = settings.nTable.id
55
        // When the DataTables search function is triggered,
65
        // When the DataTables search function is triggered,
Lines 62-70 var dataTablesDefaults = { Link Here
62
                $("#" + tableId + "_wrapper").find(".dt_button_clear_filter").removeClass("disabled");
72
                $("#" + tableId + "_wrapper").find(".dt_button_clear_filter").removeClass("disabled");
63
            }
73
            }
64
        });
74
        });
65
    }
75
    },
76
};
77
78
var dataTablesDefaults = {
79
    "oLanguage": {
80
        "oPaginate": {
81
            "sFirst"    : DataTableDefaults.language.paginate.first,
82
            "sLast"     : DataTableDefaults.language.paginate.last,
83
            "sNext"     : DataTableDefaults.language.paginate.next,
84
            "sPrevious" : DataTableDefaults.language.paginate.previous,
85
        },
86
        "sEmptyTable"       : DataTableDefaults.language.emptyTable,
87
        "sInfo"             : DataTableDefaults.language.info,
88
        "sInfoEmpty"        : DataTableDefaults.language.infoEmpty,
89
        "sInfoFiltered"     : DataTableDefaults.language.infoFiltered,
90
        "sLengthMenu"       : DataTableDefaults.language.lengthMenu,
91
        "sLoadingRecords"   : DataTableDefaults.language.loadingRecords,
92
        "sProcessing"       : DataTableDefaults.language.processing,
93
        "sSearch"           : DataTableDefaults.language.search,
94
        "sZeroRecords"      : DataTableDefaults.language.zeroRecords,
95
        "buttons": {
96
            "copyTitle"     : DataTableDefaults.language.buttons.copyTitle,
97
            "copyKeys"      : DataTableDefaults.language.buttons.copyKeys,
98
            "copySuccess": {
99
                "_": DataTableDefaults.language.buttons.copySuccess["_"],
100
                "1": DataTableDefaults.language.buttons.copySuccess["1"]
101
            }
102
        }
103
    },
104
    "dom": '<"top pager"ilpfB>tr<"bottom pager"ip>',
105
    "buttons": DataTableDefaults.buttons,
106
    "aLengthMenu": DataTableDefaults.lengthMenu,
107
    "iDisplayLength": DataTableDefaults.pageLength,
108
    initComplete: DataTableDefaults.initComplete,
66
};
109
};
67
110
111
(function($) {
112
    $.fn.kohaDataTable = function(options) {
113
        return this.DataTable($.extend(true, {}, DataTableDefaults, options));
114
    };
115
})(jQuery);
116
68
117
69
// Return an array of string containing the values of a particular column
118
// Return an array of string containing the values of a particular column
70
$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
119
$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
(-)a/t/db_dependent/Koha/Acquisition/Basket.t (-2 / +43 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 9;
22
use Test::More tests => 10;
23
use t::lib::TestBuilder;
23
use t::lib::TestBuilder;
24
use t::lib::Mocks;
24
use t::lib::Mocks;
25
25
Lines 268-273 subtest 'authorizer' => sub { Link Here
268
        $basket_creator->borrowernumber,
268
        $basket_creator->borrowernumber,
269
        '->authorized should return the correct creator'
269
        '->authorized should return the correct creator'
270
    );
270
    );
271
};
272
273
subtest 'total' => sub {
274
    plan tests => 2;
275
276
    $schema->storage->txn_begin;
277
    my $bookseller = $builder->build_object({
278
        class => 'Koha::Acquisition::Booksellers',
279
        value => {
280
            listincgst => 0,
281
        },
282
    });
283
    my $basket = $builder->build_object({
284
        class => 'Koha::Acquisition::Baskets',
285
        value => {
286
            booksellerid => $bookseller->id,
287
        },
288
    });
289
    my $order1 = $builder->build_object({
290
        class => 'Koha::Acquisition::Orders',
291
        value => {
292
            basketno => $basket->basketno,
293
            ecost_tax_excluded => 1.5,
294
            ecost_tax_included => 2,
295
            quantity => 2,
296
        }
297
    });
298
    my $order2 = $builder->build_object({
299
        class => 'Koha::Acquisition::Orders',
300
        value => {
301
            basketno => $basket->basketno,
302
            ecost_tax_excluded => 1.5,
303
            ecost_tax_included => 2,
304
            quantity => 2,
305
        }
306
    });
307
308
    is ($basket->total, 6);
309
310
    $bookseller->listincgst(1)->store();
311
    $basket = Koha::Acquisition::Baskets->find($basket->basketno);
312
    is ($basket->total, 8);
271
313
272
    $schema->storage->txn_rollback;
314
    $schema->storage->txn_rollback;
273
};
315
};
274
- 

Return to bug 11708