From 2bc58307ac661b7235b32160ad7eb74cb8ea8980 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Mon, 30 Jan 2017 13:17:25 +0100 Subject: [PATCH] =?utf8?q?SL::Dev::Record=20-=20params=20immer=20per=20ass?= =?utf8?q?ign=5Fattributes=20=C3=BCbergeben?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Ansonsten wurden bei leerem Hash die vorherigen Werte überschrieben. --- SL/Dev/Record.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SL/Dev/Record.pm b/SL/Dev/Record.pm index dde842e36..a26f332b3 100644 --- a/SL/Dev/Record.pm +++ b/SL/Dev/Record.pm @@ -44,8 +44,8 @@ sub create_sales_invoice { payment_id => $params{payment_id} // undef, gldate => DateTime->today_local->to_kivitendo, invoiceitems => $invoiceitems, - %params, ); + $invoice->assign_attributes(%params) if %params; $invoice->post; return $invoice; @@ -73,8 +73,8 @@ sub create_sales_delivery_order { salesman_id => $params{employee_id} // SL::DB::Manager::Employee->current->id, transdate => $params{transdate} // DateTime->today_local->to_kivitendo, orderitems => $orderitems, - %params ); + $delivery_order->assign_attributes(%params) if %params; $delivery_order->save; return $delivery_order; } @@ -100,8 +100,8 @@ sub create_sales_order { # salesman_id => delete $params{employee_id} // SL::DB::Manager::Employee->current->id, transdate => delete $params{transdate} // DateTime->today_local->to_kivitendo, orderitems => $orderitems, - %params ); + $order->assign_attributes(%params) if %params; if ( $save ) { $order->calculate_prices_and_taxes; @@ -130,8 +130,8 @@ sub create_purchase_order { transdate => delete $params{transdate} // DateTime->today_local->to_kivitendo, 'closed' => undef, orderitems => $orderitems, - %params ); + $order->assign_attributes(%params) if %params; if ( $save ) { $order->calculate_prices_and_taxes; # not tested for purchase orders @@ -192,8 +192,8 @@ sub _create_item { description => $part->description, unit => $part->unit, qty => $params{qty} || 5, - %params, ); + $item->assign_attributes(%params) if %params; return $item; } @@ -220,8 +220,8 @@ sub create_project { valid => 1, project_status_id => SL::DB::Manager::ProjectStatus->find_by(name => "running")->id, project_type_id => SL::DB::Manager::ProjectType->find_by(description => "Standard")->id, - %params, )->save; + $project->assign_attributes(%params) if %params; return $project; } -- 2.20.1