'Add on-the-fly suspend reason', #NEW
'Edit customer package invoice details', #NEW
'Edit customer package comments', #NEW
+ 'Qualify service', #NEW
],
###
'description' => 'Default the "Continue recurring billing while suspended" flag to on for new package definitions.',
'type' => 'checkbox',
},
+
+ {
+ 'key' => 'qual-alt-address-format',
+ 'section' => 'UI',
+ 'description' => 'Enable the alternate address format (location type, number, and kind) on qualifications',
+ 'type' => 'checkbox',
+ },
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
my $prefix = $self->has_ship_address ? 'ship_' : '';
my $notfirst = 0;
- foreach (qw ( address1 address2 ) ) {
+ foreach (qw ( address1 address2 location_type location_number ) ) {
my $method = "$prefix$_";
$line .= ($notfirst ? $separator : ''). &$escape($self->$method)
if $self->$method;
&& $optionvalue ne '' );
}
+ # XXX: eventually perhaps this should return both the packages a link to
+ # order each package and go to the svc prov with the prequal id filled in
my $list = "<B>Qualifying Packages:</B><UL>";
my @part_pkgs = qsearch( 'part_pkg', { 'disabled' => '' } );
foreach my $part_pkg ( @part_pkgs ) {
$self->SUPER::check;
}
+sub export {
+ my $self = shift;
+ if ( $self->exportnum ) {
+ return qsearchs('part_export', { exportnum => $self->exportnum } )
+ or die 'invalid exportnum';
+ }
+ '';
+}
+
sub location {
my $self = shift;
if ( $self->locationnum ) {
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
- unless $curuser->access_right('Order customer package'); # XXX: fix me
+ unless $curuser->access_right('Qualify service');
$cgi->param('custnum') =~ /^(\d+)$/
or die 'illegal custnum '. $cgi->param('custnum');
my $export = @exports[0];
if($export->exporttype eq 'ikano') {
- $cgi->param('vendor_qual_id') =~ /^(\d+)$/
- or die 'unparsable vendor_qual_id';
- my $vendor_qual_id = $1;
-
- die "no start date set on customer package" if !$cust_pkg->start_date;
+ my $ddd = $cust_pkg->start_date;
+ $ddd = time unless $ddd;
my @addl_fields = (
{ field => 'loop_type',
'password',
{ field => 'isp_chg', type => 'checkbox', },
'isp_prev',
- { field => 'vendor_qual_id',
- type => 'fixed',
- value => $vendor_qual_id, },
+ 'vendor_qual_id',
{ field => 'vendor_order_type',
type => 'hidden',
value => 'NEW' },
{ field => 'desired_due_date',
type => 'fixed',
formatted_value =>
- time2str($date_format,$cust_pkg->start_date),
- value => $cust_pkg->start_date,
+ time2str($date_format,$ddd),
+ value => $ddd,
},
);
push @fields, @addl_fields;
<% include('/elements/tr-select-cust_location.html',
'cgi' => $cgi,
'cust_main' => $cust_main,
- 'alt_format' => 1, # XXX: use a config option
+ 'alt_format' => $conf->exists('qual-alt-address-format') ? 1 : 0,
'is_optional' => 1,
'no_bold' => 1,
)
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
- unless $curuser->access_right('Order customer package'); # XXX: fix this
+ unless $curuser->access_right('Qualify service');
my $conf = new FS::Conf;
my $date_format = $conf->config('date_format') || '%m/%d/%Y';
--- /dev/null
+<% include( 'elements/search.html',
+ 'title' => 'Qualifications',
+ 'name_singular' => 'qualification',
+ 'query' => { 'table' => 'qual',
+ 'hashref' => $hashref,
+ 'extra_sql' => $extra_sql,
+ 'order_by' => 'ORDER BY qualnum DESC',
+ },
+ 'count_query' => "$count_query $extra_sql",
+ 'header' => [ 'Qualification',
+ 'Status',
+ 'Customer or Prospect',
+ 'Service Telephone Number',
+ 'Address',
+ 'Qualified Using',
+ 'Vendor Qualification #',
+ ],
+ 'align' => 'rcccccc',
+ 'fields' => [ 'qualnum',
+ sub {
+ my $self = shift;
+ $self->status_long;
+ },
+ sub {
+ my $self = shift;
+ my $cust_or_prospect = $self->cust_or_prospect;
+ return $cust_or_prospect->name
+ if $cust_or_prospect->get('custnum');
+ return "Prospect #".$cust_or_prospect->prospectnum
+ if $cust_or_prospect->get('prospectnum');
+ '';
+ },
+ 'phonenum',
+ sub {
+ my $self = shift;
+ my %location_hash = $self->location;
+ # ugh...
+ if ( %location_hash ) {
+ my $loc = new FS::cust_location(\%location_hash);
+ return $loc->location_label;
+ }
+ '';
+ },
+ sub {
+ my $self = shift;
+ my $export = $self->export;
+ my $result = '(manual)';
+ $result = $export->exportname if $export;
+ $result;
+ },
+ 'vendor_qual_id',
+ ],
+ 'links' => [
+ [ "${p}view/qual.cgi?qualnum=", 'qualnum' ],
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ ],
+ )
+%>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Qualify service');
+
+my $hashref = {};
+my $count_query = 'SELECT COUNT(*) FROM qual';
+
+my $extra_sql = '';
+if ( $cgi->param('custnum') && $cgi->param('custnum') =~ /^(\d+)$/ ) {
+ $extra_sql = " where custnum = $1 or locationnum in "
+ . " (select locationnum from cust_location where custnum = $1)";
+}
+
+</%init>
% my $s = 0;
-% # XXX: add qual access right
+% if ( $curuser->access_right('Qualify service') ) {
<% $s++ ? ' | ' : '' %>
<% include('qual_link.html', $cust_main) %>
+% }
% if ( $curuser->access_right('Order customer package') ) {
<% $s++ ? ' | ' : '' %>
</TD>
<TD ALIGN="right">
- <A HREF="<%$p%>search/report_cust_pkg.html?custnum=<% $cust_main->custnum %>">Package reports</A><BR>
+ <A HREF="<%$p%>search/report_cust_pkg.html?custnum=<% $cust_main->custnum %>">Package reports</A>
+% if ( $curuser->access_right('Qualify service') ) {
+ | <A HREF="<%$p%>search/qual.cgi?custnum=<% $cust_main->custnum %>">View Qualifications</A>
+% }
+ <BR>
Service reports:
<A HREF="<%$p%>search/report_svc_acct.html?custnum=<% $cust_main->custnum %>">accounts</A><BR>
Usage reports:
<% include( '/elements/popup_link-cust_main.html',
'action' => $p. 'misc/qual.html',
- 'label' => 'Service Qualification',
- 'actionlabel' => 'Service Qualification',
+ 'label' => 'New Qualification',
+ 'actionlabel' => 'New Qualification',
'color' => '#333399',
'cust_main' => $cust_main,
'closetext' => 'Close',
% my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?';
| <A HREF="<%$url%><%$svcnum%>">Edit this <% $label %></A>
-% unless ( $opt{'disable_unprovision'} ) {
| <A HREF="javascript:areyousure('<%$p.'misc/unprovision.cgi?'.$svcnum%>')">
Unprovision this Service</A>
<BR>
-% }
<% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
<% include("/elements/header.html","View Qualification") %>
-% if ( $cust_or_prospect->custnum ) {
+% if ( $cust_or_prospect->get('custnum') ) {
<% include( '/elements/small_custview.html', $cust_or_prospect->custnum, '', 1,
"${p}view/cust_main.cgi") %>
<%init>
-# XXX: add access right for quals?
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Qualify service');
my $qualnum;
if ( $cgi->param('qualnum') ) {
$cust_location = new FS::cust_location(\%location_hash);
$location_line = $cust_location->location_label;
}
-# XXX: geocode_Mixin location_label doesn't currently have the new cust_location fields - add them
my $location_kind;
-$location_kind = "Residential" if $cust_location->location_kind eq 'R';
-$location_kind = "Business" if $cust_location->location_kind eq 'B';
+$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 $export;
-if ( $qual->exportnum ) {
- $export = qsearchs('part_export', { exportnum => $qual->exportnum } )
- or die 'invalid exportnum';
-}
+my $export = $qual->export;
</%init>
return if ( scalar(@exports) == 0 );
my $export = @exports[0];
- $opt->{'disable_unprovision'} = 1;
@fields = ( 'phonenum',
{ field => 'loop_type',