Exposed user and url fields to shop vendors.
This commit is contained in:
parent
ab1c20fa8f
commit
93a6dc0568
5 changed files with 38 additions and 19 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
- fixed: unable to purge trash
|
- fixed: unable to purge trash
|
||||||
- fixed: EMS not displaying all users with a badge
|
- fixed: EMS not displaying all users with a badge
|
||||||
- fixed: ems 2.0: ticket import/export borked
|
- fixed: ems 2.0: ticket import/export borked
|
||||||
|
- Exposed user and url fields to shop vendors.
|
||||||
- fixed: ems 2.0: code cleanup
|
- fixed: ems 2.0: code cleanup
|
||||||
- fixed: WebGUI::Search - joinClass not documented
|
- fixed: WebGUI::Search - joinClass not documented
|
||||||
- fixed: thingy's checkbox field
|
- fixed: thingy's checkbox field
|
||||||
|
|
|
||||||
|
|
@ -35,17 +35,17 @@ updateAddressTable( $session );
|
||||||
addProductShipping( $session );
|
addProductShipping( $session );
|
||||||
addGalleryImageDensity( $session );
|
addGalleryImageDensity( $session );
|
||||||
updatePaymentDrivers( $session );
|
updatePaymentDrivers( $session );
|
||||||
|
extendVendors($session);
|
||||||
finish($session); # this line required
|
finish($session); # this line required
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Describe what our function does
|
sub extendVendors {
|
||||||
#sub exampleFunction {
|
my $session = shift;
|
||||||
# my $session = shift;
|
print "\tExtending vendor properties..." unless $quiet;
|
||||||
# print "\tWe're doing some stuff here that you should know about... " unless $quiet;
|
$session->db->write("alter table vendor add column url text");
|
||||||
# # and here's our code
|
print "DONE!\n" unless $quiet;
|
||||||
# print "DONE!\n" unless $quiet;
|
}
|
||||||
#}
|
|
||||||
|
|
||||||
# Rename Thingy_fields subtext column
|
# Rename Thingy_fields subtext column
|
||||||
sub renameThingyFieldsSubtextColumn {
|
sub renameThingyFieldsSubtextColumn {
|
||||||
|
|
|
||||||
|
|
@ -90,16 +90,24 @@ sub getValue {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $value = $self->SUPER::getValue(@_);
|
my $value = $self->SUPER::getValue(@_);
|
||||||
$value =~ tr/\r\n//d;
|
$value =~ tr/\r\n//d;
|
||||||
if ($value =~ /mailto:/) {
|
# empty
|
||||||
return $value;
|
if ($value eq "" || $value =~ m{^http://$}i) {
|
||||||
}
|
return undef;
|
||||||
elsif ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
|
}
|
||||||
return "mailto:".$value;
|
# proper email url
|
||||||
}
|
elsif ($value =~ /mailto:/) {
|
||||||
elsif ($value =~ /^\// || $value =~ /:\/\// || $value =~ /^\^/) {
|
return $value;
|
||||||
return $value;
|
}
|
||||||
}
|
# improper email url
|
||||||
return "http://".$value;
|
elsif ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
|
||||||
|
return "mailto:".$value;
|
||||||
|
}
|
||||||
|
# proper web url
|
||||||
|
elsif ($value =~ /^\// || $value =~ /:\/\// || $value =~ /^\^/) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
# improper web url
|
||||||
|
return "http://".$value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ The name of the vendor.
|
||||||
sub update {
|
sub update {
|
||||||
my ($self, $newProperties) = @_;
|
my ($self, $newProperties) = @_;
|
||||||
my $id = id $self;
|
my $id = id $self;
|
||||||
my @fields = (qw(name));
|
my @fields = (qw(name userId url));
|
||||||
foreach my $field (@fields) {
|
foreach my $field (@fields) {
|
||||||
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
|
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
|
||||||
}
|
}
|
||||||
|
|
@ -253,7 +253,9 @@ sub www_edit {
|
||||||
$f->hidden(name=>'method',value=>'editSave');
|
$f->hidden(name=>'method',value=>'editSave');
|
||||||
$f->hidden(name=>'vendorId',value=>$properties->{vendorId});
|
$f->hidden(name=>'vendorId',value=>$properties->{vendorId});
|
||||||
$f->readOnly(label=>$i18n->get('date created'),value=>$properties->{dateCreated});
|
$f->readOnly(label=>$i18n->get('date created'),value=>$properties->{dateCreated});
|
||||||
$f->text(name=>'name', label=>$i18n->get('name'),defaultValue=>$properties->{name});
|
$f->text(name=>'name', label=>$i18n->get('name'),value=>$properties->{name});
|
||||||
|
$f->user(name=>'userId',label=>$i18n->get('username'),value=>$properties->{userId},defaultValue=>3);
|
||||||
|
$f->url(name=>'url', label=>$i18n->get('company url'),value=>$properties->{url});
|
||||||
$f->submit();
|
$f->submit();
|
||||||
|
|
||||||
# Wrap in admin console
|
# Wrap in admin console
|
||||||
|
|
@ -276,6 +278,8 @@ sub www_editSave {
|
||||||
my $form = $session->form;
|
my $form = $session->form;
|
||||||
my $properties = {
|
my $properties = {
|
||||||
name => $form->get("name","text"),
|
name => $form->get("name","text"),
|
||||||
|
userId => $form->get("userId","user",'3'),
|
||||||
|
url => $form->get("url","url"),
|
||||||
};
|
};
|
||||||
my $self = eval{$class->new($session, $form->get("vendorId"))};
|
my $self = eval{$class->new($session, $form->get("vendorId"))};
|
||||||
if (!WebGUI::Error->caught && defined $self) {
|
if (!WebGUI::Error->caught && defined $self) {
|
||||||
|
|
|
||||||
|
|
@ -831,6 +831,12 @@ our $I18N = {
|
||||||
context => q|a button a user clicks on to remove an item from the cart|
|
context => q|a button a user clicks on to remove an item from the cart|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'company url' => {
|
||||||
|
message => q|Company URL|,
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q|a field in the vendor screen|
|
||||||
|
},
|
||||||
|
|
||||||
'checkout button' => {
|
'checkout button' => {
|
||||||
message => q|Checkout|,
|
message => q|Checkout|,
|
||||||
lastUpdated => 0,
|
lastUpdated => 0,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue