X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-sales.html;h=956a9d1590bebefb0d5169c3f85ab0316c034021;hp=b69b3d8b6e000cb5c3d328e6ee8c5e79b95c9ba9;hb=7b0bbc4117a7959b9f7b7b2cf999b8188ba34160;hpb=c14b35ce12141287e201bba8489b202a1b34b38f diff --git a/httemplate/elements/tr-select-sales.html b/httemplate/elements/tr-select-sales.html index b69b3d8b6..956a9d159 100644 --- a/httemplate/elements/tr-select-sales.html +++ b/httemplate/elements/tr-select-sales.html @@ -81,7 +81,11 @@ Example: function <% $field %>_agentnum_changed(what) { what.form.<% $field %>.disabled = 'disabled'; //disable sales dropdown - agentnum = what.options[what.selectedIndex].value; + if ( what.type == 'hidden' ) { + agentnum = what.value; + } else { + agentnum = what.options[what.selectedIndex].value; + } function update_<% $field %>(sales) { @@ -151,8 +155,11 @@ 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', });