From d0fc25693dd91869c6e1fe1372bcae35fde1a827 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 31 Dec 2015 17:44:04 -0800 Subject: allow back-billing by changing start dates, #38883 --- httemplate/misc/change_pkg_start.html | 99 +++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 httemplate/misc/change_pkg_start.html (limited to 'httemplate/misc/change_pkg_start.html') diff --git a/httemplate/misc/change_pkg_start.html b/httemplate/misc/change_pkg_start.html new file mode 100755 index 000000000..5a890c86e --- /dev/null +++ b/httemplate/misc/change_pkg_start.html @@ -0,0 +1,99 @@ +<& /elements/header-popup.html, mt($title) &> + +<& /elements/error.html &> + +% # only slightly different from unhold_pkg. +
+ + +
+<% emt('Start billing [_1]', $part_pkg->pkg_comment(cust_pkg => $cust_pkg)) %> + + + +
+ + + +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied" + unless $curuser->access_right('Change package start date'); + +my $pkgnum; +if ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) { + $pkgnum = $1; +} else { + die "illegal query ". $cgi->keywords; +} + +my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + +my $title = 'Start billing package'; + +my $cust_pkg = qsearchs({ + table => 'cust_pkg', + addl_from => ' JOIN cust_main USING (custnum) ', + hashref => { 'pkgnum' => $pkgnum }, + extra_sql => ' AND '. $curuser->agentnums_sql, +}) or die "Unknown pkgnum: $pkgnum"; + +my $next_bill_date = $cust_pkg->cust_main->next_bill_date; + +my $part_pkg = $cust_pkg->part_pkg; + +# defaults: +# sticky on error, then the existing start date if any, then the customer's +# next bill date, and if none of those, default to now +my $when = $cgi->param('when'); + +if (!$when) { + if ($cust_pkg->start_date) { + $when = 'date'; + } elsif ($next_bill_date) { + $when = 'next_bill_date'; + } else { + $when = 'now'; + } +} + -- cgit v1.2.1