[freeside-devel] And now for something completely different(svc_* keys)

Dave Burgess burgess at www.cynjut.net
Sat Dec 15 10:48:14 PST 2001


Happy Saturday to all....

Today's silliness involves svc_www(). I started out slowly and have
a couple of new lines of code (hopefully against pre-6 this time
:-)  Please note (everyone) that I am building these svc_www records
by hand using a MySQL browser, so this code won't be of much use
to the general public until we get an editor/adder going.  I need
to get the ACH stuff finished, so this is all I'll be forwarding
this week-end (probably).

First, the view/cust_www.cgi routine:

<%
# <!-- $Id: svc_www.cgi,v 1.5 2001/10/30 14:54:07 ivan Exp $ -->

use strict;
use vars qw( $cgi $query $svcnum $svc_www $cust_svc $pkgnum 
             $cust_pkg $custnum $part_svc $p $svc_acct $email
             $domain_record );
use CGI;
use FS::UID qw(cgisuidsetup);
use FS::CGI qw(header menubar popurl menubar);
use FS::Record qw(qsearchs);
use FS::svc_www;
use FS::domain_record;
use FS::cust_svc;
use FS::cust_pkg;
use FS::part_svc;

$cgi = new CGI;
cgisuidsetup($cgi);

($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
$svcnum = $1;
$svc_www = qsearchs('svc_www',{'svcnum'=>$svcnum});
die "svc_www: Unknown svcnum $svcnum" unless $svc_www;

$domain_record = qsearchs('domain_record',{'recnum'=> $svc_www->recnum } );
die "svc_www: Unknown recnum $domain_record->recnum" unless $domain_record;

my $www = $domain_record->reczone;

$p = popurl(2);
print header('Website View', menubar(
  ( ( $custnum )
    ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum",
        "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
      )
    : ( "Cancel this (unaudited) account" =>
          "${p}misc/cancel-unaudited.cgi?$svcnum" )
  ),
  "Main menu" => $p,
)),
      "Service #$svcnum",
      "<BR>Website name: <B>$www</B>.",
      '</BODY></HTML>',
;
%>

- - - - - Cut Here - - - - -

I know it isn't much, and you still have to build the svc_www entries by hand,
but it's a start.

I've also update cust_svc.pm to include similar resolution:

- - - - - - - - - - - - - - -
--- cust_svc.pm.orig    Sat Dec 15 12:45:55 2001
+++ cust_svc.pm Sat Dec 15 12:27:20 2001
@@ -184,6 +184,9 @@
     }
   } elsif ( $svcdb eq 'svc_domain' ) {
     $tag = $svc_x->getfield('domain');
+  } elsif ( $svcdb eq 'svc_www' ) {
+    my $domain = qsearchs ( 'domain_record', { 'recnum' => $svc_x->recnum } );
+    $tag = $domain->getfield('reczone');
   } else {
     cluck "warning: asked for label of unsupported svcdb; using svcnum";
     $tag = $svc_x->getfield('svcnum');




More information about the freeside-devel mailing list