X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=eg%2Ftable_template-svc.pm;h=1470b6f37a30b1834c8d1d8d99c61dfd1e2b22ce;hp=a4f5028f509b9e2056e56307b0c717f371f9720f;hb=29d80a8582103ead0b5910391cabc45cb85fa836;hpb=6981a417a49264fd4e03dc0167e070f7a4c128e1 diff --git a/eg/table_template-svc.pm b/eg/table_template-svc.pm index a4f5028f5..1470b6f37 100644 --- a/eg/table_template-svc.pm +++ b/eg/table_template-svc.pm @@ -1,13 +1,10 @@ package FS::svc_table; use strict; -use vars qw(@ISA); +use base qw( FS::svc_Common ); #use FS::Record qw( qsearch qsearchs ); -use FS::svc_Common; use FS::cust_svc; -@ISA = qw(svc_Common); - =head1 NAME FS::table_name - Object methods for table_name records @@ -59,6 +56,61 @@ points to. You can ask the object for a copy with the I method. sub table { 'table_name'; } +sub table_info { + { + 'name' => 'Example', + 'name_plural' => 'Example services', #optional, + 'longname_plural' => 'Example services', #optional + 'sorts' => 'svcnum', # optional sort field (or arrayref of sort fields, main first) + 'display_weight' => 100, + 'cancel_weight' => 100, + 'fields' => { + 'field' => 'Description', + 'another_field' => { + 'label' => 'Description', + 'def_label' => 'Description for service definitions', + 'type' => 'text', + 'disable_default' => 1, #disable switches + 'disable_fixed' => 1, # + 'disable_inventory' => 1, # + 'disable_select' => 1, # + }, + 'foreign_key' => { + 'label' => 'Description', + 'def_label' => 'Description for service defs', + 'type' => 'select', + 'select_table' => 'foreign_table', + 'select_key' => 'key_field_in_table', + 'select_label' => 'label_field_in_table', + }, + + }, + }; +} + +=item search_sql STRING + +Class method which returns an SQL fragment to search for the given string. + +=cut + +#or something more complicated if necessary +sub search_sql { + my($class, $string) = @_; + $class->search_sql_field('search_field', $string); +} + +=item label + +Returns a meaningful identifier for this example + +=cut + +sub label { + my $self = shift; + $self->label_field; #or something more complicated if necessary +} + =item insert Adds this record to the database. If there is an error, returns the error, @@ -141,15 +193,11 @@ sub check { my $part_svc = $x; - ''; #no error + $self->SUPER::check; } =back -=head1 VERSION - -$Id: table_template-svc.pm,v 1.1 1999-08-04 08:03:03 ivan Exp $ - =head1 BUGS The author forgot to customize this manpage. @@ -159,21 +207,6 @@ The author forgot to customize this manpage. L, L, L, L, L, schema.html from the base documentation. -=head1 HISTORY - -ivan@voicenet.com 97-jul-21 - -$Log: table_template-svc.pm,v $ -Revision 1.1 1999-08-04 08:03:03 ivan -move table subclass examples out of production directory - -Revision 1.4 1998/12/30 00:30:48 ivan -svc_ stuff is more properly OO - has a common superclass FS::svc_Common - -Revision 1.2 1998/11/15 04:33:01 ivan -updates for newest versoin - - =cut 1;