Kosmetik für Feature Projektpflicht bei Verkaufsaufträgen
authorJan Büren <jan@kivitendo-premium.de>
Tue, 24 Nov 2015 07:29:36 +0000 (08:29 +0100)
committerJan Büren <jan@kivitendo-premium.de>
Tue, 24 Nov 2015 07:29:36 +0000 (08:29 +0100)
SL/Controller/ClientConfig.pm
SL/OE.pm
sql/Pg-upgrade2/project_defaults.sql

index 521242d..2346f15 100644 (file)
@@ -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           },
index ceca51a..5b7c16d 100644 (file)
--- 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;
index 1d65dc7..f03ca93 100644 (file)
@@ -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;