From: Moritz Bunkus Date: Tue, 20 Feb 2007 09:07:57 +0000 (+0000) Subject: Globale Projektnummer in Einkaufs- und Verkaufsbelegen. X-Git-Tag: release-2.4.2~87 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=82c784869fbfc8a746a0ee0662947f189f021993;p=kivitendo-erp.git Globale Projektnummer in Einkaufs- und Verkaufsbelegen. --- diff --git a/SL/OE.pm b/SL/OE.pm index 210a87c75..1967fc05d 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -437,6 +437,7 @@ Message: $form->{message}\r| if $form->{message}; payment_id = $form->{payment_id}, delivery_vendor_id = $form->{delivery_vendor_id}, delivery_customer_id = $form->{delivery_customer_id}, + globalproject_id = | . conv_i($form->{"globalproject_id"}, 'NULL') . qq|, employee_id = $form->{employee_id}, cp_id = | . conv_i($form->{cp_id}, 'NULL') . qq| WHERE id = $form->{id}|; @@ -670,11 +671,13 @@ sub retrieve { o.closed, o.reqdate, o.quonumber, o.department_id, o.cusordnumber, d.description AS department, o.payment_id, o.language_id, o.taxzone_id, o.delivery_customer_id, o.delivery_vendor_id, o.proforma, o.shipto_id, + o.globalproject_id, pr.projectnumber AS globalprojectnumber, o.delivered FROM oe o JOIN $form->{vc} cv ON (o.$form->{vc}_id = cv.id) LEFT JOIN employee e ON (o.employee_id = e.id) LEFT JOIN department d ON (o.department_id = d.id) + LEFT JOIN project pr ON (o.globalproject_id = pr.id) | . ($form->{id} ? qq|WHERE o.id = $form->{id}| diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 4634cb19d..45c0b59ab 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -531,7 +531,7 @@ sub form_header { | . $locale->text('Due Date') . qq| $button2 - + diff --git a/bin/mozilla/arap.pl b/bin/mozilla/arap.pl index 534a702fe..48cb61027 100644 --- a/bin/mozilla/arap.pl +++ b/bin/mozilla/arap.pl @@ -272,26 +272,29 @@ sub add_transaction { sub check_project { $lxdebug->enter_sub(); - for $i (1 .. $form->{rowcount}) { - $form->{"project_id_$i"} = "" unless $form->{"projectnumber_$i"}; - if ($form->{"projectnumber_$i"} ne $form->{"oldprojectnumber_$i"}) { - if ($form->{"projectnumber_$i"}) { + for $i (0 .. $form->{rowcount}) { + my $suffix = $i ? "_$i" : ""; + my $prefix = $i ? "" : "global"; + $form->{"${prefix}project_id${suffix}"} = "" unless $form->{"${prefix}projectnumber$suffix"}; + if ($form->{"${prefix}projectnumber${suffix}"} ne $form->{"old${prefix}projectnumber${suffix}"}) { + if ($form->{"${prefix}projectnumber${suffix}"}) { # get new project - $form->{projectnumber} = $form->{"projectnumber_$i"}; + $form->{projectnumber} = $form->{"${prefix}projectnumber${suffix}"}; if (($rows = PE->projects(\%myconfig, $form)) > 1) { # check form->{project_list} how many there are $form->{rownumber} = $i; - &select_project; + &select_project($i ? undef : 1); exit; } if ($rows == 1) { - $form->{"project_id_$i"} = $form->{project_list}->[0]->{id}; - $form->{"projectnumber_$i"} = + $form->{"${prefix}project_id${suffix}"} = + $form->{project_list}->[0]->{id}; + $form->{"${prefix}projectnumber${suffix}"} = $form->{project_list}->[0]->{projectnumber}; - $form->{"oldprojectnumber_$i"} = + $form->{"old${prefix}projectnumber${suffix}"} = $form->{project_list}->[0]->{projectnumber}; } else { @@ -299,7 +302,7 @@ sub check_project { $form->error($locale->text('Project not on file!')); } } else { - $form->{"oldprojectnumber_$i"} = ""; + $form->{"old${prefix}projectnumber${suffix}"} = ""; } } } @@ -310,6 +313,8 @@ sub check_project { sub select_project { $lxdebug->enter_sub(); + my ($is_global) = @_; + @column_index = qw(ndx projectnumber description); $column_data{ndx} = qq| |; @@ -387,7 +392,7 @@ sub select_project { |; # delete action variable - map { delete $form->{$_} } qw(action project_list header); + map { delete $form->{$_} } qw(action project_list header update); # save all other form variables foreach $key (keys %${form}) { @@ -396,6 +401,7 @@ sub select_project { } print qq| +
@@ -418,18 +424,21 @@ sub project_selected { # index for new item $i = $form->{ndx}; - $form->{"projectnumber_$form->{rownumber}"} = + my $prefix = $form->{"is_global"} ? "global" : ""; + my $suffix = $form->{"is_global"} ? "" : "_$form->{rownumber}"; + + $form->{"${prefix}projectnumber${suffix}"} = $form->{"new_projectnumber_$i"}; - $form->{"oldprojectnumber_$form->{rownumber}"} = + $form->{"old${prefix}projectnumber${suffix}"} = $form->{"new_projectnumber_$i"}; - $form->{"project_id_$form->{rownumber}"} = $form->{"new_id_$i"}; + $form->{"${prefix}project_id${suffix}"} = $form->{"new_id_$i"}; # delete all the new_ variables for $i (1 .. $form->{lastndx}) { map { delete $form->{"new_${_}_$i"} } qw(id projectnumber description); } - map { delete $form->{$_} } qw(ndx lastndx nextsub); + map { delete $form->{$_} } qw(ndx lastndx nextsub is_global); if ($form->{update}) { &{ $form->{update} }; diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 0f9c295a1..1b99f5fb5 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -455,7 +455,15 @@ sub form_header { - + + | . $locale->text('Project Number') . qq| + + + + + + + diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index e29ca4c00..3b298f13d 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -741,6 +741,14 @@ print qq| | . $locale->text('Customer Order Number') . qq| + + | . $locale->text('Project Number') . qq| + + + + + + diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 0d0d80131..b0e013c02 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -781,6 +781,14 @@ print qq| $openclosed $employee $ordnumber + + | . $locale->text('Project Number') . qq| + + + + + + diff --git a/locale/de/cn b/locale/de/cn index 402c50cec..3a1fc6132 100644 --- a/locale/de/cn +++ b/locale/de/cn @@ -241,6 +241,7 @@ $self->{subs} = { 'post' => 'post', 'post_as_new' => 'post_as_new', 'prepare_credit_note' => 'prepare_credit_note', + 'preset_projectnumber' => 'preset_projectnumber', 'preview' => 'preview', 'print' => 'print', 'print_and_post' => 'print_and_post', diff --git a/locale/de/dn b/locale/de/dn index fe1aa2a9c..2ac021613 100644 --- a/locale/de/dn +++ b/locale/de/dn @@ -228,6 +228,7 @@ $self->{subs} = { 'order' => 'order', 'part_selection_internal' => 'part_selection_internal', 'post_as_new' => 'post_as_new', + 'preset_projectnumber' => 'preset_projectnumber', 'print' => 'print', 'print_dunning' => 'print_dunning', 'print_form' => 'print_form', diff --git a/locale/de/ic b/locale/de/ic index 3e9677326..891b360a5 100644 --- a/locale/de/ic +++ b/locale/de/ic @@ -279,6 +279,7 @@ $self->{subs} = { 'parts_language_selection' => 'parts_language_selection', 'parts_subtotal' => 'parts_subtotal', 'post_as_new' => 'post_as_new', + 'preset_projectnumber' => 'preset_projectnumber', 'price_row' => 'price_row', 'print' => 'print', 'print_form' => 'print_form', diff --git a/locale/de/io b/locale/de/io index e8fc49d04..66fce0894 100644 --- a/locale/de/io +++ b/locale/de/io @@ -162,6 +162,7 @@ $self->{subs} = { 'order' => 'order', 'part_selection_internal' => 'part_selection_internal', 'post_as_new' => 'post_as_new', + 'preset_projectnumber' => 'preset_projectnumber', 'print' => 'print', 'print_form' => 'print_form', 'print_options' => 'print_options', diff --git a/locale/de/ir b/locale/de/ir index 2e14867dd..a51700992 100644 --- a/locale/de/ir +++ b/locale/de/ir @@ -236,6 +236,7 @@ $self->{subs} = { 'post_as_new' => 'post_as_new', 'post_payment' => 'post_payment', 'prepare_invoice' => 'prepare_invoice', + 'preset_projectnumber' => 'preset_projectnumber', 'print' => 'print', 'print_form' => 'print_form', 'print_options' => 'print_options', diff --git a/locale/de/is b/locale/de/is index cd4ca7f25..df8420f4c 100644 --- a/locale/de/is +++ b/locale/de/is @@ -262,6 +262,7 @@ $self->{subs} = { 'post_as_new' => 'post_as_new', 'post_payment' => 'post_payment', 'prepare_invoice' => 'prepare_invoice', + 'preset_projectnumber' => 'preset_projectnumber', 'preview' => 'preview', 'print' => 'print', 'print_and_post' => 'print_and_post', diff --git a/locale/de/oe b/locale/de/oe index 52db95a52..beaa440f9 100644 --- a/locale/de/oe +++ b/locale/de/oe @@ -279,6 +279,7 @@ $self->{subs} = { 'poso' => 'poso', 'post_as_new' => 'post_as_new', 'prepare_order' => 'prepare_order', + 'preset_projectnumber' => 'preset_projectnumber', 'print' => 'print', 'print_form' => 'print_form', 'print_options' => 'print_options', diff --git a/sql/Pg-upgrade2/globalprojectnumber_ap_ar_oe.sql b/sql/Pg-upgrade2/globalprojectnumber_ap_ar_oe.sql new file mode 100644 index 000000000..932cad4d2 --- /dev/null +++ b/sql/Pg-upgrade2/globalprojectnumber_ap_ar_oe.sql @@ -0,0 +1,9 @@ +-- @tag: globalprojectnumber_ap_ar_oe +-- @description: Neue Spalte für eine globale Projektnummer in Einkaufs- und Verkaufsbelegen +-- @depends: release_2_4_1 +ALTER TABLE ap ADD COLUMN globalproject_id integer; +ALTER TABLE ap ADD FOREIGN KEY (globalproject_id) REFERENCES project (id); +ALTER TABLE ar ADD COLUMN globalproject_id integer; +ALTER TABLE ar ADD FOREIGN KEY (globalproject_id) REFERENCES project (id); +ALTER TABLE oe ADD COLUMN globalproject_id integer; +ALTER TABLE oe ADD FOREIGN KEY (globalproject_id) REFERENCES project (id);