fix location selection for prospects, #940
authorMark Wells <mark@freeside.biz>
Thu, 31 May 2012 20:02:12 +0000 (13:02 -0700)
committerMark Wells <mark@freeside.biz>
Thu, 31 May 2012 20:02:12 +0000 (13:02 -0700)
FS/FS/prospect_main.pm
httemplate/edit/prospect_main.html
httemplate/elements/tr-select-cust_location.html

index 5a4048f..6adc852 100644 (file)
@@ -244,7 +244,8 @@ Returns the locations (see L<FS::cust_location>) associated with this prospect.
 
 sub cust_location {
   my $self = shift;
-  qsearch( 'cust_location', { 'prospectnum' => $self->prospectnum } );
+  qsearch( 'cust_location', { 'prospectnum' => $self->prospectnum,
+                              'custnum'     => '' } );
 }
 
 =item qual
index c8c8e98..d398541 100644 (file)
@@ -36,6 +36,9 @@
          'empty_label'   => 'No address',
          'disable_empty' => $conf->exists('prospect_main-location_required'),
          'alt_format'    => $conf->exists('prospect_main-alt_address_format'),
+         'include_opt_callback' => sub { 
+            'prospect_main' => shift
+          },
        },
      ],
      'new_callback'    => $new_callback,
index 05712ee..d9e3e9e 100644 (file)
@@ -287,7 +287,7 @@ my $location_sort = sub {
   or lc($a->address2) cmp lc($b->address2)
 };
 
-my @cust_location = ();
+my @cust_location;
 push @cust_location, $cust_main->cust_location if $cust_main;
 push @cust_location, $prospect_main->cust_location if $prospect_main;
 push @cust_location, $cust_location