# Set up the content of $form in the way that AR::post_transaction() expects.
- $self->setup_form($form);
+ $self->setup_form($form, 1);
$form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate});
$form->{defaultcurrency} = $form->get_default_currency($myconfig);
sub setup_form {
$main::lxdebug->enter_sub();
- my ($self, $form) = @_;
+ my ($self, $form, $for_post_payments) = @_;
my ($exchangerate, $i, $j, $k, $key, $akey, $ref, $index, $taxamount, $totalamount, $totaltax, $totalwithholding, $withholdingrate,
$taxincluded, $tax, $diff);
$form->{$key} = $form->{"select$key"};
- # if there is a value we have an old entry
$j = 0;
$k = 0;
+ # if there is a value we have an old entry
next unless $form->{acc_trans}{$key};
+
+ # do not use old entries for payments. They come from the form
+ # even if they are not changeable (then they are in hiddens)
+ next if $for_post_payments && $key eq "AP_paid";
+
for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
if ($key eq "AP_paid") {
# Set up the content of $form in the way that AR::post_transaction() expects.
- $self->setup_form($form);
+ $self->setup_form($form, 1);
$form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate});
$form->{defaultcurrency} = $form->get_default_currency($myconfig);
sub setup_form {
$main::lxdebug->enter_sub();
- my ($self, $form) = @_;
+ my ($self, $form, $for_post_payments) = @_;
my ($exchangerate, $akey, $j, $k, $index, $taxamount, $totaltax, $taxrate, $diff, $totalwithholding, $withholdingrate,
$totalamount, $taxincluded, $tax);
$exchangerate = $form->{exchangerate} ? $form->{exchangerate} : 1;
foreach my $key (keys %{ $form->{AR_links} }) {
- # if there is a value we have an old entry
$j = 0;
$k = 0;
+ # if there is a value we have an old entry
next unless $form->{acc_trans}{$key};
+ # do not use old entries for payments. They come from the form
+ # even if they are not changeable (then they are in hiddens)
+ next if $for_post_payments && $key eq "AR_paid";
+
for my $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
if ($key eq "AR_paid") {
$j++;
}
my $ChartTypeIsAccount = ($form->{charttype} eq "A") ? "1":"";
+ my $AccountIsPosted = ($form->{orphaned} ) ? "":"1";
$form->header();
my $parameters_ref = {
ChartTypeIsAccount => $ChartTypeIsAccount,
+ AccountIsPosted => $AccountIsPosted,
select_category => $select_category,
select_charttype => $select_charttype,
select_bwa => $select_bwa,
$main::auth->assert('general_ledger');
+ my ($inline) = @_;
+
# check if there is a vendor, invoice and due date
$form->isblank("transdate", $locale->text("Invoice Date missing!"));
$form->isblank("duedate", $locale->text("Due Date missing!"));
# /saving the history
remove_draft() if $form->{remove_draft};
# Dieser Text wird niemals ausgegeben: Probleme beim redirect?
- $form->redirect($locale->text('Transaction posted!'));
+ $form->redirect($locale->text('Transaction posted!')) unless $inline;
} else {
$form->error($locale->text('Cannot post transaction!'));
}
'Cc' => 'Cc',
'Change Lx-Office installation settings (all menu entries beneath \'System\')' => 'Verändern der Lx-Office-Installationseinstellungen (Menüpunkte unterhalb von \'System\')',
'Change representative to' => 'Vertreter ändern in',
+ 'Changes to Receivables and Payables are only possible if no transactions to this account are posted yet.' => 'Änderungen bei Forderungen oder Verbindlichkeiten sind nur möglich, wenn dieses Konto noch nicht bebucht wurde.',
'Charge Number' => 'Chargennummer',
'Charge number' => 'Chargennummer',
'Charset' => 'Zeichensatz',
'Cc' => '',
'Change Lx-Office installation settings (all menu entries beneath \'System\')' => '',
'Change representative to' => '',
+ 'Changes to Receivables and Payables are only possible if no transactions to this account are posted yet.' => '',
'Charge Number' => '',
'Charge number' => '',
'Chart' => '',
--- /dev/null
+-- @tag: customer_add_constraints
+-- @description: Zusätzliche Fremdschlüssel für Sprache, Kundentyp und Zahlungskonditionen
+-- @depends: release_2_6_3
+-- @charset: utf-8
+-- @ignore: 0
+
+-- verwaiste Zahlungsbedingungen vorher entfernen:
+update customer set payment_id = NULL where payment_id not in (select id from payment_terms);
+
+ALTER TABLE customer ADD FOREIGN KEY (payment_id) REFERENCES payment_terms (id);
+ALTER TABLE customer ADD FOREIGN KEY (language_id) REFERENCES language (id);
+ALTER TABLE customer ADD FOREIGN KEY (business_id) REFERENCES business (id);
--- /dev/null
+-- @tag: vendor_add_constraints
+-- @description: Zusätzliche Fremdschlüssel für Sprache, Lieferantentyp und Zahlungskonditionen
+-- @depends: release_2_6_3
+-- @charset: utf-8
+-- @ignore: 0
+
+-- verwaiste Zahlungsbedingungen vorher entfernen
+update vendor set payment_id = NULL where payment_id not in (select id from payment_terms);
+
+
+ALTER TABLE vendor ADD FOREIGN KEY (payment_id) REFERENCES payment_terms (id);
+ALTER TABLE vendor ADD FOREIGN KEY (language_id) REFERENCES language (id);
+ALTER TABLE vendor ADD FOREIGN KEY (business_id) REFERENCES business (id);
[% 'Inventory' | $T8 %]
</fieldset>
+[% IF AccountIsPosted %]
+[%- SET DIS = ' disabled="disabled"' %]
+[% END %]
<fieldset class="DEPENDS ON charttype BEING A">
<legend>[% 'Include in drop-down menus' | $T8 %]</legend>
<p style='font-weight:normal'>[% 'These will only be effective if the account is NOT a summary account AND there exists at least one taxkey. Setting the account as a summary account will erase these settings.' | $T8 %]</p>
+ <p style='font-weight:normal'>[% 'Changes to Receivables and Payables are only possible if no transactions to this account are posted yet.' | $T8 %]</p>
<table width="100%">
<tr>
<th align="left">[% 'Receivables' | $T8 %]</th>
<tr>
<td>
<input name="AR_amount" type="checkbox" class="checkbox" value="AR_amount"
- [% HTML.escape(AR_amount) %]>
+ [% HTML.escape(AR_amount)%][% DIS %]>
[% 'Revenue' | $T8 %] <br>
<input name="AR_paid" type="checkbox" class="checkbox" value="AR_paid"
- [% HTML.escape(AR_paid) %]>
+ [% HTML.escape(AR_paid) %][% DIS %]>
[% 'Receipt' | $T8 %] <br>
<input name="AR_tax" type="checkbox" class="checkbox" value="AR_tax"
- [% HTML.escape(AR_tax) %]>
+ [% HTML.escape(AR_tax) %][% DIS %]>
[% 'Tax' | $T8 %]
</td>
<td>
<input name="AP_amount" type="checkbox" class="checkbox" value="AP_amount"
- [% HTML.escape(AP_amount) %]>
+ [% HTML.escape(AP_amount) %][% DIS %]>
[% 'Expense/Asset' | $T8 %] <br>
<input name="AP_paid" type="checkbox" class="checkbox" value="AP_paid"
- [% HTML.escape(AP_paid) %]>
+ [% HTML.escape(AP_paid) %][% DIS %]>
[% 'Payment' | $T8 %] <br>
<input name="AP_tax" type="checkbox" class="checkbox" value="AP_tax"
- [% HTML.escape(AP_tax) %]>
+ [% HTML.escape(AP_tax) %][% DIS %]>
[% 'Tax' | $T8 %]
</td>
<td>