1 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>" VALIGN="top">
2 <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
5 <A NAME="cust_pkg<% $cust_pkg->pkgnum %>"
6 ID ="cust_pkg<% $cust_pkg->pkgnum %>"
7 ><% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><B><% $part_pkg->pkg |h %></B></A>
9 <% $part_pkg->custom_comment |h %>
13 % if ( $cust_pkg->quantity > 1 ) {
16 Quantity:
17 <B><% $cust_pkg->quantity %></B>
26 % unless ( $cust_pkg->get('cancel') ) {
29 % if ( $curuser->access_right('Change customer package') ) {
31 ( <%pkg_change_link($cust_pkg)%> )
34 % if ( $curuser->access_right('Edit customer package dates') ) {
36 ( <%pkg_dates_link($cust_pkg)%> )
39 % if ( $curuser->access_right('Discount customer package')
40 % && $part_pkg->can_discount
41 % && ! scalar($cust_pkg->cust_pkg_discount_active)
42 % && ! scalar($cust_pkg->part_pkg->part_pkg_discount)
46 ( <%pkg_discount_link($cust_pkg)%> )
49 % if ( $curuser->access_right('Customize customer package') ) {
51 ( <%pkg_customize_link($cust_pkg,$part_pkg)%> )
54 <% $br ? '<BR>' : '' %>
57 % if ( $cust_pkg->num_cust_event
58 % && ( $curuser->access_right('Billing event reports')
59 % || $curuser->access_right('View customer billing events')
62 ( <%pkg_event_link($cust_pkg)%> )
69 % my $editi = $curuser->access_right('Edit customer package invoice details');
70 % my $editc = $curuser->access_right('Edit customer package comments');
71 % my @cust_pkg_detail = $cust_pkg->cust_pkg_detail;
72 % my @invoice_detail = grep { $_->detailtype eq 'I' } @cust_pkg_detail;
73 % my @comments = grep { $_->detailtype eq 'C' } @cust_pkg_detail;
75 % if ( scalar(@invoice_detail) || scalar(@comments) || $editi || $editc ) {
77 % my $editlink = $p. 'edit/cust_pkg_detail?pkgnum='. $cust_pkg->pkgnum.
82 % if ( @invoice_detail ) {
84 <% include('/elements/table-grid.html') %>
86 <TH BGCOLOR="#dddddd" STYLE="border-bottom: dashed 1px black; padding-bottom: 1px">
89 % if ( $editi && ! $cust_pkg->get('cancel') ) {
90 (<% include('/elements/popup_link.html', {
91 'action' => $editlink. 'I',
93 'actionlabel' => 'Edit invoice details',
102 % foreach my $cust_pkg_detail ( @invoice_detail ) {
104 <TD><FONT SIZE="-1"> - <% $cust_pkg_detail->detail |h %></FONT></TD>
111 % if ( $editi && ! $cust_pkg->get('cancel') ) {
113 ( <% include('/elements/popup_link.html', {
114 'action' => $editlink. 'I',
115 'label' => 'Add invoice details',
116 'actionlabel' => 'Add invoice details',
117 'color' => '#333399',
128 <% include('/elements/table-grid.html') %>
130 <TH BGCOLOR="#dddddd" STYLE="border-bottom: dashed 1px black; padding-bottom: 1px">
134 (<% include('/elements/popup_link.html', {
135 'action' => $editlink. 'C',
137 'actionlabel' => 'Edit comments',
138 'color' => '#333399',
146 % foreach my $cust_pkg_detail ( @comments ) {
148 <TD><FONT SIZE="-1"> - <% $cust_pkg_detail->detail |h %></FONT></TD>
157 ( <% include('/elements/popup_link.html', {
158 'action' => $editlink. 'C',
159 'label' => 'Add comments',
160 'actionlabel' => 'Add comments',
161 'color' => '#333399',
171 % if ( $curuser->access_right('Change customer package') and
172 % !$cust_pkg->get('cancel') and
173 % !$opt{'show_location'}) {
176 ( <% pkg_change_location_link($cust_pkg) %> )
189 my $bgcolor = $opt{'bgcolor'};
190 my $cust_pkg = $opt{'cust_pkg'};
191 my $part_pkg = $opt{'part_pkg'};
193 my $curuser = $FS::CurrentUser::CurrentUser;
195 my $countrydefault = $opt{'countrydefault'} || 'US';
196 my $statedefault = $opt{'statedefault'}
197 || ($countrydefault eq 'US' ? 'CA' : '');
201 #false laziness w/status.html
203 my($action, $label, $cust_pkg) = @_;
204 return '' unless $cust_pkg;
205 qq!<a href="$p$action.cgi?!. $cust_pkg->pkgnum. qq!">$label</a>!;
208 sub pkg_change_link {
209 my $cust_pkg = shift;
210 my $locationnum = $cust_pkg->locationnum;
211 include( '/elements/popup_link-cust_pkg.html',
212 'action' => $p. "misc/change_pkg.cgi?locationnum=$locationnum",
213 'label' => 'Change package',
214 'actionlabel' => 'Change',
215 'cust_pkg' => $cust_pkg,
219 sub pkg_change_location_link {
220 my $cust_pkg = shift;
221 my $pkgpart = $cust_pkg->pkgpart;
222 include( '/elements/popup_link-cust_pkg.html',
223 'action' => $p. "misc/change_pkg.cgi?locationnum=-1;pkgpart=$pkgpart;".
224 "address1=;address2=;city=;county=;state=$statedefault;".
225 "zip=;country=$countrydefault",
226 'label' => 'Change location',
227 'actionlabel' => 'Change',
228 'cust_pkg' => $cust_pkg,
232 sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', 'Edit dates', @_ ); }
234 sub pkg_discount_link {
235 my $cust_pkg = shift or return '';
236 #my $part_pkg = shift;
237 #my $custnum = $cust_pkg->custnum;
238 include( '/elements/popup_link-cust_pkg.html',
239 'action' => $p.'edit/cust_pkg_discount.html',
240 'label' => 'Discount',
241 'actionlabel' => 'Discount',
242 'cust_pkg' => $cust_pkg,
247 sub pkg_customize_link {
248 my $cust_pkg = shift or return '';
249 my $part_pkg = shift;
250 my $custnum = $cust_pkg->custnum;
251 qq!<A HREF="${p}edit/part_pkg.cgi?!.
252 "clone=". $part_pkg->pkgpart. ';'.
253 "pkgnum=". $cust_pkg->pkgnum.
259 qq!<a href="${p}search/cust_event.html?pkgnum=!. $cust_pkg->pkgnum. qq!">!.
260 'View package events'.