[freeside-commits] freeside/httemplate/misc qual.html,1.2,1.3

Erik Levinson levinse at wavetail.420.am
Tue Dec 7 12:38:54 PST 2010


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

Modified Files:
	qual.html 
Log Message:
added prospect support to qualifications, RT7111


Index: qual.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/qual.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- qual.html	7 Dec 2010 19:04:43 -0000	1.2
+++ qual.html	7 Dec 2010 20:38:52 -0000	1.3
@@ -4,7 +4,7 @@
 
 <FORM NAME="QualForm" ACTION="<% $p %>edit/process/qual.cgi" METHOD="POST">
 
-<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main->custnum %>">
+<INPUT TYPE="hidden" NAME="<%$cust_or_prospect%>num" VALUE="<% $custnum_or_prospectnum %>">
 
 <% ntable("#cccccc", 2) %>
 
@@ -38,7 +38,7 @@
 
 <% include('/elements/tr-select-cust_location.html',
              'cgi'       => $cgi,
-             'cust_main' => $cust_main,
+	     $table => $cust_main_or_prospect_main,
 	     'alt_format' => $conf->exists('qual-alt-address-format') ? 1 : 0,
 	     'is_optional' => 1,
 	     'no_bold' => 1,
@@ -62,13 +62,20 @@
 my $conf = new FS::Conf;
 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
 
-$cgi->param('custnum') =~ /^(\d+)$/ or die "no custnum";
+$cgi->param('custnum') =~ /^(\d+)$/;
 my $custnum = $1;
-my $cust_main = qsearchs({
-  'table'     => 'cust_main',
-  'hashref'   => { 'custnum' => $custnum },
+$cgi->param('prospectnum') =~ /^(\d+)$/;
+my $prospectnum = $1;
+my $cust_or_prospect = $custnum ? "cust" : "prospect";
+my $table = $cust_or_prospect . "_main";
+my $custnum_or_prospectnum = $custnum ? $custnum : $prospectnum;
+my $cust_main_or_prospect_main = qsearchs({
+  'table'     => $table,
+  'hashref'   => { $cust_or_prospect."num" => $custnum_or_prospectnum },
   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
 });
+die "neither prospect nor customer specified or found" 
+    unless $cust_main_or_prospect_main;
 
 my @exports = grep { $_->can('qual') } qsearch( 'part_export', {} );
 my @export_options = ( 0 );



More information about the freeside-commits mailing list