summaryrefslogtreecommitdiff
path: root/httemplate/misc/email-customers-history.html
blob: 2f9a38d238b26f31425f806c3ff30d418b06da37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

 <% include('email-customers.html',
      'form_action'       => 'email-customers-history.html',
      'sub_param_process' => $sub_param_process,
      'alternate_form'    => $alternate_form,
      'title'             => 'Send payment history',
    )
 %>

<%init>

my $sub_param_process = sub {
  my $conf = shift;
  my %sub_param;
  foreach my $field ( qw( start_date end_date ) ) {
    $sub_param{'payment_history'}->{$field} = parse_datetime($cgi->param($field));
    $cgi->delete($field);
  }
  $cgi->param('msgnum',$conf->config('payment_history_msgnum'));
  return %sub_param;
};

my $alternate_form = sub {
  my %sub_param = @_;
  # this could maaaybe be a separate element, for cleanliness
  # but it's really only for use by this page, and it's not overly complicated
  my $noinit = 0;
  return join("\n",
    '<TABLE BORDER="0">',
    (
      map {
        my $label = ucfirst($_);
        $label =~ s/_/ /;
        include('/elements/tr-input-date-field.html',{
          'name' => $_,
          'value' => $sub_param{'payment_history'}->{$_} || '',
          'label' => $label,
          'noinit' => $noinit++
        });
      }
      qw( start_date end_date )
    ),
    '</TABLE>',
    '<INPUT TYPE="hidden" NAME="msgnum" VALUE="' . $cgi->param('msgnum') . '">',
    '<INPUT TYPE="hidden" NAME="action" VALUE="preview">',
    '<INPUT TYPE="submit" VALUE="Preview notice">',
  );
};

</%init>