=== modified file 'shipping/uc_ups/uc_ups.module'
--- shipping/uc_ups/uc_ups.module	2009-02-12 15:33:59 +0000
+++ shipping/uc_ups/uc_ups.module	2009-03-10 20:18:56 +0000
@@ -323,6 +323,18 @@
   $shipfrom_country = $shipfrom_country[0]['country_iso_code_2'];
   $shipfrom_zip = $origin->postal_code;
 
+  $ups_units = variable_get('uc_ups_unit_system', variable_get('uc_length_unit', 'in'));
+  switch ($ups_units) {
+    case 'in':
+      $units = 'LBS';
+      $unit_name = 'Pounds';
+      break;
+    case 'cm':
+      $units = 'KGS';
+      $unit_name = 'Kilograms';
+      break;
+  }
+
   $shipment_weight = 0;
   $package_schema = '';
   foreach ($packages as $package) {
@@ -349,17 +361,13 @@
           $package_schema .= "</Dimensions>";
         }
         $size = $package->length * $conversion + 2 * $conversion * ($package->width + $package->height);
-        switch (variable_get('uc_ups_unit_system', variable_get('uc_length_unit', 'in'))) {
+        switch ($ups_units) {
           case 'in':
-            $units = 'LBS';
-            $unit_name = 'Pounds';
             $conversion = uc_weight_conversion($package->weight_units, 'lb');
-          break;
+            break;
           case 'cm':
-            $units = 'KGS';
-            $unit_name = 'Kilograms';
             $conversion = uc_weight_conversion($package->weight_units, 'kg');
-          break;
+            break;
         }
         $weight = max(1, $package->weight * $conversion);
         $shipment_weight += $weight;
@@ -433,7 +441,8 @@
     </ShipFrom>
     <ShipmentWeight>
       <UnitOfMeasurement>
-        <Code>LBS</Code>
+        <Code>$units</Code>
+        <Description>$unit_name</Description>
       </UnitOfMeasurement>
       <Weight>". number_format($shipment_weight, 1, '.', '') ."</Weight>
     </ShipmentWeight>
@@ -504,7 +513,8 @@
   $shipfrom_country = $shipfrom_country[0]['country_iso_code_2'];
   $shipfrom_zip = $origin->postal_code;
 
-  //$shipment_weight = 0;
+  $ups_units = variable_get('uc_ups_unit_system', variable_get('uc_length_unit', 'in'));
+
   $package_schema = '';
   foreach ($packages as $package) {
     $qty = $package->qty;
@@ -513,7 +523,6 @@
       $package_schema .= "<Package>";
         $package_schema .= "<PackagingType>";
           $package_schema .= "<Code>". $package_type['code'] ."</Code>";
-          //$package_schema .= "<Description>". $package_type['description'] ."</Description>";
         $package_schema .= "</PackagingType>";
         if ($package->pkg_type == '02' && $package->length && $package->width && $package->height) {
           if ($package->length < $package->width) {
@@ -530,20 +539,15 @@
           $package_schema .= "</Dimensions>";
         }
         $size = $package->length * $conversion + 2 * $conversion * ($package->width + $package->height);
-        switch (variable_get('uc_ups_unit_system', variable_get('uc_length_unit', 'in'))) {
+        switch ($ups_units) {
           case 'in':
-            $units = 'LBS';
-            $unit_name = 'Pounds';
-            $conversion = constant(strtoupper($package->weight_units) .'_TO_LB');
-          break;
+            $conversion = uc_weight_conversion($package->weight_units, 'lb');
+            break;
           case 'cm':
-            $units = 'KGS';
-            $unit_name = 'Kilograms';
-            $conversion = constant(strtoupper($package->weight_units) .'_TO_KG');
-          break;
+            $conversion = uc_weight_conversion($package->weight_units, 'kg');
+            break;
         }
         $weight = $package->weight * $conversion;
-        //$shipment_weight += $weight;
         $package_schema .= "<PackageWeight>";
           $package_schema .= "<UnitOfMeasurement>";
             $package_schema .= "<Code>$units</Code>";
@@ -650,12 +654,6 @@
       $schema .= "<Code>{$service[code]}</Code>";
       $schema .= "<Description>{$service[description]}</Description>";
     $schema .= "</Service>";
-    /* $schema .= "<ShipmentWeight>";
-      $schema .= "<UnitOfMeasurement>";
-        $schema .= "<Code>LBS</Code>";
-      $schema .= "</UnitOfMeasurement>";
-      $schema .= "<Weight>". number_format($shipment_weight, 1, '.', '') ."</Weight>";
-    $schema .= "</ShipmentWeight>"; */
     $schema .= $package_schema;
   $schema .= "</Shipment>";
   $schema .= "<LabelSpecification>";

