summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
676a117)
- Added reasonnum and a corresponding foreign key in cust_bill_void and
cust_bill_pkg_void tables (Schema.pm)
- Used the FS::reason_Mixin::reason as the override of the
cust_bill_void->reason to handle legacy and classified reasons
- Changes in voided_invoice.html template to handle classified reasons for
void invoices
#void fields
'void_date', @date_type, '', '',
#void fields
'void_date', @date_type, '', '',
- 'reason', 'varchar', 'NULL', $char_d, '', '',
- 'void_usernum', 'int', 'NULL', '', '', '',
+ 'reason', 'varchar', 'NULL', $char_d, '', '',
+ 'reasonnum', 'int', 'NULL', '', '', '',
+ 'void_usernum', 'int', 'NULL', '', '', '',
],
'primary_key' => 'invnum',
'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum? huh
],
'primary_key' => 'invnum',
'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum? huh
{ columns => [ 'statementnum' ],
table => 'cust_statement', #_void? both?
},
{ columns => [ 'statementnum' ],
table => 'cust_statement', #_void? both?
},
+ { columns => [ 'reasonnum' ],
+ table => 'reason',
+ },
{ columns => [ 'void_usernum' ],
table => 'access_user',
references => [ 'usernum' ],
{ columns => [ 'void_usernum' ],
table => 'access_user',
references => [ 'usernum' ],
'feepart', 'int', 'NULL', '', '', '',
#void fields
'void_date', @date_type, '', '',
'feepart', 'int', 'NULL', '', '', '',
#void fields
'void_date', @date_type, '', '',
- 'reason', 'varchar', 'NULL', $char_d, '', '',
- 'void_usernum', 'int', 'NULL', '', '', '',
+ 'reason', 'varchar', 'NULL', $char_d, '', '',
+ 'reasonnum', 'int', 'NULL', '', '', '',
+ 'void_usernum', 'int', 'NULL', '', '', '',
],
'primary_key' => 'billpkgnum',
'unique' => [],
],
'primary_key' => 'billpkgnum',
'unique' => [],
{ columns => [ 'invnum' ],
table => 'cust_bill_void',
},
{ columns => [ 'invnum' ],
table => 'cust_bill_void',
},
+ { columns => [ 'reasonnum' ],
+ table => 'reason',
+ },
#pkgnum 0 and -1 are used for special things
#{ columns => [ 'pkgnum' ],
# table => 'cust_pkg',
#pkgnum 0 and -1 are used for special things
#{ columns => [ 'pkgnum' ],
# table => 'cust_pkg',
use FS::cust_credit_bill_pkg;
use FS::discount_plan;
use FS::cust_bill_void;
use FS::cust_credit_bill_pkg;
use FS::discount_plan;
use FS::cust_bill_void;
+use FS::reason;
+use FS::reason_type;
use FS::L10N;
$DEBUG = 0;
use FS::L10N;
$DEBUG = 0;
Voids this invoice: deletes the invoice and adds a record of the voided invoice
to the FS::cust_bill_void table (and related tables starting from
Voids this invoice: deletes the invoice and adds a record of the voided invoice
to the FS::cust_bill_void table (and related tables starting from
my $self = shift;
my $reason = scalar(@_) ? shift : '';
my $self = shift;
my $reason = scalar(@_) ? shift : '';
+ unless (ref($reason) || !$reason) {
+ $reason = FS::reason->new_or_existing(
+ 'class' => 'X',
+ 'type' => 'Void invoice',
+ 'reason' => $reason
+ );
+ }
+
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
local $SIG{QUIT} = 'IGNORE';
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
local $SIG{QUIT} = 'IGNORE';
my $cust_bill_void = new FS::cust_bill_void ( {
map { $_ => $self->get($_) } $self->fields
} );
my $cust_bill_void = new FS::cust_bill_void ( {
map { $_ => $self->get($_) } $self->fields
} );
- $cust_bill_void->reason($reason);
+ $cust_bill_void->reasonnum($reason->reasonnum) if $reason;
my $error = $cust_bill_void->insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
my $error = $cust_bill_void->insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
use FS::cust_bill_pkg_tax_rate_location_void;
use FS::cust_tax_exempt_pkg_void;
use FS::cust_bill_pkg_fee_void;
use FS::cust_bill_pkg_tax_rate_location_void;
use FS::cust_tax_exempt_pkg_void;
use FS::cust_bill_pkg_fee_void;
+use FS::reason;
+use FS::reason_type;
Voids this line item: deletes the line item and adds a record of the voided
line item to the FS::cust_bill_pkg_void table (and related tables).
Voids this line item: deletes the line item and adds a record of the voided
line item to the FS::cust_bill_pkg_void table (and related tables).
my $self = shift;
my $reason = scalar(@_) ? shift : '';
my $self = shift;
my $reason = scalar(@_) ? shift : '';
+ unless (ref($reason) || !$reason) {
+ $reason = FS::reason->new_or_existing(
+ 'class' => 'X',
+ 'type' => 'Void invoice',
+ 'reason' => $reason
+ );
+ }
+
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
local $SIG{QUIT} = 'IGNORE';
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
local $SIG{QUIT} = 'IGNORE';
my $cust_bill_pkg_void = new FS::cust_bill_pkg_void ( {
map { $_ => $self->get($_) } $self->fields
} );
my $cust_bill_pkg_void = new FS::cust_bill_pkg_void ( {
map { $_ => $self->get($_) } $self->fields
} );
- $cust_bill_pkg_void->reason($reason);
+ $cust_bill_pkg_void->reasonnum($reason->reasonnum) if $reason;
my $error = $cust_bill_pkg_void->insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
my $error = $cust_bill_pkg_void->insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
package FS::cust_bill_pkg_void;
package FS::cust_bill_pkg_void;
-use base qw( FS::TemplateItem_Mixin FS::Record );
+use base qw( FS::TemplateItem_Mixin FS::reason_Mixin FS::Record );
use strict;
use FS::Record qw( qsearch qsearchs dbh fields );
use strict;
use FS::Record qw( qsearch qsearchs dbh fields );
+=item reason
+
+freeform string (deprecated)
+
+=item reasonnum
+
+reason for voiding the payment (see L<FS::reson>)
Adds this record to the database. If there is an error, returns the error,
otherwise returns false.
Adds this record to the database. If there is an error, returns the error,
otherwise returns false.
+=item reason
+
+Returns the text of the associated void reason (see L<FS::reason>) for this.
+
=item unvoid
"Un-void"s this line item: Deletes the voided line item from the database and
=item unvoid
"Un-void"s this line item: Deletes the voided line item from the database and
|| $self->ut_moneyn('unitrecur')
|| $self->ut_enum('hidden', [ '', 'Y' ])
|| $self->ut_numbern('feepart')
|| $self->ut_moneyn('unitrecur')
|| $self->ut_enum('hidden', [ '', 'Y' ])
|| $self->ut_numbern('feepart')
+ || $self->ut_textn('reason')
+ || $self->ut_foreign_keyn('reasonnum', 'reason', 'reasonnum')
;
return $error if $error;
;
return $error if $error;
package FS::cust_bill_void;
package FS::cust_bill_void;
-use base qw( FS::Template_Mixin FS::cust_main_Mixin FS::otaker_Mixin FS::Record );
+use base qw( FS::Template_Mixin FS::cust_main_Mixin FS::otaker_Mixin
+ FS::reason_Mixin FS::Record );
use strict;
use FS::Record qw( qsearch qsearchs dbh fields );
use strict;
use FS::Record qw( qsearch qsearchs dbh fields );
+=item reason
+
+freeform string (deprecated)
+
+=item reasonnum
+reason for voiding the payment (see L<FS::reson>)
|| $self->ut_numbern('void_date')
|| $self->ut_textn('reason')
|| $self->ut_numbern('void_usernum')
|| $self->ut_numbern('void_date')
|| $self->ut_textn('reason')
|| $self->ut_numbern('void_usernum')
+ || $self->ut_foreign_keyn('reasonnum', 'reason', 'reasonnum')
;
return $error if $error;
;
return $error if $error;
+=item reason
+
+Returns the text of the associated void reason (see L<FS::reason>) for this.
+
=cut
sub cust_bill_pkg { #actually cust_bill_pkg_void objects
=cut
sub cust_bill_pkg { #actually cust_bill_pkg_void objects
% }
% my $reason = $cust_bill_void->reason;
% if ($reason) {
% }
% my $reason = $cust_bill_void->reason;
% if ($reason) {
% }
<% mt("on [_1]", time2str($date_format, $cust_bill_void->void_date) ) |h %>
</I>
% }
<% mt("on [_1]", time2str($date_format, $cust_bill_void->void_date) ) |h %>
</I>