1 <TD CLASS="inv package" BGCOLOR="<% $bgcolor %>" VALIGN="top"
2 STYLE="border-left-width: <% $supplemental * 30 %>px">
3 <TABLE CLASS="inv package">
6 <A NAME="cust_pkg<% $cust_pkg->pkgnum %>"
7 ID ="cust_pkg<% $cust_pkg->pkgnum %>"
8 ><% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><B><% $part_pkg->pkg |h %></B></A>
10 <% $part_pkg->custom_comment |h %>
14 % if ( $cust_pkg->quantity > 1 ) {
17 <% mt('Quantity:') |h %>
18 <B><% $cust_pkg->quantity %></B>
27 % unless ( $cust_pkg->get('cancel') ) {
29 % if ( $supplemental ) {
30 % # then only show "Edit dates", "Add invoice details", and "Add
32 % if ( $curuser->access_right('Edit customer package dates') ) {
33 ( <%pkg_dates_link($cust_pkg)%> )
38 % if ( $curuser->access_right('Change customer package') ) {
40 ( <%pkg_change_link($cust_pkg)%> )
43 % if ( $curuser->access_right('Edit customer package dates') ) {
45 ( <%pkg_dates_link($cust_pkg)%> )
48 % if ( $curuser->access_right('Discount customer package')
49 % && $part_pkg->can_discount
50 % && ! scalar($cust_pkg->cust_pkg_discount_active)
51 % && ! scalar($cust_pkg->part_pkg->part_pkg_discount)
55 ( <%pkg_discount_link($cust_pkg)%> )
58 % if ( $curuser->access_right('Customize customer package') ) {
60 ( <%pkg_customize_link($cust_pkg,$part_pkg)%> )
63 <% $br ? '<BR>' : '' %>
66 % if ( $cust_pkg->num_cust_event
67 % && ( $curuser->access_right('Billing event reports')
68 % || $curuser->access_right('View customer billing events')
71 ( <%pkg_event_link($cust_pkg)%> )
79 % my $editi = $curuser->access_right('Edit customer package invoice details');
80 % my $editc = $curuser->access_right('Edit customer package comments');
81 % my @cust_pkg_detail = $cust_pkg->cust_pkg_detail;
82 % my @invoice_detail = grep { $_->detailtype eq 'I' } @cust_pkg_detail;
83 % my @comments = grep { $_->detailtype eq 'C' } @cust_pkg_detail;
85 % if ( scalar(@invoice_detail) || scalar(@comments) || $editi || $editc ) {
87 % my $editlink = $p. 'edit/cust_pkg_detail.html?pkgnum='. $cust_pkg->pkgnum.
92 % if ( @invoice_detail ) {
94 <& /elements/table-grid.html &>
96 <TH BGCOLOR="#dddddd" STYLE="border-bottom: dashed 1px black; padding-bottom: 1px">
98 <% mt('Invoice details') |h %>
99 % if ( $editi && ! $cust_pkg->get('cancel') ) {
100 (<& /elements/popup_link.html, {
101 'action' => $editlink. 'I',
102 'label' => emt('edit'),
103 'actionlabel' => emt('Edit invoice details'),
104 'color' => '#333399',
112 % foreach my $cust_pkg_detail ( @invoice_detail ) {
114 <TD><FONT SIZE="-1"> - <% $cust_pkg_detail->detail |h %></FONT></TD>
121 % if ( $editi && ! $cust_pkg->get('cancel') ) {
123 ( <% include('/elements/popup_link.html', {
124 'action' => $editlink. 'I',
125 'label' => emt('Add invoice details'),
126 'actionlabel' => emt('Add invoice details'),
127 'color' => '#333399',
138 <& /elements/table-grid.html &>
140 <TH BGCOLOR="#dddddd" STYLE="border-bottom: dashed 1px black; padding-bottom: 1px">
142 <% mt('Comments') |h %>
144 (<& /elements/popup_link.html, {
145 'action' => $editlink. 'C',
146 'label' => emt('edit'),
147 'actionlabel' => emt('Edit comments'),
148 'color' => '#333399',
156 % foreach my $cust_pkg_detail ( @comments ) {
158 <TD><FONT SIZE="-1"> - <% $cust_pkg_detail->detail |h %></FONT></TD>
167 ( <& /elements/popup_link.html, {
168 'action' => $editlink. 'C',
169 'label' => emt('Add comments'),
170 'actionlabel' => emt('Add comments'),
171 'color' => '#333399',
181 % if ( $curuser->access_right('Change customer package') and
182 % !$cust_pkg->get('cancel') and
184 % !$opt{'show_location'}) {
187 ( <% pkg_change_location_link($cust_pkg) %> )
200 my $bgcolor = $opt{'bgcolor'};
201 my $cust_pkg = $opt{'cust_pkg'};
202 my $part_pkg = $opt{'part_pkg'};
204 my $curuser = $FS::CurrentUser::CurrentUser;
206 my $countrydefault = $opt{'countrydefault'} || 'US';
207 my $statedefault = $opt{'statedefault'}
208 || ($countrydefault eq 'US' ? 'CA' : '');
210 my $supplemental = $opt{'supplemental'} || 0;
213 #false laziness w/status.html
215 my($action, $label, $cust_pkg) = @_;
216 return '' unless $cust_pkg;
217 qq!<a href="$p$action.cgi?!. $cust_pkg->pkgnum. qq!">$label</a>!;
220 sub pkg_change_link {
221 my $cust_pkg = shift;
222 my $locationnum = $cust_pkg->locationnum;
223 include( '/elements/popup_link-cust_pkg.html',
224 'action' => $p. "misc/change_pkg.cgi?locationnum=$locationnum",
225 'label' => emt('Change package'),
226 'actionlabel' => emt('Change'),
227 'cust_pkg' => $cust_pkg,
231 sub pkg_change_location_link {
232 my $cust_pkg = shift;
233 my $pkgpart = $cust_pkg->pkgpart;
234 include( '/elements/popup_link-cust_pkg.html',
235 'action' => $p. "misc/change_pkg.cgi?locationnum=-1;pkgpart=$pkgpart;".
236 "address1=;address2=;city=;county=;state=$statedefault;".
237 "zip=;country=$countrydefault",
238 'label' => emt('Change location'),
239 'actionlabel' => emt('Change'),
240 'cust_pkg' => $cust_pkg,
244 sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', emt('Edit dates'), @_ ); }
246 sub pkg_discount_link {
247 my $cust_pkg = shift or return '';
248 include( '/elements/popup_link-cust_pkg.html',
249 'action' => $p.'edit/cust_pkg_discount.html',
250 'label' => emt('Discount'),
251 'actionlabel' => emt('Discount'),
252 'cust_pkg' => $cust_pkg,
257 sub pkg_customize_link {
258 my $cust_pkg = shift or return '';
259 my $part_pkg = shift;
260 my $custnum = $cust_pkg->custnum;
261 qq!<A HREF="${p}edit/part_pkg.cgi?!.
262 "clone=". $part_pkg->pkgpart. ';'.
263 "pkgnum=". $cust_pkg->pkgnum.
264 qq!">!.emt('Customize').'</A>';
269 qq!<a href="${p}search/cust_event.html?pkgnum=!. $cust_pkg->pkgnum. qq!">!.
270 emt('View package events').