-my $from_placed_on = $input->param('from');
-$from_placed_on = C4::Dates->new($from_placed_on) if $from_placed_on;
-my $to_placed_on = $input->param('to');
-$to_placed_on = C4::Dates->new($to_placed_on) if $to_placed_on;
+my $do_search = $input->param('do_search') || 0;
+my $budget = $input->param( 'budget' );
+my $orderstatus = $input->param( 'orderstatus' );
+my $ordernumber = $input->param( 'ordernumber' );
+my $search_children_too = $input->param( 'search_children_too' );
+my @created_by = $input->multi_param('created_by');
+
+my $from_placed_on = eval { dt_from_string( scalar $input->param('from') ) } || dt_from_string;
+my $to_placed_on = eval { dt_from_string( scalar $input->param('to') ) } || dt_from_string;
+unless ( $input->param('from') ) {
+ # Fill the form with year-1
+ $from_placed_on->subtract( years => 1 );
+}