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 <% mt('Quantity:') |h %>
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.html?pkgnum='. $cust_pkg->pkgnum.
82 % if ( @invoice_detail ) {
84 <& /elements/table-grid.html &>
86 <TH BGCOLOR="#dddddd" STYLE="border-bottom: dashed 1px black; padding-bottom: 1px">
88 <% mt('Invoice details') |h %>
89 % if ( $editi && ! $cust_pkg->get('cancel') ) {
90 (<& /elements/popup_link.html, {
91 'action' => $editlink. 'I',
92 'label' => emt('edit'),
93 'actionlabel' => emt('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' => emt('Add invoice details'),
116 'actionlabel' => emt('Add invoice details'),
117 'color' => '#333399',
128 <& /elements/table-grid.html &>
130 <TH BGCOLOR="#dddddd" STYLE="border-bottom: dashed 1px black; padding-bottom: 1px">
132 <% mt('Comments') |h %>
134 (<& /elements/popup_link.html, {
135 'action' => $editlink. 'C',
136 'label' => emt('edit'),
137 'actionlabel' => emt('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 ( <& /elements/popup_link.html, {
158 'action' => $editlink. 'C',
159 'label' => emt('Add comments'),
160 'actionlabel' => emt('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' => emt('Change package'),
214 'actionlabel' => emt('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' => emt('Change location'),
227 'actionlabel' => emt('Change'),
228 'cust_pkg' => $cust_pkg,
232 sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', emt('Edit dates'), @_ ); }
234 sub pkg_discount_link {
235 my $cust_pkg = shift or return '';
236 include( '/elements/popup_link-cust_pkg.html',
237 'action' => $p.'edit/cust_pkg_discount.html',
238 'label' => emt('Discount'),
239 'actionlabel' => emt('Discount'),
240 'cust_pkg' => $cust_pkg,
245 sub pkg_customize_link {
246 my $cust_pkg = shift or return '';
247 my $part_pkg = shift;
248 my $custnum = $cust_pkg->custnum;
249 qq!<A HREF="${p}edit/part_pkg.cgi?!.
250 "clone=". $part_pkg->pkgpart. ';'.
251 "pkgnum=". $cust_pkg->pkgnum.
252 qq!">!.emt('Customize').'</A>';
257 qq!<a href="${p}search/cust_event.html?pkgnum=!. $cust_pkg->pkgnum. qq!">!.
258 emt('View package events').