summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authormark <mark>2010-11-03 00:33:24 +0000
committermark <mark>2010-11-03 00:33:24 +0000
commit942f129f37980d8a2a87be8c3297663ad38298ba (patch)
tree9253eb585901ebd58478f7a7434ed1c4468027cc /httemplate/edit
parent588c85777d2890ada13645bb7742e3c7aca4ed73 (diff)
bulk change package type, RT#9947
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/bulk-cust_pkg.html62
-rw-r--r--httemplate/edit/process/bulk-cust_pkg.cgi9
2 files changed, 71 insertions, 0 deletions
diff --git a/httemplate/edit/bulk-cust_pkg.html b/httemplate/edit/bulk-cust_pkg.html
new file mode 100644
index 000000000..ab419215e
--- /dev/null
+++ b/httemplate/edit/bulk-cust_pkg.html
@@ -0,0 +1,62 @@
+<% include('/elements/header-popup.html', 'Bulk package change') %>
+
+<% include('/elements/init_overlib.html') %>
+
+<% include('/elements/progress-init.html',
+ 'OneTrueForm',
+ [qw( old_pkgpart new_pkgpart keep_dates)],
+ 'process/bulk-cust_pkg.cgi',
+ $p.'browse/part_pkg.cgi',
+ )
+%>
+
+<SCRIPT TYPE="text/javascript">
+function areyousure() {
+ if(confirm('Change these packages?')) {
+ process();
+ }
+}
+</SCRIPT>
+<FORM NAME="OneTrueForm">
+% #false laziness with bulk-cust_svc.html
+% $cgi->param('pkgpart') =~ /^(\d+)$/
+% or die "illegal pkgpart: ". $cgi->param('pkgpart');
+%
+% my $old_pkgpart = $1;
+% my $src_part_pkg = qsearchs('part_pkg', { 'pkgpart' => $old_pkgpart } )
+% or die "unknown pkgpart: $old_pkgpart";
+%
+
+
+<INPUT NAME="old_pkgpart" TYPE="hidden" VALUE="<% $old_pkgpart %>">
+Change <B><% $src_part_pkg->pkg_comment %></B><BR>
+
+to new package definition
+<SELECT NAME="new_pkgpart">
+% foreach my $dest_part_pkg ( qsearch('part_pkg', { 'disabled' => '' } ) ) {
+% # XXX probably no way to prevent packages from violating agent restrictions
+% # maybe something like what bulk-cust_svc does with changing services
+% # under specific pkgparts?
+
+ <OPTION VALUE="<% $dest_part_pkg->pkgpart %>"><% $dest_part_pkg->pkgpart %>: <% $dest_part_pkg->pkg %>
+% }
+
+</SELECT>
+<BR>
+<BR>
+<INPUT TYPE="checkbox" NAME="keep_dates" CHECKED> Preserve all billing dates
+<BR>
+<BR>
+
+<INPUT TYPE="button" VALUE="Bulk change packages" onclick="areyousure()">
+
+</FORM>
+
+<% include('/elements/footer.html') %>
+
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/edit/process/bulk-cust_pkg.cgi b/httemplate/edit/process/bulk-cust_pkg.cgi
new file mode 100644
index 000000000..ede3ee8cd
--- /dev/null
+++ b/httemplate/edit/process/bulk-cust_pkg.cgi
@@ -0,0 +1,9 @@
+<% $server->process %>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $server = new FS::UI::Web::JSRPC 'FS::cust_pkg::process_bulk_cust_pkg', $cgi;
+
+</%init>