From: Ivan Kohler Date: Fri, 30 May 2014 21:04:09 +0000 (-0700) Subject: MySQL support, RT#28895 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=dba6b1030a2694cbb69371c171e4ebb8c52db830 MySQL support, RT#28895 --- diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 72147b3a1..4e67cf7ad 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 3c972d0bd..7339d74f7 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 7e6819a3d..4fbd89ca2 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 b2cd3db49..5b94c4775 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 bbfc1a670..02362db6a 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 00c9adde1..fa3838dcf 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 406895ed9..151d3ba65 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;