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

(-)a/C4/Acquisition.pm (+8 lines)
Lines 2456-2461 sub GetInvoices { Link Here
2456
        push @bind_strs, " aqinvoices.message_id = ? ";
2456
        push @bind_strs, " aqinvoices.message_id = ? ";
2457
        push @bind_args, $args{message_id};
2457
        push @bind_args, $args{message_id};
2458
    }
2458
    }
2459
    if ( exists $args{closedate} ) {
2460
        if ( $args{closedate} ) {
2461
            push @bind_strs, " aqinvoices.closedate = ? ";
2462
            push @bind_args, $args{closedate};
2463
        } else {
2464
            push @bind_strs, " aqinvoices.closedate IS NULL ";
2465
        }
2466
    }
2459
2467
2460
    $query .= " WHERE " . join(" AND ", @bind_strs) if @bind_strs;
2468
    $query .= " WHERE " . join(" AND ", @bind_strs) if @bind_strs;
2461
2469
(-)a/acqui/parcels.pl (-1 / +4 lines)
Lines 87-92 my $code = $input->param('filter'); Link Here
87
my $datefrom       = $input->param('datefrom');
87
my $datefrom       = $input->param('datefrom');
88
my $dateto         = $input->param('dateto');
88
my $dateto         = $input->param('dateto');
89
my $resultsperpage = $input->param('resultsperpage');
89
my $resultsperpage = $input->param('resultsperpage');
90
my $include_closed = $input->param('filter_include_closed');
90
my $op             = $input->param('op');
91
my $op             = $input->param('op');
91
$resultsperpage ||= 20;
92
$resultsperpage ||= 20;
92
93
Lines 155-161 my @parcels = GetInvoices( Link Here
155
    invoicenumber => $code,
156
    invoicenumber => $code,
156
    ( $datefrom ? ( shipmentdatefrom => $datefrom ) : () ),
157
    ( $datefrom ? ( shipmentdatefrom => $datefrom ) : () ),
157
    ( $dateto   ? ( shipmentdateto   => $dateto   ) : () ),
158
    ( $dateto   ? ( shipmentdateto   => $dateto   ) : () ),
158
    order_by => $order
159
    order_by => $order,
160
    ( $include_closed ? () : ( closedate => undef ) ),
159
);
161
);
160
my $count_parcels = @parcels;
162
my $count_parcels = @parcels;
161
163
Lines 210-215 $template->param( Link Here
210
    datefrom                 => $datefrom,
212
    datefrom                 => $datefrom,
211
    dateto                   => $dateto,
213
    dateto                   => $dateto,
212
    resultsperpage           => $resultsperpage,
214
    resultsperpage           => $resultsperpage,
215
    filter_include_closed    => $include_closed,
213
    name                     => $bookseller->name,
216
    name                     => $bookseller->name,
214
    shipmentdate_today       => dt_from_string,
217
    shipmentdate_today       => dt_from_string,
215
    booksellerid             => $booksellerid,
218
    booksellerid             => $booksellerid,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt (+11 lines)
Lines 233-238 Link Here
233
                <option value="50">50</option>
233
                <option value="50">50</option>
234
                <option value="100">100</option>
234
                <option value="100">100</option>
235
                </select></li>
235
                </select></li>
236
            <li>
237
                <label for="filter_include_closed">
238
                    [% IF filter_include_closed %]
239
                        <input type="checkbox" id="filter_include_closed" value="1" name="filter_include_closed" checked="checked" title="Include closed invoices in the search" />
240
                    [% ELSE %]
241
                        <input type="checkbox" id="filter_include_closed" value="1" name="filter_include_closed" title="Include closed invoices in the search" />
242
                    [% END %]
243
                    Include closed invoices
244
                </label>
245
246
            </li>
236
        </ol>
247
        </ol>
237
        <fieldset class="action"><input type="submit" class="btn btn-default" value="Filter" /> <a href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% booksellerid | uri %]">Clear</a></fieldset>
248
        <fieldset class="action"><input type="submit" class="btn btn-default" value="Filter" /> <a href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% booksellerid | uri %]">Clear</a></fieldset>
238
    </fieldset>
249
    </fieldset>
(-)a/t/db_dependent/Acquisition/Invoices.t (-2 / +14 lines)
Lines 8-14 use Koha::Acquisition::Booksellers; Link Here
8
use Koha::Acquisition::Orders;
8
use Koha::Acquisition::Orders;
9
use Koha::Database;
9
use Koha::Database;
10
10
11
use Test::More tests => 24;
11
use Test::More tests => 27;
12
12
13
BEGIN {
13
BEGIN {
14
    use_ok('C4::Acquisition', qw( NewBasket GetBasket AddInvoice GetInvoice ModReceiveOrder GetInvoiceDetails GetInvoices ModInvoice CloseInvoice ReopenInvoice MergeInvoices DelInvoice ));
14
    use_ok('C4::Acquisition', qw( NewBasket GetBasket AddInvoice GetInvoice ModReceiveOrder GetInvoiceDetails GetInvoices ModInvoice CloseInvoice ReopenInvoice MergeInvoices DelInvoice ));
Lines 99-104 my $invoiceid1 = AddInvoice(invoicenumber => 'invoice1', booksellerid => $bookse Link Here
99
my $invoiceid2 = AddInvoice(invoicenumber => 'invoice2', booksellerid => $booksellerid, unknown => "unknown",
99
my $invoiceid2 = AddInvoice(invoicenumber => 'invoice2', booksellerid => $booksellerid, unknown => "unknown",
100
                            shipmentdate => '2012-12-24',
100
                            shipmentdate => '2012-12-24',
101
                           );
101
                           );
102
my $invoiceid_closed = AddInvoice(
103
    invoicenumber => 'invoice_close',
104
    booksellerid  => $booksellerid,
105
    unknown       => "unknown",
106
    shipmentdate  => '2012-12-24',
107
    closedate     => '2024-12-13',
108
);
109
102
110
103
my $invoice1 = GetInvoice( $invoiceid1 );
111
my $invoice1 = GetInvoice( $invoiceid1 );
104
my $invoice2 = GetInvoice( $invoiceid2 );
112
my $invoice2 = GetInvoice( $invoiceid2 );
Lines 162-167 is($invoices[0]->{invoicenumber}, 'invoice1', 'GetInvoices() to search by ISBN w Link Here
162
@invoices = GetInvoices(isbneanissn => '123456789');
170
@invoices = GetInvoices(isbneanissn => '123456789');
163
is($invoices[0]->{invoicenumber}, 'invoice1', 'GetInvoices() to search by partial ISBN works (bug 8854)');
171
is($invoices[0]->{invoicenumber}, 'invoice1', 'GetInvoices() to search by partial ISBN works (bug 8854)');
164
172
173
@invoices = GetInvoices(booksellerid => $booksellerid, closedate => undef);
174
is(scalar @invoices, 2, );
175
is($invoices[0]->{invoicenumber}, 'invoice1', 'GetInvoices()');
176
is($invoices[1]->{invoicenumber}, 'invoice2', 'GetInvoices()');
177
165
my $invoicesummary1 = GetInvoice($invoiceid1);
178
my $invoicesummary1 = GetInvoice($invoiceid1);
166
is($invoicesummary1->{'invoicenumber'}, 'invoice1', 'GetInvoice retrieves correct invoice');
179
is($invoicesummary1->{'invoicenumber'}, 'invoice1', 'GetInvoice retrieves correct invoice');
167
is($invoicesummary1->{'invoicenumber'}, $invoice1->{'invoicenumber'}, 'GetInvoice and GetInvoiceDetails retrieve same information');
180
is($invoicesummary1->{'invoicenumber'}, $invoice1->{'invoicenumber'}, 'GetInvoice and GetInvoiceDetails retrieve same information');
168
- 

Return to bug 38343