It will now create a new account if the email and names are different.
Names are required fields and now are marked as being required.
// render the view
render: function(){
+ // Call the custom fields ajax
+ app.setCustomFieldsForm(this.model.get('reg_event'), this.model.id, '.attendee-cf-' + this.model.id);
+
this.$el.html( this.template( this.model.toJSON() ) );
this.$emailInput = this.$('.editEmail');
this.$('.reg-edit-form').hide();
- app.setCustomFieldsForm(this.model.get('reg_event'), this.model.id, '.attendee-cf-' + this.model.id);
return this;
},
option: 'delete'
}, processData: true});
+ // Need to release the lock if they want to delete the attendee
+ app.regEventLock = false;
+
this.remove();
},
this.listenTo( this.model.registrants, 'add', this.addOne );
// this.listenTo( this.model.registrants, 'create', this.render );
this.listenTo( this.model.registrants, 'remove', this.deleteOne );
-
this.listenTo( this.model, 'change', this.render );
- // this.listenTo( this.model.registrants, 'change', this.render );
+ this.listenTo( this.model.registrants, 'change', this.render );
+
return this;
},
return;
}
} else {
- findByEmail = this.model.registrants.where({email: email});
+ findByEmail = this.model.registrants.where({email: email, fname: fname, lname: lname});
}
var regRequest = cart.get( 'request' );
var parent = this.model.get('parent');
var customFieldData = this.$( 'form.attendee-cf-form-new' ).serialize();
// return false;
- if ( findByEmail.length === 0 ) {
- var newRegistrant = this.model.registrants.create({
- option: 'add',
- reg_request: regRequest.id,
- reg_time: this.model.get( 'id' ),
- reg_event: this.model.get( 'reg_event' ), // Todo: use correct reg_event
- reg_class: this.model.get( 'parent' ).id, // Todo: use correct reg_class
- reg_rate: rateId,
- email: email,
- fname: fname,
- lname: lname,
- addr1: addr1,
- addr2: addr2,
- city: city,
- state: state,
- zip: zip,
- country: country,
- customFields: customFieldData,
- });
- }
+ var newRegistrant = this.model.registrants.create({
+ option: 'add',
+ reg_request: regRequest.id,
+ reg_time: this.model.get( 'id' ),
+ reg_event: this.model.get( 'reg_event' ), // Todo: use correct reg_event
+ reg_class: this.model.get( 'parent' ).id, // Todo: use correct reg_class
+ reg_rate: rateId,
+ email: email,
+ fname: fname,
+ lname: lname,
+ addr1: addr1,
+ addr2: addr2,
+ city: city,
+ state: state,
+ zip: zip,
+ country: country,
+ customFields: customFieldData,
+ });
+ this.$('.glm-add-new-account').show();
this.newRegAccount.destroy();
this.newRegAccountView.remove();
app.regEventLock = false;
// add a registrant to collection
addOne: function( item ){
- // console.log( 'regTime: addOne called' );
+ console.log( 'regTime: addOne called' );
// console.log( item.get('id') );
this.model.set({selectedTime: item.get('reg_time') })
// this.render();
// delete a registrant in collection
deleteOne: function( item ){
- // console.log( 'regTime: deleteOne called' );
+ console.log( 'regTime: deleteOne called' );
// this.render();
},
});
// bind events to the view
events: {
- 'focusout .add_reg_email': 'verifyEmail'
+ 'blur input.add_reg_email': 'verifyEmail'
},
// setup the view
this.$('.add_reg_lname').val(account.lname);
// lock the form
- this.lockForm();
+ // this.lockForm();
} else {
// They should be able to edit the form
this.unLockForm();
// render the view
render: function(){
+ // Call the custom fields ajax
+ app.setCustomFieldsForm(this.model.get('reg_event'), this.model.id, '.attendee-cf-' + this.model.id);
+
this.$el.html( this.template( this.model.toJSON() ) );
this.$emailInput = this.$('.editEmail');
this.$('.reg-edit-form').hide();
- app.setCustomFieldsForm(this.model.get('reg_event'), this.model.id, '.attendee-cf-' + this.model.id);
return this;
},
option: 'delete'
}, processData: true});
+ // Need to release the lock if they want to delete the attendee
+ app.regEventLock = false;
+
this.remove();
},
this.listenTo( this.model.registrants, 'add', this.addOne );
// this.listenTo( this.model.registrants, 'create', this.render );
this.listenTo( this.model.registrants, 'remove', this.deleteOne );
-
this.listenTo( this.model, 'change', this.render );
- // this.listenTo( this.model.registrants, 'change', this.render );
+ this.listenTo( this.model.registrants, 'change', this.render );
+
return this;
},
return;
}
} else {
- findByEmail = this.model.registrants.where({email: email});
+ findByEmail = this.model.registrants.where({email: email, fname: fname, lname: lname});
}
var regRequest = cart.get( 'request' );
var parent = this.model.get('parent');
var customFieldData = this.$( 'form.attendee-cf-form-new' ).serialize();
// return false;
- if ( findByEmail.length === 0 ) {
- var newRegistrant = this.model.registrants.create({
- option: 'add',
- reg_request: regRequest.id,
- reg_time: this.model.get( 'id' ),
- reg_event: this.model.get( 'reg_event' ), // Todo: use correct reg_event
- reg_class: this.model.get( 'parent' ).id, // Todo: use correct reg_class
- reg_rate: rateId,
- email: email,
- fname: fname,
- lname: lname,
- addr1: addr1,
- addr2: addr2,
- city: city,
- state: state,
- zip: zip,
- country: country,
- customFields: customFieldData,
- });
- }
+ var newRegistrant = this.model.registrants.create({
+ option: 'add',
+ reg_request: regRequest.id,
+ reg_time: this.model.get( 'id' ),
+ reg_event: this.model.get( 'reg_event' ), // Todo: use correct reg_event
+ reg_class: this.model.get( 'parent' ).id, // Todo: use correct reg_class
+ reg_rate: rateId,
+ email: email,
+ fname: fname,
+ lname: lname,
+ addr1: addr1,
+ addr2: addr2,
+ city: city,
+ state: state,
+ zip: zip,
+ country: country,
+ customFields: customFieldData,
+ });
+ this.$('.glm-add-new-account').show();
this.newRegAccount.destroy();
this.newRegAccountView.remove();
app.regEventLock = false;
// add a registrant to collection
addOne: function( item ){
- // console.log( 'regTime: addOne called' );
+ console.log( 'regTime: addOne called' );
// console.log( item.get('id') );
this.model.set({selectedTime: item.get('reg_time') })
// this.render();
// delete a registrant in collection
deleteOne: function( item ){
- // console.log( 'regTime: deleteOne called' );
+ console.log( 'regTime: deleteOne called' );
// this.render();
},
});
// bind events to the view
events: {
- 'focusout .add_reg_email': 'verifyEmail'
+ 'blur input.add_reg_email': 'verifyEmail'
},
// setup the view
this.$('.add_reg_lname').val(account.lname);
// lock the form
- this.lockForm();
+ // this.lockForm();
} else {
// They should be able to edit the form
this.unLockForm();
);
}
- // If we have the email address then look up the account for it
+ // If we have the email address then look up the account for it.
+ // Need to match the record by email first and last name.
if ( isset( $modelData['email'] ) && $email = filter_var( $modelData['email'], FILTER_VALIDATE_EMAIL ) ) {
$accountId = $this->wpdb->get_var(
$this->wpdb->prepare(
"SELECT id
FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "account
- WHERE email = %s",
- $email
+ WHERE email = %s
+ AND fname = %s
+ AND lname = %s",
+ $email,
+ $modelData['fname'],
+ $modelData['lname']
)
);
}
<div>
<h4>{/literal}{$terms.reg_term_attendee_cap} Info{literal}</h4>
<div class="row">
- <div class="columns large-4 small-12">First Name</div>
- <div class="columns large-8 small-12"><input class="add_reg_fname" value="<%- fname %>"></div>
+ <div class="columns small-12 text-right">
+ <span style="color:red;">* Required Fields</span>
+ </div>
</div>
<div class="row">
- <div class="columns large-4 small-12">Last Name</div>
- <div class="columns large-8 small-12"><input class="add_reg_lname" value="<%- lname %>"></div>
+ <div class="columns large-4 small-12 text-right">Email Address</div>
+ <div class="columns large-8 small-12"><input class="add_reg_email" value="<%- email %>"></div>
</div>
<div class="row">
- <div class="columns large-4 small-12">Email Address</div>
- <div class="columns large-8 small-12"><input class="add_reg_email" value="<%- email %>"></div>
+ <div class="columns large-4 small-12 text-right">First Name *</div>
+ <div class="columns large-8 small-12"><input class="add_reg_fname" value="<%- fname %>"></div>
+ </div>
+ <div class="row">
+ <div class="columns large-4 small-12 text-right">Last Name *</div>
+ <div class="columns large-8 small-12"><input class="add_reg_lname" value="<%- lname %>"></div>
</div>
<form class="attendee-cf-form-new">
<div class="attendee-cf-new">
<a class="show-hide-address">Address (show/hide)</a>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">Address 1</div>
+ <div class="columns large-4 small-12 text-right">Address 1</div>
<div class="columns large-8 small-12"><input class="add_reg_addr1" value="<%- addr1 %>"></div>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">Address 2</div>
+ <div class="columns large-4 small-12 text-right">Address 2</div>
<div class="columns large-8 small-12"><input class="add_reg_addr2" value="<%- addr2 %>"></div>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">City</div>
+ <div class="columns large-4 small-12 text-right">City</div>
<div class="columns large-8 small-12"><input class="add_reg_city" value="<%- city %>"></div>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">State</div>
+ <div class="columns large-4 small-12 text-right">State</div>
<div class="columns large-8 small-12"><input class="add_reg_state" value="<%- state %>"></div>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">Zip/Postal Code</div>
+ <div class="columns large-4 small-12 text-right">Zip/Postal Code</div>
<div class="columns large-8 small-12"><input class="add_reg_zip" value="<%- zip %>"></div>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">Country</div>
+ <div class="columns large-4 small-12 text-right">Country</div>
<div class="columns large-8 small-12"><input class="add_reg_country" value="<%- country %>"></div>
</div>
{/literal}{if $regEvent.time_specific.value}
<div class="columns small-12 large-12">
<h4>{/literal}{$terms.reg_term_attendee_cap} Info{literal}</h4>
<div class="row">
- <div class="columns large-4 small-12">First Name</div>
- <div class="columns large-8 small-12"><input class="reg_fname" value="<%- fname %>"></div>
+ <div class="columns small-12 text-right">
+ <span style="color:red;">* Required Fields</span>
+ </div>
</div>
<div class="row">
- <div class="columns large-4 small-12">Last Name</div>
- <div class="columns large-8 small-12"><input class="reg_lname" value="<%- lname %>"></div>
+ <div class="columns large-4 small-12 text-right">Email Address</div>
+ <div class="columns large-8 small-12"><input class="reg_email" value="<%- email %>" disabled></div>
</div>
<div class="row">
- <div class="columns large-4 small-12">Email Address</div>
- <div class="columns large-8 small-12"><input class="reg_email" value="<%- email %>" disabled></div>
+ <div class="columns large-4 small-12 text-right">First Name *</div>
+ <div class="columns large-8 small-12"><input class="reg_fname" value="<%- fname %>"></div>
+ </div>
+ <div class="row">
+ <div class="columns large-4 small-12 text-right">Last Name *</div>
+ <div class="columns large-8 small-12"><input class="reg_lname" value="<%- lname %>"></div>
</div>
<form class="attendee-cf-form-<%= id %>"><div class="attendee-cf-<%= id %>"></div></form>
<div>
<a class="show-hide-address">Address (show/hide)</a>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">Address 1</div>
+ <div class="columns large-4 small-12 text-right">Address 1</div>
<div class="columns large-8 small-12"><input class="reg_addr1" value="<%- addr1 %>"></div>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">Address 2</div>
+ <div class="columns large-4 small-12 text-right">Address 2</div>
<div class="columns large-8 small-12"><input class="reg_addr2" value="<%- addr2 %>"></div>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">City</div>
+ <div class="columns large-4 small-12 text-right">City</div>
<div class="columns large-8 small-12"><input class="reg_city" value="<%- city %>"></div>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">State</div>
+ <div class="columns large-4 small-12 text-right">State</div>
<div class="columns large-8 small-12"><input class="reg_state" value="<%- state %>"></div>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">Zip/Postal Code</div>
+ <div class="columns large-4 small-12 text-right">Zip/Postal Code</div>
<div class="columns large-8 small-12"><input class="reg_zip" value="<%- zip %>"></div>
</div>
<div class="row ereg-addr">
- <div class="columns large-4 small-12">Country</div>
+ <div class="columns large-4 small-12 text-right">Country</div>
<div class="columns large-8 small-12"><input class="reg_country" value="<%- country %>"></div>
</div>
</div>