From 79635c0c2d6dd16a77d97d045566ea22ef2b5f56 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 21 Oct 2008 18:33:07 +0000 Subject: [PATCH] EMS Saved Address (#8864) --- docs/changelog/7.x.x.txt | 4 ++++ ...-cart-collateral-items_address-default.wgpkg | Bin 0 -> 1380 bytes docs/upgrades/upgrade_7.6.1-7.6.2.pl | 16 +++++++++------- lib/WebGUI/Asset/Sku/EMSBadge.pm | 4 ++-- lib/WebGUI/Shop/Address.pm | 16 ++++++++++++++-- lib/WebGUI/Shop/AddressBook.pm | 6 ++++++ lib/WebGUI/i18n/English/Shop.pm | 12 ++++++++++++ 7 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 docs/upgrades/packages-7.6.2/shopping-cart-collateral-items_address-default.wgpkg diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 723c0285b..bea643219 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -6,6 +6,7 @@ - Moved Asset ID and Class Name fields to the Meta tab of all assets. - Made Classname from control a subclass of ReadOnly. - Added query keys to WebGUI::Crud. + - EMS Saved Address (#8864) - WebGUI::Crud can now automatically resolve differences between its definition and the table schema. - Fixed a limit bug in the asset discovery service. @@ -15,6 +16,9 @@ - rfe #740: Thingy Pre-Text (SDH Consulting Group) - rfe #746: use the menu title in asset manager - rfe #549: New macro for checking spectre status. VersionTag::RequestCommit and Operation::VestionTag::www_commitVertionTag now both check for spectre status before trying to commit. + + + 7.6.1 - changed: the list of extensions for the export system to pass through unmodified has been moved to the configuration file under the diff --git a/docs/upgrades/packages-7.6.2/shopping-cart-collateral-items_address-default.wgpkg b/docs/upgrades/packages-7.6.2/shopping-cart-collateral-items_address-default.wgpkg new file mode 100644 index 0000000000000000000000000000000000000000..a1cf0e561cdaf85fc2ffcb265fee4d6b8c728cfa GIT binary patch literal 1380 zcmV-q1)KUGiwFP!000001MOICZ`(Ey_UHZz!Tr(#bu2l4sa3B)`jRGH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/upgrade_7.6.1-7.6.2.pl index 047d45bd2..386b67384 100644 --- a/docs/upgrades/upgrade_7.6.1-7.6.2.pl +++ b/docs/upgrades/upgrade_7.6.1-7.6.2.pl @@ -31,17 +31,19 @@ my $session = start(); # this line required # upgrade functions go here repairManageWorkflows($session); addPreTextToThingyFields($session); +updateAddressBook($session); finish($session); # this line required #---------------------------------------------------------------------------- -# Describe what our function does -#sub exampleFunction { -# my $session = shift; -# print "\tWe're doing some stuff here that you should know about... " unless $quiet; -# # and here's our code -# print "DONE!\n" unless $quiet; -#} +sub updateAddressBook { + my $session = shift; + print "\tAdd Organization and Email Address to address book." unless $quiet; + my $db = $session->db; + $db->write("alter table address add column organization char(255)"); + $db->write("alter table address add column email char(255)"); + print "DONE!\n" unless $quiet; +} #---------------------------------------------------------------------------- sub repairManageWorkflows { diff --git a/lib/WebGUI/Asset/Sku/EMSBadge.pm b/lib/WebGUI/Asset/Sku/EMSBadge.pm index cc5321114..0ae432658 100644 --- a/lib/WebGUI/Asset/Sku/EMSBadge.pm +++ b/lib/WebGUI/Asset/Sku/EMSBadge.pm @@ -396,7 +396,7 @@ sub view { }); $vars{organization} = WebGUI::Form::text($session, { name => 'organization', - defaultValue => $form->get("organization"), + defaultValue => (defined $address) ? $address->get("organization") : $form->get('organization'), }); $vars{address1} = WebGUI::Form::text($session, { name => 'address1', @@ -432,7 +432,7 @@ sub view { }); $vars{email} = WebGUI::Form::text($session, { name => 'email', - defaultValue => $form->get('email','email'), + defaultValue => (defined $address) ? $address->get('email') : $form->get('email','email'), }); if($self->getQuantityAvailable() > 0){ $vars{submitAddress} = WebGUI::Form::submit($session, {value => $i18n->get('add to cart'),}); diff --git a/lib/WebGUI/Shop/Address.pm b/lib/WebGUI/Shop/Address.pm index d18ddfdff..3ab0b6818 100644 --- a/lib/WebGUI/Shop/Address.pm +++ b/lib/WebGUI/Shop/Address.pm @@ -111,13 +111,17 @@ Returns an HTML formatted address for display. sub getHtmlFormatted { my $self = shift; - my $address = $self->get("firstName"). " " .$self->get("lastName") . "
" . $self->get("address1") . "
"; + my $address = $self->get("firstName"). " " .$self->get("lastName") . "
"; + $address .= $self->get("organization") . "
" if ($self->get("organization") ne ""); + $address .= $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") . ", "; $address .= $self->get("state") . " " if ($self->get("state") ne ""); $address .= $self->get("code") if ($self->get("code") ne ""); $address .= '
' . $self->get("country"); + $address .= '
'.$self->get("phoneNumber") if ($self->get("phoneNumber") ne ""); + $address .= '
'.$self->get("email").'' if ($self->get("email") ne ""); return $address; } @@ -228,6 +232,14 @@ The country that this address is in. A telephone number for this address. It is required by some shippers. +=head4 email + +An email address for this user. + +=head4 organization + +The organization or company that this user is a part of. + =head4 addressBookId The address book that this address belongs to. @@ -237,7 +249,7 @@ 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 firstName lastName country phoneNumber)) { + foreach my $field (qw(email organization 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 ec05a8bc0..1c36b9182 100644 --- a/lib/WebGUI/Shop/AddressBook.pm +++ b/lib/WebGUI/Shop/AddressBook.pm @@ -369,6 +369,10 @@ sub www_editAddress { {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))}), + emailField => WebGUI::Form::email($session, + {name=>"email", defaultValue=>($form->get("email") || ((defined $address) ? $address->get('email') : undef))}), + organizationField => WebGUI::Form::text($session, + {name=>"organization", defaultValue=>($form->get("organization") || ((defined $address) ? $address->get('organization') : undef))}), ); my $template = WebGUI::Asset::Template->new($session, $session->setting->get("shopAddressTemplateId")); $template->prepare; @@ -425,6 +429,8 @@ sub www_editAddressSave { code => $form->get("code","zipcode"), country => $form->get("country","country"), phoneNumber => $form->get("phoneNumber","phone"), + email => $form->get("email","email"), + organization => $form->get("organization"), ); if ($form->get('addressId') eq '') { $self->addAddress(\%addressData); diff --git a/lib/WebGUI/i18n/English/Shop.pm b/lib/WebGUI/i18n/English/Shop.pm index cbb95960c..4f4c25a99 100644 --- a/lib/WebGUI/i18n/English/Shop.pm +++ b/lib/WebGUI/i18n/English/Shop.pm @@ -9,6 +9,18 @@ our $I18N = { context => q|vendor label|, }, + 'organization' => { + message => q|Organization|, + lastUpdated => 0, + context => q|address book label|, + }, + + 'email' => { + message => q|Email|, + lastUpdated => 0, + context => q|address book label|, + }, + 'Payment Information' => { message => q|Payment Information|, lastUpdated => 0,