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

(-)a/C4/Acquisition.pm (-2 / +6 lines)
Lines 1510-1516 sub ModReceiveOrder { Link Here
1510
        $order->{datereceived} = $datereceived;
1510
        $order->{datereceived} = $datereceived;
1511
        $order->{invoiceid} = $invoice->{invoiceid};
1511
        $order->{invoiceid} = $invoice->{invoiceid};
1512
        $order->{orderstatus} = 'complete';
1512
        $order->{orderstatus} = 'complete';
1513
        $new_ordernumber = Koha::Acquisition::Order->new($order)->store->ordernumber; # TODO What if the store fails?
1513
        my @columns = Koha::Acquisition::Orders->columns;
1514
        my %filtered_order = map { exists $order->{$_} ? ($_ => $order->{$_}) : () } @columns;
1515
        $new_ordernumber = Koha::Acquisition::Order->new(\%filtered_order)->store->ordernumber;
1514
1516
1515
        if ($received_items) {
1517
        if ($received_items) {
1516
            foreach my $itemnumber (@$received_items) {
1518
            foreach my $itemnumber (@$received_items) {
Lines 2000-2006 sub TransferOrder { Link Here
2000
    delete $order->{parent_ordernumber};
2002
    delete $order->{parent_ordernumber};
2001
    $order->{'basketno'} = $basketno;
2003
    $order->{'basketno'} = $basketno;
2002
2004
2003
    my $newordernumber = Koha::Acquisition::Order->new($order)->store->ordernumber;
2005
    my @columns = Koha::Acquisition::Orders->columns;
2006
    my %filtered_order = map { exists $order->{$_} ? ($_ => $order->{$_}) : () } @columns;
2007
    my $newordernumber = Koha::Acquisition::Order->new(\%filtered_order)->store->ordernumber;
2004
2008
2005
    $query = q{
2009
    $query = q{
2006
        UPDATE aqorders_items
2010
        UPDATE aqorders_items
(-)a/Koha/Acquisition/Basket.pm (+22 lines)
Lines 20-25 package Koha::Acquisition::Basket; Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::Acquisition::Orders;
23
24
24
use base qw( Koha::Object );
25
use base qw( Koha::Object );
25
26
Lines 58-63 sub effective_create_items { Link Here
58
    return $self->create_items || C4::Context->preference('AcqCreateItem');
59
    return $self->create_items || C4::Context->preference('AcqCreateItem');
59
}
60
}
60
61
62
=head3 orders
63
64
Returns basket's orders
65
66
    # As an arrayref
67
    my $orders = $basket->orders;
68
69
    # As an array
70
    my @orders = $basket->orders;
71
72
=cut
73
74
sub orders {
75
    my ($self) = @_;
76
77
    $self->{_orders} ||= Koha::Acquisition::Orders->search({ basketno => $self->basketno });
78
79
    return wantarray ? $self->{_orders}->as_list : $self->{_orders};
80
}
81
82
61
=head2 Internal methods
83
=head2 Internal methods
62
84
63
=head3 _type
85
=head3 _type
(-)a/Koha/Acquisition/Basketgroup.pm (+133 lines)
Line 0 Link Here
1
package Koha::Acquisition::Basketgroup;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use List::MoreUtils qw/uniq/;
21
22
use Koha::Acquisition::Baskets;
23
24
use base qw(Koha::Object);
25
26
=head1 NAME
27
28
Koha::Acquisition::Basketgroup
29
30
=head1 API
31
32
=head2 Methods
33
34
=head3 bookseller
35
36
Returns the basketgroup's bookseller (Koha::Acquisition::Bookseller)
37
38
    my $bookseller = $basketgroup->bookseller;
39
40
=cut
41
42
sub bookseller {
43
    my ($self) = @_;
44
45
    return scalar Koha::Acquisition::Booksellers->find($self->booksellerid);
46
}
47
48
=head3 baskets
49
50
Returns the basketgroup's baskets
51
52
    my $baskets = $basketgroup->baskets;    # Koha::Acquisition::Baskets
53
    my @baskets = $basketgroup->baskets;    # array of Koha::Acquisition::Basket
54
55
=cut
56
57
sub baskets {
58
    my ($self) = @_;
59
60
    $self->{_baskets} ||= Koha::Acquisition::Baskets->search({ basketgroupid => $self->id });
61
62
    return wantarray ? $self->{_baskets}->as_list : $self->{_baskets};
63
}
64
65
=head3 baskets_count
66
67
Returns the number of baskets contained in a basket group
68
69
    my $count = $basketgroup->baskets_count;
70
71
=cut
72
73
sub baskets_count {
74
    my ($self) = @_;
75
76
    return $self->baskets->count;
77
}
78
79
=head3 ordered_titles_count
80
81
Returns the number of ordered titles contained in a basket group
82
83
    my $count = $basketgroup->ordered_titles_count;
84
85
=cut
86
87
sub ordered_titles_count {
88
    my ($self) = @_;
89
90
    my @biblionumbers;
91
    foreach my $basket ($self->baskets) {
92
        foreach my $order ($basket->orders) {
93
            push @biblionumbers, $order->biblionumber;
94
        }
95
    }
96
97
    return scalar uniq @biblionumbers;
98
}
99
100
=head3 received_titles_count
101
102
Returns the number of received titles contained in a basket group
103
104
    my $count = $basketgroup->ordered_titles_count;
105
106
=cut
107
108
sub received_titles_count {
109
    my ($self) = @_;
110
111
    my @biblionumbers;
112
    foreach my $basket ($self->baskets) {
113
        foreach my $order ($basket->orders) {
114
            if ($order->datereceived) {
115
                push @biblionumbers, $order->biblionumber;
116
            }
117
        }
118
    }
119
120
    return scalar uniq @biblionumbers;
121
}
122
123
=head2 Internal Methods
124
125
=head3 _type
126
127
=cut
128
129
sub _type {
130
    return 'Aqbasketgroup';
131
}
132
133
1;
(-)a/Koha/Acquisition/Basketgroups.pm (+50 lines)
Line 0 Link Here
1
package Koha::Acquisition::Basketgroups;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Koha::Acquisition::Basketgroup;
21
22
use base qw(Koha::Objects);
23
24
=head1 NAME
25
26
Koha::Acquisition::Basketgroups
27
28
=head1 API
29
30
=head2 Internal methods
31
32
=cut
33
34
=head3 _type
35
36
=cut
37
38
sub _type {
39
    return 'Aqbasketgroup';
40
}
41
42
=head3 object_class
43
44
=cut
45
46
sub object_class {
47
    return 'Koha::Acquisition::Basketgroup';
48
}
49
50
1;
(-)a/acqui/basket.pl (-2 / +2 lines)
Lines 207-213 if ( $op eq 'delete_confirm' ) { Link Here
207
                            });
207
                            });
208
            ModBasket( { basketno => $basketno,
208
            ModBasket( { basketno => $basketno,
209
                         basketgroupid => $basketgroupid } );
209
                         basketgroupid => $basketgroupid } );
210
            print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid.'&closed=1');
210
            print $query->redirect('/cgi-bin/koha/acqui/basketgroups.pl?booksellerid='.$booksellerid);
211
        } else {
211
        } else {
212
            print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid);
212
            print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid);
213
        }
213
        }
Lines 554-560 sub edi_close_and_order { Link Here
554
                }
554
                }
555
            );
555
            );
556
            print $query->redirect(
556
            print $query->redirect(
557
"/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=$booksellerid&closed=1"
557
                "/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=$booksellerid"
558
            );
558
            );
559
        }
559
        }
560
        else {
560
        else {
(-)a/acqui/basketgroup.pl (-91 / +96 lines)
Lines 58-63 use Koha::Acquisition::Booksellers; Link Here
58
use Koha::ItemTypes;
58
use Koha::ItemTypes;
59
use Koha::Patrons;
59
use Koha::Patrons;
60
60
61
use List::MoreUtils qw/uniq/;
62
61
our $input=new CGI;
63
our $input=new CGI;
62
64
63
our ($template, $loggedinuser, $cookie)
65
our ($template, $loggedinuser, $cookie)
Lines 87-95 sub BasketTotal { Link Here
87
89
88
#displays all basketgroups and all closed baskets (in their respective groups)
90
#displays all basketgroups and all closed baskets (in their respective groups)
89
sub displaybasketgroups {
91
sub displaybasketgroups {
90
    my $basketgroups = shift;
92
    my ($basketgroups, $bookseller, $baskets, $template) = @_;
91
    my $bookseller = shift;
92
    my $baskets = shift;
93
    if (scalar @$basketgroups != 0) {
93
    if (scalar @$basketgroups != 0) {
94
        foreach my $basketgroup (@$basketgroups){
94
        foreach my $basketgroup (@$basketgroups){
95
            my $i = 0;
95
            my $i = 0;
Lines 123-151 sub displaybasketgroups { Link Here
123
123
124
sub printbasketgrouppdf{
124
sub printbasketgrouppdf{
125
    my ($basketgroupid) = @_;
125
    my ($basketgroupid) = @_;
126
    
126
127
    my $pdfformat = C4::Context->preference("OrderPdfFormat");
127
    my $pdfformat = C4::Context->preference("OrderPdfFormat");
128
    if ($pdfformat eq 'pdfformat::layout3pages' || $pdfformat eq 'pdfformat::layout2pages' || $pdfformat eq 'pdfformat::layout3pagesfr'
128
    if ($pdfformat eq 'pdfformat::layout3pages' || $pdfformat eq 'pdfformat::layout2pages' || $pdfformat eq 'pdfformat::layout3pagesfr'
129
        || $pdfformat eq 'pdfformat::layout2pagesde'){
129
        || $pdfformat eq 'pdfformat::layout2pagesde'){
130
	eval {
130
        eval {
131
        eval "require $pdfformat";
131
            my $pdfformatfile = './' . ($pdfformat =~ s,::,/,gr) . '.pm';
132
	    import $pdfformat;
132
            require $pdfformatfile;
133
	};
133
            import $pdfformat;
134
	if ($@){
134
        };
135
	}
135
        if ($@){
136
            warn $@;
137
        }
136
    }
138
    }
137
    else {
139
    else {
138
	print $input->header;  
140
        print $input->header;
139
	print $input->start_html;  # FIXME Should do a nicer page
141
        print $input->start_html;  # FIXME Should do a nicer page
140
	print "<h1>Invalid PDF Format set</h1>";
142
        print "<h1>Invalid PDF Format set</h1>";
141
	print "Please go to the systempreferences and set a valid pdfformat";
143
        print "Please go to the systempreferences and set a valid pdfformat";
142
	exit;
144
        exit;
143
    }
145
    }
144
    
146
145
    my $basketgroup = GetBasketgroup($basketgroupid);
147
    my $basketgroup = GetBasketgroup($basketgroupid);
146
    my $bookseller = Koha::Acquisition::Booksellers->find( $basketgroup->{booksellerid} );
148
    my $bookseller = Koha::Acquisition::Booksellers->find( $basketgroup->{booksellerid} );
147
    my $baskets = GetBasketsByBasketgroup($basketgroupid);
149
    my $baskets = GetBasketsByBasketgroup($basketgroupid);
148
    
150
149
    my %orders;
151
    my %orders;
150
    for my $basket (@$baskets) {
152
    for my $basket (@$baskets) {
151
        my @ba_orders;
153
        my @ba_orders;
Lines 212-218 sub printbasketgrouppdf{ Link Here
212
    );
214
    );
213
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->tax_rate // C4::Context->preference("gist")) || die "pdf generation failed";
215
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->tax_rate // C4::Context->preference("gist")) || die "pdf generation failed";
214
    print $pdf;
216
    print $pdf;
215
216
}
217
}
217
218
218
sub generate_edifact_orders {
219
sub generate_edifact_orders {
Lines 226-295 sub generate_edifact_orders { Link Here
226
    return;
227
    return;
227
}
228
}
228
229
229
my $op = $input->param('op') || 'display';
230
# possible values of $op :
230
# possible values of $op :
231
# - add : adds a new basketgroup, or edit an open basketgroup, or display a closed basketgroup
232
# - mod_basket : modify an individual basket of the basketgroup
231
# - mod_basket : modify an individual basket of the basketgroup
233
# - closeandprint : close and print an closed basketgroup in pdf. called by clicking on "Close and print" button in closed basketgroups list
232
# - closeandprint : close and print an closed basketgroup in pdf. called by
234
# - print : print a closed basketgroup. called by clicking on "Print" button in closed basketgroups list
233
#   clicking on "Close and print" button in closed basketgroups list
234
# - print : print a closed basketgroup. called by clicking on "Print" button in
235
#   closed basketgroups list
235
# - ediprint : generate edi order messages for the baskets in the group
236
# - ediprint : generate edi order messages for the baskets in the group
236
# - export : export in CSV a closed basketgroup. called by clicking on "Export" button in closed basketgroups list
237
# - export : export in CSV a closed basketgroup. called by clicking on "Export"
237
# - delete : delete an open basketgroup. called by clicking on "Delete" button in open basketgroups list
238
#   button in closed basketgroups list
238
# - reopen : reopen a closed basketgroup. called by clicking on "Reopen" button in closed basketgroup list
239
# - delete : delete an open basketgroup. called by clicking on "Delete" button
239
# - attachbasket : save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page
240
#   in open basketgroups list
240
# - display : display the list of all basketgroups for a vendor
241
# - reopen : reopen a closed basketgroup. called by clicking on "Reopen" button
242
#   in closed basketgroup list
243
# - attachbasket : save a modified basketgroup, or creates a new basketgroup
244
#   when a basket is closed. called from basket page
245
my $op = $input->param('op');
241
my $booksellerid = $input->param('booksellerid');
246
my $booksellerid = $input->param('booksellerid');
242
$template->param(booksellerid => $booksellerid);
243
247
244
if ( $op eq "add" ) {
248
if ($op eq 'mod_basket') {
245
#
246
# if no param('basketgroupid') is not defined, adds a new basketgroup
247
# else, edit (if it is open) or display (if it is close) the basketgroup basketgroupid
248
# the template will know if basketgroup must be displayed or edited, depending on the value of closed key
249
#
250
    my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
251
    my $basketgroupid = $input->param('basketgroupid');
252
    my $billingplace;
253
    my $deliveryplace;
254
    my $freedeliveryplace;
255
    if ( $basketgroupid ) {
256
        # Get the selected baskets in the basketgroup to display them
257
        my $selecteds = GetBasketsByBasketgroup($basketgroupid);
258
        foreach my $basket(@{$selecteds}){
259
            $basket->{total} = BasketTotal($basket->{basketno}, $bookseller);
260
        }
261
        $template->param(basketgroupid => $basketgroupid,
262
                         selectedbaskets => $selecteds);
263
264
        # Get general informations about the basket group to prefill the form
265
        my $basketgroup = GetBasketgroup($basketgroupid);
266
        $template->param(
267
            name            => $basketgroup->{name},
268
            deliverycomment => $basketgroup->{deliverycomment},
269
            freedeliveryplace => $basketgroup->{freedeliveryplace},
270
        );
271
        $billingplace  = $basketgroup->{billingplace};
272
        $deliveryplace = $basketgroup->{deliveryplace};
273
        $freedeliveryplace = $basketgroup->{freedeliveryplace};
274
        $template->param( closedbg => ($basketgroup ->{'closed'}) ? 1 : 0);
275
    } else {
276
        $template->param( closedbg => 0);
277
    }
278
    # determine default billing and delivery places depending on librarian homebranch and existing basketgroup data
279
    my $patron = Koha::Patrons->find( $loggedinuser ); # FIXME Not needed if billingplace and deliveryplace are set
280
    $billingplace  = $billingplace  || $patron->branchcode;
281
    $deliveryplace = $deliveryplace || $patron->branchcode;
282
283
    $template->param( billingplace => $billingplace );
284
    $template->param( deliveryplace => $deliveryplace );
285
    $template->param( booksellerid => $booksellerid );
286
287
    # the template will display a unique basketgroup
288
    $template->param(grouping => 1);
289
    my $basketgroups = &GetBasketgroups($booksellerid);
290
    my $baskets = &GetBasketsByBookseller($booksellerid);
291
    displaybasketgroups($basketgroups, $bookseller, $baskets);
292
} elsif ($op eq 'mod_basket') {
293
#
249
#
294
# edit an individual basket contained in this basketgroup
250
# edit an individual basket contained in this basketgroup
295
#
251
#
Lines 330-336 if ( $op eq "add" ) { Link Here
330
#
286
#
331
    my $basketgroupid = $input->param('basketgroupid');
287
    my $basketgroupid = $input->param('basketgroupid');
332
    DelBasketgroup($basketgroupid);
288
    DelBasketgroup($basketgroupid);
333
    print $input->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . $booksellerid.'&amp;listclosed=1');
289
    print $input->redirect('/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=' . $booksellerid);
290
    exit;
334
}elsif ( $op eq 'reopen'){
291
}elsif ( $op eq 'reopen'){
335
#
292
#
336
# reopen a closed basketgroup
293
# reopen a closed basketgroup
Lines 338-345 if ( $op eq "add" ) { Link Here
338
    my $basketgroupid   = $input->param('basketgroupid');
295
    my $basketgroupid   = $input->param('basketgroupid');
339
    my $booksellerid    = $input->param('booksellerid');
296
    my $booksellerid    = $input->param('booksellerid');
340
    ReOpenBasketgroup($basketgroupid);
297
    ReOpenBasketgroup($basketgroupid);
341
    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';
298
    my $redirectpath;
299
    my $mode = $input->param('mode');
300
    if (defined $mode && $mode eq 'singlebg') {
301
        $redirectpath = '/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;basketgroupid='.$basketgroupid.'&amp;booksellerid='.$booksellerid;
302
    } else {
303
        $redirectpath = '/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=' .$booksellerid;
304
    }
342
    print $input->redirect($redirectpath);
305
    print $input->redirect($redirectpath);
306
    exit;
343
} elsif ( $op eq 'attachbasket') {
307
} elsif ( $op eq 'attachbasket') {
344
#
308
#
345
# save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page
309
# save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page
Lines 385-406 if ( $op eq "add" ) { Link Here
385
        };
349
        };
386
        $basketgroupid = NewBasketgroup($basketgroup);
350
        $basketgroupid = NewBasketgroup($basketgroup);
387
    }
351
    }
388
    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;
352
    my $redirectpath;
389
    $redirectpath .=  "&amp;listclosed=1" if $closedbg ;
353
    my $mode = $input->param('mode');
390
    print $input->redirect($redirectpath );
354
    if (defined $mode && $mode eq 'singlebg') {
391
    
355
        $redirectpath = '/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;basketgroupid='.$basketgroupid.'&amp;booksellerid='.$booksellerid;
356
    } else {
357
        $redirectpath = '/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=' . $booksellerid;
358
    }
359
    print $input->redirect($redirectpath);
360
    exit;
392
} elsif ( $op eq 'ediprint') {
361
} elsif ( $op eq 'ediprint') {
393
    my $basketgroupid = $input->param('basketgroupid');
362
    my $basketgroupid = $input->param('basketgroupid');
394
    generate_edifact_orders( $basketgroupid );
363
    generate_edifact_orders( $basketgroupid );
395
    exit;
364
    exit;
396
}else{
365
}
397
# no param : display the list of all basketgroups for a given vendor
398
    my $basketgroups = &GetBasketgroups($booksellerid);
399
    my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
400
    my $baskets = &GetBasketsByBookseller($booksellerid);
401
366
402
    displaybasketgroups($basketgroups, $bookseller, $baskets);
367
# if no param('basketgroupid') is not defined, adds a new basketgroup else, edit
368
# (if it is open) or display (if it is close) the basketgroup basketgroupid the
369
# template will know if basketgroup must be displayed or edited, depending on
370
# the value of closed key
371
372
my $bookseller = Koha::Acquisition::Booksellers->find($booksellerid);
373
my $basketgroupid = $input->param('basketgroupid');
374
my $billingplace;
375
my $deliveryplace;
376
my $freedeliveryplace;
377
if ( $basketgroupid ) {
378
    # Get the selected baskets in the basketgroup to display them
379
    my $selecteds = GetBasketsByBasketgroup($basketgroupid);
380
    foreach my $basket(@{$selecteds}){
381
        $basket->{total} = BasketTotal($basket->{basketno}, $bookseller);
382
    }
383
    $template->param(basketgroupid => $basketgroupid,
384
                     selectedbaskets => $selecteds);
385
386
    # Get general informations about the basket group to prefill the form
387
    my $basketgroup = GetBasketgroup($basketgroupid);
388
    $template->param(
389
        name => $basketgroup->{name},
390
        billingplace => $basketgroup->{billingplace},
391
        deliveryplace => $basketgroup->{deliveryplace},
392
        deliverycomment => $basketgroup->{deliverycomment},
393
        freedeliveryplace => $basketgroup->{freedeliveryplace},
394
        closedbg => $basketgroup->{closed} ? 1 : 0
395
    );
396
} else {
397
    $template->param( closedbg => 0);
403
}
398
}
404
$template->param(listclosed => ((defined $input->param('listclosed')) && ($input->param('listclosed') eq '1'))? 1:0 );
399
# determine default billing and delivery places depending on librarian homebranch and existing basketgroup data
405
#prolly won't use all these, maybe just use print, the rest can be done inside validate
400
my $borrower = Koha::Patrons->find( $loggedinuser );
401
$billingplace  = $billingplace  || $borrower->branchcode;
402
$deliveryplace = $deliveryplace || $borrower->branchcode;
403
404
$template->param( booksellerid => $booksellerid );
405
406
# the template will display a unique basketgroup
407
my $basketgroups = &GetBasketgroups($booksellerid);
408
my $baskets = &GetBasketsByBookseller($booksellerid);
409
displaybasketgroups($basketgroups, $bookseller, $baskets, $template);
410
406
output_html_with_http_headers $input, $cookie, $template->output;
411
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
            <li><a href="/cgi-bin/koha/acqui/lateorders.pl">Late orders</a></li>
9
            <li><a href="/cgi-bin/koha/acqui/lateorders.pl">Late orders</a></li>
7
            [% IF ( suggestion ) %]<li><a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a></li>[% END %]
10
            [% IF ( suggestion ) %]<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 %]">Baskets</a></li>[% END %]
4
        [% IF ( CAN_user_acquisition_order_manage ) %]<li><a href="/cgi-bin/koha/acqui/booksellers.pl?booksellerid=[% booksellerid %]">Baskets</a></li>[% END %]
5
        [% IF ( CAN_user_acquisition_group_manage ) %]<li><a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid %]">Basket groups</a></li>[% END %]
5
        [% IF ( CAN_user_acquisition_group_manage ) %]<li><a href="/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=[% booksellerid %]">Basket groups</a></li>[% END %]
6
        [% IF ( CAN_user_acquisition_contracts_manage ) %]<li><a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a></li>[% END %]
6
        [% IF ( CAN_user_acquisition_contracts_manage ) %]<li><a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a></li>[% END %]
7
        <li><a href="/cgi-bin/koha/acqui/invoices.pl?supplierid=[% booksellerid %]&amp;op=do_search">Invoices</a></li>
7
        <li><a href="/cgi-bin/koha/acqui/invoices.pl?supplierid=[% booksellerid %]&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/basketgroup.tt (-244 / +138 lines)
Lines 1-8 Link Here
1
[% USE Asset %]
1
[% USE Asset %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% USE Price %]
3
[% USE Price %]
4
[% USE KohaDates %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Basket grouping for [% booksellername |html %]</title>
6
[% IF booksellerid %]
7
  <title>Koha &rsaquo; Basket groups for [% booksellername |html %]</title>
8
[% ELSE %]
9
  <title>Koha &rsaquo; Basket groups</title>
10
[% END %]
6
[% Asset.css("css/datatables.css") %]
11
[% Asset.css("css/datatables.css") %]
7
[% INCLUDE 'doc-head-close.inc' %]
12
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'datatables.inc' %]
13
[% INCLUDE 'datatables.inc' %]
Lines 11-17 Link Here
11
[% Asset.js("lib/yui/container/container_core-min.js") %]
16
[% Asset.js("lib/yui/container/container_core-min.js") %]
12
[% Asset.js("lib/yui/menu/menu-min.js") %]
17
[% Asset.js("lib/yui/menu/menu-min.js") %]
13
[% Asset.js("js/basketgroup.js") %]
18
[% Asset.js("js/basketgroup.js") %]
14
[% IF ( grouping ) %]
15
[% Asset.js("lib/yui/yahoo-dom-event/yahoo-dom-event.js") %]
19
[% Asset.js("lib/yui/yahoo-dom-event/yahoo-dom-event.js") %]
16
[% Asset.js("lib/yui/animation/animation-min.js") %]
20
[% Asset.js("lib/yui/animation/animation-min.js") %]
17
[% Asset.js("lib/yui/dragdrop/dragdrop-min.js") %]
21
[% Asset.js("lib/yui/dragdrop/dragdrop-min.js") %]
Lines 87-93 fieldset.various li { Link Here
87
}
91
}
88
92
89
</style>
93
</style>
90
 [% END %]
91
<script type="text/javascript">
94
<script type="text/javascript">
92
//<![CDATA[
95
//<![CDATA[
93
	YAHOO.util.Event.onDOMReady(DDApp.init, DDApp, true);
96
	YAHOO.util.Event.onDOMReady(DDApp.init, DDApp, true);
Lines 108-127 function submitForm(form) { Link Here
108
    }
111
    }
109
}
112
}
110
113
111
 $(document).ready(function() {
112
    $("#basket_groups").tabs();
113
114
    $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
115
        "aoColumnDefs": [
116
            { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
117
        ],
118
        "bAutoWidth": false,
119
        "sPaginationType": "four_button"
120
    } ));
121
122
 });
123
124
125
//]]>
114
//]]>
126
</script>
115
</script>
127
</head>
116
</head>
Lines 130-390 function submitForm(form) { Link Here
130
[% INCLUDE 'acquisitions-search.inc' %]
119
[% INCLUDE 'acquisitions-search.inc' %]
131
120
132
<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;
121
<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;
133
[% IF ( grouping ) %]
122
    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a>
134
    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid %]">Basket grouping</a> &rsaquo; Add basket group for [% booksellername |html %]</div>
123
    &rsaquo;
135
[% ELSE %]
124
    <a href="/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=[% booksellerid %]">Basket groups</a>
136
    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a> &rsaquo; Basket grouping</div>
125
    &rsaquo;
137
[% END %]
126
    Add basket group for [% booksellername |html %]
127
</div>
138
128
139
<div id="doc3" class="yui-t2">
129
<div id="doc3" class="yui-t2">
140
    <div id="bd">
130
    <div id="bd">
141
        <div id="yui-main">
131
        <div id="yui-main">
142
            <div class="yui-b">
132
            <div class="yui-b">
143
                [% IF ( grouping ) %]
133
                [% IF (closedbg) %]
144
                    [% IF (closedbg) %]
134
                    <div id="toolbar" class="btn-toolbar">
145
                        <div id="toolbar" class="btn-toolbar">
135
                        <div class="btn-group"><a href="[% script_name %]?op=reopen&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]&amp;mode=singlebg" class="btn btn-default btn-sm" id="reopenbutton"><i class="fa fa-download"></i> Reopen this basket group</a></div>
146
                            <div class="btn-group"><a href="[% script_name %]?op=reopen&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]&amp;mode=singlebg" class="btn btn-default btn-sm" id="reopenbutton"><i class="fa fa-download"></i> Reopen this basket group</a></div>
136
                        <div class="btn-group"><a href="[% script_name %]?op=export&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]" class="btn btn-default btn-sm" id="exportbutton"><i class="fa fa-download"></i> Export this basket group as CSV</a></div>
147
                            <div class="btn-group"><a href="[% script_name %]?op=export&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]" class="btn btn-default btn-sm" id="exportbutton"><i class="fa fa-download"></i> Export this basket group as CSV</a></div>
137
                        <div class="btn-group"><a href="[% script_name %]?op=print&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Print this basket group in PDF</a></div>
148
                            <div class="btn-group"><a href="[% script_name %]?op=print&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Print this basket group in PDF</a></div>
138
                        <div class="btn-group"><a href="[% script_name %]?op=ediprint&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div>
149
                            <div class="btn-group"><a href="[% script_name %]?op=ediprint&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div>
139
                    </div>
140
                [% END %]
141
                [% IF (name && closedbg) %]
142
                    <h1>Basket group [% name %] ([% basketgroupid %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
143
                [% ELSIF (name) %]
144
                    <h1>Edit basket group [% name %] ([% basketgroupid %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
145
                [% ELSE %]
146
                    <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
147
                [% END %]
148
                <div id="basketgroupcolumns" class="yui-g">
149
                    [% UNLESS (closedbg) %]
150
                        <div class="yui-u">
151
                            <form action="[% scriptname %]" method="post" name="basketgroups" id="basketgroups">
152
                                <div id="groups">
153
                                    <fieldset class="brief">
154
                                        <div class="workarea_alt" >
155
                                            <h3>Ungrouped baskets</h3>
156
                                            <ul id="ungrouped" class="draglist_alt">
157
                                                [% IF ( baskets ) %]
158
                                                    [% FOREACH basket IN baskets %]
159
                                                        <li class="ungrouped" id="b-[% basket.basketno %]" >
160
                                                            <a href="basket.pl?basketno=[% basket.basketno %]">
161
                                                                [% IF ( basket.basketname ) %]
162
                                                                    [% basket.basketname %]
163
                                                                [% ELSE %]
164
                                                                    No name, basketnumber: [% basket.basketno %]
165
                                                                [% END %]
166
                                                            </a>, <br />
167
                                                            Total: [% basket.total | $Price %]
168
                                                            <input type="hidden" class="basket" name="basket" value="[% basket.basketno %]" />
169
                                                        </li>
170
                                                    [% END %]
171
                                                [% END %]
172
                                            </ul>
173
                                        </div>
174
                                    </fieldset>
175
                                </div>
176
                            </form>
150
                        </div>
177
                        </div>
151
                    [% END %]
178
                    [% END %]
152
                    [% IF (name && closedbg) %]
179
                    <div class="yui-u first">
153
                        <h1>Basket group [% name %] ([% basketgroupid %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
180
                        <form action="" method="post" id="groupingform" onsubmit="return submitForm(this)">
154
                    [% ELSIF (name) %]
181
                            <fieldset id="various" class="brief">
155
                        <h1>Edit basket group [% name %] ([% basketgroupid %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
182
                                <ol>
156
                    [% ELSE %]
183
                                    [% UNLESS (closedbg) %]
157
                        <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
184
                                        <li>
158
                    [% END %]
185
                                            <label for="basketgroupname">Basket group name:</label>
159
                    <div id="basketgroupcolumns" class="yui-g">
186
                                            <input type="text" name="basketgroupname" id="basketgroupname" value="[% name %]" class="focus" />
160
                        [% UNLESS (closedbg) %]
187
                                        </li>
161
                            <div class="yui-u">
188
                                    [% ELSE %]
162
                                <form action="[% scriptname %]" method="post" name="basketgroups" id="basketgroups">
189
                                        <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% name %]" />
163
                                    <div id="groups">
190
                                    [% END %]
164
                                        <fieldset class="brief">
191
                                    <li>
165
                                            <div class="workarea_alt" >
166
                                                <h3>Ungrouped baskets</h3>
167
                                                <ul id="ungrouped" class="draglist_alt">
168
                                                    [% IF ( baskets ) %]
169
                                                        [% FOREACH basket IN baskets %]
170
                                                            <li class="ungrouped" id="b-[% basket.basketno %]" >
171
                                                                <a href="basket.pl?basketno=[% basket.basketno %]">
172
                                                                    [% IF ( basket.basketname ) %]
173
                                                                        [% basket.basketname %]
174
                                                                    [% ELSE %]
175
                                                                        No name, basketnumber: [% basket.basketno %]
176
                                                                    [% END %]
177
                                                                </a>, <br />
178
                                                                Total: [% basket.total | $Price %]
179
                                                                <input type="hidden" class="basket" name="basket" value="[% basket.basketno %]" />
180
                                                            </li>
181
                                                        [% END %]
182
                                                    [% END %]
183
                                                </ul>
184
                                            </div>
185
                                        </fieldset>
186
                                    </div>
187
                                </form>
188
                            </div>
189
                        [% END %]
190
                        <div class="yui-u first">
191
                            <form action="" method="post" id="groupingform" onsubmit="return submitForm(this)">
192
                                <fieldset id="various" class="brief">
193
                                    <ol>
194
                                        [% UNLESS (closedbg) %]
192
                                        [% UNLESS (closedbg) %]
195
                                            <li>
193
                                            <label for="billingplace">Billing place:</label>
196
                                                <label for="basketgroupname">Basket group name:</label>
194
                                            <select name="billingplace" id="billingplace">
197
                                                <input type="text" name="basketgroupname" id="basketgroupname" value="[% name %]" class="focus" />
195
                                                <option value="">--</option>
198
                                            </li>
196
                                                [% PROCESS options_for_libraries libraries => Branches.all( selected => billingplace ) %]
197
                                            </select>
199
                                        [% ELSE %]
198
                                        [% ELSE %]
200
                                            <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% name %]" />
199
                                            <span class="label">Billing place:</span>
200
                                            <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace %]" />[% Branches.GetName( billingplace ) %]
201
                                        [% END %]
201
                                        [% END %]
202
                                    </li>
203
                                    [% UNLESS (closedbg) %]
202
                                        <li>
204
                                        <li>
203
                                            [% UNLESS (closedbg) %]
205
                                            <label for="deliveryplace">Delivery place:</label>
204
                                                <label for="billingplace">Billing place:</label>
206
                                            <select name="deliveryplace" id="deliveryplace">
205
                                                <select name="billingplace" id="billingplace">
207
                                                <option value="">--</option>
206
                                                    <option value="">--</option>
208
                                                [% PROCESS options_for_libraries libraries => Branches.all( selected => deliveryplace ) %]
207
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => billingplace ) %]
209
                                            <select>
208
                                                </select>
209
                                            [% ELSE %]
210
                                                <span class="label">Billing place:</span>
211
                                                <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace %]" />[% Branches.GetName( billingplace ) %]
212
                                            [% END %]
213
                                        </li>
210
                                        </li>
214
                                        [% UNLESS (closedbg) %]
211
                                        <li><p>or</p></li>
215
                                            <li>
212
                                        <li>
216
                                                <label for="deliveryplace">Delivery place:</label>
213
                                            <label for="freedeliveryplace">Delivery place:</label>
217
                                                <select name="deliveryplace" id="deliveryplace">
214
                                            <textarea cols="26" rows="3" name="freedeliveryplace" id="freedeliveryplace">[% freedeliveryplace %]</textarea>
218
                                                    <option value="">--</option>
215
                                        </li>
219
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => deliveryplace ) %]
216
                                        [% ELSE %]
220
                                                <select>
221
                                            </li>
222
                                            <li><p>or</p></li>
223
                                            <li>
224
                                                <label for="freedeliveryplace">Delivery place:</label>
225
                                                <textarea cols="26" rows="3" name="freedeliveryplace" id="freedeliveryplace">[% freedeliveryplace %]</textarea>
226
                                            </li>
227
                                            [% ELSE %]
228
                                                <li>
229
                                                    <span class="label">Delivery place:</span>
230
                                                    [% IF (freedeliveryplace) %]
231
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% freedeliveryplace %]" />[% freedeliveryplace %]
232
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
233
                                                    [% ELSE %]
234
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% deliveryplace %]" />[% Branches.GetName( deliveryplace ) %]
235
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
236
                                                    [% END %]
237
                                                </li>
238
                                            [% END %]
239
                                            <li>
217
                                            <li>
240
                                                [% UNLESS (closedbg) %]
218
                                                <span class="label">Delivery place:</span>
241
                                                    <label for="deliverycomment">Delivery comment:</label>
219
                                                [% IF (freedeliveryplace) %]
242
                                                    <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% deliverycomment %]</textarea>
220
                                                    <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% freedeliveryplace %]" />[% freedeliveryplace %]
221
                                                    <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
243
                                                [% ELSE %]
222
                                                [% ELSE %]
244
                                                    <span class="label">Delivery comment:</span>[% deliverycomment %]
223
                                                    <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% deliveryplace %]" />[% Branches.GetName( deliveryplace ) %]
245
                                                    <input name="deliverycomment" id="deliverycomment" type="hidden" value = "[% deliverycomment %]" />
224
                                                    <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
246
                                                [% END %]
225
                                                [% END %]
247
                                            </li>
226
                                            </li>
248
                                            <li>
227
                                        [% END %]
249
                                                <span class="label">Baskets in this group:</span>
228
                                        <li>
250
                                                [% UNLESS (closedbg) %]
229
                                            [% UNLESS (closedbg) %]
251
                                                    <ul class="draglist" id="bg">
230
                                                <label for="deliverycomment">Delivery comment:</label>
252
                                                [% ELSE %]
231
                                                <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% deliverycomment %]</textarea>
253
                                                    <ul>
232
                                            [% ELSE %]
254
                                                [% END %]
233
                                                <span class="label">Delivery comment:</span>[% deliverycomment %]
255
                                                [% FOREACH selectedbasket IN selectedbaskets %]
234
                                                <input name="deliverycomment" id="deliverycomment" type="hidden" value = "[% deliverycomment %]" />
256
                                                    <li class="grouped" id="b-[% selectedbasket.basketno %]" >
235
                                            [% END %]
257
                                                        <a href="basket.pl?basketno=[% selectedbasket.basketno %]">
258
                                                            [% IF ( selectedbasket.basketname ) %]
259
                                                                [% selectedbasket.basketname %]
260
                                                            [% ELSE %]
261
                                                                No name, basketnumber: [% selectedbasket.basketno %]
262
                                                            [% END %]
263
                                                        </a>, <br />
264
                                                        Total: [% selectedbasket.total | $Price %]
265
                                                        <input type="hidden" class="basket" name="basket" value="[% selectedbasket.basketno %]" />
266
                                                    </li>
267
                                                [% END %]
268
                                            </ul>
269
                                        </li>
236
                                        </li>
237
                                        <li>
238
                                            <span class="label">Baskets in this group:</span>
270
                                            [% UNLESS (closedbg) %]
239
                                            [% UNLESS (closedbg) %]
271
                                                <li><label><input type="checkbox" id="closedbg" name="closedbg" />Close basket group</label></li>
240
                                                <ul class="draglist" id="bg">
272
                                            [% ELSE %]
241
                                            [% ELSE %]
273
                                                <input type="hidden" id="closedbg" name="closedbg" value ="1"/>
242
                                                <ul>
274
                                            [% END %]
243
                                            [% END %]
275
                                    </ol>
244
                                            [% FOREACH selectedbasket IN selectedbaskets %]
276
                                </fieldset>
245
                                                <li class="grouped" id="b-[% selectedbasket.basketno %]" >
277
                                [% UNLESS (closedbg) %]
246
                                                    <a href="basket.pl?basketno=[% selectedbasket.basketno %]">
278
                                    <fieldset class="action"><input type="hidden" name="booksellerid" value="[% booksellerid %]" />
247
                                                        [% IF ( selectedbasket.basketname ) %]
279
                                        [% IF ( basketgroupid ) %]
248
                                                            [% selectedbasket.basketname %]
280
                                            <input type="hidden" name="basketgroupid" value="[% basketgroupid %]" />
281
                                        [% END %]
282
                                        <input type="hidden" name="op" value="attachbasket" />
283
                                        <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid %]" class="cancel">Cancel</a>
284
                                    </fieldset>
285
                                [% END %]
286
                            </form>
287
                        </div>
288
                    </div>
289
                [% ELSE %]
290
                    <div id="toolbar" class="btn-toolbar">
291
                        <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid %]" class="btn btn-default btn-sm" id="newbasketgroup"><i class="fa fa-plus"></i> New basket group</a></div>
292
                    </div>
293
                    <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
294
                    <div id="basket_groups" class="toptabs">
295
                        <ul class="ui-tabs-nav">
296
                            [% UNLESS ( listclosed) %]<li class="ui-tabs-active"><a href="#opened">Open</a></li>
297
                            [% ELSE%]<li><a href="#opened">Open</a></li>[% END %]
298
                            [% IF ( listclosed) %]<li class="ui-tabs-active"><a href="#closed">Closed</a></li>
299
                            [% ELSE %]<li><a href="#closed">Closed</a></li>[% END %]
300
                        </ul>
301
                        <div id="opened">
302
                            <table id="basket_group_opened">
303
                                <thead>
304
                                    <tr>
305
                                        <th>Name</th>
306
                                        <th>Number</th>
307
                                        <th>Billing place</th>
308
                                        <th>Delivery place</th>
309
                                        <th>Number of baskets</th>
310
                                        <th>Action</th>
311
                                    </tr>
312
                                </thead>
313
                                <tbody>
314
                                    [% FOREACH basketgroup IN basketgroups %]
315
                                        [% UNLESS ( basketgroup.closed ) %]
316
                                            <tr>
317
                                                <td>[% IF ( basketgroup.name ) %]
318
                                                    [% basketgroup.name %]
319
                                                    [% ELSE %]
320
                                                        Basket group no. [% basketgroup.id %]
321
                                                    [% END %]
322
                                                </td>
323
                                                <td>[% basketgroup.id %]</td>
324
                                                <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
325
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
326
                                                <td>[% basketgroup.basketsqty %]</td>
327
                                                <td>
328
                                                    <input type="button" onclick="closeandprint('[% basketgroup.id %]');" value="Close and export as PDF" />
329
                                                    <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 %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Edit" /></form>
330
                                                    [% UNLESS basketgroup.basketsqty %]
331
                                                        <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 %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Delete" /></form>
332
                                                    [% END %]
333
                                                </td>
334
                                            </tr>
335
                                        [% END %]
336
                                    [% END %]
337
                                </tbody>
338
                            </table>
339
                        </div>
340
                        <div id="closed">
341
                            <table id="basket_group_closed">
342
                                <thead>
343
                                    <tr>
344
                                        <th>Name</th>
345
                                        <th>Number</th>
346
                                        <th>Billing place</th>
347
                                        <th>Delivery place</th>
348
                                        <th>Number of baskets</th>
349
                                        <th>Action</th>
350
                                    </tr>
351
                                </thead>
352
                                <tbody>
353
                                    [% FOREACH basketgroup IN basketgroups %]
354
                                        [% IF ( basketgroup.closed ) %]
355
                                            <tr>
356
                                                <td>
357
                                                    [% IF ( basketgroup.name ) %]
358
                                                        [% basketgroup.name %]
359
                                                        [% ELSE %]
249
                                                        [% ELSE %]
360
                                                            Basket group no. [% basketgroup.id %]
250
                                                            No name, basketnumber: [% selectedbasket.basketno %]
361
                                                        [% END %]
251
                                                        [% END %]
362
                                                </td>
252
                                                    </a>, <br />
363
                                                <td>[% basketgroup.id %]</td>
253
                                                    Total: [% selectedbasket.total | $Price %]
364
                                                <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
254
                                                    <input type="hidden" class="basket" name="basket" value="[% selectedbasket.basketno %]" />
365
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
255
                                                </li>
366
                                                <td>[% basketgroup.basketsqty %]</td>
256
                                            [% END %]
367
                                                <td>
257
                                        </ul>
368
                                                    <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 %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="View" /></form>
258
                                    </li>
369
                                                    <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 %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Reopen" /></form>
259
                                        [% UNLESS (closedbg) %]
370
                                                    <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 %]" /><input type="submit" value="Export as PDF" /></form>
260
                                            <li><label><input type="checkbox" id="closedbg" name="closedbg" />Close basket group</label></li>
371
                                                    <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 %]" /><input type="submit" value="Export as CSV" /></form>
261
                                        [% ELSE %]
372
                                                    <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 %]" /><input type="submit" value="Generate EDIFACT order" /></form>
262
                                            <input type="hidden" id="closedbg" name="closedbg" value ="1"/>
373
                                                </td>
374
                                            </tr>
375
                                        [% END %]
263
                                        [% END %]
264
                                </ol>
265
                            </fieldset>
266
                            [% UNLESS (closedbg) %]
267
                                <fieldset class="action"><input type="hidden" name="booksellerid" value="[% booksellerid %]" />
268
                                    [% IF ( basketgroupid ) %]
269
                                        <input type="hidden" name="basketgroupid" value="[% basketgroupid %]" />
376
                                    [% END %]
270
                                    [% END %]
377
                                </tbody>
271
                                    <input type="hidden" name="op" value="attachbasket" />
378
                            </table>
272
                                    <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid %]" class="cancel">Cancel</a>
379
                        </div>
273
                                </fieldset>
274
                            [% END %]
275
                        </form>
380
                    </div>
276
                    </div>
381
                [% END %]
277
                </div>
382
            </div>
278
            </div>
383
        </div>
279
        </div>
384
        <div class="yui-b">
280
        <div class="yui-b">
385
            [% IF ( booksellerid ) %]
281
            [% INCLUDE 'vendor-menu.inc' %]
386
                [% INCLUDE 'vendor-menu.inc' %]
387
            [% END %]
388
            [% INCLUDE 'acquisitions-menu.inc' %]
282
            [% INCLUDE 'acquisitions-menu.inc' %]
389
        </div>
283
        </div>
390
    </div>
284
    </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt (+163 lines)
Line 0 Link Here
1
[% USE Asset %]
2
[% USE Branches %]
3
[% USE KohaDates %]
4
5
[% INCLUDE 'doc-head-open.inc' %]
6
    [% IF bookseller %]
7
        <title>Koha &rsaquo; Basket groups for [% bookseller.name |html %]</title>
8
    [% ELSE %]
9
        <title>Koha &rsaquo; Basket groups</title>
10
    [% END %]
11
12
    [% Asset.css('css/datatables.css') %]
13
    [% INCLUDE 'doc-head-close.inc' %]
14
    [% INCLUDE 'datatables.inc' %]
15
    [% Asset.js('lib/jquery/plugins/jquery.dataTables.columnFilter.js') %]
16
    <script type="text/javascript">
17
        $(document).ready(function() {
18
            var options = {
19
                "paging": false,
20
                "autoWidth": false,
21
                "columnDefs": [
22
                    { "visible": false, "targets": 1 },
23
                    { "orderable": false, "targets": -1 }
24
                ],
25
                "orderFixed": [[ 1, 'asc' ]]
26
            };
27
            [% UNLESS bookseller %]
28
                options.drawCallback = function(settings) {
29
                    var api = this.api();
30
                    var rows = api.rows({page: 'current'}).nodes();
31
                    var last = null;
32
33
                    api.column(1, {page: 'current'}).data().each(function(group, i) {
34
                        if (last !== group) {
35
                            $(rows).eq(i).before(
36
                                '<tr><td class="group" colspan="8">' + group + '</td></tr>'
37
                            );
38
                            last = group;
39
                        }
40
                    });
41
                };
42
            [% END %]
43
            $("#basketgroups-table").kohaDataTable(options);
44
45
            $('#basketgroups-table').on('click', '.closeandprint', function(e) {
46
                e.preventDefault();
47
                var w = window.open($(this).attr('href'));
48
                var timer = setInterval(function() {
49
                    if (w.closed === true) {
50
                        clearInterval(timer);
51
                        window.location.reload(true);
52
                    }
53
                }, 1000);
54
            });
55
            $('#basketgroups-table').on('click', '.delete', function() {
56
                return confirm(_("Are you sure you want to delete this basketgroup ?"));
57
            });
58
        });
59
    </script>
60
</head>
61
<body id="acq_basketgroup" class="acq">
62
    [% INCLUDE 'header.inc' %]
63
    [% INCLUDE 'acquisitions-search.inc' %]
64
65
    <div id="breadcrumbs">
66
        <a href="/cgi-bin/koha/mainpage.pl">Home</a>
67
        &rsaquo;
68
        <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
69
        &rsaquo;
70
        [% IF (bookseller) %]
71
            <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name |html %]</a>
72
            &rsaquo;
73
        [% END %]
74
        Basket groups
75
    </div>
76
77
    <div id="doc3" class="yui-t2">
78
        <div id="bd">
79
            <div id="yui-main">
80
                <div class="yui-b">
81
                    [% IF bookseller %]
82
                        <div id="toolbar" class="btn-toolbar">
83
                            <div class="btn-group">
84
                                <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% bookseller.id %]" class="btn btn-default btn-sm" id="newbasketgroup"><i class="fa fa-plus"></i> New basket group</a>
85
                            </div>
86
                        </div>
87
88
                        <h1>Basket groups for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name %]</a></h1>
89
                    [% END %]
90
91
                    [% IF basketgroups.size > 0 %]
92
                        <table id="basketgroups-table" class="group">
93
                            <thead>
94
                                <tr>
95
                                    <th>Name</th>
96
                                    <th>Vendor</th>
97
                                    <th>Billing place</th>
98
                                    <th>Delivery place</th>
99
                                    <th>No. of baskets</th>
100
                                    <th>No. of ordered titles</th>
101
                                    <th>No. of received titles</th>
102
                                    <th>Date closed</th>
103
                                    <th>Action</th>
104
                                </tr>
105
                            </thead>
106
                            <tbody>
107
                                [% FOREACH basketgroup IN basketgroups %]
108
                                    <tr>
109
                                        <td>
110
                                            [% IF ( basketgroup.name ) %]
111
                                                [% basketgroup.name %]
112
                                            [% ELSE %]
113
                                                Basket group no. [% basketgroup.id %]
114
                                            [% END %]
115
                                        </td>
116
                                        <td>[% basketgroup.bookseller.name %]</td>
117
                                        <td>[% Branches.GetName(basketgroup.billingplace) %]</td>
118
                                        <td>
119
                                            [% IF (basketgroup.freedeliveryplace) %]
120
                                                [% basketgroup.freedeliveryplace %]
121
                                            [% ELSE %]
122
                                                [% Branches.GetName(basketgroup.deliveryplace) %]
123
                                            [% END %]
124
                                        </td>
125
                                        <td>[% basketgroup.baskets_count %]</td>
126
                                        <td>[% basketgroup.ordered_titles_count %]</td>
127
                                        <td>[% basketgroup.received_titles_count %]</td>
128
                                        <td>[% basketgroup.closeddate | $KohaDates %]</td>
129
                                        <td>
130
                                            <div class="dropdown">
131
                                            <a class="btn btn-default btn-xs dropdown-toggle" id="actions-[% basketgroup.id %]" role="button" data-toggle="dropdown">Actions <b class="caret"></b></a>
132
                                            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="actions-[% basketgroup.id %]">
133
                                            [% IF basketgroup.closeddate %]
134
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% basketgroup.booksellerid %]&basketgroupid=[% basketgroup.id %]"><i class="fa fa-eye"></i> View</a></li>
135
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=reopen&booksellerid=[% basketgroup.booksellerid %]&basketgroupid=[% basketgroup.id %]"><i class="fa fa-folder-open"></i> Reopen</a></li>
136
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=print&basketgroupid=[% basketgroup.id %]"><i class="fa fa-print"></i> Export as PDF</a></li>
137
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=export&basketgroupid=[% basketgroup.id %]"><i class="fa fa-file-text"></i> Export as CSV</a></li>
138
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=ediprint&baskegroupid=[% basketgroup.id %]">Generate EDIFACT order</a></li>
139
                                            [% ELSE %]
140
                                                <li><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% basketgroup.booksellerid %]&basketgroupid=[% basketgroup.id %]"><i class="fa fa-pencil"></i> Edit</a></li>
141
                                                <li><a class="closeandprint" href="/cgi-bin/koha/acqui/basketgroup.pl?op=closeandprint&basketgroupid=[% basketgroup.id %]"><i class="fa fa-print"></i> Close and export as PDF</a></li>
142
                                                [% UNLESS basketgroup.baskets_count %]
143
                                                    <li><a class="delete" href="/cgi-bin/koha/acqui/basketgroup.pl?op=delete&booksellerid=[% basketgroup.booksellerid %]&basketgroupid=[% basketgroup.id %]"><i class="fa fa-trash"></i> Delete</a></li>
144
                                                [% END %]
145
                                            [% END %]
146
                                            </ul>
147
                                            </div>
148
                                        </td>
149
                                    </tr>
150
                                [% END %]
151
                            </tbody>
152
                        </table>
153
                    [% END %]
154
                </div>
155
            </div>
156
            <div class="yui-b">
157
                [% IF bookseller %]
158
                    [% INCLUDE 'vendor-menu.inc' booksellerid = bookseller.id %]
159
                [% END %]
160
                [% INCLUDE 'acquisitions-menu.inc' %]
161
            </div>
162
        </div>
163
    [% INCLUDE 'intranet-bottom.inc' %]
(-)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 (-25 / +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 ) {
43
- 

Return to bug 11708