Revision e064ca5b
Von Sven Schöling vor fast 3 Jahren hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
46 | 46 |
use Rose::Object::MakeMethods::Generic |
47 | 47 |
( |
48 | 48 |
scalar => [ qw(item_ids_to_delete is_custom_shipto_to_delete) ], |
49 |
'scalar --get_set_init' => [ qw(order valid_types type cv p all_price_factors search_cvpartnumber show_update_button part_picker_classification_ids) ], |
|
49 |
'scalar --get_set_init' => [ qw(order valid_types type cv p all_price_factors search_cvpartnumber show_update_button part_picker_classification_ids type_data) ],
|
|
50 | 50 |
); |
51 | 51 |
|
52 | 52 |
|
... | ... | |
66 | 66 |
my ($self) = @_; |
67 | 67 |
|
68 | 68 |
$self->order->transdate(DateTime->now_local()); |
69 |
$self->set_reqdate_by_type; |
|
69 |
$self->type_data->set_reqdate_by_type;
|
|
70 | 70 |
|
71 | 71 |
|
72 | 72 |
$self->pre_render(); |
... | ... | |
1025 | 1025 |
my ($self) = @_; |
1026 | 1026 |
|
1027 | 1027 |
if (none { $::form->{type} eq $_ } @{$self->valid_types}) { |
1028 |
die "Not a valid type for order"; |
|
1028 |
die "Not a valid type for delivery order";
|
|
1029 | 1029 |
} |
1030 | 1030 |
|
1031 | 1031 |
$self->type($::form->{type}); |
... | ... | |
1069 | 1069 |
sub init_part_picker_classification_ids { |
1070 | 1070 |
my ($self) = @_; |
1071 | 1071 |
|
1072 |
return [ map { $_->id } @{ SL::DB::Manager::PartClassification->get_all(where => $self->type_date->part_classification_query) } ];
|
|
1072 |
return [ map { $_->id } @{ SL::DB::Manager::PartClassification->get_all(where => $self->type_data->part_classification_query) } ];
|
|
1073 | 1073 |
} |
1074 | 1074 |
|
1075 | 1075 |
sub check_auth { |
... | ... | |
1161 | 1161 |
# order here solves this problem. |
1162 | 1162 |
my $order; |
1163 | 1163 |
$order = SL::DB::DeliveryOrder->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id}; |
1164 |
$order ||= SL::DB::DeliveryOrder->new(orderitems => [], |
|
1165 |
quotation => $self->type_data->is_quotation, |
|
1166 |
currency_id => $::instance_conf->get_currency_id(),); |
|
1164 |
$order ||= SL::DB::DeliveryOrder->new(orderitems => [], currency_id => $::instance_conf->get_currency_id(),); |
|
1167 | 1165 |
|
1168 | 1166 |
my $cv_id_method = $self->cv . '_id'; |
1169 | 1167 |
if (!$::form->{id} && $::form->{$cv_id_method}) { |
... | ... | |
1572 | 1570 |
$item->active_discount_source($price_source->discount_from_source($item->active_discount_source)); |
1573 | 1571 |
} |
1574 | 1572 |
|
1575 |
if ($self->order->number && $::instance_conf->get_webdav) {
|
|
1573 |
if ($self->order->${\ $self->type_data->nr_key } && $::instance_conf->get_webdav) {
|
|
1576 | 1574 |
my $webdav = SL::Webdav->new( |
1577 | 1575 |
type => $self->type, |
1578 | 1576 |
number => $self->order->number, |
SL/Controller/DeliveryOrder/TypeData.pm | ||
---|---|---|
6 | 6 |
use SL::Locale::String qw(t8); |
7 | 7 |
|
8 | 8 |
use constant { |
9 |
SALES_ORDER_TYPE => 'sales_order', |
|
10 |
PURCHASE_ORDER_TYPE => 'purchase_order', |
|
11 |
SALES_QUOTATION_TYPE => 'sales_quotation', |
|
12 |
REQUEST_QUOTATION_TYPE => 'request_quotation' |
|
9 |
SALES_ORDER_TYPE => 'sales_order', |
|
10 |
PURCHASE_ORDER_TYPE => 'purchase_order', |
|
11 |
SALES_QUOTATION_TYPE => 'sales_quotation', |
|
12 |
REQUEST_QUOTATION_TYPE => 'request_quotation', |
|
13 |
PURCHASE_DELIVERY_ORDER_TYPE => 'purchase_delivery_order', |
|
14 |
SALES_DELIVERY_ORDER_TYPE => 'sales_delivery_order', |
|
13 | 15 |
}; |
14 | 16 |
|
15 | 17 |
our @EXPORT_OK = qw(SALES_ORDER_TYPE PURCHASE_ORDER_TYPE SALES_QUOTATION_TYPE REQUEST_QUOTATION_TYPE); |
... | ... | |
133 | 135 |
part_classification_query => [ "used_for_purchase" => 1 ], |
134 | 136 |
right => "request_quotation_edit", |
135 | 137 |
}, |
138 |
SALES_DELIVERY_ORDER_TYPE() => { |
|
139 |
text => { |
|
140 |
delete => t8('Delivery Order has been deleted'), |
|
141 |
saved => t8('Delivery Order has been saved'), |
|
142 |
add => t8("Add Sales Delivery Order"), |
|
143 |
edit => t8("Edit Sales Delivery Order"), |
|
144 |
}, |
|
145 |
show_menu => { |
|
146 |
save_and_quotation => 0, |
|
147 |
save_and_rfq => 0, |
|
148 |
save_and_sales_order => 0, |
|
149 |
save_and_purchase_order => 0, |
|
150 |
save_and_delivery_order => 0, |
|
151 |
save_and_ap_transaction => 0, |
|
152 |
delete => sub { $::instance_conf->get_sales_delivery_order_show_delete }, |
|
153 |
}, |
|
154 |
properties => { |
|
155 |
customervendor => "customer", |
|
156 |
nr_key => "donumber", |
|
157 |
}, |
|
158 |
part_classification_query => [ "used_for_sale" => 1 ], |
|
159 |
right => "sales_delivery_order_edit", |
|
160 |
}, |
|
161 |
PURCHASE_DELIVERY_ORDER_TYPE() => { |
|
162 |
text => { |
|
163 |
delete => t8('Delivery Order has been deleted'), |
|
164 |
saved => t8('Delivery Order has been saved'), |
|
165 |
add => t8("Add Purchase Delivery Order"), |
|
166 |
edit => t8("Edit Purchase Delivery Order"), |
|
167 |
}, |
|
168 |
show_menu => { |
|
169 |
save_and_quotation => 0, |
|
170 |
save_and_rfq => 0, |
|
171 |
save_and_sales_order => 0, |
|
172 |
save_and_purchase_order => 0, |
|
173 |
save_and_delivery_order => 0, |
|
174 |
save_and_ap_transaction => 0, |
|
175 |
delete => sub { $::instance_conf->get_sales_delivery_order_show_delete }, |
|
176 |
}, |
|
177 |
properties => { |
|
178 |
customervendor => "vendor", |
|
179 |
nr_key => "donumber", |
|
180 |
}, |
|
181 |
part_classification_query => [ "used_for_purchase" => 1 ], |
|
182 |
right => "purchase_delivery_order_edit", |
|
183 |
}, |
|
184 |
|
|
136 | 185 |
); |
137 | 186 |
|
138 | 187 |
sub new { |
... | ... | |
150 | 199 |
PURCHASE_ORDER_TYPE, |
151 | 200 |
SALES_QUOTATION_TYPE, |
152 | 201 |
REQUEST_QUOTATION_TYPE, |
202 |
SALES_DELIVERY_ORDER_TYPE, |
|
203 |
PURCHASE_DELIVERY_ORDER_TYPE, |
|
153 | 204 |
]; |
154 | 205 |
} |
155 | 206 |
|
... | ... | |
157 | 208 |
$_[0]->c->type; |
158 | 209 |
} |
159 | 210 |
|
160 |
sub get { |
|
211 |
sub _get {
|
|
161 | 212 |
my ($self, $key) = @_; |
162 | 213 |
|
163 | 214 |
my $ret = $type_data{$self->type}->{$key} // die "unknown property '$key'"; |
... | ... | |
206 | 257 |
} |
207 | 258 |
|
208 | 259 |
sub access { |
209 |
$type_data{right};
|
|
260 |
_get($_[0], "right");
|
|
210 | 261 |
} |
211 | 262 |
|
212 | 263 |
sub is_quotation { |
locale/de/all | ||
---|---|---|
1055 | 1055 |
'Delivery Order Number' => 'Lieferscheinnummer', |
1056 | 1056 |
'Delivery Order created' => 'Lieferschein erstellt', |
1057 | 1057 |
'Delivery Order deleted!' => 'Lieferschein gelöscht!', |
1058 |
'Delivery Order has been deleted' => 'Lieferschein wurde gelöscht', |
|
1059 |
'Delivery Order has been saved' => 'Lieferschein wurde gespeichert', |
|
1058 | 1060 |
'Delivery Order(s) for full qty created' => 'Lieferschein(e) mit kompletter Menge erstellt', |
1059 | 1061 |
'Delivery Orders' => 'Lieferscheine', |
1060 | 1062 |
'Delivery Plan' => 'Lieferplan', |
... | ... | |
2420 | 2422 |
'Part Notes' => 'Bemerkungen', |
2421 | 2423 |
'Part Number' => 'Artikelnummer', |
2422 | 2424 |
'Part Number missing!' => 'Artikelnummer fehlt!', |
2423 |
'Part Test' => '', |
|
2425 |
'Part Test' => 'Artikel-Test',
|
|
2424 | 2426 |
'Part Type' => 'Artikel-Typ', |
2425 | 2427 |
'Part Unit' => 'Einheit', |
2426 | 2428 |
'Part classifications' => 'Artikel-Klassifizierungen', |
Auch abrufbar als: Unified diff
DeliveryOrder: neue typen für Lieferschein