- if ($shipto) {
- if ($self->{shipto_id}) {
- my $query = qq|UPDATE shipto set
- shiptoname = ?,
- shiptodepartment_1 = ?,
- shiptodepartment_2 = ?,
- shiptostreet = ?,
- shiptozipcode = ?,
- shiptocity = ?,
- shiptocountry = ?,
- shiptocontact = ?,
- shiptocp_gender = ?,
- shiptophone = ?,
- shiptofax = ?,
- shiptoemail = ?
- WHERE shipto_id = ?|;
- do_query($self, $dbh, $query, @values, $self->{shipto_id});
- } else {
- my $query = qq|SELECT * FROM shipto
- WHERE shiptoname = ? AND
- shiptodepartment_1 = ? AND
- shiptodepartment_2 = ? AND
- shiptostreet = ? AND
- shiptozipcode = ? AND
- shiptocity = ? AND
- shiptocountry = ? AND
- shiptocontact = ? AND
- shiptocp_gender = ? AND
- shiptophone = ? AND
- shiptofax = ? AND
- shiptoemail = ? AND
- module = ? AND
- trans_id = ?|;
- my $insert_check = selectfirst_hashref_query($self, $dbh, $query, @values, $module, $id);
- if(!$insert_check){
- $query =
- qq|INSERT INTO shipto (trans_id, shiptoname, shiptodepartment_1, shiptodepartment_2,
- shiptostreet, shiptozipcode, shiptocity, shiptocountry,
- shiptocontact, shiptocp_gender, shiptophone, shiptofax, shiptoemail, module)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
- do_query($self, $dbh, $query, $id, @values, $module);
- }
+ return if !$shipto;
+
+ my $shipto_id = $self->{shipto_id};
+
+ if ($self->{shipto_id}) {
+ my $query = qq|UPDATE shipto set
+ shiptoname = ?,
+ shiptodepartment_1 = ?,
+ shiptodepartment_2 = ?,
+ shiptostreet = ?,
+ shiptozipcode = ?,
+ shiptocity = ?,
+ shiptocountry = ?,
+ shiptogln = ?,
+ shiptocontact = ?,
+ shiptocp_gender = ?,
+ shiptophone = ?,
+ shiptofax = ?,
+ shiptoemail = ?
+ WHERE shipto_id = ?|;
+ do_query($self, $dbh, $query, @values, $self->{shipto_id});
+ } else {
+ my $query = qq|SELECT * FROM shipto
+ WHERE shiptoname = ? AND
+ shiptodepartment_1 = ? AND
+ shiptodepartment_2 = ? AND
+ shiptostreet = ? AND
+ shiptozipcode = ? AND
+ shiptocity = ? AND
+ shiptocountry = ? AND
+ shiptogln = ? AND
+ shiptocontact = ? AND
+ shiptocp_gender = ? AND
+ shiptophone = ? AND
+ shiptofax = ? AND
+ shiptoemail = ? AND
+ module = ? AND
+ trans_id = ?|;
+ my $insert_check = selectfirst_hashref_query($self, $dbh, $query, @values, $module, $id);
+ if(!$insert_check){
+ my $insert_query =
+ qq|INSERT INTO shipto (trans_id, shiptoname, shiptodepartment_1, shiptodepartment_2,
+ shiptostreet, shiptozipcode, shiptocity, shiptocountry, shiptogln,
+ shiptocontact, shiptocp_gender, shiptophone, shiptofax, shiptoemail, module)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+ do_query($self, $dbh, $insert_query, $id, @values, $module);
+
+ $insert_check = selectfirst_hashref_query($self, $dbh, $query, @values, $module, $id);