booking with same customer mail address but different names?

354 views
Skip to first unread message

Andreas Hanny

unread,
Mar 11, 2021, 1:40:42 PM3/11/21
to Easy!Appointments - Support Group
Hi everybody,

I got a problem with E!A 1.4.1. I have allowed 5 slots every 10 minutes for my service, and now I noticed that when someone registers twice (and uses the same customer mail address but different customer namens) I get two mails with the correct information. I see then that there were 2 different customers that used the same mail address.
But in the backend section I only see the name of the first, so it seems that one had booked twice, but in reality these are two different persons.
In my case the parents have to take appointments for their children, and they use the parent's mail addresses.

Example:
1st booking: Customer A - ma...@example.com
2nd booking: Customer B - ma...@example.com

In the backend I see "Customer A" twice.

Is this my fault or a bug and how can I avoid this? The system is already online and it gives a lot of confusion for us :-(

Thank you very much for any help!!!

ayman salah

unread,
Mar 11, 2021, 1:50:12 PM3/11/21
to Easy!Appointments - Support Group
Your absolutely right, when customer enter email that already exists it override the old one assuming that same person is booking.
to avoid that some codes  changes needs to be done and I dont think it will be that easy.

Alex Tselegidis

unread,
Mar 22, 2021, 5:09:23 AM3/22/21
to Easy!Appointments - Support Group
Hello! 

You can quickly display this customer matching by making the following change in the application/models/Customers_model.php 

Before: 

public function exists($customer)
    {
        if (empty($customer['email']))
        {
            throw new Exception('Customer\'s email is not provided.');
        }

        // This method shouldn't depend on another method of this class.
        $num_rows = $this->db
            ->select('*')
            ->from('users')
            ->join('roles', 'roles.id = users.id_roles', 'inner')
            ->where('users.email', $customer['email'])
            ->where('roles.slug', DB_SLUG_CUSTOMER)
            ->get()->num_rows();

        return $num_rows > 0;
    }


After: 

public function exists($customer)
    {
        return FALSE; 
        
        if (empty($customer['email']))
        {
            throw new Exception('Customer\'s email is not provided.');
        }

        // This method shouldn't depend on another method of this class.
        $num_rows = $this->db
            ->select('*')
            ->from('users')
            ->join('roles', 'roles.id = users.id_roles', 'inner')
            ->where('users.email', $customer['email'])
            ->where('roles.slug', DB_SLUG_CUSTOMER)
            ->get()->num_rows();

        return $num_rows > 0;
    }





  Alex Tselegidis, Easy!Appointments Creator
  Need a customization? Contact me in person!



Andreas Hanny

unread,
Mar 22, 2021, 9:40:51 AM3/22/21
to Easy!Appointments - Support Group
Hi Alex,

well, just to know I've understand this: my problem is that when two different people fix an appointment using the same mail address, at the end I have two appointments with the name of the second person. Does your code solve this problem?

Thank you very much!

Andreas

Alex Tselegidis

unread,
Mar 29, 2021, 4:33:31 AM3/29/21
to Easy!Appointments - Support Group
Yes, in which each appointment will have its own customer record and data existing data won't be overwritten. 







  Alex Tselegidis, Easy!Appointments Creator
  Need a customization? Contact me in person!



José Antonio Cachón Suárez

unread,
Mar 29, 2021, 7:20:09 AM3/29/21
to Easy!Appointments - Support Group
Hi, Alex, I have done what you said here, and as a result, the appointment is impossible to be saved, and the next message is seen:

Given email address belongs to another customer record. Please use a different email.

Alex Tselegidis

unread,
Apr 6, 2021, 9:27:15 AM4/6/21
to Easy!Appointments - Support Group
Remove the following part from the Customers_model.php - validate method: 

// When inserting a record the email address must be unique.
$customer_id = isset($customer['id']) ? $customer['id'] : '';


$num_rows = $this->db
->select('*')
->from('users')
->join('roles', 'roles.id = users.id_roles', 'inner')
->where('roles.slug', DB_SLUG_CUSTOMER)

->where('users.email', $customer['email'])
->where('users.id !=', $customer_id)
->get()
->num_rows();

if ($num_rows > 0)
{
throw new Exception('Given email address belongs to another customer record. '
. 'Please use a different email.');
}







  Alex Tselegidis, Easy!Appointments Creator
  Need a customization? Contact me in person!



José Antonio Cachón Suárez

unread,
Apr 7, 2021, 8:47:37 AM4/7/21
to Easy!Appointments - Support Group
Hi Alex. Due to your help, it has worked. Thanks a lot!

Alex Tselegidis

unread,
Apr 12, 2021, 6:31:57 AM4/12/21
to Easy!Appointments - Support Group
Awesome!







  Alex Tselegidis, Easy!Appointments Creator
  Need a customization? Contact me in person!



Andreas Hanny

unread,
Apr 19, 2021, 6:32:59 AM4/19/21
to Easy!Appointments - Support Group
Hi Alex,

I've modified the original Customers_model.php by just removing this whole part, no other modifications were done:


        // When inserting a record the email address must be unique.
        $customer_id = isset($customer['id']) ? $customer['id'] : '';


        $num_rows = $this->db
            ->select('*')
            ->from('users')
            ->join('roles', 'roles.id = users.id_roles', 'inner')
            ->where('roles.slug', DB_SLUG_CUSTOMER)
            ->where('users.email', $customer['email'])
            ->where('users.id !=', $customer_id)
            ->get()
            ->num_rows();

        if ($num_rows > 0)
        {
            throw new Exception('Given email address belongs to another customer record. '
                . 'Please use a different email.');
        }


I still have the same problem, what did I wrong?

Andreas Hanny

unread,
Apr 19, 2021, 6:35:25 AM4/19/21
to Easy!Appointments - Support Group
Sorry, my fault,

I had to make the other modification also.

Thank you very much!!!!!!

Reply all
Reply to author
Forward
0 new messages