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 (+1 lines)
Lines 89-94 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
};
93
my $from_placed_on = eval { dt_from_string( scalar $input->param('from') ) } || dt_from_string;
94
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;
95
my $to_placed_on   = eval { dt_from_string( scalar $input->param('to')   ) } || dt_from_string;
(-)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 %]
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 36-42 Link Here
36
                <th>Status</th>
37
                <th>Status</th>
37
				<th>Basket</th>
38
				<th>Basket</th>
38
                <th>Basket creator</th>
39
                <th>Basket creator</th>
39
				<th>Basket group</th>
40
                <th>Basket group</th>
41
                <th>Managing library</th>
40
                <th>Invoice number</th>
42
                <th>Invoice number</th>
41
                <th class="anti-the">Summary</th>
43
                <th class="anti-the">Summary</th>
42
				<th>Vendor</th>
44
				<th>Vendor</th>
Lines 73-78 Link Here
73
                            &nbsp;
75
                            &nbsp;
74
                        [% END %]
76
                        [% END %]
75
                    </td>
77
                    </td>
78
                    <td>[% Branches.GetName(order.managing_library) | html %]</td>
76
                    <td>[% IF ( order.invoicenumber ) %]
79
                    <td>[% IF ( order.invoicenumber ) %]
77
                            <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
80
                            <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
78
                        [% ELSE %]
81
                        [% ELSE %]
(-)a/t/db_dependent/Acquisition.t (-2 / +37 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 => 75;
22
use Test::More tests => 76;
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 795-798 subtest 'GetHistory with additional fields' => sub { Link Here
795
    is( scalar( @$history ), 1, 'GetHistory returns the order when additional field is set');
795
    is( scalar( @$history ), 1, 'GetHistory returns the order when additional field is set');
796
};
796
};
797
797
798
subtest 'GetHistory - managing library' => sub {
799
    plan tests => 1;
800
    
801
    my $orders = GetHistory(managing_library => 'CPL');
802
    
803
    my $builder = t::lib::TestBuilder->new;
804
805
    my $order_basket1 = $builder->build({ source => 'Aqbasket', value => { branch => 'CPL' } });
806
    my $orderinfo1 ={
807
        basketno => $order_basket1->{basketno},
808
        rrp => 19.99,
809
        replacementprice => undef,
810
        quantity => 1,
811
        quantityreceived => 0,
812
        datereceived => undef,
813
        datecancellationprinted => undef,
814
    };
815
    my $order1 = $builder->build({ source => 'Aqorder', value => $orderinfo1 });
816
    
817
    my $order_basket2 = $builder->build({ source => 'Aqbasket', value => { branch => 'LIB' } });
818
    my $orderinfo2 ={
819
        basketno => $order_basket2->{basketno},
820
        rrp => 19.99,
821
        replacementprice => undef,
822
        quantity => 1,
823
        quantityreceived => 0,
824
        datereceived => undef,
825
        datecancellationprinted => undef,
826
    };
827
    my $order2 = $builder->build({ source => 'Aqorder', value => $orderinfo2 });
828
829
    my $history = GetHistory(managing_library => 'CPL');
830
    is( scalar( @$history), scalar ( @$orders ) +1, "GetHistory returns number of orders");
831
832
};
833
798
$schema->storage->txn_rollback();
834
$schema->storage->txn_rollback();
799
- 

Return to bug 14669