[freeside-commits] freeside/httemplate/elements location.html, 1.11, 1.12

Ivan,,, ivan at wavetail.420.am
Sat Mar 12 18:31:12 PST 2011


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv29767/httemplate/elements

Modified Files:
	location.html 
Log Message:
qualification address handling changes, RT#7111

Index: location.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/location.html,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -d -r1.11 -r1.12
--- location.html	6 Dec 2010 06:36:02 -0000	1.11
+++ location.html	0 ??? 1900 4203292:32535:-551452672 -0000	1.12
@@ -17,6 +17,27 @@
 
 </%doc>
 
+% if ( $opt{'alt_format'} ) {
+
+<TR>
+    <<%$th%> ALIGN="right">Locatiopn type</<%$th%>>
+    <TD>
+    <% include('/elements/select.html',
+                 'cgi'        => $cgi,
+                 'field'      => 'location_kind',
+                 'disabled'   => $disabled,
+                 'style'      => $style, 
+                 'options'    => \@location_kind_options,
+                 'labels'     => $location_kind_labels,
+                 'curr_value' => scalar($cgi->param('location_kind'))
+                                   || $object->get($pre.'location_kind'),
+              )
+    %>
+    </TD>
+  </TR>
+
+% } 
+
 <TR>
   <<%$th%> ALIGN="right"><%$r%><% $opt{'address1_label'} || 'Address' %></<%$th%>>
   <TD COLSPAN=7>
@@ -31,6 +52,9 @@
     >
   </TD>
 </TR>
+
+% if ( ! $opt{'alt_format'} ) { #regular format
+
 <TR>
       <TD ALIGN="right"><FONT ID="<% $pre %>address2_required" color="#ff0000" <% $address2_label_style %>>*</FONT>&nbsp;<FONT ID="<% $pre %>address2_label" <% $address2_label_style %>><B>Unit&nbsp;#</B></FONT></TD>
       <TD COLSPAN=7>
@@ -46,46 +70,87 @@
       </TD>
 </TR>
 
+% } else { # alternate format
+
+      <INPUT TYPE  = "hidden"
+             NAME  = "<%$pre%>address2"
+             VALUE = "<% $object->get($pre.'address2') |h %>"
+      >
 
-% if ( $opt{'alt_format'} ) { 
 <TR>
-    <<%$th%> ALIGN="right">Location Type</<%$th%>>
-    <TD><INPUT 	TYPE="text" 
+    <<%$th%> ALIGN="right">Unit Type and #</<%$th%>>
+    <TD COLSPAN=7>
+
+%     my $location_type = scalar($cgi->param('location_type'))
+%                           || $object->get($pre.'location_type');
+%     #my $location_number = scalar($cgi->param('location_number'))
+%     #                        || $object->get($pre.'location_number');
+%
+%   if ( $object->get($pre.'address2') && ! $location_type ) {
+%   }
+%
+%     if ( 1 ) { #ikano, switch on via config
+%       tie my %location_types, 'Tie::IxHash',
+%         FS::part_export::ikano->location_types;
+        <% include('/elements/select.html',
+                     'cgi'        => $cgi,
+                     'field'      => 'location_type',
+                     'disabled'   => $disabled,
+                     'style'      => $style,
+                     'options'    => [ keys %location_types ],
+                     'labels'     => \%location_types,
+                     'curr_value' => $location_type,
+                     'onchange'   => 'location_type_changed',
+                  )
+        %>
+        <SCRIPT TYPE="text/javascript">
+          function location_type_changed (what) {
+            if ( what.options[what.selectedIndex].value == '' ) {
+              what.form.location_number.disabled = true;
+              what.form.location_number.style.backgroundColor = '#dddddd';
+            } else {
+              what.form.location_number.disabled = false;
+              what.form.location_number.style.backgroundColor = '#ffffff';
+            }
+          }
+        </SCRIPT>
+%     } else {
+        <INPUT TYPE  = "text" 
 		NAME="location_type" 
 		ID="location_type"
-		VALUE="<% $object->get('location_type') |h %>"
+               VALUE = "<% $location_type |h %>"
 		SIZE="10"
 	       <% $disabled %>
 	       <% $style %>
 	>
-    </TD>
-    <TD></TD>
-    <<%$th%> ALIGN="right">Number</<%$th%>>
-    <TD><INPUT	TYPE="text" 
+%     }
+
+    <INPUT TYPE="text" 
 		NAME="location_number"
 		ID="location_number"
-		VALUE="<% $object->get('location_number') |h %>"
+               VALUE="<% scalar($cgi->param('location_number')) || $object->get($pre.'location_number') |h %>"
 		SIZE="5"
-	       <% $disabled %>
+               <% $disabled || ($location_type ? '' : 'DISABLED') %>
 	       <% $style %>
 	>
+
+%   if ( $object->get($pre.'address2') ) {
+
+%     #XXX try to parse first
+%     if ( 0 ) {
+%     } else {
+        Can't parse unit type and number from <B><% $object->get($pre.'address2') |h %></B>
+%    }
+
+% }
+
     </TD>
-    <<%$th%> ALIGN="right">Kind</<%$th%>>
-    <TD>
-    <% include('/elements/select.html',
-             'cgi'       => $cgi,
-	     'field'	=> 'location_kind',
-	     'disabled' => $disabled,
-	     'style' => $style, 
-	     'options'  => \@location_kind_options,
-	     'labels'   => $location_kind_labels,
-	     'curr_value' => $cgi->param('location_kind'),
-	  )
-    %>
-    </TD>
+
 </TR>
+
 % } 
 
+
 <TR>
   <<%$th%> ALIGN="right"><%$r%>City</<%$th%>>
   <TD WIDTH="1"><% include('/elements/city.html', %select_hash) %></TD>



More information about the freeside-commits mailing list