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

(-)a/C4/Acquisition.pm (-3 / +6 lines)
Lines 2156-2161 sub AddClaim { Link Here
2156
2156
2157
    my @invoices = GetInvoices(
2157
    my @invoices = GetInvoices(
2158
        invoicenumber => $invoicenumber,
2158
        invoicenumber => $invoicenumber,
2159
        supplierid => $supplierid,
2159
        suppliername => $suppliername,
2160
        suppliername => $suppliername,
2160
        shipmentdatefrom => $shipmentdatefrom, # ISO format
2161
        shipmentdatefrom => $shipmentdatefrom, # ISO format
2161
        shipmentdateto => $shipmentdateto, # ISO format
2162
        shipmentdateto => $shipmentdateto, # ISO format
Lines 2200-2205 sub GetInvoices { Link Here
2200
        FROM aqinvoices
2201
        FROM aqinvoices
2201
          LEFT JOIN aqbooksellers ON aqbooksellers.id = aqinvoices.booksellerid
2202
          LEFT JOIN aqbooksellers ON aqbooksellers.id = aqinvoices.booksellerid
2202
          LEFT JOIN aqorders ON aqorders.invoiceid = aqinvoices.invoiceid
2203
          LEFT JOIN aqorders ON aqorders.invoiceid = aqinvoices.invoiceid
2204
          LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
2205
          LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
2203
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
2206
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
2204
          LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber
2207
          LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber
2205
          LEFT JOIN subscription ON biblio.biblionumber = subscription.biblionumber
2208
          LEFT JOIN subscription ON biblio.biblionumber = subscription.biblionumber
Lines 2220-2230 sub GetInvoices { Link Here
2220
        push @bind_args, "%$args{suppliername}%";
2223
        push @bind_args, "%$args{suppliername}%";
2221
    }
2224
    }
2222
    if($args{shipmentdatefrom}) {
2225
    if($args{shipmentdatefrom}) {
2223
        push @bind_strs, " aqinvoices.shipementdate >= ? ";
2226
        push @bind_strs, " aqinvoices.shipmentdate >= ? ";
2224
        push @bind_args, $args{shipmentdatefrom};
2227
        push @bind_args, $args{shipmentdatefrom};
2225
    }
2228
    }
2226
    if($args{shipmentdateto}) {
2229
    if($args{shipmentdateto}) {
2227
        push @bind_strs, " aqinvoices.shipementdate <= ? ";
2230
        push @bind_strs, " aqinvoices.shipmentdate <= ? ";
2228
        push @bind_args, $args{shipmentdateto};
2231
        push @bind_args, $args{shipmentdateto};
2229
    }
2232
    }
2230
    if($args{billingdatefrom}) {
2233
    if($args{billingdatefrom}) {
Lines 2256-2262 sub GetInvoices { Link Here
2256
        push @bind_args, $args{publicationyear};
2259
        push @bind_args, $args{publicationyear};
2257
    }
2260
    }
2258
    if($args{branchcode}) {
2261
    if($args{branchcode}) {
2259
        push @bind_strs, " aqorders.branchcode = ? ";
2262
        push @bind_strs, " borrowers.branchcode = ? ";
2260
        push @bind_args, $args{branchcode};
2263
        push @bind_args, $args{branchcode};
2261
    }
2264
    }
2262
2265
(-)a/acqui/invoices.pl (-1 / +1 lines)
Lines 71-77 if ( $op and $op eq "do_search" ) { Link Here
71
    my $billingdateto_iso    = C4::Dates->new($billingdateto)->output("iso");
71
    my $billingdateto_iso    = C4::Dates->new($billingdateto)->output("iso");
72
    my @invoices             = GetInvoices(
72
    my @invoices             = GetInvoices(
73
        invoicenumber    => $invoicenumber,
73
        invoicenumber    => $invoicenumber,
74
        suppliername     => $supplier,
74
        supplierid       => $supplier,
75
        shipmentdatefrom => $shipmentdatefrom_iso,
75
        shipmentdatefrom => $shipmentdatefrom_iso,
76
        shipmentdateto   => $shipmentdateto_iso,
76
        shipmentdateto   => $shipmentdateto_iso,
77
        billingdatefrom  => $billingdatefrom_iso,
77
        billingdatefrom  => $billingdatefrom_iso,
(-)a/t/Acquisition/Invoice.t (-5 / +4 lines)
Lines 6-13 use C4::Context; Link Here
6
use Test::More tests => 47;
6
use Test::More tests => 47;
7
use Test::MockModule;
7
use Test::MockModule;
8
8
9
use_ok('C4::Acquisition');
10
11
my $module = new Test::MockModule('C4::Context');
9
my $module = new Test::MockModule('C4::Context');
12
$module->mock('_new_dbh', sub {
10
$module->mock('_new_dbh', sub {
13
    my $dbh = DBI->connect( 'DBI:Mock:', '', '' )
11
    my $dbh = DBI->connect( 'DBI:Mock:', '', '' )
Lines 17-22 $module->mock('_new_dbh', sub { Link Here
17
15
18
my $dbh = C4::Context->dbh;
16
my $dbh = C4::Context->dbh;
19
17
18
use_ok('C4::Acquisition');
19
20
# We need to add a resultset to avoid DBI fail
20
# We need to add a resultset to avoid DBI fail
21
# ("DBI bind_columns: invalid number of arguments...")
21
# ("DBI bind_columns: invalid number of arguments...")
22
my $rs = [
22
my $rs = [
Lines 42-49 my @invoices = C4::Acquisition::GetInvoices( Link Here
42
);
42
);
43
my $history = $dbh->{mock_all_history};
43
my $history = $dbh->{mock_all_history};
44
44
45
is(scalar(@$history), 1);
45
ok(scalar(@$history) > 0);
46
my @bound_params = @{ $history->[0]->{bound_params} };
46
my @bound_params = @{ $history->[-1]->{bound_params} };
47
is(scalar(@bound_params), 15);
47
is(scalar(@bound_params), 15);
48
is($bound_params[0], 'supplierid');
48
is($bound_params[0], 'supplierid');
49
is($bound_params[1], '%invoicenumber%');
49
is($bound_params[1], '%invoicenumber%');
50
- 

Return to bug 8854