X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Fqual.html;h=6df8daae4408e0edaa4e3a4e6f928fc61a550f04;hp=7796342810c3f1ec438f3d2c17ef48e81f0a60c2;hb=11bbf29de447fe39e9d7155fe280a0df70fa8c3c;hpb=663b89d06a2c97fb0e7915ba409310fbefefea98 diff --git a/httemplate/misc/qual.html b/httemplate/misc/qual.html index 779634281..6df8daae4 100644 --- a/httemplate/misc/qual.html +++ b/httemplate/misc/qual.html @@ -2,52 +2,69 @@ <% include('/elements/error.html') %> -
+ - + <% ntable("#cccccc", 2) %> <% include('/elements/tr-td-label.html', - 'cgi' => $cgi, - 'label' => 'Qualify using', - 'cell_style' => 'font-weight: bold', - 'id' => 'exportnum', - ) + 'cgi' => $cgi, + 'label' => 'Qualify using', + #'cell_style' => 'font-weight: bold', + 'id' => 'exportnum', + ) %> <% include('/elements/select.html', - 'cgi' => $cgi, - 'field' => 'exportnum', - 'options' => \@export_options, - 'labels' => $export_labels, - 'curr_value' => $cgi->param('exportnum'), - ) + 'cgi' => $cgi, + 'field' => 'exportnum', + 'options' => \@export_options, + 'labels' => $export_labels, + 'curr_value' => $exportnum, + ) %> <% include('/elements/tr-input-text.html', - 'cgi' => $cgi, - 'label' => 'Service Telephone Number', - 'field' => 'phonenum', - 'size' => '12', - 'value' => $cgi->param('phonenum'), + 'cgi' => $cgi, + 'label' => 'Service phone number', + 'field' => 'phonenum', + 'size' => '12', + 'value' => scalar($cgi->param('phonenum')), + + 'valign' => 'middle', + 'colspan' => 6, + 'prefix' => '
', + 'postfix' => ''. join('
', + 'Line-share (non dry loops) - always fill in', + 'Dry loops - always leave empty', + ). '
', ) %> <% include('/elements/tr-select-cust_location.html', - 'cgi' => $cgi, - 'cust_main' => $cust_main, - 'alt_format' => 1, # XXX: use a config option - 'is_optional' => 1, - 'no_bold' => 1, + 'cgi' => $cgi, + $table => $cust_main_or_prospect_main, + 'alt_format' => $conf->exists('qual-alt_address_format'), + 'disable_empty' => $conf->exists('qual-alt_address_format'), + 'no_bold' => 1, + #required for ikano.. config? 'is_optional' => 1, ) %>
- +
@@ -57,18 +74,25 @@ my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" - unless $curuser->access_right('Order customer package'); # XXX: fix this + unless $curuser->access_right('Qualify service'); 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 ); @@ -77,5 +101,10 @@ foreach my $export ( @exports ) { push @export_options, $export->exportnum; $export_labels->{$export->exportnum} = $export->exportname; } +my $exportnum = $cgi->param('error') + ? scalar($cgi->param('exportnum')) + : scalar(@exports) == 1 + ? $exports[0]->exportnum + : '';