From 5c6ae08373b08615c7ab9ffbb98eada0cfd2878f Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 4 Jun 2013 03:30:20 -0700 Subject: [PATCH] move services between packages, RT#22619 --- httemplate/edit/process/bulk-cust_svc-pkgnum.html | 39 +++++++++++++++++++++++ httemplate/view/cust_main/packages/services.html | 18 +++++++++-- 2 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 httemplate/edit/process/bulk-cust_svc-pkgnum.html diff --git a/httemplate/edit/process/bulk-cust_svc-pkgnum.html b/httemplate/edit/process/bulk-cust_svc-pkgnum.html new file mode 100644 index 000000000..5936cc643 --- /dev/null +++ b/httemplate/edit/process/bulk-cust_svc-pkgnum.html @@ -0,0 +1,39 @@ +% if ($error) { +% #$cgi->param('error', $error); +% #$cgi->redirect(popurl(3). 'misc/detach_pkg.html?'. $cgi->query_string ); +% #XXX actually redirect back and display the error instead +% errorpage($error); +% } else { + + <% header(emt("Services moved")) %> + + + + +% } +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied" unless $curuser->access_right('Bulk move customer services'); + +$cgi->param('pkgnum') =~ /^(\d+)$/ or die 'illegal pkgnum'; +my $pkgnum = $1; + +my $cust_pkg = qsearchs({ + 'table' => 'cust_pkg', + 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'pkgnum' => $pkgnum }, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, +}) or die 'unknown pkgnum'; + +my @svcnum = (); +foreach my $param (grep /^svcnum\d+$/, $cgi->param) { + $param =~ /^svcnum(\d+)$/ or die "guru meditation #309"; + push @svcnum, $1 if $cgi->param($param); +} + +my $error = $cust_pkg->grab_svcnums(@svcnum); + + diff --git a/httemplate/view/cust_main/packages/services.html b/httemplate/view/cust_main/packages/services.html index c0a56d0f3..7dfc0049e 100644 --- a/httemplate/view/cust_main/packages/services.html +++ b/httemplate/view/cust_main/packages/services.html @@ -24,7 +24,7 @@ function clearhint_search_cust_svc(obj, str) { % 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 %>) @@ -74,9 +74,21 @@ 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' ) { +% && $part_svc->svcdb eq 'svc_phone' +% && ! $opt{no_links} +% ) +% { % if ( $part_svc->num_avail > 5 ) { % local $opt{'bulk'} = 1;
<% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %> -- 2.11.0