$lopt{'reason_otaker'} = $cpr->otaker;
} else {
warn "no reason found when canceling package ".$_->pkgnum."\n";
- # we're not actually required to pass a reason to cust_pkg::cancel,
- # but if we're getting to this point, something has gone awry.
- $null_reason ||= FS::reason->new_or_existing(
- reason => 'unknown reason',
- type => 'Cancel Reason',
- class => 'C',
- );
- $lopt{'reason'} = $null_reason->reasonnum;
- $lopt{'reason_otaker'} = $FS::CurrentUser::CurrentUser->username;
+ $lopt{'reason'} = '';
}
}
my $error = $_->cancel(%lopt);
this.
=item reason - can be set to a cancellation reason (see L<FS:reason>),
-either a reasonnum of an existing reason, or passing a hashref will create
-a new reason. The hashref should have the following keys: typenum - Reason
-type (see L<FS::reason_type>, reason - Text of the new reason.
+either a reasonnum of an existing reason, or a hashref to create
+a new reason. The hashref should have the following keys:
+typenum - Reason type (see L<FS::reason_type>
+reason - Text of the new reason.
+
+If this argument isn't given or is a false value, then the package will be
+canceled with no reason.
=item date - can be set to a unix style timestamp to specify when to
cancel (expire)
=cut
+# XXX should look for an expire reason
+# but seems to be unused; this is now handled more holistically in
+# cust_main::Billing
+
sub cancel_if_expired {
my $self = shift;
my $time = shift || time;