X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_acct.pm;h=6aede58e811721dd62d3c45245f73d609f25bf27;hb=abdb0f8539d8604b3e1ba6218e36a8717e96f88d;hp=509384170c4c9fb2f24b2ccbd6dddfea283e2677;hpb=7a8c7b6f64ac14d555d866f93300e64c47b74a98;p=freeside.git diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 509384170..6aede58e8 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -1,7 +1,8 @@ package FS::svc_acct; use strict; -use base qw( FS::svc_Domain_Mixin FS::svc_Common ); +use base qw( FS::svc_Domain_Mixin FS::svc_CGP_Mixin FS::svc_CGPRule_Mixin + FS::svc_Common ); use vars qw( $DEBUG $me $conf $skip_fuzzyfiles $dir_prefix @shells $usernamemin $usernamemax $passwordmin $passwordmax @@ -463,71 +464,9 @@ sub table_info { disable_select => 1, }, 'cgp_timezone' => { - label => 'Communigate time zone', - type => 'select', - select_list => [ '', - 'HostOS', - '(+0100) Algeria/Congo', - '(+0200) Egypt/South Africa', - '(+0300) Saudi Arabia', - '(+0400) Oman', - '(+0500) Pakistan', - '(+0600) Bangladesh', - '(+0700) Thailand/Vietnam', - '(+0800) China/Malaysia', - '(+0900) Japan/Korea', - '(+1000) Queensland', - '(+1100) Micronesia', - '(+1200) Fiji', - '(+1300) Tonga/Kiribati', - '(+1400) Christmas Islands', - '(-0100) Azores/Cape Verde', - '(-0200) Fernando de Noronha', - '(-0300) Argentina/Uruguay', - '(-0400) Venezuela/Guyana', - '(-0500) Haiti/Peru', - '(-0600) Central America', - '(-0700) Arisona', - '(-0800) Adamstown', - '(-0900) Marquesas Islands', - '(-1000) Hawaii/Tahiti', - '(-1100) Samoa', - 'Asia/Afghanistan', - 'Asia/India', - 'Asia/Iran', - 'Asia/Iraq', - 'Asia/Israel', - 'Asia/Jordan', - 'Asia/Lebanon', - 'Asia/Syria', - 'Australia/Adelaide', - 'Australia/East', - 'Australia/NorthernTerritory', - 'Europe/Central', - 'Europe/Eastern', - 'Europe/Moscow', - 'Europe/Western', - 'GMT (+0000)', - 'Newfoundland', - 'NewZealand/Auckland', - 'NorthAmerica/Alaska', - 'NorthAmerica/Atlantic', - 'NorthAmerica/Central', - 'NorthAmerica/Eastern', - 'NorthAmerica/Mountain', - 'NorthAmerica/Pacific', - 'Russia/Ekaterinburg', - 'Russia/Irkutsk', - 'Russia/Kamchatka', - 'Russia/Krasnoyarsk', - 'Russia/Magadan', - 'Russia/Novosibirsk', - 'Russia/Vladivostok', - 'Russia/Yakutsk', - 'SouthAmerica/Brasil', - 'SouthAmerica/Chile', - 'SouthAmerica/Paraguay', - ], + label => 'Communigate time zone', + type => 'select', + select_list => __PACKAGE__->cgp_timezone, disable_inventory => 1, disable_select => 1, }, @@ -1228,6 +1167,10 @@ sub check { || $self->ut_snumbern('upbytes') || $self->ut_snumbern('downbytes') || $self->ut_snumbern('totalbytes') + || $self->ut_snumbern('seconds_threshold') + || $self->ut_snumbern('upbytes_threshold') + || $self->ut_snumbern('downbytes_threshold') + || $self->ut_snumbern('totalbytes_threshold') || $self->ut_enum('_password_encoding', ['',qw(plain crypt ldap)]) || $self->ut_enum('password_selfchange', [ '', 'Y' ]) || $self->ut_enum('password_recover', [ '', 'Y' ]) @@ -2283,7 +2226,7 @@ sub set_usage { my $reset = 0; my %handyhash = (); if ( $options{null} ) { - %handyhash = ( map { ( $_ => 'NULL', $_."_threshold" => 'NULL' ) } + %handyhash = ( map { ( $_ => undef, $_."_threshold" => undef ) } qw( seconds upbytes downbytes totalbytes ) ); } @@ -2305,7 +2248,7 @@ sub set_usage { #die $error if $error; #services not explicity changed via the UI my $sql = "UPDATE svc_acct SET " . - join (',', map { "$_ = $handyhash{$_}" } (keys %handyhash) ). + join (',', map { "$_ = ?" } (keys %handyhash) ). " WHERE svcnum = ". $self->svcnum; warn "$me $sql\n" @@ -2314,7 +2257,7 @@ sub set_usage { if (scalar(keys %handyhash)) { my $sth = $dbh->prepare( $sql ) or die "Error preparing $sql: ". $dbh->errstr; - my $rv = $sth->execute(); + my $rv = $sth->execute(values %handyhash); die "Error executing $sql: ". $sth->errstr unless defined($rv); die "Can't update usage for svcnum ". $self->svcnum