X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=blobdiff_plain;f=SL%2FController%2FDeliveryOrder%2FTypeData.pm;fp=SL%2FController%2FDeliveryOrder%2FTypeData.pm;h=0650e08b355d3bd67464804e3a5fe76fb60e05f7;hp=0000000000000000000000000000000000000000;hb=53593baa211863fbf66540cf1bcc36c8fb37257f;hpb=deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44 diff --git a/SL/Controller/DeliveryOrder/TypeData.pm b/SL/Controller/DeliveryOrder/TypeData.pm new file mode 100644 index 000000000..0650e08b3 --- /dev/null +++ b/SL/Controller/DeliveryOrder/TypeData.pm @@ -0,0 +1,101 @@ +package SL::Controller::DeliveryOrder::TypeData; + +use strict; +use Exporter qw(import); +use Scalar::Util qw(weaken); +use SL::Locale::String qw(t8); +use SL::DB::DeliveryOrder::TypeData qw(:types :subs); + +my @export_types = qw(SALES_DELIVERY_ORDER_TYPE PURCHASE_DELIVERY_ORDER_TYPE SUPPLIER_DELIVERY_ORDER_TYPE RMA_DELIVERY_ORDER_TYPE); + +our @EXPORT_OK = (@export_types); +our %EXPORT_TAGS = (types => \@export_types); + +use Rose::Object::MakeMethods::Generic scalar => [ qw(c) ]; + +sub new { + my ($class, $controller) = @_; + my $o = bless {}, $class; + + if ($controller) { + $o->c($controller); + weaken($o->{c}); + } + + return $o; +} + +sub validate { + my ($self, $string) = @_; + validate_type($string); +} + +sub text { + my ($self, $string) = @_; + get3($self->c->type, "text", $string); +} + +sub show_menu { + my ($self, $string) = @_; + get3($self->c->type, "show_menu", $string); +} + +sub workflow { + my ($self, $string) = @_; + get3($self->c->type, "workflow", $string); +} + +sub properties { + my ($self, $string) = @_; + get3($self->c->type, "properties", $string); +} + +sub access { + my ($self, $string) = @_; + get3($_[0]->c->type, "rights", $string); +} + +sub is_quotation { + get3($_[0]->c->type, "properties", "is_quotation"); +} + +sub customervendor { + get3($_[0]->c->type, "properties", "customervendor"); +} + +sub is_customer { + get3($_[0]->c->type, "properties", "is_customer"); +} + +sub nr_key { + get3($_[0]->c->type, "properties", "nr_key"); +} + +sub transfer { + get3($_[0]->c->type, "properties", "transfer"); +} + +sub part_classification_query { + my ($self, $string) = @_; + get($self->c->type, "part_classification_query"); +} + +sub set_reqdate_by_type { + my ($self) = @_; + + if (!$self->c->order->reqdate) { + $self->c->order->reqdate(DateTime->today_local->next_workday(extra_days => 1)); + } +} + +sub get_reqdate_by_type { + my ($self, $reqdate, $saved_reqdate) = @_; + + if ($reqdate == $saved_reqdate) { + return DateTime->today_local->next_workday(extra_days => 1); + } else { + return $reqdate; + } +} + +1;