From 3d433e1f69add82bd4c654e7ca6b1071a35e0c86 Mon Sep 17 00:00:00 2001 From: Tamino Steinert Date: Mon, 4 Dec 2023 12:22:08 +0100 Subject: [PATCH] Varianten: SQL-Scripte und ROSE-DB Dateien erstellt --- SL/DB/Helper/ALL.pm | 7 ++ SL/DB/Helper/Mappings.pm | 7 ++ SL/DB/Helper/TransNumberGenerator.pm | 2 + SL/DB/Manager/PartParentVarientPartVarient.pm | 14 ++++ SL/DB/Manager/TranslationVarientProperty.pm | 14 ++++ .../TranslationVarientPropertyValue.pm | 14 ++++ SL/DB/Manager/VarientProperty.pm | 14 ++++ SL/DB/Manager/VarientPropertyPart.pm | 14 ++++ SL/DB/Manager/VarientPropertyValue.pm | 14 ++++ SL/DB/Manager/VarientPropertyValuePart.pm | 14 ++++ SL/DB/MetaSetup/Default.pm | 2 + SL/DB/MetaSetup/Part.pm | 2 +- .../MetaSetup/PartParentVarientPartVarient.pm | 34 +++++++++ SL/DB/MetaSetup/TranslationVarientProperty.pm | 36 +++++++++ .../TranslationVarientPropertyValue.pm | 36 +++++++++ SL/DB/MetaSetup/VarientProperty.pm | 27 +++++++ SL/DB/MetaSetup/VarientPropertyPart.pm | 33 ++++++++ SL/DB/MetaSetup/VarientPropertyValue.pm | 32 ++++++++ SL/DB/MetaSetup/VarientPropertyValuePart.pm | 33 ++++++++ SL/DB/Part.pm | 24 ++++++ SL/DB/PartParentVarientPartVarient.pm | 13 ++++ SL/DB/TranslationVarientProperty.pm | 13 ++++ SL/DB/TranslationVarientPropertyValue.pm | 13 ++++ SL/DB/VarientProperty.pm | 22 ++++++ SL/DB/VarientPropertyPart.pm | 13 ++++ SL/DB/VarientPropertyValue.pm | 22 ++++++ SL/DB/VarientPropertyValuePart.pm | 13 ++++ SL/TransNumber.pm | 12 +-- sql/Pg-upgrade2/add_variants.sql | 76 +++++++++++++++++++ .../client_config/_ranges_of_numbers.html | 8 ++ .../client_config/_ranges_of_numbers.html | 4 + 31 files changed, 576 insertions(+), 6 deletions(-) create mode 100644 SL/DB/Manager/PartParentVarientPartVarient.pm create mode 100644 SL/DB/Manager/TranslationVarientProperty.pm create mode 100644 SL/DB/Manager/TranslationVarientPropertyValue.pm create mode 100644 SL/DB/Manager/VarientProperty.pm create mode 100644 SL/DB/Manager/VarientPropertyPart.pm create mode 100644 SL/DB/Manager/VarientPropertyValue.pm create mode 100644 SL/DB/Manager/VarientPropertyValuePart.pm create mode 100644 SL/DB/MetaSetup/PartParentVarientPartVarient.pm create mode 100644 SL/DB/MetaSetup/TranslationVarientProperty.pm create mode 100644 SL/DB/MetaSetup/TranslationVarientPropertyValue.pm create mode 100644 SL/DB/MetaSetup/VarientProperty.pm create mode 100644 SL/DB/MetaSetup/VarientPropertyPart.pm create mode 100644 SL/DB/MetaSetup/VarientPropertyValue.pm create mode 100644 SL/DB/MetaSetup/VarientPropertyValuePart.pm create mode 100644 SL/DB/PartParentVarientPartVarient.pm create mode 100644 SL/DB/TranslationVarientProperty.pm create mode 100644 SL/DB/TranslationVarientPropertyValue.pm create mode 100644 SL/DB/VarientProperty.pm create mode 100644 SL/DB/VarientPropertyPart.pm create mode 100644 SL/DB/VarientPropertyValue.pm create mode 100644 SL/DB/VarientPropertyValuePart.pm create mode 100644 sql/Pg-upgrade2/add_variants.sql diff --git a/SL/DB/Helper/ALL.pm b/SL/DB/Helper/ALL.pm index 4220d51852..e9c51007d7 100644 --- a/SL/DB/Helper/ALL.pm +++ b/SL/DB/Helper/ALL.pm @@ -91,6 +91,7 @@ use SL::DB::OrderVersion; use SL::DB::Part; use SL::DB::PartClassification; use SL::DB::PartCustomerPrice; +use SL::DB::PartParentVarientPartVarient; use SL::DB::PartsGroup; use SL::DB::PartsPriceHistory; use SL::DB::PaymentTerm; @@ -153,12 +154,18 @@ use SL::DB::TimeRecordingArticle; use SL::DB::TodoUserConfig; use SL::DB::TransferType; use SL::DB::Translation; +use SL::DB::TranslationVarientProperty; +use SL::DB::TranslationVarientPropertyValue; use SL::DB::TriggerInformation; use SL::DB::Unit; use SL::DB::UnitsLanguage; use SL::DB::UserPreference; use SL::DB::VC; use SL::DB::ValidityToken; +use SL::DB::VarientProperty; +use SL::DB::VarientPropertyPart; +use SL::DB::VarientPropertyValue; +use SL::DB::VarientPropertyValuePart; use SL::DB::Vendor; use SL::DB::Warehouse; diff --git a/SL/DB/Helper/Mappings.pm b/SL/DB/Helper/Mappings.pm index 74a60a15e6..488d905621 100644 --- a/SL/DB/Helper/Mappings.pm +++ b/SL/DB/Helper/Mappings.pm @@ -168,6 +168,7 @@ my %kivitendo_package_names = ( oe => 'order', oe_version => 'order_version', parts => 'part', + parts_parent_variant_id_parts_variant_id => 'PartParentVarientPartVarient', partsgroup => 'parts_group', part_classifications => 'PartClassification', part_customer_prices => 'PartCustomerPrice', @@ -231,11 +232,17 @@ my %kivitendo_package_names = ( todo_user_config => 'todo_user_config', transfer_type => 'transfer_type', translation => 'translation', + translation_varient_properties => 'TranslationVarientProperty', + translation_varient_property_values => 'TranslationVarientPropertyValue', trigger_information => 'trigger_information', units => 'unit', units_language => 'units_language', user_preferences => 'user_preference', validity_tokens => 'ValidityToken', + variant_properties => 'VarientProperty', + varient_properties_parts => 'VarientPropertyPart', + variant_property_values => 'VarientPropertyValue', + varient_property_values_parts => 'VarientPropertyValuePart', vendor => 'vendor', warehouse => 'warehouse', ); diff --git a/SL/DB/Helper/TransNumberGenerator.pm b/SL/DB/Helper/TransNumberGenerator.pm index f5694ec1b5..41a133627d 100644 --- a/SL/DB/Helper/TransNumberGenerator.pm +++ b/SL/DB/Helper/TransNumberGenerator.pm @@ -47,6 +47,8 @@ my %specs = ( ar => { number_column => 'invnumber', service => { number_column => 'partnumber', number_range_column => 'servicenumber', }, assembly => { number_column => 'partnumber', number_range_column => 'assemblynumber', }, assortment => { number_column => 'partnumber', number_range_column => 'assortmentnumber', }, + parent_variant => { number_column => 'partnumber', number_range_column => 'parent_variant_number', }, + variant => { number_column => 'partnumber', number_range_column => 'variant_number', }, ); sub get_next_trans_number { diff --git a/SL/DB/Manager/PartParentVarientPartVarient.pm b/SL/DB/Manager/PartParentVarientPartVarient.pm new file mode 100644 index 0000000000..b307bd3b78 --- /dev/null +++ b/SL/DB/Manager/PartParentVarientPartVarient.pm @@ -0,0 +1,14 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::Manager::PartParentVarientPartVarient; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +sub object_class { 'SL::DB::PartParentVarientPartVarient' } + +__PACKAGE__->make_manager_methods; + +1; diff --git a/SL/DB/Manager/TranslationVarientProperty.pm b/SL/DB/Manager/TranslationVarientProperty.pm new file mode 100644 index 0000000000..b4fc6b9e73 --- /dev/null +++ b/SL/DB/Manager/TranslationVarientProperty.pm @@ -0,0 +1,14 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::Manager::TranslationVarientProperty; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +sub object_class { 'SL::DB::TranslationVarientProperty' } + +__PACKAGE__->make_manager_methods; + +1; diff --git a/SL/DB/Manager/TranslationVarientPropertyValue.pm b/SL/DB/Manager/TranslationVarientPropertyValue.pm new file mode 100644 index 0000000000..61ce4ceac2 --- /dev/null +++ b/SL/DB/Manager/TranslationVarientPropertyValue.pm @@ -0,0 +1,14 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::Manager::TranslationVarientPropertyValue; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +sub object_class { 'SL::DB::TranslationVarientPropertyValue' } + +__PACKAGE__->make_manager_methods; + +1; diff --git a/SL/DB/Manager/VarientProperty.pm b/SL/DB/Manager/VarientProperty.pm new file mode 100644 index 0000000000..e7cc058991 --- /dev/null +++ b/SL/DB/Manager/VarientProperty.pm @@ -0,0 +1,14 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::Manager::VarientProperty; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +sub object_class { 'SL::DB::VarientProperty' } + +__PACKAGE__->make_manager_methods; + +1; diff --git a/SL/DB/Manager/VarientPropertyPart.pm b/SL/DB/Manager/VarientPropertyPart.pm new file mode 100644 index 0000000000..8e179fa6e8 --- /dev/null +++ b/SL/DB/Manager/VarientPropertyPart.pm @@ -0,0 +1,14 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::Manager::VarientPropertyPart; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +sub object_class { 'SL::DB::VarientPropertyPart' } + +__PACKAGE__->make_manager_methods; + +1; diff --git a/SL/DB/Manager/VarientPropertyValue.pm b/SL/DB/Manager/VarientPropertyValue.pm new file mode 100644 index 0000000000..09626c7b16 --- /dev/null +++ b/SL/DB/Manager/VarientPropertyValue.pm @@ -0,0 +1,14 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::Manager::VarientPropertyValue; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +sub object_class { 'SL::DB::VarientPropertyValue' } + +__PACKAGE__->make_manager_methods; + +1; diff --git a/SL/DB/Manager/VarientPropertyValuePart.pm b/SL/DB/Manager/VarientPropertyValuePart.pm new file mode 100644 index 0000000000..80149f1ad1 --- /dev/null +++ b/SL/DB/Manager/VarientPropertyValuePart.pm @@ -0,0 +1,14 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::Manager::VarientPropertyValuePart; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +sub object_class { 'SL::DB::VarientPropertyValuePart' } + +__PACKAGE__->make_manager_methods; + +1; diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index 77aa0b4c6d..3e625b375b 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -145,6 +145,7 @@ __PACKAGE__->meta->columns( order_warn_no_cusordnumber => { type => 'boolean', default => 'false' }, order_warn_no_deliverydate => { type => 'boolean', default => 'true' }, p_reclamation_record_number => { type => 'text', default => '0', not_null => 1 }, + parent_variant_number => { type => 'text' }, parts_image_css => { type => 'text', default => 'border:0;float:left;max-width:250px;margin-top:20px:margin-right:10px;margin-left:10px;' }, parts_listing_image => { type => 'boolean', default => 'true' }, parts_show_image => { type => 'boolean', default => 'true' }, @@ -221,6 +222,7 @@ __PACKAGE__->meta->columns( transit_items_chart_id => { type => 'integer' }, transport_cost_reminder_article_number_id => { type => 'integer' }, undo_transfer_interval => { type => 'integer', default => 7 }, + variant_number => { type => 'text' }, vc_greetings_use_textfield => { type => 'boolean' }, vendor_ustid_taxnummer_unique => { type => 'boolean', default => 'false' }, vendornumber => { type => 'text' }, diff --git a/SL/DB/MetaSetup/Part.pm b/SL/DB/MetaSetup/Part.pm index 3a43b731a0..ff34ca3375 100644 --- a/SL/DB/MetaSetup/Part.pm +++ b/SL/DB/MetaSetup/Part.pm @@ -32,7 +32,7 @@ __PACKAGE__->meta->columns( obsolete => { type => 'boolean', default => 'false', not_null => 1 }, onhand => { type => 'numeric', default => '0', precision => 25, scale => 5 }, order_qty => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 }, - part_type => { type => 'enum', check_in => [ 'part', 'service', 'assembly', 'assortment' ], db_type => 'part_type_enum', not_null => 1 }, + part_type => { type => 'enum', check_in => [ 'part', 'service', 'assembly', 'assortment', 'parent_variant', 'variant' ], db_type => 'part_type_enum', not_null => 1 }, partnumber => { type => 'text', not_null => 1 }, partsgroup_id => { type => 'integer' }, payment_id => { type => 'integer' }, diff --git a/SL/DB/MetaSetup/PartParentVarientPartVarient.pm b/SL/DB/MetaSetup/PartParentVarientPartVarient.pm new file mode 100644 index 0000000000..7220e91767 --- /dev/null +++ b/SL/DB/MetaSetup/PartParentVarientPartVarient.pm @@ -0,0 +1,34 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::PartParentVarientPartVarient; + +use strict; + +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('parts_parent_variant_id_parts_variant_id'); + +__PACKAGE__->meta->columns( + parent_variant_id => { type => 'integer', not_null => 1 }, + variant_id => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'parent_variant_id', 'variant_id' ]); + +__PACKAGE__->meta->unique_keys([ 'variant_id' ]); + +__PACKAGE__->meta->foreign_keys( + parent_variant => { + class => 'SL::DB::Part', + key_columns => { parent_variant_id => 'id' }, + }, + + variant => { + class => 'SL::DB::Part', + key_columns => { variant_id => 'id' }, + rel_type => 'one to one', + }, +); + +1; +; diff --git a/SL/DB/MetaSetup/TranslationVarientProperty.pm b/SL/DB/MetaSetup/TranslationVarientProperty.pm new file mode 100644 index 0000000000..3651e4a019 --- /dev/null +++ b/SL/DB/MetaSetup/TranslationVarientProperty.pm @@ -0,0 +1,36 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::TranslationVarientProperty; + +use strict; + +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('translation_varient_properties'); + +__PACKAGE__->meta->columns( + itime => { type => 'timestamp', default => 'now()' }, + language_id => { type => 'integer', not_null => 1 }, + mtime => { type => 'timestamp' }, + name => { type => 'text', not_null => 1 }, + varient_property_id => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'varient_property_id', 'language_id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + language => { + class => 'SL::DB::Language', + key_columns => { language_id => 'id' }, + }, + + varient_property => { + class => 'SL::DB::VarientProperty', + key_columns => { varient_property_id => 'id' }, + }, +); + +1; +; diff --git a/SL/DB/MetaSetup/TranslationVarientPropertyValue.pm b/SL/DB/MetaSetup/TranslationVarientPropertyValue.pm new file mode 100644 index 0000000000..6584522007 --- /dev/null +++ b/SL/DB/MetaSetup/TranslationVarientPropertyValue.pm @@ -0,0 +1,36 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::TranslationVarientPropertyValue; + +use strict; + +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('translation_varient_property_values'); + +__PACKAGE__->meta->columns( + itime => { type => 'timestamp', default => 'now()' }, + language_id => { type => 'integer', not_null => 1 }, + mtime => { type => 'timestamp' }, + value => { type => 'text', not_null => 1 }, + varient_property_value_id => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'varient_property_value_id', 'language_id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + language => { + class => 'SL::DB::Language', + key_columns => { language_id => 'id' }, + }, + + varient_property_value => { + class => 'SL::DB::VarientPropertyValue', + key_columns => { varient_property_value_id => 'id' }, + }, +); + +1; +; diff --git a/SL/DB/MetaSetup/VarientProperty.pm b/SL/DB/MetaSetup/VarientProperty.pm new file mode 100644 index 0000000000..b3c0b2bbc2 --- /dev/null +++ b/SL/DB/MetaSetup/VarientProperty.pm @@ -0,0 +1,27 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::VarientProperty; + +use strict; + +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('variant_properties'); + +__PACKAGE__->meta->columns( + abbreviation => { type => 'varchar', length => 4, not_null => 1 }, + id => { type => 'serial', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + name => { type => 'text', not_null => 1 }, + unique_name => { type => 'text', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->unique_keys([ 'unique_name' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +1; +; diff --git a/SL/DB/MetaSetup/VarientPropertyPart.pm b/SL/DB/MetaSetup/VarientPropertyPart.pm new file mode 100644 index 0000000000..82a091af4c --- /dev/null +++ b/SL/DB/MetaSetup/VarientPropertyPart.pm @@ -0,0 +1,33 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::VarientPropertyPart; + +use strict; + +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('varient_properties_parts'); + +__PACKAGE__->meta->columns( + part_id => { type => 'integer', not_null => 1 }, + variant_property_id => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'part_id', 'variant_property_id' ]); + +__PACKAGE__->meta->unique_keys([ 'variant_property_id', 'part_id' ]); + +__PACKAGE__->meta->foreign_keys( + part => { + class => 'SL::DB::Part', + key_columns => { part_id => 'id' }, + }, + + variant_property => { + class => 'SL::DB::VarientProperty', + key_columns => { variant_property_id => 'id' }, + }, +); + +1; +; diff --git a/SL/DB/MetaSetup/VarientPropertyValue.pm b/SL/DB/MetaSetup/VarientPropertyValue.pm new file mode 100644 index 0000000000..3dc4e78802 --- /dev/null +++ b/SL/DB/MetaSetup/VarientPropertyValue.pm @@ -0,0 +1,32 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::VarientPropertyValue; + +use strict; + +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('variant_property_values'); + +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + sortkey => { type => 'integer', not_null => 1 }, + value => { type => 'text', not_null => 1 }, + variant_property_id => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + variant_property => { + class => 'SL::DB::VarientProperty', + key_columns => { variant_property_id => 'id' }, + }, +); + +1; +; diff --git a/SL/DB/MetaSetup/VarientPropertyValuePart.pm b/SL/DB/MetaSetup/VarientPropertyValuePart.pm new file mode 100644 index 0000000000..a6e17d5e71 --- /dev/null +++ b/SL/DB/MetaSetup/VarientPropertyValuePart.pm @@ -0,0 +1,33 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::VarientPropertyValuePart; + +use strict; + +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('varient_property_values_parts'); + +__PACKAGE__->meta->columns( + part_id => { type => 'integer', not_null => 1 }, + variant_property_value_id => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'part_id', 'variant_property_value_id' ]); + +__PACKAGE__->meta->unique_keys([ 'variant_property_value_id', 'part_id' ]); + +__PACKAGE__->meta->foreign_keys( + part => { + class => 'SL::DB::Part', + key_columns => { part_id => 'id' }, + }, + + variant_property_value => { + class => 'SL::DB::VarientPropertyValue', + key_columns => { variant_property_value_id => 'id' }, + }, +); + +1; +; diff --git a/SL/DB/Part.pm b/SL/DB/Part.pm index 50d0c94405..d844dfc430 100644 --- a/SL/DB/Part.pm +++ b/SL/DB/Part.pm @@ -92,6 +92,30 @@ __PACKAGE__->meta->add_relationships( class => 'SL::DB::PurchaseBasketItem', column_map => { id => 'part_id' }, }, + varient_properties => { + map_class => 'SL::DB::VarientPropertyPart', + map_from => 'part', + map_to => 'variant_property', + type => 'many to many', + }, + varient_porperty_values => { + map_class => 'SL::DB::VarientPropertyValuePart', + map_from => 'part', + map_to => 'variant_property_value', + type => 'many to many', + }, + parent_variant => { + map_class => 'SL::DB::PartParentVarientPartVarient', + map_from => 'variant', + map_to => 'parent_variant', + type => 'many to many', #should be 'many to one' but has no map_class + }, + varients => { + map_class => 'SL::DB::PartParentVarientPartVarient', + map_from => 'parent_variant', + map_to => 'variant', + type => 'many to many', #should be 'one to many' but has no map_class + } ); __PACKAGE__->meta->initialize; diff --git a/SL/DB/PartParentVarientPartVarient.pm b/SL/DB/PartParentVarientPartVarient.pm new file mode 100644 index 0000000000..2f4f058957 --- /dev/null +++ b/SL/DB/PartParentVarientPartVarient.pm @@ -0,0 +1,13 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::PartParentVarientPartVarient; + +use strict; + +use SL::DB::MetaSetup::PartParentVarientPartVarient; +use SL::DB::Manager::PartParentVarientPartVarient; + +__PACKAGE__->meta->initialize; + +1; diff --git a/SL/DB/TranslationVarientProperty.pm b/SL/DB/TranslationVarientProperty.pm new file mode 100644 index 0000000000..7261eb650d --- /dev/null +++ b/SL/DB/TranslationVarientProperty.pm @@ -0,0 +1,13 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::TranslationVarientProperty; + +use strict; + +use SL::DB::MetaSetup::TranslationVarientProperty; +use SL::DB::Manager::TranslationVarientProperty; + +__PACKAGE__->meta->initialize; + +1; diff --git a/SL/DB/TranslationVarientPropertyValue.pm b/SL/DB/TranslationVarientPropertyValue.pm new file mode 100644 index 0000000000..b60a566196 --- /dev/null +++ b/SL/DB/TranslationVarientPropertyValue.pm @@ -0,0 +1,13 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::TranslationVarientPropertyValue; + +use strict; + +use SL::DB::MetaSetup::TranslationVarientPropertyValue; +use SL::DB::Manager::TranslationVarientPropertyValue; + +__PACKAGE__->meta->initialize; + +1; diff --git a/SL/DB/VarientProperty.pm b/SL/DB/VarientProperty.pm new file mode 100644 index 0000000000..0d2bc11689 --- /dev/null +++ b/SL/DB/VarientProperty.pm @@ -0,0 +1,22 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::VarientProperty; + +use strict; + +use SL::DB::MetaSetup::VarientProperty; +use SL::DB::Manager::VarientProperty; + +__PACKAGE__->meta->add_relationships( + parent_variants => { + map_class => 'SL::DB::VarientPropertyPart', + map_from => 'variant_property', + map_to => 'part', + type => 'many to many', + }, +); + +__PACKAGE__->meta->initialize; + +1; diff --git a/SL/DB/VarientPropertyPart.pm b/SL/DB/VarientPropertyPart.pm new file mode 100644 index 0000000000..7458fe55f8 --- /dev/null +++ b/SL/DB/VarientPropertyPart.pm @@ -0,0 +1,13 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::VarientPropertyPart; + +use strict; + +use SL::DB::MetaSetup::VarientPropertyPart; +use SL::DB::Manager::VarientPropertyPart; + +__PACKAGE__->meta->initialize; + +1; diff --git a/SL/DB/VarientPropertyValue.pm b/SL/DB/VarientPropertyValue.pm new file mode 100644 index 0000000000..af15fd02fc --- /dev/null +++ b/SL/DB/VarientPropertyValue.pm @@ -0,0 +1,22 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::VarientPropertyValue; + +use strict; + +use SL::DB::MetaSetup::VarientPropertyValue; +use SL::DB::Manager::VarientPropertyValue; + +__PACKAGE__->meta->add_relationships( + parent_variants => { + map_class => 'SL::DB::VarientPropertyValuePart', + map_from => 'variant_property_value', + map_to => 'part', + type => 'many to many', + }, +); + +__PACKAGE__->meta->initialize; + +1; diff --git a/SL/DB/VarientPropertyValuePart.pm b/SL/DB/VarientPropertyValuePart.pm new file mode 100644 index 0000000000..51030829b3 --- /dev/null +++ b/SL/DB/VarientPropertyValuePart.pm @@ -0,0 +1,13 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::VarientPropertyValuePart; + +use strict; + +use SL::DB::MetaSetup::VarientPropertyValuePart; +use SL::DB::Manager::VarientPropertyValuePart; + +__PACKAGE__->meta->initialize; + +1; diff --git a/SL/TransNumber.pm b/SL/TransNumber.pm index e19c111ec4..2b6bd04433 100644 --- a/SL/TransNumber.pm +++ b/SL/TransNumber.pm @@ -92,12 +92,14 @@ sub _get_filters { $filters{table} = "oe"; $filters{where} = 'COALESCE(quotation, FALSE) AND (vendor_id IS NOT NULL)'; - } elsif ($type =~ /^(part|service|assembly|assortment)$/) { + } elsif ($type =~ /^(part|service|assembly|assortment|parent_variant|variant)$/) { $filters{trans_number} = "partnumber"; - my %numberfield_hash = ( service => 'servicenumber', - assembly => 'assemblynumber', - assortment => 'assortmentnumber', - part => 'articlenumber' + my %numberfield_hash = ( service => 'servicenumber', + assembly => 'assemblynumber', + assortment => 'assortmentnumber', + parent_variant => 'parent_variant_number', + variant => 'variant_number', + part => 'articlenumber' ); $filters{numberfield} = $numberfield_hash{$type}; $filters{table} = "parts"; diff --git a/sql/Pg-upgrade2/add_variants.sql b/sql/Pg-upgrade2/add_variants.sql new file mode 100644 index 0000000000..3de00f57dd --- /dev/null +++ b/sql/Pg-upgrade2/add_variants.sql @@ -0,0 +1,76 @@ +-- @tag: add_variants +-- @description: Neue Tabllen für Variantenartikel +-- @depends: release_3_8_0 +-- @ignore: 0 + +ALTER TYPE part_type_enum ADD VALUE 'parent_variant'; +ALTER TYPE part_type_enum ADD VALUE 'variant'; + +ALTER TABLE defaults ADD parent_variant_number TEXT; +ALTER TABLE defaults ADD variant_number TEXT; + +CREATE TABLE parts_parent_variant_id_parts_variant_id ( + parent_variant_id INTEGER NOT NULL REFERENCES parts(id), + variant_id INTEGER NOT NULL UNIQUE REFERENCES parts(id), + PRIMARY KEY (parent_variant_id, variant_id) +); + +CREATE TABLE variant_properties ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + unique_name TEXT NOT NULL UNIQUE, + abbreviation VARCHAR(4) NOT NULL, + itime TIMESTAMP DEFAULT now(), + mtime TIMESTAMP +); +CREATE TRIGGER mtime_variant_properties + BEFORE UPDATE ON variant_properties + FOR EACH ROW EXECUTE PROCEDURE set_mtime(); + +CREATE TABLE varient_properties_parts ( + variant_property_id INTEGER NOT NULL REFERENCES variant_properties(id), + part_id INTEGER NOT NULL REFERENCES parts(id), + PRIMARY KEY (part_id, variant_property_id) +); + +CREATE TABLE translation_varient_properties ( + varient_property_id INTEGER NOT NULL REFERENCES variant_properties(id), + language_id INTEGER NOT NULL REFERENCES language(id), + name TEXT NOT NULL, + itime TIMESTAMP DEFAULT now(), + mtime TIMESTAMP, + PRIMARY KEY (varient_property_id, language_id) +); +CREATE TRIGGER mtime_translation_varient_properties + BEFORE UPDATE ON translation_varient_properties + FOR EACH ROW EXECUTE PROCEDURE set_mtime(); + +CREATE TABLE variant_property_values ( + id SERIAL PRIMARY KEY, + variant_property_id INTEGER NOT NULL REFERENCES variant_properties(id), + value TEXT NOT NULL, + sortkey INTEGER NOT NULL, + itime TIMESTAMP DEFAULT now(), + mtime TIMESTAMP +); +CREATE TRIGGER mtime_variant_property_values + BEFORE UPDATE ON variant_property_values + FOR EACH ROW EXECUTE PROCEDURE set_mtime(); + +CREATE TABLE varient_property_values_parts ( + variant_property_value_id INTEGER NOT NULL REFERENCES variant_property_values(id), + part_id INTEGER NOT NULL REFERENCES parts(id), + PRIMARY KEY (part_id, variant_property_value_id) +); + +CREATE TABLE translation_varient_property_values ( + varient_property_value_id INTEGER NOT NULL REFERENCES variant_property_values(id), + language_id INTEGER NOT NULL REFERENCES language(id), + value TEXT NOT NULL, + itime TIMESTAMP DEFAULT now(), + mtime TIMESTAMP, + PRIMARY KEY (varient_property_value_id, language_id) +); +CREATE TRIGGER mtime_translation_varient_property_values + BEFORE UPDATE ON translation_varient_property_values + FOR EACH ROW EXECUTE PROCEDURE set_mtime(); diff --git a/templates/design40_webpages/client_config/_ranges_of_numbers.html b/templates/design40_webpages/client_config/_ranges_of_numbers.html index 0466ac0455..82de8e35e7 100644 --- a/templates/design40_webpages/client_config/_ranges_of_numbers.html +++ b/templates/design40_webpages/client_config/_ranges_of_numbers.html @@ -104,6 +104,14 @@ [% L.input_tag("defaults.assortmentnumber", SELF.defaults.assortmentnumber, size="15", class="wi-normal") %] [% END %] + + [% LxERP.t8('Parent Variant') %] + [% L.input_tag("defaults.parent_variant_number", SELF.defaults.parent_variant_number, size="15", class="wi-normal") %] + + + [% LxERP.t8('Variant') %] + [% L.input_tag("defaults.variant_number", SELF.defaults.variant_number, size="15", class="wi-normal") %] + diff --git a/templates/webpages/client_config/_ranges_of_numbers.html b/templates/webpages/client_config/_ranges_of_numbers.html index 0b6a3f63c7..08e084128b 100644 --- a/templates/webpages/client_config/_ranges_of_numbers.html +++ b/templates/webpages/client_config/_ranges_of_numbers.html @@ -72,11 +72,15 @@ [% LxERP.t8('Last Purchase Delivery Order Number') %] [% L.input_tag("defaults.pdonumber", SELF.defaults.pdonumber, size="15") %] + [% LxERP.t8('Last Parent Variant Number') %] + [% L.input_tag("defaults.parent_variant_number", SELF.defaults.parent_variant_number, size="15") %] [% LxERP.t8('Last Supplier Delivery Order Number') %] [% L.input_tag("defaults.sudonumber", SELF.defaults.sudonumber, size="15") %] + [% LxERP.t8('Last Variant Number') %] + [% L.input_tag("defaults.variant_number", SELF.defaults.variant_number, size="15") %]