[freeside-commits] branch master updated. c9860506278274605e76c1a8c18084db134d7409

Carl J. Adams-Collier cjac at 420.am
Mon Sep 8 14:39:48 PDT 2014


The branch, master has been updated
       via  c9860506278274605e76c1a8c18084db134d7409 (commit)
      from  b853ec09fb19df91fe0188c5dde9d759333a2503 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c9860506278274605e76c1a8c18084db134d7409
Author: C.J. Adams-Collier <cjac at colliertech.org>
Date:   Mon Sep 8 14:14:20 2014 -0700

    moved WHERE/AND logic in to calling code.  FS RT #884

diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 1b7ac8a..c53c9ae 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -402,26 +402,7 @@ sub qsearch {
         get_real_fields($table, $record, \@real_fields));
     }
 
-    if( defined($extra_sql) ){
-      if( $statement =~ /\sWHERE\s/i ){
-	if( $extra_sql =~ /^\s*AND /i ){
-	  # correct format
-	}elsif($extra_sql =~ /^\s*WHERE /i ){
-	  $extra_sql =~ s/WHERE /AND /i;
-	}else{
-	  $extra_sql = " AND $extra_sql";
-	}
-      }else{
-	if( $extra_sql =~ /^\s*AND /i ){
-	  $extra_sql =~ s/AND /WHERE /i;
-	}elsif($extra_sql =~ /^\s*WHERE /i ){
-	  # correct format
-	}else{
-	  $extra_sql = " WHERE $extra_sql";
-	}
-      }
-      $statement .= " $extra_sql";
-    }
+    $statement .= " $extra_sql" if defined($extra_sql);
     $statement .= " $order_by"  if defined($order_by);
 
     push @statement, $statement;
diff --git a/httemplate/graph/signupdate.cgi b/httemplate/graph/signupdate.cgi
index 011817c..8261257 100644
--- a/httemplate/graph/signupdate.cgi
+++ b/httemplate/graph/signupdate.cgi
@@ -43,8 +43,9 @@ my $edate = DateTime->new(
     month      => $cgi->param('end_month')
 )->add( months => 1 )->epoch();
 
-my $where .= " AND signupdate >= $sdate ".
-             " AND signupdate < $edate ";
+my $where = (%where ? ' AND ' : ' WHERE ');
+$where .= " signupdate >= $sdate ".
+          " AND signupdate < $edate ";
 
 foreach my $cust (qsearch({ table   => 'cust_main',
                             hashref => \%where,

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Record.pm                 |   21 +--------------------
 httemplate/graph/signupdate.cgi |    5 +++--
 2 files changed, 4 insertions(+), 22 deletions(-)




More information about the freeside-commits mailing list