s/title/organization/ at noment's request
[freeside.git] / FS / FS / part_export / infostreet.pm
index 8a68a20..2464e5d 100644 (file)
@@ -1,11 +1,13 @@
 package FS::part_export::infostreet;
 
-use vars qw(@ISA %infostreet2cust_main);
+use vars qw(@ISA %infostreet2cust_main $DEBUG);
 use FS::UID qw(dbh);
 use FS::part_export;
 
 @ISA = qw(FS::part_export);
 
+$DEBUG = 0;
+
 %infostreet2cust_main = (
   'firstName'   => 'first',
   'lastName'    => 'last',
@@ -48,7 +50,7 @@ sub _export_insert {
   $contact_info{'email'} = $emails[0] if @emails;
 
   #this one is kinda noment-specific
-  $contact_info{'title'} = $cust_main->agent->agent;
+  $contact_info{'organization'} = $cust_main->agent->agent;
 
   $err_or_queue = $self->infostreet_queueContact( $svc_acct->svcnum,
     $svc_acct->username, %contact_info );
@@ -141,9 +143,9 @@ sub infostreet_setContact {
   my($url, $is_username, $is_password, $groupID, $username, %contact_info) = @_;
   my $accountID = infostreet_command($url, $is_username, $is_password, $groupID,
     'getAccountID', $username);
-  foreach my $field ( %contact_info ) {
+  foreach my $field ( keys %contact_info ) {
     infostreet_command($url, $is_username, $is_password, $groupID,
-      'setContactField', $field, $contact_info{$field} );
+      'setContactField', $accountID, $field, $contact_info{$field} );
   }
 
 }
@@ -151,6 +153,8 @@ sub infostreet_setContact {
 sub infostreet_command { #subroutine, not method
   my($url, $username, $password, $groupID, $method, @args) = @_;
 
+  warn "[FS::part_export::infostreet] $method ".join(' ', @args)."\n" if $DEBUG;
+
   #quelle hack
   if ( $method =~ /,/ ) {
     foreach my $part ( split(/,\s*/, $method) ) {