2 <TD CLASS="background" COLSPAN=99>
4 <% itable('', 4, 1) %><TR><TD VALIGN="top">
7 %foreach my $part_svc ( @part_svc ) {
8 % my $svcpart = $part_svc->svcpart;
9 % my $pkg_svc = $pkg_svc{$svcpart}
10 % ||= qsearchs('pkg_svc', { 'pkgpart' => $pkgpart,
11 % 'svcpart' => $svcpart } )
12 % || new FS::pkg_svc ( {
13 % 'pkgpart' => $pkgpart,
14 % 'svcpart' => $svcpart,
16 % 'primary_svc' => '',
20 % if ( $cgi->param('error') ) {
21 % my $primary_svc = ( $pkg_svc->primary_svc =~ /^Y/i );
22 % my $pkg_svc_primary = scalar($cgi->param('pkg_svc_primary'));
23 % $pkg_svc->primary_svc('')
24 % if $primary_svc && $pkg_svc_primary != $svcpart;
25 % $pkg_svc->primary_svc('Y')
26 % if ! $primary_svc && $pkg_svc_primary == $svcpart;
30 % if ( $cgi->param("pkg_svc$svcpart") =~ /^\s*(\d+)\s*$/ ) {
32 % } elsif ( $pkg_svc->quantity ) {
33 % $quan = $pkg_svc->quantity;
37 % if ( grep { $_ eq "hidden_svc$svcpart" } $cgi->param ) {
38 % $hidden = $cgi->param("hidden_svc$svcpart");
40 % $hidden = $pkg_svc->hidden;
43 % if ( grep { $_ eq "no_bulk_skip$svcpart" } $cgi->param ) {
44 % $bulk_skip = $cgi->param("no_bulk_skip$svcpart") eq 'Y' ? '' : 'Y';
46 % $bulk_skip = $pkg_svc->bulk_skip;
49 % my @exports = $pkg_svc->part_svc->part_export;
50 % foreach my $export ( @exports ) {
51 % push @possible_exports, $export if $export->can('external_pkg_map');
56 <INPUT TYPE="text" NAME="pkg_svc<% $svcpart %>" SIZE=4 MAXLENGTH=6 VALUE="<% $quan %>">
60 <INPUT TYPE="radio" NAME="pkg_svc_primary" VALUE="<% $svcpart %>" <% $pkg_svc->primary_svc =~ /^Y/i ? ' CHECKED' : '' %>>
64 <A HREF="part_svc.cgi?<% $part_svc->svcpart %>"><% $part_svc->svc %></A> <% $part_svc->disabled =~ /^Y/i ? ' (DISABLED)' : '' %>
68 <INPUT TYPE="checkbox" NAME="hidden<% $svcpart %>" VALUE="Y"<% $hidden =~ /^Y/i ? ' CHECKED' : ''%>>
72 <INPUT TYPE="checkbox" NAME="no_bulk_skip<% $svcpart %>" VALUE="Y"<% $bulk_skip =~ /^Y/i ? '' : ' CHECKED' %>>
76 % foreach ( 1 .. $columns-1 ) {
77 % if ( $count == int( $_ * scalar(@part_svc) / $columns ) ) {
80 </TABLE></TD><TD VALIGN="top"><% $thead %>
87 </TR></TABLE></TD></TR></TABLE>
89 % if ( scalar(@possible_exports) > 0 || scalar(@mapped_exports) > 0 ) {
91 <TH BGCOLOR="#dcdcdc">Export</TH>
92 <TH BGCOLOR="#dcdcdc">Vendor Package Id <FONT SIZE="-2">(blank to delete)</FONT></TH>
94 % foreach my $export ( @mapped_exports ) {
96 <TD><% $export->exportname %></TD>
97 <TD><INPUT TYPE="text" NAME="export<% $export->exportnum %>"
98 SIZE="30" VALUE="<% $vendor_pkg_ids{$export->exportnum} %>">
102 % foreach my $export ( @possible_exports ) {
103 % unless ( defined $vendor_pkg_ids{$export->exportnum} ) {
105 <TD><% $export->exportname %></TD>
107 <INPUT TYPE="text" NAME="export<% $export->exportnum %>" SIZE="30">
121 my $cgi = $opt{'cgi'};
123 my $thead = "\n\n". ntable('#cccccc', 2).
125 '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Quan.</FONT></TH>'.
126 '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Primary</FONT></TH>'.
127 '<TH BGCOLOR="#dcdcdc">Service</TH>'.
128 '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Hide<BR>from<BR>Invoices</FONT></TH>'.
129 '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Bulk<BR>Charge</FONT></TH>'.
132 my $part_pkg = $opt{'object'};
133 my $pkgpart = $part_pkg->pkgpart;
135 my $where = "WHERE disabled IS NULL OR disabled = ''";
137 $where .= " OR 0 < ( SELECT quantity FROM pkg_svc
138 WHERE pkg_svc.svcpart = part_svc.svcpart
139 AND pkgpart = $pkgpart
142 my @part_svc = qsearch('part_svc', {}, '', $where);
144 #my $q_part_pkg = $clone_part_pkg || $part_pkg;
145 #my %pkg_svc = map { $_->svcpart => $_ } $q_part_pkg->pkg_svc;
146 my %pkg_svc = map { $_->svcpart => $_ } $part_pkg->pkg_svc('disable_linked'=>1);
151 my @possible_exports = ();
152 my @mapped_exports = ();
153 my @part_pkg_vendor = $part_pkg->part_pkg_vendor;
154 foreach my $part_pkg_vendor ( @part_pkg_vendor ) {
155 push @mapped_exports, $part_pkg_vendor->part_export;
157 my %vendor_pkg_ids = $part_pkg->vendor_pkg_ids;