From: G. Richardson Date: Sun, 29 Nov 2015 21:46:41 +0000 (+0100) Subject: Projektzwang bei Verkaufsaufträgen - auch Kunden verlinken X-Git-Tag: release-3.4.1~570 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=32b9234509522f36795001a5298c19e3315cd2a5;p=kivitendo-erp.git Projektzwang bei Verkaufsaufträgen - auch Kunden verlinken --- diff --git a/SL/OE.pm b/SL/OE.pm index 5b7c16dba..16ce8c164 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -537,9 +537,13 @@ sub save { # force new project, if not set yet if ($::instance_conf->get_order_always_project && !$form->{"globalproject_id"} && ($form->{type} eq 'sales_order')) { + require SL::DB::Customer; + my $customer = SL::DB::Manager::Customer->find_by( id => $form->{customer_id} ); + die "Can't find customer" unless $customer; my $new_project = SL::DB::Project->new( projectnumber => $form->{ordnumber}, - description => $form->{customer}, + description => $customer->name, + customer_id => $customer->id, active => 1, project_type_id => $::instance_conf->get_project_type_id, project_status_id => $::instance_conf->get_project_status_id,