X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIS.pm;h=d91a36b8b09d0ea64441f4c0603a0faa6435dfeb;hb=89c9ff022d3f13e27ba6bda085df15707fcfb0eb;hp=666d8bc043c1e632c97d9c5a195ccae831eb666d;hpb=ef92528c3f875dee2b456418adb214ccebb97361;p=kivitendo-erp.git diff --git a/SL/IS.pm b/SL/IS.pm index 666d8bc04..d91a36b8b 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -963,10 +963,7 @@ sub post_invoice { $query = qq|UPDATE ar SET paid = ? WHERE id = ?|; do_query($form, $dbh, $query, $form->{paid}, conv_i($form->{id})); - if (!$provided_dbh) { - $dbh->commit(); - $dbh->disconnect(); - } + $dbh->commit if !$provided_dbh; $main::lxdebug->leave_sub(); return; @@ -1048,7 +1045,7 @@ sub post_invoice { # save printed, emailed and queued $form->save_status($dbh); - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); # Link this record to the records it was created from. RecordLinks->create_links('dbh' => $dbh, @@ -1081,10 +1078,7 @@ sub post_invoice { 'table' => 'ar',); my $rc = 1; - if (!$provided_dbh) { - $dbh->commit(); - $dbh->disconnect(); - } + $dbh->commit if !$provided_dbh; $main::lxdebug->leave_sub(); @@ -1283,7 +1277,7 @@ sub cogs { # sellprice is the cost of the item my $linetotal = $form->round_amount(($ref->{sellprice} * $qty) / ( ($ref->{price_factor} || 1) * ( $basefactor || 1 )), 2); - if (!$main::eur) { + if (!$::lx_office_conf{system}->{eur}) { $ref->{expense_accno} = ($form->{"expense_accno_$row"}) ? $form->{"expense_accno_$row"} : $ref->{expense_accno}; # add to expense $form->{amount_cogs}{ $form->{id} }{ $ref->{expense_accno} } += -$linetotal; @@ -1368,7 +1362,7 @@ sub reverse_invoice { sub delete_invoice { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $form, $spool) = @_; + my ($self, $myconfig, $form) = @_; # connect to database my $dbh = $form->dbconnect_noauto($myconfig); @@ -1379,7 +1373,7 @@ sub delete_invoice { # Falls wir ein Storno haben, müssen zwei Felder in der stornierten Rechnung wieder # zurückgesetzt werden. Vgl: - # id | storno | storno_id | paid | amount + # id | storno | storno_id | paid | amount #----+--------+-----------+---------+----------- # 18 | f | | 0.00000 | 119.00000 # ZU: @@ -1404,6 +1398,7 @@ sub delete_invoice { $dbh->disconnect; if ($rc) { + my $spool = $::lx_office_conf{paths}->{spool}; map { unlink "$spool/$_" if -f "$spool/$_"; } @spoolfiles; } @@ -1589,7 +1584,7 @@ sub retrieve_invoice { } $sth->finish; - Common::webdav_folder($form) if ($main::webdav); + Common::webdav_folder($form); } my $rc = $dbh->commit; @@ -2086,13 +2081,13 @@ sub get_pricegroups_for_parts { # to distinguish case A and B the variable pricegroup_id_$i is used # for new articles this variable isn't defined, for loaded articles it is # sellprice can't be used, as it already has 0,00 set - + if ($pkr->{pricegroup_id} eq $form->{"pricegroup_id_$i"} and defined $form->{"pricegroup_id_$i"}) { # Case A $pkr->{selected} = ' selected'; - } elsif ($pkr->{pricegroup_id} eq $form->{customer_klass} - and not defined $form->{"pricegroup_id_$i"} + } elsif ($pkr->{pricegroup_id} eq $form->{customer_klass} + and not defined $form->{"pricegroup_id_$i"} and $pkr->{price} != 0 # only use customer pricegroup price if it has a value, else use default_sellprice # for the case where pricegroup prices haven't been set ) { @@ -2125,7 +2120,9 @@ sub get_pricegroups_for_parts { if ($pkr->{pricegroup_id} eq $selectedpricegroup_id) { $pkr->{selected} = ' selected'; } - } elsif (($price_new != $form->{"sellprice_$i"}) and ($price_new ne 0) and defined $price_new) { + } elsif ( ($form->parse_amount($myconfig, $price_new) + != $form->parse_amount($myconfig, $form->{"sellprice_$i"})) + and ($price_new ne 0) and defined $price_new) { # sellprice has changed # when loading existing invoices $price_new is NULL if ($pkr->{pricegroup_id} == 0) {