- 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,
- },
- );
-
- my $export = @exports[0];
- if($export->exporttype eq 'ikano') {
- my $ddd = $cust_pkg->start_date;
- $ddd = time unless $ddd;
-
- 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',
- 'vendor_qual_id',
- { 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
+ 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;
+ }
+
+ if ( $vendor_qual_id ) {
+ splice @fields, -1, 0,
+ { field => 'loop_type',
+ type => 'fixed',
+ value => ( $qual->phonenum ? '' : '0' ),
+ formatted_value => ( $qual->phonenum ? 'Line-share'
+ : 'Standalone' ),
+ };
+ } else {
+ 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',
+ ;
+
+ if ( $vendor_qual_id ) {
+ push @fields,
+ { field => 'vendor_qual_id',
+ type => 'fixed',
+ value => $vendor_qual_id,
+ };
+ } else {
+ push @fields,
+ { field => 'vendor_qual_id',
+ type => 'select',
+ options => \@prequalids,
+ labels => \%prequal_labels,
+ onchange => 'ikano_vendor_qual_id_changed',
+ };
+ }
+
+ push @fields,
+ { 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 );