Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8359617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:12:07+00:00 2026-06-09T11:12:07+00:00

I am attempting to write a migration script (between 2 versions of a program)

  • 0

I am attempting to write a migration script (between 2 versions of a program) to populate the phppos_permissions_actions table.

The rule for populating is: “If the user has permission for the module (based on phppos_permissions), then they are granted all action permissions for that module. (Which can be looked up in phppos_module_actions)”.

I am trying to write a query or a set of queries that makes the following rule happen. Could someone guide me in the right direction? Below is my schema

mysql> describe phppos_modules;
+---------------+--------------+------+-----+---------+-------+
| Field         | Type         | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| name_lang_key | varchar(255) | NO   | UNI | NULL    |       |
| desc_lang_key | varchar(255) | NO   | UNI | NULL    |       |
| sort          | int(10)      | NO   |     | NULL    |       |
| module_id     | varchar(255) | NO   | PRI | NULL    |       |
+---------------+--------------+------+-----+---------+-------+
4 rows in set (0.01 sec)

mysql> select * from phppos_modules;
+-------------------+------------------------+------+------------+
| name_lang_key     | desc_lang_key          | sort | module_id  |
+-------------------+------------------------+------+------------+
| module_config     | module_config_desc     |  100 | config     |
| module_customers  | module_customers_desc  |   10 | customers  |
| module_employees  | module_employees_desc  |   80 | employees  |
| module_giftcards  | module_giftcards_desc  |   90 | giftcards  |
| module_item_kits  | module_item_kits_desc  |   30 | item_kits  |
| module_items      | module_items_desc      |   20 | items      |
| module_receivings | module_receivings_desc |   60 | receivings |
| module_reports    | module_reports_desc    |   50 | reports    |
| module_sales      | module_sales_desc      |   70 | sales      |
| module_suppliers  | module_suppliers_desc  |   40 | suppliers  |
+-------------------+------------------------+------+------------+
10 rows in set (0.00 sec)
mysql> describe phppos_modules_actions;
+-----------------+--------------+------+-----+---------+-------+
| Field           | Type         | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------+-------+
| action_id       | varchar(255) | NO   | PRI | NULL    |       |
| module_id       | varchar(255) | NO   | PRI | NULL    |       |
| action_name_key | varchar(255) | NO   |     | NULL    |       |
| sort            | int(11)      | NO   |     | NULL    |       |
+-----------------+--------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

mysql> 

mysql> select * from phppos_modules_actions;
+----------------+-----------+--------------------------------+------+
| action_id      | module_id | action_name_key                | sort |
+----------------+-----------+--------------------------------+------+
| add_update     | customers | module_action_add_update       |    1 |
| add_update     | employees | module_action_add_update       |  130 |
| add_update     | item_kits | module_action_add_update       |   70 |
| add_update     | items     | module_action_add_update       |   40 |
| add_update     | suppliers | module_action_add_update       |  100 |
| delete         | customers | module_action_delete           |   20 |
| delete         | employees | module_action_delete           |  140 |
| delete         | item_kits | module_action_delete           |   80 |
| delete         | items     | module_action_delete           |   50 |
| delete         | suppliers | module_action_delete           |  110 |
| search         | customers | module_action_search_customers |   30 |
| search         | employees | module_action_search_employees |  150 |
| search         | item_kits | module_action_search_item_kits |   90 |
| search         | items     | module_action_search_items     |   60 |
| search         | suppliers | module_action_search_suppliers |  120 |
| see_cost_price | items     | module_see_cost_price          |   61 |
+----------------+-----------+--------------------------------+------+
16 rows in set (0.00 sec)


mysql> describe phppos_permissions
    -> ;
+-----------+--------------+------+-----+---------+-------+
| Field     | Type         | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| module_id | varchar(255) | NO   | PRI | NULL    |       |
| person_id | int(10)      | NO   | PRI | NULL    |       |
+-----------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql> select * from phppos_permissions;
+------------+-----------+
| module_id  | person_id |
+------------+-----------+
| config     |         1 |
| customers  |         1 |
| employees  |         1 |
| giftcards  |         1 |
| item_kits  |         1 |
| items      |         1 |
| receivings |         1 |
| reports    |         1 |
| sales      |         1 |
| suppliers  |         1 |
| sales      |       301 |
| sales      |       741 |
| config     |       759 |
| customers  |       759 |
| employees  |       759 |
| giftcards  |       759 |
| item_kits  |       759 |
| items      |       759 |
| receivings |       759 |
| reports    |       759 |
| sales      |       759 |
| suppliers  |       759 |
| sales      |       776 |
+------------+-----------+
23 rows in set (0.00 sec)


mysql> describe phppos_permissions_actions;
+-----------+--------------+------+-----+---------+-------+
| Field     | Type         | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| module_id | varchar(255) | NO   | PRI | NULL    |       |
| person_id | int(11)      | NO   | PRI | NULL    |       |
| action_id | varchar(255) | NO   | PRI | NULL    |       |
+-----------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:12:09+00:00Added an answer on June 9, 2026 at 11:12 am

    Does

    insert 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
    order by module_id, person_id
    

    solve your problem?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to write a menu driven modular perl script that will capture user
I am curretnly attempting to write a script in python that allows me to
I am attempting to write a method that has an optional EventHandler Paramater. it
I have been attempting to write a VBA Script that can parse out other
I'm attempting to write a very basic script using javascript. What I want to
I am attempting to write to Azure Table Storage without using the TableContext and
I am attempting to write this type of program as stated in the question.
I am attempting to write a script that can retrieve the HTML from my
I'm attempting to write a program that downloads Team Viewer and installs it and
I am attempting to write a simple script to recursively rip through a directory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.