default credit limit, RT#27267
authorIvan Kohler <ivan@freeside.biz>
Sat, 15 Feb 2014 23:56:55 +0000 (15:56 -0800)
committerIvan Kohler <ivan@freeside.biz>
Sat, 15 Feb 2014 23:56:55 +0000 (15:56 -0800)
FS/FS/Conf.pm
httemplate/edit/cust_main/billing.html
httemplate/view/cust_main/billing.html

index d8c29f3..48b39c5 100644 (file)
@@ -5599,6 +5599,13 @@ and customer address. Include units.',
     'type'        => 'checkbox',
   },
 
+  {
+    'key'         => 'default_credit_limit',
+    'section'     => 'billing',
+    'description' => 'Default customer credit limit',
+    'type'        => 'text',
+  },
+
   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
index 1088cf5..16ddb2e 100644 (file)
@@ -559,8 +559,23 @@ function toggle(obj) {
   obj.form.credit_limit.disabled = obj.checked;
 }
         </SCRIPT>
-        <INPUT TYPE="text" NAME="credit_limit" VALUE=<% sprintf('"%.2f"', $cust_main->credit_limit) %><% length($cust_main->credit_limit) ? '' : ' DISABLED' %>>
-        <INPUT TYPE="checkbox" NAME="no_credit_limit" VALUE=1 onclick="toggle(this)"<% length($cust_main->credit_limit) ? '' : ' CHECKED'%>> <% mt('Unlimited') |h %> 
+        <INPUT TYPE  = "text"
+               NAME  = "credit_limit"
+               VALUE = "<% sprintf('%.2f', $cust_main->credit_limit) %>"
+               <% length($cust_main->credit_limit) ? '' : ' DISABLED' %>
+        >
+%       my $default_credit_limit = $conf->config('default_credit_limit');
+        <INPUT TYPE  = "checkbox"
+               NAME  = "no_credit_limit"
+               VALUE = 1
+               onClick="toggle(this)"
+               <% length($cust_main->credit_limit) ? '' : ' CHECKED'%>
+        > <% $default_credit_limit
+               ? "Default ($money_char". sprintf("%.2f", $default_credit_limit).
+                 ")"
+               : mt('Unlimited')
+            |h
+          %> 
       </TD>
     </TR>
 
@@ -678,6 +693,8 @@ my $payinfo = $options{'payinfo'};
 my $conf = new FS::Conf;
 my $payby_default = $conf->config('payby-default');
 
+my $money_char = $conf->config('money_char') || '$';
+
 my @payby = grep /\w/, $conf->config('payby');
 #@payby = (qw( CARD DCRD CHEK DCHK BILL CASH WEST COMP ))
 @payby = (qw( CARD DCRD CHEK DCHK BILL CASH COMP ))
index e0dd7b9..382fdac 100644 (file)
 <TR>
   <TD ALIGN="right"><% mt('Credit limit') |h %></TD>
   <TD BGCOLOR="#ffffff">
-    <% length($cust_main->credit_limit) ? 
-        $money_char.sprintf("%.2f", $cust_main->credit_limit) :
-        emt('Unlimited') %>
+%   my $default_credit_limit = $conf->config('default_credit_limit');
+    <% length($cust_main->credit_limit)
+         ? $money_char. sprintf("%.2f", $cust_main->credit_limit)
+         : $default_credit_limit
+           ? "Default ($money_char". sprintf("%.2f", $default_credit_limit). ")"
+           : emt('Unlimited')
+    %>
   </TD>
 </TR>