Globale Projektnummer in Einkaufs- und Verkaufsbelegen.
authorMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 20 Feb 2007 09:07:57 +0000 (09:07 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 20 Feb 2007 09:07:57 +0000 (09:07 +0000)
14 files changed:
SL/OE.pm
bin/mozilla/ar.pl
bin/mozilla/arap.pl
bin/mozilla/ir.pl
bin/mozilla/is.pl
bin/mozilla/oe.pl
locale/de/cn
locale/de/dn
locale/de/ic
locale/de/io
locale/de/ir
locale/de/is
locale/de/oe
sql/Pg-upgrade2/globalprojectnumber_ap_ar_oe.sql [new file with mode: 0644]

index 210a87c..1967fc0 100644 (file)
--- 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}|
index 4634cb1..45c0b59 100644 (file)
@@ -531,7 +531,7 @@ sub form_header {
                <th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
                 $button2
              </tr>
-           </table>
+     </table>
          </td>
        </tr>
       </table>
index 534a702..48cb610 100644 (file)
@@ -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|<th>&nbsp;</th>|;
@@ -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|
+<input type="hidden" name="is_global" value="$is_global">
 <input type=hidden name=nextsub value=project_selected>
 
 <br>
@@ -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} };
index 0f9c295..1b99f5f 100644 (file)
@@ -455,7 +455,15 @@ sub form_header {
           <td><input name="quodate" id="quodate" size="11" title="$myconfig{dateformat}" value="| . Q($form->{quodate}) . qq|"></td>
           <td><input type="button" name="b_quodate" id="trigger_quodate" value="?"></td>
         </tr>
-           </table>
+             <tr>
+          <th align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
+          <td>
+            <input name="globalprojectnumber" size="11" value="| . Q($form->{globalprojectnumber}) . qq|">
+            <input type="hidden" name="oldglobalprojectnumber" value="| . Q($form->{globalprojectnumber}) . qq|">
+            <input type="hidden" name="globalproject_id" value="| . Q($form->{globalproject_id}) . qq|">
+          </td:>
+             </tr>
+     </table>
          </td>
        </tr>
       </table>
index e29ca4c..3b298f1 100644 (file)
@@ -741,6 +741,14 @@ print qq|     <tr>
                <th align=right nowrap>| . $locale->text('Customer Order Number') . qq|</th>
                <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
              </tr>
+             <tr>
+          <th align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
+          <td>
+            <input name="globalprojectnumber" size="11" value="| . Q($form->{globalprojectnumber}) . qq|">
+            <input type="hidden" name="oldglobalprojectnumber" value="| . Q($form->{globalprojectnumber}) . qq|">
+            <input type="hidden" name="globalproject_id" value="| . Q($form->{globalproject_id}) . qq|">
+          </td>
+             </tr>
            </table>
           </td>
        </tr>
index 0d0d801..b0e013c 100644 (file)
@@ -781,6 +781,14 @@ print qq|      </table>
              $openclosed
              $employee
              $ordnumber
+             <tr>
+          <th width="70%" align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
+          <td>
+            <input name="globalprojectnumber" size="11" value="| . Q($form->{globalprojectnumber}) . qq|">
+            <input type="hidden" name="oldglobalprojectnumber" value="| . Q($form->{globalprojectnumber}) . qq|">
+            <input type="hidden" name="globalproject_id" value="| . Q($form->{globalproject_id}) . qq|">
+          </td>
+             </tr>
            </table>
          </td>
        </tr>
index 402c50c..3a1fc61 100644 (file)
@@ -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',
index fe1aa2a..2ac0216 100644 (file)
@@ -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',
index 3e96773..891b360 100644 (file)
@@ -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',
index e8fc49d..66fce08 100644 (file)
@@ -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',
index 2e14867..a517009 100644 (file)
@@ -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',
index cd4ca7f..df8420f 100644 (file)
@@ -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',
index 52db95a..beaa440 100644 (file)
@@ -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 (file)
index 0000000..932cad4
--- /dev/null
@@ -0,0 +1,9 @@
+-- @tag: globalprojectnumber_ap_ar_oe
+-- @description: Neue Spalte f&uuml;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);