From 1465da30be12244675541d59b22e94a0f90e0b33 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Sven=20Sch=C3=B6ling?= <s.schoeling@linet-services.de>
Date: Thu, 10 Dec 2009 11:02:01 +0100
Subject: [PATCH] =?utf8?q?=C3=84nderungen=20zum=20vorherigen=20Commit,=20u?=
 =?utf8?q?m=20die=20Funktionen=20rouster=20zu=20machen.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 SL/IS.pm          | 32 --------------------------------
 SL/OE.pm          | 33 +++++++++++++++++++++++++++++++++
 bin/mozilla/is.pl |  3 ++-
 3 files changed, 35 insertions(+), 33 deletions(-)

diff --git a/SL/IS.pm b/SL/IS.pm
index 3b0e15666..7c923b0dd 100644
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -1954,38 +1954,6 @@ sub retrieve_item {
   $main::lxdebug->leave_sub();
 }
 
-##########################
-# Get data for the submitted order id
-# from database
-#
-sub get_order_data {
-
-  $main::lxdebug->enter_sub();
-
-  my $self      = shift;
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $dbh      = $form->get_standard_dbh();
-
-  my @values = (conv_i($form->{ordnumber}));
-
-  # We query the database for the fields we need using the submitted "ordnumber"
-  my $query = <<SQL;
-    SELECT o.payment_id, o.salesman_id, o.transdate AS orddate, o.taxzone_id, o.quonumber
-    FROM oe o
-    WHERE o.ordnumber = ?;
-SQL
-
-  # Do the actual query and return the results for later processing by our "frontend"
-  my ($result) = selectfirst_hashref_query($form, $dbh, $query, @values);
-
-  $dbh->disconnect;
-
-  $main::lxdebug->leave_sub();
-
-  return $result;
-}
-
 ##########################
 # get pricegroups from database
 # build up selected pricegroup
diff --git a/SL/OE.pm b/SL/OE.pm
index 1bf8a719a..3f7dbaa75 100644
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -1307,4 +1307,37 @@ sub project_description {
   return $value;
 }
 
+##########################
+# Get data for the submitted order id
+# from database
+#
+sub get_order_data_by_ordnumber {
+  $main::lxdebug->enter_sub();
+
+  my $self      = shift;
+  my %params    = @_;
+
+  Common::check_params(\%params, qw(ordnumber));
+
+  my $form     = $main::form;
+  my %myconfig = %main::myconfig;
+  my $dbh      = $form->get_standard_dbh();
+
+  my @values = ($params{ordnumber});
+
+  # We query the database for the fields we need using the submitted "ordnumber"
+  my $query = <<SQL;
+    SELECT o.payment_id, o.salesman_id, o.transdate AS orddate, o.taxzone_id, o.quonumber
+    FROM oe o
+    WHERE o.ordnumber = ?;
+SQL
+
+  # Do the actual query and return the results for later processing by our "frontend"
+  my $result = selectfirst_hashref_query($form, $dbh, $query, @values);
+
+  $main::lxdebug->leave_sub();
+
+  return $result;
+}
+
 1;
diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl
index ad0c99080..aa75ebe25 100644
--- a/bin/mozilla/is.pl
+++ b/bin/mozilla/is.pl
@@ -34,6 +34,7 @@
 use SL::FU;
 use SL::IS;
 use SL::PE;
+use SL::OE;
 use Data::Dumper;
 use List::Util qw(max sum);
 
@@ -156,7 +157,7 @@ sub invoice_links {
   }
 
   # Load data for a specific order and update form fields
-  my $order_data = IS->get_order_data();
+  my $order_data = OE->get_order_data_by_ordnumber(%$form);
 
   # Copy the fields we need to %form
   for my $key (qw(payment_id salesman_id orddate taxzone_id quonumber)) {
-- 
2.20.1