[freeside-commits] freeside/httemplate/elements select-part_referral.html, NONE, 1.1 tr-select-part_referral.html, NONE, 1.1 select-agent.html, 1.3, 1.4 tr-select-agent.html, 1.2, 1.3

Ivan,,, ivan at wavetail.420.am
Fri Aug 11 01:02:28 PDT 2006


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

Modified Files:
	select-agent.html tr-select-agent.html 
Added Files:
	select-part_referral.html tr-select-part_referral.html 
Log Message:
virtualize referrals on customer addition

Index: select-agent.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-agent.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- select-agent.html	19 Jun 2006 02:33:52 -0000	1.3
+++ select-agent.html	11 Aug 2006 08:02:26 -0000	1.4
@@ -1,8 +1,7 @@
 <%
   my( $agentnum, %opt ) = @_;
 
-  my %select_opt = ();
-  $select_opt{'records'} = $opt{'agents'}
+  $opt{'records'} = delete $opt{'agents'}
     if $opt{'agents'};
 
 %><%= include( '/elements/select-table.html',
@@ -12,7 +11,8 @@
                  'empty_label' => 'all',
                  'hashref'     => { 'disabled' => '' },
                  'extra_sql'   => ' AND '.
-                                  $FS::CurrentUser::CurrentUser->agentnums_sql,
-                 %select_opt,
+                                  $FS::CurrentUser::CurrentUser->agentnums_sql.
+                                  ' ORDER BY agent',
+                 %opt,
              )
 %>

--- NEW FILE: select-part_referral.html ---
<%
  my( $refnum, %opt ) = @_;

  $opt{'records'} = delete $opt{'part_referrals'}
    if $opt{'part_referrals'};

%><%= include( '/elements/select-table.html',
                 'table'       => 'part_referral',
                 'name_col'    => 'referral',
                 'value'       => $refnum,
                 'empty_label' => 'Select advertising source',
                 'hashref'     => { 'disabled' => '' },
                 'extra_sql'   => ' AND '.
                                  FS::part_referral->all_part_referral(1),
                 %opt,
             )
%>

Index: tr-select-agent.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select-agent.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- tr-select-agent.html	19 Jun 2006 02:33:52 -0000	1.2
+++ tr-select-agent.html	11 Aug 2006 08:02:26 -0000	1.3
@@ -7,12 +7,9 @@
     #here is the agent virtualization
     my $agentnums_href = $FS::CurrentUser::CurrentUser->agentnums_href;
     @agents = grep $agentnums_href->{$_->agentnum}, @{ $opt{'agents'} };
+    delete $opt{'agents'};
   } else {
-    @agents = qsearch( {
-      'table'     => 'agent',
-      'hashref'   => { disabled=>'' },
-      'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
-    });
+    @agents = $FS::CurrentUser::CurrentUser->agents;
   }
 
 %>
@@ -24,10 +21,11 @@
 <% } else { %>
 
   <TR>
-    <TD ALIGN="right"><%= $opt{'label'} || 'Agent: ' %></TD>
+    <TD ALIGN="right"><%= $opt{'label'} || 'Agent' %></TD>
     <TD>
       <%= include( '/elements/select-agent.html', $agentnum,
                      'agents' => \@agents,
+                     %opt,
                  )
       %>
     </TD>

--- NEW FILE: tr-select-part_referral.html ---
<%
  my( $refnum, %opt ) = @_;

  $opt{'part_referrals'} ||=
    [ FS::part_referral->all_part_referral( 1 ) ]; #1: include global

  my $r = qq!<font color="#ff0000">*</font>&nbsp;!;

%>

<% if ( scalar( @{$opt{'part_referrals'}} ) == 0 ) {
     eidiot "You have not created any advertising sources.  You must create at least one advertising source before adding a customer.  Go to ". popurl(2). "browse/part_referral.html and create one or more advertising sources.";
   } elsif ( scalar( @{$opt{'part_referrals'}} ) == 1 ) {
%>

     <INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $opt{'part_referrals'}->[0]->refnum %>">

<% } else { %>

     <TR>
       <TH ALIGN="right"><%=$r%>Advertising source</TH>
       <TD>
         <%= include( '/elements/select-part_referral.html', $refnum,
                        'part_referrals' => $opt{'part_referrals'},
                    )
         %>
       </TD>
     </TR>

<% } %>



More information about the freeside-commits mailing list