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

(-)a/acqui/lateorders.pl (-17 / +15 lines)
Lines 68-74 my ($template, $loggedinuser, $cookie) = get_template_and_user( Link Here
68
    }
68
    }
69
);
69
);
70
70
71
my $booksellerid = $input->param('booksellerid') || undef; # we don't want "" or 0
71
my $booksellerid = $input->param('booksellerid');
72
my $delay        = $input->param('delay') // 0;
72
my $delay        = $input->param('delay') // 0;
73
73
74
# Get the "date from" param if !defined is today
74
# Get the "date from" param if !defined is today
Lines 133-155 push @parameters, $estimateddeliverydateto_dt Link Here
133
    ? $estimateddeliverydateto_dt->ymd()
133
    ? $estimateddeliverydateto_dt->ymd()
134
    : undef;
134
    : undef;
135
135
136
my %supplierlist = GetBooksellersWithLateOrders(@parameters);
136
my @lateorders = Koha::Acquisition::Orders->filter_by_lates(
137
138
my (@sloopy);	# supplier loop
139
foreach( sort { $supplierlist{$a} cmp $supplierlist{$b} } keys %supplierlist ) {
140
	push @sloopy, (($booksellerid and $booksellerid eq $_ )            ?
141
					{id=>$_, name=>$supplierlist{$_}, selected=>1} :
142
					{id=>$_, name=>$supplierlist{$_}} )            ;
143
}
144
$template->param(SUPPLIER_LOOP => \@sloopy);
145
146
$template->param(Supplier=>$supplierlist{$booksellerid}) if ($booksellerid);
147
$template->param(booksellerid=>$booksellerid) if ($booksellerid);
148
149
my $lateorders = Koha::Acquisition::Orders->filter_by_lates(
150
    {
137
    {
151
        delay        => $delay,
138
        delay        => $delay,
152
        booksellerid => $booksellerid,
153
        (
139
        (
154
            $estimateddeliverydatefrom_dt
140
            $estimateddeliverydatefrom_dt
155
            ? ( estimated_from => $estimateddeliverydatefrom_dt )
141
            ? ( estimated_from => $estimateddeliverydatefrom_dt )
Lines 160-173 my $lateorders = Koha::Acquisition::Orders->filter_by_lates( Link Here
160
            ? ( estimated_to => $estimateddeliverydateto_dt )
146
            ? ( estimated_to => $estimateddeliverydateto_dt )
161
            : ()
147
            : ()
162
        )
148
        )
149
    },
150
)->as_list;
151
152
my $booksellers = Koha::Acquisition::Booksellers->search(
153
    {
154
        id => {
155
            -in => map { $_->basket->booksellerid } @lateorders
156
        },
163
    }
157
    }
164
);
158
);
165
159
160
@lateorders = grep { $_->basket->booksellerid eq $booksellerid } @lateorders if $booksellerid;
161
166
my $letters = GetLetters({ module => "claimacquisition" });
162
my $letters = GetLetters({ module => "claimacquisition" });
167
163
168
$template->param(ERROR_LOOP => \@errors) if (@errors);
164
$template->param(ERROR_LOOP => \@errors) if (@errors);
169
$template->param(
165
$template->param(
170
    lateorders => $lateorders,
166
    lateorders => \@lateorders,
167
    booksellers => $booksellers,
168
    bookseller_filter => ( $booksellerid ? $booksellers->find($booksellerid) : undef),
171
	delay => $delay,
169
	delay => $delay,
172
    letters => $letters,
170
    letters => $letters,
173
    estimateddeliverydatefrom => $estimateddeliverydatefrom,
171
    estimateddeliverydatefrom => $estimateddeliverydatefrom,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt (-12 / +14 lines)
Lines 21-27 Link Here
21
        <div class="col-sm-10 col-sm-push-2">
21
        <div class="col-sm-10 col-sm-push-2">
22
            <main>
22
            <main>
23
23
24
<h1>[% IF ( Supplier ) %][% Supplier | html %] : [% END %]Late orders</h1>
24
<h1>[% IF bookseller_filter %][% bookseller_filter.name | html %] : [% END %]Late orders</h1>
25
<div id="acqui_lateorders">
25
<div id="acqui_lateorders">
26
26
27
[% IF error_claim %]
27
[% IF error_claim %]
Lines 36-46 Link Here
36
[% IF info_claim %]
36
[% IF info_claim %]
37
    <div class="dialog message">Email has been sent.</div>
37
    <div class="dialog message">Email has been sent.</div>
38
[% END %]
38
[% END %]
39
[% IF lateorders.count %]
39
[% IF lateorders.size %]
40
<form action="lateorders.pl" name="claim" method="post">
40
<form action="lateorders.pl" name="claim" method="post">
41
  <input type="hidden" name="op" value="send_alert" />
41
  <input type="hidden" name="op" value="send_alert" />
42
  <input type="hidden" name="delay" value="[% delay | html %]" />
42
  <input type="hidden" name="delay" value="[% delay | html %]" />
43
  <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
43
  <input type="hidden" name="booksellerid" value="[% bookseller_filter.id | html %]" />
44
	[% IF ( letters ) %]
44
	[% IF ( letters ) %]
45
	<p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
45
	<p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
46
	  [% FOREACH letter IN letters %]
46
	  [% FOREACH letter IN letters %]
Lines 53-59 Link Here
53
    <table id="late_orders">
53
    <table id="late_orders">
54
      <thead>
54
      <thead>
55
        <tr>
55
        <tr>
56
            [% IF Supplier %]
56
            [% IF bookseller_filter %]
57
                <th><a id="CheckAll" href="#">Check all</a><br /><a id="CheckNone" href="#">Uncheck all</a></th>
57
                <th><a id="CheckAll" href="#">Check all</a><br /><a id="CheckNone" href="#">Uncheck all</a></th>
58
            [% ELSE %]
58
            [% ELSE %]
59
                <th></th>
59
                <th></th>
Lines 225-238 Link Here
225
        <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
225
        <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
226
    </li>
226
    </li>
227
227
228
	<li><label for="booksellerid">Vendor:</label>
228
    <li><label for="booksellerid">Vendor:</label>
229
		<select id="booksellerid" size="1" tabindex="" name="booksellerid">
229
        <select id="booksellerid" tabindex="" name="booksellerid">
230
            <option value=""></option>
230
            <option value=""></option>
231
			[% FOREACH SUPPLIER_LOO IN SUPPLIER_LOOP %]
231
            [% FOREACH bookseller IN booksellers %]
232
                [% IF ( SUPPLIER_LOO.selected ) %]<option value="[% SUPPLIER_LOO.id | html %]" selected="selected">[% SUPPLIER_LOO.name | html %]</option>
232
                [% IF bookseller.id == bookseller_filter.id %]
233
                [% ELSE %]<option value="[% SUPPLIER_LOO.id | html %]">[% SUPPLIER_LOO.name | html %]</option>[% END %]
233
                    <option value="[% bookseller.id | html %]" selected="selected">[% bookseller.name | html %]</option>
234
        	[% END %]
234
                [% ELSE %]
235
		</select>
235
                    <option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option>
236
                [% END %]
237
            [% END %]
238
        </select>
236
</ol>
239
</ol>
237
    <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
240
    <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
238
</fieldset>
241
</fieldset>
239
- 

Return to bug 25266