Bug 25266: Build the vendor list from the order list
This patch is removing the use of GetBooksellersWithLateOrders and use the late order list to generate the vendors. Test plan: Create several vendors, several orders, close the baskets Also create vendors that do not have orders (or basket not closed) Go to the late orders page and confirm that the list of vendors is correctly filled, select one, you can see the "select all" link in the header of the table QA: that would be good to test this with production data and compare execution time. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
941b5aaecc
commit
9e1d4c978d
2 changed files with 29 additions and 28 deletions
|
@ -68,7 +68,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user(
|
|||
}
|
||||
);
|
||||
|
||||
my $booksellerid = $input->param('booksellerid') || undef; # we don't want "" or 0
|
||||
my $booksellerid = $input->param('booksellerid');
|
||||
my $delay = $input->param('delay') // 0;
|
||||
|
||||
# Get the "date from" param if !defined is today
|
||||
|
@ -133,23 +133,9 @@ push @parameters, $estimateddeliverydateto_dt
|
|||
? $estimateddeliverydateto_dt->ymd()
|
||||
: undef;
|
||||
|
||||
my %supplierlist = GetBooksellersWithLateOrders(@parameters);
|
||||
|
||||
my (@sloopy); # supplier loop
|
||||
foreach( sort { $supplierlist{$a} cmp $supplierlist{$b} } keys %supplierlist ) {
|
||||
push @sloopy, (($booksellerid and $booksellerid eq $_ ) ?
|
||||
{id=>$_, name=>$supplierlist{$_}, selected=>1} :
|
||||
{id=>$_, name=>$supplierlist{$_}} ) ;
|
||||
}
|
||||
$template->param(SUPPLIER_LOOP => \@sloopy);
|
||||
|
||||
$template->param(Supplier=>$supplierlist{$booksellerid}) if ($booksellerid);
|
||||
$template->param(booksellerid=>$booksellerid) if ($booksellerid);
|
||||
|
||||
my $lateorders = Koha::Acquisition::Orders->filter_by_lates(
|
||||
my @lateorders = Koha::Acquisition::Orders->filter_by_lates(
|
||||
{
|
||||
delay => $delay,
|
||||
booksellerid => $booksellerid,
|
||||
(
|
||||
$estimateddeliverydatefrom_dt
|
||||
? ( estimated_from => $estimateddeliverydatefrom_dt )
|
||||
|
@ -160,14 +146,26 @@ my $lateorders = Koha::Acquisition::Orders->filter_by_lates(
|
|||
? ( estimated_to => $estimateddeliverydateto_dt )
|
||||
: ()
|
||||
)
|
||||
},
|
||||
)->as_list;
|
||||
|
||||
my $booksellers = Koha::Acquisition::Booksellers->search(
|
||||
{
|
||||
id => {
|
||||
-in => map { $_->basket->booksellerid } @lateorders
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
@lateorders = grep { $_->basket->booksellerid eq $booksellerid } @lateorders if $booksellerid;
|
||||
|
||||
my $letters = GetLetters({ module => "claimacquisition" });
|
||||
|
||||
$template->param(ERROR_LOOP => \@errors) if (@errors);
|
||||
$template->param(
|
||||
lateorders => $lateorders,
|
||||
lateorders => \@lateorders,
|
||||
booksellers => $booksellers,
|
||||
bookseller_filter => ( $booksellerid ? $booksellers->find($booksellerid) : undef),
|
||||
delay => $delay,
|
||||
letters => $letters,
|
||||
estimateddeliverydatefrom => $estimateddeliverydatefrom,
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<div class="col-sm-10 col-sm-push-2">
|
||||
<main>
|
||||
|
||||
<h1>[% IF ( Supplier ) %][% Supplier | html %] : [% END %]Late orders</h1>
|
||||
<h1>[% IF bookseller_filter %][% bookseller_filter.name | html %] : [% END %]Late orders</h1>
|
||||
<div id="acqui_lateorders">
|
||||
|
||||
[% IF error_claim %]
|
||||
|
@ -36,11 +36,11 @@
|
|||
[% IF info_claim %]
|
||||
<div class="dialog message">Email has been sent.</div>
|
||||
[% END %]
|
||||
[% IF lateorders.count %]
|
||||
[% IF lateorders.size %]
|
||||
<form action="lateorders.pl" name="claim" method="post">
|
||||
<input type="hidden" name="op" value="send_alert" />
|
||||
<input type="hidden" name="delay" value="[% delay | html %]" />
|
||||
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
|
||||
<input type="hidden" name="booksellerid" value="[% bookseller_filter.id | html %]" />
|
||||
[% IF ( letters ) %]
|
||||
<p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
|
||||
[% FOREACH letter IN letters %]
|
||||
|
@ -53,7 +53,7 @@
|
|||
<table id="late_orders">
|
||||
<thead>
|
||||
<tr>
|
||||
[% IF Supplier %]
|
||||
[% IF bookseller_filter %]
|
||||
<th><a id="CheckAll" href="#">Check all</a><br /><a id="CheckNone" href="#">Uncheck all</a></th>
|
||||
[% ELSE %]
|
||||
<th></th>
|
||||
|
@ -225,14 +225,17 @@
|
|||
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
|
||||
</li>
|
||||
|
||||
<li><label for="booksellerid">Vendor:</label>
|
||||
<select id="booksellerid" size="1" tabindex="" name="booksellerid">
|
||||
<li><label for="booksellerid">Vendor:</label>
|
||||
<select id="booksellerid" tabindex="" name="booksellerid">
|
||||
<option value=""></option>
|
||||
[% FOREACH SUPPLIER_LOO IN SUPPLIER_LOOP %]
|
||||
[% IF ( SUPPLIER_LOO.selected ) %]<option value="[% SUPPLIER_LOO.id | html %]" selected="selected">[% SUPPLIER_LOO.name | html %]</option>
|
||||
[% ELSE %]<option value="[% SUPPLIER_LOO.id | html %]">[% SUPPLIER_LOO.name | html %]</option>[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
[% FOREACH bookseller IN booksellers %]
|
||||
[% IF bookseller.id == bookseller_filter.id %]
|
||||
<option value="[% bookseller.id | html %]" selected="selected">[% bookseller.name | html %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
</ol>
|
||||
<fieldset class="action"><input type="submit" value="Filter" /></fieldset>
|
||||
</fieldset>
|
||||
|
|
Loading…
Reference in a new issue