X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpackages.html;h=566ab294384a86dcaaa27e1b97c8112839391938;hb=7f2d0815adb38e78ed46661e3e09d499fbcbe989;hp=7d79306342eff6fced37398e59ecd9d1f901624b;hpb=a6fe07e49e3fc12169e801b1ed6874c3a5bd8500;p=freeside.git diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 7d7930634..566ab2943 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -1,4 +1,32 @@ -% my $s = 0; + + +% unless ( $opt{no_links} ) { + +% my $s = 0; % if ( $curuser->access_right('Qualify service') ) { <% $s++ ? ' | ' : '' %> @@ -17,21 +45,33 @@ <& one_time_charge_link.html, $cust_main &> % } +% if ( $curuser->access_right('Bulk move customer services') ) { + <% $s++ ? ' | ' : '' %> + + <& /elements/popup_link-cust_main.html, + 'label' => emt('Move services between packages'), + 'action' => "${p}edit/bulk-cust_svc-pkgnum.html", + 'cust_main' => $cust_main, + 'actionlabel' => emt('Move services'), + 'width' => 968, #763, + 'height' => 575, + &> + +% } + % if ( $curuser->access_right('Bulk change customer packages') ) { <% $s++ ? ' | ' : '' %> - <% mt('Bulk order and cancel packages') |h %> (<% mt('preserves services') |h %>) + <% mt('Bulk order and cancel packages') |h %> % }

+% } # unless $opt{no_links} + + +% unless ( $opt{no_links} ) { + + +% } # unless $opt{no_links} +
-% if ( @$packages ) { - -<% mt('Current packages') |h %> -% } % if ( $cust_main->num_cancelled_pkgs ) { % if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me % || ( $conf->exists('hidecancelledpackages') @@ -60,6 +100,9 @@ % } <% mt('Package reports') |h %> % if ( $curuser->access_right('Qualify service') ) { @@ -71,14 +114,18 @@ <% mt('Usage reports:') |h %> <% mt('CDRs') |h %>
-% if ( $conf->exists('cust_pkg-group_by_location') and $show_location ) { +% if ( $conf->exists('cust_pkg-group_by_location') ) { <& locations.html, 'cust_main' => $cust_main, 'packages' => $packages, + %opt, &> % } % else { @@ -87,7 +134,7 @@ <& packages/section.html, 'cust_main' => $cust_main, 'packages' => $packages, - 'show_location' => $show_location, + %opt, &>
% } @@ -114,10 +161,6 @@ my $curuser = $FS::CurrentUser::CurrentUser; my( $packages, $num_old_packages ) = get_packages($cust_main, $conf); - -my $show_location = $conf->exists('cust_pkg-always_show_location') - || (grep $_->locationnum, @$packages); # ? '1' : '0'; - my $countrydefault = scalar($conf->config('countrydefault')) || 'US'; #subroutines @@ -155,11 +198,30 @@ sub get_packages { } ); my $num_old_packages = scalar(@packages); + my %change_to_from; # target pkgnum => current cust_pkg, for future changes + foreach my $cust_pkg ( @packages ) { my %hash = $cust_pkg->hash; my %part_pkg = map { /^part_pkg_(.+)$/ or die; ( $1 => $hash{$_} ); } grep { /^part_pkg_/ } keys %hash; $cust_pkg->{'_pkgpart'} = new FS::part_pkg \%part_pkg; + if ( $cust_pkg->change_to_pkgnum ) { + $change_to_from{$cust_pkg->change_to_pkgnum} = $cust_pkg; + } + } + + if ( keys %change_to_from ) { + my @not_future_packages; + foreach my $cust_pkg (@packages) { + if ( exists( $change_to_from{$cust_pkg->pkgnum} ) ) { + my $change_from = $change_to_from{ $cust_pkg->pkgnum }; + $cust_pkg->set('change_from_pkg', $change_from); + $change_from->set('change_to_pkg', $cust_pkg); + } else { + push @not_future_packages, $cust_pkg; + } + } + @packages = @not_future_packages; } unless ( $cgi->param('showoldpackages') ) { @@ -178,6 +240,11 @@ sub get_packages { } $num_old_packages -= scalar(@packages); + + # don't include supplemental packages in this list; they'll be found from + # their main packages + # (as will change-target packages) + @packages = grep !$_->main_pkgnum, @packages; ( \@packages, $num_old_packages ); }