set the suspension date before calling service suspensions, fix RADIUS groups suspens...
[freeside.git] / httemplate / view / qual.cgi
1 <% include("/elements/header.html","View Qualification") %>
2
3 % if ( $cust_or_prospect->custnum ) {
4
5     <% include( '/elements/small_custview.html', $cust_or_prospect,
6                   '',                        #countrydefault override
7                   1,                         #no balance
8                   "${p}view/cust_main.cgi"), #url
9     %>
10
11 % } elsif ( $cust_or_prospect->prospectnum ) {
12
13     <% include( '/elements/small_prospect_view.html', $cust_or_prospect) %>
14
15 % }
16
17 <BR><BR>
18
19 <B>Qualification #<% $qual->qualnum %></B>
20 <% ntable("#cccccc", 2) %>
21 <% include('elements/tr.html', label => 'Status', value => $qual->status_long ) %>
22 <% include('elements/tr.html', label => 'Service Telephone Number', value => $qual->phonenum || '(none - dry loop)' ) %>
23 <% include('elements/tr.html', label => 'Address', value => $location_line ) %>
24 % if ( $location_kind ) {
25 <% include('elements/tr.html', label => 'Location Kind', value => $location_kind ) %>
26 % } if ( $export ) { 
27 <% include('elements/tr.html', label => 'Qualified using', value => $export->exportname ) %>
28 <% include('elements/tr.html', label => 'Vendor Qualification #', value => $qual->vendor_qual_id ) %>
29 % } 
30 </TABLE>
31 <BR><BR>
32
33 % if ( $export ) {
34 %   my $qual_result = $export->qual_result($qual);
35 %   if ($qual_result->{'pkglist'}) { # one of the possible formats (?)
36       <B>Qualifying Packages</B> - click to order
37 %     my $svcpart = '';
38 %     my $pkglist = $qual_result->{'pkglist'};
39 %     my $cust_or_prospect = $qual->cust_or_prospect;
40 %     my $locationnum = '';
41 %     my %location = $qual->location_hash;
42 %     my $locationnum = $location{'locationnum'};
43       <UL>
44 %       foreach my $pkgpart ( keys %$pkglist ) { 
45           <LI>
46
47 %           if($cust_or_prospect->custnum) {
48
49 %             my %opt = ( 'label'            => $pkglist->{$pkgpart},
50 %                         'lock_pkgpart'     => $pkgpart,
51 %                         'lock_locationnum' => $location{'locationnum'},
52 %                         'qualnum'          => $qual->qualnum,                
53 %                       );
54 %             if ( $export->exporttype eq 'ikano' ) {
55 %               my $pkg_svc = qsearchs('pkg_svc', { 'pkgpart'     => $pkgpart,
56 %                                                   'primary_svc' => 'Y',
57 %                                                 }
58 %                                     );
59 %               $opt{'svcpart'} = $pkg_svc->svcpart if $pkg_svc;
60 %             }
61
62               <% include('/view/cust_main/order_pkg_link.html',
63                            $cust_or_prospect, %opt) %>
64
65 %           } elsif ($cust_or_prospect->prospectnum) {
66
67 %             my $link = "${p}edit/cust_main.cgi?qualnum=". $qual->qualnum.
68 %                                              ";lock_pkgpart=$pkgpart";
69               <A HREF="<% $link %>"><% $pkglist->{$pkgpart} |h %></A>
70
71 %           }
72           </LI>
73 %       }
74       </UL>
75 %  }
76
77 %  my $not_avail = $qual_result->{'not_avail'};
78 %  if ( keys %$not_avail ) {
79      <BR>
80      Qualifying vendor packages (not yet configured in any package definition):
81      <% join(', ', map $not_avail->{$_}, keys %$not_avail ) |h %>
82 %  }
83
84 % }
85
86 <%init>
87
88 die "access denied"
89   unless $FS::CurrentUser::CurrentUser->access_right('Qualify service');
90
91 my $qualnum;
92 if ( $cgi->param('qualnum') ) {
93   $cgi->param('qualnum') =~ /^(\d+)$/ or die "unparsable qualnum";
94   $qualnum = $1;
95 } else {
96   my($query) = $cgi->keywords;
97   $query =~ /^(\d+)$/ or die "no qualnum";
98   $qualnum = $1;
99 }
100
101 my $qual = qsearchs('qual', { qualnum => $qualnum }) or die "invalid qualnum";
102 my $location_line = '';
103 my %location_hash = $qual->location_hash;
104 my $cust_location;
105 if ( %location_hash ) {
106     $cust_location = new FS::cust_location(\%location_hash);
107     $location_line = $cust_location->location_label;
108 }
109
110 my $location_kind;
111 $location_kind = "Residential" if $cust_location->get('location_kind') eq 'R';
112 $location_kind = "Business" if $cust_location->get('location_kind') eq 'B';
113
114 my $cust_or_prospect = $qual->cust_or_prospect; #or die?  qual without this?
115 my $export = $qual->part_export;
116
117 </%init>