usernum
+=item close_date
+
+projected date when the quotation will be closed
+
+=item confidence
+
+projected confidence (expressed as integer) that quotation will close
=back
|| $self->ut_numbern('_date')
|| $self->ut_enum('disabled', [ '', 'Y' ])
|| $self->ut_numbern('usernum')
+ || $self->ut_numbern('close_date')
+ || $self->ut_numbern('confidence')
;
return $error if $error;
$self->usernum($FS::CurrentUser::CurrentUser->usernum) unless $self->usernum;
+ return 'confidence must be an integer between 1 and 100'
+ if length($self->confidence) && (($self->confidence < 1) || ($self->confidence > 100));
+
return 'prospectnum or custnum must be specified'
if ! $self->prospectnum
&& ! $self->custnum;
});
my $total_setup = $self->total_setup;
+ my $total_recur = $self->total_recur;
+ my $setup_show = $total_setup > 0 ? 1 : 0;
+ my $recur_show = $total_recur > 0 ? 1 : 0;
+ unless ($setup_show && $recur_show) {
+ foreach my $quotation_pkg ($self->quotation_pkg) {
+ $setup_show = 1 if !$setup_show and $quotation_pkg->setup_show_zero;
+ $recur_show = 1 if !$recur_show and $quotation_pkg->recur_show_zero;
+ last if $setup_show && $recur_show;
+ }
+ }
+
foreach my $pkg_tax (@setup_tax) {
if ($pkg_tax->setup_amount > 0) {
$total_setup += $pkg_tax->setup_amount;
}
}
- if ( $total_setup > 0 ) {
+ if ( $setup_show ) {
push @items, {
- 'total_item' => $self->mt( $self->total_recur > 0 ? 'Total Setup' : 'Total' ),
+ 'total_item' => $self->mt( $recur_show ? 'Total Setup' : 'Total' ),
'total_amount' => sprintf('%.2f',$total_setup),
'break_after' => ( scalar(@recur_tax) ? 1 : 0 )
};
#could/should add up the different recurring frequencies on lines of their own
# but this will cover the 95% cases for now
- my $total_recur = $self->total_recur;
# label these with the frequency
foreach my $pkg_tax (@recur_tax) {
if ($pkg_tax->recur_amount > 0) {
}
}
- if ( $total_recur > 0 ) {
+ if ( $recur_show ) {
push @items, {
'total_item' => $self->mt('Total Recurring'),
'total_amount' => sprintf('%.2f',$total_recur),