change calculation method for prepaid income report, #13289
[freeside.git] / FS / FS / cust_pkg.pm
index 1cca10b..1d4a90c 100644 (file)
@@ -972,7 +972,16 @@ sub uncancel {
     my $svc_error = $svc_x->insert;
     if ( $svc_error && $options{svc_fatal} ) {
       $dbh->rollback if $oldAutoCommit;
-      return $error;
+      return $svc_error;
+    } else {
+      my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $svc_x->svcnum });
+      if ( $cust_svc ) {
+        my $cs_error = $cust_svc->delete;
+        if ( $cs_error ) {
+          $dbh->rollback if $oldAutoCommit;
+          return $cs_error;
+        }
+      }
     }
     push @svc_errors, $svc_error if $svc_error;
   }
@@ -3682,7 +3691,7 @@ sub _location_sql_where {
 
 #        ( $table.${prefix}city    = ? $or_empty_city   $ornull )
   "
-        ( $table.${prefix}district = ? OR ? = '' OR CAST(? AS text) IS NULL )
+        ( $table.district = ? OR ? = '' OR CAST(? AS text) IS NULL )
     AND ( $table.${prefix}city     = ? OR ? = '' OR CAST(? AS text) IS NULL )
     AND ( $table.${prefix}county   = ? $or_empty_county $ornull )
     AND ( $table.${prefix}state    = ? $or_empty_state  $ornull )