[freeside-commits] branch FREESIDE_4_BRANCH updated. a93d85b710311eeaeb5cb6f5e987ee3f8e0a1c81

Jonathan Prykop jonathan at 420.am
Tue Nov 10 21:34:41 PST 2015


The branch, FREESIDE_4_BRANCH has been updated
       via  a93d85b710311eeaeb5cb6f5e987ee3f8e0a1c81 (commit)
       via  0e1e72497fe8a045631f1f060ea63b506df3d238 (commit)
      from  ea7ad838b493e85a9d6cf070903e8ffedbe2c33b (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 a93d85b710311eeaeb5cb6f5e987ee3f8e0a1c81
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Nov 10 23:20:55 2015 -0600

    RT#38597: OQM - svc Circuit use and setup [fixed sql quoting]

diff --git a/FS/FS/svc_circuit.pm b/FS/FS/svc_circuit.pm
index 408bd79..1a42efa 100644
--- a/FS/FS/svc_circuit.pm
+++ b/FS/FS/svc_circuit.pm
@@ -6,7 +6,7 @@ use base qw(
   FS::MAC_Mixin
   FS::svc_Common
 );
-use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( dbh qsearch qsearchs );
 use FS::circuit_provider;
 use FS::circuit_type;
 use FS::circuit_termination;
@@ -221,9 +221,9 @@ sub label {
 sub search_sql {
   my ($class, $string) = @_;
   my @where = ();
-  push @where, 'LOWER(svc_circuit.circuit_id) = \''.lc($string).'\'';
-  push @where, 'LOWER(circuit_provider.provider) = \''.lc($string).'\'';
-  push @where, 'LOWER(circuit_type.typename) = \''.lc($string).'\'';
+  push @where, 'LOWER(svc_circuit.circuit_id) = ' . dbh->quote($string);
+  push @where, 'LOWER(circuit_provider.provider) = ' . dbh->quote($string);
+  push @where, 'LOWER(circuit_type.typename) = ' . dbh->quote($string);
   '(' . join(' OR ', @where) . ')';
 }
 

commit 0e1e72497fe8a045631f1f060ea63b506df3d238
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Sat Oct 31 01:26:07 2015 -0500

    RT#38597: OQM - svc Circuit use and setup

diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm
index 974af67..376ef02 100644
--- a/FS/FS/cust_svc.pm
+++ b/FS/FS/cust_svc.pm
@@ -1205,9 +1205,10 @@ sub smart_search_param {
   my @or = 
       map { my $table = $_;
             my $search_sql = "FS::$table"->search_sql($string);
+            my $addl_from = "FS::$table"->search_sql_addl_from();
 
             "SELECT $table.svcnum AS svcnum, '$table' AS svcdb ".
-            "FROM $table WHERE $search_sql";
+            "FROM $table $addl_from WHERE $search_sql";
           }
       FS::part_svc->svc_tables;
 
diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm
index 355c383..35415a2 100644
--- a/FS/FS/svc_Common.pm
+++ b/FS/FS/svc_Common.pm
@@ -1349,6 +1349,9 @@ sub search_sql {
   #my( $class, $string ) = @_;
   '1 = 0'; #false
 }
+sub search_sql_addl_from {
+  '';
+}
 
 =item search HASHREF
 
diff --git a/FS/FS/svc_circuit.pm b/FS/FS/svc_circuit.pm
index f705c68..408bd79 100644
--- a/FS/FS/svc_circuit.pm
+++ b/FS/FS/svc_circuit.pm
@@ -218,6 +218,20 @@ sub label {
   $self->get('circuit_id');
 }
 
+sub search_sql {
+  my ($class, $string) = @_;
+  my @where = ();
+  push @where, 'LOWER(svc_circuit.circuit_id) = \''.lc($string).'\'';
+  push @where, 'LOWER(circuit_provider.provider) = \''.lc($string).'\'';
+  push @where, 'LOWER(circuit_type.typename) = \''.lc($string).'\'';
+  '(' . join(' OR ', @where) . ')';
+}
+
+sub search_sql_addl_from {
+  'LEFT JOIN circuit_provider USING ( providernum ) '.
+  'LEFT JOIN circuit_type USING ( typenum )';
+}
+
 =back
 
 =head1 SEE ALSO
diff --git a/httemplate/elements/tr-cust_svc.html b/httemplate/elements/tr-cust_svc.html
index 03de3ba..2d1a9e6 100644
--- a/httemplate/elements/tr-cust_svc.html
+++ b/httemplate/elements/tr-cust_svc.html
@@ -38,6 +38,10 @@ Usage:
       <% FS::UI::Web::svc_label_link($m, $part_svc, $cust_svc) %>
 %   }
     </B>
+%   if ($part_svc->svcdb eq 'svc_circuit') {
+      <BR>Provider: <% $svc_x->circuit_provider->provider %>
+      <BR>Type: <% $svc_x->circuit_type->typename %>
+%   }
 %   if ( $opt{after_svc_callback} ) {
       <% &{ $opt{after_svc_callback} }( $cust_svc ) %>
 %   }

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

Summary of changes:
 FS/FS/cust_svc.pm                    |    3 ++-
 FS/FS/svc_Common.pm                  |    3 +++
 FS/FS/svc_circuit.pm                 |   16 +++++++++++++++-
 httemplate/elements/tr-cust_svc.html |    4 ++++
 4 files changed, 24 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list