diff --git a/docs/upgrades/upgrade_7.5.18-7.5.19.pl b/docs/upgrades/upgrade_7.5.18-7.5.19.pl
index f53d92e7a..ad709702e 100644
--- a/docs/upgrades/upgrade_7.5.18-7.5.19.pl
+++ b/docs/upgrades/upgrade_7.5.18-7.5.19.pl
@@ -30,7 +30,7 @@ my $session = start(); # this line required
# upgrade functions go here
addNewInboxIndexes( $session );
-
+updateAddressTable( $session );
finish($session); # this line required
@@ -43,6 +43,16 @@ finish($session); # this line required
# print "DONE!\n" unless $quiet;
#}
+#----------------------------------------------------------------------------
+# Removes the name field and adds a firstName and lastName field
+sub updateAddressTable{
+ my $session = shift;
+ print "\tUpdating TABLE address... " unless $quiet;
+ $session->db->write("ALTER TABLE 'address' DROP COLUMN 'name';");
+ $session->db->write("ALTER TABLE 'address' ADD COLUMN 'firstName' VARCHAR(35) AFTER 'label', ADD COLUMN 'lastName' VARCHAR(35) AFTER 'firstName';");
+ print "\tDone.\n" unless $quiet;
+}
+
#----------------------------------------------------------------------------
# Add new indexes to the inbox to make millions of messages possible
sub addNewInboxIndexes {
diff --git a/lib/WebGUI/Asset/Sku/EMSBadge.pm b/lib/WebGUI/Asset/Sku/EMSBadge.pm
index 3e37e57ad..d485fe508 100644
--- a/lib/WebGUI/Asset/Sku/EMSBadge.pm
+++ b/lib/WebGUI/Asset/Sku/EMSBadge.pm
@@ -325,7 +325,7 @@ sub view {
$info->text(
name => 'name',
label => $i18n->get('name','Shop'),
- defaultValue => (defined $address) ? $address->get("name") : $form->get('name'),
+ defaultValue => (defined $address) ? $address->get("firstName")." ".$address->get('lastName') : $form->get('name'),
);
$info->text(
name => 'organization',
diff --git a/lib/WebGUI/Shop/Address.pm b/lib/WebGUI/Shop/Address.pm
index de47ec9eb..d65adc449 100644
--- a/lib/WebGUI/Shop/Address.pm
+++ b/lib/WebGUI/Shop/Address.pm
@@ -111,7 +111,7 @@ Returns an HTML formatted address for display.
sub getHtmlFormatted {
my $self = shift;
- my $address = $self->get("name") . "
" . $self->get("address1") . "
";
+ my $address = $self->get("firstName"). "
" .$self->get("lastName") . "
" . $self->get("address1") . "
";
$address .= $self->get("address2") . "
" if ($self->get("address2") ne "");
$address .= $self->get("address3") . "
" if ($self->get("address3") ne "");
$address .= $self->get("city") . ", ";
@@ -233,7 +233,8 @@ The address book that this address belongs to.
sub update {
my ($self, $newProperties) = @_;
my $id = id $self;
- foreach my $field (qw(address1 address2 address3 state code city label name country phoneNumber)) {
+ #foreach my $field (qw(address1 address2 address3 state code city label name country phoneNumber)) {
+ foreach my $field (qw(address1 address2 address3 state code city label firstName lastName country phoneNumber)) {
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
}
$properties{$id}{addressBookId} = $self->addressBook->getId;
diff --git a/lib/WebGUI/Shop/AddressBook.pm b/lib/WebGUI/Shop/AddressBook.pm
index 26ecd7470..ec05a8bc0 100644
--- a/lib/WebGUI/Shop/AddressBook.pm
+++ b/lib/WebGUI/Shop/AddressBook.pm
@@ -347,16 +347,28 @@ sub www_editAddress {
.WebGUI::Form::hidden($session, {name=>"addressId", value=>$form->get("addressId")}),
saveButton => WebGUI::Form::submit($session),
formFooter => WebGUI::Form::formFooter($session),
- address1Field => WebGUI::Form::text($session, {name=>"address1", maxlength=>35, defaultValue=>($form->get("address1") || ((defined $address) ? $address->get('address1') : undef))}),
- address2Field => WebGUI::Form::text($session, {name=>"address2", maxlength=>35, defaultValue=>($form->get("address2") || ((defined $address) ? $address->get('address2') : undef))}),
- address3Field => WebGUI::Form::text($session, {name=>"address3", maxlength=>35, defaultValue=>($form->get("address3") || ((defined $address) ? $address->get('address3') : undef))}),
- labelField => WebGUI::Form::text($session, {name=>"label", maxlength=>35, defaultValue=>($form->get("label") || ((defined $address) ? $address->get('label') : undef))}),
- nameField => WebGUI::Form::text($session, {name=>"name", maxlength=>35, defaultValue=>($form->get("name") || ((defined $address) ? $address->get('name') : undef))}),
- cityField => WebGUI::Form::text($session, {name=>"city", maxlength=>35, defaultValue=>($form->get("city") || ((defined $address) ? $address->get('city') : undef))}),
- stateField => WebGUI::Form::text($session, {name=>"state", maxlength=>35, defaultValue=>($form->get("state") || ((defined $address) ? $address->get('state') : undef))}),
- countryField => WebGUI::Form::country($session, {name=>"country", defaultValue=>($form->get("country") || ((defined $address) ? $address->get('country') : undef))}),
- codeField => WebGUI::Form::zipcode($session, {name=>"code", defaultValue=>($form->get("code") || ((defined $address) ? $address->get('code') : undef))}),
- phoneNumberField => WebGUI::Form::phone($session, {name=>"phoneNumber", defaultValue=>($form->get("phoneNumber") || ((defined $address) ? $address->get('phoneNumber') : undef))}),
+ address1Field => WebGUI::Form::text($session,
+ {name=>"address1", maxlength=>35, defaultValue=>($form->get("address1") || ((defined $address) ? $address->get('address1') : undef))}),
+ address2Field => WebGUI::Form::text($session,
+ {name=>"address2", maxlength=>35, defaultValue=>($form->get("address2") || ((defined $address) ? $address->get('address2') : undef))}),
+ address3Field => WebGUI::Form::text($session,
+ {name=>"address3", maxlength=>35, defaultValue=>($form->get("address3") || ((defined $address) ? $address->get('address3') : undef))}),
+ labelField => WebGUI::Form::text($session,
+ {name=>"label", maxlength=>35, defaultValue=>($form->get("label") || ((defined $address) ? $address->get('label') : undef))}),
+ firstNameField => WebGUI::Form::text($session,
+ {name=>"firstName", maxlength=>35, defaultValue=>($form->get("firstName") || ((defined $address) ? $address->get('firstName') : undef))}),
+ lastNameField => WebGUI::Form::text($session,
+ {name=>"lastName", maxlength=>35, defaultValue=>($form->get("lastName") || ((defined $address) ? $address->get('lastName') : undef))}),
+ cityField => WebGUI::Form::text($session,
+ {name=>"city", maxlength=>35, defaultValue=>($form->get("city") || ((defined $address) ? $address->get('city') : undef))}),
+ stateField => WebGUI::Form::text($session,
+ {name=>"state", maxlength=>35, defaultValue=>($form->get("state") || ((defined $address) ? $address->get('state') : undef))}),
+ countryField => WebGUI::Form::country($session,
+ {name=>"country", defaultValue=>($form->get("country") || ((defined $address) ? $address->get('country') : undef))}),
+ codeField => WebGUI::Form::zipcode($session,
+ {name=>"code", defaultValue=>($form->get("code") || ((defined $address) ? $address->get('code') : undef))}),
+ phoneNumberField => WebGUI::Form::phone($session,
+ {name=>"phoneNumber", defaultValue=>($form->get("phoneNumber") || ((defined $address) ? $address->get('phoneNumber') : undef))}),
);
my $template = WebGUI::Asset::Template->new($session, $session->setting->get("shopAddressTemplateId"));
$template->prepare;
@@ -380,8 +392,11 @@ sub www_editAddressSave {
if ($form->get("label") eq "") {
return $self->www_editAddress(sprintf($i18n->get('is a required field'), $i18n->get('label')));
}
- if ($form->get("name") eq "") {
- return $self->www_editAddress(sprintf($i18n->get('is a required field'), $i18n->get('name')));
+ if ($form->get("firstName") eq "") {
+ return $self->www_editAddress(sprintf($i18n->get('is a required field'), $i18n->get('firstName')));
+ }
+ if ($form->get("lastName") eq "") {
+ return $self->www_editAddress(sprintf($i18n->get('is a required field'), $i18n->get('lastName')));
}
if ($form->get("address1") eq "") {
return $self->www_editAddress(sprintf($i18n->get('is a required field'), $i18n->get('address')));
@@ -400,7 +415,8 @@ sub www_editAddressSave {
}
my %addressData = (
label => $form->get("label"),
- name => $form->get("name"),
+ firstName => $form->get("firstName"),
+ lastName => $form->get("lastName"),
address1 => $form->get("address1"),
address2 => $form->get("address2"),
address3 => $form->get("address3"),
diff --git a/lib/WebGUI/Shop/PayDriver/ITransact.pm b/lib/WebGUI/Shop/PayDriver/ITransact.pm
index 4198f5b18..e22e74e6a 100644
--- a/lib/WebGUI/Shop/PayDriver/ITransact.pm
+++ b/lib/WebGUI/Shop/PayDriver/ITransact.pm
@@ -636,12 +636,12 @@ sub www_getCredentials {
$f->text(
-name => 'firstName',
-label => $i18n->get('firstName'),
- -value => $form->process("firstName") || $addressData->{ name } || $u->profileField('firstName'),
+ -value => $form->process("firstName") || $addressData->{ "firstName" } || $u->profileField('firstName'),
);
$f->text(
-name => 'lastName',
-label => $i18n->get('lastName'),
- -value => $form->process("lastName") || $u->profileField('lastName'),
+ -value => $form->process("lastName") || $addressData->{ "lastName" } || $u->profileField('lastName'),
);
$f->text(
-name => 'address',
diff --git a/lib/WebGUI/Shop/Transaction.pm b/lib/WebGUI/Shop/Transaction.pm
index c4cced3bd..92ce17b56 100644
--- a/lib/WebGUI/Shop/Transaction.pm
+++ b/lib/WebGUI/Shop/Transaction.pm
@@ -593,7 +593,7 @@ sub update {
$newProperties->{taxes} = $cart->calculateTaxes;
my $address = $cart->getShippingAddress;
$newProperties->{shippingAddressId} = $address->getId;
- $newProperties->{shippingAddressName} = $address->get('name');
+ $newProperties->{shippingAddressName} = $address->get('firstName') . " " .$address->get('lastName');
$newProperties->{shippingAddress1} = $address->get('address1');
$newProperties->{shippingAddress2} = $address->get('address2');
$newProperties->{shippingAddress3} = $address->get('address3');
@@ -616,7 +616,7 @@ sub update {
if (exists $newProperties->{paymentAddress}) {
my $address = $newProperties->{paymentAddress};
$newProperties->{paymentAddressId} = $address->getId;
- $newProperties->{paymentAddressName} = $address->get('name');
+ $newProperties->{paymentAddressName} = $address->get('firstName') ." ". $address->get('lastName');
$newProperties->{paymentAddress1} = $address->get('address1');
$newProperties->{paymentAddress2} = $address->get('address2');
$newProperties->{paymentAddress3} = $address->get('address3');
diff --git a/lib/WebGUI/i18n/English/Shop.pm b/lib/WebGUI/i18n/English/Shop.pm
index 751a173c1..ef71e3f48 100644
--- a/lib/WebGUI/i18n/English/Shop.pm
+++ b/lib/WebGUI/i18n/English/Shop.pm
@@ -650,6 +650,16 @@ our $I18N = {
lastUpdated => 0,
context => q|a label in the address editor|
},
+ 'firstName' => {
+ message => q|First Name|,
+ lastUpdated => 0,
+ context => q|a label in the address editor|
+ },
+ 'lastName' => {
+ message => q|Last Name|,
+ lastUpdated => 0,
+ context => q|a label in the address editor|
+ },
'address' => {
message => q|Address|,