Skip to content

Commit

Permalink
Merge pull request #7543 from ehuelsmann/fix/master/saved-shipto
Browse files Browse the repository at this point in the history
Save 'Ship To' data
  • Loading branch information
ehuelsmann committed Jul 26, 2023
2 parents ee898d2 + cb007f1 commit 8e745fa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
22 changes: 13 additions & 9 deletions old/bin/io.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1354,17 +1354,20 @@ sub print_form {
}
}

# $logger->trace("\$form->{formname}=$form->{formname} \$form->{fax}=$form->{fax} \$shipto=$shipto \$form->{shiptofax}=$form->{shiptofax}");
$form->{shipto} = $shipto;
if (! $shipto) {
if ( $form->{formname} eq 'purchase_order'
|| $form->{formname} eq 'request_quotation' )
{
|| $form->{formname} eq 'request_quotation' ) {
$form->{shiptoname} = $form->{company};
$form->{shiptoaddress1} = $form->{address};
}
else {
if ( $form->{formname} !~ /bin_list/ ) {
for (@vars) {if($_ ne 'fax'){$form->{"shipto$_"}=$form->{$_}}} #fax contains myCompanyFax
for (@vars) {
if($_ ne 'fax') { #fax contains myCompanyFax
$form->{"shipto$_"} = $form->{$_}
}
}
}
}
}
Expand Down Expand Up @@ -1443,6 +1446,9 @@ sub print_form {
totalqty totalship totalweight totalparts totalservices totalweightship
paid subtotal total
shipto shiptoname shiptoaddress1 shiptoaddress2 shiptocity shiptostate
shiptozipcode shiptocountry shiptocontact shiptophone shiptoemail
))};
my $body = $template->{output};
utf8::encode($body) if utf8::is_utf8($body); ## no critic
Expand Down Expand Up @@ -1678,7 +1684,7 @@ sub ship_to {
print qq|
<tr>
<td><input type=radio data-dojo-type="dijit/form/RadioButton" name=shiptoradio id="shiptoradio_$i" value="$i" $checked >
<td><input type=radio data-dojo-type="dijit/form/RadioButton" name="shiptoradio" id="shiptoradio_$i" value="$i" $checked >
<input name="shiptolocationid_$i" id="shiptolocationid_$i" type="hidden" value="$form->{"shiptolocationid_$i"}" readonly></td>
<td>$form->{"shiptoaddress1_$i"}</td>
<td>$form->{"shiptoaddress2_$i"}</td>
Expand Down Expand Up @@ -1981,11 +1987,9 @@ sub setlocation_id

my $loc_id_index=$form->{"shiptoradio"};

my $index="locationid_".$loc_id_index;

$form->{"locationid"}=$form->{$index};

my $index="shiptolocationid_".$loc_id_index;

$form->{"shiptolocationid"}=$form->{$index};
}

1;
2 changes: 1 addition & 1 deletion old/bin/ir.pl
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ sub form_header {
qw(id title vc type terms creditlimit creditremaining
shipped oldtransdate recurring reverse batch_id subtype form_id
separate_duties nextsub default_reportable address city zipcode
state country is_return cash_accno)
state country is_return cash_accno shiptolocationid)
);

print qq|
Expand Down
2 changes: 1 addition & 1 deletion old/bin/is.pl
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ sub form_header {
shipped oldtransdate recurring reverse batch_id subtype tax_id
meta_number separate_duties lock_description nextsub
default_reportable address city zipcode state country
is_return cash_accno)
is_return cash_accno shiptolocationid)
);

if ($form->{notice}){
Expand Down
4 changes: 2 additions & 2 deletions old/lib/LedgerSMB/Form.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ If $is_oe is true, the value of trans_id is NULL and of oe_id is $id.
sub add_shipto {

my ($self, $id, $is_oe) = @_;
if (! $self->{locationid}) {
if (! $self->{shiptolocationid}) {
return;
}

Expand All @@ -1322,7 +1322,7 @@ sub add_shipto {
$sth->execute(
$trans_id,
$oe_id,
$self->{locationid}
$self->{shiptolocationid}
) || $self->dberror($query);

$sth->finish;
Expand Down
2 changes: 1 addition & 1 deletion old/lib/LedgerSMB/IS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ sub list_locations_contacts
WITH eca AS (select * from entity_credit_account
where id = ?
)
select id as locationid,line_one as shiptoaddress1,line_two as shiptoaddress2,line_three as shiptoaddress3,city as shiptocity,
select id as shiptolocationid,line_one as shiptoaddress1,line_two as shiptoaddress2,line_three as shiptoaddress3,city as shiptocity,
state as shiptostate,mail_code as shiptozipcode,country as shiptocountry
from (
select (eca__list_locations(id)).*
Expand Down

0 comments on commit 8e745fa

Please sign in to comment.