},
{
+ 'key' => 'prospect_main-location_required',
+ 'section' => 'UI',
+ 'description' => 'Require an address for prospects. Recommended if the main use of propects is for qualifications.',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'note-classes',
'section' => 'UI',
'description' => 'Use customer note classes',
'm2_error_callback' => $m2_error_callback,
},
- { 'field' => 'locationnum',
- 'type' => 'select-cust_location',
- 'empty_label' => 'No address',
- 'alt_format' => $conf->exists('prospect_main-alt_address_format'),
+ { 'field' => 'locationnum',
+ 'type' => 'select-cust_location',
+ 'empty_label' => 'No address',
+ 'disable_empty' => $conf->exists('prospect_main-location_required'),
+ 'alt_format' => $conf->exists('prospect_main-alt_address_format'),
},
],
'new_callback' => $new_callback,
'field' => 'location_kind',
'id' => 'location_kind',
'disabled' => $disabled,
- 'style' => \@style,
+ #'style' => \@style,
'options' => \@location_kind_options,
'labels' => $location_kind_labels,
'curr_value' => scalar($cgi->param('location_kind'))
'field' => 'location_type',
'id' => 'location_type',
'disabled' => $disabled,
- 'style' => \@style,
+ #'style' => \@style,
'options' => [ keys %location_types ],
'labels' => \%location_types,
'curr_value' => $location_type,
'prefix' => $pre,
'onchange' => $onchange,
'disabled' => $disabled,
- 'style' => \@style,
+ #'style' => \@style,
);
my $th = $opt{'no_bold'} ? 'TD' : 'TH';
#optional
'empty_label' => '(default service address)',
+ 'disable_empty' => 0, #1 to disable
)
</%doc>
<<%$th%> ALIGN="right"><% $opt{'label'} || 'Service location' %></<%$th%>>
<TD COLSPAN=7>
<SELECT NAME="locationnum" onChange="locationnum_changed(this);">
-% if ( !$prospect_main ) {
+% if ( !$prospect_main && !$opt{'disable_empty'} ) {
<OPTION VALUE=""><% $opt{'empty_label'} || '(default service address)' |h %>
% }
% if ( $opt{'is_optional'} ) {
my $disabled =
( $locationnum < 0
|| ( $editable && $locationnum )
- || ( $prospect_main && !$opt{'is_optional'} && !@cust_location && $addnew )
+ || ( ( $prospect_main || $opt{'disable_empty'} )
+ && !$opt{'is_optional'} && !@cust_location && $addnew
+ )
)
? ''
: 'DISABLED';