setError('Missing first name or last name.'); return false; } // check if a customer with the same information exists if (!empty($data['email'])) { $customer = $this->getItem([ 'first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'email' => $data['email'], ]); if ($customer) { // convert the saving operation into an update $data['id'] = $customer->id; } } } if (!empty($data['country']) && strlen($data['country']) !== 3) { // attempt to convert a country iso2 code or name into the corresponding iso3 char code $data['country'] = VikBooking::getCPinInstance()->get3CharCountry($data['country']); } return parent::preflight($data); } }