add credit reason selection, RT#85046
authorIvan Kohler <ivan@freeside.biz>
Mon, 9 Nov 2020 21:18:07 +0000 (13:18 -0800)
committerIvan Kohler <ivan@freeside.biz>
Mon, 9 Nov 2020 21:18:07 +0000 (13:18 -0800)
httemplate/elements/tr-select-reason.html
httemplate/search/cust_credit.html
httemplate/search/report_cust_credit.html

index 64648ba..8174420 100755 (executable)
@@ -16,7 +16,7 @@ Example:
     'control_button' => 'element_name',  #button to be enabled when a reason is
                                          #selected
     'id'             => 'element_id',
     'control_button' => 'element_name',  #button to be enabled when a reason is
                                          #selected
     'id'             => 'element_id',
-    'hide_add'       => '1',             # setting this will hide the add new reason link,
+    'hide_addnew'    => '1',             # setting this will hide the add new reason link,
                                          # even if the user has access to add a new reason.
     'hide_onload'    => '1',             # setting this will hide reason select box on page load,
                                          # allowing for it do be displayed later.
                                          # even if the user has access to add a new reason.
     'hide_onload'    => '1',             # setting this will hide reason select box on page load,
                                          # allowing for it do be displayed later.
index 1ffa302..88f9bca 100755 (executable)
@@ -195,6 +195,10 @@ if ( $cgi->param('credbatch') =~ /^([\w\-\/\.\:]+)$/ ) {
   push @search, "cust_credit.credbatch = '$1'";
 }
 
   push @search, "cust_credit.credbatch = '$1'";
 }
 
+if ( $cgi->param('reasonnum') =~ /^(\d+)$/ && $1 ) {
+  push @search, "cust_credit.reasonnum = $1";
+}
+
 # commission_salesnum
 if ( $cgi->param('commission_salesnum') =~ /^(\d+)$/ ) {
   push @search, "commission_salesnum = $1";
 # commission_salesnum
 if ( $cgi->param('commission_salesnum') =~ /^(\d+)$/ ) {
   push @search, "commission_salesnum = $1";
index cafe556..c37b578 100644 (file)
                 'field' => 'amount',
   &>
 
                 'field' => 'amount',
   &>
 
+  <& /elements/tr-select-reason.html,
+       'label'        => emt('Reason').':',
+       'field'        => 'reasonnum',
+       'reason_class' => 'R',
+       'cgi'          => $cgi,
+       'hide_addnew'  => 1,
+       'pre_options'  => [ 0 => emt('(any reason)') ],
+  &>
+
   <& /elements/tr-checkbox.html,
        'label' => emt('Show Voided Credits').':',
        'field' => 'show_voided_credits',
   <& /elements/tr-checkbox.html,
        'label' => emt('Show Voided Credits').':',
        'field' => 'show_voided_credits',