From 6b87fc69acd2056741e1247e46b9d4dcc9db8730 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 1 Nov 2013 14:32:13 +0100 Subject: [PATCH] Pflichtenhefte: Nummerierungsformate zu Typen verschoben & bearbeitbar gemacht --- SL/DB/MetaSetup/Default.pm | 172 +++++++++--------- SL/DB/MetaSetup/RequirementSpecType.pm | 14 +- SL/DB/RequirementSpecItem.pm | 4 +- locale/de/all | 3 + .../requirement_spec_types_number_formats.sql | 16 ++ .../webpages/requirement_spec_type/form.html | 12 ++ .../webpages/requirement_spec_type/list.html | 5 + 7 files changed, 131 insertions(+), 95 deletions(-) create mode 100644 sql/Pg-upgrade2/requirement_spec_types_number_formats.sql diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index 5b547efc4..942810c34 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -9,93 +9,91 @@ use base qw(SL::DB::Object); __PACKAGE__->meta->table('defaults'); __PACKAGE__->meta->columns( - accounting_method => { type => 'text' }, - address => { type => 'text' }, - ap_changeable => { type => 'integer', default => 2, not_null => 1 }, - ap_show_mark_as_paid => { type => 'boolean', default => 'true' }, - ar_changeable => { type => 'integer', default => 2, not_null => 1 }, - ar_paid_accno_id => { type => 'integer' }, - ar_show_mark_as_paid => { type => 'boolean', default => 'true' }, - articlenumber => { type => 'text' }, - assemblynumber => { type => 'text' }, - balance_startdate_method => { type => 'text' }, - bin_id => { type => 'integer' }, - bin_id_ignore_onhand => { type => 'integer' }, - businessnumber => { type => 'text' }, - closedto => { type => 'date' }, - cnnumber => { type => 'text' }, - co_ustid => { type => 'text' }, - coa => { type => 'text' }, - company => { type => 'text' }, - currency_id => { type => 'integer', not_null => 1 }, - customer_hourly_rate => { type => 'numeric', precision => 2, scale => 8 }, - customernumber => { type => 'text' }, - datev_check_on_ap_transaction => { type => 'boolean', default => 'true' }, - datev_check_on_ar_transaction => { type => 'boolean', default => 'true' }, - datev_check_on_gl_transaction => { type => 'boolean', default => 'true' }, - datev_check_on_purchase_invoice => { type => 'boolean', default => 'true' }, - datev_check_on_sales_invoice => { type => 'boolean', default => 'true' }, - dunning_ar => { type => 'integer' }, - dunning_ar_amount_fee => { type => 'integer' }, - dunning_ar_amount_interest => { type => 'integer' }, - duns => { type => 'text' }, - expense_accno_id => { type => 'integer' }, - fxgain_accno_id => { type => 'integer' }, - fxloss_accno_id => { type => 'integer' }, - gl_changeable => { type => 'integer', default => 2, not_null => 1 }, - id => { type => 'serial', not_null => 1 }, - income_accno_id => { type => 'integer' }, - inventory_accno_id => { type => 'integer' }, - inventory_system => { type => 'text' }, - invnumber => { type => 'text' }, - ir_changeable => { type => 'integer', default => 2, not_null => 1 }, - ir_show_mark_as_paid => { type => 'boolean', default => 'true' }, - is_changeable => { type => 'integer', default => 2, not_null => 1 }, - is_show_mark_as_paid => { type => 'boolean', default => 'true' }, - itime => { type => 'timestamp', default => 'now()' }, - language_id => { type => 'integer' }, - max_future_booking_interval => { type => 'integer', default => 360 }, - mtime => { type => 'timestamp' }, - normalize_part_descriptions => { type => 'boolean', default => 'true' }, - normalize_vc_names => { type => 'boolean', default => 'true' }, - 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' }, - payments_changeable => { type => 'integer', default => '0', not_null => 1 }, - pdonumber => { type => 'text' }, - ponumber => { type => 'text' }, - profit_determination => { type => 'text' }, - purchase_delivery_order_show_delete => { type => 'boolean', default => 'true' }, - purchase_order_show_delete => { type => 'boolean', default => 'true' }, - requirement_spec_function_block_number_format => { type => 'text', default => 'FB000', not_null => 1 }, - requirement_spec_section_number_format => { type => 'text', default => 'A00', not_null => 1 }, - requirement_spec_section_order_part_id => { type => 'integer' }, - revtrans => { type => 'boolean', default => 'false' }, - rfqnumber => { type => 'text' }, - rmanumber => { type => 'text' }, - sales_delivery_order_show_delete => { type => 'boolean', default => 'true' }, - sales_order_show_delete => { type => 'boolean', default => 'true' }, - sdonumber => { type => 'text' }, - sepa_creditor_id => { type => 'text' }, - servicenumber => { type => 'text' }, - show_bestbefore => { type => 'boolean', default => 'false' }, - show_weight => { type => 'boolean', default => 'false', not_null => 1 }, - signature => { type => 'text' }, - sonumber => { type => 'text' }, - sqnumber => { type => 'text' }, - taxnumber => { type => 'text' }, - templates => { type => 'text' }, - transfer_default => { type => 'boolean', default => 'true' }, - transfer_default_ignore_onhand => { type => 'boolean', default => 'false' }, - transfer_default_use_master_default_bin => { type => 'boolean', default => 'false' }, - vendornumber => { type => 'text' }, - version => { type => 'varchar', length => 8 }, - vertreter => { type => 'boolean', default => 'false' }, - warehouse_id => { type => 'integer' }, - warehouse_id_ignore_onhand => { type => 'integer' }, - webdav => { type => 'boolean', default => 'false' }, - webdav_documents => { type => 'boolean', default => 'false' }, - weightunit => { type => 'varchar', length => 5 }, + accounting_method => { type => 'text' }, + address => { type => 'text' }, + ap_changeable => { type => 'integer', default => 2, not_null => 1 }, + ap_show_mark_as_paid => { type => 'boolean', default => 'true' }, + ar_changeable => { type => 'integer', default => 2, not_null => 1 }, + ar_paid_accno_id => { type => 'integer' }, + ar_show_mark_as_paid => { type => 'boolean', default => 'true' }, + articlenumber => { type => 'text' }, + assemblynumber => { type => 'text' }, + balance_startdate_method => { type => 'text' }, + bin_id => { type => 'integer' }, + bin_id_ignore_onhand => { type => 'integer' }, + businessnumber => { type => 'text' }, + closedto => { type => 'date' }, + cnnumber => { type => 'text' }, + co_ustid => { type => 'text' }, + coa => { type => 'text' }, + company => { type => 'text' }, + currency_id => { type => 'integer', not_null => 1 }, + customer_hourly_rate => { type => 'numeric', precision => 2, scale => 8 }, + customernumber => { type => 'text' }, + datev_check_on_ap_transaction => { type => 'boolean', default => 'true' }, + datev_check_on_ar_transaction => { type => 'boolean', default => 'true' }, + datev_check_on_gl_transaction => { type => 'boolean', default => 'true' }, + datev_check_on_purchase_invoice => { type => 'boolean', default => 'true' }, + datev_check_on_sales_invoice => { type => 'boolean', default => 'true' }, + dunning_ar => { type => 'integer' }, + dunning_ar_amount_fee => { type => 'integer' }, + dunning_ar_amount_interest => { type => 'integer' }, + duns => { type => 'text' }, + expense_accno_id => { type => 'integer' }, + fxgain_accno_id => { type => 'integer' }, + fxloss_accno_id => { type => 'integer' }, + gl_changeable => { type => 'integer', default => 2, not_null => 1 }, + id => { type => 'serial', not_null => 1 }, + income_accno_id => { type => 'integer' }, + inventory_accno_id => { type => 'integer' }, + inventory_system => { type => 'text' }, + invnumber => { type => 'text' }, + ir_changeable => { type => 'integer', default => 2, not_null => 1 }, + ir_show_mark_as_paid => { type => 'boolean', default => 'true' }, + is_changeable => { type => 'integer', default => 2, not_null => 1 }, + is_show_mark_as_paid => { type => 'boolean', default => 'true' }, + itime => { type => 'timestamp', default => 'now()' }, + language_id => { type => 'integer' }, + max_future_booking_interval => { type => 'integer', default => 360 }, + mtime => { type => 'timestamp' }, + normalize_part_descriptions => { type => 'boolean', default => 'true' }, + normalize_vc_names => { type => 'boolean', default => 'true' }, + 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' }, + payments_changeable => { type => 'integer', default => '0', not_null => 1 }, + pdonumber => { type => 'text' }, + ponumber => { type => 'text' }, + profit_determination => { type => 'text' }, + purchase_delivery_order_show_delete => { type => 'boolean', default => 'true' }, + purchase_order_show_delete => { type => 'boolean', default => 'true' }, + requirement_spec_section_order_part_id => { type => 'integer' }, + revtrans => { type => 'boolean', default => 'false' }, + rfqnumber => { type => 'text' }, + rmanumber => { type => 'text' }, + sales_delivery_order_show_delete => { type => 'boolean', default => 'true' }, + sales_order_show_delete => { type => 'boolean', default => 'true' }, + sdonumber => { type => 'text' }, + sepa_creditor_id => { type => 'text' }, + servicenumber => { type => 'text' }, + show_bestbefore => { type => 'boolean', default => 'false' }, + show_weight => { type => 'boolean', default => 'false', not_null => 1 }, + signature => { type => 'text' }, + sonumber => { type => 'text' }, + sqnumber => { type => 'text' }, + taxnumber => { type => 'text' }, + templates => { type => 'text' }, + transfer_default => { type => 'boolean', default => 'true' }, + transfer_default_ignore_onhand => { type => 'boolean', default => 'false' }, + transfer_default_use_master_default_bin => { type => 'boolean', default => 'false' }, + vendornumber => { type => 'text' }, + version => { type => 'varchar', length => 8 }, + vertreter => { type => 'boolean', default => 'false' }, + warehouse_id => { type => 'integer' }, + warehouse_id_ignore_onhand => { type => 'integer' }, + webdav => { type => 'boolean', default => 'false' }, + webdav_documents => { type => 'boolean', default => 'false' }, + weightunit => { type => 'varchar', length => 5 }, ); __PACKAGE__->meta->primary_key_columns([ 'id' ]); diff --git a/SL/DB/MetaSetup/RequirementSpecType.pm b/SL/DB/MetaSetup/RequirementSpecType.pm index 102b8178f..53a8be17f 100644 --- a/SL/DB/MetaSetup/RequirementSpecType.pm +++ b/SL/DB/MetaSetup/RequirementSpecType.pm @@ -9,12 +9,14 @@ use base qw(SL::DB::Object); __PACKAGE__->meta->table('requirement_spec_types'); __PACKAGE__->meta->columns( - description => { type => 'text', not_null => 1 }, - id => { type => 'serial', not_null => 1 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - position => { type => 'integer', not_null => 1 }, - template_file_name => { type => 'text' }, + description => { type => 'text', not_null => 1 }, + function_block_number_format => { type => 'text', default => 'FB000', not_null => 1 }, + id => { type => 'serial', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + position => { type => 'integer', not_null => 1 }, + section_number_format => { type => 'text', default => 'A00', not_null => 1 }, + template_file_name => { type => 'text' }, ); __PACKAGE__->meta->primary_key_columns([ 'id' ]); diff --git a/SL/DB/RequirementSpecItem.pm b/SL/DB/RequirementSpecItem.pm index dc710b4de..433e844e5 100644 --- a/SL/DB/RequirementSpecItem.pm +++ b/SL/DB/RequirementSpecItem.pm @@ -56,8 +56,8 @@ sub _before_save_create_fb_number { $self->requirement_spec->update_attributes($method => $next_number) || return 0; - $method = 'requirement_spec_' . ($self->parent_id ? 'function_block' : 'section') . '_number_format'; - my $format = SL::DB::Default->get->$method; + $method = ($self->parent_id ? 'function_block' : 'section') . '_number_format'; + my $format = $self->requirement_spec->type->$method; $self->fb_number(SL::PrefixedNumber->new(number => $format || 0)->set_to($next_number)); diff --git a/locale/de/all b/locale/de/all index b69fff843..1c56c59c4 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1116,6 +1116,7 @@ $self->{texts} = { 'Full access to all functions' => 'Vollzugriff auf alle Funktionen', 'Function block' => 'Funktionsblock', 'Function block actions' => 'Funktionsblockaktionen', + 'Function block number format' => 'Format der Funktionsblocknummerierung', 'Function/position' => 'Funktion/Position', 'Fwd' => 'Vorwärts', 'GL Transaction' => 'Dialogbuchung', @@ -2021,6 +2022,7 @@ $self->{texts} = { 'Searchable' => 'Durchsuchbar', 'Secondary sorting' => 'Untersortierung', 'Section "#1"' => 'Abschnitt "#1"', + 'Section number format' => 'Format der Abschnittsnummerierung', 'Section/Function block actions' => 'Abschnitts-/Funktionsblockaktionen', 'Sections' => 'Abschnitte', 'Sections that are not assigned to any of the items above will be added as new positions.' => 'Abschnitte, die keiner der oben aufgeführten Positionen zugeordnet sind, werden als neue Positionen ergänzt.', @@ -2398,6 +2400,7 @@ $self->{texts} = { 'The name must only consist of letters, numbers and underscores and start with a letter.' => 'Der Name darf nur aus Buchstaben (keine Umlaute), Ziffern und Unterstrichen bestehen und muss mit einem Buchstaben beginnen.', 'The new requirement spec will be a copy of \'#1\' for customer \'#2\'.' => 'Das neue Pflichtenheft wird eine Kopie von \'#1\' für Kunde \'#2\' sein.', 'The number of days for full payment' => 'Die Anzahl Tage, bis die Rechnung in voller Höhe bezahlt werden muss', + 'The numbering will start at 1 with each requirement spec.' => 'Die Nummerierung beginnt bei jedem Pflichtenheft bei 1.', 'The option field is empty.' => 'Das Optionsfeld ist leer.', 'The package name is invalid.' => 'Der Paketname ist ungültig.', 'The parts for this delivery order have already been transferred in.' => 'Die Artikel dieses Lieferscheins wurden bereits eingelagert.', diff --git a/sql/Pg-upgrade2/requirement_spec_types_number_formats.sql b/sql/Pg-upgrade2/requirement_spec_types_number_formats.sql new file mode 100644 index 000000000..01c54a594 --- /dev/null +++ b/sql/Pg-upgrade2/requirement_spec_types_number_formats.sql @@ -0,0 +1,16 @@ +-- @tag: requirement_spec_types_number_formats +-- @description: Nummerierungsformate für Pflichtenhefte in Typentabelle verschieben +-- @depends: requirement_specs +ALTER TABLE requirement_spec_types ADD COLUMN section_number_format TEXT; +ALTER TABLE requirement_spec_types ALTER COLUMN section_number_format SET DEFAULT 'A00'; +ALTER TABLE requirement_spec_types ADD COLUMN function_block_number_format TEXT; +ALTER TABLE requirement_spec_types ALTER COLUMN function_block_number_format SET DEFAULT 'FB000'; + +UPDATE requirement_spec_types SET section_number_format = (SELECT requirement_spec_section_number_format FROM defaults); +UPDATE requirement_spec_types SET function_block_number_format = (SELECT requirement_spec_function_block_number_format FROM defaults); + +ALTER TABLE requirement_spec_types ALTER COLUMN section_number_format SET NOT NULL; +ALTER TABLE requirement_spec_types ALTER COLUMN function_block_number_format SET NOT NULL; + +ALTER TABLE defaults DROP COLUMN requirement_spec_section_number_format; +ALTER TABLE defaults DROP COLUMN requirement_spec_function_block_number_format; diff --git a/templates/webpages/requirement_spec_type/form.html b/templates/webpages/requirement_spec_type/form.html index 814e49d5f..e9bc2d6c8 100755 --- a/templates/webpages/requirement_spec_type/form.html +++ b/templates/webpages/requirement_spec_type/form.html @@ -15,6 +15,16 @@ [% LxERP.t8('Print template base file name') %](1) [% L.input_tag("requirement_spec_type.template_file_name", SELF.requirement_spec_type.template_file_name) %] + + + [% LxERP.t8('Section number format') %](2) + [% L.input_tag("requirement_spec_type.section_number_format", SELF.requirement_spec_type.section_number_format, size="15") %] + + + + [% LxERP.t8('Function block number format') %](2) + [% L.input_tag("requirement_spec_type.function_block_number_format", SELF.requirement_spec_type.function_block_number_format, size="15") %] +

@@ -29,5 +39,7 @@

(1): [% LxERP.t8("The base file name without a path or an extension to be used for printing for this type of requirement spec.") %] +
+ (2): [% LxERP.t8('The numbering will start at 1 with each requirement spec.') %]

diff --git a/templates/webpages/requirement_spec_type/list.html b/templates/webpages/requirement_spec_type/list.html index b1a6baacf..a8920ddd0 100644 --- a/templates/webpages/requirement_spec_type/list.html +++ b/templates/webpages/requirement_spec_type/list.html @@ -16,6 +16,8 @@ [ LxERP.t8('reorder item') %] [%- LxERP.t8('Description') %] + [%- LxERP.t8('Section number format') %] + [%- LxERP.t8('Function block number format') %] @@ -28,6 +30,9 @@ [%- HTML.escape(requirement_spec_type.description) %] + + [% HTML.escape(requirement_spec_type.section_number_format) %] + [% HTML.escape(requirement_spec_type.function_block_number_format) %] [%- END %] -- 2.20.1