+ if ( !$self->get('setup') ) {
+ # not yet billed, so allow amount and quantity
+ if ( exists($opt{'quantity'})
+ and $opt{'quantity'} != $self->quantity
+ and $opt{'quantity'} > 0 ) {
+
+ $self->set('quantity', $opt{'quantity'});
+ }
+ if ( exists($opt{'start_date'})
+ and $opt{'start_date'} != $self->start_date ) {
+
+ $self->set('start_date', $opt{'start_date'});
+ }
+ if ($self->modified) { # for quantity or start_date change
+ my $error = $self->replace;
+ return $error if $error;
+ }
+
+ if ( exists($opt{'amount'})
+ and $part_pkg->option('setup_fee') != $opt{'amount'}
+ and $opt{'amount'} > 0 ) {
+
+ $pkg_opt{'setup_fee'} = $opt{'amount'};
+ # standard for one-time charges is to set comment = (formatted) amount
+ # update it to avoid confusion
+ my $conf = FS::Conf->new;
+ $part_pkg->set('comment',
+ ($conf->config('money_char') || '$') .
+ sprintf('%.2f', $opt{'amount'})
+ );
+ }
+ } # else simply ignore them; the UI shouldn't allow editing the fields
+