[freeside-commits] branch master updated. dba6b1030a2694cbb69371c171e4ebb8c52db830

Ivan ivan at 420.am
Fri May 30 14:04:10 PDT 2014


The branch, master has been updated
       via  dba6b1030a2694cbb69371c171e4ebb8c52db830 (commit)
      from  5700d83bcd475134cff8afb28307174c09116924 (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 dba6b1030a2694cbb69371c171e4ebb8c52db830
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri May 30 14:04:09 2014 -0700

    MySQL support, RT#28895

diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 72147b3..4e67cf7 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -4548,16 +4548,16 @@ sub tables_hashref {
 
     'tower_sector' => {
       'columns' => [
-        'sectornum',   'serial',     '',      '', '', '',
-        'towernum',       'int',     '',      '', '', '',
-        'sectorname', 'varchar',     '', $char_d, '', '',
-        'ip_addr',    'varchar', 'NULL',      15, '', '',
-        'height',     'decimal', 'NULL',      '', '', '', 
-        'freq_mhz',       'int', 'NULL',      '', '', '',
-        'direction',      'int', 'NULL',      '', '', '',
-        'width',          'int', 'NULL',      '', '', '',
+        'sectornum',     'serial',     '',      '', '', '',
+        'towernum',         'int',     '',      '', '', '',
+        'sectorname',   'varchar',     '', $char_d, '', '',
+        'ip_addr',      'varchar', 'NULL',      15, '', '',
+        'height',       'decimal', 'NULL',      '', '', '', 
+        'freq_mhz',         'int', 'NULL',      '', '', '',
+        'direction',        'int', 'NULL',      '', '', '',
+        'width',            'int', 'NULL',      '', '', '',
         #downtilt etc? rfpath has profile files for devices/antennas you upload?
-        'range',      'decimal', 'NULL',      '', '', '',  #?
+        'sector_range', 'decimal', 'NULL',      '', '', '',  #?
       ],
       'primary_key'  => 'sectornum',
       'unique'       => [ [ 'towernum', 'sectorname' ], [ 'ip_addr' ], ],
diff --git a/FS/FS/TicketSystem.pm b/FS/FS/TicketSystem.pm
index 3c972d0..7339d74 100644
--- a/FS/FS/TicketSystem.pm
+++ b/FS/FS/TicketSystem.pm
@@ -331,16 +331,24 @@ sub _upgrade_data {
     }
   }
 
-  #Pg-specific 
-  my $cve_2013_3373_sql = q(
-    UPDATE Tickets SET Subject = REPLACE(Subject,E'\n','')
-  );
-  #need this for mysql
-  #UPDATE Tickets SET Subject = REPLACE(Subject,'\n','');
-
-  my $cve_2013_3373_sth = $dbh->prepare( $cve_2013_3373_sql)
-    or die $dbh->errstr;
-  $cve_2013_3373_sth->execute or die $cve_2013_3373_sth->errstr;
+  my $cve_2013_3373_sql = '';
+  if ( driver_name =~ /^Pg/i ) {
+    $cve_2013_3373_sql = q(
+      UPDATE Tickets SET Subject = REPLACE(Subject,E'\n','')
+    );
+  } elsif ( driver_name =~ /^mysql/i ) {
+    $cve_2013_3373_sql = q(
+      UPDATE Tickets SET Subject = REPLACE(Subject,'\n','');
+    );
+  } else {
+    warn "WARNING: Don't know how to update RT Ticket Subjects for your database driver for CVE-2013-3373";
+  }
+  if ( $cve_2013_3373_sql ) {
+    my $cve_2013_3373_sth = $dbh->prepare($cve_2013_3373_sql)
+      or die $dbh->errstr;
+    $cve_2013_3373_sth->execute
+      or die $cve_2013_3373_sth->errstr;
+  }
 
   # Remove dangling customer links, if any
   my %target_pkey = ('cust_main' => 'custnum', 'cust_svc' => 'svcnum');
diff --git a/FS/FS/tower_sector.pm b/FS/FS/tower_sector.pm
index 7e6819a..4fbd89c 100644
--- a/FS/FS/tower_sector.pm
+++ b/FS/FS/tower_sector.pm
@@ -109,7 +109,7 @@ sub check {
     || $self->ut_numbern('freq_mhz')
     || $self->ut_numbern('direction')
     || $self->ut_numbern('width')
-    || $self->ut_floatn('range')
+    || $self->ut_floatn('sector_range')
   ;
   return $error if $error;
 
diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade
index b2cd3db..5b94c47 100755
--- a/FS/bin/freeside-upgrade
+++ b/FS/bin/freeside-upgrade
@@ -94,10 +94,18 @@ if ( dbdef->table('areacode') and
 }
 
 if ( dbdef->table('upgrade_journal') ) {
-  push @bugfix, "SELECT SETVAL( 'upgrade_journal_upgradenum_seq',
-                                ( SELECT MAX(upgradenum) FROM upgrade_journal )
-                              )
-                ";
+  if ( driver_name =~ /^Pg/i ) {
+    push @bugfix, "
+      SELECT SETVAL( 'upgrade_journal_upgradenum_seq',
+                     ( SELECT MAX(upgradenum) FROM upgrade_journal )
+                   )
+    ";
+  } elsif ( driver_name =~ /^mysql/i ) {
+    push @bugfix, "
+       ALTER TABLE upgrade_journal AUTO_INCREMENT =
+                   ( ( SELECT MAX(upgradenum) FROM upgrade_journal ) + 1 )
+    ";
+  }
 }
 
 if ( $DRY_RUN ) {
diff --git a/httemplate/edit/process/tower.html b/httemplate/edit/process/tower.html
index bbfc1a6..02362db 100644
--- a/httemplate/edit/process/tower.html
+++ b/httemplate/edit/process/tower.html
@@ -2,6 +2,9 @@
     table       => 'tower',
     viewall_dir => 'browse',
     process_o2m => { 'table'  => 'tower_sector',
-                     'fields' => [qw( sectorname ip_addr height freq_mhz direction width range )],
+                     'fields' => [qw(
+                       sectorname ip_addr height freq_mhz direction width
+                       sector_range
+                     )],
                    },
 &>
diff --git a/httemplate/edit/tower.html b/httemplate/edit/tower.html
index 00c9add..fa3838d 100644
--- a/httemplate/edit/tower.html
+++ b/httemplate/edit/tower.html
@@ -37,7 +37,10 @@
 my $m2_error_callback = sub { # reconstruct the list
   my ($cgi, $object) = @_;
 
-  my @fields = qw( sectorname ip_addr height freq_mhz direction width range );
+  my @fields = qw(
+    sectorname ip_addr height freq_mhz direction width sector_range
+  );
+
   map {
     my $k = $_;
     new FS::tower_sector {
diff --git a/httemplate/elements/tower_sector.html b/httemplate/elements/tower_sector.html
index 406895e..151d3ba 100644
--- a/httemplate/elements/tower_sector.html
+++ b/httemplate/elements/tower_sector.html
@@ -51,13 +51,13 @@ if ( $curr_value ) {
 my %size = ( 'title' => 12 );
 
 tie my %label, 'Tie::IxHash',
-  'sectorname' => 'Name',
-  'ip_addr'    => 'IP Address',
-  'height'     => 'Height',
-  'freq_mhz'   => 'Freq. (MHz)',
-  'direction'  => 'Direction', # or a button to set these to 0 for omni
-  'width'      => 'Width',     #
-  'range'      => 'Range',
+  'sectorname'   => 'Name',
+  'ip_addr'      => 'IP Address',
+  'height'       => 'Height',
+  'freq_mhz'     => 'Freq. (MHz)',
+  'direction'    => 'Direction', # or a button to set these to 0 for omni
+  'width'        => 'Width',     #
+  'sector_range' => 'Range',
 ;
 
 my @fields = keys %label;

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

Summary of changes:
 FS/FS/Schema.pm                       |   18 +++++++++---------
 FS/FS/TicketSystem.pm                 |   28 ++++++++++++++++++----------
 FS/FS/tower_sector.pm                 |    2 +-
 FS/bin/freeside-upgrade               |   16 ++++++++++++----
 httemplate/edit/process/tower.html    |    5 ++++-
 httemplate/edit/tower.html            |    5 ++++-
 httemplate/elements/tower_sector.html |   14 +++++++-------
 7 files changed, 55 insertions(+), 33 deletions(-)




More information about the freeside-commits mailing list