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

(-)a/C4/Acquisition.pm (-1 / +10 lines)
Lines 2276-2281 params: Link Here
2276
  budget
2276
  budget
2277
  orderstatus (note that orderstatus '' will retrieve orders
2277
  orderstatus (note that orderstatus '' will retrieve orders
2278
               of any status except cancelled)
2278
               of any status except cancelled)
2279
  managing_library
2279
  biblionumber
2280
  biblionumber
2280
  get_canceled_order (if set to a true value, cancelled orders will
2281
  get_canceled_order (if set to a true value, cancelled orders will
2281
                      be included)
2282
                      be included)
Lines 2296-2302 returns: Link Here
2296
                'ordernumber'      => '1',
2297
                'ordernumber'      => '1',
2297
                'quantity'         => 1,
2298
                'quantity'         => 1,
2298
                'quantityreceived' => undef,
2299
                'quantityreceived' => undef,
2299
                'title'            => 'The Adventures of Huckleberry Finn'
2300
                'title'            => 'The Adventures of Huckleberry Finn',
2301
                'managing_library' => 'CPL'
2300
            }
2302
            }
2301
2303
2302
=cut
2304
=cut
Lines 2322-2327 sub GetHistory { Link Here
2322
    my $ordernumber = $params{ordernumber};
2324
    my $ordernumber = $params{ordernumber};
2323
    my $search_children_too = $params{search_children_too} || 0;
2325
    my $search_children_too = $params{search_children_too} || 0;
2324
    my $created_by = $params{created_by} || [];
2326
    my $created_by = $params{created_by} || [];
2327
    my $managing_library = $params{managing_library};
2325
    my $ordernumbers = $params{ordernumbers} || [];
2328
    my $ordernumbers = $params{ordernumbers} || [];
2326
    my $additional_fields = $params{additional_fields} // [];
2329
    my $additional_fields = $params{additional_fields} // [];
2327
2330
Lines 2358-2363 sub GetHistory { Link Here
2358
            aqbasket.basketgroupid,
2361
            aqbasket.basketgroupid,
2359
            aqbasket.authorisedby,
2362
            aqbasket.authorisedby,
2360
            concat( borrowers.firstname,' ',borrowers.surname) AS authorisedbyname,
2363
            concat( borrowers.firstname,' ',borrowers.surname) AS authorisedbyname,
2364
            branch as managing_library,
2361
            aqbasketgroups.name as groupname,
2365
            aqbasketgroups.name as groupname,
2362
            aqbooksellers.name,
2366
            aqbooksellers.name,
2363
            aqbasket.creationdate,
2367
            aqbasket.creationdate,
Lines 2484-2489 sub GetHistory { Link Here
2484
        push @query_params, @$created_by;
2488
        push @query_params, @$created_by;
2485
    }
2489
    }
2486
2490
2491
    if ( $managing_library ) {
2492
        $query .= " AND aqbasket.branch = ? ";
2493
        push @query_params, $managing_library;
2494
    }
2495
2487
    if ( @$ordernumbers ) {
2496
    if ( @$ordernumbers ) {
2488
        $query .= ' AND (aqorders.ordernumber IN ( ' . join (',', ('?') x @$ordernumbers ) . '))';
2497
        $query .= ' AND (aqorders.ordernumber IN ( ' . join (',', ('?') x @$ordernumbers ) . '))';
2489
        push @query_params, @$ordernumbers;
2498
        push @query_params, @$ordernumbers;
(-)a/acqui/histsearch.pl (-2 / +4 lines)
Lines 89-103 my $filters = { Link Here
89
    ordernumber             => scalar $input->param('ordernumber'),
89
    ordernumber             => scalar $input->param('ordernumber'),
90
    search_children_too     => scalar $input->param('search_children_too'),
90
    search_children_too     => scalar $input->param('search_children_too'),
91
    created_by              => [ $input->multi_param('created_by') ],
91
    created_by              => [ $input->multi_param('created_by') ],
92
    managing_library        => scalar $input->param('managing_library'),
92
};
93
};
94
93
my $from_placed_on = eval { dt_from_string( scalar $input->param('from') ) } || dt_from_string;
95
my $from_placed_on = eval { dt_from_string( scalar $input->param('from') ) } || dt_from_string;
94
my $to_placed_on   = eval { dt_from_string( scalar $input->param('to')   ) } || dt_from_string;
96
my $to_placed_on   = eval { dt_from_string( scalar $input->param('to')   ) } || dt_from_string;
95
unless ( $input->param('from') ) {
97
unless ( $input->param('from') ) {
96
    # Fill the form with year-1
98
    # Fill the form with year-1
97
    $from_placed_on->set_time_zone('floating')->subtract( years => 1 );
99
    $from_placed_on->set_time_zone('floating')->subtract( years => 1 );
98
}
100
}
99
$filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } ),
101
$filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } );
100
$filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } ),
102
$filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } );
101
my @additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } );
103
my @additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } );
102
$template->param( available_additional_fields => \@additional_fields );
104
$template->param( available_additional_fields => \@additional_fields );
103
my @additional_field_filters;
105
my @additional_field_filters;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc (+8 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% USE KohaDates %]
3
[% USE KohaDates %]
3
<ol>
4
<ol>
4
    <li><label for="title">Title: </label> <input type="text" name="title" id="title" value="[% filters.title | html %]" /></li>
5
    <li><label for="title">Title: </label> <input type="text" name="title" id="title" value="[% filters.title | html %]" /></li>
Lines 15-20 Link Here
15
            <div id="basket_creators" style="float:left;"></div>
16
            <div id="basket_creators" style="float:left;"></div>
16
        </div>
17
        </div>
17
    </li>
18
    </li>
19
    <li>
20
        <label for="managing_library">Managing library: </label>
21
        <select name="managing_library" id="managing_library">
22
            <option value="">Any library</option>
23
            [% PROCESS options_for_libraries libraries => Branches.all(selected => '') %]
24
        </select>
25
    </li>
18
    <li><label for="booksellerinvoicenumber ">Bookseller invoice no: </label> <input type="text" name="booksellerinvoicenumber" id="booksellerinvoicenumber" value="[% filters.booksellerinvoicenumber | html %]" /></li>
26
    <li><label for="booksellerinvoicenumber ">Bookseller invoice no: </label> <input type="text" name="booksellerinvoicenumber" id="booksellerinvoicenumber" value="[% filters.booksellerinvoicenumber | html %]" /></li>
19
    <li>
27
    <li>
20
        <label for="basketgroupname">Basket group:</label>
28
        <label for="basketgroupname">Basket group:</label>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt (-1 / +4 lines)
Lines 2-7 Link Here
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE KohaDates %]
3
[% USE KohaDates %]
4
[% USE ColumnsSettings %]
4
[% USE ColumnsSettings %]
5
[% USE Branches %]
5
[% SET footerjs = 1 %]
6
[% SET footerjs = 1 %]
6
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
7
<title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( order_loop ) %]Orders search &rsaquo; Search results[% ELSE %]Order search[% END %]</title>
8
<title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( order_loop ) %]Orders search &rsaquo; Search results[% ELSE %]Order search[% END %]</title>
Lines 38-44 Link Here
38
                <th>Status</th>
39
                <th>Status</th>
39
				<th>Basket</th>
40
				<th>Basket</th>
40
                <th>Basket creator</th>
41
                <th>Basket creator</th>
41
				<th>Basket group</th>
42
                <th>Basket group</th>
43
                <th>Managing library</th>
42
                <th>Invoice number</th>
44
                <th>Invoice number</th>
43
                <th class="anti-the">Summary</th>
45
                <th class="anti-the">Summary</th>
44
				<th>Vendor</th>
46
				<th>Vendor</th>
Lines 75-80 Link Here
75
                            &nbsp;
77
                            &nbsp;
76
                        [% END %]
78
                        [% END %]
77
                    </td>
79
                    </td>
80
                    <td>[% Branches.GetName(order.managing_library) | html %]</td>
78
                    <td>[% IF ( order.invoicenumber ) %]
81
                    <td>[% IF ( order.invoicenumber ) %]
79
                            <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
82
                            <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
80
                        [% ELSE %]
83
                        [% ELSE %]
(-)a/t/db_dependent/Acquisition.t (-2 / +39 lines)
Lines 19-25 use Modern::Perl; Link Here
19
19
20
use POSIX qw(strftime);
20
use POSIX qw(strftime);
21
21
22
use Test::More tests => 77;
22
use Test::More tests => 78;
23
use t::lib::Mocks;
23
use t::lib::Mocks;
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::Acquisition::Basket;
25
use Koha::Acquisition::Basket;
Lines 838-841 subtest 'Test for get_rounded_price' => sub { Link Here
838
    is( $rounded_result3,     $round_down_price, "Price ($down_price) was correctly rounded ($rounded_result3)" );
838
    is( $rounded_result3,     $round_down_price, "Price ($down_price) was correctly rounded ($rounded_result3)" );
839
839
840
};
840
};
841
842
subtest 'GetHistory - managing library' => sub {
843
844
    plan tests => 1;
845
846
    my $orders = GetHistory(managing_library => 'CPL');
847
848
    my $builder = t::lib::TestBuilder->new;
849
850
    my $order_basket1 = $builder->build({ source => 'Aqbasket', value => { branch => 'CPL' } });
851
    my $orderinfo1 ={
852
        basketno => $order_basket1->{basketno},
853
        rrp => 19.99,
854
        replacementprice => undef,
855
        quantity => 1,
856
        quantityreceived => 0,
857
        datereceived => undef,
858
        datecancellationprinted => undef,
859
    };
860
    my $order1 = $builder->build({ source => 'Aqorder', value => $orderinfo1 });
861
862
    my $order_basket2 = $builder->build({ source => 'Aqbasket', value => { branch => 'LIB' } });
863
    my $orderinfo2 ={
864
        basketno => $order_basket2->{basketno},
865
        rrp => 19.99,
866
        replacementprice => undef,
867
        quantity => 1,
868
        quantityreceived => 0,
869
        datereceived => undef,
870
        datecancellationprinted => undef,
871
    };
872
    my $order2 = $builder->build({ source => 'Aqorder', value => $orderinfo2 });
873
874
    my $history = GetHistory(managing_library => 'CPL');
875
    is( scalar( @$history), scalar ( @$orders ) +1, "GetHistory returns number of orders");
876
877
};
878
841
$schema->storage->txn_rollback();
879
$schema->storage->txn_rollback();
842
- 

Return to bug 14669