summaryrefslogtreecommitdiff
path: root/httemplate/view/qual.cgi
blob: ec3a7cf1d5415c7f117e77eef58e90e044c442bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<% include("/elements/header.html","View Qualification") %>

% if ( $cust_or_prospect->get('custnum') ) {

  <% include( '/elements/small_custview.html', $cust_or_prospect->custnum, '', 1,
     "${p}view/cust_main.cgi") %>

% } 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>

<B>Qualification #<% $qual->qualnum %></B>
<% ntable("#cccccc", 2) %>
<% include('elements/tr.html', label => 'Status', value => $qual->status_long ) %>
<% include('elements/tr.html', label => 'Service Telephone Number', value => $qual->phonenum ) %>
<% include('elements/tr.html', label => 'Address', value => $location_line ) %>
% if ( $location_kind ) {
<% include('elements/tr.html', label => 'Location Kind', value => $location_kind ) %>
% } if ( $export ) { 
<% include('elements/tr.html', label => 'Qualified using', value => $export->exportname ) %>
<% include('elements/tr.html', label => 'Vendor Qualification #', value => $qual->vendor_qual_id ) %>
% } 
</TABLE>
<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>
%       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 && $cust_or_prospect->custnum) {
		   <% include('/view/cust_main/order_pkg_link.html', $qual->cust_or_prospect, %opt) %>
%		}
%		else {
		    <% $opt{label} %>
%		}
	    </LI>
%       }
    </UL>
%  }
% }

<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Qualify service');

my $qualnum;
if ( $cgi->param('qualnum') ) {
  $cgi->param('qualnum') =~ /^(\d+)$/ or die "unparsable qualnum";
  $qualnum = $1;
} else {
  my($query) = $cgi->keywords;
  $query =~ /^(\d+)$/ or die "no qualnum";
  $qualnum = $1;
}

my $qual = qsearchs('qual', { qualnum => $qualnum }) or die "invalid qualnum";
my $location_line = '';
my %location_hash = $qual->location_hash;
my $cust_location;
if ( %location_hash ) {
    $cust_location = new FS::cust_location(\%location_hash);
    $location_line = $cust_location->location_label;
}

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 $export = $qual->part_export;

</%init>