[freeside-commits] freeside/httemplate/search report_svc_hardware.html, NONE, 1.1 svc_dish.cgi, NONE, 1.1 svc_hardware.cgi, NONE, 1.1
Mark Wells
mark at wavetail.420.am
Thu Mar 31 19:52:24 PDT 2011
- Previous message: [freeside-commits] freeside/httemplate/elements menu.html, 1.112, 1.113 select-hardware_class.html, NONE, 1.1 select-hardware_type.html, NONE, 1.1 tr-cust_svc.html, NONE, 1.1 tr-cust_svc_cancel.html, NONE, 1.1 tr-select-hardware_type.html, NONE, 1.1
- Next message: [freeside-commits] freeside/httemplate/view/cust_main/packages services.html, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv29538/httemplate/search
Added Files:
report_svc_hardware.html svc_dish.cgi svc_hardware.cgi
Log Message:
svc_hardware and svc_dish, #11454
--- NEW FILE: svc_dish.cgi ---
<% include( 'elements/search.html',
'title' => 'Dish Network Search Results',
'name' => 'services',
'query' => $sql_query,
'count_query' => $count_query,
'redirect' => $link,
'header' => [ '#',
'Service',
'Account #',
FS::UI::Web::cust_header(),
],
'fields' => [ 'svcnum',
'svc',
'acctnum',
\&FS::UI::Web::cust_fields,
],
'links' => [ $link,
$link,
$link,
( map { $_ ne 'Cust. Status' ? $link_cust : '' }
FS::UI::Web::cust_header()
),
],
'align' => 'rll'. FS::UI::Web::cust_aligns(),
'color' => [
'',
'',
'',
FS::UI::Web::cust_colors(),
],
'style' => [
'',
'',
'',
FS::UI::Web::cust_styles(),
],
)
%>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('List services');
#my $conf = new FS::Conf;
my $orderby = 'ORDER BY svcnum';
my @extra_sql = ();
if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) {
push @extra_sql, 'pkgnum IS NULL'
if $cgi->param('magic') eq 'unlinked';
if ( $cgi->param('sortby') =~ /^(\w+)$/ ) {
my $sortby = $1;
$orderby = "ORDER BY $sortby";
}
} elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) {
push @extra_sql, "svcpart = $1";
}
my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '.
' LEFT JOIN part_svc USING ( svcpart ) '.
' LEFT JOIN cust_pkg USING ( pkgnum ) '.
' LEFT JOIN cust_main USING ( custnum ) ';
#here is the agent virtualization
push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql(
'null_right' => 'View/link unlinked services'
);
my $extra_sql =
scalar(@extra_sql)
? ' WHERE '. join(' AND ', @extra_sql )
: '';
my $count_query = "SELECT COUNT(*) FROM svc_dish $addl_from $extra_sql";
my $sql_query = {
'table' => 'svc_dish',
'hashref' => {},
'select' => join(', ',
'svc_dish.*',
'part_svc.svc',
'cust_main.custnum',
FS::UI::Web::cust_sql_fields(),
),
'extra_sql' => $extra_sql,
'order_by' => $orderby,
'addl_from' => $addl_from,
};
my $link = [ "${p}view/svc_dish.cgi?", 'svcnum', ];
my $link_cust = sub {
my $svc_x = shift;
$svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : '';
};
</%init>
--- NEW FILE: svc_hardware.cgi ---
<% include('elements/search.html',
'title' => 'Hardware service search results',
'name' => 'installations',
'query' => $sql_query,
'count_query' => $count_query,
'redirect' => $link_svc,
'header' => [ '#',
'Service',
'Device type',
'Serial #',
'Hardware addr.',
'IP addr.',
FS::UI::Web::cust_header(),
],
'fields' => [ 'svcnum',
'svc',
'model',
'serial',
'hw_addr',
'ip_addr',
\&FS::UI::Web::cust_fields,
],
'links' => [ ($link_svc) x 6,
( map { $_ ne 'Cust. Status' ?
$link_cust : '' }
FS::UI::Web::cust_header() )
],
'align' => 'rllll' . FS::UI::Web::cust_aligns(),
'color' => [ ('') x 4, FS::UI::Web::cust_colors() ],
'style' => [ ('') x 4, FS::UI::Web::cust_styles() ],
)
%>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('List services');
my $addl_from = '
LEFT JOIN cust_svc USING ( svcnum )
LEFT JOIN part_svc USING ( svcpart )
LEFT JOIN cust_pkg USING ( pkgnum )
LEFT JOIN cust_main USING ( custnum )
LEFT JOIN hardware_type USING ( typenum )';
my @extra_sql;
push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql(
'null_right' => 'View/link unlinked services'
);
if ( $cgi->param('magic') =~ /^(unlinked)$/ ) {
push @extra_sql, 'pkgnum IS NULL';
}
if ( lc($cgi->param('serial')) =~ /^(\w+)$/ ) {
push @extra_sql, "LOWER(serial) LIKE '%$1%'";
}
if ( $cgi->param('hw_addr') =~ /^(\S+)$/ ) {
my $hw_addr = uc($1);
$hw_addr =~ s/\W//g;
push @extra_sql, "hw_addr LIKE '%$hw_addr%'";
}
my $ip = NetAddr::IP->new($cgi->param('ip_addr'));
if ( $ip ) {
push @extra_sql, "ip_addr = '".lc($ip->addr)."'";
}
if ( $cgi->param('statusnum') =~ /^(\d+)$/ ) {
push @extra_sql, "statusnum = $1";
}
if ( $cgi->param('classnum') =~ /^(\d+)$/ ) {
push @extra_sql, "hardware_type.classnum = $1";
if ( $cgi->param('classnum'.$1.'typenum') =~ /^(\d+)$/ ) {
push @extra_sql, "svc_hardware.typenum = $1";
}
}
my ($orderby) = $cgi->param('orderby') =~ /^(\w+( ASC| DESC)?)$/i;
$orderby ||= 'svcnum';
my $extra_sql = '';
$extra_sql = ' WHERE '.join(' AND ', @extra_sql) if @extra_sql;
my $sql_query = {
'table' => 'svc_hardware',
'select' => join(', ',
'svc_hardware.*',
'part_svc.svc',
'cust_main.custnum',
'hardware_type.model',
FS::UI::Web::cust_sql_fields(),
),
'hashref' => {},
'extra_sql' => $extra_sql,
'order_by' => "ORDER BY $orderby",
'addl_from' => $addl_from,
};
my $count_query = "SELECT COUNT(*) FROM svc_hardware $addl_from $extra_sql";
my $link_svc = [ $p.'view/svc_hardware.cgi?', 'svcnum' ];
my $link_cust = [ $p.'view/cust_main.cgi?', 'custnum' ];
</%init>
--- NEW FILE: report_svc_hardware.html ---
<% include('/elements/header.html', $title ) %>
<FORM ACTION="svc_hardware.cgi" METHOD="GET">
<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
<TR>
<TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Search options</FONT></TH>
</TR>
<TR><TD>
<% include('/elements/selectlayers.html',
'field' => 'classnum',
'label' => '',
'options' => \@classnums,
'labels' => \%class_labels,
'layer_callback' => \&layer_callback,
'html_between' => '</TD><TD>',
) %>
</TD></TR>
<% include('/elements/tr-input-text.html',
'field' => 'serial',
'label' => 'Serial #',
) %>
<% include('/elements/tr-input-text.html',
'field' => 'hw_addr',
'label' => 'Hardware address',
) %>
<% include('/elements/tr-input-text.html',
'field' => 'ip_addr',
'label' => 'IP address',
) %>
<% include('/elements/tr-select-table.html',
'field' => 'statusnum',
'label' => 'Service status',
'table' => 'hardware_status',
'name_col' => 'label',
'empty_label' => 'any',
) %>
</TABLE>
<BR>
<INPUT TYPE="submit" VALUE="Search">
</FORM>
<% include('/elements/footer.html') %>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('List packages'); #?
my $title = 'Hardware Service Report';
my @classes = qsearch('hardware_class', {});
my @classnums = ('', map { $_->classnum } @classes);
my %class_labels = ('' => 'Select hardware class',
map { $_->classnum => $_->classname } @classes);
sub layer_callback {
my $classnum = shift or return '';
include('/elements/select-hardware_type.html',
'field' => 'classnum'.$classnum.'typenum',
'classnum' => $classnum,
'empty_label' => 'any',
);
}
</%init>
- Previous message: [freeside-commits] freeside/httemplate/elements menu.html, 1.112, 1.113 select-hardware_class.html, NONE, 1.1 select-hardware_type.html, NONE, 1.1 tr-cust_svc.html, NONE, 1.1 tr-cust_svc_cancel.html, NONE, 1.1 tr-select-hardware_type.html, NONE, 1.1
- Next message: [freeside-commits] freeside/httemplate/view/cust_main/packages services.html, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list