fix svc_url to work no matter where we are coming from in the tree - use rooturl...
authorivan <ivan>
Sun, 21 Jan 2007 09:10:46 +0000 (09:10 +0000)
committerivan <ivan>
Sun, 21 Jan 2007 09:10:46 +0000 (09:10 +0000)
FS/FS/CGI.pm
FS/FS/UI/Web.pm

index 88548cd..a85d48a 100644 (file)
@@ -239,14 +239,17 @@ sub rooturl {
   #even though this is kludgy
   $url_string =~
     s{
-       (browse|config|docs|edit|graph|misc|search|view|pref)
+       /
+       (browse|config|docs|edit|graph|misc|search|view|pref|rt)
        /
        (process/)?
-       ([\w\-\.]+)
+       ([\w\-\.\/]+)
        $
      }
      {}x;
 
+  $url_string .= '/' unless $url_string =~ /\/$/;
+
   $url_string;
 
 }
index 15ec1a7..d7730c1 100644 (file)
@@ -91,7 +91,7 @@ passed as a list of name-value pairs, and include:
   # ##
   #  'ahref'    => 1, # if set true, returns <A HREF="$url">
 
-use FS::CGI qw(popurl);
+use FS::CGI qw(rooturl);
 sub svc_url {
   my %opt = @_;
 
@@ -112,8 +112,7 @@ sub svc_url {
     $url .= 'svcnum=' if $query =~ /^\d+(;|$)/ or $query eq '';
   }
 
-  my $p = popurl(2); #?
-  my $return = "$p$opt{action}/$url$query";
+  my $return = rooturl(). "$opt{action}/$url$query";
 
   $return = qq!<A HREF="$return">! if $opt{ahref};