1 package FS::sched_item;
2 use base qw( FS::Record );
5 #use FS::Record qw( qsearch qsearchs );
9 FS::sched_item - Object methods for sched_item records
15 $record = new FS::sched_item \%hash;
16 $record = new FS::sched_item { 'column' => 'value' };
18 $error = $record->insert;
20 $error = $new_record->replace($old_record);
22 $error = $record->delete;
24 $error = $record->check;
28 An FS::sched_item object represents an schedulable item, such as an installer,
29 meeting room or truck. FS::sched_item inherits from FS::Record. The following
30 fields are currently supported:
55 Creates a new item. To add the item 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 { 'sched_item'; }
66 Adds this record to the database. If there is an error, returns the error,
67 otherwise returns false.
71 Delete this record from the database.
73 =item replace OLD_RECORD
75 Replaces the OLD_RECORD with this one in the database. If there is an error,
76 returns the error, otherwise returns false.
80 Checks all fields to make sure this is a valid item. If there is
81 an error, returns the error, otherwise returns false. Called by the insert
90 $self->ut_numbern('itemnum')
91 || $self->ut_foreign_keyn('usernum', 'access_user', 'usernum')
92 || $self->ut_enum('disabled', [ '', 'Y' ])
94 return $error if $error;
101 Returns a name for this item; either the name of the associated employee (see
102 L<FS::access_user), or the itemname field.
108 my $access_user = $self->access_user;
109 $access_user ? $access_user->name : $self->itemname;
118 L<FS::access_user>, L<FS::sched_avail>, L<FS::Record>