summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-03-22 06:00:54 +0000
committerivan <ivan>2011-03-22 06:00:54 +0000
commit3dfc446d8a4d241787c47ff7e2db72483d62ab7a (patch)
treef0129a16674ccd7c2feec43d7aea7dd5be2f7d41
parentb1011034b084a90c07c7199f5e64cdee7cdd199f (diff)
new customer from prospect qualification, RT#7111
-rw-r--r--FS/FS/cust_location.pm81
-rw-r--r--FS/FS/geocode_Mixin.pm50
-rw-r--r--FS/FS/part_export/ikano.pm31
-rw-r--r--FS/FS/qual.pm49
-rwxr-xr-xhttemplate/edit/cust_main.cgi48
-rw-r--r--httemplate/edit/cust_main/first_pkg.html5
-rw-r--r--httemplate/edit/cust_main/first_pkg/select-part_pkg.html5
-rw-r--r--httemplate/edit/cust_main/first_pkg/svc_dsl.html75
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi23
-rw-r--r--httemplate/edit/svc_dsl.cgi209
-rw-r--r--httemplate/elements/small_prospect_view.html11
-rw-r--r--httemplate/view/qual.cgi87
12 files changed, 436 insertions, 238 deletions
diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm
index 7d0ce1c..7ffa5ed 100644
--- a/FS/FS/cust_location.pm
+++ b/FS/FS/cust_location.pm
@@ -203,7 +203,8 @@ sub has_ship_address {
=item location_hash
Returns a list of key/value pairs, with the following keys: address1, address2,
-city, county, state, zip, country, geocode.
+city, county, state, zip, country, geocode, location_type, location_number,
+location_kind.
=cut
@@ -271,6 +272,84 @@ sub move_to {
return;
}
+=item alternize
+
+Attempts to parse data for location_type and location_number from address1
+and address2.
+
+=cut
+
+sub alternize {
+ my $self = shift;
+
+ return '' if $self->get('location_type')
+ || $self->get('location_number');
+
+ my %parse;
+ if ( 1 ) { #ikano, switch on via config
+ { no warnings 'void';
+ eval { 'use FS::part_export::ikano;' };
+ die $@ if $@;
+ }
+ %parse = FS::part_export::ikano->location_types_parse;
+ } else {
+ %parse = (); #?
+ }
+
+ foreach my $from ('address1', 'address2') {
+ foreach my $parse ( keys %parse ) {
+ my $value = $self->get($from);
+ if ( $value =~ s/(^|\W+)$parse\W+(\w+)\W*$//i ) {
+ $self->set('location_type', $parse{$parse});
+ $self->set('location_number', $2);
+ $self->set($from, $value);
+ return '';
+ }
+ }
+ }
+
+ #nothing matched, no changes
+ $self->get('address2')
+ ? "Can't parse unit type and number from address2"
+ : '';
+}
+
+=item dealternize
+
+Moves data from location_type and location_number to the end of address1.
+
+=cut
+
+sub dealternize {
+ my $self = shift;
+
+ #false laziness w/geocode_Mixin.pm::line
+ my $lt = $self->get('location_type');
+ if ( $lt ) {
+
+ my %location_type;
+ if ( 1 ) { #ikano, switch on via config
+ { no warnings 'void';
+ eval { 'use FS::part_export::ikano;' };
+ die $@ if $@;
+ }
+ %location_type = FS::part_export::ikano->location_types;
+ } else {
+ %location_type = (); #?
+ }
+
+ $self->address1( $self->address1. ' '. $location_type{$lt} || $lt );
+ $self->location_type('');
+ }
+
+ if ( length($self->location_number) ) {
+ $self->address1( $self->address1. ' '. $self->location_number );
+ $self->location_number('');
+ }
+
+ '';
+}
+
=back
=head1 BUGS
diff --git a/FS/FS/geocode_Mixin.pm b/FS/FS/geocode_Mixin.pm
index a17a0ab..4f8d1e8 100644
--- a/FS/FS/geocode_Mixin.pm
+++ b/FS/FS/geocode_Mixin.pm
@@ -96,7 +96,8 @@ sub location_label {
$notfirst++;
}
- if ( $self->get($prefix.'location_type') ) {
+ my $lt = $self->get($prefix.'location_type');
+ if ( $lt ) {
my %location_type;
if ( 1 ) { #ikano, switch on via config
{ no warnings 'void';
@@ -108,9 +109,7 @@ sub location_label {
%location_type = (); #?
}
- $line .= ' '.&$escape( $location_type{ $self->get($prefix.'location_type') }
- || $self->get($prefix.'location_type')
- );
+ $line .= ' '.&$escape( $location_type{$lt} || $lt );
}
$line .= ' '. &$escape($self->get($prefix.'location_number'))
@@ -172,49 +171,6 @@ sub geocode {
$geocode;
}
-=item alternize
-
-Attempts to parse data for location_type and location_number from address1
-and address2.
-
-=cut
-
-sub alternize {
- my $self = shift;
- my $prefix = $self->has_ship_address ? 'ship_' : '';
-
- return '' if $self->get($prefix.'location_type')
- || $self->get($prefix.'location_number');
-
- my %parse;
- if ( 1 ) { #ikano, switch on via config
- { no warnings 'void';
- eval { 'use FS::part_export::ikano;' };
- die $@ if $@;
- }
- %parse = FS::part_export::ikano->location_types_parse;
- } else {
- %parse = (); #?
- }
-
- foreach my $from ('address1', 'address2') {
- foreach my $parse ( keys %parse ) {
- my $value = $self->get($prefix.$from);
- if ( $value =~ s/(^|\W+)$parse\W+(\w+)\W*$//i ) {
- $self->set($prefix.'location_type', $parse{$parse});
- $self->set($prefix.'location_number', $2);
- $self->set($prefix.$from, $value);
- return '';
- }
- }
- }
-
- #nothing matched, no changes
- $self->get($prefix.'address2')
- ? "Can't parse unit type and number from ${prefix}address2"
- : '';
-}
-
=back
=head1 BUGS
diff --git a/FS/FS/part_export/ikano.pm b/FS/FS/part_export/ikano.pm
index 2d7688d..4323d94 100644
--- a/FS/FS/part_export/ikano.pm
+++ b/FS/FS/part_export/ikano.pm
@@ -234,7 +234,6 @@ sub dsl_pull {
my @onotes = $svc_dsl->notes;
# assume notes we already have don't change & no notes added from our side
# so using the horrible code below just find what we're missing and add it
- my $error;
foreach my $inote ( @inotes ) {
my $found = 0;
foreach my $onote ( @onotes ) {
@@ -243,7 +242,7 @@ sub dsl_pull {
last;
}
}
- $error = $inote->insert unless ( $found );
+ my $error = $inote->insert unless ( $found );
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return "Cannot add note: $error";
@@ -252,7 +251,7 @@ sub dsl_pull {
$svc_dsl->last_pull((time));
local $FS::svc_Common::noexport_hack = 1;
- $error = $svc_dsl->replace;
+ my $error = $svc_dsl->replace;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return "Cannot update DSL data: $error";
@@ -373,7 +372,7 @@ sub qual_result {
$not_avail{$externalid} = $externalid; #a better label?
}
- { 'header' => 'Qualifying Packages',
+ {
'pkglist' => \%pkglist,
'not_avail' => \%not_avail,
};
@@ -461,15 +460,14 @@ sub valid_order {
if $self->option('debug');
# common to all order types/status/loop_type
- my $error = !($svc_dsl->desired_due_date
- && grep($_ eq $svc_dsl->vendor_order_type, Net::Ikano->orderTypes)
- && $svc_dsl->first
- && $svc_dsl->last
- && defined $svc_dsl->loop_type
- && $svc_dsl->vendor_qual_id
- );
- return 'Missing or invalid order data' if $error;
-
+ return 'No desired_due_date' unless $svc_dsl->desired_due_date;
+ return 'Unknown vendor_order_type'
+ unless grep $_ eq $svc_dsl->vendor_order_type, Net::Ikano->orderTypes;
+ return 'No first name' unless $svc_dsl->first;
+ return 'No last name' unless $svc_dsl->get('last');
+ return 'No loop type' unless defined $svc_dsl->loop_type;
+ return 'No vendor_qual_id' unless $svc_dsl->vendor_qual_id;
+
my %vendor_pkg_ids = $svc_dsl->cust_svc->cust_pkg->part_pkg->vendor_pkg_ids;
return 'Package does not have an external id configured'
unless defined $vendor_pkg_ids{$self->exportnum};
@@ -481,7 +479,7 @@ sub valid_order {
# weird ifs & long lines for readability and ease of understanding - don't change
if($svc_dsl->vendor_order_type eq 'NEW') {
if($svc_dsl->pushed) {
- $error = !( ($action eq 'pull' || $action eq 'statuschg'
+ my $error = !( ($action eq 'pull' || $action eq 'statuschg'
|| $action eq 'delete' || $action eq 'expire')
&& length($svc_dsl->vendor_order_id) > 0
&& length($svc_dsl->vendor_order_status) > 0
@@ -492,7 +490,7 @@ sub valid_order {
if ($action eq 'statuschg' && length($svc_dsl->phonenum) < 1);
}
else { # unpushed New order - cannot do anything other than push it
- $error = !($action eq 'insert'
+ my $error = !($action eq 'insert'
&& length($svc_dsl->vendor_order_id) < 1
&& length($svc_dsl->vendor_order_status) < 1
&& ( ($svc_dsl->phonenum eq '' && $svc_dsl->loop_type eq '0') # dry
@@ -534,7 +532,8 @@ sub _export_insert {
return $result unless $result eq '';
my $isp_chg = $svc_dsl->isp_chg eq 'Y' ? 'YES' : 'NO';
- my $contactTN = $svc_dsl->cust_svc->cust_pkg->cust_main->daytime;
+ my $cust_main = $svc_dsl->cust_svc->cust_pkg->cust_main;
+ my $contactTN = $cust_main->daytime || $cust_main->night || '5555555555';
$contactTN =~ s/[^0-9]//g;
my %vendor_pkg_ids = $svc_dsl->cust_svc->cust_pkg->part_pkg->vendor_pkg_ids;
diff --git a/FS/FS/qual.pm b/FS/FS/qual.pm
index d0b3fbd..07878e9 100644
--- a/FS/FS/qual.pm
+++ b/FS/FS/qual.pm
@@ -185,28 +185,34 @@ sub part_export {
'';
}
+sub cust_location {
+ my $self = shift;
+ return '' unless $self->locationnum;
+ qsearchs('cust_location', { 'locationnum' => $self->locationnum } );
+}
+
+sub cust_main {
+ my $self = shift;
+ return '' unless $self->custnum;
+ qsearchs('cust_main', { 'custnum' => $self->custnum } );
+}
+
sub location_hash {
- my $self = shift;
- if ( $self->locationnum ) {
- my $l = qsearchs( 'cust_location',
- { 'locationnum' => $self->locationnum });
- if ( $l ) {
- my %loc_hash = $l->location_hash;
- $loc_hash{locationnum} = $self->locationnum;
- return %loc_hash;
- }
- }
- if ( $self->custnum ) {
- my $c = qsearchs( 'cust_main', { 'custnum' => $self->custnum });
-
- if($c) {
- # always override location_kind as it would never be known in the
- # case of cust_main "default service address"
- my %loc_hash = $c->location_hash;
- $loc_hash{location_kind} = $c->company ? 'B' : 'R';
- return %loc_hash;
- }
- }
+ my $self = shift;
+
+ if ( my $l = $self->cust_location ) {
+ my %loc_hash = $l->location_hash;
+ $loc_hash{locationnum} = $self->locationnum;
+ return %loc_hash;
+ }
+
+ if ( my $c = $self->cust_main ) {
+ # always override location_kind as it would never be known in the
+ # case of cust_main "default service address"
+ my %loc_hash = $c->location_hash;
+ $loc_hash{location_kind} = $c->company ? 'B' : 'R';
+ return %loc_hash;
+ }
warn "prospectnum does not imply any particular address! must specify locationnum";
return ();
@@ -226,6 +232,7 @@ sub cust_or_prospect {
if $self->custnum;
return qsearchs('prospect_main', { 'prospectnum' => $self->prospectnum })
if $self->prospectnum;
+ '';
}
sub status_long {
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index 07629dc..d4217bb 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -13,7 +13,8 @@
%# STYLE="margin-top: 0; margin-bottom: 0">
>
-<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
+<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
+<INPUT TYPE="hidden" NAME="prospectnum" VALUE="<% $prospectnum %>">
% if ( $custnum ) {
Customer #<B><% $cust_main->display_custnum %></B> -
@@ -187,6 +188,7 @@ function samechanged(what) {
'popnum' => $popnum,
'saved_domsvc' => $saved_domsvc,
%svc_phone,
+ %svc_dsl,
)
%>
@@ -237,6 +239,8 @@ my $same = '';
my $pkgpart_svcpart = ''; #first_pkg
my($username, $password, $popnum, $saved_domsvc) = ( '', '', 0, 0 ); #svc_acct
my %svc_phone = ();
+my %svc_dsl = ();
+my $prospectnum = '';
if ( $cgi->param('error') ) {
@@ -273,6 +277,10 @@ if ( $cgi->param('error') ) {
$svc_phone{$_} = $cgi->param($_)
foreach qw( countrycode phonenum sip_password pin phone_name );
+ #svc_dsl (phonenum came in with svc_phone)
+ $svc_phone{$_} = $cgi->param($_)
+ foreach qw( password isp_chg isp_prev vendor_qual_id );
+
} elsif ( $cgi->keywords ) { #editing
die "access denied"
@@ -309,6 +317,44 @@ if ( $cgi->param('error') ) {
$stateid = '';
$payinfo = '';
+ if ( $cgi->param('qualnum') =~ /^(\d+)$/ ) {
+ my $qualnum = $1;
+ my $qual = qsearchs('qual', { 'qualnum' => $qualnum } )
+ or die "unknown qualnum $qualnum";
+
+ my $prospect_main = $qual->cust_or_prospect;
+ $prospectnum = $prospect_main->prospectnum
+ or die "qualification not on a prospect";
+
+ $cust_main->agentnum( $prospect_main->agentnum );
+ $cust_main->company( $prospect_main->company );
+
+ #first contact? -> name
+ my @contacts = $prospect_main->contact;
+ my $contact = $contacts[0];
+ $cust_main->first( $contact->first );
+ $cust_main->set( 'last', $contact->get('last') );
+ #XXX contact phone numbers
+
+ #XXX additional/all contacts -> alas (notes for now? add add'l contact support?)
+
+ #XXX move all contacts and locations
+
+ #location -> address (all prospect quals have location, right?)
+ my $cust_location = $qual->cust_location;
+ $cust_location->dealternize;
+ $cust_main->$_( $cust_location->$_ )
+ foreach qw( address1 address2 city county state zip country geocode );
+
+ #pkgpart handled by lock_pkgpart below
+
+ #XXX locationnum -> package order
+
+ #service telephone & vendor_qual_id -> svc_dsl
+ $svc_dsl{$_} = $qual->$_
+ foreach qw( phonenum vendor_qual_id );
+ }
+
if ( $cgi->param('lock_pkgpart') =~ /^(\d+)$/ ) {
my $pkgpart = $1;
my $part_pkg = qsearchs('part_pkg', { 'pkgpart' => $pkgpart } )
diff --git a/httemplate/edit/cust_main/first_pkg.html b/httemplate/edit/cust_main/first_pkg.html
index 7c131ea..3b15d4e 100644
--- a/httemplate/edit/cust_main/first_pkg.html
+++ b/httemplate/edit/cust_main/first_pkg.html
@@ -13,7 +13,8 @@
<TR>
<TD COLSPAN=2>
<% include('first_pkg/select-part_pkg.html',
- 'part_pkg' => \@part_pkg,
+ 'part_pkg' => \@part_pkg,
+ 'first_svc' => \@first_svc,
%opt,
# map { $_ => $opt{$_} } qw( pkgpart_svcpart saved_domsvc )
)
@@ -69,7 +70,7 @@ if ( $cgi->param('lock_pkgpart') =~ /^([\d, ]+)$/ ) {
}
-my @first_svc = ( 'svc_acct', 'svc_phone' );
+my @first_svc = ( 'svc_acct', 'svc_phone', 'svc_dsl' );
@part_pkg =
grep { $_->svcpart(\@first_svc)
diff --git a/httemplate/edit/cust_main/first_pkg/select-part_pkg.html b/httemplate/edit/cust_main/first_pkg/select-part_pkg.html
index 20f0e19..9d37f15 100644
--- a/httemplate/edit/cust_main/first_pkg/select-part_pkg.html
+++ b/httemplate/edit/cust_main/first_pkg/select-part_pkg.html
@@ -132,9 +132,8 @@ $opt{saved_domsvc} = 0 unless $opt{saved_domsvc};
my $url_prefix = $opt{'relurls'} ? '' : $p;
-my @part_pkg = @{$opt{'part_pkg'}};
-
-my @first_svc = ( 'svc_acct', 'svc_phone' );
+my @part_pkg = @{ $opt{'part_pkg'} };
+my @first_svc = @{ $opt{'first_svc'} };
my %pkgpart_svcpart = ();
my %svcdb = ();
diff --git a/httemplate/edit/cust_main/first_pkg/svc_dsl.html b/httemplate/edit/cust_main/first_pkg/svc_dsl.html
new file mode 100644
index 0000000..971f4be
--- /dev/null
+++ b/httemplate/edit/cust_main/first_pkg/svc_dsl.html
@@ -0,0 +1,75 @@
+<% ntable("#cccccc") %>
+
+% if ( $opt{'phonenum'} ) {
+
+ <INPUT TYPE="hidden" NAME="loop_type" VALUE="">
+ <INPUT TYPE="hidden" NAME="phonenum" VALUE="<% $opt{'phonenum'} %>">
+
+ <TR>
+ <TD ALIGN="right">Loop Type</TD>
+ <TD BGCOLOR="#eeeeee">Line-share</TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN="right">Phone Number</TD>
+ <TD BGCOLOR="#eeeeee"><% $opt{'phonenum'} %></TD>
+ </TR>
+
+% } else {
+
+ <INPUT TYPE="hidden" NAME="loop_type" VALUE="0">
+ <INPUT TYPE="hidden" NAME="phonenum" VALUE="">
+
+ <TR>
+ <TD ALIGN="right">Loop Type</TD>
+ <TD BGCOLOR="#eeeeee">Standalone</TD>
+ </TR>
+
+% }
+
+<TR>
+ <TD ALIGN="right">PPPoE password</TD>
+ <TD>
+ <INPUT TYPE = "text"
+ NAME = "password"
+ VALUE = "<% $opt{'password'} %>"
+ >
+ </TD>
+</TR>
+
+<TR>
+ <TD ALIGN="right">ISP Changing?</TD>
+ <TD>
+ <INPUT TYPE = "checkbox"
+ NAME = "isp_chg"
+ VALUE = "Y"
+ <% $opt{'isp_chg'} eq 'Y' ? 'CHECKED' : '' %>
+ >
+ </TD>
+</TR>
+
+<TR>
+ <TD ALIGN="right">Current or Previous ISP</TD>
+ <TD>
+ <INPUT TYPE = "text"
+ NAME = "isp_prev"
+ VALUE = "<% $opt{'isp_prev'} %>"
+ >
+ </TD>
+</TR>
+
+<INPUT TYPE="hidden" NAME="vendor_qual_id" VALUE="<% $opt{'vendor_qual_id'} %>">
+<TR>
+ <TD ALIGN="right">Vendor Qualification ID</TD>
+ <TD BGCOLOR="#eeeeee"><% $opt{'vendor_qual_id'} %></TD>
+</TR>
+
+</TABLE>
+
+<%init>
+
+my %opt = @_;
+
+#my $conf = new FS::Conf;
+
+</%init>
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 24cecea..c43ffa3 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -192,13 +192,28 @@ if ( $new->custnum eq '' ) {
} elsif ( $svcdb eq 'svc_phone' ) {
my %svc_phone = (
- 'svcpart' => $svcpart,
- map { $_ => scalar($cgi->param($_)) }
- qw( countrycode phonenum sip_password pin phone_name )
- );
+ 'svcpart' => $svcpart,
+ map { $_ => scalar($cgi->param($_)) }
+ qw( countrycode phonenum sip_password pin phone_name )
+ );
$svc = new FS::svc_phone \%svc_phone;
+ } elsif ( $svcdb eq 'svc_dsl' ) {
+
+ my %svc_dsl = (
+ 'svcpart' => $svcpart,
+ ( map { $_ => scalar($cgi->param("ship_$_")) || scalar($cgi->param($_))}
+ qw( first last company )
+ ),
+ ( map { $_ => scalar($cgi->param($_)) }
+ qw( loop_type phonenum password isp_chg isp_prev vendor_qual_id )
+ ),
+ 'desired_due_date' => time, #XXX enter?
+ 'vendor_order_type' => 'NEW',
+ );
+ $svc = new FS::svc_dsl \%svc_dsl;
+
} else {
die "$svcdb not handled on new customer yet";
}
diff --git a/httemplate/edit/svc_dsl.cgi b/httemplate/edit/svc_dsl.cgi
index 48464fb..7ecf906 100644
--- a/httemplate/edit/svc_dsl.cgi
+++ b/httemplate/edit/svc_dsl.cgi
@@ -1,10 +1,10 @@
<% include( 'elements/svc_Common.html',
- 'table' => 'svc_dsl',
- 'fields' => \@fields,
- 'svc_new_callback' => $new_cb,
- 'svc_edit_callback' => $edit_cb,
- 'html_foot' => $html_foot,
- )
+ 'table' => 'svc_dsl',
+ 'fields' => \@fields,
+ 'svc_new_callback' => $new_cb,
+ 'svc_edit_callback' => $edit_cb,
+ 'html_foot' => $html_foot,
+ )
%>
<%init>
@@ -18,44 +18,43 @@ my $ti_fields = FS::svc_dsl->table_info->{'fields'};
my @fields = ();
-my $html_foot = sub {
- return "
+my $html_foot = sub { "
<SCRIPT TYPE=\"text/javascript\">
function ikano_loop_type_changed() {
- var loop_type = document.getElementById('loop_type').value;
- var phonenum = document.getElementById('phonenum');
- if(loop_type == '0') {
- phonenum.value = '';
- phonenum.disabled = true;
- }
- else phonenum.disabled = false;
+ var loop_type = document.getElementById('loop_type').value;
+ var phonenum = document.getElementById('phonenum');
+ if(loop_type == '0') {
+ phonenum.value = '';
+ phonenum.disabled = true;
+ }
+ else phonenum.disabled = false;
}
-</SCRIPT>";
-};
+</SCRIPT>
+"; };
my $edit_cb = sub {
my( $cgi,$svc_x, $part_svc,$cust_pkg, $fields1,$opt) = @_;
my @exports = $part_svc->part_export_dsl_pull;
die "more than one DSL-pulling export attached to svcpart ".$part_svc->svcpart
- if ( scalar(@exports) > 1 );
+ if ( scalar(@exports) > 1 );
if ( scalar(@exports) == 1 ) {
- my $export = @exports[0];
- if($export->exporttype eq 'ikano') {
- @fields = ( 'password', 'monitored', );
-
- foreach my $hf ( keys %$ti_fields ) {
- push @fields, {
- field => $hf,
- type => 'hidden',
- value => $svc_x->$hf,
- } unless ( $hf eq 'password' || $hf eq 'monitored' );
- }
- }
- # else add any other export-specific stuff here
+ my $export = @exports[0];
+ if($export->exporttype eq 'ikano') {
+ @fields = ( 'password', 'monitored', );
+
+ foreach my $hf ( keys %$ti_fields ) {
+ push @fields, {
+ field => $hf,
+ type => 'hidden',
+ value => $svc_x->$hf,
+ } unless ( $hf eq 'password' || $hf eq 'monitored' );
+ }
+ }
+ # else add any other export-specific stuff here
}
else {
- push @fields, qw( first last company phonenum circuitnum rate_band vpi vci );
+ push @fields, qw( first last company phonenum circuitnum rate_band vpi vci );
}
};
@@ -63,80 +62,82 @@ my $new_cb = sub {
my( $cgi,$svc_x, $part_svc,$cust_pkg, $fields1,$opt) = @_;
my @exports = $part_svc->part_export_dsl_pull;
die "more than one DSL-pulling export attached to svcpart ".$part_svc->svcpart
- if ( scalar(@exports) > 1 );
-
- my $cust_main = $cust_pkg->cust_main;
- my $defsvctn = $cust_main->ship_daytime ? $cust_main->ship_daytime
- : $cust_main->daytime;
- $defsvctn =~ s/[^0-9]//g;
-
- @fields = (
- { field => 'first',
- value => $cust_main->ship_first ? $cust_main->ship_first
- : $cust_main->first,
- },
- { field => 'last',
- value => $cust_main->ship_last ? $cust_main->ship_last
- : $cust_main->last,
- },
- { field => 'company',
- value => $cust_pkg->cust_main->ship_company,
- value => $cust_main->ship_company ? $cust_main->ship_company
- : $cust_main->company,
- },
- { field => 'phonenum',
- value => $defsvctn,
- },
- );
+ if ( scalar(@exports) > 1 );
+
+ my $cust_main = $cust_pkg->cust_main;
+ my $defsvctn = $cust_main->ship_daytime ? $cust_main->ship_daytime
+ : $cust_main->daytime;
+ $defsvctn =~ s/[^0-9]//g;
+
+ @fields = (
+ { field => 'first',
+ value => $cust_main->ship_first ? $cust_main->ship_first
+ : $cust_main->first,
+ },
+ { field => 'last',
+ value => $cust_main->ship_last ? $cust_main->ship_last
+ : $cust_main->last,
+ },
+ { field => 'company',
+ value => $cust_pkg->cust_main->ship_company,
+ value => $cust_main->ship_company ? $cust_main->ship_company
+ : $cust_main->company,
+ },
+ { field => 'phonenum',
+ value => $defsvctn,
+ },
+ );
if ( scalar(@exports) == 1 ) {
- my $export = @exports[0];
- if($export->exporttype eq 'ikano') {
- my $ddd = $cust_pkg->start_date;
- $ddd = time unless $ddd;
-
- my @quals = $export->quals_by_cust_and_pkg($cust_pkg->cust_main->custnum,$cust_pkg->pkgpart);
- my @prequalids;
- my %prequal_labels;
- foreach my $qual ( @quals ) {
- my $prequalid = $qual->vendor_qual_id;
- push @prequalids, $prequalid;
- $prequal_labels{$prequalid} = "$prequalid - qualification #"
- .$qual->qualnum;
- }
-
- my @addl_fields = (
- { field => 'loop_type',
- type => 'select',
- options => [ '', '0' ],
- labels => { '' => 'Line-share', '0', => 'Standalone' },
- onchange => 'ikano_loop_type_changed',
- },
- 'password',
- { field => 'isp_chg', type => 'checkbox', },
- 'isp_prev',
- { field => 'vendor_qual_id',
- type => 'select',
- options => \@prequalids,
- labels => \%prequal_labels,
- onchange => 'ikano_vendor_qual_id_changed',
- },
- { field => 'vendor_order_type',
- type => 'hidden',
- value => 'NEW' },
- { field => 'desired_due_date',
- type => 'fixed',
- formatted_value =>
- time2str($date_format,$ddd),
- value => $ddd,
- },
- );
- push @fields, @addl_fields;
- }
- # else add any other export-specific stuff here
- }
- else { # display non-export and non-Ikano fields
- push @fields, qw( rate_band circuitnum vpi vci );
+ my $export = @exports[0];
+ if($export->exporttype eq 'ikano') {
+ my $ddd = $cust_pkg->start_date;
+ $ddd = time unless $ddd;
+
+ my @quals = $export->quals_by_cust_and_pkg($cust_pkg->cust_main->custnum,$cust_pkg->pkgpart);
+ my @prequalids;
+ my %prequal_labels;
+ foreach my $qual ( @quals ) {
+ my $prequalid = $qual->vendor_qual_id;
+ push @prequalids, $prequalid;
+ $prequal_labels{$prequalid} = "$prequalid - qualification #"
+ .$qual->qualnum;
+ }
+
+ splice @fields, -1, 0,
+ { field => 'loop_type',
+ type => 'select',
+ options => [ '', '0' ],
+ labels => { '' => 'Line-share', '0', => 'Standalone' },
+ onchange => 'ikano_loop_type_changed',
+ },
+ ;
+
+ push @fields,
+ 'password',
+ { field => 'isp_chg', type => 'checkbox', value=>'Y', },
+ 'isp_prev',
+ { field => 'vendor_qual_id',
+ type => 'select',
+ options => \@prequalids,
+ labels => \%prequal_labels,
+ onchange => 'ikano_vendor_qual_id_changed',
+ },
+ { field => 'vendor_order_type',
+ type => 'hidden',
+ value => 'NEW' },
+ { field => 'desired_due_date',
+ type => 'fixed',
+ formatted_value =>
+ time2str($date_format,$ddd),
+ value => $ddd,
+ },
+ ;
+ }
+ # else add any other export-specific stuff here
+
+ } else { # display non-export and non-Ikano fields
+ push @fields, qw( rate_band circuitnum vpi vci );
}
};
</%init>
diff --git a/httemplate/elements/small_prospect_view.html b/httemplate/elements/small_prospect_view.html
new file mode 100644
index 0000000..4942e8d
--- /dev/null
+++ b/httemplate/elements/small_prospect_view.html
@@ -0,0 +1,11 @@
+% my $link = "${p}view/prospect_main.html?". $prospect_main->prospectnum;
+Prospect: <A HREF="<%$link%>"><% $prospect_main->name %></A>
+<%init>
+
+my($prospect_main, %opt) = @_;
+
+$prospect_main = qsearchs('prospect_main', { 'prospectnum' => $prospect_main } )
+ || die "unknown prospectnum $prospect_main"
+ unless ref($prospect_main);
+
+</%init>
diff --git a/httemplate/view/qual.cgi b/httemplate/view/qual.cgi
index a0768c3..6998b85 100644
--- a/httemplate/view/qual.cgi
+++ b/httemplate/view/qual.cgi
@@ -1,14 +1,17 @@
<% include("/elements/header.html","View Qualification") %>
-% if ( $cust_or_prospect->get('custnum') ) {
+% if ( $cust_or_prospect->custnum ) {
- <% include( '/elements/small_custview.html', $cust_or_prospect->custnum, '', 1,
- "${p}view/cust_main.cgi") %>
+ <% include( '/elements/small_custview.html', $cust_or_prospect,
+ '', #countrydefault override
+ 1, #no balance
+ "${p}view/cust_main.cgi"), #url
+ %>
+
+% } elsif ( $cust_or_prospect->prospectnum ) {
+
+ <% include( '/elements/small_prospect_view.html', $cust_or_prospect) %>
-% } elsif ( $cust_or_prospect->get('prospectnum') ) {
-% my $prospectnum = $cust_or_prospect->get('prospectnum');
-% my $link = "${p}view/prospect_main.html?$prospectnum";
- <A HREF="<%$link%>">Prospect #<%$prospectnum%></A>
% }
<BR><BR>
@@ -28,40 +31,46 @@
<BR><BR>
% if ( $export ) {
-% my $qual_result = $export->qual_result($qual);
-% if ($qual_result->{'header'}) {
- <B><% $qual_result->{'header'} %></B>
-% }
-% if ($qual_result->{'pkglist'}) { # one of the possible formats
-% my $svcpart = '';
-% my $pkglist = $qual_result->{'pkglist'};
-% my $cust_or_prospect = $qual->cust_or_prospect;
-% my $locationnum = '';
-% my %location = $qual->location_hash;
-% if (%location && $location{'locationnum'}) {
-% $locationnum = $location{'locationnum'};
-% }
- <UL>
+% my $qual_result = $export->qual_result($qual);
+% if ($qual_result->{'pkglist'}) { # one of the possible formats (?)
+ <B>Qualifying Packages</B> - click to order
+% my $svcpart = '';
+% my $pkglist = $qual_result->{'pkglist'};
+% my $cust_or_prospect = $qual->cust_or_prospect;
+% my $locationnum = '';
+% my %location = $qual->location_hash;
+% my $locationnum = $location{'locationnum'};
+ <UL>
% foreach my $pkgpart ( keys %$pkglist ) {
-% my %opt = ( 'label' => $pkglist->{$pkgpart},
-% 'pkgpart' => $pkgpart,
-% 'locationnum' => $locationnum, );
-% if ( $export->exporttype eq 'ikano' ) {
-% my $pkg_svc = qsearchs('pkg_svc', { 'pkgpart' => $pkgpart,
-% 'primary_svc' => 'Y',
-% } );
-% $opt{'svcpart'} = $pkg_svc->svcpart if $pkg_svc;
+ <LI>
+
+% if($cust_or_prospect->custnum) {
+
+% my %opt = ( 'label' => $pkglist->{$pkgpart},
+% 'pkgpart' => $pkgpart,
+% 'locationnum' => $location{'locationnum'},
+% );
+% if ( $export->exporttype eq 'ikano' ) {
+% my $pkg_svc = qsearchs('pkg_svc', { 'pkgpart' => $pkgpart,
+% 'primary_svc' => 'Y',
+% }
+% );
+% $opt{'svcpart'} = $pkg_svc->svcpart if $pkg_svc;
+% }
+
+ <% include('/view/cust_main/order_pkg_link.html',
+ $cust_or_prospect, %opt) %>
+
+% } elsif ($cust_or_prospect->prospectnum) {
+
+% my $link = "${p}edit/cust_main.cgi?qualnum=". $qual->qualnum.
+% ";lock_pkgpart=$pkgpart";
+ <A HREF="<% $link %>"><% $pkglist->{$pkgpart} |h %></A>
+
% }
- <LI>
-% if($cust_or_prospect && $cust_or_prospect->custnum) {
- <% include('/view/cust_main/order_pkg_link.html', $qual->cust_or_prospect, %opt) %>
-% }
-% else {
- <% $opt{label} %>
-% }
- </LI>
+ </LI>
% }
- </UL>
+ </UL>
% }
% my $not_avail = $qual_result->{'not_avail'};
@@ -101,7 +110,7 @@ my $location_kind;
$location_kind = "Residential" if $cust_location->get('location_kind') eq 'R';
$location_kind = "Business" if $cust_location->get('location_kind') eq 'B';
-my $cust_or_prospect = $qual->cust_or_prospect;
+my $cust_or_prospect = $qual->cust_or_prospect; #or die? qual without this?
my $export = $qual->part_export;
</%init>