'columns' => [
'svcnum', 'int', '', '', '', '',
'acctnum', 'varchar', '', 16, '', '',
+ 'installdate', @date_type, '', '',
'note', 'text', 'NULL', '', '', '',
],
'primary_key' => 'svcnum',
'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',
'columns' => [
'statusnum', 'serial', '', '', '', '',
'label' ,'varchar', '', $char_d, '', '',
+ 'disabled', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'statusnum',
'unique' => [ ],
=item acctnum - DISH account number
+=item installdate - Installation date (as Unix timestamp)
+
=item note - Installation notes: location on property, physical access, etc.
=back
'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 },
}
}
my $error =
$self->ut_numbern('svcnum')
|| $self->ut_text('acctnum')
+ || $self->ut_numbern('installdate')
|| $self->ut_textn('note')
;
return $error if $error;
=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.
'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',
|| $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')
;
'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' ],
<% 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>
label => 'DISH Account #',
},
{
+ field => 'installdate',
+ type => 'input-date-field',
+ label => 'Install date',
+ },
+ {
field => 'note',
type => 'textarea',
rows => 4,
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',
<% include('/elements/tr-input-text.html',
'field' => 'serial',
- 'label' => 'Serial #',
+ 'label' => 'Serial number',
) %>
<% include('/elements/tr-input-text.html',
'field' => 'hw_addr',
'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>
'Serial #',
'Hardware addr.',
'IP addr.',
+ 'Smartcard',
FS::UI::Web::cust_header(),
],
'fields' => [ 'svcnum',
'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>
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";
}
}
}
+if ( $cgi->param('svcpart') =~ /^(\d+)$/ ) {
+ push @extra_sql, "cust_svc.svcpart = $1";
+}
+
my ($orderby) = $cgi->param('orderby') =~ /^(\w+( ASC| DESC)?)$/i;
$orderby ||= 'svcnum';
'part_svc.svc',
'cust_main.custnum',
'hardware_type.model',
+ 'cust_pkg.cancel',
FS::UI::Web::cust_sql_fields(),
),
'hashref' => {},
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>
: $fields->{$_}
);
} keys %$fields;
-my @fields = qw( acctnum note );
+my @fields = ('acctnum',
+ { field => 'installdate', type => 'date' },
+ 'note'
+ );
</%init>
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>