[freeside-commits] freeside/httemplate/elements tr-select-cust_location.html, 1.13, 1.14 tr-td-label.html, 1.1, 1.2

Ivan,,, ivan at wavetail.420.am
Thu Mar 10 16:45:55 PST 2011


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

Modified Files:
	tr-select-cust_location.html tr-td-label.html 
Log Message:
prospect qualifications default to prospect address if there's one, other UI cleanups RT#7111

Index: tr-select-cust_location.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select-cust_location.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -d -r1.13 -r1.14
--- tr-select-cust_location.html	20 Jan 2011 20:46:29 -0000	1.13
+++ tr-select-cust_location.html	11 Mar 2011 00:45:53 -0000	1.14
@@ -160,14 +160,8 @@
 % if ( $opt{'is_optional'} ) {
     <OPTION VALUE="-2" <% $locationnum == -2 ? 'SELECTED' : ''%>><% $opt{'optional_label'} || '(not required)' |h %>
 % }
-%     my @locations = $cust_main ? $cust_main->cust_location : ();
-%     @locations = qsearch('cust_location', 
-%			    { 'prospectnum' => $prospect_main->prospectnum } ) 
-%	    if $prospect_main;
-%     push @locations, $cust_location
-%       if !$cust_main && $cust_location && $cust_location->locationnum>0;
-%     foreach my $loc ( sort $location_sort @locations ) {
-%       next if $loc->disabled;
+%
+%     foreach my $loc ( @cust_location ) {
         <OPTION VALUE="<% $loc->locationnum %>"
                 <% $locationnum == $loc->locationnum ? 'SELECTED' : '' %>
         ><% $loc->line |h %>
@@ -206,13 +200,21 @@
 
 my $prefix = ($cust_main && length($cust_main->ship_last)) ? 'ship_' : '';
 
-my $locationnum;
+my $locationnum = '';
+if ( $cgi->param('error') ) {
+  $cgi->param('locationnum') =~ /^(\-?\d*)$/ or die "illegal locationnum";
+  $locationnum = $1;
+} else {
 if ( length($opt{'curr_value'}) ) {
   $locationnum = $opt{'curr_value'};
-} else {
+  } elsif ($prospect_main) {
+    my @cust_location = $prospect_main->cust_location;
+    $locationnum = $cust_location[0]->locationnum if scalar(@cust_location)==1;
+  } else { #?
   $cgi->param('locationnum') =~ /^(\-?\d*)$/ or die "illegal locationnum";
   $locationnum = $1;
 }
+}
 
 #probably could use explicit controls
 # (cust_main locations not editable for tax reasons)
@@ -248,7 +250,20 @@
   or lc($a->address2) cmp lc($b->address2)
 };
 
-my $disabled = ( $locationnum < 0 || ($editable && $locationnum) )
+my @cust_location = ();
+push @cust_location, $cust_main->cust_location if $cust_main;
+push @cust_location, $prospect_main->cust_location if $prospect_main;
+push @cust_location, $cust_location
+  if !$cust_main && $cust_location && $cust_location->locationnum > 0
+  && ! grep { $_->locationnum == $cust_location->locationnum } @cust_location;
+
+ at cust_location = sort $location_sort grep !$_->disabled, @cust_location;
+
+my $disabled =
+  ( $locationnum < 0
+    || ( $editable && $locationnum )
+    || ( $prospect_main && !$opt{'is_optional'} && !@cust_location && $addnew )
+  )
                  ? ''
                  : 'DISABLED';
 

Index: tr-td-label.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-td-label.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- tr-td-label.html	1 Aug 2007 22:25:10 -0000	1.1
+++ tr-td-label.html	11 Mar 2011 00:45:53 -0000	1.2
@@ -1,10 +1,10 @@
 <TR>
 
-  <TD ALIGN="right" VALIGN="top" STYLE="<% $style %>" ID="<% $opt{label_id} || $opt{id}. '_label0' %>">
-
-    <% $opt{label} %>
-
-  </TD>
+  <TD ALIGN  = "right"
+      VALIGN = "<% $opt{'valign'} || 'top' %>"
+      STYLE  = "<% $style %>"
+      ID     = "<% $opt{label_id} || $opt{id}. '_label0' %>"
+  ><% $opt{label} %></TD>
 
 <%init>
 



More information about the freeside-commits mailing list