use Rose::Object::MakeMethods::Generic
(
scalar => [ qw(item_ids_to_delete is_custom_shipto_to_delete) ],
- 'scalar --get_set_init' => [ qw(order valid_types type cv p all_price_factors search_cvpartnumber show_update_button part_picker_classification_ids) ],
+ '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) ],
);
my ($self) = @_;
$self->order->transdate(DateTime->now_local());
- $self->set_reqdate_by_type;
+ $self->type_data->set_reqdate_by_type;
$self->pre_render();
my ($self) = @_;
if (none { $::form->{type} eq $_ } @{$self->valid_types}) {
- die "Not a valid type for order";
+ die "Not a valid type for delivery order";
}
$self->type($::form->{type});
sub init_part_picker_classification_ids {
my ($self) = @_;
- return [ map { $_->id } @{ SL::DB::Manager::PartClassification->get_all(where => $self->type_date->part_classification_query) } ];
+ return [ map { $_->id } @{ SL::DB::Manager::PartClassification->get_all(where => $self->type_data->part_classification_query) } ];
}
sub check_auth {
# order here solves this problem.
my $order;
$order = SL::DB::DeliveryOrder->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
- $order ||= SL::DB::DeliveryOrder->new(orderitems => [],
- quotation => $self->type_data->is_quotation,
- currency_id => $::instance_conf->get_currency_id(),);
+ $order ||= SL::DB::DeliveryOrder->new(orderitems => [], currency_id => $::instance_conf->get_currency_id(),);
my $cv_id_method = $self->cv . '_id';
if (!$::form->{id} && $::form->{$cv_id_method}) {
$item->active_discount_source($price_source->discount_from_source($item->active_discount_source));
}
- if ($self->order->number && $::instance_conf->get_webdav) {
+ if ($self->order->${\ $self->type_data->nr_key } && $::instance_conf->get_webdav) {
my $webdav = SL::Webdav->new(
type => $self->type,
number => $self->order->number,
use SL::Locale::String qw(t8);
use constant {
- SALES_ORDER_TYPE => 'sales_order',
- PURCHASE_ORDER_TYPE => 'purchase_order',
- SALES_QUOTATION_TYPE => 'sales_quotation',
- REQUEST_QUOTATION_TYPE => 'request_quotation'
+ SALES_ORDER_TYPE => 'sales_order',
+ PURCHASE_ORDER_TYPE => 'purchase_order',
+ SALES_QUOTATION_TYPE => 'sales_quotation',
+ REQUEST_QUOTATION_TYPE => 'request_quotation',
+ PURCHASE_DELIVERY_ORDER_TYPE => 'purchase_delivery_order',
+ SALES_DELIVERY_ORDER_TYPE => 'sales_delivery_order',
};
our @EXPORT_OK = qw(SALES_ORDER_TYPE PURCHASE_ORDER_TYPE SALES_QUOTATION_TYPE REQUEST_QUOTATION_TYPE);
part_classification_query => [ "used_for_purchase" => 1 ],
right => "request_quotation_edit",
},
+ SALES_DELIVERY_ORDER_TYPE() => {
+ text => {
+ delete => t8('Delivery Order has been deleted'),
+ saved => t8('Delivery Order has been saved'),
+ add => t8("Add Sales Delivery Order"),
+ edit => t8("Edit Sales Delivery Order"),
+ },
+ show_menu => {
+ save_and_quotation => 0,
+ save_and_rfq => 0,
+ save_and_sales_order => 0,
+ save_and_purchase_order => 0,
+ save_and_delivery_order => 0,
+ save_and_ap_transaction => 0,
+ delete => sub { $::instance_conf->get_sales_delivery_order_show_delete },
+ },
+ properties => {
+ customervendor => "customer",
+ nr_key => "donumber",
+ },
+ part_classification_query => [ "used_for_sale" => 1 ],
+ right => "sales_delivery_order_edit",
+ },
+ PURCHASE_DELIVERY_ORDER_TYPE() => {
+ text => {
+ delete => t8('Delivery Order has been deleted'),
+ saved => t8('Delivery Order has been saved'),
+ add => t8("Add Purchase Delivery Order"),
+ edit => t8("Edit Purchase Delivery Order"),
+ },
+ show_menu => {
+ save_and_quotation => 0,
+ save_and_rfq => 0,
+ save_and_sales_order => 0,
+ save_and_purchase_order => 0,
+ save_and_delivery_order => 0,
+ save_and_ap_transaction => 0,
+ delete => sub { $::instance_conf->get_sales_delivery_order_show_delete },
+ },
+ properties => {
+ customervendor => "vendor",
+ nr_key => "donumber",
+ },
+ part_classification_query => [ "used_for_purchase" => 1 ],
+ right => "purchase_delivery_order_edit",
+ },
+
);
sub new {
PURCHASE_ORDER_TYPE,
SALES_QUOTATION_TYPE,
REQUEST_QUOTATION_TYPE,
+ SALES_DELIVERY_ORDER_TYPE,
+ PURCHASE_DELIVERY_ORDER_TYPE,
];
}
$_[0]->c->type;
}
-sub get {
+sub _get {
my ($self, $key) = @_;
my $ret = $type_data{$self->type}->{$key} // die "unknown property '$key'";
}
sub access {
- $type_data{right};
+ _get($_[0], "right");
}
sub is_quotation {
'Delivery Order Number' => 'Lieferscheinnummer',
'Delivery Order created' => 'Lieferschein erstellt',
'Delivery Order deleted!' => 'Lieferschein gelöscht!',
+ 'Delivery Order has been deleted' => 'Lieferschein wurde gelöscht',
+ 'Delivery Order has been saved' => 'Lieferschein wurde gespeichert',
'Delivery Order(s) for full qty created' => 'Lieferschein(e) mit kompletter Menge erstellt',
'Delivery Orders' => 'Lieferscheine',
'Delivery Plan' => 'Lieferplan',
'Part Notes' => 'Bemerkungen',
'Part Number' => 'Artikelnummer',
'Part Number missing!' => 'Artikelnummer fehlt!',
- 'Part Test' => '',
+ 'Part Test' => 'Artikel-Test',
'Part Type' => 'Artikel-Typ',
'Part Unit' => 'Einheit',
'Part classifications' => 'Artikel-Klassifizierungen',