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

(-)a/acqui/basketgroup.pl (-6 / +31 lines)
Lines 57-62 use C4::Members qw/GetMember/; Link Here
57
57
58
use Koha::Acquisition::Bookseller;
58
use Koha::Acquisition::Bookseller;
59
59
60
use List::MoreUtils qw/uniq/;
61
60
our $input=new CGI;
62
our $input=new CGI;
61
63
62
our ($template, $loggedinuser, $cookie)
64
our ($template, $loggedinuser, $cookie)
Lines 371-382 if ( $op eq "add" ) { Link Here
371
    print $input->redirect($redirectpath );
373
    print $input->redirect($redirectpath );
372
    
374
    
373
}else{
375
}else{
374
# no param : display the list of all basketgroups for a given vendor
376
    my @booksellers;
375
    my $basketgroups = &GetBasketgroups($booksellerid);
377
    if ($booksellerid) {
376
    my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
378
        my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
377
    my $baskets = &GetBasketsByBookseller($booksellerid);
379
        push @booksellers, $bookseller;
378
380
        $template->param(booksellername => $booksellers[0]->{name});
379
    displaybasketgroups($basketgroups, $bookseller, $baskets);
381
    } else {
382
        @booksellers = Koha::Acquisition::Bookseller->search;
383
    }
384
    foreach my $bookseller (@booksellers) {
385
        $bookseller->{basketgroups} = GetBasketgroups($bookseller->{id});
386
        foreach my $basketgroup (@{ $bookseller->{basketgroups} }) {
387
            my $baskets = GetBasketsByBasketgroup($basketgroup->{id});
388
            $basketgroup->{basketsqty} = 0;
389
            my (@ordered_biblionumbers, @received_biblionumbers);
390
            foreach my $basket (@$baskets) {
391
                $basketgroup->{basketsqty} += 1;
392
                my @orders = GetOrders($basket->{basketno});
393
                foreach my $order (@orders) {
394
                    push @ordered_biblionumbers, $order->{biblionumber};
395
                    if ($order->{datereceived}) {
396
                        push @received_biblionumbers, $order->{biblionumber};
397
                    }
398
                }
399
            }
400
            $basketgroup->{ordered_titles_count} = uniq @ordered_biblionumbers;
401
            $basketgroup->{received_titles_count} = uniq @received_biblionumbers;
402
        }
403
    }
404
    $template->param(booksellers => \@booksellers);
380
}
405
}
381
$template->param(listclosed => ((defined $input->param('listclosed')) && ($input->param('listclosed') eq '1'))? 1:0 );
406
$template->param(listclosed => ((defined $input->param('listclosed')) && ($input->param('listclosed') eq '1'))? 1:0 );
382
#prolly won't use all these, maybe just use print, the rest can be done inside validate
407
#prolly won't use all these, maybe just use print, the rest can be done inside validate
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css (+3 lines)
Lines 240-245 tr.even.selected td { Link Here
240
240
241
/* ColumnFilter */
241
/* ColumnFilter */
242
span.filter_column > input[type="text"] {
242
span.filter_column > input[type="text"] {
243
    box-sizing: border-box;
244
    -moz-box-sizing: border-box;
245
    -webkit-box-sizing: border-box;
243
    font-size: 80%;
246
    font-size: 80%;
244
    width: 100%;
247
    width: 100%;
245
    box-sizing: border-box;
248
    box-sizing: border-box;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc (+3 lines)
Lines 2-7 Link Here
2
	<li><a href="/cgi-bin/koha/acqui/lateorders.pl">Late orders</a></li>
2
	<li><a href="/cgi-bin/koha/acqui/lateorders.pl">Late orders</a></li>
3
	[% IF ( suggestion ) %]<li><a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a></li>[% ELSE %][% END %]
3
	[% IF ( suggestion ) %]<li><a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a></li>[% ELSE %][% END %]
4
    <li><a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a></li>
4
    <li><a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a></li>
5
    [% IF ( CAN_user_acquisition_group_manage ) %]
6
      <li><a href="/cgi-bin/koha/acqui/basketgroup.pl">Basket groups</a></li>
7
    [% END %]
5
    [% IF ( CAN_user_acquisition_budget_manage ) %]
8
    [% IF ( CAN_user_acquisition_budget_manage ) %]
6
    <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a></li>
9
    <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a></li>
7
    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a></li>
10
    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a></li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt (-96 / +164 lines)
Lines 1-9 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE KohaDates %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Basket grouping for [% booksellername |html %]</title>
4
[% IF booksellerid %]
5
  <title>Koha &rsaquo; Basket groups for [% booksellername |html %]</title>
6
[% ELSE %]
7
  <title>Koha &rsaquo; Basket groups</title>
8
[% END %]
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
9
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5
[% INCLUDE 'doc-head-close.inc' %]
10
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'datatables.inc' %]
11
[% INCLUDE 'datatables.inc' %]
12
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
7
<script type="text/javascript" src="[% themelang %]/lib/yui/utilities/utilities.js"></script>
13
<script type="text/javascript" src="[% themelang %]/lib/yui/utilities/utilities.js"></script>
8
<script type="text/javascript" src="[% themelang %]/lib/yui/button/button-min.js"></script>
14
<script type="text/javascript" src="[% themelang %]/lib/yui/button/button-min.js"></script>
9
<script type="text/javascript" src="[% themelang %]/lib/yui/container/container_core-min.js"></script>
15
<script type="text/javascript" src="[% themelang %]/lib/yui/container/container_core-min.js"></script>
Lines 107-121 function submitForm(form) { Link Here
107
}
113
}
108
114
109
 $(document).ready(function() {
115
 $(document).ready(function() {
110
    $("#basket_groups").tabs();
116
    $(".basket_groups").tabs();
111
117
112
    $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
118
    $("table").each(function () {
113
        "aoColumnDefs": [
119
      var column_filter_options = {
114
            { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
120
        sPlaceHolder: "head:after",
115
        ],
121
        aoColumns: [
116
        "bAutoWidth": false,
122
          { type: "text" },
117
        "sPaginationType": "four_button"
123
          { type: "text" },
118
    } ));
124
          { type: "text" },
125
          { type: "text" },
126
          { type: "text" },
127
          { type: "text" },
128
          { type: "text" },
129
          null
130
        ]
131
      };
132
      if ($(this).hasClass('basket_group_closed')) {
133
        // There is one more column in closed basketgroups tables
134
        column_filter_options.aoColumns.unshift({ type: "text" });
135
      }
136
      $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
137
          "aoColumnDefs": [
138
              { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
139
          ],
140
          "bPaginate": false,
141
          "bAutoWidth": false
142
      } ))
143
      .columnFilter(column_filter_options);
144
    });
119
145
120
 });
146
 });
121
147
Lines 129-138 function submitForm(form) { Link Here
129
155
130
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
156
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
131
[% IF ( grouping ) %]
157
[% IF ( grouping ) %]
132
    <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>
158
    <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 groups</a> &rsaquo; Add basket group for [% booksellername |html %]
133
[% ELSE %]
159
[% ELSE %]
134
    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a> &rsaquo; Basket grouping</div>
160
  [% IF (booksellerid) %]
161
    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a> &rsaquo;
162
  [% END %]
163
  Basket groups
135
[% END %]
164
[% END %]
165
</div>
136
166
137
<div id="doc3" class="yui-t2">
167
<div id="doc3" class="yui-t2">
138
    <div id="bd">
168
    <div id="bd">
Lines 300-393 function submitForm(form) { Link Here
300
                        </div>
330
                        </div>
301
                    </div>
331
                    </div>
302
                [% ELSE %]
332
                [% ELSE %]
303
                    <div id="toolbar" class="btn-toolbar">
333
                    [% IF booksellerid %]
304
                        <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="newbasketgroup"><i class="fa fa-plus"></i> New basket group</a></div>
334
                        <div id="toolbar" class="btn-toolbar">
305
                    </div>
335
                            <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="newbasketgroup"><i class="fa fa-plus"></i> New basket group</a></div>
306
                    <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
336
                        </div>
307
                    <div id="basket_groups" class="toptabs">
337
                    [% END %]
308
                        <ul class="ui-tabs-nav">
338
309
                            [% UNLESS ( listclosed) %]<li class="ui-tabs-active"><a href="#opened">Open</a></li>
339
                    [% FOREACH bookseller IN booksellers %]
310
                            [% ELSE%]<li><a href="#opened">Open</a></li>[% END %]
340
                        [% IF bookseller.basketgroups.size > 0 %]
311
                            [% IF ( listclosed) %]<li class="ui-tabs-active"><a href="#closed">Closed</a></li>
341
                            <h1>Basket groups for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name |html %]</a></h1>
312
                            [% ELSE %]<li><a href="#closed">Closed</a></li>[% END %]
342
                            <div class="basket_groups toptabs">
313
                        </ul>
343
                                <ul class="ui-tabs-nav">
314
                        <div id="opened">
344
                                    [% UNLESS ( listclosed) %]<li class="ui-tabs-active"><a href="#opened[% bookseller.id %]">Open</a></li>
315
                            <table id="basket_group_opened">
345
                                    [% ELSE%]<li><a href="#opened[% bookseller.id %]">Open</a></li>[% END %]
316
                                <thead>
346
                                    [% IF ( listclosed) %]<li class="ui-tabs-active"><a href="#closed[% bookseller.id %]">Closed</a></li>
317
                                    <tr>
347
                                    [% ELSE %]<li><a href="#closed[% bookseller.id %]">Closed</a></li>[% END %]
318
                                        <th>Name</th>
348
                                </ul>
319
                                        <th>Number</th>
349
                                <div id="opened[% bookseller.id %]">
320
                                        <th>Billing place</th>
350
                                    <table id="basket_group_opened">
321
                                        <th>Delivery place</th>
351
                                        <thead>
322
                                        <th>Number of baskets</th>
323
                                        <th>Action</th>
324
                                    </tr>
325
                                </thead>
326
                                <tbody>
327
                                    [% FOREACH basketgroup IN basketgroups %]
328
                                        [% UNLESS ( basketgroup.closed ) %]
329
                                            <tr>
352
                                            <tr>
330
                                                <td>[% IF ( basketgroup.name ) %]
353
                                                <th>Search name</th>
331
                                                    [% basketgroup.name %]
354
                                                <th>Search no.</th>
332
                                                    [% ELSE %]
355
                                                <th>Search billing place</th>
333
                                                        Basket group no. [% basketgroup.id %]
356
                                                <th>Search delivery place</th>
334
                                                    [% END %]
357
                                                <th>Search no. of baskets</th>
335
                                                </td>
358
                                                <th>Search no. of ordered titles</th>
336
                                                <td>[% basketgroup.id %]</td>
359
                                                <th>Search no. of received titles</th>
337
                                                <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
360
                                                <th></th>
338
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
339
                                                <td>[% basketgroup.basketsqty %]</td>
340
                                                <td>
341
                                                    <input type="button" onclick="closeandprint('[% basketgroup.id %]');" value="Close and print" />
342
                                                    <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>
343
                                                    <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>
344
                                                </td>
345
                                            </tr>
361
                                            </tr>
346
                                        [% END %]
347
                                    [% END %]
348
                                </tbody>
349
                            </table>
350
                        </div>
351
                        <div id="closed">
352
                            <table id="basket_group_closed">
353
                                <thead>
354
                                    <tr>
355
                                        <th>Name</th>
356
                                        <th>Number</th>
357
                                        <th>Billing place</th>
358
                                        <th>Delivery place</th>
359
                                        <th>Number of baskets</th>
360
                                        <th>Action</th>
361
                                    </tr>
362
                                </thead>
363
                                <tbody>
364
                                    [% FOREACH basketgroup IN basketgroups %]
365
                                        [% IF ( basketgroup.closed ) %]
366
                                            <tr>
362
                                            <tr>
367
                                                <td>
363
                                                <th>Name</th>
368
                                                    [% IF ( basketgroup.name ) %]
364
                                                <th>No.</th>
369
                                                        [% basketgroup.name %]
365
                                                <th>Billing place</th>
370
                                                        [% ELSE %]
366
                                                <th>Delivery place</th>
371
                                                            Basket group no. [% basketgroup.id %]
367
                                                <th>No. of baskets</th>
372
                                                        [% END %]
368
                                                <th>No. of ordered titles</th>
373
                                                </td>
369
                                                <th>No. of received titles</th>
374
                                                <td>[% basketgroup.id %]</td>
370
                                                <th>Action</th>
375
                                                <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
376
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
377
                                                <td>[% basketgroup.basketsqty %]</td>
378
                                                <td>
379
                                                    <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>
380
                                                    <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>
381
                                                    <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="Print" /></form>
382
                                                    <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>
383
                                                </td>
384
                                            </tr>
371
                                            </tr>
385
                                        [% END %]
372
                                        </thead>
386
                                    [% END %]
373
                                        <tbody>
387
                                </tbody>
374
                                            [% FOREACH basketgroup IN bookseller.basketgroups %]
388
                            </table>
375
                                                [% UNLESS ( basketgroup.closed ) %]
389
                        </div>
376
                                                    <tr>
390
                    </div>
377
                                                        <td>
378
                                                            [% IF ( basketgroup.name ) %]
379
                                                                [% basketgroup.name %]
380
                                                            [% ELSE %]
381
                                                                Basket group no. [% basketgroup.id %]
382
                                                            [% END %]
383
                                                        </td>
384
                                                        <td>[% basketgroup.id %]</td>
385
                                                        <td>[% Branches.GetName(basketgroup.billingplace) %]</td>
386
                                                        <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName(basketgroup.deliveryplace) %][% END %]</td>
387
                                                        <td>[% basketgroup.basketsqty %]</td>
388
                                                        <td>[% basketgroup.ordered_titles_count %]</td>
389
                                                        <td>[% basketgroup.received_titles_count %]</td>
390
                                                        <td>
391
                                                            <input type="button" onclick="closeandprint('[% basketgroup.id %]');" value="Close and print" />
392
                                                            <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>
393
                                                            <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>
394
                                                        </td>
395
                                                    </tr>
396
                                                [% END %]
397
                                            [% END %]
398
                                        </tbody>
399
                                    </table>
400
                                </div>
401
                                <div id="closed[% bookseller.id %]">
402
                                    <table class="basket_group_closed">
403
                                        <thead>
404
                                            <tr>
405
                                                <th>Search name</th>
406
                                                <th>Search no.</th>
407
                                                <th>Search date closed</th>
408
                                                <th>Search billing place</th>
409
                                                <th>Search delivery place</th>
410
                                                <th>Search no. of baskets</th>
411
                                                <th>Search no. of ordered titles</th>
412
                                                <th>Search no. of received titles</th>
413
                                                <th></th>
414
                                            </tr>
415
                                            <tr>
416
                                                <th>Name</th>
417
                                                <th>No.</th>
418
                                                <th>Date closed</th>
419
                                                <th>Billing place</th>
420
                                                <th>Delivery place</th>
421
                                                <th>No. of baskets</th>
422
                                                <th>No. of ordered titles</th>
423
                                                <th>No. of received titles</th>
424
                                                <th>Action</th>
425
                                            </tr>
426
                                        </thead>
427
                                        <tbody>
428
                                            [% FOREACH basketgroup IN bookseller.basketgroups %]
429
                                                [% IF ( basketgroup.closed ) %]
430
                                                    <tr>
431
                                                        <td>
432
                                                            [% IF ( basketgroup.name ) %]
433
                                                                [% basketgroup.name %]
434
                                                            [% ELSE %]
435
                                                                Basket group no. [% basketgroup.id %]
436
                                                            [% END %]
437
                                                        </td>
438
                                                        <td>[% basketgroup.id %]</td>
439
                                                        <td>[% basketgroup.closeddate |$KohaDates %]</td>
440
                                                        <td>[% Branches.GetName(basketgroup.billingplace) %]</td>
441
                                                        <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName(basketgroup.deliveryplace) %][% END %]</td>
442
                                                        <td>[% basketgroup.basketsqty %]</td>
443
                                                        <td>[% basketgroup.ordered_titles_count %]</td>
444
                                                        <td>[% basketgroup.received_titles_count %]</td>
445
                                                        <td>
446
                                                            <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>
447
                                                            <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>
448
                                                            <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="Print" /></form>
449
                                                            <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>
450
                                                        </td>
451
                                                    </tr>
452
                                                [% END %]
453
                                            [% END %]
454
                                        </tbody>
455
                                    </table>
456
                                </div>
457
                            </div>
458
                        [% END %]
459
                    [% END %]
391
                [% END %]
460
                [% END %]
392
            </div>
461
            </div>
393
        </div>
462
        </div>
394
- 

Return to bug 11708