|
Lines 20-25
use Modern::Perl;
Link Here
|
| 20 |
use Mojo::Base 'Mojolicious::Controller'; |
20 |
use Mojo::Base 'Mojolicious::Controller'; |
| 21 |
|
21 |
|
| 22 |
use Koha::Acquisition::Orders; |
22 |
use Koha::Acquisition::Orders; |
|
|
23 |
use Koha::DateUtils qw(dt_from_string); |
| 23 |
|
24 |
|
| 24 |
use Clone qw( clone ); |
25 |
use Clone qw( clone ); |
| 25 |
use JSON; |
26 |
use JSON; |
|
Lines 49-62
sub list {
Link Here
|
| 49 |
my $only_active = $c->param('only_active'); |
50 |
my $only_active = $c->param('only_active'); |
| 50 |
my $order_id = $c->param('order_id'); |
51 |
my $order_id = $c->param('order_id'); |
| 51 |
|
52 |
|
| 52 |
$c->req->params->remove('only_active')->remove('order_id'); |
53 |
# handle late orders |
|
|
54 |
my $only_late = $c->param('only_late'); |
| 55 |
my $late_delay = $c->param('late_delay') // 0; |
| 56 |
my $estimateddeliverydatefrom = $c->param('estimated_deliverydate_from'); |
| 57 |
my $estimateddeliverydateto = $c->param('estimated_deliverydate_to'); |
| 53 |
|
58 |
|
| 54 |
my $orders_rs; |
59 |
$c->req->params->remove('only_active')->remove('order_id')->remove('only_late') |
|
|
60 |
->remove('estimated_deliverydate_from')->remove('estimated_deliverydate_to')->remove('late_delay'); |
| 61 |
|
| 62 |
my $orders_rs = Koha::Acquisition::Orders->new; |
| 55 |
|
63 |
|
| 56 |
if ($only_active) { |
64 |
if ($only_active) { |
| 57 |
$orders_rs = Koha::Acquisition::Orders->filter_by_active; |
65 |
$orders_rs = $orders_rs->filter_by_active; |
| 58 |
} else { |
66 |
} elsif ($only_late) { |
| 59 |
$orders_rs = Koha::Acquisition::Orders->new; |
67 |
$orders_rs = $orders_rs->filter_by_lates( |
|
|
68 |
{ |
| 69 |
delay => $late_delay, |
| 70 |
( |
| 71 |
$estimateddeliverydatefrom |
| 72 |
? ( estimated_from => dt_from_string( $estimateddeliverydatefrom, 'iso' ) ) |
| 73 |
: () |
| 74 |
), |
| 75 |
( |
| 76 |
$estimateddeliverydateto |
| 77 |
? ( estimated_to => dt_from_string( $estimateddeliverydateto, 'iso' ) ) |
| 78 |
: () |
| 79 |
) |
| 80 |
} |
| 81 |
); |
| 60 |
} |
82 |
} |
| 61 |
|
83 |
|
| 62 |
$orders_rs = $orders_rs->filter_by_id_including_transfers( { ordernumber => $order_id } ) |
84 |
$orders_rs = $orders_rs->filter_by_id_including_transfers( { ordernumber => $order_id } ) |