From: G. Richardson Date: Mon, 30 Jan 2017 12:17:25 +0000 (+0100) Subject: SL::Dev::Record - params immer per assign_attributes übergeben X-Git-Tag: release-3.5.4~1613 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2bc58307ac661b7235b32160ad7eb74cb8ea8980;p=kivitendo-erp.git SL::Dev::Record - params immer per assign_attributes übergeben Ansonsten wurden bei leerem Hash die vorherigen Werte überschrieben. --- 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; }