Lines 55-64
use CGI qw ( -utf8 );
Link Here
|
55 |
use C4::Auth; # get_template_and_user |
55 |
use C4::Auth; # get_template_and_user |
56 |
use C4::Output; |
56 |
use C4::Output; |
57 |
use C4::Acquisition; |
57 |
use C4::Acquisition; |
58 |
use C4::Dates; |
|
|
59 |
use C4::Debug; |
58 |
use C4::Debug; |
60 |
use C4::Branch; |
59 |
use C4::Branch; |
61 |
use C4::Koha; |
60 |
use C4::Koha; |
|
|
61 |
use Koha::DateUtils; |
62 |
|
62 |
|
63 |
my $input = new CGI; |
63 |
my $input = new CGI; |
64 |
my $title = $input->param( 'title'); |
64 |
my $title = $input->param( 'title'); |
Lines 70-87
my $basket = $input->param( 'basket' );
Link Here
|
70 |
my $basketgroupname = $input->param('basketgroupname'); |
70 |
my $basketgroupname = $input->param('basketgroupname'); |
71 |
my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' ); |
71 |
my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' ); |
72 |
my $do_search = $input->param('do_search') || 0; |
72 |
my $do_search = $input->param('do_search') || 0; |
73 |
my $from_placed_on = C4::Dates->new($input->param('from')); |
|
|
74 |
my $to_placed_on = C4::Dates->new($input->param('to')); |
75 |
my $budget = $input->param( 'budget' ); |
73 |
my $budget = $input->param( 'budget' ); |
76 |
my $orderstatus = $input->param( 'orderstatus' ); |
74 |
my $orderstatus = $input->param( 'orderstatus' ); |
77 |
my $ordernumber = $input->param( 'ordernumber' ); |
75 |
my $ordernumber = $input->param( 'ordernumber' ); |
78 |
my $search_children_too = $input->param( 'search_children_too' ); |
76 |
my $search_children_too = $input->param( 'search_children_too' ); |
79 |
my @created_by = $input->param('created_by'); |
77 |
my @created_by = $input->param('created_by'); |
80 |
|
78 |
|
81 |
if ( not $input->param('from') ) { |
79 |
my $from_placed_on = eval { dt_from_string( $input->param('from') ) } || dt_from_string; |
82 |
# FIXME Dirty but we can't sent a Date::Calc to C4::Dates ? |
80 |
my $to_placed_on = eval { dt_from_string( $input->param('to') ) } || dt_from_string; |
83 |
# We would use a function like Add_Delta_YM(-1, 0, 0); |
81 |
unless ( $input->param('from') ) { |
84 |
$$from_placed_on{dmy_arrayref}[5] -= 1; |
82 |
# Fill the form with year-1 |
|
|
83 |
$from_placed_on->subtract( years => 1 ); |
85 |
} |
84 |
} |
86 |
|
85 |
|
87 |
my $dbh = C4::Context->dbh; |
86 |
my $dbh = C4::Context->dbh; |
Lines 96-109
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
96 |
} |
95 |
} |
97 |
); |
96 |
); |
98 |
|
97 |
|
99 |
my ( $from_iso, $to_iso, $d ); |
|
|
100 |
if ( $d = $input->param('from') ) { |
101 |
$from_iso = C4::Dates->new($d)->output('iso'); |
102 |
} |
103 |
if ( $d = $input->param('iso') ) { |
104 |
$to_iso = C4::Dates->new($d)->output('iso'); |
105 |
} |
106 |
|
107 |
my $order_loop; |
98 |
my $order_loop; |
108 |
# If we're supplied any value then we do a search. Otherwise we don't. |
99 |
# If we're supplied any value then we do a search. Otherwise we don't. |
109 |
if ($do_search) { |
100 |
if ($do_search) { |
Lines 113-120
if ($do_search) {
Link Here
|
113 |
isbn => $isbn, |
104 |
isbn => $isbn, |
114 |
ean => $ean, |
105 |
ean => $ean, |
115 |
name => $name, |
106 |
name => $name, |
116 |
from_placed_on => $from_iso, |
107 |
from_placed_on => output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } ), |
117 |
to_placed_on => $to_iso, |
108 |
to_placed_on => output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } ), |
118 |
basket => $basket, |
109 |
basket => $basket, |
119 |
booksellerinvoicenumber => $booksellerinvoicenumber, |
110 |
booksellerinvoicenumber => $booksellerinvoicenumber, |
120 |
basketgroupname => $basketgroupname, |
111 |
basketgroupname => $basketgroupname, |
Lines 126-134
if ($do_search) {
Link Here
|
126 |
); |
117 |
); |
127 |
} |
118 |
} |
128 |
|
119 |
|
129 |
my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef; |
|
|
130 |
my $to_date = $to_placed_on ? $to_placed_on->output('syspref') : undef; |
131 |
|
132 |
my $budgetperiods = C4::Budgets::GetBudgetPeriods; |
120 |
my $budgetperiods = C4::Budgets::GetBudgetPeriods; |
133 |
my $bp_loop = $budgetperiods; |
121 |
my $bp_loop = $budgetperiods; |
134 |
for my $bp ( @{$budgetperiods} ) { |
122 |
for my $bp ( @{$budgetperiods} ) { |
Lines 152-159
$template->param(
Link Here
|
152 |
basketgroupname => $basketgroupname, |
140 |
basketgroupname => $basketgroupname, |
153 |
ordernumber => $ordernumber, |
141 |
ordernumber => $ordernumber, |
154 |
search_children_too => $search_children_too, |
142 |
search_children_too => $search_children_too, |
155 |
from_placed_on => $from_date, |
143 |
from_placed_on => $from_placed_on, |
156 |
to_placed_on => $to_date, |
144 |
to_placed_on => $to_placed_on, |
157 |
orderstatus => $orderstatus, |
145 |
orderstatus => $orderstatus, |
158 |
budget_id => $budget, |
146 |
budget_id => $budget, |
159 |
bp_loop => $bp_loop, |
147 |
bp_loop => $bp_loop, |