X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Flocation.cgi;h=188c5c3dfc3d81974e564ad7177d47daac7dbf42;hb=b5c4237a34aef94976bc343c8d9e138664fc3984;hp=3c3a8554525bbddb0d4e3e77181d0ec1194de311;hpb=20bddf47a41b6d064b3cfa4c41e55c157cf0c3de;p=freeside.git diff --git a/httemplate/misc/location.cgi b/httemplate/misc/location.cgi index 3c3a85545..188c5c3df 100644 --- a/httemplate/misc/location.cgi +++ b/httemplate/misc/location.cgi @@ -3,16 +3,29 @@ my $locationnum = $cgi->param('arg'); +my $curuser = $FS::CurrentUser::CurrentUser; + my $cust_location = qsearchs({ + 'select' => 'cust_location.*', 'table' => 'cust_location', 'hashref' => { 'locationnum' => $locationnum }, - 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, + 'addl_from' => ' LEFT JOIN cust_main USING ( custnum ) ', + ' LEFT JOIN prospect_main USING ( prospectnum ) ', + 'extra_sql' => ' AND ( '. + ' ( custnum IS NOT NULL AND '. + $curuser->agentnums_sql( table=>'cust_main' ). + ' ) '. + ' OR '. + ' ( prospectnum IS NOT NULL AND '. + $curuser->agentnums_sql( table=>'prospect_main' ). + ' ) '. + ' )', }); my %hash = (); %hash = map { $_ => $cust_location->$_() } - qw( address1 address2 city county state zip country ) + qw( address1 address2 city county state zip country + location_kind location_type location_number ) if $cust_location;