diff --git a/client/src/i18n/fr/tree.json b/client/src/i18n/fr/tree.json index ea24616688..9b23a8fe4e 100644 --- a/client/src/i18n/fr/tree.json +++ b/client/src/i18n/fr/tree.json @@ -34,7 +34,7 @@ "CURRENCY":"Monnaie", "DATA_COLLECTION": "Collecte de données", "FORMS_MANAGEMENT": "Gestion des formulaires", - "DATA_KIT": ".Kit de collecte de données", + "DATA_KIT": "Kit de collecte de données", "DATA_KIT_REPORT": "Rapport des collectes des données", "DEBTOR_GROUP":"Gestion des Groupes Débiteurs", "DEPOTS":"Dépôts", diff --git a/client/src/js/components/bhNavigation.js b/client/src/js/components/bhNavigation.js index 2d12d65417..993e067ff8 100644 --- a/client/src/js/components/bhNavigation.js +++ b/client/src/js/components/bhNavigation.js @@ -31,8 +31,8 @@ function NavigationController($location, $rootScope, Tree, AppCache, Notify, $tr function loadTreeUnits() { Tree.units() .then(units => { - Tree.sortByTranslationKey(units); + $ctrl.units = units; calculateUnitIndex($ctrl.units); diff --git a/client/src/js/services/tree.js b/client/src/js/services/tree.js index 981b518fbf..36636ca56e 100644 --- a/client/src/js/services/tree.js +++ b/client/src/js/services/tree.js @@ -30,7 +30,19 @@ function Tree($http, $translate, util, TreeClass) { .then(data => new TreeClass(data)); } - /** recursively sort an array of BHIMA units respecting translation keys. */ + // returns 1 if unit is a parent or 0 if not. + function hasChildren(unit) { + const bool = unit.children && unit.children.length > 0; + return bool ? 1 : 0; + } + + /** + * @function sortByTranslationKey + * + * @description + * Recursively sort an array of BHIMA units respecting translation keys. + * + */ function sortByTranslationKey(unitArray) { if (angular.isUndefined(unitArray)) { return; @@ -39,7 +51,12 @@ function Tree($http, $translate, util, TreeClass) { unitArray.sort((a, b) => { const aValue = $translate.instant(a.key); const bValue = $translate.instant(b.key); - return aValue.localeCompare(bValue); + + // make sure parents sink to the bottom of the sorted list. + const parentWeight = (hasChildren(a) - hasChildren(b)); + + // prioritize sorting by parents, then by i18nValue + return (parentWeight || aValue.localeCompare(bValue)); }); // recursively step into each set of children diff --git a/server/models/bhima.sql b/server/models/bhima.sql index 8a5b30979e..47d5891f3a 100644 --- a/server/models/bhima.sql +++ b/server/models/bhima.sql @@ -10,150 +10,157 @@ SET CHARACTER SET utf8mb4, CHARACTER_SET_CONNECTION = utf8mb4; -- units INSERT INTO unit VALUES - (0, 'Root','TREE.ROOT','The unseen root node',NULL,'/root'), - (1, 'Admin','TREE.ADMIN','The Administration Super-Category',0,'/ADMIN_FOLDER'), - (2, 'Enterprise', 'TREE.ENTERPRISE', 'Manage the registered enterprises from here', 1, '/enterprises'), - (3, 'Invoice Registry','TREE.INVOICE_REGISTRY','Invoice Registry',5,'/invoices'), - (4, 'Users & Permissions','TREE.USERS','Manage user privileges and permissions',1,'/users'), - (5, 'Finance','TREE.FINANCE','The Finance Super-Category',0,'/FINANCE_FOLDER'), - (6, 'Account','TREE.ACCOUNT','Chart of Accounts management',5,'/accounts'), - (9, 'Posting Journal','TREE.POSTING_JOURNAL','Daily Log',5,'/journal'), - (10, 'General Ledger','TREE.GENERAL_LEDGER','Posted Journal Data', 5,'/general_ledger'), - (12, 'Hospital','TREE.HOSPITAL','The Hospital Super-Category',0,'/HOSPITAL_FOLDER'), - (13, 'Fiscal Year','TREE.FISCAL_YEAR','Fiscal year configuration page',5,'/fiscal'), - (14, 'Patient Registration','TREE.PATIENT_REGISTRATION','Register patients',12,'/patients/register'), - (15, 'Patient Registry','TREE.PATIENT_REGISTRY','Patient Registry',12,'/patients'), - (16, 'Patient Invoice','TREE.PATIENT_INVOICE','Create an invoice for a patient',5,'/invoices/patient'), - (18, 'Cash Window','TREE.CASH_WINDOW','Cash payments against past or future invoices',5,'/cash'), - (19, 'Register Supplier','TREE.REGISTER_SUPPLIER','',1,'/suppliers'), - (20, 'Depot Management','DEPOT.TITLE','', 160,'/depots'), - (21, 'Price List','TREE.PRICE_LIST','Configure price lists!',1,'/prices'), - (26, 'Location Manager','TREE.LOCATION','',1,'/locations'), - (29, 'Patient Group','TREE.PATIENT_GRP','',1,'/patients/groups'), - (48, 'Service Management','TREE.SERVICE','',1,'/services'), - (57, 'Human Resources','TREE.HUMANS_RESSOURCES','',0,'/PAYROLL_FOLDER'), - (61, 'Employee','TREE.EMPLOYEE','Employees Registration',57,'/employees/register'), - (62, 'Employee Registry','TREE.EMPLOYEE_REGISTRY', '', 57,'/employees'), - (82, 'Subsidies','TREE.SUBSIDY','Handles the subsidy situation',1,'/subsidies'), - (105, 'Cashbox Management','TREE.CASHBOX_MANAGEMENT','',1,'/cashboxes'), - (107, 'Debtor Groups Management', 'TREE.DEBTOR_GROUP', 'Debtor Groups Management module', 1, '/debtors/groups'), - (134, 'Simple Journal Vouchers', 'TREE.SIMPLE_VOUCHER', 'Creates a simple transfer slip between two accounts', 5, '/vouchers/simple'), - (135, 'Invoicing Fee', 'TREE.INVOICING_FEES', 'Configures invoicing Fee for bhima', 1, '/invoicing_fees'), - (137, 'Complex Journal Vouchers', 'TREE.COMPLEX_JOURNAL_VOUCHER', 'Complex Journal vouchers module', 5, '/vouchers/complex'), - (138, 'Inventory Module', 'TREE.INVENTORY', 'Inventory management module', 0, '/INVENTORY_FOLDER'), - (139, 'Inventory Registry', 'TREE.INVENTORY_REGISTRY', 'Inventory Registry module', 138, '/inventory'), - (140, 'Inventory Configurations', 'TREE.INVENTORY_CONFIGURATION', 'Inventory configuration module', 138, '/inventory/configuration'), - (141, 'Vouchers Records', 'TREE.VOUCHER_REGISTRY', 'Vouchers registry module', 5, '/vouchers'), - (143, 'Transaction Type Module', 'TREE.TRANSACTION_TYPE', 'This module is responsible for managing transaction type', 1, '/transaction_type'), - (144, 'Reports (Finance)', 'TREE.REPORTS', 'A folder holding all finance reports', 0, '/finance/REPORT_FOLDER'), - (145, 'Cashflow', 'TREE.CASHFLOW', 'The Cashflow Report', 144, '/reports/cashflow'), - (146, 'Creditor Groups Management', 'TREE.CREDITOR_GROUP', 'Creditor Groups Management module', 1, '/creditors/groups'), - (147, 'Cash Payment Registry', 'TREE.CASH_PAYMENT_REGISTRY', 'Cash Payment Registry', 5, '/payments'), - (149, 'Cash Report', 'TREE.CASH_REPORT', 'The report of cash entry and exit', 144, '/reports/cash_report'), - (150, 'Balance Report', 'TREE.BALANCE_REPORT', 'Balance report module', 144, '/reports/balance_report'), - (151, 'Customer Debts', 'TREE.AGED_DEBTORS', 'Aged Debtors', 144, '/reports/aged_debtors'), - (152, 'Account report', 'TREE.REPORT_ACCOUNTS', 'The report accounts', 144, '/reports/account_report'), - (153, 'Report Cashflow by Service', 'TREE.CASHFLOW_BY_SERVICE', 'CashflowByService', 144, '/reports/cashflowByService'), - (154, 'Purchase Order', 'TREE.PURCHASE_ORDER', 'Purchase order folder', 0, '/PURCHASE_FOLDER'), - (155, 'Purchase', 'TREE.PURCHASE', 'The purchase module', 154, '/purchases/create'), - (156, 'Purchase Registry', 'TREE.PURCHASE_REGISTRY', 'The purchase registry', 154, '/purchases'), - (157, 'Open Debtors', 'REPORT.OPEN_DEBTORS.TREE', 'Open Debtors', 144, '/reports/open_debtors'), - (160, 'Stock', 'TREE.STOCK', 'The stock management module', 0, '/STOCK_FOLDER'), - (161, 'Stock Lots', 'TREE.STOCK_LOTS', 'The stock lots registry', 160, '/stock/lots'), - (162, 'Stock Movements', 'TREE.STOCK_MOVEMENTS', 'The stock lots movements registry', 160, '/stock/movements'), - (163, 'Stock Inventory', 'TREE.STOCK_INVENTORY', 'The stock inventory registry', 160, '/stock/inventories'), - (164, 'Stock Exit', 'STOCK.EXIT', 'The stock exit module', 160, '/stock/exit'), - (165, 'Stock Entry', 'STOCK.ENTRY', 'The stock entry module', 160, '/stock/entry'), - (167, 'Stock Adjustment', 'STOCK.ADJUSTMENT', 'The stock adjustment module', 160, '/stock/adjustment'), - (168, 'Aged Creditors', 'TREE.AGED_CREDITORS', 'Aged Creditors', 144, '/reports/aged_creditors'), - (170, 'Account Statement', 'TREE.ACCOUNT_STATEMENT', 'Account Statement Module', 5, '/account_statement'), - (180, 'Income Expenses', 'REPORT.PROFIT_AND_LOSS', 'The report of income and expenses', 144, '/reports/income_expense'), - (181, 'Stock Report', 'TREE.STOCK_REPORT', 'The report of inventories in stock', 144, '/reports/inventory_report'), - (182, 'Stock Sheet Report', 'TREE.STOCK_INVENTORY_REPORT', 'The report of an inventory in stock', 144, '/reports/stock_sheet'), - (183, 'Grade Management','TREE.GRADES','', 57,'/grades'), - (184, 'Job Title Management','TREE.PROFESSION','', 57,'/functions'), - (185, 'Payroll Rubric Management','TREE.PAYROLL_RUB_MANAGEMENT','', 57,'/payroll/rubrics'), - (186, 'Holidays Management','TREE.HOLIDAYS_MANAGEMENT','Holidays Management',57,'/holidays'), - (187, 'Offdays Management','TREE.OFFDAYS_MANAGEMENT','Offdays Management', 57,'/offdays'), - (188, 'Tax IPR Management','TREE.IPR_MANAGEMENT','IPR Management',57,'/ipr_tax'), - (189, 'IPR Tax Configuration','TREE.IPR_TAX_CONFIGURATION','IPR Tax Configuration', 57,'/ipr_tax/configuration'), - (190, 'Payroll Rubric Configuration','TREE.PAYROLL_RUB_CONFIGURATION','',57,'/payroll/rubric_configuration'), - (191, 'Account Configuration','TREE.PAYROLL_ACCOUNT_CONFIGURATION','Account Configuration', 57,'/payroll/account_configuration'), - (192, 'Operating report', 'TREE.OPERATING_ACCOUNT', 'The report of operating', 144, '/reports/operating'), - (193, 'Weekend Configuration','TREE.WEEKEND_CONFIGURATION','Weekend Configuration', 57,'/payroll/weekend_configuration'), - (194, 'Payroll Configuration','TREE.PAYROLL_CONFIGURATION','Payroll Configuration', 57,'/payroll'), - (195, 'Role management','TREE.ROLE_MANAGEMENT','Roles Management', 1,'/roles'), - (197, 'Stock Exit Report','TREE.STOCK_EXIT_REPORT','Stock Exit Report', 144,'/reports/stock_exit'), - (199, 'Annual Clients Report', 'REPORT.CLIENTS.TITLE', 'Annual Clients Report', 144, '/reports/annual-clients-report'), - (200, 'Multiple Payroll','TREE.MULTI_PAYROLL','Multiple Payroll', 57,'/multiple_payroll'), - (201, 'Employee Standing Report', 'TREE.EMPLOYEE_STANDING_REPORT', 'Employee Standing Report', 144, '/reports/employeeStanding'), - (202, 'Patient Standing Report', 'TREE.PATIENT_STANDING_REPORT', 'Patient Standing Report', 144, '/reports/patientStanding'), - (203, 'Employees Configuration','TREE.PAYROLL_EMP_CONFIGURATION','',57,'/payroll/employee_configuration'), - (204, 'Exchange Rate','TREE.EXCHANGE','', 1,'/exchange'), - (205, 'Account Reference Management','TREE.ACCOUNT_REFERENCE_MANAGEMENT','',1,'/account_reference'), - (206, '[OHADA] Bilan','TREE.OHADA_BALANCE_SHEET','',144,'/reports/ohada_balance_sheet_report'), - (207, 'Account Reference Report','TREE.ACCOUNT_REFERENCE_REPORT','',144,'/reports/account_reference'), - (208, 'Import Stock From File','TREE.IMPORT_STOCK_FROM_FILE','',160,'/stock/import'), - (209, 'Accounts Report Multiple','TREE.REPORTS_MULTIPLE_ACCOUNTS','',144,'/reports/account_report_multiple'), - (210, 'Unbalanced Invoice Payments','REPORT.UNPAID_INVOICE_PAYMENTS_REPORT.TITLE','',144,'/reports/unpaid-invoice-payments'), - (211, 'Income Expenses by Month', 'REPORT.PROFIT_AND_LOSS_BY_MONTH', 'The report of income and expenses', 144, '/reports/income_expense_by_month'), - (213, 'Stock value Report','TREE.STOCK_VALUE','',144,'/reports/stock_value'), - (214, '[OHADA] Compte de resultat','TREE.OHADA_RESULT_ACCOUNT','',144,'/reports/ohada_profit_loss'), - (216, 'Income Expenses by Year', 'REPORT.PROFIT_AND_LOSS_BY_YEAR', 'The report of income and expenses', 144, '/reports/income_expense_by_year'), - (217, 'Tags','TREE.TAGS','', 1,'/tags'), - (218, 'Fee Center Management','TREE.FEE_CENTER_MANAGEMENT','', 0,'/fee_center'), - (219, 'Fee Center Management','TREE.FEE_CENTER','', 218,'/fee_center'), - (220, 'Distributions fees Centers','TREE.DITRIBUTION_AUX_FEES_CENTERS','', 218,'/distribution_center'), - (221, 'Update Distributions','TREE.UPDATE_DISTRIBUTION','', 218,'/distribution_center/update'), - (222, 'Fee Center Report', 'TREE.FEE_CENTER_REPORT', 'Fee Center Report', 144, '/reports/feeCenter'), - (223, 'Distribution keys', 'TREE.DISTRIBUTION_KEYS', 'Distribution keys', 218, '/distribution_center/distribution_key'), - (225, 'Stock Assignment','ASSIGN.STOCK_ASSIGN','', 160,'/stock/assign'), - (226, 'Account Reference Type','TREE.ACCOUNT_REFERENCE_TYPE','Account Reference Type', 1,'/account_reference_type'), - (227, 'Ward Module', 'TREE.WARD', 'Ward folder', 0, '/WARD_FOLDER'), - (228, 'Ward Configurations', 'TREE.WARD_CONFIGURATION', 'Ward configuration module', 227, '/ward/configuration'), - (229, 'Visits Registry', 'TREE.VISITS_REGISTRY', 'Visits registry', 12, '/patients/visits'), - (230, 'Break Even Reference','TREE.BREAK_EVEN_REFERENCE','Break Even Reference', 1,'/break_even_reference'), - (231, 'Break-even Report', 'TREE.BREAK_EVEN_REPORT', 'Break-even Report', 144, '/reports/breakEven'), - (232, 'Break Even By Fee Center', 'TREE.BREAK_EVEN_FEE_CENTER_REPORT', 'Break-even By Fee Center Report', 144, '/reports/breakEvenFeeCenter'), - (233, 'Dashboards Folder', 'TREE.DASHBOARDS.TITLE', 'Tableaux de bord', 0, '/DASHBOARDS_FOLDER'), - (234, 'Indicators Files Registry', 'TREE.DASHBOARDS.INDICATORS_FILES_REGISTRY', 'Registre des fiches des indicateurs', 233, '/dashboards/indicators_files_registry'), - (235, 'Hospitalization dashboard', 'TREE.DASHBOARDS.HOSPITALIZATION', 'Tableau de bord des hospitalisations', 233, '/dashboards/hospitalization'), - (236, 'Human Resources dashboard', 'TREE.DASHBOARDS.HUMAN_RESOURCES', 'Tableau de bord du Personnel', 233, '/dashboards/staff'), - (237, 'Finances dashboard', 'TREE.DASHBOARDS.FINANCES', 'Tableau de bord des finances', 233, '/dashboards/finances'), - (238, 'Indicators report', 'TREE.INDICATORS_REPORT', 'Rapport sur les indicateurs', 144, '/reports/indicatorsReport'), - (239, 'Visits Report', 'TREE.VISITS_REPORT', 'Visits registry', 144, '/reports/visit_report'), - (240, '[Stock] Stock Entry Report','TREE.STOCK_ENTRY_REPORT','Stock Entry Report', 144,'/reports/stock_entry'), - (241, 'Entity Folder', 'ENTITY.MANAGEMENT', 'Entity Folder', 0, '/ENTITY_FOLDER'), - (242, 'Entity Management','ENTITY.MANAGEMENT','',241,'/entities'), - (243, 'Entity Group', 'ENTITY.GROUP.TITLE', 'Entity Group', 241, '/entity_group'), - (244, 'Monthly Balance', 'TREE.MONTHLY_BALANCE', 'Monthly Balance', 144, '/reports/monthlyBalance'), - (245, 'Debtor summary report', 'REPORT.DEBTOR_SUMMARY.TITLE', 'Debtor summary report', 144, '/reports/debtorSummary'), - (246, 'Client debts report', 'TREE.CLIENT_DEBTS_REPORT', 'Client debts report', 144, '/reports/clientDebts'), - (247, 'Client support report', 'TREE.CLIENT_SUPPORT_REPORT', 'Client support report', 144, '/reports/clientSupport'), - (248, 'Analysis of cashboxes', 'REPORT.ANALYSIS_AUX_CASHBOXES.TITLE', 'Analysis of auxiliary cashboxes', 144, '/reports/analysisAuxiliaryCash'), - (249, 'Realized Profit Report', 'TREE.REALIZED_PROFIT_REPORT', 'Realized profit report', 144, '/reports/realizedProfit'), - (250, 'Sytem usage statistic', 'REPORT.SYSTEM_USAGE_STAT.TITLE', 'Sytem usage statistic', 144, '/reports/systemUsageStat'), - (251, 'indexes', 'TREE.INDEXES','The payrall-index', 57,'/PAYROLL_INDEX_FOLDER'), - (252, 'Staffing indexes management','TREE.STAFFING_INDICES_MANAGEMENT','Staffing indices management',251 ,'/staffing_indices'), - (253, 'Multiple Payroll by indice','TREE.MULTI_PAYROLL_INDICE','Multiple Payroll (indice)', 251,'/multiple_payroll_indice'), - (254, 'Data Collection', 'TREE.DATA_COLLECTION', '', 0, '/data_collection'), - (255, 'Fill Form', 'TREE.FILL_FORM', '', 254, '/fill_form'), - (256, 'Display Metadata', 'TREE.DISPLAY_METADATA', '', 254, '/display_metadata'), - (257, 'Data Kit', 'TREE.DATA_KIT', 'Data Kit', 254, '/data_kit'), - (258, 'Data Collector Management', 'TREE.FORMS_MANAGEMENT', '', 257, '/data_collector_management'), - (259, 'Choices list management', 'TREE.CHOICES_LIST_MANAGEMENT', '', 257, '/choices_list_management'), - (260, 'Survey Form', 'TREE.FORMS_CONFIGURATION', '', 257, '/survey_form'), - (261, 'Data Kit Report', 'TREE.DATA_KIT_REPORT', 'Data Kit Report', 144, '/reports/dataKit'), - (262, 'Stock Requisition','TREE.STOCK_REQUISITION','Stock Requisition', 160,'/stock/requisition'), - (263, 'Configuration Analysis Tools','TREE.CONFIGURATION_ANALYSIS_TOOLS','Configuration Analysis Tools', 1,'/configuration_analysis_tools'), - (264, 'Configurable Analysis Report','TREE.CONFIGURABLE_ANALYSIS_REPORT','Configurable Analysis Report', 144,'/reports/configurable_analysis_report'), - (265, 'Purchase order analysis', 'TREE.PURCHASE_ORDER_ANALYSIS', 'Purchase order analysis', 144, '/reports/purchaseOrderAnalysis'), - (266, 'Inventory Changes Report', 'REPORT.INVENTORY_CHANGE.TITLE', 'Inventory Changes Report', 144, '/reports/inventoryChanges'), - (267, 'Monthly consumption report', 'TREE.MONTHLY_CONSUMPTION', 'Monthly consumption report', 144, '/reports/monthlyConsumptionReport'), - (268, '[Stock] Consumption graph','TREE.STOCK_CONSUMPTION_GRAPH_REPORT','Stock Consumption graph report', 144,'/reports/stock_consumption_graph_report'), - (269, 'Inventory Adjustment', 'TREE.INVENTORY_ADJUSTMENT', 'Inventory Adjustment', 160, '/stock/inventory-adjustment'), - (270, 'compare invoiced to received','TREE.COMPARE_INVOICED_RECEIVED','Compare invoiced items to received stock', 144,'/reports/invoicedReceivedStock'), - (271, 'Collection Capacity Report', 'TREE.COLLECTION_CAPACITY_REPORT', 'Collection Capacity Report', 144, '/reports/collectionCapacity'); + (0,'Root','TREE.ROOT','The unseen root node',NULL,'/root'), + (1,'Admin','TREE.ADMIN','The Administration Super-Category',0,'/ADMIN_FOLDER'), + (2,'Enterprise','TREE.ENTERPRISE','Manage the registered enterprises from here',1,'/enterprises'), + (3,'Invoice Registry','TREE.INVOICE_REGISTRY','Invoice Registry',5,'/invoices'), + (4,'Users & Permissions','TREE.USERS','Manage user privileges and permissions',1,'/users'), + (5,'Finance','TREE.FINANCE','The Finance Super-Category',0,'/FINANCE_FOLDER'), + (6,'Account','TREE.ACCOUNT','Chart of Accounts management',5,'/accounts'), + (9,'Posting Journal','TREE.POSTING_JOURNAL','Daily Log',5,'/journal'), + (10,'General Ledger','TREE.GENERAL_LEDGER','Posted Journal Data',5,'/general_ledger'), + (12,'Hospital','TREE.HOSPITAL','The Hospital Super-Category',0,'/HOSPITAL_FOLDER'), + (13,'Fiscal Year','TREE.FISCAL_YEAR','Fiscal year configuration page',5,'/fiscal'), + (14,'Patient Registration','TREE.PATIENT_REGISTRATION','Register patients',12,'/patients/register'), + (15,'Patient Registry','TREE.PATIENT_REGISTRY','Patient Registry',12,'/patients'), + (16,'Patient Invoice','TREE.PATIENT_INVOICE','Create an invoice for a patient',5,'/invoices/patient'), + (18,'Cash Window','TREE.CASH_WINDOW','Cash payments against past or future invoices',5,'/cash'), + (19,'Register Supplier','TREE.REGISTER_SUPPLIER','',1,'/suppliers'), + (20,'Depot Management','DEPOT.TITLE','',160,'/depots'), + (21,'Price List','TREE.PRICE_LIST','Configure price lists!',1,'/prices'), + (26,'Location Manager','TREE.LOCATION','',1,'/locations'), + (29,'Patient Group','TREE.PATIENT_GRP','',1,'/patients/groups'), + (48,'Service Management','TREE.SERVICE','',1,'/services'), + (57,'Human Resources','TREE.HUMANS_RESSOURCES','',0,'/PAYROLL_FOLDER'), + (61,'Employee','TREE.EMPLOYEE','Employees Registration',57,'/employees/register'), + (62,'Employee Registry','TREE.EMPLOYEE_REGISTRY','',57,'/employees'), + (82,'Subsidies','TREE.SUBSIDY','Handles the subsidy situation',1,'/subsidies'), + (105,'Cashbox Management','TREE.CASHBOX_MANAGEMENT','',1,'/cashboxes'), + (107,'Debtor Groups Management','TREE.DEBTOR_GROUP','Debtor Groups Management module',1,'/debtors/groups'), + (134,'Simple Journal Vouchers','TREE.SIMPLE_VOUCHER','Creates a simple transfer slip between two accounts',5,'/vouchers/simple'), + (135,'Invoicing Fee','TREE.INVOICING_FEES','Configures invoicing Fee for bhima',1,'/invoicing_fees'), + (137,'Complex Journal Vouchers','TREE.COMPLEX_JOURNAL_VOUCHER','Complex Journal vouchers module',5,'/vouchers/complex'), + (138,'Inventory Module','TREE.INVENTORY','Inventory management module',0,'/INVENTORY_FOLDER'), + (139,'Inventory Registry','TREE.INVENTORY_REGISTRY','Inventory Registry module',138,'/inventory'), + (140,'Inventory Configurations','TREE.INVENTORY_CONFIGURATION','Inventory configuration module',138,'/inventory/configuration'), + (141,'Vouchers Records','TREE.VOUCHER_REGISTRY','Vouchers registry module',5,'/vouchers'), + (143,'Transaction Type Module','TREE.TRANSACTION_TYPE','This module is responsible for managing transaction type',1,'/transaction_type'), + (145,'Cashflow','TREE.CASHFLOW','The Cashflow Report',281,'/reports/cashflow'), + (146,'Creditor Groups Management','TREE.CREDITOR_GROUP','Creditor Groups Management module',1,'/creditors/groups'), + (147,'Cash Payment Registry','TREE.CASH_PAYMENT_REGISTRY','Cash Payment Registry',5,'/payments'), + (149,'Cash Report','TREE.CASH_REPORT','The report of cash entry and exit',281,'/reports/cash_report'), + (150,'Balance Sheet','TREE.BALANCE_REPORT','Balance report module',281,'/reports/balance_report'), + (151,'Aged Debtors','TREE.AGED_DEBTORS','Aged Debtors',281,'/reports/aged_debtors'), + (152,'Account report','TREE.REPORT_ACCOUNTS','The report accounts',281,'/reports/account_report'), + (153,'Report Cashflow by Service','TREE.CASHFLOW_BY_SERVICE','CashflowByService',281,'/reports/cashflowByService'), + (154,'Purchase Order','TREE.PURCHASE_ORDER','Purchase order folder',0,'/PURCHASE_FOLDER'), + (155,'Purchase','TREE.PURCHASE','The purchase module',154,'/purchases/create'), + (156,'Purchase Registry','TREE.PURCHASE_REGISTRY','The purchase registry',154,'/purchases'), + (157,'Open Debtors','REPORT.OPEN_DEBTORS.TREE','Open Debtors',281,'/reports/open_debtors'), + (160,'Stock','TREE.STOCK','The stock management module',0,'/STOCK_FOLDER'), + (161,'Stock Lots','TREE.STOCK_LOTS','The stock lots registry',160,'/stock/lots'), + (162,'Stock Movements','TREE.STOCK_MOVEMENTS','The stock lots movements registry',160,'/stock/movements'), + (163,'Stock Inventory','TREE.STOCK_INVENTORY','The stock inventory registry',160,'/stock/inventories'), + (164,'Stock Exit','STOCK.EXIT','The stock exit module',160,'/stock/exit'), + (165,'Stock Entry','STOCK.ENTRY','The stock entry module',160,'/stock/entry'), + (167,'Stock Adjustment','STOCK.ADJUSTMENT','The stock adjustment module',160,'/stock/adjustment'), + (168,'Aged Creditors','TREE.AGED_CREDITORS','Aged Creditors',281,'/reports/aged_creditors'), + (170,'Account Statement','TREE.ACCOUNT_STATEMENT','Account Statement Module',281,'/account_statement'), + (180,'Profit & Loss Statement','REPORT.PROFIT_AND_LOSS','The report of income and expenses',281,'/reports/income_expense'), + (181,'Stock Report','TREE.STOCK_REPORT','The report of inventories in stock',282,'/reports/inventory_report'), + (182,'Stock Sheet Report','TREE.STOCK_INVENTORY_REPORT','The report of an inventory in stock',282,'/reports/stock_sheet'), + (183,'Grade Management','TREE.GRADES','',57,'/grades'), + (184,'Job Title Management','TREE.PROFESSION','',57,'/functions'), + (185,'Payroll Rubric Management','TREE.PAYROLL_RUB_MANAGEMENT','',57,'/payroll/rubrics'), + (186,'Holidays Management','TREE.HOLIDAYS_MANAGEMENT','Holidays Management',57,'/holidays'), + (187,'Offdays Management','TREE.OFFDAYS_MANAGEMENT','Offdays Management',57,'/offdays'), + (188,'Tax IPR Management','TREE.IPR_MANAGEMENT','IPR Management',57,'/ipr_tax'), + (189,'IPR Tax Configuration','TREE.IPR_TAX_CONFIGURATION','IPR Tax Configuration',57,'/ipr_tax/configuration'), + (190,'Payroll Rubric Configuration','TREE.PAYROLL_RUB_CONFIGURATION','',57,'/payroll/rubric_configuration'), + (191,'Account Configuration','TREE.PAYROLL_ACCOUNT_CONFIGURATION','Account Configuration',57,'/payroll/account_configuration'), + (192,'Operating Accounts Report','TREE.OPERATING_ACCOUNT','The report of operating',281,'/reports/operating'), + (193,'Weekend Configuration','TREE.WEEKEND_CONFIGURATION','Weekend Configuration',57,'/payroll/weekend_configuration'), + (194,'Payroll Configuration','TREE.PAYROLL_CONFIGURATION','Payroll Configuration',57,'/payroll'), + (195,'Role Management','TREE.ROLE_MANAGEMENT','Roles Management',1,'/roles'), + (197,'Stock Exit Report','TREE.STOCK_EXIT_REPORT','Stock Exit Report',282,'/reports/stock_exit'), + (199,'Annual Clients Report','REPORT.CLIENTS.TITLE','Annual Clients Report',281,'/reports/annual-clients-report'), + (200,'Multiple Payroll','TREE.MULTI_PAYROLL','Multiple Payroll',57,'/multiple_payroll'), + (201,'Employee Standing Report','TREE.EMPLOYEE_STANDING_REPORT','Employee Standing Report',283,'/reports/employeeStanding'), + (202,'Patient Standing Report','TREE.PATIENT_STANDING_REPORT','Patient Standing Report',280,'/reports/patientStanding'), + (203,'Employees Configuration','TREE.PAYROLL_EMP_CONFIGURATION','',57,'/payroll/employee_configuration'), + (204,'Exchange Rate','TREE.EXCHANGE','',1,'/exchange'), + (205,'Account Reference Management','TREE.ACCOUNT_REFERENCE_MANAGEMENT','',1,'/account_reference'), + (206,'[OHADA] Bilan','TREE.OHADA_BALANCE_SHEET','',281,'/reports/ohada_balance_sheet_report'), + (207,'Account Reference Report','TREE.ACCOUNT_REFERENCE_REPORT','',281,'/reports/account_reference'), + (208,'Import Stock From File','TREE.IMPORT_STOCK_FROM_FILE','',160,'/stock/import'), + (209,'Accounts Report Multiple','TREE.REPORTS_MULTIPLE_ACCOUNTS','',281,'/reports/account_report_multiple'), + (210,'Unbalanced Invoice Payments','REPORT.UNPAID_INVOICE_PAYMENTS_REPORT.TITLE','',281,'/reports/unpaid-invoice-payments'), + (211,'Profit & Loss by Month','REPORT.PROFIT_AND_LOSS_BY_MONTH','The report of income and expenses',281,'/reports/income_expense_by_month'), + (213,'Stock Value Report','TREE.STOCK_VALUE','',282,'/reports/stock_value'), + (214,'[OHADA] Compte de resultat','TREE.OHADA_RESULT_ACCOUNT','',281,'/reports/ohada_profit_loss'), + (216,'Profit & Loss by Year','REPORT.PROFIT_AND_LOSS_BY_YEAR','The report of income and expenses',281,'/reports/income_expense_by_year'), + (217,'Tags','TREE.TAGS','',1,'/tags'), + (218,'Fee Center Management','TREE.FEE_CENTER_MANAGEMENT','',0,'/fee_center'), + (219,'Fee Center Management','TREE.FEE_CENTER','',218,'/fee_center'), + (220,'Distributions Fee Centers','TREE.DITRIBUTION_AUX_FEES_CENTERS','',218,'/distribution_center'), + (221,'Update Distributions','TREE.UPDATE_DISTRIBUTION','',218,'/distribution_center/update'), + (222,'Fee Center Report','TREE.FEE_CENTER_REPORT','Fee Center Report',286,'/reports/feeCenter'), + (223,'Distribution keys','TREE.DISTRIBUTION_KEYS','Distribution keys',218,'/distribution_center/distribution_key'), + (225,'Stock Assignment','ASSIGN.STOCK_ASSIGN','',160,'/stock/assign'), + (226,'Account Reference Type','TREE.ACCOUNT_REFERENCE_TYPE','Account Reference Type',1,'/account_reference_type'), + (227,'Ward Module','TREE.WARD','Ward folder',0,'/WARD_FOLDER'), + (228,'Ward Configurations','TREE.WARD_CONFIGURATION','Ward configuration module',227,'/ward/configuration'), + (229,'Visits Registry','TREE.VISITS_REGISTRY','Visits registry',12,'/patients/visits'), + (230,'Break Even Reference','TREE.BREAK_EVEN_REFERENCE','Break Even Reference',1,'/break_even_reference'), + (231,'Break Even Report','TREE.BREAK_EVEN_REPORT','Break-even Report',286,'/reports/breakEven'), + (232,'Break Even By Fee Center','TREE.BREAK_EVEN_FEE_CENTER_REPORT','Break-even By Fee Center Report',286,'/reports/breakEvenFeeCenter'), + (233,'Dashboards Folder','TREE.DASHBOARDS.TITLE','Tableaux de bord',0,'/DASHBOARDS_FOLDER'), + (234,'Indicators Files Registry','TREE.DASHBOARDS.INDICATORS_FILES_REGISTRY','Registre des fiches des indicateurs',233,'/dashboards/indicators_files_registry'), + (235,'Hospitalization dashboard','TREE.DASHBOARDS.HOSPITALIZATION','Tableau de bord des hospitalisations',233,'/dashboards/hospitalization'), + (236,'Human Resources dashboard','TREE.DASHBOARDS.HUMAN_RESOURCES','Tableau de bord du Personnel',233,'/dashboards/staff'), + (237,'Finances dashboard','TREE.DASHBOARDS.FINANCES','Tableau de bord des finances',233,'/dashboards/finances'), + (238,'Indicators report','TREE.INDICATORS_REPORT','Rapport sur les indicateurs',286,'/reports/indicatorsReport'), + (239,'Visits Report','TREE.VISITS_REPORT','Visits registry',280,'/reports/visit_report'), + (240,'[Stock] Stock Entry Report','TREE.STOCK_ENTRY_REPORT','Stock Entry Report',282,'/reports/stock_entry'), + (241,'Entity Folder','ENTITY.MANAGEMENT','Entity Folder',0,'/ENTITY_FOLDER'), + (242,'Entity Management','ENTITY.MANAGEMENT','',241,'/entities'), + (243,'Entity Group','ENTITY.GROUP.TITLE','Entity Group',241,'/entity_group'), + (244,'Monthly Analysis of Balance','TREE.MONTHLY_BALANCE','Monthly Balance',281,'/reports/monthlyBalance'), + (245,'Debtor Summary Report','REPORT.DEBTOR_SUMMARY.TITLE','Debtor summary report',281,'/reports/debtorSummary'), + (246,'Client Debts Report','TREE.CLIENT_DEBTS_REPORT','Client debts report',281,'/reports/clientDebts'), + (247,'Client Support Report','TREE.CLIENT_SUPPORT_REPORT','Client support report',281,'/reports/clientSupport'), + (248,'Analysis of Cashboxes','REPORT.ANALYSIS_AUX_CASHBOXES.TITLE','Analysis of auxiliary cashboxes',281,'/reports/analysisAuxiliaryCash'), + (249,'Realized Profit Report','TREE.REALIZED_PROFIT_REPORT','Realized profit report',281,'/reports/realizedProfit'), + (250,'System Usage Statistic','REPORT.SYSTEM_USAGE_STAT.TITLE','Sytem usage statistic',280,'/reports/systemUsageStat'), + (251,'Indexes','TREE.INDEXES','The payroll index',57,'/PAYROLL_INDEX_FOLDER'), + (252,'Staffing indexes management','TREE.STAFFING_INDICES_MANAGEMENT','Staffing indices management',251,'/staffing_indices'), + (253,'Multiple Payroll by Indice','TREE.MULTI_PAYROLL_INDICE','Multiple Payroll (indice)',251,'/multiple_payroll_indice'), + (254,'Data Collection','TREE.DATA_COLLECTION','',0,'/data_collection'), + (255,'Fill Form','TREE.FILL_FORM','',254,'/fill_form'), + (256,'Display Metadata','TREE.DISPLAY_METADATA','',254,'/display_metadata'), + (257,'Data Kit','TREE.DATA_KIT','Data Kit',254,'/data_kit'), + (258,'Data Collector Management','TREE.FORMS_MANAGEMENT','',257,'/data_collector_management'), + (259,'Choices List Management','TREE.CHOICES_LIST_MANAGEMENT','',257,'/choices_list_management'), + (260,'Survey Form','TREE.FORMS_CONFIGURATION','',257,'/survey_form'), + (261,'Data Kit Report','TREE.DATA_KIT_REPORT','Data Kit Report',284,'/reports/dataKit'), + (262,'Stock Requisition','TREE.STOCK_REQUISITION','Stock Requisition',160,'/stock/requisition'), + (263,'Configuration Analysis Tools','TREE.CONFIGURATION_ANALYSIS_TOOLS','Configuration Analysis Tools',1,'/configuration_analysis_tools'), + (264,'Configurable Analysis Report','TREE.CONFIGURABLE_ANALYSIS_REPORT','Configurable Analysis Report',281,'/reports/configurable_analysis_report'), + (265,'Purchase Order Analysis','TREE.PURCHASE_ORDER_ANALYSIS','Purchase order analysis',285,'/reports/purchaseOrderAnalysis'), + (266,'Inventory Changes Report','REPORT.INVENTORY_CHANGE.TITLE','Inventory Changes Report',287,'/reports/inventoryChanges'), + (267,'Monthly Consumption Report','TREE.MONTHLY_CONSUMPTION','Monthly consumption report',282,'/reports/monthlyConsumptionReport'), + (268,'[Stock] Consumption Graph','TREE.STOCK_CONSUMPTION_GRAPH_REPORT','Stock Consumption graph report',282,'/reports/stock_consumption_graph_report'), + (269,'Inventory Adjustment','TREE.INVENTORY_ADJUSTMENT','Inventory Adjustment',160,'/stock/inventory-adjustment'), + (270,'Compare Invoiced to Received','TREE.COMPARE_INVOICED_RECEIVED','Compare invoiced items to received stock',282,'/reports/invoicedReceivedStock'), + (271,'Recovery Capacity Report','TREE.COLLECTION_CAPACITY_REPORT','Collection Capacity Report',281,'/reports/collectionCapacity'), + (280,'Hospital Reports','TREE.REPORTS','reports for the hospital modules',12,'/HOSPITAL_FOLDER/reports'), + (281,'Finance Reports','TREE.REPORTS','reports for the accounting/finance module',5,'/FINANCE_FOLDER/reports'), + (282,'Stock Reports','TREE.REPORTS','reports for the stock modules',160,'/STOCK_FOLDER/reports'), + (283,'HR Reports','TREE.REPORTS','reports for the HR/Payroll modules',57,'/PAYROLL_FOLDER/reports'), + (284,'Data Kit Reports','TREE.REPORTS','reports for the data collection modules',254,'/data_collection/reports'), + (285,'Purchase Reports','TREE.REPORTS','reports for the purchasing modules',154,'/PURCHASE_FOLDER/reports'), + (286,'Fee Center Reports','TREE.REPORTS','reports for the fee center modules',218,'/fee_center/reports'), + (287,'Inventory Reports','TREE.REPORTS','reports for the inventory modules', 138,'/inventory/reports'); -- Reserved system account type INSERT INTO `account_category` VALUES diff --git a/server/models/migrations/next/migrate.sql b/server/models/migrations/next/migrate.sql index dee33b402f..461c9cb36a 100644 --- a/server/models/migrations/next/migrate.sql +++ b/server/models/migrations/next/migrate.sql @@ -90,3 +90,4 @@ ALTER TABLE `province` DROP INDEX `province_1`; ALTER TABLE `sector` DROP INDEX `sector_1`; ALTER TABLE `village` DROP INDEX `village_1`; + diff --git a/server/models/migrations/next/units.sql b/server/models/migrations/next/units.sql new file mode 100644 index 0000000000..b0da39d4bf --- /dev/null +++ b/server/models/migrations/next/units.sql @@ -0,0 +1,191 @@ +/* +Migration of the unit IDs to put reports in proper folders. +*/ + +INSERT IGNORE INTO unit (`id`, `name`, `key`, `description`, `parent`, `path`) VALUES + (280, 'Hospital Reports', 'TREE.REPORTS', 'reports for the hospital modules', 12, '/HOSPITAL_FOLDER/reports'), + (281, 'Finance Reports', 'TREE.REPORTS', 'reports for the accounting/finance module', 5, '/FINANCE_FOLDER/reports'), + (282, 'Stock Reports', 'TREE.REPORTS', 'reports for the stock modules', 160, '/STOCK_FOLDER/reports'), + (283, 'HR Reports', 'TREE.REPORTS', 'reports for the HR/Payroll modules', 57, '/PAYROLL_FOLDER/reports'), + (284, 'Data Kit Reports', 'TREE.REPORTS', 'reports for the data collection modules', 254, '/data_collection/reports'), + (285, 'Purchase Reports', 'TREE.REPORTS', 'reports for the purchasing modules', 154, '/PURCHASE_FOLDER/reports'), + (286, 'Fee Center Reports', 'TREE.REPORTS', 'reports for the fee center modules', 218, '/fee_center/reports'), + (287, 'Inventory Reports', 'TREE.REPORTS', 'reports for the inventory modules', 138, '/inventory/reports'); + +-- FINANCE + +-- Cash Flow +UPDATE `unit` SET `parent` = 281 WHERE id = 145; + +-- Cash Report +UPDATE `unit` SET `parent` = 281 WHERE id = 149; + +-- Balance Sheet Report +UPDATE `unit` SET name = "Balance Sheet", `parent` = 281 WHERE id = 150; + +-- Aged Debtors Report +UPDATE `unit` SET name = "Aged Debtors", `parent` = 281 WHERE id = 151; + +-- Account Report +UPDATE `unit` SET `parent` = 281 WHERE id = 152; + +-- Cashflow by Service +UPDATE `unit` SET `parent` = 281 WHERE id = 153; + +-- Open Debtors +UPDATE `unit` SET `parent` = 281 WHERE id = 157; + +-- Aged Creditors +UPDATE `unit` SET `parent` = 281 WHERE id = 168; + +-- Account Statement (Simple) +UPDATE `unit` SET `parent` = 281 WHERE id = 170; + +-- Profit and Loss Statement +UPDATE `unit` SET name = "Profit & Loss Statement", `parent` = 281 WHERE id = 180; + +-- Compte d'Exploitation (PCGC P&L) +UPDATE `unit` SET name = "Operating Accounts Report", `parent` = 281 WHERE id = 192; + +-- Annual Clients Report +UPDATE `unit` SET `parent` = 281 WHERE id = 199; + +-- Bilan (OHADA Balance Sheet +UPDATE `unit` SET `parent` = 281 WHERE id = 206; + +-- Account References Report +UPDATE `unit` SET `parent` = 281 WHERE id = 207; + +-- Account Statement (Multiple) +UPDATE `unit` SET `parent` = 281 WHERE id = 209; + +-- Monthly Analysis of Balance +UPDATE `unit` SET name = "Monthly Analysis of Balance", `parent` = 281 WHERE id = 244; + +-- Unpaid/Unbalanced Invoices Report +UPDATE `unit` SET `parent` = 281 WHERE id = 210; + +-- Proft and Loss by Month +UPDATE `unit` SET name = "Profit & Loss by Month", `parent` = 281 WHERE id = 211; + +-- Compte de Resultat (OHADA P&L) +UPDATE `unit` SET `parent` = 281 WHERE id = 214; + +-- Profit and Loss by Year +UPDATE `unit` SET name = "Profit & Loss by Year", `parent` = 281 WHERE id = 216; + +-- Monthly Analysis of the Balance Sheet +UPDATE `unit` SET name = "Monthly Analysis of Balance", `parent` = 281 WHERE id = 244; + +-- Debtor Summary Report +UPDATE `unit` SET `parent` = 281 WHERE id = 245; + +-- Client Debts Report +UPDATE `unit` SET `parent` = 281 WHERE id = 246; + +-- Debtor Summary Report +UPDATE `unit` SET `parent` = 281 WHERE id = 245; + +-- Client Debts Report +UPDATE `unit` SET `parent` = 281 WHERE id = 246; + +-- Client Support Report +UPDATE `unit` SET `parent` = 281 WHERE id = 247; + +-- Analysis of Auxiliary Cashboxes +UPDATE `unit` SET `parent` = 281 WHERE id = 248; + +-- Realized Profit Report +UPDATE `unit` SET `parent` = 281 WHERE id = 249; + +-- Recovery Capacity Report +UPDATE `unit` SET name = "Recovery Capacity Report", `parent` = 281 WHERE id = 271; + +-- Configurable Analysis Tools Report +UPDATE `unit` SET `parent` = 281 WHERE id = 264; + +-- HOSPITAL REPORTS + +-- Patient Standing Report +UPDATE `unit` SET `parent` = 280 WHERE id = 202; + +-- Visit Report +UPDATE `unit` SET `parent` = 280 WHERE id = 239; + +-- System Usage Statistics +UPDATE `unit` SET `parent` = 280 WHERE id = 250; + +-- STOCK REPORTS + +-- stock report +UPDATE `unit` SET `parent` = 282 WHERE id = 181; + +-- stock sheet report +UPDATE `unit` SET `parent` = 282 WHERE id = 182; + +-- stock exit report +UPDATE `unit` SET `parent` = 282 WHERE id = 197; + +-- stock value report +UPDATE `unit` SET `parent` = 282 WHERE id = 213; + +-- stock entry report +UPDATE `unit` SET `parent` = 282 WHERE id = 240; + +-- monthly consumption report +UPDATE `unit` SET `parent` = 282 WHERE id = 267; + +-- Consumption Graph +UPDATE `unit` SET `parent` = 282 WHERE id = 268; + +-- Compare Invoiced to Received Report +UPDATE `unit` SET `parent` = 282 WHERE id = 270; + +-- HR REPORTS + +-- Employee Standing Report +UPDATE `unit` SET `parent` = 283 WHERE id = 201; + +-- Data Kit Reports + +-- Data Collect Report +UPDATE `unit` SET `parent` = 284 WHERE id = 261; + +-- PURCHASE REPORTS + +-- Purchase Order Analysis +UPDATE `unit` SET `parent` = 285 WHERE id = 265; + +-- FEE CENTER REPORTS + +-- Fee Center Report +UPDATE `unit` SET `parent` = 286 WHERE id = 222; + +-- Break Even Report +UPDATE `unit` SET `parent` = 286 WHERE id = 231; + +-- Break Even By Fee Center Report +UPDATE `unit` SET `parent` = 286 WHERE id = 232; + +-- Indicator Report +UPDATE `unit` SET `parent` = 286 WHERE id = 238; + +-- INVENTORY REPORTS + +-- Inventory Changes Report +UPDATE `unit` SET `parent` = 287 WHERE id = 266; + + +-- remove previous report folder +DELETE FROM role_unit where unit_id = 144; +DELETE FROM unit WHERE id = 144; + +-- update roles to reflect new permissions +CREATE TEMPORARY TABLE ru AS + SELECT role_uuid, unit.parent as `unit_id` FROM role_unit JOIN unit ON role_unit.unit_id = unit.id; + +-- ALTER TABLE `role_unit` ADD CONSTRAINT `tmp_ru_unique_key` UNIQUE (`role_uuid`, `unit_id`); + +INSERT IGNORE INTO `role_unit` SELECT HUID(uuid()), role_uuid, unit_id FROM ru; + +DROP TEMPORARY TABLE `ru`;