How to add an entire new custom module
Hi,
How do we start to create a custom module from scratch. I try to copy the Items modules (Controller, view, etc), create permission, but I'm getting a blank page.
Can I have some to start please?
Thank you.
-
Here is an example if you were making an appointments module. You would need a controller called Appointments and the following sql to generate the menu and permissions. Please send me an email (support@phppointofsale.com) if you need code.
Here is sql
INSERT INTO `phppos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `icon`, `module_id`) VALUES
('module_appointments', 'module_appointments_desc', 75, 'ti-calendar', 'appointments');INSERT INTO `phppos_permissions` (`module_id`, `person_id`) (SELECT 'appointments', person_id FROM phppos_permissions WHERE module_id = 'sales');
INSERT INTO `phppos_modules_actions` (`action_id`, `module_id`, `action_name_key`, `sort`) VALUES ('add_update', 'appointments', 'appointments_add_update', 240);
INSERT INTO phppos_permissions_actions (module_id, person_id, action_id)
SELECT DISTINCT phppos_permissions.module_id, phppos_permissions.person_id, action_id
from phppos_permissions
inner join phppos_modules_actions on phppos_permissions.module_id = phppos_modules_actions.module_id
WHERE phppos_permissions.module_id = 'appointments' and
action_id = 'add_update'
order by module_id, person_id;INSERT INTO `phppos_modules_actions` (`action_id`, `module_id`, `action_name_key`, `sort`) VALUES ('edit', 'appointments', 'appointments_edit', 240);
INSERT INTO phppos_permissions_actions (module_id, person_id, action_id)
SELECT DISTINCT phppos_permissions.module_id, phppos_permissions.person_id, action_id
from phppos_permissions
inner join phppos_modules_actions on phppos_permissions.module_id = phppos_modules_actions.module_id
WHERE phppos_permissions.module_id = 'appointments' and
action_id = 'edit'
order by module_id, person_id;
INSERT INTO `phppos_modules_actions` (`action_id`, `module_id`, `action_name_key`, `sort`) VALUES ('delete', 'appointments', 'appointments_delete', 250);INSERT INTO phppos_permissions_actions (module_id, person_id, action_id)
SELECT DISTINCT phppos_permissions.module_id, phppos_permissions.person_id, action_id
from phppos_permissions
inner join phppos_modules_actions on phppos_permissions.module_id = phppos_modules_actions.module_id
WHERE phppos_permissions.module_id = 'appointments' and
action_id = 'delete'
order by module_id, person_id;INSERT INTO `phppos_modules_actions` (`action_id`, `module_id`, `action_name_key`, `sort`) VALUES ('search', 'appointments', 'appointments_search', 255);
INSERT INTO phppos_permissions_actions (module_id, person_id, action_id)
SELECT DISTINCT phppos_permissions.module_id, phppos_permissions.person_id, action_id
from phppos_permissions
inner join phppos_modules_actions on phppos_permissions.module_id = phppos_modules_actions.module_id
WHERE phppos_permissions.module_id = 'appointments' and
action_id = 'search'
order by module_id, person_id;
Please sign in to leave a comment.
Comments
5 comments