1 package SL::Controller::OrderItem;
5 use parent qw(SL::Controller::Base);
10 use SL::Controller::Helper::GetModels;
11 use SL::Controller::Helper::ParseFilter;
12 use SL::Locale::String qw(t8);
14 __PACKAGE__->run_before('check_auth');
16 use Rose::Object::MakeMethods::Generic (
17 'scalar' => [ qw(orderitems) ],
18 'scalar --get_set_init' => [ qw(model) ],
22 partnumber => t8('Part Number'),
23 ordnumber => t8('Order'),
24 customer => t8('Customer'),
25 transdate => t8('Date'),
30 my ($self, %params) = @_;
32 my $title = t8("Sold order items");
34 $::request->layout->use_javascript('client_js.js');
36 # The actual loading of orderitems happens in action_order_item_list_dynamic_table
37 # which is processed inside this template and automatically called upon
38 # loading. This causes all filtered orderitems to be displayed,
39 # there is no paginate mechanism or export
40 $self->render('order_items_search/order_items', { layout => 1, process => 1 },
46 sub action_order_item_list_dynamic_table {
49 $self->orderitems( $self->model->get );
52 $self->add_linked_delivery_order_items;
54 $self->render('order_items_search/_order_item_list', { layout => 0 , process => 1 });
57 sub add_linked_delivery_order_items {
62 foreach my $orderitem ( @{ $self->orderitems } ) {
63 my $dois = $orderitem->linked_delivery_order_items;
64 $orderitem->{deliveryorders} = join('<br>', map { $_->displayable_delivery_order_info($qty_round) } @{$dois});
71 SL::Controller::Helper::GetModels->new(
74 query => [ SL::DB::Manager::Order->type_filter('sales_order') ],
82 with_objects => [ 'order', 'order.customer', 'part' ],
87 $::auth->assert('sales_order_edit');
98 SL::Controller::OrderItem - Controller for OrderItems
102 Controller for quickly finding orderitems in sales orders. For example the
103 customer phones you, saying he would like to order another one of the green
104 thingies he ordered 2 years ago. You have no idea what he is referring to, but
105 you can quickly filter by customer (a customerpicker) and e.g. part description
106 or partnumber or order date, successively narrowing down the search. The
107 resulting list is updated dynamically after keypresses.
111 Certain fields can be preset by passing them as get parameters in the URL, so
112 you could create links to this report:
114 controller.pl?action=OrderItem/search&ordnumber=24
115 controller.pl?action=OrderItem/search&customer_id=3455
117 =head1 TODO AND CAVEATS
121 =item * amount of results is limited