diff options
author | ivan <ivan> | 2003-05-03 02:06:56 +0000 |
---|---|---|
committer | ivan <ivan> | 2003-05-03 02:06:56 +0000 |
commit | 61a2cea1f9f09fcb0482af442f45ef620277a8dc (patch) | |
tree | 7d2a1bcd2d3a07845fff975b34ae33185a00d802 | |
parent | 4cde7ff66b9d008668a430615264c38eb723de2b (diff) |
enable quota maintenance in infostreet export
-rw-r--r-- | FS/FS/part_export/infostreet.pm | 37 | ||||
-rwxr-xr-x | httemplate/edit/svc_acct.cgi | 11 |
2 files changed, 47 insertions, 1 deletions
diff --git a/FS/FS/part_export/infostreet.pm b/FS/FS/part_export/infostreet.pm index f2d519932..caca7c5e1 100644 --- a/FS/FS/part_export/infostreet.pm +++ b/FS/FS/part_export/infostreet.pm @@ -55,6 +55,12 @@ sub _export_insert { $err_or_queue = $self->infostreet_queueContact( $svc_acct->svcnum, $svc_acct->username, %contact_info ); return $err_or_queue unless ref($err_or_queue); + + # If a quota has been specified set the quota because it is not the default + $err_or_queue = $self->infostreet_queueSetQuota( $svc_acct->svcnum, + $svc_acct->username, $svc_acct->quota ) if $svc_acct->quota; + return $err_or_queue unless ref($err_or_queue); + my $error = $err_or_queue->depend_insert( $jobnum ); return $error if $error; @@ -68,6 +74,13 @@ sub _export_replace { my( $self, $new, $old ) = (shift, shift, shift); return "can't change username with InfoStreet" if $old->username ne $new->username; + + # If the quota has changed then do the export to setQuota + my $err_or_queue = $self->infostreet_queueSetQuota( $new->svcnum, $new->username, $new->quota ) + if ( $old->quota != $new->quota ); + return $err_or_queue unless ref($err_or_queue); + + return '' unless $old->_password ne $new->_password; $self->infostreet_queue( $new->svcnum, 'passwd', $new->username, $new->_password ); @@ -150,6 +163,30 @@ sub infostreet_setContact { } +sub infostreet_queueSetQuota { + + my( $self, $svcnum) = (shift, shift); + my $queue = new FS::queue { + 'svcnum' => $svcnum, + 'job' => 'FS::part_export::infostreet::infostreet_setQuota', + }; + + $queue->insert( + $self->option('url'), + $self->option('login'), + $self->option('password'), + $self->option('groupID'), + @_, + ) or $queue; + +} + +sub infostreet_setQuota { + my($url, $is_username, $is_password, $groupID, $username, $quota) = @_; + infostreet_command($url, $is_username, $is_password, $groupID, 'setQuota', $username, [ 'int'=> $quota ] ); +} + + sub infostreet_command { #subroutine, not method my($url, $username, $password, $groupID, $method, @args) = @_; diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index d4c9a738d..4420bb609 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -244,7 +244,16 @@ my($quota,$slipip)=( $svc_acct->slipip, ); -print qq!<INPUT TYPE="hidden" NAME="quota" VALUE="$quota">!; +if ( $part_svc->part_svc_column('quota')->columnflag eq "F" ) +{ + print qq!<INPUT TYPE="hidden" NAME="quota" VALUE="$quota">!; +} else { + print <<END; + <TR><TD ALIGN="right">Quota:</TD> + <TD> <INPUT TYPE="text" NAME="quota" VALUE="$quota" ></TD> + </TR> +END +} if ( $part_svc->part_svc_column('slipip')->columnflag eq "F" ) { print qq!<INPUT TYPE="hidden" NAME="slipip" VALUE="$slipip">!; |