blob: 4049ade80abe5c565e9337b2007bcd6095d11e09 (
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
52
53
|
<%
my $eventpart = $cgi->param('eventpart');
my $old = qsearchs('part_bill_event',{'eventpart'=>$eventpart}) if $eventpart;
#s/days/seconds/
$cgi->param('seconds', $cgi->param('days') * 86400 );
my $error;
if ( ! $cgi->param('plan_weight_eventcode') ) {
$error = "Must select an action";
} else {
$cgi->param('plan_weight_eventcode') =~ /^([\w\-]+):(\d+):(.*)$/
or die "illegal plan_weight_eventcode:".
$cgi->param('plan_weight_eventcode');
$cgi->param('plan', $1);
$cgi->param('weight', $2);
my $eventcode = $3;
my $plandata = '';
while ( $eventcode =~ /%%%(\w+)%%%/ ) {
my $field = $1;
my $value = $cgi->param($field);
$eventcode =~ s/%%%$field%%%/$value/;
$plandata .= "$field $value\n";
}
$cgi->param('eventcode', $eventcode);
$cgi->param('plandata', $plandata);
my $new = new FS::part_bill_event ( {
map {
$_, scalar($cgi->param($_));
} fields('part_bill_event'),
} );
if ( $eventpart ) {
$error = $new->replace($old);
} else {
$error = $new->insert;
$eventpart = $new->getfield('eventpart');
}
}
if ( $error ) {
$cgi->param('error', $error);
print $cgi->redirect(popurl(2). "part_bill_event.cgi?". $cgi->query_string );
} else {
print $cgi->redirect(popurl(3)."browse/part_bill_event.cgi");
}
%>
|