[freeside-commits] freeside/httemplate/view/cust_main packages.html, 1.78, 1.79 locations.html, NONE, 1.1
Mark Wells
mark at wavetail.420.am
Mon Dec 13 23:29:14 PST 2010
- Previous message: [freeside-commits] freeside/FS/FS Conf.pm, 1.405, 1.406 Schema.pm, 1.254, 1.255 cust_location.pm, 1.8, 1.9
- Next message: [freeside-commits] freeside/httemplate/view/cust_main/packages location.html, 1.8, 1.9 package.html, 1.8, 1.9 section.html, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/httemplate/view/cust_main
In directory wavetail.420.am:/tmp/cvs-serv29584/httemplate/view/cust_main
Modified Files:
packages.html
Added Files:
locations.html
Log Message:
cust_location editing features, RT#10766
Index: packages.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/packages.html,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -w -d -r1.78 -r1.79
--- packages.html 14 Dec 2010 06:33:29 -0000 1.78
+++ packages.html 14 Dec 2010 07:29:12 -0000 1.79
@@ -75,61 +75,23 @@
<TR>
<TD COLSPAN=2>
-
-% if ( @$packages ) {
-
-<% include('/elements/table-grid.html') %>
-% my $bgcolor1 = '#eeeeee';
-% my $bgcolor2 = '#ffffff';
-% my $bgcolor = '';
-
-<TR>
- <TH CLASS="grid" BGCOLOR="#cccccc">Package</TH>
- <TH CLASS="grid" BGCOLOR="#cccccc">Status</TH>
-% if ( $show_location ) {
- <TH CLASS="grid" BGCOLOR="#cccccc">Location</TH>
-% }
- <TH CLASS="grid" BGCOLOR="#cccccc">Services</TH>
-</TR>
-
-% #$FS::cust_pkg::DEBUG = 2;
-% foreach my $cust_pkg (@$packages) {
-%
-% if ( $bgcolor eq $bgcolor1 ) {
-% $bgcolor = $bgcolor2;
-% } else {
-% $bgcolor = $bgcolor1;
-% }
-%
-% my %iopt = (
-% 'bgcolor' => $bgcolor,
-% 'cust_pkg' => $cust_pkg,
-% 'part_pkg' => $cust_pkg->part_pkg,
-% %conf_opt,
-% );
-%
-
- <!--pkgnum: <% $cust_pkg->pkgnum %>-->
- <TR>
- <% include('packages/package.html', %iopt) %>
- <% include('packages/status.html', %iopt) %>
-% if ( $show_location ) {
- <% include('packages/location.html', %iopt) %>
-% }
- <% include('packages/services.html', %iopt) %>
- </TR>
-
+% if ( $conf->exists('cust_pkg-group_by_location') and $show_location ) {
+<% include('locations.html',
+ 'cust_main' => $cust_main,
+ 'packages' => $packages,
+) %>
% }
-
+% else {
+% # in this format, put all packages in one section
+<% include('/elements/table-grid.html') %>
+<% include('packages/section.html',
+ 'packages' => $packages,
+ 'show_location' => $show_location,
+) %>
</TABLE>
-
-% } else {
-<BR>
% }
-
</TD>
</TR>
-</TABLE>
% if ( $cgi->param('fragment') =~ /^cust_pkg(\d+)$/ ) {
<SCRIPT>
@@ -140,42 +102,22 @@
if ( el ) el.scrollIntoView(true);
</SCRIPT>
% }
-
+</TABLE>
<%init>
-my( $cust_main ) = @_;
+my $cust_main = shift;
+my %opt = @_;
my $conf = new FS::Conf;
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';
-my %conf_opt = (
- #for services.html and status.html
- 'cust_pkg-display_times' => ($conf->exists('cust_pkg-display_times')
- || $curuser->option('cust_pkg-display_times')),
- #for status.html
- 'cust_pkg-show_autosuspend' => $conf->exists('cust_pkg-show_autosuspend'),
- #for status.html pkg-balances
- 'pkg-balances' => $conf->exists('pkg-balances'),
- 'money_char' => ( $conf->config('money_char') || '$' ),
-
- #for location.html
- 'countrydefault' => $countrydefault,
- 'statedefault' => ( scalar($conf->config('statedefault'))
- || ($countrydefault eq 'US' ? 'CA' : '') ),
- #for services.html
- 'svc_external-skip_manual' => $conf->exists('svc_external-skip_manual'),
- 'legacy_link' => $conf->exists('legacy_link'),
- 'svc_broadband-manage_link' => scalar($conf->config('svc_broadband-manage_link')),
- 'maestro-status_test' => $conf->exists('maestro-status_test'),
- 'cust_pkg-large_pkg_size' => $conf->config('cust_pkg-large_pkg_size'),
-);
-
#subroutines
sub get_packages {
--- NEW FILE: locations.html ---
<STYLE>
span.loclabel {
padding-left: 4px;
padding-right: 4px;
background-color: #cccccc;
border: 1px solid black
}
</STYLE>
% foreach my $locationnum (@sorted) {
% my $packages = $packages_in{$locationnum};
% my $loc = $locations{$locationnum};
% next if $loc->disabled and scalar(@$packages) == 0;
<% include('/elements/table-grid.html') %>
<TR><TH COLSPAN=3 ALIGN="left" VALIGN="bottom"
STYLE="padding-bottom: 0px;
padding-left: 0px;
border-bottom-style: solid;
border-bottom-color: black;
border-bottom-width: 1px;">
<SPAN CLASS="loclabel">
% if (! $locationnum) {
Default service location:
% }
% elsif ( $loc->disabled ) {
<FONT COLOR="#808080"><I>
% }
<% $loc->location_label %></SPAN>
<SPAN STYLE="float:right;">
% if ( $locationnum and !$loc->disabled ) {
<% edit_location_link($locationnum) %>
% }
% if ( !$loc->disabled and !$active{$locationnum} ) {
<% disable_location_link($locationnum) %>
% }
</SPAN></TH></TR>
% if (@$packages) {
<% include('packages/section.html', 'packages' => $packages ) %>
% }
</TABLE><BR>
% } #foreach $locationnum
<%init>
my %opt = @_;
my $cust_main = $opt{'cust_main'};
my $all_packages = $opt{'packages'};
my %locations = map { $_->locationnum => $_ } qsearch({
'table' => 'cust_location',
'hashref' => { 'custnum' => $cust_main->custnum },
'order_by' => 'ORDER BY country, state, city, address1, locationnum',
});
my @sections = keys %locations;
$locations{''} = $cust_main;
my %packages_in = map { $_ => [] } @sections;
my %active = (); # groups with non-canceled packages
foreach my $cust_pkg ( @$all_packages ) {
my $key = $cust_pkg->locationnum;
push @{ $packages_in{$key} }, $cust_pkg;
$active{$key} = 1 if !$cust_pkg->getfield('cancel');
}
my @sorted = (
'',
grep ( { $active{$_} } @sections),
grep ( { !$active{$_} } @sections),
);
sub edit_location_link {
my $locationnum = shift;
include( '/elements/popup_link.html',
'action' => $p. "edit/cust_location.cgi?locationnum=$locationnum",
'label' => '(Edit location)',
'actionlabel' => 'Edit',
);
}
sub disable_location_link {
my $locationnum = shift;
include( '/elements/popup_link.html',
'action' => $p. "misc/disable-cust_location.cgi?locationnum=$locationnum",
'label' => '(Disable location)',
'actionlabel' => 'Disable',
);
}
</%init>
- Previous message: [freeside-commits] freeside/FS/FS Conf.pm, 1.405, 1.406 Schema.pm, 1.254, 1.255 cust_location.pm, 1.8, 1.9
- Next message: [freeside-commits] freeside/httemplate/view/cust_main/packages location.html, 1.8, 1.9 package.html, 1.8, 1.9 section.html, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list