diff options
-rw-r--r-- | LedgerSMB/OE.pm | 17 | ||||
-rw-r--r-- | LedgerSMB/PriceMatrix.pm | 10 |
2 files changed, 15 insertions, 12 deletions
diff --git a/LedgerSMB/OE.pm b/LedgerSMB/OE.pm index d129ba7c..c6b9e960 100644 --- a/LedgerSMB/OE.pm +++ b/LedgerSMB/OE.pm @@ -762,21 +762,24 @@ sub retrieve { SELECT o.ordnumber, o.transdate, o.reqdate, o.terms, o.taxincluded, o.shippingpoint, o.shipvia, o.notes, o.intnotes, o.curr AS currency, - e.name AS employee, o.employee_id, - o.$form->{vc}_id, vc.name AS $form->{vc}, + pe.first_name \|\| ' ' \|\| pe.last_name AS employee, + o.person_id AS employee_id, + o.entity_id AS $form->{vc}_id, c.legal_name AS $form->{vc}, o.amount AS invtotal, o.closed, o.reqdate, o.quonumber, o.department_id, d.description AS department, o.language_code, o.ponumber FROM oe o - JOIN $form->{vc} vc ON (o.$form->{vc}_id = vc.id) - LEFT JOIN employee e ON (o.employee_id = e.id) + JOIN company c ON (c.entity_id = o.entity_id) + JOIN $form->{vc} vc ON (c.entity_id = vc.entity_id) + LEFT JOIN person pe ON (o.person_id = pe.id) + LEFT JOIN employee e ON (pe.entity_id = e.entity_id) LEFT JOIN department d ON (o.department_id = d.id) WHERE o.id = ?|; $sth = $dbh->prepare($query); $sth->execute( $form->{id} ) || $form->dberror($query); - $ref = $sth->fetchrow_hashref(NAME_lc); + $ref = $sth->fetchrow_hashref('NAME_lc'); $form->db_parse_numeric(sth=>$sth, hashref=>$ref); for ( keys %$ref ) { $form->{$_} = $ref->{$_} } $sth->finish; @@ -785,7 +788,7 @@ sub retrieve { $sth = $dbh->prepare($query); $sth->execute( $form->{id} ) || $form->dberror($query); - $ref = $sth->fetchrow_hashref(NAME_lc); + $ref = $sth->fetchrow_hashref('NAME_lc'); for ( keys %$ref ) { $form->{$_} = $ref->{$_} } $sth->finish; @@ -851,7 +854,7 @@ sub retrieve { my $sellprice; my $listprice; - while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) { + while ( $ref = $sth->fetchrow_hashref('NAME_lc') ) { $form->db_parse_numeric(sth=>$sth, hashref=>$ref); ($decimalplaces) = ( $ref->{sellprice} =~ /\.(\d+)/ ); diff --git a/LedgerSMB/PriceMatrix.pm b/LedgerSMB/PriceMatrix.pm index 87e04fd3..41226ee6 100644 --- a/LedgerSMB/PriceMatrix.pm +++ b/LedgerSMB/PriceMatrix.pm @@ -102,7 +102,7 @@ sub price_matrix_query { SELECT partnumber FROM partsvendor WHERE parts_id = ? - AND vendor_id = $entity_id|; + AND entity_id = $entity_id|; $sth = $dbh->prepare($query) || $form->dberror($query); } @@ -122,9 +122,9 @@ sub price_matrix { if ( $form->{customer_id} ) { $pmh->execute( $ref->{id}, $ref->{id}, $ref->{id}, $ref->{id} ); - while ( $mref = $pmh->fetchrow_hashref(NAME_lc) ) { + while ( $mref = $pmh->fetchrow_hashref('NAME_lc') ) { - $form->db_parse_numeric(sth=>$sth, hashref=>$mref); + $form->db_parse_numeric(sth=>$pmh, hashref=>$mref); # check date if ( $mref->{validfrom} ) { next @@ -195,8 +195,8 @@ sub price_matrix { if ( $form->{vendor_id} ) { $pmh->execute( $ref->{id} ); - $mref = $pmh->fetchrow_hashref(NAME_lc); - $form->db_parse_numeric(sth=>$sth, hashref=>$mref); + $mref = $pmh->fetchrow_hashref('NAME_lc'); + $form->db_parse_numeric(sth=>$pmh, hashref=>$mref); if ( $mref->{partnumber} ne "" ) { $ref->{partnumber} = $mref->{partnumber}; |