EMS Saved Address (#8864)

This commit is contained in:
JT Smith 2008-10-21 18:33:07 +00:00
parent 5b1eb1c095
commit 79635c0c2d
7 changed files with 47 additions and 11 deletions

View file

@ -6,6 +6,7 @@
- Moved Asset ID and Class Name fields to the Meta tab of all assets. - Moved Asset ID and Class Name fields to the Meta tab of all assets.
- Made Classname from control a subclass of ReadOnly. - Made Classname from control a subclass of ReadOnly.
- Added query keys to WebGUI::Crud. - Added query keys to WebGUI::Crud.
- EMS Saved Address (#8864)
- WebGUI::Crud can now automatically resolve differences between its - WebGUI::Crud can now automatically resolve differences between its
definition and the table schema. definition and the table schema.
- Fixed a limit bug in the asset discovery service. - Fixed a limit bug in the asset discovery service.
@ -15,6 +16,9 @@
- rfe #740: Thingy Pre-Text (SDH Consulting Group) - rfe #740: Thingy Pre-Text (SDH Consulting Group)
- rfe #746: use the menu title in asset manager - 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. - 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 7.6.1
- changed: the list of extensions for the export system to pass through - changed: the list of extensions for the export system to pass through
unmodified has been moved to the configuration file under the unmodified has been moved to the configuration file under the

View file

@ -31,17 +31,19 @@ my $session = start(); # this line required
# upgrade functions go here # upgrade functions go here
repairManageWorkflows($session); repairManageWorkflows($session);
addPreTextToThingyFields($session); addPreTextToThingyFields($session);
updateAddressBook($session);
finish($session); # this line required finish($session); # this line required
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Describe what our function does sub updateAddressBook {
#sub exampleFunction { my $session = shift;
# my $session = shift; print "\tAdd Organization and Email Address to address book." unless $quiet;
# print "\tWe're doing some stuff here that you should know about... " unless $quiet; my $db = $session->db;
# # and here's our code $db->write("alter table address add column organization char(255)");
# print "DONE!\n" unless $quiet; $db->write("alter table address add column email char(255)");
#} print "DONE!\n" unless $quiet;
}
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
sub repairManageWorkflows { sub repairManageWorkflows {

View file

@ -396,7 +396,7 @@ sub view {
}); });
$vars{organization} = WebGUI::Form::text($session, { $vars{organization} = WebGUI::Form::text($session, {
name => 'organization', name => 'organization',
defaultValue => $form->get("organization"), defaultValue => (defined $address) ? $address->get("organization") : $form->get('organization'),
}); });
$vars{address1} = WebGUI::Form::text($session, { $vars{address1} = WebGUI::Form::text($session, {
name => 'address1', name => 'address1',
@ -432,7 +432,7 @@ sub view {
}); });
$vars{email} = WebGUI::Form::text($session, { $vars{email} = WebGUI::Form::text($session, {
name => 'email', name => 'email',
defaultValue => $form->get('email','email'), defaultValue => (defined $address) ? $address->get('email') : $form->get('email','email'),
}); });
if($self->getQuantityAvailable() > 0){ if($self->getQuantityAvailable() > 0){
$vars{submitAddress} = WebGUI::Form::submit($session, {value => $i18n->get('add to cart'),}); $vars{submitAddress} = WebGUI::Form::submit($session, {value => $i18n->get('add to cart'),});

View file

@ -111,13 +111,17 @@ Returns an HTML formatted address for display.
sub getHtmlFormatted { sub getHtmlFormatted {
my $self = shift; my $self = shift;
my $address = $self->get("firstName"). " " .$self->get("lastName") . "<br />" . $self->get("address1") . "<br />"; my $address = $self->get("firstName"). " " .$self->get("lastName") . "<br />";
$address .= $self->get("organization") . "<br />" if ($self->get("organization") ne "");
$address .= $self->get("address1") . "<br />";
$address .= $self->get("address2") . "<br />" if ($self->get("address2") ne ""); $address .= $self->get("address2") . "<br />" if ($self->get("address2") ne "");
$address .= $self->get("address3") . "<br />" if ($self->get("address3") ne ""); $address .= $self->get("address3") . "<br />" if ($self->get("address3") ne "");
$address .= $self->get("city") . ", "; $address .= $self->get("city") . ", ";
$address .= $self->get("state") . " " if ($self->get("state") ne ""); $address .= $self->get("state") . " " if ($self->get("state") ne "");
$address .= $self->get("code") if ($self->get("code") ne ""); $address .= $self->get("code") if ($self->get("code") ne "");
$address .= '<br />' . $self->get("country"); $address .= '<br />' . $self->get("country");
$address .= '<br />'.$self->get("phoneNumber") if ($self->get("phoneNumber") ne "");
$address .= '<br /><a href="mailto:'.$self->get("email").'">'.$self->get("email").'</a>' if ($self->get("email") ne "");
return $address; 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. 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 =head4 addressBookId
The address book that this address belongs to. The address book that this address belongs to.
@ -237,7 +249,7 @@ The address book that this address belongs to.
sub update { sub update {
my ($self, $newProperties) = @_; my ($self, $newProperties) = @_;
my $id = id $self; 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}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
} }
$properties{$id}{addressBookId} = $self->addressBook->getId; $properties{$id}{addressBookId} = $self->addressBook->getId;

View file

@ -369,6 +369,10 @@ sub www_editAddress {
{name=>"code", defaultValue=>($form->get("code") || ((defined $address) ? $address->get('code') : undef))}), {name=>"code", defaultValue=>($form->get("code") || ((defined $address) ? $address->get('code') : undef))}),
phoneNumberField => WebGUI::Form::phone($session, phoneNumberField => WebGUI::Form::phone($session,
{name=>"phoneNumber", defaultValue=>($form->get("phoneNumber") || ((defined $address) ? $address->get('phoneNumber') : undef))}), {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")); my $template = WebGUI::Asset::Template->new($session, $session->setting->get("shopAddressTemplateId"));
$template->prepare; $template->prepare;
@ -425,6 +429,8 @@ sub www_editAddressSave {
code => $form->get("code","zipcode"), code => $form->get("code","zipcode"),
country => $form->get("country","country"), country => $form->get("country","country"),
phoneNumber => $form->get("phoneNumber","phone"), phoneNumber => $form->get("phoneNumber","phone"),
email => $form->get("email","email"),
organization => $form->get("organization"),
); );
if ($form->get('addressId') eq '') { if ($form->get('addressId') eq '') {
$self->addAddress(\%addressData); $self->addAddress(\%addressData);

View file

@ -9,6 +9,18 @@ our $I18N = {
context => q|vendor label|, 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' => { 'Payment Information' => {
message => q|Payment Information|, message => q|Payment Information|,
lastUpdated => 0, lastUpdated => 0,