X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FOE.pm;h=61360996b658c813bdf6b11154ccbdca52ab25b8;hb=d8e0c6d81c47bc3a58af6607019ffebc74becc16;hp=7a35fa717aedd5b186809b2c4badac97b12372e9;hpb=300f3739cfe93d10a867a778a1430068c00c32a8;p=kivitendo-erp.git diff --git a/SL/OE.pm b/SL/OE.pm index 7a35fa717..61360996b 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -52,7 +52,7 @@ sub transactions { my ($self, $myconfig, $form) = @_; # connect to database - my $dbh = $form->dbconnect($myconfig); + my $dbh = $form->get_standard_dbh; my $query; my $ordnumber = 'ordnumber'; @@ -226,7 +226,6 @@ SQL } $sth->finish; - $dbh->disconnect; $main::lxdebug->leave_sub(); } @@ -658,7 +657,8 @@ sub delete { my ($self, $myconfig, $form) = @_; # connect to database - my $dbh = $form->dbconnect_noauto($myconfig); + my $dbh = $form->get_standard_dbh; + $dbh->begin_work; # delete spool files my $query = qq|SELECT s.spoolfile FROM status s | . @@ -702,7 +702,6 @@ sub delete { do_query($form, $dbh, $query, @values); my $rc = $dbh->commit; - $dbh->disconnect; if ($rc) { my $spool = $::lx_office_conf{paths}->{spool}; @@ -803,14 +802,16 @@ sub retrieve { $sth = prepare_execute_query($form, $dbh, $query, @values); $ref = $sth->fetchrow_hashref("NAME_lc"); - map { $form->{$_} = $ref->{$_} } keys %$ref; - $form->{saved_xyznumber} = $form->{$form->{type} =~ /_quotation$/ ? - "quonumber" : "ordnumber"}; + if ($ref) { + map { $form->{$_} = $ref->{$_} } keys %$ref; + + $form->{saved_xyznumber} = $form->{$form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber"}; - # set all entries for multiple ids blank that yield different information - while ($ref = $sth->fetchrow_hashref("NAME_lc")) { - map { $form->{$_} = '' if ($ref->{$_} ne $form->{$_}) } keys %$ref; + # set all entries for multiple ids blank that yield different information + while ($ref = $sth->fetchrow_hashref("NAME_lc")) { + map { $form->{$_} = '' if ($ref->{$_} ne $form->{$_}) } keys %$ref; + } } # if not given, fill transdate with current_date @@ -868,7 +869,7 @@ sub retrieve { c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from as income_valid, c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from as expense_valid, oe.ordnumber AS ordnumber_oe, oe.transdate AS transdate_oe, oe.cusordnumber AS cusordnumber_oe, - p.partnumber, p.assembly, o.description, o.qty, + p.partnumber, p.assembly, p.listprice, o.description, o.qty, o.sellprice, o.parts_id AS id, o.unit, o.discount, p.bin, p.notes AS partnotes, p.inventory_accno_id AS part_inventory_accno_id, o.reqdate, o.project_id, o.serialnumber, o.ship, o.lastcost, o.ordnumber, o.transdate, o.cusordnumber, o.subtotal, o.longdescription, @@ -1034,7 +1035,7 @@ sub order_details { my ($self, $myconfig, $form) = @_; # connect to database - my $dbh = $form->dbconnect($myconfig); + my $dbh = $form->get_standard_dbh; my $query; my @values = (); my $sth;