X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpackages%2Fpackage.html;h=0b72d195e5b5e3f6f9eb3337e0b56c55fe6a12b7;hb=6a42226f7f1779974316111cb178a3c6a6d74931;hp=3a362b6fa987aabf07ae92681526eeb9d509545f;hpb=a65d16767bcaa1077be0f41568a4349c9db18990;p=freeside.git diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html index 3a362b6fa..0b72d195e 100644 --- a/httemplate/view/cust_main/packages/package.html +++ b/httemplate/view/cust_main/packages/package.html @@ -24,16 +24,19 @@ -% unless ( $cust_pkg->get('cancel') ) { +% unless ( $cust_pkg->get('cancel') ) { % -% if ( $supplemental ) { -% # then only show "Edit dates", "Add invoice details", and "Add -% # comments". +% if ( $supplemental or $part_pkg->freq eq '0' ) { +% # Supplemental packages can't be changed independently. +% # One-time charges don't need to be changed. +% # For both of those, we only show "Edit dates", "Add comments", +% # and "Add invoice details". % if ( $curuser->access_right('Edit customer package dates') ) { ( <%pkg_dates_link($cust_pkg)%> ) % } % } else { -% # the usual case +% # the usual case: links to change package definition, +% # discount, and customization % my $br = 0; % if ( $curuser->access_right('Change customer package') ) { % $br=1; @@ -181,15 +184,44 @@ % if ( $curuser->access_right('Change customer package') and % !$cust_pkg->get('cancel') and % !$supplemental and -% !$opt{'show_location'}) { +% $part_pkg->freq ne '0' ) { +% if ( !$opt{'show_location'} ) { ( <% pkg_change_location_link($cust_pkg) %> ) +% } +% if ( FS::Conf->new->exists('invoice-unitprice') ) { + + ( <% pkg_change_quantity_link($cust_pkg) %> ) + +% } % } % } +% if ( @cust_pkg_usage ) { + + +% foreach my $usage (@cust_pkg_usage) { +% my $part = $usage->part_pkg_usage; +% my $ratio = 255 * ($usage->minutes / $part->minutes); +% $ratio = 255 if $ratio > 255; # because rollover +% my $color = sprintf('STYLE="font-weight: bold; color: #%02x%02x00"', 255 - $ratio, $ratio); +% my $trstyle = ''; +% $trstyle = ' CLASS="shared"' if $part->shared; + > + + + + +% if ( $part->shared ) { + +% } + +% } +
<% mt('Included usage') %>
<% $part->description %>: ALIGN="right"><% $usage->minutes %>> / ><% $part->minutes %>(shared)
+% } @@ -208,6 +240,17 @@ my $statedefault = $opt{'statedefault'} || ($countrydefault eq 'US' ? 'CA' : ''); my $supplemental = $opt{'supplemental'} || 0; + +$cust_pkg->pkgnum =~ /^(\d+)$/; +my $pkgnum = $1; +my @cust_pkg_usage = qsearch({ + 'select' => 'cust_pkg_usage.*', + 'table' => 'cust_pkg_usage', + 'addl_from' => ' JOIN part_pkg_usage USING (pkgusagepart)', + 'extra_sql' => " WHERE pkgnum = $1", + 'order_by' => ' ORDER BY priority ASC, description ASC', +}); + #subroutines #false laziness w/status.html @@ -241,6 +284,17 @@ sub pkg_change_location_link { ); } +sub pkg_change_quantity_link { + include( '/elements/popup_link-cust_pkg.html', + 'action' => $p. 'edit/cust_pkg_quantity.html?', + 'label' => emt('Change quantity'), + 'actionlabel' => emt('Change'), + 'cust_pkg' => shift, + 'width' => 390, + 'height' => 220, + ); +} + sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', emt('Edit dates'), @_ ); } sub pkg_discount_link {