[freeside-commits] freeside/FS/FS ClientAPI_XMLRPC.pm, 1.5.2.7, 1.5.2.8

Ivan,,, ivan at wavetail.420.am
Sun Oct 30 19:33:31 PDT 2011


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv1041/FS/FS

Modified Files:
      Tag: FREESIDE_2_3_BRANCH
	ClientAPI_XMLRPC.pm 
Log Message:
fix fallout from fixing UTF-8 XML-RPC self-service issues, RT#13656

Index: ClientAPI_XMLRPC.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI_XMLRPC.pm,v
retrieving revision 1.5.2.7
retrieving revision 1.5.2.8
diff -u -w -d -r1.5.2.7 -r1.5.2.8
--- ClientAPI_XMLRPC.pm	30 Oct 2011 23:28:25 -0000	1.5.2.7
+++ ClientAPI_XMLRPC.pm	31 Oct 2011 02:33:29 -0000	1.5.2.8
@@ -30,11 +30,26 @@
 use strict;
 
 use vars qw($DEBUG $AUTOLOAD);
+use XMLRPC::Lite; # for XMLRPC::Data
 use FS::ClientAPI;
 
 $DEBUG = 0;
 $FS::ClientAPI::DEBUG = $DEBUG;
 
+#false laziness w/FS::SelfService/XMLRPC.pm, same problem as below but worse
+our %typefix = (
+  'invoice_pdf'        => { 'invoice_pdf' => 'base64', },
+  'legacy_invoice_pdf' => { 'invoice_pdf' => 'base64', },
+  'skin_info'          => { 'logo'              => 'base64',
+                            'title_left_image'  => 'base64',
+                            'title_right_image' => 'base64',
+                            'menu_top_image'    => 'base64',
+                            'menu_body_image'   => 'base64',
+                            'menu_bottom_image' => 'base64',
+                          },
+  'invoice_logo'       => { 'logo' => 'base64', },
+);
+
 sub AUTOLOAD {
   my $call = $AUTOLOAD;
   $call =~ s/^FS::(SelfService::|ClientAPI_)XMLRPC:://;
@@ -44,12 +59,27 @@
   my $autoload = &ss2clientapi;
 
   if (exists($autoload->{$call})) {
+
     shift; #discard package name;
+
     #$call = "FS::SelfService::$call";
     #no strict 'refs';
     #&{$call}(@_);
     #FS::ClientAPI->dispatch($autoload->{$call}, @_);
-    FS::ClientAPI->dispatch($autoload->{$call}, { @_ } );
+
+    my $return = FS::ClientAPI->dispatch($autoload->{$call}, { @_ } );
+
+    if ( exists($typefix{$call}) ) {
+      my $typefix = $typefix{$call};
+      foreach my $field ( grep exists($return->{$_}), keys %$typefix ) {
+        my $type = $typefix->{$field};
+        $return->{$field} = XMLRPC::Data->value($return->{$field})
+                                        ->type($type);
+      }
+    }
+
+    $return;
+
   }else{
     die "No such procedure: $call";
   }



More information about the freeside-commits mailing list