X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/bfd5682ab8cad5878260ec2cafcd630dd3c05eff..f217d072d76183bc07723dcc29503b732bd2022d:/SL/Controller/RequirementSpecOrder.pm diff --git a/SL/Controller/RequirementSpecOrder.pm b/SL/Controller/RequirementSpecOrder.pm index 398c86a47..60f9b43eb 100644 --- a/SL/Controller/RequirementSpecOrder.pm +++ b/SL/Controller/RequirementSpecOrder.pm @@ -10,6 +10,7 @@ use List::Util qw(first); use SL::DB::Customer; use SL::DB::Order; +use SL::DB::Order::TypeData qw(:types); use SL::DB::Part; use SL::DB::RequirementSpec; use SL::DB::RequirementSpecOrder; @@ -93,7 +94,7 @@ sub action_update { my $order = $self->rs_order->order; my $sections = $self->requirement_spec->sections_sorted; - if (!$::auth->assert($order->quotation ? 'sales_quotation_edit' : 'sales_order_edit', 1)) { + if (!$::auth->assert($order->type_data->rights('edit'), 1)) { return $self->js->flash('error', t8("You do not have the permissions to access this function."))->render; } @@ -368,11 +369,12 @@ sub create_order { my $reqdate = !$::form->{quotation} ? undef : $customer->payment_id ? $customer->payment->calc_date : DateTime->today_local->next_workday(extra_days => $::instance_conf->get_reqdate_interval)->to_kivitendo; + my $record_type = $::form->{quotation} ? SALES_QUOTATION_TYPE() : SALES_ORDER_TYPE(); my $order = SL::DB::Order->new( + record_type => $record_type, globalproject_id => $self->requirement_spec->project_id, transdate => DateTime->today_local, reqdate => $reqdate, - quotation => !!$::form->{quotation}, orderitems => [ @orderitems, @add_items ], customer_id => $customer->id, taxincluded => $customer->taxincluded,