Revision bea3f989
Von Moritz Bunkus vor fast 15 Jahren hinzugefügt
SL/AP.pm | ||
---|---|---|
54 | 54 |
my $exchangerate = 0; |
55 | 55 |
|
56 | 56 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
57 |
delete $form->{currency} unless $form->{defaultcurrency}; |
|
57 | 58 |
|
58 | 59 |
($null, $form->{department_id}) = split(/--/, $form->{department}); |
59 | 60 |
$form->{department_id} *= 1; |
... | ... | |
587 | 588 |
|
588 | 589 |
$self->setup_form($form); |
589 | 590 |
|
590 |
($form->{defaultcurrency}) = selectrow_query($form, $dbh, qq|SELECT curr FROM defaults|); |
|
591 |
$form->{defaultcurrency} = (split m/:/, $form->{defaultcurrency})[0]; |
|
592 |
$form->{currency} = $form->{defaultcurrency} if ($form->{defaultcurrency} && ($form->{currency} =~ m/^\s*$/)); |
|
593 |
|
|
594 |
$form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate}); |
|
591 |
$form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate}); |
|
592 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
|
593 |
delete $form->{currency} unless $form->{defaultcurrency}; |
|
595 | 594 |
|
596 | 595 |
# Get the AP accno. |
597 | 596 |
$query = |
SL/AR.pm | ||
---|---|---|
54 | 54 |
|
55 | 55 |
my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig); |
56 | 56 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
57 |
delete $form->{currency} unless $form->{default_currency}; |
|
57 | 58 |
|
58 | 59 |
# set exchangerate |
59 | 60 |
$form->{exchangerate} = ($form->{currency} eq $form->{defaultcurrency}) ? 1 : |
... | ... | |
346 | 347 |
|
347 | 348 |
$self->setup_form($form); |
348 | 349 |
|
349 |
($form->{defaultcurrency}) = selectrow_query($form, $dbh, qq|SELECT curr FROM defaults|); |
|
350 |
$form->{defaultcurrency} = (split m/:/, $form->{defaultcurrency})[0]; |
|
351 |
$form->{currency} = $form->{defaultcurrency} if ($form->{defaultcurrency} && ($form->{currency} =~ m/^\s*$/)); |
|
352 |
|
|
353 |
$form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate}); |
|
350 |
$form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate}); |
|
351 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
|
352 |
delete $form->{currency} unless $form->{default_currency}; |
|
354 | 353 |
|
355 | 354 |
# Get the AR accno (which is normally done by Form::create_links()). |
356 | 355 |
$query = |
SL/Form.pm | ||
---|---|---|
1738 | 1738 |
return $exchangerate; |
1739 | 1739 |
} |
1740 | 1740 |
|
1741 |
sub get_default_currency {
|
|
1741 |
sub get_all_currencies {
|
|
1742 | 1742 |
$main::lxdebug->enter_sub(); |
1743 | 1743 |
|
1744 | 1744 |
my ($self, $myconfig) = @_; |
... | ... | |
1746 | 1746 |
|
1747 | 1747 |
my $query = qq|SELECT curr FROM defaults|; |
1748 | 1748 |
|
1749 |
my ($curr) = selectrow_query($self, $dbh, $query);
|
|
1750 |
my ($defaultcurrency) = split m/:/, $curr;
|
|
1749 |
my ($curr) = selectrow_query($self, $dbh, $query); |
|
1750 |
my @currencies = grep { $_ } map { s/\s//g; $_ } split m/:/, $curr;
|
|
1751 | 1751 |
|
1752 | 1752 |
$main::lxdebug->leave_sub(); |
1753 | 1753 |
|
1754 |
return $defaultcurrency;
|
|
1754 |
return @currencies;
|
|
1755 | 1755 |
} |
1756 | 1756 |
|
1757 |
sub get_default_currency { |
|
1758 |
$main::lxdebug->enter_sub(); |
|
1759 |
|
|
1760 |
my ($self, $myconfig) = @_; |
|
1761 |
my @currencies = $self->get_all_currencies($myconfig); |
|
1762 |
|
|
1763 |
$main::lxdebug->leave_sub(); |
|
1764 |
|
|
1765 |
return $currencies[0]; |
|
1766 |
} |
|
1757 | 1767 |
|
1758 | 1768 |
sub set_payment_options { |
1759 | 1769 |
$main::lxdebug->enter_sub(); |
bin/mozilla/ap.pl | ||
---|---|---|
156 | 156 |
$form->{notes} = $form->{intnotes} unless $form->{notes}; |
157 | 157 |
|
158 | 158 |
# currencies |
159 |
my @curr = split(/:/, $form->{currencies}); |
|
160 |
chomp $curr[0]; |
|
161 |
$form->{defaultcurrency} = $curr[0]; |
|
159 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
162 | 160 |
|
163 |
map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
|
|
161 |
map { $form->{selectcurrency} .= "<option>$_\n" } $form->get_all_currencies(\%myconfig);
|
|
164 | 162 |
|
165 | 163 |
# vendors |
166 | 164 |
if (@{ $form->{all_vendor} || [] }) { |
... | ... | |
261 | 259 |
my $exchangerate = qq| |
262 | 260 |
<input type=hidden name=forex value=$form->{forex}> |
263 | 261 |
|; |
264 |
if ($form->{currency} ne $form->{defaultcurrency}) {
|
|
262 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
|
|
265 | 263 |
if ($form->{forex}) { |
266 | 264 |
$exchangerate .= qq| |
267 | 265 |
<tr> |
... | ... | |
639 | 637 |
|; |
640 | 638 |
|
641 | 639 |
my @column_index; |
642 |
if ($form->{currency} eq $form->{defaultcurrency}) {
|
|
640 |
if ($form->{defaultcurrency} && ($form->{currency} eq $form->{defaultcurrency})) {
|
|
643 | 641 |
@column_index = qw(datepaid source memo paid AP_paid paid_project_id); |
644 | 642 |
} else { |
645 | 643 |
@column_index = qw(datepaid source memo paid exchangerate AP_paid paid_project_id); |
... | ... | |
692 | 690 |
} |
693 | 691 |
|
694 | 692 |
$exchangerate = qq| |; |
695 |
if ($form->{currency} ne $form->{defaultcurrency}) {
|
|
693 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
|
|
696 | 694 |
if ($form->{"forex_$i"}) { |
697 | 695 |
$exchangerate = |
698 | 696 |
qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|; |
... | ... | |
985 | 983 |
$form->error($locale->text('Cannot post payment for a closed period!')) |
986 | 984 |
if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig)); |
987 | 985 |
|
988 |
if ($form->{currency} ne $form->{defaultcurrency}) {
|
|
986 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
|
|
989 | 987 |
$form->{"exchangerate_$i"} = $form->{exchangerate} |
990 | 988 |
if ($invdate == $datepaid); |
991 | 989 |
$form->isblank("exchangerate_$i", |
... | ... | |
1034 | 1032 |
$form->error($locale->text('Zero amount posting!')) if $zero_amount_posting; |
1035 | 1033 |
|
1036 | 1034 |
$form->isblank("exchangerate", $locale->text('Exchangerate missing!')) |
1037 |
if ($form->{currency} ne $form->{defaultcurrency});
|
|
1035 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency}));
|
|
1038 | 1036 |
delete($form->{AP}); |
1039 | 1037 |
|
1040 | 1038 |
for my $i (1 .. $form->{paidaccounts}) { |
... | ... | |
1046 | 1044 |
$form->error($locale->text('Cannot post payment for a closed period!')) |
1047 | 1045 |
if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig)); |
1048 | 1046 |
|
1049 |
if ($form->{currency} ne $form->{defaultcurrency}) {
|
|
1047 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
|
|
1050 | 1048 |
$form->{"exchangerate_$i"} = $form->{exchangerate} |
1051 | 1049 |
if ($transdate == $datepaid); |
1052 | 1050 |
$form->isblank("exchangerate_$i", |
bin/mozilla/ar.pl | ||
---|---|---|
147 | 147 |
my $form = $main::form; |
148 | 148 |
my %myconfig = %main::myconfig; |
149 | 149 |
|
150 |
my ($duedate, $taxincluded, @curr);
|
|
150 |
my ($duedate, $taxincluded); |
|
151 | 151 |
|
152 | 152 |
$form->create_links("AR", \%myconfig, "customer"); |
153 | 153 |
$duedate = $form->{duedate}; |
... | ... | |
166 | 166 |
$form->{notes} = $form->{intnotes} unless $form->{notes}; |
167 | 167 |
|
168 | 168 |
# currencies |
169 |
@curr = split(/:/, $form->{currencies}); |
|
170 |
chomp $curr[0]; |
|
171 |
$form->{defaultcurrency} = $curr[0]; |
|
169 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
172 | 170 |
|
173 |
map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
|
|
171 |
map { $form->{selectcurrency} .= "<option>$_\n" } $form->get_all_currencies(\%myconfig);
|
|
174 | 172 |
|
175 | 173 |
# customers |
176 | 174 |
if (@{ $form->{all_customer} || [] }) { |
... | ... | |
290 | 288 |
$exchangerate = qq| |
291 | 289 |
<input type=hidden name=forex value=$form->{forex}> |
292 | 290 |
|; |
293 |
if ($form->{currency} ne $form->{defaultcurrency}) {
|
|
291 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
|
|
294 | 292 |
if ($form->{forex}) { |
295 | 293 |
$exchangerate .= qq| |
296 | 294 |
<th align=right>| . $locale->text('Exchangerate') . qq|</th> |
... | ... | |
684 | 682 |
</tr> |
685 | 683 |
|; |
686 | 684 |
|
687 |
if ($form->{currency} eq $form->{defaultcurrency}) {
|
|
685 |
if ($form->{defaultcurrency} && ($form->{currency} eq $form->{defaultcurrency})) {
|
|
688 | 686 |
@column_index = qw(datepaid source memo paid AR_paid paid_project_id); |
689 | 687 |
} else { |
690 | 688 |
@column_index = qw(datepaid source memo paid exchangerate AR_paid paid_project_id); |
... | ... | |
737 | 735 |
} |
738 | 736 |
|
739 | 737 |
$exchangerate = qq| |; |
740 |
if ($form->{currency} ne $form->{defaultcurrency}) {
|
|
738 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
|
|
741 | 739 |
if ($form->{"forex_$i"}) { |
742 | 740 |
$exchangerate = |
743 | 741 |
qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|; |
... | ... | |
1048 | 1046 |
|
1049 | 1047 |
$form->error($locale->text('Cannot post payment for a closed period!')) if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig)); |
1050 | 1048 |
|
1051 |
if ($form->{currency} ne $form->{defaultcurrency}) {
|
|
1049 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
|
|
1052 | 1050 |
# $form->{"exchangerate_$i"} = $form->{exchangerate} if ($invdate == $datepaid); |
1053 | 1051 |
$form->isblank("exchangerate_$i", $locale->text('Exchangerate for payment missing!')); |
1054 | 1052 |
} |
... | ... | |
1099 | 1097 |
unless grep $_*1, map $form->parse_amount(\%myconfig, $form->{"amount_$_"}), 1..$form->{rowcount}; |
1100 | 1098 |
|
1101 | 1099 |
$form->isblank("exchangerate", $locale->text('Exchangerate missing!')) |
1102 |
if ($form->{currency} ne $form->{defaultcurrency});
|
|
1100 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency}));
|
|
1103 | 1101 |
|
1104 | 1102 |
delete($form->{AR}); |
1105 | 1103 |
|
... | ... | |
1112 | 1110 |
$form->error($locale->text('Cannot post payment for a closed period!')) |
1113 | 1111 |
if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig)); |
1114 | 1112 |
|
1115 |
if ($form->{currency} ne $form->{defaultcurrency}) {
|
|
1113 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
|
|
1116 | 1114 |
$form->{"exchangerate_$i"} = $form->{exchangerate} if ($transdate == $datepaid); |
1117 | 1115 |
$form->isblank("exchangerate_$i", $locale->text('Exchangerate for payment missing!')); |
1118 | 1116 |
} |
Auch abrufbar als: Unified diff
Nicht mit Wechselkursen arbeiten, wenn keine Währungen konfiguriert sind
Fix für Bug 1349