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;
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;
}
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,