-
- | . $locale->text('Payments') . qq| |
-
+
+ | . $locale->text('Payments') . qq| |
+
|;
my @column_index;
- if ($form->{currency} eq $form->{defaultcurrency}) {
+ if ($form->{defaultcurrency} && ($form->{currency} eq $form->{defaultcurrency})) {
@column_index = qw(datepaid source memo paid AP_paid paid_project_id);
} else {
@column_index = qw(datepaid source memo paid exchangerate AP_paid paid_project_id);
@@ -697,7 +690,7 @@ $jsscript
}
$exchangerate = qq| |;
- if ($form->{currency} ne $form->{defaultcurrency}) {
+ if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
if ($form->{"forex_$i"}) {
$exchangerate =
qq|{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
@@ -990,7 +983,7 @@ sub post_payment {
$form->error($locale->text('Cannot post payment for a closed period!'))
if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig));
- if ($form->{currency} ne $form->{defaultcurrency}) {
+ if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
$form->{"exchangerate_$i"} = $form->{exchangerate}
if ($invdate == $datepaid);
$form->isblank("exchangerate_$i",
@@ -1039,7 +1032,7 @@ sub post {
$form->error($locale->text('Zero amount posting!')) if $zero_amount_posting;
$form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
- if ($form->{currency} ne $form->{defaultcurrency});
+ if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency}));
delete($form->{AP});
for my $i (1 .. $form->{paidaccounts}) {
@@ -1051,7 +1044,7 @@ sub post {
$form->error($locale->text('Cannot post payment for a closed period!'))
if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig));
- if ($form->{currency} ne $form->{defaultcurrency}) {
+ if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
$form->{"exchangerate_$i"} = $form->{exchangerate}
if ($transdate == $datepaid);
$form->isblank("exchangerate_$i",
@@ -1070,7 +1063,7 @@ sub post {
my ($debitaccno, $debittaxkey) = split /--/, $form->{AP_amountselected};
my ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
my ($payablesaccno, $payablestaxkey) = split /--/, $form->{APselected};
- $form->{AP_amount_1} = $debitaccno;
+# $form->{AP_amount_1} = $debitaccno;
$form->{AP_payables} = $payablesaccno;
$form->{taxkey} = $taxkey;
$form->{storno} = 0;
@@ -1086,9 +1079,11 @@ sub post {
}
# /saving the history
remove_draft() if $form->{remove_draft};
+ # Dieser Text wird niemals ausgegeben: Probleme beim redirect?
$form->redirect($locale->text('Transaction posted!'));
+ } else {
+ $form->error($locale->text('Cannot post transaction!'));
}
- $form->error($locale->text('Cannot post transaction!'));
$main::lxdebug->leave_sub();
}
@@ -1105,8 +1100,8 @@ sub post_as_new {
# saving the history
if(!exists $form->{addition} && $form->{id} ne "") {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};
- $form->{addition} = "POSTED AS NEW";
- $form->save_history($form->dbconnect(\%myconfig));
+ $form->{addition} = "POSTED AS NEW";
+ $form->save_history($form->dbconnect(\%myconfig));
}
# /saving the history
&post;
@@ -1188,7 +1183,7 @@ sub yes {
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};
- $form->{addition} = "DELETED";
+ $form->{addition} = "DELETED";
$form->save_history($form->dbconnect(\%myconfig));
}
# /saving the history
@@ -1202,234 +1197,29 @@ sub yes {
sub search {
$main::lxdebug->enter_sub();
+ $main::auth->assert('general_ledger | invoice_edit');
+
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
- my $cgi = $main::cgi;
- $main::auth->assert('general_ledger | vendor_invoice_edit');
-
- # setup vendor selection
+ # setup customer selection
$form->all_vc(\%myconfig, "vendor", "AP");
- my $vendor;
- if (@{ $form->{all_vendor} || [] }) {
- map { $vendor .= "\n";
-
- map {
- $form->{selectdepartment} .=
- "$_->{description}--$_->{id}\n"
- } (@{ $form->{all_departments} || [] });
- }
-
- my $department = qq|
-
- | . $locale->text('Department') . qq| |
- |
-
-| if $form->{selectdepartment};
-
- $form->{title} = $locale->text('AP Transactions');
-
- # use JavaScript Calendar or not
+ $form->{title} = $locale->text('AP Transactions');
+ $form->{fokus} = "search.vendor";
$form->{jsscript} = 1;
- my $jsscript = "";
- my ($button1, $button2);
- if ($form->{jsscript}) {
- # with JavaScript Calendar
- $button1 = qq|
-
- text('button') . qq|> |
- |;
- $button2 = qq|
-
- text('button') . qq|> |
- |;
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
+ "departments" => "ALL_DEPARTMENTS",
+ "vendors" => "ALL_VC");
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1",
- "transdateto", "BL", "trigger2");
- } else {
+ # constants and subs for template
+ $form->{jsscript} = 1;
+ $form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
- # without JavaScript Calendar
- $button1 = qq|
- | |;
- $button2 = qq|
- | |;
- }
-
- $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
- "all" => 1 });
-
- my %labels = ();
- my @values = ("");
- foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
- push(@values, $item->{"id"});
- $labels{$item->{"id"}} = $item->{"projectnumber"};
- }
- my $projectnumber =
- NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
- '-labels' => \%labels));
- $form->{javascript} .= qq||;
$form->header;
- my $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
- $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
- print qq|
-
-
-
-
-
- |