From: G. Richardson Date: Thu, 12 May 2011 09:28:38 +0000 (+0200) Subject: Bugfix 1626: changing charttype from account to heading X-Git-Tag: release-2.6.3~25^2~47^2 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2a10bda67f4badddcf7932021ac4f5397e71f8df;p=kivitendo-erp.git Bugfix 1626: changing charttype from account to heading Empty certain values in chart before saving to database when converting an account from chart to heading, so that for example link is empty. Added a TODO: make sure that accounts that have been booked can't be converted to a heading --- diff --git a/SL/AM.pm b/SL/AM.pm index 445abd2e3..f73456c8c 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -199,6 +199,9 @@ sub get_account { sub save_account { $main::lxdebug->enter_sub(); + # TODO: it should be forbidden to change an account to a heading if there + # have been bookings to this account in the past + my ($self, $myconfig, $form) = @_; # connect to database, turn off AutoCommit @@ -242,7 +245,23 @@ sub save_account { my @values; + if ($form->{id}) { + + # if charttype is heading make sure certain values are empty + # specifically, if charttype is changed from an existing account, empty the + # fields unnecessary for headings, so that e.g. heading doesn't appear in + # drop-down menues due to still having a valid "link" entry + + if ( $form->{charttype} eq 'H' ) { + $form->{link} = ''; + $form->{pos_bwa} = ''; + $form->{pos_bilanz} = ''; + $form->{pos_eur} = ''; + $form->{new_chart_id} = ''; + $form->{valid_from} = ''; + }; + $query = qq|UPDATE chart SET accno = ?, description = ?, @@ -272,6 +291,7 @@ sub save_account { $form->{id}, ); + } do_query($form, $dbh, $query, @values); diff --git a/doc/changelog b/doc/changelog index 67638891c..e60ffd164 100644 --- a/doc/changelog +++ b/doc/changelog @@ -22,8 +22,8 @@ Liste gefixter Bugs aus dem Bugtracker: - Bugfix 1613: Status teilweise - - Bugfix 1642: Lieferantenrabatt wird korrekt gespeichert, aber nicht mehr angezeigt - + - Bugfix 1642: Lieferantenrabatt wird korrekt gespeichert, aber nicht mehr angezeigt + - Bugfix 1626: Beim Festlegen der Standardkonten kann beim Warenbestand eine Überschrift ausgewählt werden. 2011-02-02 - Release 2.6.2