Entity scope: every contact is linked to a business entity via las asignaciones de personas a un negocio. You only see contacts assigned to your active entity.
π What does this system do?
The Contact Manager manages contacts, customers, and team members across business entities. It provides:
- Session + active-entity authentication (each user belongs to one or more entities).
- Full contact lifecycle: create, view, edit, delete β with search and filters (status, gender, role, keyword).
- Photo/avatar upload, with sensible fallback defaults.
- Role assignment per entity via the las asignaciones de personas a un negocio pivot table (la persona, el identificador del negocio,
role).
- Live statistics: total, active, verified, primary-owner counts.
π±οΈ How to Use
1
Login & entity context
After login, the system uses your active el negocio (la entidad) selection. Every contact shown belongs to that entity.
2
View & filter contacts
The table shows photo, name, email, phone, role and status. Filter by name/email/phone, status, gender, or role.
3
Add a contact
Fill in name, surname, email (required), optionally a photo and a role. New contacts get linked to your entity via las asignaciones de personas a un negocio.
4
Edit / view / delete
Deleting only removes the contact from your entity β the contact itself is only fully deleted if it has no other entity associations left.
5
Deduplication
Adding a contact whose email/RFC/CURP already exists doesn't create a duplicate β it links the existing contact to your entity instead.
π₯ Adding an employee to your company
An employee does not get into your company just by being accepted: they must switch to your company in their profile, and you assign the apps they will use. Full steps:
1
Employee: asks to join (or accepts your invitation)
In Profile β My Employment the employee requests to join your company, or accepts the invitation you sent from Team. No employment link is recorded unless both sides accept.
2
You: accept and choose their apps
In Team β Employment requests press Accept. A window lets you tick which apps they get. If you tick none they stay pending assignment: they only see Team, Contacts, Notes, Tasks, Help and their profile.
3
Employee: switches to the company (required step)
Accepting only links them to your company; their session stays on the company they had before. To work in yours they must go to Profile β Active Entity, pick your company in the list and press Establecer (Set). Until then they will not see your apps or data. If your company is missing from that list, the acceptance did not complete.
4
You: assign or change their apps any time
In Team, with that person's Permissions key: Apps they can use section (which apps open) and the table below (what they can do inside each). If they open an app that is not assigned, they see a screen explaining their administrator has not enabled it yet. Every change is logged.
Working in several companies: to switch from one to another use the same Active Entity selector in the profile. Apps and permissions are per company: what you assigned in yours does not apply elsewhere.
Two companies at once? Yes: the active company is stored in each browser's own session. You can be signed in on Chrome with company A (as an employee) and on Firefox with company B (as an administrator); each shows its own data, apps and permissions, and switching company in one browser does not affect the other. Two tabs of the same browser share one session: to work in two companies at the same time use another browser or a private window.
Did your employee forget the password, or have no e-mail? Open Team β the Permissions key of that person β Sign-in with username and password β Generate access. A username is created (leave it empty to get a suggestion) and a temporary password that is shown only once: hand it over. On the first sign-in the platform asks for a password of their own before opening anything else. If it is forgotten again, generate a new one: the old one stops working and their open sessions are closed. It works for employees whose account was created for the job (they have never signed in) or who were given access by your company before. Someone who already uses their account on their own keeps their privacy: they use Β«Forgot your password?Β» or ask support. Every time it is logged: who did it and to whom.
β Core Features
| Feature | Description |
| π€ Photo/Avatar upload | PNG/JPG, stored under /media/platform/img/users/ with username-based filenames. |
| πͺͺ RFC/CURP validation | Uniqueness enforced at the application level β prevents duplicate official IDs across entities. |
| π’ Multi-entity architecture | A contact can belong to multiple entities, with a different role in each, via las asignaciones de personas a un negocio. |
| π Password hashing | New contacts get a hashed password (password_hash()). Editing never shows or resets it accidentally. |
| π Live statistics | Aggregated counts (active/verified/primary) scoped to the active entity. |
| π Dynamic filtering | Combined search across name/email/phone/nick plus status/gender/role. |
π API Endpoints
All actions require an authenticated session and an active entity.
GET ?action=get
Paginated contacts with filters, scoped to the active entity via las asignaciones de personas a un negocio.
GET ?action=get&id=123
Single contact's details (only if it belongs to your active entity).
GET ?action=stats
Entity-scoped statistics: total, active, verified, primary.
POST Create contact
Validates name/email, checks for an existing contact first, then links the role.
PUT Update contact
Updates fields, handles a new photo upload, updates the entity's role.
DELETE Delete contact
Removes the las asignaciones de personas a un negocio link; only deletes the contact itself if no other entity association remains.
Tables involved: contacts (personal data, photo, el interruptor de activo), las asignaciones de personas a un negocio (la persona, el identificador del negocio, role), el negocio (la entidad) (entity context).
π‘οΈ Security & Permissions
- Session enforcement: every request checks the authenticated user and active entity; unauthorized requests get redirected to login.
- Entity isolation: every query joins through las asignaciones de personas a un negocio scoped to the active el identificador del negocio β you can't see or edit another entity's contacts.
- SQL injection protection: parameterized queries throughout, no raw string concatenation.
- Password storage: new contacts get
password_hash() β never plaintext.
- Photo upload: extension allow-list, absolute filesystem paths on save to prevent directory traversal.
π§ Troubleshooting & FAQ
"No contacts show up" or stats show 0
Make sure you have an active entity selected. Check that las asignaciones de personas a un negocio has a row linking your user to that entity.
Photo not uploading or showing a default avatar
Check that the upload folder is writable, and that the file extension is allowed (jpg/png). The preview relies on a publicly reachable URL.
"Invalid business entity" error
Your account has no el negocio (la entidad) record. This is normally created automatically at signup β if it's missing, contact an administrator.
Duplicate contacts / linking behavior
Adding a contact with an email/RFC/CURP that already exists does NOT create a duplicate β it just adds a new las asignaciones de personas a un negocio entry for your entity.
Pagination not working or filters reset
Check the browser console for JS errors β the list uses event delegation, and one broken handler can affect the rest.