first part of ACL and re-skinning work and some other small stuff
[freeside.git] / FS / FS / UI / Web.pm
index 11e4804..10ddbf3 100644 (file)
@@ -131,6 +131,7 @@ package FS::UI::Web::JSRPC;
 
 use strict;
 use vars qw($DEBUG);
+use Carp;
 use Storable qw(nfreeze);
 use MIME::Base64;
 use JSON;
@@ -138,7 +139,7 @@ use FS::UID;
 use FS::Record qw(qsearchs);
 use FS::queue;
 
-$DEBUG = 1;
+$DEBUG = 0;
 
 sub new {
         my $class = shift;
@@ -150,7 +151,7 @@ sub new {
 
         bless $self, $class;
 
-        die "CGI object required as second argument" unless $self->{'cgi'};
+        croak "CGI object required as second argument" unless $self->{'cgi'};
 
         return $self;
 }
@@ -183,6 +184,10 @@ sub process {
 
     $self->job_status(@args);
 
+  } else {
+
+    die "unknown sub $sub";
+
   }
 
 }
@@ -227,11 +232,19 @@ sub start_job {
   my $error = $job->insert( '_JOB', encode_base64(nfreeze(\%param)) );
 
   if ( $error ) {
+
+    warn "job not inserted: $error\n"
+      if $DEBUG;
+
     $error;  #this doesn't seem to be handled well,
              # will trigger "illegal jobnum" below?
              # (should never be an error inserting the job, though, only thing
              #  would be Pg f%*kage)
   } else {
+
+    warn "job inserted successfully with jobnum ". $job->jobnum. "\n"
+      if $DEBUG;
+
     $job->jobnum;
   }
   
@@ -252,7 +265,7 @@ sub job_status {
   my @return;
   if ( $job && $job->status ne 'failed' ) {
     @return = ( 'progress', $job->statustext );
-  } elsif ( !$job ) { #handle job gone case : job sucessful
+  } elsif ( !$job ) { #handle job gone case : job successful
                       # so close popup, redirect parent window...
     @return = ( 'complete' );
   } else {