This document covers the user management functionality within the Hotelaro hotel management system, specifically focusing on customer management operations. The system provides comprehensive CRUD operations for managing customer data with multi-tenant isolation and role-based permissions.
Note: This page documents customer management functionality. For employee management and administrative user roles, see Authentication & Security.
The user management system in Hotelaro is built around a modular architecture that handles customer data management with multi-tenant support. Each hotel property maintains its own isolated customer database through the admin_uid filtering mechanism.
Core Infrastructure
Database Layer
Customer Management System
Customer Controller
(Customer.php)
CustomerModel
(CustomerModel.php)
Customer Views
(content.php, customerlist.php)
Frontend JavaScript
(frontjavascript.php)
hotel_booking_clients table
permissionvaluecheck()
session()->get('uid')
csrf_hash()
The customer management system provides a complete interface for managing customer information including personal details, contact information, and geographical data. The system is located in the Core\\Customer namespace and follows the MVC pattern.
| Component | File | Purpose |
|---|---|---|
| Controller | inc/core/Customer/Controllers/Customer.php | Handles HTTP requests and business logic |
| Model | inc/core/Customer/Models/CustomerModel.php | Database operations and queries |
| Views | inc/core/Customer/Views/ | User interface templates |
| JavaScript | inc/core/Customer/Views/frontjavascript.php | Frontend interactions and AJAX |
The customer module configuration is defined in Config.php and referenced throughout the system using $this->config['id'] for permission checking and routing.
The customer data is stored in the hotel_booking_clients table with the following key fields:
hotel_booking_clients
int
id
PK
string
uid
Unique customer ID (CUS001, CUS002, etc)
int
admin_uid
Multi-tenant isolation key
string
c_name
Customer full name
string
c_email
Email address
string
c_phone
Phone number
string
c_address
Street address
string
c_country
Country
string
c_state
State/Province
string
c_city
City
string
c_zip
Postal code
string
password
Hashed password
The system uses admin_uid for tenant isolation, ensuring each hotel property only sees its own customers. This is implemented in the model's getSearchAll() method:
$builder = $this->db->table('hotel_booking_clients')->where('admin_uid', $this->session->get('uid'));
The uid field follows the pattern CUS001, CUS002, etc., generated using the idbyorder() helper function.
The customer management system implements full CRUD (Create, Read, Update, Delete) functionality with proper permission checking and validation.
Model Operations
Permission Checks
Customer CRUD Flow
index() - List customers
add() - Show add form
edit(id) - Show edit form
datasetup() - Process form
deleteit() - Delete customer
get() - Fetch customer data
permissionvaluecheck('view')
permissionvaluecheck('create')
permissionvaluecheck('edit')
permissionvaluecheck('delete')
getSearchAll(searchMain)
insertit(data)
updateit(id, data)
deleteit(id)
getById(id)
The create operation involves form validation, unique ID generation, and password hashing:
The system provides multiple read operations:
The frontend interface consists of two main views: a list view for displaying customers and a form view for adding/editing customer information.
The customer list (customerlist.php) provides:
Key table columns: Sr-No, ID, Customer name, Email, Phone, State, City, Country, Action
The customer form (content.php) includes:
The frontend JavaScript (frontjavascript.php) handles:
Backend Endpoints
User Interactions
Frontend JavaScript Functions
ajaxSend(page, alldata, routeurl, masterkey, pagelimit)
joinmainData(arrayhere, divID)
joinpagiData(dataObject, divID)
deletetr click handler
#searching click
#rowSelect click
#filtering click
#reseting click
.pagechange click
.deletetr click
/customer/get
/customer/deleteit
AJAX Data Loading: Dynamic table population without page refresh
Pagination: Click handlers for page navigation
Search & Filtering: Real-time search and multi-field filtering
Row Management: Inline edit/delete actions
Local Storage: Remembers user's preferred page size setting
The customer management system implements role-based access control through the permissionvaluecheck() function. Each CRUD operation requires specific permissions:
| Operation | Permission Required | Implementation |
|---|---|---|
| View customers | view | Checked in get() method |
| Create customer | create | Checked in add() method |
| Edit customer | edit | Checked in edit() method |
| Delete customer | delete | Checked in deleteit() method |
Permission failures result in:
The permission system uses the module configuration ID ($this->config['id']) to determine the specific permission context for the customer module.