[freeside-commits] freeside/httemplate/elements menu.html, 1.20.2.6, 1.20.2.7 tr-select-reason.html, 1.3, 1.3.2.1

Jeff Finucane,420,, jeff at wavetail.420.am
Tue Dec 4 10:19:10 PST 2007


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail:/tmp/cvs-serv22683/httemplate/elements

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	menu.html tr-select-reason.html 
Log Message:
change credit reasons from freetext to new reason/reason type system (#2777)

Index: menu.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/menu.html,v
retrieving revision 1.20.2.6
retrieving revision 1.20.2.7
diff -u -d -r1.20.2.6 -r1.20.2.7
--- menu.html	4 Nov 2007 18:04:43 -0000	1.20.2.6
+++ menu.html	4 Dec 2007 18:19:07 -0000	1.20.2.7
@@ -248,6 +248,8 @@
   'View/Edit prepaid cards'            => [ $fsurl.'search/prepay_credit.html', 'View outstanding cards, generate new cards' ],
   'View/Edit call rates and regions'   => [ $fsurl.'browse/rate.cgi', 'Manage rate plans, regions and prefixes for VoIP and call billing' ],
   'View/Edit locales and tax rates'    => [ $fsurl.'browse/cust_main_county.cgi', 'Change tax rates, or break down a country into states, or a state into counties and assign different tax rates to each' ],
+  'View/Edit credit reason types'  => [ $fsurl.'browse/reason_type.html?class=R', 'Credit reason types define groups of reasons, for reporting and convenience purposes.' ],
+  'View/Edit credit reasons'       => [ $fsurl.'browse/reason.html?class=R', 'Credit reasons explain why a credit was issued.' ],
 ;
 
 tie my %config_dialup, 'Tie::IxHash',

Index: tr-select-reason.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select-reason.html,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -d -r1.3 -r1.3.2.1
--- tr-select-reason.html	28 Dec 2006 20:52:00 -0000	1.3
+++ tr-select-reason.html	4 Dec 2007 18:19:08 -0000	1.3.2.1
@@ -54,18 +54,39 @@
   </TD>
 </TR>
 
+%   my @types = qsearch( 'reason_type', { 'class' => $class } );
+%   if (scalar(@types) < 1) {  # we should never reach this
+<TR>
+  <TD ALIGN="right">
+    <P>No reason types.  Go add some. </P>
+  </TD>
+</TR>
+%   }elsif (scalar(@types) == 1) {
+<TR>
+  <TD ALIGN="right">
+    <P id="new<% $name %>TLabel" style="display:<% $display %>">Reason Type</P>
+  </TD>
+  <TD>
+    <P id="new<% $name %>T" disabled="<% $disabled %>" style="display:<% $display %>"><% $types[0]->type %>
+    <INPUT type="hidden" name="new<% $name %>T" value="<% $types[0]->typenum %>">
+  </TD>
+</TR>
+
+%   }else{
+
 <TR>
   <TD ALIGN="right">
     <P id="new<% $name %>TLabel" style="display:<% $display %>">Reason Type</P>
   </TD>
   <TD>
     <SELECT id="new<% $name %>T" name="new<% $name %>T" disabled="<% $disabled %>" style="display:<% $display %>">
-%     for my $type (qsearch( 'reason_type', { 'class' => $class } )){
+%     for my $type (@types){
         <OPTION VALUE="<% $type->typenum %>" <% ($init_type == $type->typenum) ? 'SELECTED' : '' %>><% $type->type %></OPTION>
 %     }
     </SELECT>
   </TD>
 </TR>
+%   }
 
 <TR>
   <TD ALIGN="right">
@@ -82,6 +103,8 @@
   $access_right='Add on-the-fly cancel reason';
 }elsif ($class eq 'S') {
   $access_right='Add on-the-fly suspend reason';
+}elsif ($class eq 'R') {
+  $access_right='Add on-the-fly credit reason';
 }else{
   print "illegal class: $class";
 }
@@ -94,7 +117,8 @@
   $disabled = 'true';
 }
 
-$extra_sql = "WHERE class = '$class' ORDER BY reason_type";
+$extra_sql = "WHERE class = '$class' and (disabled = '' OR disabled is NULL) ".
+             "ORDER BY reason_type";
 $curuser = $FS::CurrentUser::CurrentUser;
 
 </%init>



More information about the freeside-commits mailing list