X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-sales.html;h=956a9d1590bebefb0d5169c3f85ab0316c034021;hp=2a2edf03c4774903b7e9d056ed46be3ce7a5a550;hb=7b0bbc4117a7959b9f7b7b2cf999b8188ba34160;hpb=5c0cfcb8dec7c4f3a7aecea4c550ffb4bfb774c3 diff --git a/httemplate/elements/tr-select-sales.html b/httemplate/elements/tr-select-sales.html index 2a2edf03c..956a9d159 100644 --- a/httemplate/elements/tr-select-sales.html +++ b/httemplate/elements/tr-select-sales.html @@ -13,7 +13,8 @@ Example: 'label' => 'Sales Person', 'empty_label' => 'Select sales person', #override default - #on already# 'disable_empty' => 1, + 'disable_empty' => 0, #on byd efault, pass 0 to disable + 'field' => 'salesnum', #HTML element name and ID &> @@ -21,8 +22,8 @@ Example: % if ( scalar(@sales) == 0 || $opt{'fixed'} ) { @@ -63,19 +64,106 @@ Example: % } +<& /elements/xmlhttp.html, + 'url' => $p.'misc/sales.cgi', + 'subs' => [ 'get_sales' ], +&> + + <%init> my $curuser = $FS::CurrentUser::CurrentUser; my %opt = @_; my $salesnum = $opt{'curr_value'} || $opt{'value'}; +my $field = $opt{'element_name'} || $opt{'field'} || 'salesnum'; +my $id = $opt{'id'} || $opt{'field'} || 'salesnum'; -my @sales = qsearch({ 'table' => 'sales', - 'hashref' => { 'disabled' => '' }, +my $hashref = { disabled => '' }; +$hashref->{agentnum} = $opt{agentnum} if $opt{agentnum}; + +my @sales = qsearch({ 'table' => 'sales', + 'hashref' => $hashref, 'extra_sql' => ' AND '. $curuser->agentnums_sql, + 'order_by' => 'ORDER BY salesperson', }); my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : ''; -