[freeside-commits] freeside/httemplate/elements header.html, 1.35, 1.36 menu.html, 1.73, 1.74 tr-select-cust_location.html, 1.5, 1.6 city.html, 1.2, 1.3 tr-contact.html, NONE, 1.1 contact.html, NONE, 1.1

Ivan,,, ivan at wavetail.420.am
Mon Dec 28 11:18:21 PST 2009


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

Modified Files:
	header.html menu.html tr-select-cust_location.html city.html 
Added Files:
	tr-contact.html contact.html 
Log Message:
beginning of prospect/CRM/contact work

Index: tr-select-cust_location.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select-cust_location.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- tr-select-cust_location.html	12 Oct 2009 01:45:12 -0000	1.5
+++ tr-select-cust_location.html	28 Dec 2009 19:18:19 -0000	1.6
@@ -4,7 +4,13 @@
 
   include('/elements/tr-select-cust_location.html',
             'cgi'       => $cgi,
-            'cust_main' => $cust_main,
+
+            'cust_main'     => $cust_main,
+            #or
+            'prospect_main' => $prospect_main,
+
+            #optional
+            'empty_label'   => '(default service address)',
          )
 
 </%doc>
@@ -42,6 +48,7 @@
     } else {
 
       if ( locationnum == 0 ) {
+%       if ( $cust_main ) {
         what.form.address1.value = <% $cust_main->get($prefix.'address1') |js_string %>;
         what.form.address2.value = <% $cust_main->get($prefix.'address2') |js_string %>;
         what.form.city.value = <% $cust_main->get($prefix.'city') |js_string %>;
@@ -54,16 +61,33 @@
                                             <% $cust_main->get($prefix.'county') | js_string %>
                                           )
                        );
+%       }
 
       } else {
         get_location( locationnum, update_location );
       } 
 
+%     if ( $editable ) {
+        if ( locationnum == 0 ) {
+%     }
+
 %#sleep/wait until dropdowns are updated?
-%     for (@location_fields, 'city_select') { 
-        what.form.<%$_%>.disabled = true;
-        what.form.<%$_%>.style.backgroundColor = '#dddddd';
-%     } 
+%         for (@location_fields, 'city_select') { 
+            what.form.<%$_%>.disabled = true;
+            what.form.<%$_%>.style.backgroundColor = '#dddddd';
+%         } 
+
+%     if ( $editable ) {
+        } else {
+
+%#sleep/wait until dropdowns are updated?
+%         for (@location_fields, 'city_select') { 
+            what.form.<%$_%>.disabled = false;
+            what.form.<%$_%>.style.backgroundColor = '#ffffff';
+%         } 
+
+        }
+%     }
 
     }
   }
@@ -122,15 +146,20 @@
   <TH ALIGN="right">Service&nbsp;location</TH>
   <TD COLSPAN=7>
     <SELECT NAME="locationnum" onChange="locationnum_changed(this);">
-      <OPTION VALUE="">(default service address)
-%     foreach my $loc ( $cust_main->cust_location ) {
+      <OPTION VALUE=""><% $opt{'empty_label'} || '(default service address)' |h %>
+%     my @locations = $cust_main ? $cust_main->cust_location : ();
+%     push @locations, $cust_location
+%       if !$cust_main && $cust_location && $cust_location->locationnum>0;
+%     foreach my $loc ( @locations ) {
         <OPTION VALUE="<% $loc->locationnum %>"
                 <% $locationnum == $loc->locationnum ? 'SELECTED' : '' %>
         ><% $loc->line |h %>
 %     }
-      <OPTION VALUE="-1"
-              <% $locationnum == -1 ? 'SELECTED' : '' %>
-      >Add new location
+%     if ( $addnew ) {
+        <OPTION VALUE="-1"
+                <% $locationnum == -1 ? 'SELECTED' : '' %>
+        >Add new location
+%     }
     </SELECT>
   </TD>
 </TR>
@@ -138,7 +167,7 @@
 <% include('/elements/location.html',
              'object'       => $cust_location,
              #'onchange' ?  probably not
-             'disabled'     => ( $locationnum == -1 ? '' : 'DISABLED' ),
+             'disabled'     => $disabled,
              'no_asterisks' => 1,
           )
 %>
@@ -156,13 +185,25 @@
                    || ($countrydefault eq 'US' ? 'CA' : '');
 
 my %opt = @_;
-my $cgi       = $opt{'cgi'};
-my $cust_main = $opt{'cust_main'};
+my $cgi           = $opt{'cgi'};
+my $cust_main     = $opt{'cust_main'};
+my $prospect_main = $opt{'prospect_main'};
 
-my $prefix = length($cust_main->ship_last) ? 'ship_' : '';
+my $prefix = ($cust_main && length($cust_main->ship_last)) ? 'ship_' : '';
+
+my $locationnum;
+if ( length($opt{'curr_value'}) ) {
+  $locationnum = $opt{'curr_value'};
+} else {
+  $cgi->param('locationnum') =~ /^(\-?\d*)$/ or die "illegal locationnum";
+  $locationnum = $1;
+}
+
+#probably could use explicit controls
+# (cust_main locations not editable for tax reasons)
+my $editable = $cust_main ? 0 : 1; #could use explicit control
+my $addnew = $cust_main ? 1 : ( $locationnum>0 ? 0 : 1 );
 
-$cgi->param('locationnum') =~ /^(\-?\d*)$/ or die "illegal locationnum";
-my $locationnum = $1;
 my $cust_location;
 if ( $locationnum && $locationnum != -1 ) {
   $cust_location = qsearchs('cust_location', { 'locationnum' => $locationnum } )
@@ -171,9 +212,13 @@
   $cust_location = new FS::cust_location;
   if ( $locationnum == -1 ) {
     $cust_location->$_( $cgi->param($_) ) foreach @location_fields;
-  } else {
+  } elsif ( $cust_main ) {
     $cust_location->$_( $cust_main->get($prefix.$_) ) foreach @location_fields;
   }
 }
 
+my $disabled = ( $locationnum == -1 || ($editable && $locationnum) )
+                 ? ''
+                 : 'DISABLED';
+
 </%init>

Index: header.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/header.html,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- header.html	6 Dec 2009 23:18:48 -0000	1.35
+++ header.html	28 Dec 2009 19:18:19 -0000	1.36
@@ -39,6 +39,12 @@
     <% include('init_overlib.html') |n %>
 
     <SCRIPT TYPE="text/javascript">
+
+      function clearhint_search_prospect (what) {
+        if ( what.value == '<% $prospect_label |n %>' )
+          what.value = '';
+      }
+
       function clearhint_search_cust (what) {
         if ( what.value == '<% $cust_label |n %>' )
           what.value = '';
@@ -63,6 +69,7 @@
         if ( what.value == '<% $ticketing_label |n %>' )
           what.value = '';
       }
+
     </SCRIPT>
 
     <% $head |n %>
@@ -140,6 +147,7 @@
          vertical-align:bottom;
          text-align:right;
          font-family: Arial,Verdana,Helvetica,sans-serif;
+         font-size: 13px;
          padding-left: 0px;
          padding-right: 0px;
          padding-top: 0px;
@@ -154,14 +162,14 @@
 
     <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0>
       <TR>
-        <TD COLSPAN=6 WIDTH="100%" STYLE="padding:0"><IMG BORDER=0 ALT="" SRC="<%$fsurl%>images/black-gradient.png" HEIGHT="13" WIDTH="100%"></TD>
+        <TD COLSPAN="7" WIDTH="100%" STYLE="padding:0"><IMG BORDER=0 ALT="" SRC="<%$fsurl%>images/black-gradient.png" HEIGHT="13" WIDTH="100%"></TD>
       </TR>
 
 % if ( $menu_position eq 'top' ) {
 
       <TR>
 
-        <TD COLSPAN="4" WIDTH="100%" STYLE="padding:0" BGCOLOR="#000000">
+        <TD COLSPAN="5" WIDTH="100%" STYLE="padding:0" BGCOLOR="#000000">
           <SCRIPT TYPE="text/javascript">
             document.write(myBar);
           </SCRIPT>
@@ -180,12 +188,12 @@
       </TR>
 
       <TR>
-        <TD COLSPAN="6" WIDTH="100%" HEIGHT="2px" STYLE="padding:0" BGCOLOR="#000000">
+        <TD COLSPAN="7" WIDTH="100%" HEIGHT="2px" STYLE="padding:0" BGCOLOR="#000000">
         </TD>
       </TR>
       
       <TR>
-        <TD COLSPAN="6" WIDTH="100%" HEIGHT="4px" STYLE="padding:0" BGCOLOR="#000000">
+        <TD COLSPAN="7" WIDTH="100%" HEIGHT="4px" STYLE="padding:0" BGCOLOR="#000000">
         </TD>
       </TR>
 
@@ -193,7 +201,17 @@
 
       <TR>
 
-        <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right">
+        <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right" STYLE="padding-left:2px">
+% if ( $curuser->access_right('List prospects') ) {
+          <FORM ACTION="<%$fsurl%>search/prospect_main.html" METHOD="GET" STYLE="margin:0">
+            <INPUT NAME="search_prospect" TYPE="text" VALUE="<% $prospect_label |n %>" STYLE="width:155px" onFocus="clearhint_search_prospect(this);" onClick="clearhint_search_prospect(this);" CLASS="fstext"><BR>
+            <A HREF="<%$fsurl%>search/report_prospect_main.html" STYLE="color: #ffffff; font-size: 11px">Adv</A>
+            <INPUT TYPE="submit" VALUE="Search prospects" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px;padding-left:1px;padding-right:1px"">
+          </FORM>
+% }
+        </TD>
+
+        <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right" STYLE="padding-left:2px">
 % if ( $curuser->access_right('List customers') ) {
           <FORM ACTION="<%$fsurl%>search/cust_main.cgi" METHOD="GET" STYLE="margin:0">
             <INPUT NAME="search_cust" TYPE="text" VALUE="<% $cust_label |n %>" STYLE="width:<%$cust_width%>px" onFocus="clearhint_search_cust(this);" onClick="clearhint_search_cust(this);" CLASS="fstext"><BR>
@@ -209,7 +227,7 @@
               <INPUT TYPE="hidden" NAME="address2_on" VALUE="1">
               <INPUT NAME="address2_text" TYPE="text" VALUE="<% $address2_label |n %>" STYLE="width:67px" onFocus="clearhint_search_address2(this);" onClick="clearhint_search_address2(this);" CLASS="fstext">
               <BR>
-              <INPUT TYPE="submit" VALUE="Search units" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px;padding-left:2px;padding-right:2px">
+              <INPUT TYPE="submit" VALUE="Search units" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px;padding-left:1px;padding-right:1px;margin-top:3px">
             </FORM>
 % } 
         </TD>
@@ -217,30 +235,29 @@
         <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right">
 % if ( $curuser->access_right('View invoices') ) { 
             <FORM ACTION="<%$fsurl%>search/cust_bill.html" METHOD="GET" STYLE="margin:0;display:inline">
-              <INPUT NAME="invnum" TYPE="text" VALUE="<% $inv_label |n %>" STYLE="width:64px" onFocus="clearhint_search_invoice(this);" onClick="clearhint_search_invoice(this);" CLASS="fstext">
+              <INPUT NAME="invnum" TYPE="text" VALUE="<% $inv_label |n %>" STYLE="width:56px" onFocus="clearhint_search_invoice(this);" onClick="clearhint_search_invoice(this);" CLASS="fstext">
 %   if ( $curuser->access_right('List invoices') ) { 
               <A HREF="<%$fsurl%>search/report_cust_bill.html" STYLE="color: #ffffff; font-size: 11px">Adv</A>\
 %   } 
-<BR>
-              <INPUT TYPE="submit" VALUE="Search invoices" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px;padding-left:2px;padding-right:2px">
+<BR><INPUT TYPE="submit" VALUE="Search invoices" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px;padding-left:1px;padding-right:1px;margin-top:3px">
             </FORM>
 % } 
         </TD>
 
-        <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right">
+        <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right" STYLE="padding-left:2px">
 % if ( $curuser->access_right('View customer services') ) {
           <FORM ACTION="<%$fsurl%>search/cust_svc.html" METHOD="GET" STYLE="margin:0">
-            <INPUT NAME="search_svc" TYPE="text" VALUE="<% $svc_label |n %>" STYLE="width:324px" onFocus="clearhint_search_svc(this);" onClick="clearhint_search_svc(this);" CLASS="fstext"><BR>
+            <INPUT NAME="search_svc" TYPE="text" VALUE="<% $svc_label |n %>" STYLE="width:271px" onFocus="clearhint_search_svc(this);" onClick="clearhint_search_svc(this);" CLASS="fstext"><BR>
             <A NOTYET="<%$fsurl%>search/svc_Smarter.html" STYLE="color: #000000; font-size:11px">Advanced</A>
             <INPUT TYPE="submit" VALUE="Search services" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px">
           </FORM>
 % }
         </TD>
 
-        <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right" STYLE="padding-left:4px;padding-right:4px">
+        <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right" STYLE="padding-left:2px;padding-right:2px">
 % if ( $conf->config("ticket_system") ) { 
           <FORM ACTION="<% FS::TicketSystem->baseurl %>index.html" METHOD="GET" STYLE="margin:0">
-            <INPUT NAME="q" TYPE="text" VALUE="<% $ticketing_label |n %>" STYLE="width:256px" onFocus="clearhint_search_ticket(this);" onClick="clearhint_search_ticket(this);" CLASS="fstext"><BR>
+            <INPUT NAME="q" TYPE="text" VALUE="<% $ticketing_label |n %>" STYLE="width:223px" onFocus="clearhint_search_ticket(this);" onClick="clearhint_search_ticket(this);" CLASS="fstext"><BR>
             <A HREF="<% FS::TicketSystem->baseurl %>Search/Build.html" STYLE="color: #ffffff; font-size:11px">Advanced</A>
             <INPUT TYPE="submit" VALUE="Search tickets" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px">
           </FORM>
@@ -334,11 +351,13 @@
   $company_name = $conf->config('company_name');
 }
 
-my $cust_width = 288; #251 #ok for IE, slightly bigger for windows firefox
+my $prospect_label = '(name, company or phone)';
+
+my $cust_width = 246;
 my $cust_label = '(cust #, name, company';
 if ( $conf->exists('address1-search') ) {
   $cust_label .= ', address';
-  $cust_width += 64;
+  $cust_width += 56;
 }
 $cust_label .= ' or contact phone)';
 

--- NEW FILE: tr-contact.html ---
%   unless ( $opt{'js_only'} ) {

      <% include('tr-td-label.html', %opt) %>
        <TD <% $cell_style %>>

%   }
%
            <% include( '/elements/contact.html', %opt ) %>
%
%   unless ( $opt{'js_only'} ) {

        </TD>
      </TR>

%   }
<%init>

my( %opt ) = @_;

my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';

$opt{'label'} ||= 'Contact';

</%init>

Index: city.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/city.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- city.html	22 Oct 2009 09:34:54 -0000	1.2
+++ city.html	28 Dec 2009 19:18:19 -0000	1.3
@@ -34,7 +34,7 @@
     what.options[length] = optionName;
   }
 
-  var saved_<%$pre%>city= '';
+  var saved_<%$pre%>city= '<% $saved_city |h %>';
 
   function <% $pre %>county_changed(what, callback) {
 
@@ -124,10 +124,12 @@
 my $select_style = $opt{'style'} ? [ @{ $opt{'style'} } ] : [];
 
 my @cities = cities( $opt{'county'}, $opt{'state'}, $opt{'country'} );
+my $saved_city = '';
 if ( scalar(@cities) > 1 || $cities[0] ) {
   push @$text_style, 'display:none';
 } else {
   push @$select_style, 'display:none';
+  $saved_city = $opt{'city'};
 }
 
 $text_style =

--- NEW FILE: contact.html ---
% unless ( $opt{'js_only'} ) {

  <INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<% $curr_value %>">

  <TABLE>
    <TR>
      <TD>
        <INPUT TYPE = "text"
               NAME = "<%$name%>_first"
               ID   = "<%$id%>_id"
               VALUE = "<% $contact->first |h %>"
               <% $onchange %>
        ><BR>
        <FONT SIZE="-2">First name</FONT>
      </TD>
      <TD>
        <INPUT TYPE = "text"
               NAME = "<%$name%>_last"
               ID   = "<%$id%>_id"
               VALUE = "<% $contact->get('last') |h %>"
               <% $onchange %>
        ><BR>
        <FONT SIZE="-2">Last name</FONT>
      </TD>
      <TD>
        <INPUT TYPE = "text"
               NAME = "<%$name%>_title"
               ID   = "<%$id%>_id"
               VALUE = "<% $contact->title |h %>"
               <% $onchange %>
        ><BR>
        <FONT SIZE="-2">Title/Position</FONT>
      </TD>
      <TD>
        <INPUT TYPE = "text"
               NAME = "<%$name%>_comment"
               ID   = "<%$id%>_id"
               VALUE = "<% $contact->comment |h %>"
               <% $onchange %>
        ><BR>
        <FONT SIZE="-2">Comment</FONT>
      </TD>
    </TR>
  </TABLE>

% }
<%init>

my( %opt ) = @_;

my $name = $opt{'element_name'} || $opt{'field'} || 'contactnum';
my $id = $opt{'id'} || 'contactnum';

my $curr_value = $opt{'curr_value'} || $opt{'value'};

my $onchange = '';
if ( $opt{'onchange'} ) {
  $onchange = $opt{'onchange'};
  $onchange .= '(this)' unless $onchange =~ /\(\w*\);?$/;
  $onchange =~ s/\(what\);/\(this\);/g; #ugh, terrible hack.  all onchange
                                        #callbacks should act the same
  $onchange = 'onChange="'. $onchange. '"';
}

my $contact;
if ( $curr_value ) {
  $contact = qsearchs('contact', { 'contactnum' => $curr_value } );
} else {
  $contact = new FS::contact {};
}

</%init>

Index: menu.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/menu.html,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- menu.html	14 Dec 2009 01:41:29 -0000	1.73
+++ menu.html	28 Dec 2009 19:18:19 -0000	1.74
@@ -476,6 +476,8 @@
       'Ticketing start page',
     ],
 }
+$menu{'New prospect'} = [ $fsurl.'edit/prospect_main.html', 'Add a new prospect' ]
+  if $curuser->access_right('New prospect');
 $menu{'New customer'} = [ $fsurl.'edit/cust_main.cgi', 'Add a new customer' ]
   if $curuser->access_right('New customer');
 $menu{'Reports'} = [ \%report_menu, 'Lists, reporting and graphing' ]



More information about the freeside-commits mailing list