@@ -, +, @@ all suppliers - No. of ordered titles - No. of received titles - Ordered amount - Charged amount (amount of received orders) --- acqui/basketgroup.pl | 37 ++- koha-tmpl/intranet-tmpl/prog/css/datatables.css | 3 + .../prog/en/includes/acquisitions-menu.inc | 3 + .../prog/en/modules/acqui/basketgroup.tt | 265 +++++++++++++-------- 4 files changed, 204 insertions(+), 104 deletions(-) --- a/acqui/basketgroup.pl +++ a/acqui/basketgroup.pl @@ -58,6 +58,8 @@ use Koha::Acquisition::Booksellers; use Koha::ItemTypes; use Koha::Patrons; +use List::MoreUtils qw/uniq/; + our $input=new CGI; our ($template, $loggedinuser, $cookie) @@ -391,12 +393,35 @@ if ( $op eq "add" ) { generate_edifact_orders( $basketgroupid ); exit; }else{ -# no param : display the list of all basketgroups for a given vendor - my $basketgroups = &GetBasketgroups($booksellerid); - my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid ); - my $baskets = &GetBasketsByBookseller($booksellerid); - - displaybasketgroups($basketgroups, $bookseller, $baskets); + my @booksellers; + if ($booksellerid) { + my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid }); + push @booksellers, $bookseller; + $template->param(booksellername => $booksellers[0]->{name}); + } else { + @booksellers = Koha::Acquisition::Bookseller->search; + } + foreach my $bookseller (@booksellers) { + $bookseller->{basketgroups} = GetBasketgroups($bookseller->{id}); + foreach my $basketgroup (@{ $bookseller->{basketgroups} }) { + my $baskets = GetBasketsByBasketgroup($basketgroup->{id}); + $basketgroup->{basketsqty} = 0; + my (@ordered_biblionumbers, @received_biblionumbers); + foreach my $basket (@$baskets) { + $basketgroup->{basketsqty} += 1; + my @orders = GetOrders($basket->{basketno}); + foreach my $order (@orders) { + push @ordered_biblionumbers, $order->{biblionumber}; + if ($order->{datereceived}) { + push @received_biblionumbers, $order->{biblionumber}; + } + } + } + $basketgroup->{ordered_titles_count} = uniq @ordered_biblionumbers; + $basketgroup->{received_titles_count} = uniq @received_biblionumbers; + } + } + $template->param(booksellers => \@booksellers); } $template->param(listclosed => ((defined $input->param('listclosed')) && ($input->param('listclosed') eq '1'))? 1:0 ); #prolly won't use all these, maybe just use print, the rest can be done inside validate --- a/koha-tmpl/intranet-tmpl/prog/css/datatables.css +++ a/koha-tmpl/intranet-tmpl/prog/css/datatables.css @@ -252,6 +252,9 @@ tr.even.selected td { /* ColumnFilter */ span.filter_column > input[type="text"] { + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; font-size: 80%; width: 100%; box-sizing: border-box; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc @@ -6,6 +6,9 @@
  • Late orders
  • [% IF ( suggestion ) %]
  • Suggestions
  • [% END %]
  • Invoices
  • + [% IF ( CAN_user_acquisition_group_manage ) %] +
  • Basket groups
  • + [% END %] [% IF CAN_user_acquisition_edi_manage %]
  • EDIFACT messages
  • [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt @@ -1,9 +1,15 @@ [% USE Branches %] +[% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] -Koha › Basket grouping for [% booksellername |html %] +[% IF booksellerid %] + Koha › Basket groups for [% booksellername |html %] +[% ELSE %] + Koha › Basket groups +[% END %] [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'datatables.inc' %] + @@ -107,15 +113,35 @@ function submitForm(form) { } $(document).ready(function() { - $("#basket_groups").tabs(); + $(".basket_groups").tabs(); - $("table").dataTable($.extend(true, {}, dataTablesDefaults, { - "aoColumnDefs": [ - { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, - ], - "bAutoWidth": false, - "sPaginationType": "four_button" - } )); + $("table").each(function () { + var column_filter_options = { + sPlaceHolder: "head:after", + aoColumns: [ + { type: "text" }, + { type: "text" }, + { type: "text" }, + { type: "text" }, + { type: "text" }, + { type: "text" }, + { type: "text" }, + null + ] + }; + if ($(this).hasClass('basket_group_closed')) { + // There is one more column in closed basketgroups tables + column_filter_options.aoColumns.unshift({ type: "text" }); + } + $(this).dataTable($.extend(true, {}, dataTablesDefaults, { + "aoColumnDefs": [ + { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, + ], + "bPaginate": false, + "bAutoWidth": false + } )) + .columnFilter(column_filter_options); + }); }); @@ -129,10 +155,14 @@ function submitForm(form) { + [% booksellername |html %]Basket groups › Add basket group for [% booksellername |html %] [% ELSE %] - [% booksellername |html %] › Basket grouping + [% IF (booksellerid) %] + [% booksellername |html %] › + [% END %] + Basket groups [% END %] +
    @@ -285,97 +315,136 @@ function submitForm(form) {
    [% ELSE %] -
    -
    New basket group
    -
    -

    Basket grouping for [% booksellername |html %]

    -
    - -
    - - - - - - - - - - - - - [% FOREACH basketgroup IN basketgroups %] - [% UNLESS ( basketgroup.closed ) %] + [% IF booksellerid %] + + [% END %] + + [% FOREACH bookseller IN booksellers %] + [% IF bookseller.basketgroups.size > 0 %] +

    Basket groups for [% bookseller.name |html %]

    +
    +
      + [% UNLESS ( listclosed) %]
    • Open
    • + [% ELSE%]
    • Open
    • [% END %] + [% IF ( listclosed) %]
    • Closed
    • + [% ELSE %]
    • Closed
    • [% END %] +
    +
    +
    NameNumberBilling placeDelivery placeNumber of basketsAction
    + - - - - - - + + + + + + + + - [% END %] - [% END %] - -
    [% IF ( basketgroup.name ) %] - [% basketgroup.name %] - [% ELSE %] - Basket group no. [% basketgroup.id %] - [% END %] - [% basketgroup.id %][% Branches.GetName( basketgroup.billingplace ) %][% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %][% basketgroup.basketsqty %] - -
    - [% UNLESS basketgroup.basketsqty %] -
    - [% END %] -
    Search nameSearch no.Search billing placeSearch delivery placeSearch no. of basketsSearch no. of ordered titlesSearch no. of received titles
    -
    -
    - - - - - - - - - - - - - [% FOREACH basketgroup IN basketgroups %] - [% IF ( basketgroup.closed ) %] - - - - - - + + + + + + + + - [% END %] - [% END %] - -
    NameNumberBilling placeDelivery placeNumber of basketsAction
    - [% IF ( basketgroup.name ) %] - [% basketgroup.name %] - [% ELSE %] - Basket group no. [% basketgroup.id %] - [% END %] - [% basketgroup.id %][% Branches.GetName( basketgroup.billingplace ) %][% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %][% basketgroup.basketsqty %] -
    -
    -
    -
    -
    -
    NameNo.Billing placeDelivery placeNo. of basketsNo. of ordered titlesNo. of received titlesAction
    -
    -
    + + + [% FOREACH basketgroup IN bookseller.basketgroups %] + [% UNLESS ( basketgroup.closed ) %] + + + [% IF ( basketgroup.name ) %] + [% basketgroup.name %] + [% ELSE %] + Basket group no. [% basketgroup.id %] + [% END %] + + [% basketgroup.id %] + [% Branches.GetName(basketgroup.billingplace) %] + [% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName(basketgroup.deliveryplace) %][% END %] + [% basketgroup.basketsqty %] + [% basketgroup.ordered_titles_count %] + [% basketgroup.received_titles_count %] + + +
    + [% UNLESS basketgroup.basketsqty %] +
    + [% END %] + + + [% END %] + [% END %] + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + [% FOREACH basketgroup IN bookseller.basketgroups %] + [% IF ( basketgroup.closed ) %] + + + + + + + + + + + + [% END %] + [% END %] + +
    Search nameSearch no.Search date closedSearch billing placeSearch delivery placeSearch no. of basketsSearch no. of ordered titlesSearch no. of received titles
    NameNo.Date closedBilling placeDelivery placeNo. of basketsNo. of ordered titlesNo. of received titlesAction
    + [% IF ( basketgroup.name ) %] + [% basketgroup.name %] + [% ELSE %] + Basket group no. [% basketgroup.id %] + [% END %] + [% basketgroup.id %][% basketgroup.closeddate |$KohaDates %][% Branches.GetName(basketgroup.billingplace) %][% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName(basketgroup.deliveryplace) %][% END %][% basketgroup.basketsqty %][% basketgroup.ordered_titles_count %][% basketgroup.received_titles_count %] +
    +
    +
    +
    +
    +
    +
    + + [% END %] + [% END %] [% END %] --