1 <& /elements/header-popup.html, mt($title) &>
3 <& /elements/error.html &>
5 % # only slightly different from unhold_pkg.
6 <FORM NAME="MyForm" ACTION="process/change_pkg_start.html" METHOD=POST>
7 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
10 <% emt('Start billing [_1]', $part_pkg->pkg_comment(cust_pkg => $cust_pkg)) %>
11 <UL STYLE="padding-left: 3ex; list-style: none; background-color: #cccccc">
13 <& /elements/radio.html,
19 <label for="when_now"><% emt('Immediately') %></label>
21 % if ( $next_bill_date ) {
23 <& /elements/radio.html,
25 id => 'when_next_bill_date',
26 value => 'next_bill_date',
29 <label for="when_next_bill_date">
30 <% emt('On the next bill date: [_1]',
31 time2str($date_format, $next_bill_date) ) %>
36 <& /elements/radio.html,
42 <label for="when_date"> <% emt('On this date:') %> </label>
43 <& /elements/input-date-field.html,
44 { name => 'start_date',
45 value => $cgi->param('start_date') || $cust_pkg->start_date,
50 <INPUT TYPE="submit" NAME="submit" VALUE="<% emt('Set start date') %>">
58 my $curuser = $FS::CurrentUser::CurrentUser;
60 unless $curuser->access_right('Change package start date');
63 if ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) {
66 die "illegal query ". $cgi->keywords;
69 my $conf = new FS::Conf;
70 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
72 my $title = 'Start billing package';
74 my $cust_pkg = qsearchs({
76 addl_from => ' JOIN cust_main USING (custnum) ',
77 hashref => { 'pkgnum' => $pkgnum },
78 extra_sql => ' AND '. $curuser->agentnums_sql,
79 }) or die "Unknown pkgnum: $pkgnum";
81 my $next_bill_date = $cust_pkg->cust_main->next_bill_date;
83 my $part_pkg = $cust_pkg->part_pkg;
86 # sticky on error, then the existing start date if any, then the customer's
87 # next bill date, and if none of those, default to now
88 my $when = $cgi->param('when');
91 if ($cust_pkg->start_date) {
93 } elsif ($next_bill_date) {
94 $when = 'next_bill_date';