1 package FS::cust_credit_void;
2 use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Record );
5 use FS::Record qw(qsearchs); # qsearch qsearchs);
12 FS::cust_credit_void - Object methods for cust_credit_void objects
16 use FS::cust_credit_void;
18 $record = new FS::cust_credit_void \%hash;
19 $record = new FS::cust_credit_void { 'column' => 'value' };
21 $error = $record->insert;
23 $error = $new_record->replace($old_record);
25 $error = $record->delete;
27 $error = $record->check;
31 An FS::cust_credit_void object represents a voided credit. All fields in
32 FS::cust_credit are present, as well as:
36 =item void_date - the date (unix timestamp) that the credit was voided
38 =item void_reason - the reason (a freeform string)
40 =item void_usernum - the user (L<FS::access_user>) who voided it
50 Creates a new voided credit record.
54 sub table { 'cust_credit_void'; }
58 Adds this voided credit to the database.
62 Checks all fields to make sure this is a valid voided credit. If there is an
63 error, returns the error, otherwise returns false. Called by the insert
72 $self->ut_numbern('crednum')
73 || $self->ut_number('custnum')
74 || $self->ut_numbern('_date')
75 || $self->ut_money('amount')
76 || $self->ut_alphan('otaker')
77 || $self->ut_textn('reason')
78 || $self->ut_textn('addlinfo')
79 || $self->ut_enum('closed', [ '', 'Y' ])
80 || $self->ut_foreign_keyn('pkgnum', 'cust_pkg', 'pkgnum')
81 || $self->ut_foreign_keyn('eventnum', 'cust_event', 'eventnum')
82 || $self->ut_foreign_keyn('commission_agentnum', 'agent', 'agentnum')
83 || $self->ut_foreign_keyn('commission_salesnum', 'sales', 'salesnum')
84 || $self->ut_foreign_keyn('commission_pkgnum', 'cust_pkg', 'pkgnum')
85 || $self->ut_numbern('void_date')
86 || $self->ut_textn('void_reason')
87 || $self->ut_foreign_keyn('void_usernum', 'access_user', 'usernum')
89 return $error if $error;
91 $self->void_date(time) unless $self->void_date;
93 $self->void_usernum($FS::CurrentUser::CurrentUser->usernum)
94 unless $self->void_usernum;
101 Returns the parent customer object (see L<FS::cust_main>).
103 =item void_access_user
105 Returns the voiding employee object (see L<FS::access_user>).
109 sub void_access_user {
111 qsearchs('access_user', { 'usernum' => $self->void_usernum } );
118 Doesn't yet support unvoid.
122 L<FS::cust_credit>, L<FS::Record>, schema.html from the base documentation.