X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Fchange_pkg_date.html;h=0a23805f487b3bc8caafaf09d91d292b5386bc01;hp=5a890c86ed7ead5703cddd08598dd9b0ec950c5f;hb=990d718978480aa02b0031a2ec6753e64975fd34;hpb=80b548ef7cad9b01584f8ab2018e186a03148210 diff --git a/httemplate/misc/change_pkg_date.html b/httemplate/misc/change_pkg_date.html index 5a890c86e..0a23805f4 100755 --- a/httemplate/misc/change_pkg_date.html +++ b/httemplate/misc/change_pkg_date.html @@ -3,11 +3,12 @@ <& /elements/error.html &> % # only slightly different from unhold_pkg. -
+ +
-<% emt('Start billing [_1]', $part_pkg->pkg_comment(cust_pkg => $cust_pkg)) %> +<% emt(($isstart ? 'Start billing' : 'Set contract end for').' [_1]', $part_pkg->pkg_comment(cust_pkg => $cust_pkg)) %> - +
@@ -55,9 +56,21 @@ <%init> +my $field = $cgi->param('field'); + +my ($acl, $isstart); +if ($field eq 'start_date') { + $acl = 'Change package start date'; + $isstart = 1; +} elsif ($field eq 'contract_end') { + $acl = 'Change package contract end date'; +} else { + die "Unknown date field"; +} + my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" - unless $curuser->access_right('Change package start date'); + unless $curuser->access_right($acl); my $pkgnum; if ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) { @@ -69,7 +82,7 @@ if ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) { my $conf = new FS::Conf; my $date_format = $conf->config('date_format') || '%m/%d/%Y'; -my $title = 'Start billing package'; +my $title = $isstart ? 'Start billing package' : 'Change contract end'; my $cust_pkg = qsearchs({ table => 'cust_pkg', @@ -83,12 +96,12 @@ 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 +# sticky on error, then the existing 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) { + if ($cust_pkg->get($field)) { $when = 'date'; } elsif ($next_bill_date) { $when = 'next_bill_date';