$form->isblank("accno", $locale->text('Account Number missing!'));
$form->isblank("category", $locale->text('Account Type missing!'));
# check for conflicting accounts
if ($form->{AR} || $form->{AP} || $form->{IC}) {
$a = "";
for (qw(AR AP IC)) { $a .= $form->{$_} }
$form->error($locale->text('Cannot set account for more than one of AR, AP or IC')) if length $a > 2;
for (qw(AR_amount AR_tax AR_paid AP_amount AP_tax AP_paid IC_taxpart IC_taxservice IC_sale IC_cogs IC_income IC_expense)) { $form->error("$form->{AR}$form->{AP}$form->{IC} ". $locale->text('account cannot be set to any other type of account')) if $form->{$_} }
}
foreach $item ("AR", "AP") {
$i = 0;
for ("${item}_amount", "${item}_paid", "${item}_tax") { $i++ if $form->{$_} }
$form->error($locale->text('Cannot set multiple options for')." $item") if $i > 1;
}
if (AM->save_account(\%myconfig, \%$form)) {
$form->redirect($locale->text('Account saved!'));
} else {
$form->error($locale->text('Cannot save account!'));
}
}
sub list_account {
CA->all_accounts(\%myconfig, \%$form);
$form->{title} = $locale->text('Chart of Accounts');