+ foreach my $cust_svc (@sorted_cust_svc) {
+ my $part_svc = $cust_svc->part_svc;
+ next if ( defined($part_svc) and $part_svc->preserve );
+ my $error = $cust_svc->cancel; # immediate cancel, no date option
+ push @errors, $error if $error;
+ }
+ if (@errors) {
+ # then we won't get to the point of canceling packages
+ dbh->rollback if $oldAutoCommit;
+ return @errors;
+ }
+
+ warn "$me cancelling ". scalar(@pkgs) ." package(s) for customer ".
+ $self->custnum. "\n"
+ if $DEBUG;
+
+ @errors = grep { $_ } map { $_->cancel(%opt) } @pkgs;
+ if (@errors) {
+ dbh->rollback if $oldAutoCommit;
+ return @errors;
+ }