Lines 159-168
sub add_form {
Link Here
|
159 |
# So we can only sent the first one to the template. |
159 |
# So we can only sent the first one to the template. |
160 |
for my $mtt ( @$message_transport_types ) { |
160 |
for my $mtt ( @$message_transport_types ) { |
161 |
# The letter_name |
161 |
# The letter_name |
162 |
if ( $first_flag and $letters->{$mtt}{name} ) { |
162 |
if ( $first_flag) { |
163 |
$template->param( |
163 |
if ($letters->{$mtt}{name}) { |
164 |
letter_name=> $letters->{$mtt}{name}, |
164 |
$template->param( |
165 |
); |
165 |
letter_name=> $letters->{$mtt}{name}, |
|
|
166 |
); |
167 |
} |
168 |
if ($letters->{$mtt}{fee}) { |
169 |
$template->param( |
170 |
fee => $letters->{$mtt}{fee}, |
171 |
); |
172 |
} |
166 |
$first_flag = 0; |
173 |
$first_flag = 0; |
167 |
} |
174 |
} |
168 |
|
175 |
|
Lines 246-254
sub add_validate {
Link Here
|
246 |
my $oldmodule = $input->param('oldmodule'); |
253 |
my $oldmodule = $input->param('oldmodule'); |
247 |
my $code = $input->param('code'); |
254 |
my $code = $input->param('code'); |
248 |
my $name = $input->param('name'); |
255 |
my $name = $input->param('name'); |
|
|
256 |
my $fee = $input->param('fee'); |
249 |
my @mtt = $input->param('message_transport_type'); |
257 |
my @mtt = $input->param('message_transport_type'); |
250 |
my @title = $input->param('title'); |
258 |
my @title = $input->param('title'); |
251 |
my @content = $input->param('content'); |
259 |
my @content = $input->param('content'); |
|
|
260 |
|
261 |
my $insertfee = $fee; |
262 |
if (defined($fee) and $fee eq ''){ |
263 |
$insertfee = undef; |
264 |
} |
265 |
|
252 |
for my $mtt ( @mtt ) { |
266 |
for my $mtt ( @mtt ) { |
253 |
my $is_html = $input->param("is_html_$mtt"); |
267 |
my $is_html = $input->param("is_html_$mtt"); |
254 |
my $title = shift @title; |
268 |
my $title = shift @title; |
Lines 266-287
sub add_validate {
Link Here
|
266 |
next; |
280 |
next; |
267 |
} |
281 |
} |
268 |
elsif ( $letter and $letter->{message_transport_type} eq $mtt ) { |
282 |
elsif ( $letter and $letter->{message_transport_type} eq $mtt ) { |
269 |
$dbh->do( |
283 |
if (defined($fee)){ |
270 |
q{ |
284 |
$dbh->do(q{UPDATE letter SET branchcode = ?, module = ?, name = ?, is_html = ?, title = ?, content = ?, fee = ? |
271 |
UPDATE letter |
285 |
WHERE branchcode = ? AND module = ? AND code = ? AND message_transport_type = ?}, undef, |
272 |
SET branchcode = ?, module = ?, name = ?, is_html = ?, title = ?, content = ? |
286 |
$branchcode, $module, $name, $is_html || 0, $title, $content, $insertfee, $branchcode, $oldmodule, $code, $mtt); |
273 |
WHERE branchcode = ? AND module = ? AND code = ? AND message_transport_type = ? |
287 |
} else { |
274 |
}, |
288 |
$dbh->do(q{UPDATE letter SET branchcode = ?, module = ?, name = ?, is_html = ?, title = ?, content = ? |
275 |
undef, |
289 |
WHERE branchcode = ? AND module = ? AND code = ? AND message_transport_type = ?}, undef, |
276 |
$branchcode, $module, $name, $is_html || 0, $title, $content, |
290 |
$branchcode, $module, $name, $is_html || 0, $title, $content, $branchcode, $oldmodule, $code, $mtt); |
277 |
$branchcode, $oldmodule, $code, $mtt |
291 |
} |
278 |
); |
|
|
279 |
} else { |
292 |
} else { |
280 |
$dbh->do( |
293 |
if (defined($fee) and $fee != ''){ |
281 |
q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES (?,?,?,?,?,?,?,?)}, |
294 |
$dbh->do(q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content,message_transport_type, fee) VALUES (?,?,?,?,?,?,?,?,?)},undef, |
282 |
undef, |
295 |
$branchcode, $module, $code, $name, $is_html || 0, $title, $content, $mtt, $fee); |
283 |
$branchcode, $module, $code, $name, $is_html || 0, $title, $content, $mtt |
296 |
} else { |
284 |
); |
297 |
$dbh->do(q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES (?,?,?,?,?,?,?,?)},undef, |
|
|
298 |
$branchcode, $module, $code, $name, $is_html || 0, $title, $content, $mtt); |
299 |
} |
285 |
} |
300 |
} |
286 |
} |
301 |
} |
287 |
# set up default display |
302 |
# set up default display |
288 |
- |
|
|