From c58774a70c3326ad2ba5a7a38b174dfbd76a9f78 Mon Sep 17 00:00:00 2001 From: levinse Date: Tue, 7 Dec 2010 19:04:43 +0000 Subject: -small svc_dsl UI and flow changes, RT7111 -finish basic qualifications, except prospect support, RT7111 --- httemplate/edit/process/qual.cgi | 2 +- httemplate/edit/svc_dsl.cgi | 15 ++---- httemplate/misc/qual.html | 4 +- httemplate/search/qual.cgi | 78 ++++++++++++++++++++++++++++++++ httemplate/view/cust_main/packages.html | 9 +++- httemplate/view/cust_main/qual_link.html | 4 +- httemplate/view/elements/svc_Common.html | 2 - httemplate/view/qual.cgi | 17 +++---- httemplate/view/svc_dsl.cgi | 1 - 9 files changed, 101 insertions(+), 31 deletions(-) create mode 100755 httemplate/search/qual.cgi (limited to 'httemplate') diff --git a/httemplate/edit/process/qual.cgi b/httemplate/edit/process/qual.cgi index 78e877009..789834ebf 100644 --- a/httemplate/edit/process/qual.cgi +++ b/httemplate/edit/process/qual.cgi @@ -16,7 +16,7 @@ my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" - unless $curuser->access_right('Order customer package'); # XXX: fix me + unless $curuser->access_right('Qualify service'); $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum '. $cgi->param('custnum'); diff --git a/httemplate/edit/svc_dsl.cgi b/httemplate/edit/svc_dsl.cgi index 79aeb1a10..7493d98b9 100644 --- a/httemplate/edit/svc_dsl.cgi +++ b/httemplate/edit/svc_dsl.cgi @@ -92,11 +92,8 @@ my $new_cb = sub { my $export = @exports[0]; if($export->exporttype eq 'ikano') { - $cgi->param('vendor_qual_id') =~ /^(\d+)$/ - or die 'unparsable vendor_qual_id'; - my $vendor_qual_id = $1; - - die "no start date set on customer package" if !$cust_pkg->start_date; + my $ddd = $cust_pkg->start_date; + $ddd = time unless $ddd; my @addl_fields = ( { field => 'loop_type', @@ -108,17 +105,15 @@ my $new_cb = sub { 'password', { field => 'isp_chg', type => 'checkbox', }, 'isp_prev', - { field => 'vendor_qual_id', - type => 'fixed', - value => $vendor_qual_id, }, + 'vendor_qual_id', { field => 'vendor_order_type', type => 'hidden', value => 'NEW' }, { field => 'desired_due_date', type => 'fixed', formatted_value => - time2str($date_format,$cust_pkg->start_date), - value => $cust_pkg->start_date, + time2str($date_format,$ddd), + value => $ddd, }, ); push @fields, @addl_fields; diff --git a/httemplate/misc/qual.html b/httemplate/misc/qual.html index 779634281..298b10a7a 100644 --- a/httemplate/misc/qual.html +++ b/httemplate/misc/qual.html @@ -39,7 +39,7 @@ <% include('/elements/tr-select-cust_location.html', 'cgi' => $cgi, 'cust_main' => $cust_main, - 'alt_format' => 1, # XXX: use a config option + 'alt_format' => $conf->exists('qual-alt-address-format') ? 1 : 0, 'is_optional' => 1, 'no_bold' => 1, ) @@ -57,7 +57,7 @@ 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'; diff --git a/httemplate/search/qual.cgi b/httemplate/search/qual.cgi new file mode 100755 index 000000000..58e011406 --- /dev/null +++ b/httemplate/search/qual.cgi @@ -0,0 +1,78 @@ +<% include( 'elements/search.html', + 'title' => 'Qualifications', + 'name_singular' => 'qualification', + 'query' => { 'table' => 'qual', + 'hashref' => $hashref, + 'extra_sql' => $extra_sql, + 'order_by' => 'ORDER BY qualnum DESC', + }, + 'count_query' => "$count_query $extra_sql", + 'header' => [ 'Qualification', + 'Status', + 'Customer or Prospect', + 'Service Telephone Number', + 'Address', + 'Qualified Using', + 'Vendor Qualification #', + ], + 'align' => 'rcccccc', + 'fields' => [ 'qualnum', + sub { + my $self = shift; + $self->status_long; + }, + sub { + my $self = shift; + my $cust_or_prospect = $self->cust_or_prospect; + return $cust_or_prospect->name + if $cust_or_prospect->get('custnum'); + return "Prospect #".$cust_or_prospect->prospectnum + if $cust_or_prospect->get('prospectnum'); + ''; + }, + 'phonenum', + sub { + my $self = shift; + my %location_hash = $self->location; + # ugh... + if ( %location_hash ) { + my $loc = new FS::cust_location(\%location_hash); + return $loc->location_label; + } + ''; + }, + sub { + my $self = shift; + my $export = $self->export; + my $result = '(manual)'; + $result = $export->exportname if $export; + $result; + }, + 'vendor_qual_id', + ], + 'links' => [ + [ "${p}view/qual.cgi?qualnum=", 'qualnum' ], + '', + '', + '', + '', + '', + '', + ], + ) +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Qualify service'); + +my $hashref = {}; +my $count_query = 'SELECT COUNT(*) FROM qual'; + +my $extra_sql = ''; +if ( $cgi->param('custnum') && $cgi->param('custnum') =~ /^(\d+)$/ ) { + $extra_sql = " where custnum = $1 or locationnum in " + . " (select locationnum from cust_location where custnum = $1)"; +} + + diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 04c47aa3e..ed4ca60c4 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -1,8 +1,9 @@ % my $s = 0; -% # XXX: add qual access right +% if ( $curuser->access_right('Qualify service') ) { <% $s++ ? ' | ' : '' %> <% include('qual_link.html', $cust_main) %> +% } % if ( $curuser->access_right('Order customer package') ) { <% $s++ ? ' | ' : '' %> @@ -60,7 +61,11 @@ Current packages - Package reports
+ Package reports +% if ( $curuser->access_right('Qualify service') ) { + | View Qualifications +% } +
Service reports: accounts
Usage reports: diff --git a/httemplate/view/cust_main/qual_link.html b/httemplate/view/cust_main/qual_link.html index 077142c0a..b8dfaf9b2 100644 --- a/httemplate/view/cust_main/qual_link.html +++ b/httemplate/view/cust_main/qual_link.html @@ -1,7 +1,7 @@ <% include( '/elements/popup_link-cust_main.html', 'action' => $p. 'misc/qual.html', - 'label' => 'Service Qualification', - 'actionlabel' => 'Service Qualification', + 'label' => 'New Qualification', + 'actionlabel' => 'New Qualification', 'color' => '#333399', 'cust_main' => $cust_main, 'closetext' => 'Close', diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index e3b8da4fe..de49b50d2 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -53,11 +53,9 @@ Service #<% $svcnum %> % my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?'; | Edit this <% $label %> -% unless ( $opt{'disable_unprovision'} ) { | Unprovision this Service
-% } <% ntable("#cccccc") %><% ntable("#cccccc",2) %> diff --git a/httemplate/view/qual.cgi b/httemplate/view/qual.cgi index f96726995..ebdc5cf12 100644 --- a/httemplate/view/qual.cgi +++ b/httemplate/view/qual.cgi @@ -1,6 +1,6 @@ <% include("/elements/header.html","View Qualification") %> -% if ( $cust_or_prospect->custnum ) { +% if ( $cust_or_prospect->get('custnum') ) { <% include( '/elements/small_custview.html', $cust_or_prospect->custnum, '', 1, "${p}view/cust_main.cgi") %> @@ -28,7 +28,8 @@ <%init> -# XXX: add access right for quals? +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Qualify service'); my $qualnum; if ( $cgi->param('qualnum') ) { @@ -48,18 +49,12 @@ if ( %location_hash ) { $cust_location = new FS::cust_location(\%location_hash); $location_line = $cust_location->location_label; } -# XXX: geocode_Mixin location_label doesn't currently have the new cust_location fields - add them my $location_kind; -$location_kind = "Residential" if $cust_location->location_kind eq 'R'; -$location_kind = "Business" if $cust_location->location_kind eq 'B'; +$location_kind = "Residential" if $cust_location->get('location_kind') eq 'R'; +$location_kind = "Business" if $cust_location->get('location_kind') eq 'B'; my $cust_or_prospect = $qual->cust_or_prospect; - -my $export; -if ( $qual->exportnum ) { - $export = qsearchs('part_export', { exportnum => $qual->exportnum } ) - or die 'invalid exportnum'; -} +my $export = $qual->export; diff --git a/httemplate/view/svc_dsl.cgi b/httemplate/view/svc_dsl.cgi index 7bbdca1c7..ade13501b 100644 --- a/httemplate/view/svc_dsl.cgi +++ b/httemplate/view/svc_dsl.cgi @@ -36,7 +36,6 @@ my $svc_cb = sub { return if ( scalar(@exports) == 0 ); my $export = @exports[0]; - $opt->{'disable_unprovision'} = 1; @fields = ( 'phonenum', { field => 'loop_type', -- cgit v1.2.1