From: Holger Lindemann Date: Fri, 24 Nov 2006 16:48:02 +0000 (+0000) Subject: Sichern von abweichenden Lieferanschiften: X-Git-Tag: release-2.4.0^2~169 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=11fb5cc4377b790ab7e9ea97d48e054fef7d10c1;p=kivitendo-erp.git Sichern von abweichenden Lieferanschiften: Kunden ohne trans_id, Lieferanten ohne 'CT', mehrfaches speichern der gleichen Anschrift shiptodepartment_1 in die Auswahlbox mit übernommen, breite der Selectbox "shipto" und "konto" fixiert Konflikt mit CRM --- diff --git a/SL/CT.pm b/SL/CT.pm index 7ce751050..66bb3f98a 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -146,7 +146,7 @@ sub get_tuple { # get shipto address - $query = qq|SELECT id, shiptoname + $query = qq|SELECT shipto_id, shiptoname, shiptodepartment_1 FROM shipto WHERE trans_id=$form->{id}|; $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); @@ -662,7 +662,7 @@ sub save_vendor { } # add shipto - $form->add_shipto($dbh, $form->{id}); + $form->add_shipto($dbh, $form->{id}, "CT"); $rc = $dbh->disconnect; @@ -841,7 +841,8 @@ sub get_shipto { my $dbh = $form->dbconnect($myconfig); my $query = qq|SELECT s.* FROM shipto s - WHERE s.id = $form->{shipto_id} order by s.id limit 1|; + WHERE s.shipto_id = $form->{shipto_id}|; + #WHERE s.shipto_id = $form->{shipto_id} order by s.shipto_id limit 1|; my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); @@ -871,7 +872,7 @@ sub get_delivery { $where .= "AND ar.transdate <= '$form->{to}' "; } - my $query = qq|select shiptoname, adr_code, ar.transdate, ar.invnumber, ar.ordnumber, invoice.description, qty, invoice.unit FROM ar LEFT join shipto ON (ar.shipto_id=shipto.id) LEFT join invoice on (ar.id=invoice.trans_id) LEFT join parts ON (parts.id=invoice.parts_id) LEFT join adr ON (parts.adr_id=adr.id) $where ORDER BY ar.transdate DESC LIMIT 15|; + my $query = qq|select shiptoname, adr_code, ar.transdate, ar.invnumber, ar.ordnumber, invoice.description, qty, invoice.unit FROM ar LEFT join shipto ON (ar.shipto_id=shipto.shipto_id) LEFT join invoice on (ar.id=invoice.trans_id) LEFT join parts ON (parts.id=invoice.parts_id) LEFT join adr ON (parts.adr_id=adr.id) $where ORDER BY ar.transdate DESC LIMIT 15|; my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); diff --git a/SL/Form.pm b/SL/Form.pm index 0d32e2d0c..96d0adca0 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1210,7 +1210,7 @@ sub get_shipto { my $query = qq|SELECT s.* FROM shipto s - WHERE s.id = $self->{shipto_id}|; + WHERE s.shipto_id = $self->{shipto_id}|; my $sth = $dbh->prepare($query); $sth->execute || $self->dberror($query); $ref = $sth->fetchrow_hashref(NAME_lc); @@ -1237,7 +1237,6 @@ sub add_shipto { } $self->{"shipto$item"} =~ s/\'/\'\'/g; } - if ($shipto) { if ($self->{shipto_id}) { my $query = qq| UPDATE shipto set @@ -1252,7 +1251,7 @@ sub add_shipto { shiptophone = '$self->{shiptophone}', shiptofax = '$self->{shiptofax}', shiptoemail = '$self->{shiptoemail}' - WHERE id = $self->{shipto_id}|; + WHERE shipto_id = $self->{shipto_id}|; $dbh->do($query) || $self->dberror($query); } else { my $query = diff --git a/SL/IS.pm b/SL/IS.pm index 66564344c..7c9d21853 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1806,7 +1806,7 @@ sub get_customer { $sth->finish; # get shipping addresses - $query = qq|SELECT s.id,s.shiptoname + $query = qq|SELECT s.shipto_id,s.shiptoname,s.shiptodepartment_1 FROM shipto s WHERE s.trans_id = $form->{customer_id}|; $sth = $dbh->prepare($query);