summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2011-04-29 08:58:19 +0000
committermark <mark>2011-04-29 08:58:19 +0000
commit91fd4ea0e91ee9e6717e0b12e01eebb8f8b21322 (patch)
tree9d2cb55cb767422e00e6cadd6c91714a77e87943
parent4cd3537f6e3e14a596c67478bb83b2095303ec50 (diff)
svc_dish and svc_hardware fixes, #11454
-rw-r--r--FS/FS/Schema.pm5
-rw-r--r--FS/FS/svc_dish.pm8
-rw-r--r--FS/FS/svc_hardware.pm4
-rw-r--r--httemplate/browse/hardware_status.html2
-rw-r--r--httemplate/edit/hardware_status.html24
-rw-r--r--httemplate/edit/svc_dish.cgi5
-rw-r--r--httemplate/edit/svc_hardware.cgi6
-rwxr-xr-xhttemplate/search/report_svc_hardware.html10
-rw-r--r--httemplate/search/svc_hardware.cgi26
-rw-r--r--httemplate/view/svc_dish.cgi5
-rw-r--r--httemplate/view/svc_hardware.cgi2
11 files changed, 79 insertions, 18 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index cc0f21f..5d453ac 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -2022,6 +2022,7 @@ sub tables_hashref {
'columns' => [
'svcnum', 'int', '', '', '', '',
'acctnum', 'varchar', '', 16, '', '',
+ 'installdate', @date_type, '', '',
'note', 'text', 'NULL', '', '', '',
],
'primary_key' => 'svcnum',
@@ -2036,7 +2037,8 @@ sub tables_hashref {
'serial', 'varchar', 'NULL', $char_d, '', '',
'ip_addr', 'varchar', 'NULL', 40, '', '',
'hw_addr', 'varchar', 'NULL', 12, '', '',
- 'statusnum','int', 'NULL', '', '', '',
+ 'smartcard','varchar', 'NULL', 30, '', '',
+ 'statusnum','int', 'NULL', '', '', '',
'note', 'text', 'NULL', '', '', '',
],
'primary_key' => 'svcnum',
@@ -2069,6 +2071,7 @@ sub tables_hashref {
'columns' => [
'statusnum', 'serial', '', '', '', '',
'label' ,'varchar', '', $char_d, '', '',
+ 'disabled', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'statusnum',
'unique' => [ ],
diff --git a/FS/FS/svc_dish.pm b/FS/FS/svc_dish.pm
index 5dac4f4..e254bf5 100644
--- a/FS/FS/svc_dish.pm
+++ b/FS/FS/svc_dish.pm
@@ -36,6 +36,8 @@ The following fields are currently supported:
=item acctnum - DISH account number
+=item installdate - Installation date (as Unix timestamp)
+
=item note - Installation notes: location on property, physical access, etc.
=back
@@ -62,8 +64,9 @@ sub table_info {
'display_weight' => 58,
'cancel_weight' => 85,
'fields' => {
- 'svcnum' => { label => 'Service' },
- 'acctnum' => { label => 'DISH account#', %opts },
+ 'svcnum' => { label => 'Service' },
+ 'acctnum' => { label => 'DISH account#', %opts },
+ 'installdate' => { label => 'Install date', %opts },
'note' => { label => 'Installation notes', %opts },
}
}
@@ -112,6 +115,7 @@ sub check {
my $error =
$self->ut_numbern('svcnum')
|| $self->ut_text('acctnum')
+ || $self->ut_numbern('installdate')
|| $self->ut_textn('note')
;
return $error if $error;
diff --git a/FS/FS/svc_hardware.pm b/FS/FS/svc_hardware.pm
index 96a8e76..8f037f7 100644
--- a/FS/FS/svc_hardware.pm
+++ b/FS/FS/svc_hardware.pm
@@ -45,6 +45,8 @@ The following fields are currently supported:
=item serial - Serial number
+=item smartcard - Smartcard number, for devices that use a smartcard
+
=item statusnum - Service status (see L<FS::hardware_status>)
=item note - Installation notes: location on property, physical access, etc.
@@ -82,6 +84,7 @@ sub table_info {
'serial' => { label => 'Serial number', %opts },
'hw_addr' => { label => 'Hardware address', %opts },
'ip_addr' => { label => 'IP address', %opts },
+ 'smartcard' => { label => 'Smartcard #', %opts },
'statusnum' => { label => 'Service status',
type => 'select',
select_table => 'hardware_status',
@@ -165,6 +168,7 @@ sub check {
|| $self->ut_ip46n('ip_addr')
|| $self->ut_hexn('hw_addr')
|| $self->ut_alphan('serial')
+ || $self->ut_alphan('smartcard')
|| $self->ut_foreign_keyn('statusnum', 'hardware_status', 'statusnum')
|| $self->ut_textn('note')
;
diff --git a/httemplate/browse/hardware_status.html b/httemplate/browse/hardware_status.html
index 9695ed3..89ae830 100644
--- a/httemplate/browse/hardware_status.html
+++ b/httemplate/browse/hardware_status.html
@@ -2,6 +2,8 @@
'title' => 'Hardware Statuses',
'name' => 'hardware statuses',
'menubar' => $menubar,
+ 'disableable' => 1,
+ 'disabled_statuspos' => 2,
'query' => { 'table' => 'hardware_status', },
'count_query' => 'SELECT COUNT(*) FROM hardware_status',
'header' => [ '#', 'Status' ],
diff --git a/httemplate/edit/hardware_status.html b/httemplate/edit/hardware_status.html
index ee5f25d..23e5b6e 100644
--- a/httemplate/edit/hardware_status.html
+++ b/httemplate/edit/hardware_status.html
@@ -1,12 +1,20 @@
<% include( 'elements/edit.html',
- 'name' => 'Hardware Status',
- 'table' => 'hardware_status',
- 'labels' => {
- 'statusnum' => 'Status number',
- 'label' => 'Description' ,
- },
- 'viewall_dir' => 'browse',
- )
+ 'name_singular' => 'Hardware Status',
+ 'table' => 'hardware_status',
+ 'labels' => {
+ 'statusnum' => 'Status number',
+ 'label' => 'Description' ,
+ 'disabled' => 'Disable status'
+ },
+ 'fields' => [
+ 'label',
+ { field => 'disabled',
+ type => 'checkbox',
+ value => 'Y',
+ },
+ ],
+ 'viewall_dir' => 'browse',
+ )
%>
<%init>
diff --git a/httemplate/edit/svc_dish.cgi b/httemplate/edit/svc_dish.cgi
index 77a2239..57df498 100644
--- a/httemplate/edit/svc_dish.cgi
+++ b/httemplate/edit/svc_dish.cgi
@@ -21,6 +21,11 @@ my @fields = (
label => 'DISH Account #',
},
{
+ field => 'installdate',
+ type => 'input-date-field',
+ label => 'Install date',
+ },
+ {
field => 'note',
type => 'textarea',
rows => 4,
diff --git a/httemplate/edit/svc_hardware.cgi b/httemplate/edit/svc_hardware.cgi
index e6cb22b..cde7449 100644
--- a/httemplate/edit/svc_hardware.cgi
+++ b/httemplate/edit/svc_hardware.cgi
@@ -35,12 +35,18 @@ my @fields = (
label => 'IP address',
},
{
+ field => 'smartcard',
+ type => 'text',
+ label => 'Smartcard #',
+ },
+ {
field => 'statusnum',
type => 'select-table',
table => 'hardware_status',
label => 'Service status',
name_col => 'label',
disable_empty => 1,
+ hashref => { 'disabled' => '' },
},
{
field => 'note',
diff --git a/httemplate/search/report_svc_hardware.html b/httemplate/search/report_svc_hardware.html
index 4a763b0..07a6241 100755
--- a/httemplate/search/report_svc_hardware.html
+++ b/httemplate/search/report_svc_hardware.html
@@ -20,7 +20,7 @@
<% include('/elements/tr-input-text.html',
'field' => 'serial',
- 'label' => 'Serial #',
+ 'label' => 'Serial number',
) %>
<% include('/elements/tr-input-text.html',
'field' => 'hw_addr',
@@ -30,12 +30,20 @@
'field' => 'ip_addr',
'label' => 'IP address',
) %>
+ <% include('/elements/tr-input-text.html',
+ 'field' => 'smartcard',
+ 'label' => 'Smartcard #',
+ ) %>
<% include('/elements/tr-select-table.html',
'field' => 'statusnum',
'label' => 'Service status',
'table' => 'hardware_status',
'name_col' => 'label',
'empty_label' => 'any',
+ 'hashref' => {},
+ 'extra_sql' => ' WHERE hardware_status.disabled IS NULL
+OR (SELECT COUNT(*) FROM svc_hardware
+ WHERE svc_hardware.statusnum = hardware_status.statusnum) > 0',
) %>
</TABLE>
diff --git a/httemplate/search/svc_hardware.cgi b/httemplate/search/svc_hardware.cgi
index ffbb9f3..2ff868e 100644
--- a/httemplate/search/svc_hardware.cgi
+++ b/httemplate/search/svc_hardware.cgi
@@ -10,6 +10,7 @@
'Serial #',
'Hardware addr.',
'IP addr.',
+ 'Smartcard',
FS::UI::Web::cust_header(),
],
'fields' => [ 'svcnum',
@@ -18,16 +19,19 @@
'serial',
'hw_addr',
'ip_addr',
+ 'smartcard',
\&FS::UI::Web::cust_fields,
],
- 'links' => [ ($link_svc) x 6,
+ 'links' => [ ($link_svc) x 7,
( 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() ],
+ 'align' => 'rllllll' . FS::UI::Web::cust_aligns(),
+ 'color' => [ ('') x 7,
+ FS::UI::Web::cust_colors() ],
+ 'style' => [ $svc_cancel_style, ('') x 6,
+ FS::UI::Web::cust_styles() ],
)
%>
<%init>
@@ -67,6 +71,10 @@ if ( $ip ) {
push @extra_sql, "ip_addr = '".lc($ip->addr)."'";
}
+if ( lc($cgi->param('smartcard')) =~ /^(\w+)$/ ) {
+ push @extra_sql, "LOWER(smartcard) LIKE '%$1%'";
+}
+
if ( $cgi->param('statusnum') =~ /^(\d+)$/ ) {
push @extra_sql, "statusnum = $1";
}
@@ -78,6 +86,10 @@ if ( $cgi->param('classnum') =~ /^(\d+)$/ ) {
}
}
+if ( $cgi->param('svcpart') =~ /^(\d+)$/ ) {
+ push @extra_sql, "cust_svc.svcpart = $1";
+}
+
my ($orderby) = $cgi->param('orderby') =~ /^(\w+( ASC| DESC)?)$/i;
$orderby ||= 'svcnum';
@@ -91,6 +103,7 @@ my $sql_query = {
'part_svc.svc',
'cust_main.custnum',
'hardware_type.model',
+ 'cust_pkg.cancel',
FS::UI::Web::cust_sql_fields(),
),
'hashref' => {},
@@ -103,4 +116,9 @@ 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' ];
+my $svc_cancel_style = sub {
+ my $svc = shift;
+ ( $svc->getfield('cancel') == 0 ) ? '' : 's';
+};
+
</%init>
diff --git a/httemplate/view/svc_dish.cgi b/httemplate/view/svc_dish.cgi
index d4aa8bf..768c137 100644
--- a/httemplate/view/svc_dish.cgi
+++ b/httemplate/view/svc_dish.cgi
@@ -12,5 +12,8 @@ my %labels = map { $_ => ( ref($fields->{$_})
: $fields->{$_}
);
} keys %$fields;
-my @fields = qw( acctnum note );
+my @fields = ('acctnum',
+ { field => 'installdate', type => 'date' },
+ 'note'
+ );
</%init>
diff --git a/httemplate/view/svc_hardware.cgi b/httemplate/view/svc_hardware.cgi
index 9cea341..8201e9d 100644
--- a/httemplate/view/svc_hardware.cgi
+++ b/httemplate/view/svc_hardware.cgi
@@ -20,5 +20,5 @@ my $status = { field => 'statusnum',
type => 'text',
value => sub { $_[0]->status_label }
};
-my @fields = ($model, qw( serial hw_addr ip_addr ), $status, 'note' );
+my @fields = ($model, qw( serial hw_addr ip_addr smartcard ), $status, 'note' );
</%init>