From 19e4022642c1fd958850244ec4896f964519e563 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Tue, 24 Nov 2015 08:29:36 +0100 Subject: [PATCH] =?utf8?q?Kosmetik=20f=C3=BCr=20Feature=20Projektpflicht?= =?utf8?q?=20bei=20Verkaufsauftr=C3=A4gen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/ClientConfig.pm | 4 ++-- SL/OE.pm | 12 ++++++------ sql/Pg-upgrade2/project_defaults.sql | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/SL/Controller/ClientConfig.pm b/SL/Controller/ClientConfig.pm index 521242da5..2346f15da 100644 --- a/SL/Controller/ClientConfig.pm +++ b/SL/Controller/ClientConfig.pm @@ -144,11 +144,11 @@ sub init_defaults { SL::DB::Default->get sub init_all_warehouses { SL::DB::Manager::Warehouse->get_all_sorted } sub init_all_languages { SL::DB::Manager::Language->get_all_sorted } sub init_all_currencies { SL::DB::Manager::Currency->get_all_sorted } -sub init_all_project_types { SL::DB::Manager::ProjectType->get_all_sorted } -sub init_all_project_statuses { SL::DB::Manager::ProjectStatus->get_all_sorted } sub init_all_weightunits { my $unit = SL::DB::Manager::Unit->find_by(name => 'kg'); $unit ? $unit->convertible_units : [] } sub init_all_templates { +{ SL::Template->available_templates } } sub init_h_unit_name { first { SL::DB::Manager::Unit->find_by(name => $_) } qw(Std h Stunde) }; +sub init_all_project_types { SL::DB::Manager::ProjectType->get_all_sorted } +sub init_all_project_statuses { SL::DB::Manager::ProjectStatus->get_all_sorted } sub init_posting_options { [ { title => t8("never"), value => 0 }, diff --git a/SL/OE.pm b/SL/OE.pm index ceca51a4f..5b7c16dba 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -535,14 +535,14 @@ sub save { $pricegroup_id *= 1; $pricegroup_id = undef if !$pricegroup_id; - if ( $::instance_conf->get_order_always_project && !$form->{"globalproject_id"} && ( $form->{type} eq 'sales_order' ) ) { + # force new project, if not set yet + if ($::instance_conf->get_order_always_project && !$form->{"globalproject_id"} && ($form->{type} eq 'sales_order')) { my $new_project = SL::DB::Project->new( - projectnumber => $form->{ordnumber}, - description => $form->{customer}, - active => 1, - project_type_id => $::instance_conf->get_project_type_id, + projectnumber => $form->{ordnumber}, + description => $form->{customer}, + active => 1, + project_type_id => $::instance_conf->get_project_type_id, project_status_id => $::instance_conf->get_project_status_id, - # id => $form->{globalproject_id} ); $new_project->save; $form->{"globalproject_id"} = $new_project->id; diff --git a/sql/Pg-upgrade2/project_defaults.sql b/sql/Pg-upgrade2/project_defaults.sql index 1d65dc73c..f03ca9311 100644 --- a/sql/Pg-upgrade2/project_defaults.sql +++ b/sql/Pg-upgrade2/project_defaults.sql @@ -1,6 +1,6 @@ --- @tag: add_project_defaults +-- @tag: add_project_defaults -- @description: Standardprojekttyp und Standardprojectstatus --- @depends: release_3_2_0 +-- @depends: release_3_3_0 ALTER TABLE defaults ADD COLUMN order_always_project boolean DEFAULT false; ALTER TABLE defaults ADD COLUMN project_status_id integer; ALTER TABLE defaults ADD COLUMN project_type_id integer; -- 2.20.1