8ab0032ad2078ac57f81c5ce2db8b6033a461250
[freeside.git] / httemplate / view / qual.cgi
1 <% include("/elements/header.html","View Qualification") %>
2
3 % if ( $cust_or_prospect->get('custnum') ) {
4
5   <% include( '/elements/small_custview.html', $cust_or_prospect->custnum, '', 1,
6      "${p}view/cust_main.cgi") %>
7
8 % } elsif ( $cust_or_prospect->get('prospectnum') ) {
9 %       my $prospectnum = $cust_or_prospect->get('prospectnum');
10 %       my $link = "${p}view/prospect_main.html?$prospectnum";
11         <A HREF="<%$link%>">Prospect #<%$prospectnum%></A>
12 % }
13
14 <BR><BR>
15
16 <B>Qualification #<% $qual->qualnum %></B>
17 <% ntable("#cccccc", 2) %>
18 <% include('elements/tr.html', label => 'Status', value => $qual->status_long ) %>
19 <% include('elements/tr.html', label => 'Service Telephone Number', value => $qual->phonenum ) %>
20 <% include('elements/tr.html', label => 'Address', value => $location_line ) %>
21 % if ( $location_kind ) {
22 <% include('elements/tr.html', label => 'Location Kind', value => $location_kind ) %>
23 % } if ( $export ) { 
24 <% include('elements/tr.html', label => 'Qualified using', value => $export->exportname ) %>
25 <% include('elements/tr.html', label => 'Vendor Qualification #', value => $qual->vendor_qual_id ) %>
26 % } 
27 </TABLE>
28 <BR><BR>
29
30 % if ( $export ) {
31 <% $export->qual_html($qual) %>
32 % }
33
34 <%init>
35
36 die "access denied"
37   unless $FS::CurrentUser::CurrentUser->access_right('Qualify service');
38
39 my $qualnum;
40 if ( $cgi->param('qualnum') ) {
41   $cgi->param('qualnum') =~ /^(\d+)$/ or die "unparsable qualnum";
42   $qualnum = $1;
43 } else {
44   my($query) = $cgi->keywords;
45   $query =~ /^(\d+)$/ or die "no qualnum";
46   $qualnum = $1;
47 }
48
49 my $qual = qsearchs('qual', { qualnum => $qualnum }) or die "invalid qualnum";
50 my $location_line = '';
51 my %location_hash = $qual->location;
52 my $cust_location;
53 if ( %location_hash ) {
54     $cust_location = new FS::cust_location(\%location_hash);
55     $location_line = $cust_location->location_label;
56 }
57
58 my $location_kind;
59 $location_kind = "Residential" if $cust_location->get('location_kind') eq 'R';
60 $location_kind = "Business" if $cust_location->get('location_kind') eq 'B';
61
62 my $cust_or_prospect = $qual->cust_or_prospect;
63 my $export = $qual->part_export;
64
65 </%init>