2 use base qw( FS::MAC_Mixin FS::svc_Common );
6 #use FS::Record qw( qsearch qsearchs );
10 FS::svc_video - Object methods for svc_video records
16 $record = new FS::svc_video \%hash;
17 $record = new FS::svc_video { 'column' => 'value' };
19 $error = $record->insert;
21 $error = $new_record->replace($old_record);
23 $error = $record->delete;
25 $error = $record->check;
29 An FS::svc_video object represents an IPTV or video-on-demand service.
30 FS::svc_video inherits from FS::Record. The following fields are currently
55 Creates a new record. To add the record to the database, see L<"insert">.
57 Note that this stores the hash reference, not a distinct copy of the hash it
58 points to. You can ask the object for a copy with the I<hash> method.
62 sub table { 'svc_video'; }
65 my( $class, $string ) = @_;
66 if ( $string =~ /^([A-F0-9]{12})$/i ) {
67 $class->search_sql_field('mac_addr', uc($string));
68 } elsif ( $string =~ /^(([A-F0-9]{2}:){5}([A-F0-9]{2}))$/i ) {
70 $class->search_sql_field('mac_addr', uc($string) );
71 } elsif ( $string =~ /^(\d+)$/ ) {
72 $class->search_sql_field('smartcard_num', $1);
79 my %opts = ( 'type' => 'text',
80 'disable_select' => 1,
81 'disable_inventory' => 1,
84 tie my %fields, 'Tie::IxHash',
85 'svcnum' => { label => 'Service' },
86 'smartcard_num' => { label => 'Smartcard #',
91 'mac_addr' => { label => 'MAC address',
92 type => 'input-mac_addr',
93 value_callback => sub {
95 $svc->mac_addr_formatted('U',':');
98 'duration' => { label => 'Duration (days)',
106 'name' => 'Video', # service',
107 #'name_plural' => '', #optional,
108 #'longname_plural' => '', #optional
109 'fields' => \%fields,
110 #'sorts' => [ 'smartcard_num' ],
111 'display_weight' => 57.5,
112 'cancel_weight' => 70, #? no deps, so
119 my $label = $self->smartcard_num;
120 $label .= ', MAC:'. $self->mac_addr
127 Adds this record to the database. If there is an error, returns the error,
128 otherwise returns false.
132 Delete this record from the database.
134 =item replace OLD_RECORD
136 Replaces the OLD_RECORD with this one in the database. If there is an error,
137 returns the error, otherwise returns false.
141 Checks all fields to make sure this is a valid record. If there is
142 an error, returns the error, otherwise returns false. Called by the insert
151 $self->ut_numbern('svcnum')
152 || $self->ut_number('smartcard_num')
153 || $self->ut_mac_addr('mac_addr')
154 || $self->ut_number('duration')
156 return $error if $error;