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 },
$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;
--- @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;