$sth = prepare_execute_query($form, $dbh, $query, $form->{id});
$ref = $sth->fetchrow_hashref("NAME_lc");
- delete $ref->{id};
- map { $form->{$_} = $ref->{$_} } keys %$ref;
+ $form->{$_} = $ref->{$_} for grep { m{^shipto(?!_id$)} } keys %$ref;
$sth->finish();
- if ($form->{shipto_id}) {
+ if ($ref->{shipto_id}) {
my $cvars = CVar->get_custom_variables(
dbh => $dbh,
module => 'ShipTo',
- trans_id => $form->{shipto_id},
+ trans_id => $ref->{shipto_id},
);
$form->{"shiptocvar_$_->{name}"} = $_->{value} for @{ $cvars };
}
# get shipto
$query = qq|SELECT * FROM shipto WHERE (trans_id = ?) AND (module = 'AR')|;
$ref = selectfirst_hashref_query($form, $dbh, $query, $id);
- delete($ref->{id});
- map { $form->{$_} = $ref->{$_} } keys %$ref;
+ $form->{$_} = $ref->{$_} for grep { m{^shipto(?!_id$)} } keys %$ref;
# get printed, emailed
$query = qq|SELECT printed, emailed, spoolfile, formname FROM status WHERE trans_id = ?|;
$sth = prepare_execute_query($form, $dbh, $query, $form->{id});
$ref = $sth->fetchrow_hashref("NAME_lc");
- delete($ref->{id});
- map { $form->{$_} = $ref->{$_} } keys %$ref;
+ $form->{$_} = $ref->{$_} for grep { m{^shipto(?!_id$)} } keys %$ref;
$sth->finish;
- if ($form->{shipto_id}) {
+ if ($ref->{shipto_id}) {
my $cvars = CVar->get_custom_variables(
dbh => $dbh,
module => 'ShipTo',
- trans_id => $form->{shipto_id},
+ trans_id => $ref->{shipto_id},
);
$form->{"shiptocvar_$_->{name}"} = $_->{value} for @{ $cvars };
}