Bugzilla – Attachment 14923 Details for
Bug 8854
invoice filters don't all work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bug 8854: fix some invoice search filters
bug-8854-fix-some-invoice-search-filters.patch (text/plain), 4.65 KB, created by
Galen Charlton
on 2013-01-29 17:53:31 UTC
(
hide
)
Description:
bug 8854: fix some invoice search filters
Filename:
MIME Type:
Creator:
Galen Charlton
Created:
2013-01-29 17:53:31 UTC
Size:
4.65 KB
patch
obsolete
>From 078a3f2a966d78501bc9b2c963b93d25c1c299c4 Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmc@esilibrary.com> >Date: Tue, 29 Jan 2013 09:42:12 -0800 >Subject: [PATCH] bug 8854: fix some invoice search filters > >Fix the supplier, shipment date, and library filters >on the invoice search. An invoice's library is >(in parallel with order search) defined as the library >of the staff member that approved the basket. Before this >patch, the code was referring to an aqorders.branchcode >column that doesn't exist. > >This patch also fixes the current test cases for invoices >so that they pass. > >Test plan: > >[1] Create two invoices for different vendors. >[2] Do an invoice search and filter on shipment > date. Verify that the expected invoice(s) > are returned. >[3] Do an invoice search and filter on branch > (of the staff member that approved the basket). > Verify that the expected invoice(s) are returned. >[4] Do an invoice search and filter on supplier. > Verify that the expected invoice(s) are returned. > >Signed-off-by: Galen Charlton <gmc@esilibrary.com> >--- > C4/Acquisition.pm | 9 ++++++--- > acqui/invoices.pl | 2 +- > t/Acquisition/Invoice.t | 8 ++++---- > 3 files changed, 11 insertions(+), 8 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 4a03e2c..7d3190e 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2156,6 +2156,7 @@ sub AddClaim { > > my @invoices = GetInvoices( > invoicenumber => $invoicenumber, >+ supplierid => $supplierid, > suppliername => $suppliername, > shipmentdatefrom => $shipmentdatefrom, # ISO format > shipmentdateto => $shipmentdateto, # ISO format >@@ -2200,6 +2201,8 @@ sub GetInvoices { > FROM aqinvoices > LEFT JOIN aqbooksellers ON aqbooksellers.id = aqinvoices.booksellerid > LEFT JOIN aqorders ON aqorders.invoiceid = aqinvoices.invoiceid >+ LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno >+ LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber > LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber > LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber > LEFT JOIN subscription ON biblio.biblionumber = subscription.biblionumber >@@ -2220,11 +2223,11 @@ sub GetInvoices { > push @bind_args, "%$args{suppliername}%"; > } > if($args{shipmentdatefrom}) { >- push @bind_strs, " aqinvoices.shipementdate >= ? "; >+ push @bind_strs, " aqinvoices.shipmentdate >= ? "; > push @bind_args, $args{shipmentdatefrom}; > } > if($args{shipmentdateto}) { >- push @bind_strs, " aqinvoices.shipementdate <= ? "; >+ push @bind_strs, " aqinvoices.shipmentdate <= ? "; > push @bind_args, $args{shipmentdateto}; > } > if($args{billingdatefrom}) { >@@ -2256,7 +2259,7 @@ sub GetInvoices { > push @bind_args, $args{publicationyear}; > } > if($args{branchcode}) { >- push @bind_strs, " aqorders.branchcode = ? "; >+ push @bind_strs, " borrowers.branchcode = ? "; > push @bind_args, $args{branchcode}; > } > >diff --git a/acqui/invoices.pl b/acqui/invoices.pl >index b7f360e..deb4fd6 100755 >--- a/acqui/invoices.pl >+++ b/acqui/invoices.pl >@@ -71,7 +71,7 @@ if ( $op and $op eq "do_search" ) { > my $billingdateto_iso = C4::Dates->new($billingdateto)->output("iso"); > my @invoices = GetInvoices( > invoicenumber => $invoicenumber, >- suppliername => $supplier, >+ supplierid => $supplier, > shipmentdatefrom => $shipmentdatefrom_iso, > shipmentdateto => $shipmentdateto_iso, > billingdatefrom => $billingdatefrom_iso, >diff --git a/t/Acquisition/Invoice.t b/t/Acquisition/Invoice.t >index a887965..53ecfa2 100755 >--- a/t/Acquisition/Invoice.t >+++ b/t/Acquisition/Invoice.t >@@ -6,8 +6,6 @@ use C4::Context; > use Test::More tests => 47; > use Test::MockModule; > >-use_ok('C4::Acquisition'); >- > my $module = new Test::MockModule('C4::Context'); > $module->mock('_new_dbh', sub { > my $dbh = DBI->connect( 'DBI:Mock:', '', '' ) >@@ -17,6 +15,8 @@ $module->mock('_new_dbh', sub { > > my $dbh = C4::Context->dbh; > >+use_ok('C4::Acquisition'); >+ > # We need to add a resultset to avoid DBI fail > # ("DBI bind_columns: invalid number of arguments...") > my $rs = [ >@@ -42,8 +42,8 @@ my @invoices = C4::Acquisition::GetInvoices( > ); > my $history = $dbh->{mock_all_history}; > >-is(scalar(@$history), 1); >-my @bound_params = @{ $history->[0]->{bound_params} }; >+ok(scalar(@$history) > 0); >+my @bound_params = @{ $history->[-1]->{bound_params} }; > is(scalar(@bound_params), 15); > is($bound_params[0], 'supplierid'); > is($bound_params[1], '%invoicenumber%'); >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8854
:
14923
|
15055
|
15056
|
22330
|
22442
|
22504
|
22976