X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpackages%2Fservices.html;h=352f5ea9d92fe67228b677c68d2f7f2db144b203;hb=9aa198dfc90054de34cf1af8f3238d004416ebc9;hp=0c18f584e2cf76f1df6d5658919371a33b2ae0fd;hpb=6e0ae9815a528a46b6f0c98fc5cdff67a95ed278;p=freeside.git diff --git a/httemplate/view/cust_main/packages/services.html b/httemplate/view/cust_main/packages/services.html index 0c18f584e..352f5ea9d 100644 --- a/httemplate/view/cust_main/packages/services.html +++ b/httemplate/view/cust_main/packages/services.html @@ -3,25 +3,31 @@ % ### - +
-% foreach my $part_svc ( $cust_pkg->part_svc ) { - +% my $showdidlink = browse_received_did_inventory($cust_pkg->custnum); +% foreach my $part_svc ( +% $cust_pkg->part_svc( +% 'summarize_size' => $opt{'cust_pkg-large_pkg_size'}, +% 'hide_discontinued' => $opt{'cust_pkg-hide_discontinued-part_svc'}, +% ) +% ) { +% % my $num_cust_svc = $cust_pkg->num_cust_svc( $part_svc->svcpart ); - +% % if ( $opt{'cust_pkg-large_pkg_size'} > 0 and -% $opt{'cust_pkg-large_pkg_size'} <= $num_cust_svc ) { -% # summarize +% $opt{'cust_pkg-large_pkg_size'} <= $num_cust_svc ) { # summarize +% % } #$hint -% } -% else { # don't summarize +% +% } else { # don't summarize +% % foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) { % if ( $cust_pkg->getfield('cancel') > 0 ) { <& /elements/tr-cust_svc_cancel.html, @@ -70,17 +77,50 @@ function clearhint_search_cust_svc(obj, str) { -% } +% } + +% } #foreach part_svc + +% if ($cust_pkg->get('cancel')) { +% foreach my $svc (sort { $a->{'svcpart'} <=> $b->{'svcpart'} } +% $cust_pkg->uncancel_svc_summary('summarize_size' => $opt{'cust_pkg-large_pkg_size'}) +% ) { +% next unless $svc->{'reprovisionable'}; + + + + +% } +% } -% }
% my $href="${p}search/cust_pkg_svc.html?svcpart=".$part_svc->svcpart. % ";pkgnum=".$cust_pkg->pkgnum; - <% $part_svc->svc %> + <% $part_svc->svc |h %> (<% mt("view all [_1]", $num_cust_svc) |h %>) @@ -42,8 +48,9 @@ function clearhint_search_cust_svc(obj, str) {
- <% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %> + + +% if ( $opt{no_links} ) { + <% $part_svc->svc |h %>: <% $part_svc->num_avail %> + <% mt('Available') |h %> +% } else { + <% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %> +% } + + % if ( $curuser->access_right('Bulk provision customer service') -% && $part_svc->svcdb eq 'svc_phone' ) { -
<% mt('Browse Received DID Inventory') |h %> +% && $part_svc->svcdb eq 'svc_phone' +% && ! $opt{no_links} +% ) +% { +% if ( $part_svc->num_avail > 5 ) { +% local $opt{'bulk'} = 1; +% local $opt{'svc_phone_bulk_provision_simple'} = $svc_phone_bulk_provision_simple; +% local $opt{'num_avail'} = $part_svc->num_avail; +
<% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %> +% } +% if ($showdidlink) { +
<% mt('Browse Received DID Inventory') |h %> +% } % }
<% $svc->{'svc'} |h %><% $svc->{'label'} |h %>
@@ -92,44 +132,73 @@ my %opt = @_; my $bgcolor = $opt{'bgcolor'}; my $cust_pkg = $opt{'cust_pkg'}; my $part_pkg = $opt{'part_pkg'}; -my $curuser = $FS::CurrentUser::CurrentUser; +my $svc_phone_bulk_provision_simple = $opt{'svc_phone-bulk_provision_simple'}; -my $conf = new FS::Conf; +my $curuser = $FS::CurrentUser::CurrentUser; sub svc_provision_link { my ($cust_pkg, $part_svc, $opt, $curuser) = @_; + ( my $svc_nbsp = $part_svc->svc ) =~ s/\s+/ /g; my $num_avail = $part_svc->num_avail; - my $pkgnum_svcpart = "pkgnum=". $cust_pkg->pkgnum. ';'. - "svcpart=". $part_svc->svcpart; + + my $query = "pkgnum=". $cust_pkg->pkgnum. ';'. + "svcpart=". $part_svc->svcpart; + $query .= ';bulk=1' if $opt->{bulk}; + my $url; if ( $part_svc->svcdb eq 'svc_external' #could be generalized && $opt->{'svc_external-skip_manual'} ) { - $url = "${p}edit/process/". $part_svc->svcdb. ".cgi?$pkgnum_svcpart"; + $url = "${p}edit/process/". $part_svc->svcdb. ".cgi?$query"; + } elsif ( $part_svc->svcdb eq 'svc_phone' && $opt->{bulk} + && $opt->{svc_phone_bulk_provision_simple} + ) + { + $query .= ';num_avail='. $opt->{num_avail}; + $url = "${p}edit/bulk-svc_phone.html?$query"; } else { $url = svc_url( 'm' => $m, 'action' => 'edit', 'part_svc' => $part_svc, - 'query' => $pkgnum_svcpart, + 'query' => $query, ); } + my $action = $opt->{bulk} ? 'Bulk provision' : 'Provision'; + my $link = qq!!. - emt("Provision [_1] ([_2])",$svc_nbsp,$num_avail).''; + emt("$action [_1] ([_2])",$svc_nbsp,$num_avail).''; + if ( $opt->{'legacy_link'} && $curuser->access_right('View/link unlinked services') + && ! $opt{bulk} ) { $link .= '
'. - qq!!. + qq!!. emt("Link to legacy [_1] ([_2])",$svc_nbsp,$num_avail).''; } + $link; } +sub browse_received_did_inventory { + local($FS::Record::qsearch_qualify_columns) = 1; + qsearch({ + 'table' => 'did_order', + 'hashref' => { 'custnum' => $_[0] }, + 'extra_sql' => ' LIMIT 1' + }) || + qsearch({ + 'table' => 'did_order_item', + 'hashref' => { 'custnum' => $_[0] }, + 'addl_from' => ' INNER JOIN did_order ON did_order_item.ordernum = did_order.ordernum', + 'extra_sql' => ' LIMIT 1' + }); +} + my %hints = ( svc_acct => emt('(user or email)'), svc_domain => emt('(domain)'),