- if ($arg{reasonnum} == -1) {
-
- $error = 'Enter a new reason (or select an existing one)'
- unless $arg{newreasonnum} !~ /^\s*$/;
- my $reason = new FS::reason {
- 'reason' => $arg{newreasonnum},
- 'reason_type' => $arg{newreasonnum_type},
- };
- $error ||= $reason->insert;
- if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return "Error inserting reason: $error";
- }
- $arg{reasonnum} = $reason->reasonnum;
- }