[freeside-commits] branch FREESIDE_3_BRANCH updated. ad9229b8b2934caa4af464e26cdb3349fb2e759b

Ivan ivan at 420.am
Sat Feb 15 15:56:57 PST 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  ad9229b8b2934caa4af464e26cdb3349fb2e759b (commit)
      from  d17420aa6024c993fb785c455669518ef8befd32 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ad9229b8b2934caa4af464e26cdb3349fb2e759b
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Feb 15 15:56:57 2014 -0800

    default credit limit, RT#27267

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index f47d54d..2102644 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -5577,6 +5577,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" },
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index 5a66f0a..d52fb3c 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -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>
 
@@ -661,6 +676,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 LECB BILL CASH WEST COMP ))
 @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html
index 10cb1de..749004d 100644
--- a/httemplate/view/cust_main/billing.html
+++ b/httemplate/view/cust_main/billing.html
@@ -266,9 +266,13 @@
 <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>
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Conf.pm                          |    7 +++++++
 httemplate/edit/cust_main/billing.html |   21 +++++++++++++++++++--
 httemplate/view/cust_main/billing.html |   10 +++++++---
 3 files changed, 33 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list