Revision 0c227fb2
Von Moritz Bunkus vor mehr als 5 Jahren hinzugefügt
SL/Controller/TopQuickSearch.pm | ||
---|---|---|
21 | 21 |
'SL::Controller::TopQuickSearch::Contact', |
22 | 22 |
'SL::Controller::TopQuickSearch::SalesQuotation', |
23 | 23 |
'SL::Controller::TopQuickSearch::SalesOrder', |
24 |
'SL::Controller::TopQuickSearch::SalesDeliveryOrder', |
|
24 | 25 |
'SL::Controller::TopQuickSearch::RequestForQuotation', |
25 | 26 |
'SL::Controller::TopQuickSearch::PurchaseOrder', |
27 |
'SL::Controller::TopQuickSearch::PurchaseDeliveryOrder', |
|
26 | 28 |
'SL::Controller::TopQuickSearch::GLTransaction', |
27 | 29 |
'SL::Controller::TopQuickSearch::Customer', |
28 | 30 |
'SL::Controller::TopQuickSearch::Vendor', |
SL/Controller/TopQuickSearch/DeliveryOrder.pm | ||
---|---|---|
1 |
package SL::Controller::TopQuickSearch::DeliveryOrder; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use parent qw(Rose::Object); |
|
5 |
|
|
6 |
use SL::Locale::String qw(t8); |
|
7 |
use SL::DB::DeliveryOrder; |
|
8 |
use SL::Controller::Helper::GetModels; |
|
9 |
use SL::Controller::Base; |
|
10 |
|
|
11 |
use Rose::Object::MakeMethods::Generic ( |
|
12 |
'scalar --get_set_init' => [ qw(models) ], |
|
13 |
); |
|
14 |
|
|
15 |
# nope. this is only for subclassing |
|
16 |
sub auth { 'NOT ALLOWED' } |
|
17 |
|
|
18 |
sub name { die 'must be overwritten' } |
|
19 |
|
|
20 |
sub description_config { die 'must be overwritten' } |
|
21 |
|
|
22 |
sub description_field { die 'must be overwritten' } |
|
23 |
|
|
24 |
sub type { die 'must be overwritten' } |
|
25 |
|
|
26 |
sub cv { die 'must be overwritten' } |
|
27 |
|
|
28 |
sub query_autocomplete { |
|
29 |
my ($self) = @_; |
|
30 |
|
|
31 |
my $objects = $self->models->get; |
|
32 |
|
|
33 |
[ |
|
34 |
map { |
|
35 |
value => $_->digest, |
|
36 |
label => $_->digest, |
|
37 |
id => $_->id, |
|
38 |
}, @$objects |
|
39 |
]; |
|
40 |
} |
|
41 |
|
|
42 |
sub select_autocomplete { |
|
43 |
$_[0]->redirect_to_object($::form->{id}); |
|
44 |
} |
|
45 |
|
|
46 |
sub do_search { |
|
47 |
my ($self) = @_; |
|
48 |
|
|
49 |
my $objects = $self->models->get; |
|
50 |
|
|
51 |
return !@$objects ? () |
|
52 |
: @$objects == 1 ? $self->redirect_to_object($objects->[0]->id) |
|
53 |
: $self->redirect_to_search($::form->{term}); |
|
54 |
} |
|
55 |
|
|
56 |
sub redirect_to_search { |
|
57 |
SL::Controller::Base->new->url_for( |
|
58 |
controller => 'do.pl', |
|
59 |
action => 'orders', |
|
60 |
type => $_[0]->type, |
|
61 |
vc => $_[0]->vc, |
|
62 |
all => $_[1], |
|
63 |
open => 1, |
|
64 |
closed => 1, |
|
65 |
delivered => 1, |
|
66 |
notdelivered => 1, |
|
67 |
sortdir => 0, |
|
68 |
(map {; "l_$_" => 'Y' } qw(donumber transdate cusordnumber reqdate name employee transaction_description)), |
|
69 |
); |
|
70 |
} |
|
71 |
|
|
72 |
sub redirect_to_object { |
|
73 |
SL::Controller::Base->new->url_for( |
|
74 |
controller => 'do.pl', |
|
75 |
action => 'edit', |
|
76 |
type => $_[0]->type, |
|
77 |
vc => $_[0]->vc, |
|
78 |
id => $_[1], |
|
79 |
); |
|
80 |
} |
|
81 |
|
|
82 |
sub init_models { |
|
83 |
my ($self) = @_; |
|
84 |
|
|
85 |
SL::Controller::Helper::GetModels->new( |
|
86 |
controller => $self, |
|
87 |
model => 'DeliveryOrder', |
|
88 |
source => { |
|
89 |
filter => { |
|
90 |
type => $self->type, |
|
91 |
'all:substr:multi::ilike' => $::form->{term}, |
|
92 |
}, |
|
93 |
}, |
|
94 |
sorted => { |
|
95 |
_default => { |
|
96 |
by => 'transdate', |
|
97 |
dir => 0, |
|
98 |
}, |
|
99 |
transdate => t8('Date'), |
|
100 |
}, |
|
101 |
paginated => { |
|
102 |
per_page => 10, |
|
103 |
}, |
|
104 |
with_objects => [ qw(customer vendor orderitems) ] |
|
105 |
) |
|
106 |
} |
|
107 |
|
|
108 |
1; |
SL/Controller/TopQuickSearch/PurchaseDeliveryOrder.pm | ||
---|---|---|
1 |
package SL::Controller::TopQuickSearch::PurchaseDeliveryOrder; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use parent qw(SL::Controller::TopQuickSearch::DeliveryOrder); |
|
5 |
|
|
6 |
use SL::Locale::String qw(t8); |
|
7 |
|
|
8 |
sub auth { 'purchase_delivery_order_edit' } |
|
9 |
|
|
10 |
sub name { 'purchase_delivery_order' } |
|
11 |
|
|
12 |
sub description_config { t8('Purchase Delivery Orders') } |
|
13 |
|
|
14 |
sub description_field { t8('Purchase Delivery Orders') } |
|
15 |
|
|
16 |
sub type { 'purchase_delivery_order' } |
|
17 |
|
|
18 |
sub vc { 'vendor' } |
|
19 |
|
|
20 |
1; |
SL/Controller/TopQuickSearch/SalesDeliveryOrder.pm | ||
---|---|---|
1 |
package SL::Controller::TopQuickSearch::SalesDeliveryOrder; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use parent qw(SL::Controller::TopQuickSearch::DeliveryOrder); |
|
5 |
|
|
6 |
use SL::Locale::String qw(t8); |
|
7 |
|
|
8 |
sub auth { 'sales_delivery_order_edit' } |
|
9 |
|
|
10 |
sub name { 'sales_delivery_order' } |
|
11 |
|
|
12 |
sub description_config { t8('Sales Delivery Orders') } |
|
13 |
|
|
14 |
sub description_field { t8('Sales Delivery Orders') } |
|
15 |
|
|
16 |
sub type { 'sales_delivery_order' } |
|
17 |
|
|
18 |
sub vc { 'customer' } |
|
19 |
|
|
20 |
1; |
SL/DB/DeliveryOrder.pm | ||
---|---|---|
210 | 210 |
return $invoice; |
211 | 211 |
} |
212 | 212 |
|
213 |
sub digest { |
|
214 |
my ($self) = @_; |
|
215 |
|
|
216 |
sprintf "%s %s (%s)", |
|
217 |
$self->donumber, |
|
218 |
$self->customervendor->name, |
|
219 |
$self->date->to_kivitendo; |
|
220 |
} |
|
221 |
|
|
213 | 222 |
1; |
214 | 223 |
__END__ |
215 | 224 |
|
SL/DB/Manager/DeliveryOrder.pm | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use SL::DB::Helper::Paginated; |
8 | 8 |
use SL::DB::Helper::Sorted; |
9 |
use SL::DB::Helper::Filtered; |
|
9 | 10 |
|
10 | 11 |
sub object_class { 'SL::DB::DeliveryOrder' } |
11 | 12 |
|
12 | 13 |
__PACKAGE__->make_manager_methods; |
13 | 14 |
|
15 |
__PACKAGE__->add_filter_specs( |
|
16 |
type => sub { |
|
17 |
my ($key, $value, $prefix) = @_; |
|
18 |
return __PACKAGE__->type_filter($value, $prefix); |
|
19 |
}, |
|
20 |
all => sub { |
|
21 |
my ($key, $value, $prefix) = @_; |
|
22 |
return or => [ map { $prefix . $_ => $value } qw(donumber customer.name vendor.name transaction_description orderitems.serialnumber) ] |
|
23 |
} |
|
24 |
); |
|
25 |
|
|
14 | 26 |
sub type_filter { |
15 | 27 |
my $class = shift; |
16 | 28 |
my $type = lc(shift || ''); |
SL/DO.pm | ||
---|---|---|
36 | 36 |
|
37 | 37 |
use Carp; |
38 | 38 |
use List::Util qw(max); |
39 |
use Text::ParseWords; |
|
39 | 40 |
use YAML; |
40 | 41 |
|
41 | 42 |
use SL::AM; |
... | ... | |
211 | 212 |
push @values, like($form->{parts_description}); |
212 | 213 |
} |
213 | 214 |
|
215 |
if ($form->{all}) { |
|
216 |
my @tokens = parse_line('\s+', 0, $form->{all}); |
|
217 |
# ordnumber quonumber customer.name vendor.name transaction_description |
|
218 |
push @where, <<SQL for @tokens; |
|
219 |
( (dord.donumber ILIKE ?) |
|
220 |
OR (ct.name ILIKE ?) |
|
221 |
OR (dord.transaction_description ILIKE ?)) |
|
222 |
SQL |
|
223 |
push @values, (like($_))x3 for @tokens; |
|
224 |
} |
|
225 |
|
|
214 | 226 |
if (@where) { |
215 | 227 |
$query .= " WHERE " . join(" AND ", map { "($_)" } @where); |
216 | 228 |
} |
bin/mozilla/do.pl | ||
---|---|---|
706 | 706 |
push @hidden_variables, $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered donumber ordnumber serialnumber cusordnumber |
707 | 707 |
transaction_description transdatefrom transdateto reqdatefrom reqdateto |
708 | 708 |
type vc employee_id salesman_id project_id parts_partnumber parts_description |
709 |
insertdatefrom insertdateto business_id); |
|
709 |
insertdatefrom insertdateto business_id all);
|
|
710 | 710 |
|
711 | 711 |
my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables); |
712 | 712 |
|
... | ... | |
808 | 808 |
if ($form->{notdelivered}) { |
809 | 809 |
push @options, $locale->text('Not delivered'); |
810 | 810 |
} |
811 |
push @options, $locale->text('Quick Search') . " : $form->{all}" if $form->{all}; |
|
811 | 812 |
|
812 | 813 |
my $pr = SL::DB::Manager::Printer->find_by( |
813 | 814 |
printer_description => $::locale->text("sales_delivery_order_printer")); |
Auch abrufbar als: Unified diff
Schnellsuche für Verkaufs- & Einkaufslieferscheine