X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgl.pl;h=8f512329a5fc17fb9c9f708b8958af901cec3ed2;hb=333003d332756c5f53a33720aea7b714dfd335c8;hp=26e0a74874d39e9cb52b68a662555f58278d6b47;hpb=ca4e97fdf13349fec57b63389593e5528609e54b;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 26e0a7487..8f512329a 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -994,7 +994,10 @@ sub setup_gl_action_bar { action => [ t8('Storno'), submit => [ '#form', { action => 'storno' } ], confirm => t8('Do you really want to cancel this general ledger transaction?'), - disabled => !$form->{id} ? t8('This general ledger transaction has not been posted yet.') : undef, + disabled => !$form->{id} ? t8('This general ledger transaction has not been posted yet.') + : $form->{storno} ? t8('A canceled general ledger transaction cannot be canceled again.') + : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') + : undef, ], action => [ t8('Delete'), submit => [ '#form', { action => 'delete' } ], @@ -1004,6 +1007,7 @@ sub setup_gl_action_bar { : $change_never ? t8('Changing invoices has been disabled in the configuration.') : $change_on_same_day_only ? t8('Invoices can only be changed on the day they are posted.') : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') + : $form->{storno} ? t8('A canceled general ledger transaction cannot be deleted.') : undef, ], ], # end of combobox "Storno" @@ -1365,17 +1369,19 @@ sub post_transaction { die "guru meditation error: Can only assign amount to one bank account booking" if scalar @{ $payment } > 1; # credit/debit * -1 matches the sign for bt.amount and bt.invoice_amount - die "Can only assign the full bank amount to a single general ledger booking" unless $bt->amount == $payment->[0]->amount * -1; + die "Can only assign the full (partial) bank amount to a single general ledger booking" + unless $bt->not_assigned_amount == $payment->[0]->amount * -1; + $bt->update_attributes(invoice_amount => $bt->invoice_amount + ($payment->[0]->amount * -1)); # create record_link - my @props = ( + my %props = ( from_table => 'bank_transactions', from_id => $::form->{bt_id}, to_table => 'gl', to_id => $::form->{id}, ); - SL::DB::RecordLink->new(@props)->save; + SL::DB::RecordLink->new(%props)->save; # and tighten holy acc_trans_id for this bank_transaction my %props_acc = ( acc_trans_id => $payment->[0]->acc_trans_id,