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

(-)a/acqui/lateorders.pl (-17 / +15 lines)
Lines 67-73 my ($template, $loggedinuser, $cookie) = get_template_and_user( Link Here
67
    }
67
    }
68
);
68
);
69
69
70
my $booksellerid = $input->param('booksellerid') || undef; # we don't want "" or 0
70
my $booksellerid = $input->param('booksellerid');
71
my $delay        = $input->param('delay') // 0;
71
my $delay        = $input->param('delay') // 0;
72
72
73
# Get the "date from" param if !defined is today
73
# Get the "date from" param if !defined is today
Lines 132-154 push @parameters, $estimateddeliverydateto_dt Link Here
132
    ? $estimateddeliverydateto_dt->ymd()
132
    ? $estimateddeliverydateto_dt->ymd()
133
    : undef;
133
    : undef;
134
134
135
my %supplierlist = GetBooksellersWithLateOrders(@parameters);
135
my @lateorders = Koha::Acquisition::Orders->filter_by_lates(
136
137
my (@sloopy);	# supplier loop
138
foreach( sort { $supplierlist{$a} cmp $supplierlist{$b} } keys %supplierlist ) {
139
	push @sloopy, (($booksellerid and $booksellerid eq $_ )            ?
140
					{id=>$_, name=>$supplierlist{$_}, selected=>1} :
141
					{id=>$_, name=>$supplierlist{$_}} )            ;
142
}
143
$template->param(SUPPLIER_LOOP => \@sloopy);
144
145
$template->param(Supplier=>$supplierlist{$booksellerid}) if ($booksellerid);
146
$template->param(booksellerid=>$booksellerid) if ($booksellerid);
147
148
my $lateorders = Koha::Acquisition::Orders->filter_by_lates(
149
    {
136
    {
150
        delay        => $delay,
137
        delay        => $delay,
151
        booksellerid => $booksellerid,
152
        (
138
        (
153
            $estimateddeliverydatefrom_dt
139
            $estimateddeliverydatefrom_dt
154
            ? ( estimated_from => $estimateddeliverydatefrom_dt )
140
            ? ( estimated_from => $estimateddeliverydatefrom_dt )
Lines 159-172 my $lateorders = Koha::Acquisition::Orders->filter_by_lates( Link Here
159
            ? ( estimated_to => $estimateddeliverydateto_dt )
145
            ? ( estimated_to => $estimateddeliverydateto_dt )
160
            : ()
146
            : ()
161
        )
147
        )
148
    },
149
)->as_list;
150
151
my $booksellers = Koha::Acquisition::Booksellers->search(
152
    {
153
        id => {
154
            -in => map { $_->basket->booksellerid } @lateorders
155
        },
162
    }
156
    }
163
);
157
);
164
158
159
@lateorders = grep { $_->basket->booksellerid eq $booksellerid } @lateorders if $booksellerid;
160
165
my $letters = GetLetters({ module => "claimacquisition" });
161
my $letters = GetLetters({ module => "claimacquisition" });
166
162
167
$template->param(ERROR_LOOP => \@errors) if (@errors);
163
$template->param(ERROR_LOOP => \@errors) if (@errors);
168
$template->param(
164
$template->param(
169
    lateorders => $lateorders,
165
    lateorders => \@lateorders,
166
    booksellers => $booksellers,
167
    bookseller_filter => ( $booksellerid ? $booksellers->find($booksellerid) : undef),
170
	delay => $delay,
168
	delay => $delay,
171
    letters => $letters,
169
    letters => $letters,
172
    estimateddeliverydatefrom => $estimateddeliverydatefrom,
170
    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 211-224 Link Here
211
        <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
211
        <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
212
    </li>
212
    </li>
213
213
214
	<li><label for="booksellerid">Vendor:</label>
214
    <li><label for="booksellerid">Vendor:</label>
215
		<select id="booksellerid" size="1" tabindex="" name="booksellerid">
215
        <select id="booksellerid" tabindex="" name="booksellerid">
216
            <option value=""></option>
216
            <option value=""></option>
217
			[% FOREACH SUPPLIER_LOO IN SUPPLIER_LOOP %]
217
            [% FOREACH bookseller IN booksellers %]
218
                [% IF ( SUPPLIER_LOO.selected ) %]<option value="[% SUPPLIER_LOO.id | html %]" selected="selected">[% SUPPLIER_LOO.name | html %]</option>
218
                [% IF bookseller.id == bookseller_filter.id %]
219
                [% ELSE %]<option value="[% SUPPLIER_LOO.id | html %]">[% SUPPLIER_LOO.name | html %]</option>[% END %]
219
                    <option value="[% bookseller.id | html %]" selected="selected">[% bookseller.name | html %]</option>
220
        	[% END %]
220
                [% ELSE %]
221
		</select>
221
                    <option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option>
222
                [% END %]
223
            [% END %]
224
        </select>
222
</ol>
225
</ol>
223
    <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
226
    <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
224
</fieldset>
227
</fieldset>
225
- 

Return to bug 25266