-- Table structure for table `role_signature_assignments`
--

CREATE TABLE `role_signature_assignments` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `role_id` int(11) unsigned NOT NULL,
  `template_id` int(11) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_role_assignment` (`role_id`),
  KEY `idx_template_id` (`template_id`),
  CONSTRAINT `role_signature_assignments_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `email_signature_templates` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `role_signature_assignments`
--

set autocommit=0;
commit;

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `description` text DEFAULT NULL,
  `is_system` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=135 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `roles`
--

set autocommit=0;
INSERT INTO `roles` VALUES
(1,'Admin','System Administrator - Full Access',1,'2025-10-26 14:24:24','2025-11-01 15:08:04'),
(70,'Accounts Payable Manager','Full AP module access including vendor management, payment approvals, and AP reporting.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(72,'Accounts Receivable Manager','Full AR module access including customer payments, credit management, and AR reporting.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(76,'VP/Director of Sales','Full sales and CRM access with pricing approval, discount authority, and team management.',0,'2025-11-08 17:16:14','2025-11-15 12:33:55'),
(77,'Sales Manager','Sales team and account management',0,'2025-11-08 17:16:14','2025-11-11 13:53:56'),
(78,'Sales Representative','Customer relationship management and order processing',0,'2025-11-08 17:16:14','2025-11-11 13:53:56'),
(79,'Customer Service Manager','Full customer service access including ticket management, returns, and CS reporting.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(80,'Customer Service Representative','Handle support tickets, process returns, view customer information.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(81,'VP/Director of Operations','Full operations access including inventory, purchasing, and warehouse management.',0,'2025-11-08 17:16:14','2025-11-15 12:33:55'),
(82,'Warehouse Manager','Manage inventory, approve transfers and adjustments, warehouse reporting.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(85,'Purchasing Manager','Full purchasing access including supplier management, PO approvals, and procurement reports.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(87,'Inventory Controller','Manage inventory levels, reorder points, stock adjustments, and inventory reporting.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(88,'VP/Director of Manufacturing','Full manufacturing access including production planning, BOM management, and MRP.',0,'2025-11-08 17:16:14','2025-11-15 12:33:55'),
(92,'Quality Manager','Full quality control access including inspection plans, non-conformance management, and quality reports.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(93,'Quality Inspector','Perform inspections, record test results, create NCRs. Cannot modify inspection plans.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(96,'HR Coordinator','Employee records, recruitment coordination, training scheduling. No compensation access.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(97,'Recruiting Manager','Full recruitment module access including job postings, interviews, offers, and hiring reports.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(99,'Payroll Manager','Full payroll access with tax filing and payroll reporting.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(100,'System Administrator','Full system access including security, configuration, integrations, and system reports.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(101,'IT Manager','User management, system configuration, backup management, and IT dashboards.',0,'2025-11-08 17:16:14','2025-11-08 17:16:14'),
(108,'CEO','Chief Executive Officer - Full strategic oversight and business administration',0,'2025-11-11 13:50:13','2025-11-11 13:50:13'),
(110,'CFO','Chief Financial Officer - Complete financial oversight and control',0,'2025-11-11 13:53:56','2025-11-11 13:53:56'),
(111,'CTO','Chief Technology Officer',0,'2025-11-15 11:52:00','2025-11-15 11:52:00'),
(112,'COO','Chief Operating Officer - Operations, manufacturing, and supply chain oversight',0,'2025-11-11 13:53:56','2025-11-11 13:53:56'),
(116,'VP/Director of HR','Human resources and talent management',0,'2025-11-11 13:53:56','2025-11-15 12:33:55'),
(121,'Controller','Senior accounting oversight and financial reporting',0,'2025-11-11 13:53:56','2025-11-11 13:53:56'),
(126,'Software Engineer','Software development and technical implementation',0,'2025-11-11 13:53:56','2025-11-11 13:53:56'),
(127,'Product Manager','Product strategy and roadmap management',0,'2025-11-11 13:53:56','2025-11-11 13:53:56'),
(130,'President, Batteries &amp;amp; Tech','President of Batteries &amp;amp; Tech division, reports to CTO',0,'2025-11-15 11:54:33','2025-11-24 18:21:29'),
(131,'VP/Director of Production','VP or Director of Production - manages production operations and team',0,'2025-11-15 12:35:17','2025-11-15 12:35:17'),
(132,'VP/Director of Business Development','VP or Director of Business Development - handles new business and partnerships',0,'2025-11-15 12:35:17','2025-11-15 12:35:17'),
(133,'VP/Director of Autonomous Systems','VP or Director of Autonomous Systems - leads autonomous technology initiatives',0,'2025-11-15 12:35:17','2025-11-15 12:35:17'),
(134,'Test Role','Used to Test Security',0,'2025-11-30 14:10:19','2025-11-30 14:10:19');
commit;

--
-- Table structure for table `sales_order_items`
--

CREATE TABLE `sales_order_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` int(10) unsigned NOT NULL,
  `product_id` int(10) unsigned DEFAULT NULL,
  `description` text DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `shipped_quantity` decimal(10,2) DEFAULT 0.00,
  `unit_price` decimal(15,2) NOT NULL,
  `tax_rate` decimal(5,2) DEFAULT 0.00,
  `discount_percent` decimal(5,2) DEFAULT 0.00,
  `line_total` decimal(15,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `order_id` (`order_id`),
  KEY `product_id` (`product_id`),
  CONSTRAINT `sales_order_items_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `sales_orders` (`id`) ON DELETE CASCADE,
  CONSTRAINT `sales_order_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sales_order_items`
--

set autocommit=0;
commit;

--
-- Table structure for table `sales_orders`
--

CREATE TABLE `sales_orders` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `order_number` varchar(50) NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `order_date` date NOT NULL,
  `delivery_date` date DEFAULT NULL,
  `status` enum('draft','confirmed','processing','shipped','delivered','cancelled') DEFAULT 'draft',
  `subtotal` decimal(15,2) DEFAULT 0.00,
  `tax_amount` decimal(15,2) DEFAULT 0.00,
  `discount_amount` decimal(15,2) DEFAULT 0.00,
  `shipping_cost` decimal(15,2) DEFAULT 0.00,
  `total_amount` decimal(15,2) DEFAULT 0.00,
  `notes` text DEFAULT NULL,
  `created_by` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `order_number` (`order_number`),
  KEY `customer_id` (`customer_id`),
  KEY `created_by` (`created_by`),
  KEY `idx_deleted_at` (`deleted_at`),
  KEY `idx_search_status` (`status`,`order_date`),
  FULLTEXT KEY `ft_order_search` (`order_number`,`notes`),
  CONSTRAINT `sales_orders_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  CONSTRAINT `sales_orders_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sales_orders`
--

set autocommit=0;
INSERT INTO `sales_orders` VALUES
(16,'SO-2025-11-16-0001',46,'2025-11-16',NULL,'draft',1000.00,100.00,0.00,0.00,1100.00,NULL,1,'2025-11-16 13:27:53','2025-11-16 13:27:53',NULL),
(17,'SO-2025-11-16-0002',46,'2025-11-16',NULL,'draft',8500.00,850.00,0.00,0.00,9350.00,'Website project',1,'2025-11-16 14:28:22','2025-11-16 14:28:22',NULL),
(18,'SO-2025-11-16-0003',46,'2025-11-16',NULL,'draft',2500.00,250.00,0.00,0.00,2750.00,'Service package',1,'2025-11-16 15:01:01','2025-11-16 15:01:01',NULL),
(19,'SO-2025-11-16-0004',46,'2025-11-16',NULL,'draft',15000.00,1500.00,0.00,0.00,16500.00,'Large infrastructure deal',1,'2025-11-16 15:06:36','2025-11-16 15:06:36',NULL),
(20,'SO-2025-11-16-0005',46,'2025-11-16',NULL,'draft',750.00,75.00,0.00,0.00,825.00,'Quick deal',1,'2025-11-16 19:22:19','2025-11-16 19:22:19',NULL);
commit;

--
-- Table structure for table `saved_searches`
--

CREATE TABLE `saved_searches` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `name` varchar(100) NOT NULL COMMENT 'User-friendly name for saved search',
  `category` varchar(50) NOT NULL,
  `query` varchar(500) DEFAULT NULL,
  `filters` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Advanced filters (date range, status, etc.)' CHECK (json_valid(`filters`)),
  `is_default` tinyint(1) DEFAULT 0 COMMENT 'Load this search by default',
  `is_shared` tinyint(1) DEFAULT 0 COMMENT 'Share with other users',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_category` (`category`),
  KEY `idx_is_shared` (`is_shared`),
  CONSTRAINT `saved_searches_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='User saved searches and filters';

--
-- Dumping data for table `saved_searches`
--

set autocommit=0;
commit;

--
-- Table structure for table `search_history`
--

CREATE TABLE `search_history` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned DEFAULT NULL,
  `query` varchar(500) NOT NULL,
  `category` varchar(50) DEFAULT NULL COMMENT 'all, customers, products, invoices, etc.',
  `results_count` int(11) DEFAULT 0 COMMENT 'Number of results returned',
  `execution_time_ms` int(11) DEFAULT NULL COMMENT 'Query execution time in milliseconds',
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`,`created_at`),
  KEY `idx_query` (`query`(255)),
  KEY `idx_category` (`category`),
  KEY `idx_created_at` (`created_at`),
  CONSTRAINT `search_history_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Track search queries for analytics and suggestions';

--
-- Dumping data for table `search_history`
--

set autocommit=0;
commit;

--
-- Temporary table structure for view `search_performance_stats`
--

/*!50001 DROP VIEW IF EXISTS `search_performance_stats`*/;
/*!50001 CREATE VIEW `search_performance_stats` AS SELECT
 1 AS `category`,
  1 AS `total_searches`,
  1 AS `avg_results`,
  1 AS `avg_execution_time_ms`,
  1 AS `max_execution_time_ms`,
  1 AS `zero_result_searches`,
  1 AS `search_date` */;

--
-- Table structure for table `search_suggestions`
--

CREATE TABLE `search_suggestions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `query` varchar(255) NOT NULL,
  `category` varchar(50) DEFAULT NULL,
  `search_count` int(11) DEFAULT 1 COMMENT 'How many times this was searched',
  `click_count` int(11) DEFAULT 0 COMMENT 'How many times results were clicked',
  `last_searched_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `query` (`query`),
  KEY `idx_query` (`query`),
  KEY `idx_search_count` (`search_count` DESC),
  KEY `idx_category` (`category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Popular search queries for autocomplete suggestions';

--
-- Dumping data for table `search_suggestions`
--

set autocommit=0;
commit;

--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `setting_key` varchar(100) NOT NULL,
  `setting_value` text DEFAULT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `setting_key` (`setting_key`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `settings`
--

set autocommit=0;
INSERT INTO `settings` VALUES
(1,'corporate_email_domain','@mavrix.one','Corporate email domain for primary email addresses','2025-10-27 15:16:36','2025-11-11 14:05:48');
commit;

--
-- Table structure for table `shipment_items`
--

CREATE TABLE `shipment_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `shipment_id` int(10) unsigned NOT NULL,
  `product_id` int(10) unsigned NOT NULL,
  `sales_order_item_id` int(10) unsigned DEFAULT NULL,
  `quantity` decimal(10,2) NOT NULL,
  `serial_numbers` text DEFAULT NULL,
  `notes` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `shipment_id` (`shipment_id`),
  KEY `product_id` (`product_id`),
  KEY `sales_order_item_id` (`sales_order_item_id`),
  CONSTRAINT `shipment_items_ibfk_1` FOREIGN KEY (`shipment_id`) REFERENCES `shipments` (`id`) ON DELETE CASCADE,
  CONSTRAINT `shipment_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `shipment_items_ibfk_3` FOREIGN KEY (`sales_order_item_id`) REFERENCES `sales_order_items` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `shipment_items`
--

set autocommit=0;
commit;

--
-- Table structure for table `shipments`
--

CREATE TABLE `shipments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `shipment_number` varchar(50) NOT NULL,
  `sales_order_id` int(10) unsigned DEFAULT NULL,
  `invoice_id` int(10) unsigned DEFAULT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `shipment_date` date NOT NULL,
  `expected_delivery` date DEFAULT NULL,
  `carrier` varchar(100) DEFAULT NULL,
  `tracking_number` varchar(100) DEFAULT NULL,
  `shipping_method` varchar(100) DEFAULT NULL,
  `shipping_cost` decimal(15,2) DEFAULT 0.00,
  `shipping_address` text DEFAULT NULL,
  `shipping_city` varchar(100) DEFAULT NULL,
  `shipping_state` varchar(100) DEFAULT NULL,
  `shipping_zip` varchar(20) DEFAULT NULL,
  `shipping_country` varchar(100) DEFAULT NULL,
  `status` enum('pending','packed','shipped','in_transit','delivered','cancelled','returned') DEFAULT 'pending',
  `notes` text DEFAULT NULL,
  `packed_by` int(10) unsigned DEFAULT NULL,
  `shipped_by` int(10) unsigned DEFAULT NULL,
  `packed_at` timestamp NULL DEFAULT NULL,
  `shipped_at` timestamp NULL DEFAULT NULL,
  `delivered_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `shipment_number` (`shipment_number`),
  KEY `sales_order_id` (`sales_order_id`),
  KEY `invoice_id` (`invoice_id`),
  KEY `customer_id` (`customer_id`),
  KEY `created_by` (`created_by`),
  KEY `packed_by` (`packed_by`),
  KEY `shipped_by` (`shipped_by`),
  KEY `idx_shipments_deleted_at` (`deleted_at`),
  CONSTRAINT `shipments_ibfk_1` FOREIGN KEY (`sales_order_id`) REFERENCES `sales_orders` (`id`) ON DELETE SET NULL,
  CONSTRAINT `shipments_ibfk_2` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE SET NULL,
  CONSTRAINT `shipments_ibfk_3` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  CONSTRAINT `shipments_ibfk_4` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `shipments_ibfk_5` FOREIGN KEY (`packed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `shipments_ibfk_6` FOREIGN KEY (`shipped_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `shipments`
--

set autocommit=0;
commit;

--
-- Table structure for table `shortage_alerts`
--

CREATE TABLE `shortage_alerts` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` int(10) unsigned NOT NULL,
  `work_order_id` int(10) unsigned DEFAULT NULL,
  `safety_stock` decimal(15,3) DEFAULT 0.000,
  `reorder_point` decimal(15,3) DEFAULT 0.000,
  `current_stock` decimal(15,3) DEFAULT 0.000,
  `net_required` decimal(15,3) DEFAULT 0.000,
  `shortage_amount` decimal(15,3) NOT NULL,
  `priority` enum('low','medium','high','critical') DEFAULT 'medium',
  `status` enum('active','acknowledged','resolved') DEFAULT 'active',
  `resolution` varchar(255) DEFAULT NULL,
  `resolution_notes` text DEFAULT NULL,
  `resolved_by` int(10) unsigned DEFAULT NULL,
  `resolved_at` datetime DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_product` (`product_id`),
  KEY `idx_priority` (`priority`),
  KEY `idx_status` (`status`),
  KEY `idx_created_at` (`created_at`),
  KEY `work_order_id` (`work_order_id`),
  KEY `resolved_by` (`resolved_by`),
  KEY `idx_shortage_status_priority` (`status`,`priority`),
  CONSTRAINT `shortage_alerts_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  CONSTRAINT `shortage_alerts_ibfk_2` FOREIGN KEY (`work_order_id`) REFERENCES `work_orders` (`id`) ON DELETE CASCADE,
  CONSTRAINT `shortage_alerts_ibfk_3` FOREIGN KEY (`resolved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `shortage_alerts`
--

set autocommit=0;
commit;

--
-- Table structure for table `statement_history`
--

CREATE TABLE `statement_history` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `customer_id` int(10) unsigned NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `generation_method` enum('manual','automatic','email','bulk') DEFAULT 'manual',
  `generated_at` timestamp NULL DEFAULT current_timestamp(),
  `generated_by` int(10) unsigned DEFAULT NULL,
  `email_sent` tinyint(1) DEFAULT 0,
  `email_sent_at` timestamp NULL DEFAULT NULL,
  `pdf_generated` tinyint(1) DEFAULT 0,
  `pdf_path` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_customer` (`customer_id`),
  KEY `idx_generated_at` (`generated_at`),
  KEY `idx_period` (`start_date`,`end_date`),
  KEY `generated_by` (`generated_by`),
  CONSTRAINT `statement_history_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  CONSTRAINT `statement_history_ibfk_2` FOREIGN KEY (`generated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `statement_history`
--

set autocommit=0;
commit;

--
-- Table structure for table `stock_movements`
--

CREATE TABLE `stock_movements` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `movement_type` enum('in','out','adjustment','transfer','return','sale','purchase') NOT NULL,
  `quantity` decimal(15,4) NOT NULL COMMENT 'Positive for IN, negative for OUT',
  `cost_price` decimal(15,2) DEFAULT NULL COMMENT 'Unit cost at time of movement',
  `reference_type` varchar(50) DEFAULT NULL COMMENT 'Type of related document (e.g., purchase_order, sales_order)',
  `reference_id` int(10) unsigned DEFAULT NULL COMMENT 'ID of related document',
  `notes` text DEFAULT NULL,
  `movement_date` datetime NOT NULL DEFAULT current_timestamp(),
  `recorded_by` int(10) unsigned DEFAULT NULL COMMENT 'User ID who recorded the movement',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_product_id` (`product_id`),
  KEY `idx_location_id` (`location_id`),
  KEY `idx_movement_type` (`movement_type`),
  KEY `idx_movement_date` (`movement_date`),
  KEY `idx_reference` (`reference_type`,`reference_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_movements`
--

set autocommit=0;
commit;

--
-- Table structure for table `stock_transfers`
--

CREATE TABLE `stock_transfers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `transfer_number` varchar(50) NOT NULL,
  `product_id` int(10) unsigned NOT NULL,
  `from_location_id` int(10) unsigned NOT NULL,
  `to_location_id` int(10) unsigned NOT NULL,
  `quantity` decimal(15,4) NOT NULL,
  `status` enum('pending','in_transit','completed','cancelled') NOT NULL DEFAULT 'pending',
  `notes` text DEFAULT NULL,
  `requested_by` int(10) unsigned DEFAULT NULL COMMENT 'User who requested the transfer',
  `requested_date` datetime NOT NULL DEFAULT current_timestamp(),
  `shipped_by` int(10) unsigned DEFAULT NULL COMMENT 'User who shipped the transfer',
  `shipped_date` datetime DEFAULT NULL,
  `received_by` int(10) unsigned DEFAULT NULL COMMENT 'User who received the transfer',
  `received_date` datetime DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `transfer_number` (`transfer_number`),
  KEY `idx_product_id` (`product_id`),
  KEY `idx_from_location` (`from_location_id`),
  KEY `idx_to_location` (`to_location_id`),
  KEY `idx_status` (`status`),
  KEY `idx_requested_date` (`requested_date`),
  KEY `fk_transfers_requested_by` (`requested_by`),
  KEY `fk_transfers_shipped_by` (`shipped_by`),
  KEY `fk_transfers_received_by` (`received_by`),
  CONSTRAINT `fk_transfers_from_location` FOREIGN KEY (`from_location_id`) REFERENCES `locations` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_transfers_product` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_transfers_received_by` FOREIGN KEY (`received_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `fk_transfers_requested_by` FOREIGN KEY (`requested_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `fk_transfers_shipped_by` FOREIGN KEY (`shipped_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `fk_transfers_to_location` FOREIGN KEY (`to_location_id`) REFERENCES `locations` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_transfers`
--

set autocommit=0;
commit;

--
-- Table structure for table `supplier_bill_items`
--

CREATE TABLE `supplier_bill_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `bill_id` int(10) unsigned NOT NULL,
  `product_id` int(10) unsigned DEFAULT NULL,
  `description` text NOT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` decimal(15,2) NOT NULL,
  `tax_rate` decimal(5,2) DEFAULT 0.00,
  `line_total` decimal(15,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `bill_id` (`bill_id`),
  KEY `product_id` (`product_id`),
  CONSTRAINT `supplier_bill_items_ibfk_1` FOREIGN KEY (`bill_id`) REFERENCES `supplier_bills` (`id`) ON DELETE CASCADE,
  CONSTRAINT `supplier_bill_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `supplier_bill_items`
--

set autocommit=0;
commit;

--
-- Table structure for table `supplier_bills`
--

CREATE TABLE `supplier_bills` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `bill_number` varchar(50) NOT NULL,
  `supplier_invoice_number` varchar(100) DEFAULT NULL,
  `supplier_id` int(10) unsigned NOT NULL,
  `po_id` int(10) unsigned DEFAULT NULL,
  `grn_id` int(10) unsigned DEFAULT NULL,
  `bill_date` date NOT NULL,
  `due_date` date DEFAULT NULL,
  `status` enum('draft','pending','approved','paid','overdue','cancelled') DEFAULT 'draft',
  `subtotal` decimal(15,2) DEFAULT 0.00,
  `tax_amount` decimal(15,2) DEFAULT 0.00,
  `total_amount` decimal(15,2) DEFAULT 0.00,
  `paid_amount` decimal(15,2) DEFAULT 0.00,
  `balance` decimal(15,2) DEFAULT 0.00,
  `notes` text DEFAULT NULL,
  `created_by` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `bill_number` (`bill_number`),
  KEY `supplier_id` (`supplier_id`),
  KEY `po_id` (`po_id`),
  KEY `grn_id` (`grn_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `supplier_bills_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`),
  CONSTRAINT `supplier_bills_ibfk_2` FOREIGN KEY (`po_id`) REFERENCES `purchase_orders` (`id`) ON DELETE SET NULL,
  CONSTRAINT `supplier_bills_ibfk_3` FOREIGN KEY (`grn_id`) REFERENCES `goods_receipts` (`id`) ON DELETE SET NULL,
  CONSTRAINT `supplier_bills_ibfk_4` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `supplier_bills`
--

set autocommit=0;
commit;

--
-- Table structure for table `supplier_contracts`
--

CREATE TABLE `supplier_contracts` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `contract_number` varchar(50) NOT NULL,
  `supplier_id` int(10) unsigned NOT NULL,
  `title` varchar(255) NOT NULL,
  `contract_type` enum('supply','service','maintenance','other') DEFAULT 'supply',
  `start_date` date NOT NULL,
  `end_date` date DEFAULT NULL,
  `value` decimal(15,2) DEFAULT NULL,
  `currency` varchar(3) DEFAULT 'USD',
  `payment_terms` varchar(100) DEFAULT NULL,
  `renewal_terms` text DEFAULT NULL,
  `status` enum('draft','active','expiring','expired','terminated') DEFAULT 'draft',
  `terms_conditions` text DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_by` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `contract_number` (`contract_number`),
  KEY `supplier_id` (`supplier_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `supplier_contracts_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`),
  CONSTRAINT `supplier_contracts_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `supplier_contracts`
--

set autocommit=0;
commit;

--
-- Table structure for table `supplier_payments`
--

CREATE TABLE `supplier_payments` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `payment_number` varchar(50) NOT NULL,
  `supplier_id` int(10) unsigned NOT NULL,
  `bill_id` int(10) unsigned DEFAULT NULL,
  `payment_date` date NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `payment_method` enum('cash','check','credit_card','bank_transfer','other') NOT NULL,
  `reference` varchar(100) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_by` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `payment_number` (`payment_number`),
  KEY `supplier_id` (`supplier_id`),
  KEY `bill_id` (`bill_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `supplier_payments_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`),
  CONSTRAINT `supplier_payments_ibfk_2` FOREIGN KEY (`bill_id`) REFERENCES `supplier_bills` (`id`) ON DELETE SET NULL,
  CONSTRAINT `supplier_payments_ibfk_3` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `supplier_payments`
--

set autocommit=0;
commit;

--
-- Table structure for table `suppliers`
--

CREATE TABLE `suppliers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `company_name` varchar(255) NOT NULL,
  `contact_person` varchar(200) DEFAULT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `website` varchar(255) DEFAULT NULL,
  `tax_id` varchar(50) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `zip` varchar(20) DEFAULT NULL,
  `country` varchar(100) DEFAULT NULL,
  `payment_terms` varchar(100) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL,
  `is_1099_contractor` tinyint(1) DEFAULT 0 COMMENT 'Is this supplier a 1099 contractor?',
  `form_1099_type` enum('MISC','NEC','K','INT','DIV','R') DEFAULT NULL COMMENT '1099 form type',
  `tax_id_type` enum('EIN','SSN') DEFAULT 'EIN' COMMENT 'Tax ID type',
  `tax_id_verified` tinyint(1) DEFAULT 0 COMMENT 'Tax ID verified with W-9',
  `w9_received_date` date DEFAULT NULL COMMENT 'Date W-9 form was received',
  `w9_file_path` varchar(500) DEFAULT NULL COMMENT 'Path to W-9 document',
  `box_number` int(11) DEFAULT NULL COMMENT '1099 box number for categorization',
  PRIMARY KEY (`id`),
  KEY `idx_1099_contractor` (`is_1099_contractor`),
  KEY `idx_form_1099_type` (`form_1099_type`),
  KEY `idx_deleted_at` (`deleted_at`),
  FULLTEXT KEY `ft_supplier_search` (`company_name`,`email`)
) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `suppliers`
--

set autocommit=0;
commit;

--
-- Table structure for table `system_notes`
--

CREATE TABLE `system_notes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `note_type` varchar(50) NOT NULL,
  `subject` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `created_by` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_note_type` (`note_type`),
  KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `system_notes`
--

set autocommit=0;
INSERT INTO `system_notes` VALUES
(1,'deprecation','PurchasePaymentController Deprecated','The PurchasePaymentController (/purchases/payments) has been deprecated in favor of VendorPaymentController (/accounting/vendor-payments). \n    The VendorPaymentController provides enhanced features including:\n    - Check printing capability\n    - Multiple bill payment application\n    - Journal entry integration\n    - Payment status workflow (draft, printed, cleared, voided)\n    - Bank account management\n    \n    Legacy routes at /purchases/payments remain active for backwards compatibility but should be migrated to /accounting/vendor-payments.\n    Any new development should use VendorPaymentController.','2025-11-15 19:51:04',NULL);
commit;

--
-- Table structure for table `system_script_log`
--

CREATE TABLE `system_script_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `script_key` varchar(100) NOT NULL COMMENT 'Script identifier',
  `executed_by` int(10) unsigned NOT NULL COMMENT 'User who executed the script',
  `parameters` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Script parameters as JSON' CHECK (json_valid(`parameters`)),
  `success` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Execution success flag',
  `output` mediumtext DEFAULT NULL COMMENT 'Script output (up to 16MB)',
  `message` varchar(500) DEFAULT NULL COMMENT 'Result message',
  `executed_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_script_key` (`script_key`),
  KEY `idx_executed_by` (`executed_by`),
  KEY `idx_executed_at` (`executed_at`),
  CONSTRAINT `system_script_log_ibfk_1` FOREIGN KEY (`executed_by`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Logs system script executions for audit trail';

--
-- Dumping data for table `system_script_log`
--

set autocommit=0;
INSERT INTO `system_script_log` VALUES
(1,'scan_permissions',1,'{\"mode\":\"dry-run\"}',0,'sh: php: command not found','Script execution failed with exit code 127','2025-11-24 19:19:44'),
(2,'scan_permissions',1,'{\"mode\":\"dry-run\"}',0,'sh: php: command not found','Script execution failed with exit code 127','2025-11-24 19:21:23'),
(3,'scan_permissions',1,'{\"mode\":\"dry-run\"}',1,'PHP Warning:  Constant BASE_PATH already defined in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 17\n\nWarning: Constant BASE_PATH already defined in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 17\nPHP Warning:  session_name(): Session name cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 57\n\nWarning: session_name(): Session name cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 57\nPHP Warning:  session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 58\n\nWarning: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 58\nPHP Warning:  session_start(): Session cannot be started after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 65\n\nWarning: session_start(): Session cannot be started after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 65\n\n================================================================================\nPERMISSION SCANNER & SYNC UTILITY\nMODE: DRY RUN (no changes will be made)\n================================================================================\n\n📚 LOADING DATABASE PERMISSIONS\n--------------------------------------------------------------------------------\n  Loaded 373 permissions from database\n\n🔍 SCANNING CONTROLLERS\n--------------------------------------------------------------------------------\n  Scanned 143 controller files\n  Found 116 files with permission checks\n  Discovered 116 unique permissions\n\n📋 DISCOVERED PERMISSIONS REPORT\n--------------------------------------------------------------------------------\n  Permission                               Checks   Controllers\n--------------------------------------------------------------------------------\n\n  (CORE):\n  admin                                    86       ActionMenuEditorController,... ✓\n\n  1099_CONTRACTORS:\n  1099_contractors.export                  1        Form1099Controller ✓\n  1099_contractors.generate_reports        1        Form1099Controller ✓\n  1099_contractors.view                    1        Form1099Controller ✓\n  1099_contractors.view_payments           1        Form1099Controller ✓\n\n  ACCOUNTING:\n  accounting.approve                       2        ExpenseController ✓\n  accounting.create                        25       AccountController, BankAcco... ✓\n  accounting.customer_payments.create      2        CustomerPaymentController ✓\n  accounting.customer_payments.view        2        CustomerPaymentController ✓\n  accounting.delete                        10       BankAccountController, Budg... ✓\n  accounting.edit                          20       BankAccountController, Bank... ✓\n  accounting.vendor_payments.create        4        VendorPaymentController ✓\n  accounting.vendor_payments.delete        1        VendorPaymentController ✓\n  accounting.vendor_payments.edit          2        VendorPaymentController ✓\n  accounting.vendor_payments.print_checks  1        VendorPaymentController ✓\n  accounting.vendor_payments.view          3        VendorPaymentController ✓\n  accounting.vendor_payments.void          1        VendorPaymentController ✓\n  accounting.view                          35       AccountController, Accounti... ✓\n\n  ADMIN:\n  admin.settings                           1        PipedriveImportController ✓\n  admin.system_scripts                     3        SystemScriptsController ✓\n\n  AUDIT_LOGS:\n  audit_logs.view                          1        AuditLogController ✓\n\n  BANK_IMPORT:\n  bank_import.create                       2        BankImportController ✓\n  bank_import.delete                       1        BankImportController ✓\n  bank_import.edit                         2        BankImportController ✓\n  bank_import.import                       1        BankImportController ✓\n  bank_import.manage_rules                 4        BankImportController ✓\n  bank_import.view                         2        BankImportController ✓\n\n  CAMERA_AUDIT:\n  camera_audit.capture                     1        CameraAuditController ✓\n  camera_audit.delete                      1        CameraAuditController ✓\n  camera_audit.stations                    3        CameraAuditController ✓\n  camera_audit.verify                      1        CameraAuditController ✓\n  camera_audit.view                        3        CameraAuditController ✓\n\n  CRM:\n  crm.create                               6        ClientController, CompanyCo... ✓\n  crm.delete                               6        ClientController, CompanyCo... ✓\n  crm.edit                                 6       ','Script executed successfully','2025-11-24 19:22:27'),
(4,'sync_permissions_menu',1,'{\"mode\":\"dry-run\"}',1,'PHP Warning:  Constant BASE_PATH already defined in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 17\n\nWarning: Constant BASE_PATH already defined in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 17\nPHP Warning:  session_name(): Session name cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 57\n\nWarning: session_name(): Session name cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 57\nPHP Warning:  session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 58\n\nWarning: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 58\nPHP Warning:  session_start(): Session cannot be started after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 65\n\nWarning: session_start(): Session cannot be started after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 65\n\n================================================================================\nPERMISSION SYNC UTILITY\nMODE: DRY RUN (no changes will be made)\n================================================================================\n\n📱 CHECKING APP GRID PERMISSIONS\n--------------------------------------------------------------------------------\n  ✓ All App Grid items have permissions\n\n📋 CHECKING MENU ITEM PERMISSIONS\n--------------------------------------------------------------------------------\n  Found 6 menu items without permissions:\n\n  + ai-test.view (module: core) - View AI Assistant\n    URL: ai-test\n\n  + assumptions.view (module: core) - View Daily Update\n    URL: assumptions\n\n  + companies.view (module: core) - View Companies\n    URL: companies\n\n  + documentation.view (module: core) - View Documentation\n    URL: documentation\n\n  + network-monitor.view (module: core) - View Network Monitor\n    URL: network-monitor\n\n  + product-forecast.view (module: core) - View Product Configs\n    URL: product-forecast\n\n  Total to add: 6\n\n🔧 STANDARDIZING MODULE NAMES\n--------------------------------------------------------------------------------\n  ✓ No obvious standardization issues found\n\n\n================================================================================\nSYNC COMPLETE\n================================================================================\n\nThis was a dry run. Run with --live flag to apply changes.\n','Script executed successfully','2025-11-24 19:22:32'),
(5,'audit_menu_permissions',1,'[]',1,'PHP Warning:  Constant BASE_PATH already defined in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 17\n\nWarning: Constant BASE_PATH already defined in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 17\nPHP Warning:  session_name(): Session name cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 57\n\nWarning: session_name(): Session name cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 57\nPHP Warning:  session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 58\n\nWarning: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 58\nPHP Warning:  session_start(): Session cannot be started after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 65\n\nWarning: session_start(): Session cannot be started after headers have already been sent in /Users/rpmbbu/LocalPHPStorm/m1_erp_config/config.php on line 65\n\n================================================================================\nMENU ITEMS TO PERMISSIONS AUDIT\n================================================================================\n\n📋 MENU ITEMS ANALYSIS\n--------------------------------------------------------------------------------\n\nTOP_LEVEL:\n  - Dashboard → dashboard\n  - DEPARTMENTS → (no URL)\n  - TOOLS → (no URL)\n  - QUICK LINKS → (no URL)\n  - ADMIN → (no URL)\n  - APP GRID → (no URL)\n\nDEPARTMENTS:\n  - Accounting → #\n  - CRM → #\n  - Forecaster → (no URL)\n  - HR → #\n  - Inventory → #\n  - Manufacturing → #\n  - Purchases → #\n  - Sales → #\n\nCRM:\n  - Dashboard → crm/dashboard\n  - Activities → crm/activities\n  - Contacts → crm/contacts\n  - Companies → companies\n  - Email Marketing → email-marketing\n  - Opportunities → crm/opportunities\n  - NDAs → ndas\n  - Support → #\n  - Reports → crm/reports\n\nSupport:\n  - Tickets → crm/support\n  - FAQs → crm/faqs\n\nADMIN:\n  - Announcements → announcements\n  - Settings → #\n\nSettings:\n  - Administrative → (no URL)\n  - Automation → settings/automation\n  - Company Settings → #\n  - Financial Settings → #\n  - Location Settings → #\n  - System Configuration → #\n  - AI Assistant → ai-test\n  - Network Monitor → network-monitor\n\nCompany Settings:\n  - Company Info → settings/company\n  - Email Settings → settings/email\n  - Locations → locations\n  - Positions → hr/positions\n  - User Groups → settings/user-groups\n\nFinancial Settings:\n  - Cost Allocation → settings/cost-allocation\n  - Fiscal Year → settings/fiscal-year\n  - Payment Terms → settings/payment-terms\n  - PP&E Parameters → settings/ppe-parameters\n  - Tax Settings → settings/tax\n\nLocation Settings:\n  - Business Parameters → settings/business-parameters\n  - Facilities & Leasing → settings/facilities\n  - Payroll Settings → settings/payroll\n\nAccess & Roles:\n  - Audit Log → audit-logs\n  - Users → users\n  - Roles & Permissions → roles\n  - Specific Data Roles → data_access\n\nSystem Configuration:\n  - Action Menu Editor → settings/action-menus\n  - Dropdowns → #\n  - QuickBooks Mgmt → quickbooks\n  - System Scripts → admin/system-scripts\n  - Templates → #\n\nDropdowns:\n  - Operations → settings/dropdowns/operations\n  - Sales & CRM → settings/dropdowns/sales\n\nTemplates:\n  - NDA Templates → settings/nda-templates\n  - Terms & Conditions → settings/terms-conditions\n\nAccounting:\n  - Assets/Compliance → #\n  - Banking/Cash → #\n  - Core Accounting → #\n  - Multi-Currency → accounting/currency\n  - Operations → #\n  - Payments → (no URL)\n  - Recurring Transactions → /recurring\n  - Tax Management → #\n  - Reports → #\n\nCore Accounting:\n  - Chart of Accounts → accounting/accounts\n  - Journal Entries → accounting/journal\n  - General Ledger → accounting/ledger\n\nBanking/Cash:\n  - Bank Accounts → accounting/bank-accounts\n  - Bank Reconciliation → accounting/reconciliation\n\nOperations:\n  - Expenses → accounting/expenses\n  - Budgets → accounting/budgets\n\nAssets/Compliance:\n  - Fixed Assets → accounting/assets\n  - Depreciation → accounting/depreciation\n  - Period Closing → accounting/period\n\nReports:\n  - All Report Package → accounting/reports/package\n  - Balance Sheet → accounting/reports/balance-sheet\n  - Income Statement → accounting/reports/income-statement\n  - Cash Flow Statement → accounting/reports/cash-flow-statement\n  - Trial Balance → accounting/reports/trial-balance\n  - Aging Reports → accounting/reports/aging\n  - A/P Aging Detail → accounting/reports/ap-aging-detail\n  - A/R Aging Detail → accounting/reports/ar-aging-detail\n  - Payment Terms List → accounting/reports/payment-terms-list\n  - ','Script executed successfully','2025-11-24 19:22:44'),
(6,'cache_clear',1,'[]',1,'Cleared cache directory: /Users/rpmbbu/LocalPHPStorm/m1_erp_web/cache','Cache cleared successfully. Deleted 0 file(s).','2025-11-24 19:22:52'),
(7,'audit_menu_permissions',1,'[]',1,'\n\n\n\n\n================================================================================\nMENU ITEMS TO PERMISSIONS AUDIT\n================================================================================\n\n📋 MENU ITEMS ANALYSIS\n--------------------------------------------------------------------------------\n\nTOP_LEVEL:\n  - Dashboard → dashboard\n  - DEPARTMENTS → (no URL)\n  - TOOLS → (no URL)\n  - QUICK LINKS → (no URL)\n  - ADMIN → (no URL)\n  - APP GRID → (no URL)\n\nDEPARTMENTS:\n  - Accounting → #\n  - CRM → #\n  - Forecaster → (no URL)\n  - HR → #\n  - Inventory → #\n  - Manufacturing → #\n  - Purchases → #\n  - Sales → #\n\nCRM:\n  - Dashboard → crm/dashboard\n  - Activities → crm/activities\n  - Contacts → crm/contacts\n  - Companies → companies\n  - Email Marketing → email-marketing\n  - Opportunities → crm/opportunities\n  - NDAs → ndas\n  - Support → #\n  - Reports → crm/reports\n\nSupport:\n  - Tickets → crm/support\n  - FAQs → crm/faqs\n\nADMIN:\n  - Announcements → announcements\n  - Settings → #\n\nSettings:\n  - Administrative → (no URL)\n  - Automation → settings/automation\n  - Company Settings → #\n  - Financial Settings → #\n  - Location Settings → #\n  - System Configuration → #\n  - AI Assistant → ai-test\n  - Network Monitor → network-monitor\n\nCompany Settings:\n  - Company Info → settings/company\n  - Email Settings → settings/email\n  - Locations → locations\n  - Positions → hr/positions\n  - User Groups → settings/user-groups\n\nFinancial Settings:\n  - Cost Allocation → settings/cost-allocation\n  - Fiscal Year → settings/fiscal-year\n  - Payment Terms → settings/payment-terms\n  - PP&E Parameters → settings/ppe-parameters\n  - Tax Settings → settings/tax\n\nLocation Settings:\n  - Business Parameters → settings/business-parameters\n  - Facilities & Leasing → settings/facilities\n  - Payroll Settings → settings/payroll\n\nAccess & Roles:\n  - Audit Log → audit-logs\n  - Users → users\n  - Roles & Permissions → roles\n  - Specific Data Roles → data_access\n\nSystem Configuration:\n  - Action Menu Editor → settings/action-menus\n  - Dropdowns → #\n  - QuickBooks Mgmt → quickbooks\n  - System Scripts → admin/system-scripts\n  - Templates → #\n\nDropdowns:\n  - Operations → settings/dropdowns/operations\n  - Sales & CRM → settings/dropdowns/sales\n\nTemplates:\n  - NDA Templates → settings/nda-templates\n  - Terms & Conditions → settings/terms-conditions\n\nAccounting:\n  - Assets/Compliance → #\n  - Banking/Cash → #\n  - Core Accounting → #\n  - Multi-Currency → accounting/currency\n  - Operations → #\n  - Payments → (no URL)\n  - Recurring Transactions → /recurring\n  - Tax Management → #\n  - Reports → #\n\nCore Accounting:\n  - Chart of Accounts → accounting/accounts\n  - Journal Entries → accounting/journal\n  - General Ledger → accounting/ledger\n\nBanking/Cash:\n  - Bank Accounts → accounting/bank-accounts\n  - Bank Reconciliation → accounting/reconciliation\n\nOperations:\n  - Expenses → accounting/expenses\n  - Budgets → accounting/budgets\n\nAssets/Compliance:\n  - Fixed Assets → accounting/assets\n  - Depreciation → accounting/depreciation\n  - Period Closing → accounting/period\n\nReports:\n  - All Report Package → accounting/reports/package\n  - Balance Sheet → accounting/reports/balance-sheet\n  - Income Statement → accounting/reports/income-statement\n  - Cash Flow Statement → accounting/reports/cash-flow-statement\n  - Trial Balance → accounting/reports/trial-balance\n  - Aging Reports → accounting/reports/aging\n  - A/P Aging Detail → accounting/reports/ap-aging-detail\n  - A/R Aging Detail → accounting/reports/ar-aging-detail\n  - Payment Terms List → accounting/reports/payment-terms-list\n  - Production Reports → manufacturing/reports/production\n  - OEE Reports → manufacturing/reports/oee\n  - Report Builder → reports/custom/builder\n  - My Reports → reports/custom/my\n  - Shared Reports → reports/custom/shared\n  - Scheduled Reports → reports/custom/scheduled\n\nHR:\n  - Dashboard → hr/dashboard\n  - Employees → employees\n  - Recruitment → #\n  - Development → #\n  - Relations → #\n  - Attendance → hr/attendance\n  - Time Off → hr/timeoff\n  - Timesheets → hr/timesheets\n\nRecruitment:\n  - Dashboard → hr/recruitment/dashboard\n  - Job Positions → hr/recruitment/positions\n  - Applications → hr/recruitment/applications\n  - Interviews → hr/recruitment/interviews\n  - Assessments → hr/recruitment/assessments\n  - Offers → hr/recruitment/offers\n\nDevelopment:\n  - Contracts → hr/development/contracts\n  - Training → hr/development/training\n  - Performance Reviews → hr/development/reviews\n\nRelations:\n  - Issues & Challenges → hr/relations/issues\n  - Separations → hr/relations/separations\n\nInventory:\n  - Dashboard → inventory/dashboard\n  - Product Management → #\n  - Stock Levels → /inventory/stock-levels\n  - Lot/Serial Numbers → inventory/lots\n  - Visual Audits → /camera-audit\n\nProd','Script executed successfully','2025-11-24 19:24:19'),
(8,'audit_menu_permissions',1,'[]',1,'\n\n\n\n\n================================================================================\nMENU ITEMS TO PERMISSIONS AUDIT\n================================================================================\n\n📋 MENU ITEMS ANALYSIS\n--------------------------------------------------------------------------------\n\nTOP_LEVEL:\n  - Dashboard → dashboard\n  - DEPARTMENTS → (no URL)\n  - TOOLS → (no URL)\n  - QUICK LINKS → (no URL)\n  - ADMIN → (no URL)\n  - APP GRID → (no URL)\n\nDEPARTMENTS:\n  - Accounting → #\n  - CRM → #\n  - Forecaster → (no URL)\n  - HR → #\n  - Inventory → #\n  - Manufacturing → #\n  - Purchases → #\n  - Sales → #\n\nCRM:\n  - Dashboard → crm/dashboard\n  - Activities → crm/activities\n  - Contacts → crm/contacts\n  - Companies → companies\n  - Email Marketing → email-marketing\n  - Opportunities → crm/opportunities\n  - NDAs → ndas\n  - Support → #\n  - Reports → crm/reports\n\nSupport:\n  - Tickets → crm/support\n  - FAQs → crm/faqs\n\nADMIN:\n  - Announcements → announcements\n  - Settings → #\n\nSettings:\n  - Administrative → (no URL)\n  - Automation → settings/automation\n  - Company Settings → #\n  - Financial Settings → #\n  - Location Settings → #\n  - System Configuration → #\n  - AI Assistant → ai-test\n  - Network Monitor → network-monitor\n\nCompany Settings:\n  - Company Info → settings/company\n  - Email Settings → settings/email\n  - Locations → locations\n  - Positions → hr/positions\n  - User Groups → settings/user-groups\n\nFinancial Settings:\n  - Cost Allocation → settings/cost-allocation\n  - Fiscal Year → settings/fiscal-year\n  - Payment Terms → settings/payment-terms\n  - PP&E Parameters → settings/ppe-parameters\n  - Tax Settings → settings/tax\n\nLocation Settings:\n  - Business Parameters → settings/business-parameters\n  - Facilities & Leasing → settings/facilities\n  - Payroll Settings → settings/payroll\n\nAccess & Roles:\n  - Audit Log → audit-logs\n  - Users → users\n  - Roles & Permissions → roles\n  - Specific Data Roles → data_access\n\nSystem Configuration:\n  - Action Menu Editor → settings/action-menus\n  - Dropdowns → #\n  - QuickBooks Mgmt → quickbooks\n  - System Scripts → admin/system-scripts\n  - Templates → #\n\nDropdowns:\n  - Operations → settings/dropdowns/operations\n  - Sales & CRM → settings/dropdowns/sales\n\nTemplates:\n  - NDA Templates → settings/nda-templates\n  - Terms & Conditions → settings/terms-conditions\n\nAccounting:\n  - Dashboard → accounting\n  - Assets/Compliance → #\n  - Banking/Cash → #\n  - Core Accounting → #\n  - Multi-Currency → accounting/currency\n  - Operations → #\n  - Payments → (no URL)\n  - Recurring Transactions → /recurring\n  - Tax Management → #\n  - Reports → #\n\nCore Accounting:\n  - Chart of Accounts → accounting/accounts\n  - Journal Entries → accounting/journal\n  - General Ledger → accounting/ledger\n\nBanking/Cash:\n  - Bank Accounts → accounting/bank-accounts\n  - Bank Reconciliation → accounting/reconciliation\n\nOperations:\n  - Expenses → accounting/expenses\n  - Budgets → accounting/budgets\n\nAssets/Compliance:\n  - Fixed Assets → accounting/assets\n  - Depreciation → accounting/depreciation\n  - Period Closing → accounting/period\n\nReports:\n  - All Report Package → accounting/reports/package\n  - Balance Sheet → accounting/reports/balance-sheet\n  - Income Statement → accounting/reports/income-statement\n  - Cash Flow Statement → accounting/reports/cash-flow-statement\n  - Trial Balance → accounting/reports/trial-balance\n  - Aging Reports → accounting/reports/aging\n  - A/P Aging Detail → accounting/reports/ap-aging-detail\n  - A/R Aging Detail → accounting/reports/ar-aging-detail\n  - Payment Terms List → accounting/reports/payment-terms-list\n  - Production Reports → manufacturing/reports/production\n  - OEE Reports → manufacturing/reports/oee\n  - Report Builder → reports/custom/builder\n  - My Reports → reports/custom/my\n  - Shared Reports → reports/custom/shared\n  - Scheduled Reports → reports/custom/scheduled\n\nHR:\n  - Dashboard → hr/dashboard\n  - Employees → employees\n  - Recruitment → #\n  - Development → #\n  - Relations → #\n  - Attendance → hr/attendance\n  - Time Off → hr/timeoff\n  - Timesheets → hr/timesheets\n\nRecruitment:\n  - Dashboard → hr/recruitment/dashboard\n  - Job Positions → hr/recruitment/positions\n  - Applications → hr/recruitment/applications\n  - Interviews → hr/recruitment/interviews\n  - Assessments → hr/recruitment/assessments\n  - Offers → hr/recruitment/offers\n\nDevelopment:\n  - Contracts → hr/development/contracts\n  - Training → hr/development/training\n  - Performance Reviews → hr/development/reviews\n\nRelations:\n  - Issues & Challenges → hr/relations/issues\n  - Separations → hr/relations/separations\n\nInventory:\n  - Dashboard → inventory/dashboard\n  - Product Management → #\n  - Stock Levels → /inventory/stock-levels\n  - Lot/Serial Numbers → inventory/lots\n  - Visual Audits → /camera-audit\n\nProduct Management:\n  - Products → products\n  - Categories → inventory/categories\n\nManufacturing:\n  - Dashboard → manufacturing\n  - Capacity Planning → #\n  - Planning & Materials → #\n  - Production → #\n  - Resources → #\n  - Quality Control → #\n  - Maintenance → #\n  - Costing → #\n  - Reports → #\n\nCapacity Planning:\n  - Dashboard → manufacturing/capacity\n  - Real-time Status → manufacturing/capacity/machineStatus\n  - Analytics → manufacturing/capacity/analytics\n  - Availability → manufacturing/capacity/availability\n  - Feasibility → manufacturing/capacity/feasibility\n\nPlanning & Materials:\n  - Bill of Materials → manufacturing/boms\n  - MRP → manufacturing/mrp\n  - Production Scheduling → manufacturing/scheduling\n\nProduction:\n  - Work Orders → manufacturing/workorders\n  - Shop Floor Control → manufacturing/shopfloor\n\nResources:\n  - Business Lines → manufacturing/business-lines\n  - Equipment Lines → manufacturing/equipment-lines\n  - Equipment Units → manufacturing/equipment\n\nQuality Control:\n  - Dashboard → manufacturing/quality\n  - Inspections → manufacturing/quality/inspections\n  - NCR → manufacturing/quality/ncr\n  - Metrics → manufacturing/quality/metrics\n  - Templates → manufacturing/quality/templates\n\nMaintenance:\n  - Maintenance Schedules → manufacturing/maintenance/schedules\n  - Maintenance Work Orders → manufacturing/maintenance/work-orders\n  - Downtime Tracking → manufacturing/maintenance/downtime\n\nCosting:\n  - Production Costing → manufacturing/costing/production\n  - Job Costing → manufacturing/costing/jobs\n\nSales:\n  - Dashboard → sales/dashboard\n  - Sales Documents → #\n  - Fulfillment → #\n  - Configuration → #\n  - Reports → sales/reports\n\nSales Documents:\n  - Quotes → quotes\n  - Agreements → sales/agreements\n  - Orders → sales/orders\n  - Invoices → invoices\n  - Credit Notes → creditnotes\n\nFulfillment:\n  - Shipments → shipments\n  - Delivery Notes → sales/delivery_notes\n  - Returns (RMA) → sales/returns\n\nConfiguration:\n  - Pricing Rules → sales/pricing_rules\n  - Discounts & Promotions → sales/promotions\n\nPurchases:\n  - Dashboard → purchases/dashboard\n  - Suppliers → suppliers\n  - Procurement Process → #\n  - Payments & Documents → #\n  - Supplier Contracts → purchases/contracts\n  - Reports → purchases/reports\n\nSuppliers:\n  - Suppliers → suppliers\n  - 1099 Contractors → /suppliers?filter=1099\n\nProcurement Process:\n  - Purchase Requisitions → purchases/requisitions\n  - RFQs (Quotes) → purchases/rfqs\n  - Purchase Orders → purchases/orders\n  - Goods Receipt → purchases/receiving\n\nPayments & Documents:\n  - Bills/Invoices → purchases/bills\n  - Payments Made (Legacy) → purchases/payments\n  - Purchase Returns → purchases/returns\n  - Debit Notes → purchases/debit-notes\n\nTime Off:\n  - My Time Off → hr/timeoff/my\n  - All Requests → hr/timeoff/all\n  - Approve Requests → hr/timeoff/approve\n  - Time Off Types → hr/timeoff/types\n  - Accrual Rules → hr/timeoff/accruals\n\nTimesheets:\n  - My Timesheet → hr/timesheets/my\n  - All Timesheets → hr/timesheets/all\n  - Approve Timesheets → hr/timesheets/approve\n  - Timesheet Reports → hr/timesheets/reports\n\nLot/Serial Numbers:\n  - All Lots/Serials → inventory/lots/all\n  - Traceability → inventory/lots/traceability\n  - Expiration Dates → inventory/lots/expiration\n\nMulti-Currency:\n  - Currencies → accounting/currency/list\n  - Exchange Rates → accounting/currency/rates\n  - Currency Gains/Losses → accounting/currency/revaluation\n\nAutomation:\n  - AI Testing → ai-test\n  - Approval Rules → settings/automation/approvals\n  - Templates → automation/email-templates\n  - Scheduled Actions → settings/automation/scheduled\n  - Workflows → settings/automation/workflows\n\nProjects:\n  - Dashboard → projects/dashboard\n  - My Projects → projects/?my_projects=1\n  - My Tasks → projects/my-tasks\n  - Gantt Chart → projects/gantt\n  - Time Tracking → projects/time\n  - Resource Planning → projects/resources\n  - Project Profitability → projects/profitability\n\nFiles:\n  - All Files → /files\n  - My Files → /files?context=user\n  - Shared With Me → files/shared\n  - Accounting Files → /files?context=accounting\n  - Company Files → /files?context=company\n  - HR Documents → /files?context=hr\n  - Inventory Documents → /files?context=inventory\n  - Manufacturing Documents → /files?context=manufacturing\n  - Project Files → /files?context=project\n  - Purchases Documents → /files?context=purchases\n  - Sales Documents → /files?context=sales\n\nEmail Marketing:\n  - Dashboard → email-marketing/dashboard\n  - Campaigns → email-marketing/campaigns\n  - Email Templates → email-marketing/templates\n  - Mailing Lists → email-marketing/lists\n  - Automation → email-marketing/automation\n  - Analytics → email-marketing/analytics\n\nHelpdesk:\n  - Dashboard → helpdesk/dashboard\n  - Documentation → documentation\n  - Tickets → helpdesk/tickets\n  - My Tickets → helpdesk/my-tickets\n  - SLA Management → helpdesk/sla\n  - Knowledge Base → helpdesk/kb\n  - Live Chat → helpdesk/chat\n  - Reports → helpdesk/reports\n\nAPP GRID:\n  - DASHBOARD → dashboard\n  - CALENDAR → calendar\n  - EMPLOYEES → employees/directory\n  - PRODUCTS → products\n  - SALES → salesorders\n  - SETTINGS → settings\n\nTOOLS:\n  - Files → /files\n  - Helpdesk → helpdesk\n  - Projects → projects\n  - Reports → reports/custom\n\nTax Management:\n  - Tax Jurisdictions → /tax/jurisdictions\n  - Tax Payments → /tax/payments\n  - Tax Reports → /tax/reports/liability\n\nPayments:\n  - Customer Payments → /accounting/customer-payments\n  - Vendor Payments → /accounting/vendor-payments\n\nAdministrative:\n  - Access & Roles → #\n  - Document Mgmt → #\n  - Menu Mgmt → menus\n  - PHPmyadmin → /phpmyadmin\n  - System Backup → backup\n\nDocument Mgmt:\n  - Dashboard → nextcloud/admin/dashboard\n  - Activity Log → nextcloud/admin/activity\n  - Storage Report → nextcloud/admin/storage\n  - User Activity → nextcloud/admin/users\n  - Settings → nextcloud/settings\n\nForecaster:\n  - Getting Started → /product-forecast/getting-started\n  - Command Center → /product-forecast/command-center\n  - Daily Update → assumptions\n  - Assumption Sets → assumptions/sets\n  - Product Configs → product-forecast\n  - Generate Projections → product-forecast/generate\n  - Pro Forma Stmts → product-forecast/proforma\n  - Variance Tracking → /product-forecast/variance\n  - Sensitivity Analysis → product-forecast/sensitivity\n  - Compare Scenarios → product-forecast/compare\n  - Variance Report → assumptions/variance\n  - Advanced Tools → (no URL)\n  - Scenario Modeler → forecaster\n\nTotal menu items: 275\n\n🔐 PERMISSIONS ANALYSIS\n--------------------------------------------------------------------------------\n  (empty/top-level)               21 permissions\n  1099                             7 permissions\n  1099_contractors                 3 permissions\n  accounting                      48 permissions\n  admin                            3 permissions\n  audit                            2 permissions\n  automation                       1 permissions\n  bank_import                      8 permissions\n  credit_notes                     4 permissions\n  crm                             34 permissions\n  documents                        3 permissions\n  Forecasting                      7 permissions\n  helpdesk                         5 permissions\n  hr                              46 permissions\n  inventory                       31 permissions\n  manufacturing                   26 permissions\n  marketing                        8 permissions\n  nextcloud                        4 permissions\n  permissions                      1 permissions\n  procurement                      5 permissions\n  projects                         3 permissions\n  purchases                       24 permissions\n  recurring                        6 permissions\n  reports                          2 permissions\n  roles                            4 permissions\n  sales                           36 permissions\n  security                         5 permissions\n  settings                         2 permissions\n  statements                       4 permissions\n  system                           5 permissions\n  tax                             11 permissions\n  users                            4 permissions\n\nTotal permissions: 373\n\n⚠️  MISSING PERMISSIONS (Menu items without corresponding permissions)\n--------------------------------------------------------------------------------\n  Found 13 menu items without clear permission mappings:\n\n    - #\n    - companies\n    - documentation\n    - ai-test\n    - network-monitor\n    - assumptions\n    - assumptions/variance\n    - assumptions/sets\n    - product-forecast\n    - product-forecast/generate\n    - product-forecast/proforma\n    - product-forecast/compare\n    - product-forecast/sensitivity\n\n🗑️  ORPHANED PERMISSIONS (Permissions without menu items)\n--------------------------------------------------------------------------------\n  Found 75 permissions without clear menu mappings:\n\n    - 1099_contractors.manage (1099): Manage 1099 contractor designations\n    - 1099_contractors.view (1099): View 1099 contractors\n    - 1099_filings.file (1099): File 1099 forms\n    - 1099_filings.prepare (1099): Prepare 1099 forms\n    - 1099_payments.manage (1099): Manage 1099 payment classifications\n    - 1099_payments.view (1099): View 1099 reportable payments\n    - 1099_reports.view (1099): View 1099 reports\n    - 1099_contractors.export (1099_contractors): Export 1099 Contractors\n    - 1099_contractors.generate_reports (1099_contractors): Generate Reports 1099 Contractors\n    - 1099_contractors.view_payments (1099_contractors): View Payments 1099 Contractors\n    - audit_trail.export (audit): Export audit trail\n    - audit_trail.view (audit): View audit trail\n    - bank_import.categorize (bank_import): Categorize imported transactions\n    - bank_import.create (bank_import): Import bank transactions\n    - bank_import.delete (bank_import): Delete Bank Import\n    - bank_import.edit (bank_import): Edit Bank Import\n    - bank_import.import (bank_import): Import Bank Import\n    - bank_import.manage_rules (bank_import): Manage Rules Bank Import\n    - bank_import.rules (bank_import): Manage categorization rules\n    - bank_import.view (bank_import): View bank imports\n    ... and 55 more\n\n📱 APP GRID ANALYSIS\n--------------------------------------------------------------------------------\nApp Grid items:\n  - DASHBOARD (dashboard) → ✓ Has permission: dashboard.view\n  - CALENDAR (calendar) → ✓ Has permission: calendar.view\n  - EMPLOYEES (employees/directory) → ✓ Has permission: employees.view\n  - PRODUCTS (products) → ✓ Has permission: products.view\n  - SALES (salesorders) → ✓ Has permission: salesorders.view\n  - SETTINGS (settings) → ✓ Has permission: settings.view\n\nRECOMMENDATION: Create \'App Grid\' permission category in role editor\nThese should be DEFAULT permissions for all users:\n  ☑ DASHBOARD\n  ☑ CALENDAR\n  ☑ EMPLOYEES\n  ☑ PRODUCTS\n  ☑ SALES\n  ☑ SETTINGS\n\n💡 STANDARDIZATION RECOMMENDATIONS\n--------------------------------------------------------------------------------\n\nModule naming issues:\n  ✓ No obvious case inconsistencies found\n\n  ℹ️  21 permissions have empty module (top-level items)\n\nRECOMMENDATIONS:\n  1. Standardize all module names to lowercase\n  2. Add \'app_grid\' or \'quick_access\' module for App Grid items\n  3. Consider grouping top-level items (empty module) into \'core\' or \'general\'\n  4. Ensure every menu item has at least a \'view\' permission\n  5. Update role editor to show \'App Grid\' as first category\n\n\n================================================================================\nAUDIT COMPLETE\n================================================================================\n','Script executed successfully','2025-11-25 00:15:54'),
(9,'check_orphaned_files',1,'[]',1,'All files in uploads directory are referenced in database','No orphaned files found','2025-11-26 12:06:31'),
(10,'sync_permissions_menu',1,'{\"mode\":\"dry-run\"}',1,'\n\n\n\n\n================================================================================\nPERMISSION SYNC UTILITY\nMODE: DRY RUN (no changes will be made)\n================================================================================\n\n📱 CHECKING APP GRID PERMISSIONS\n--------------------------------------------------------------------------------\n  ✓ All App Grid items have permissions\n\n📋 CHECKING MENU ITEM PERMISSIONS\n--------------------------------------------------------------------------------\n  Found 6 menu items without permissions:\n\n  + agreements.view (module: core) - View Agreements\n    URL: agreements\n\n  + ai-test.view (module: core) - View AI Testing\n    URL: ai-test\n\n  + assumptions.view (module: core) - View Daily Update\n    URL: assumptions\n\n  + companies.view (module: core) - View Companies\n    URL: companies\n\n  + documentation.view (module: core) - View Documentation\n    URL: documentation\n\n  + product-forecast.view (module: core) - View Product Configs\n    URL: product-forecast\n\n  Total to add: 6\n\n🔧 STANDARDIZING MODULE NAMES\n--------------------------------------------------------------------------------\n  ✓ No obvious standardization issues found\n\n\n================================================================================\nSYNC COMPLETE\n================================================================================\n\nThis was a dry run. Run with --live flag to apply changes.\n','Script executed successfully','2025-11-26 12:06:40'),
(11,'sync_permissions_menu',1,'{\"mode\":\"live\"}',1,'\n\n\n\n\n================================================================================\nPERMISSION SYNC UTILITY\nMODE: LIVE (changes WILL be applied to database)\n================================================================================\n\n📱 CHECKING APP GRID PERMISSIONS\n--------------------------------------------------------------------------------\n  ✓ All App Grid items have permissions\n\n📋 CHECKING MENU ITEM PERMISSIONS\n--------------------------------------------------------------------------------\n  Found 6 menu items without permissions:\n\n  + agreements.view (module: core) - View Agreements\n    URL: agreements\n\n  + ai-test.view (module: core) - View AI Testing\n    URL: ai-test\n\n  + assumptions.view (module: core) - View Daily Update\n    URL: assumptions\n\n  + companies.view (module: core) - View Companies\n    URL: companies\n\n  + documentation.view (module: core) - View Documentation\n    URL: documentation\n\n  + product-forecast.view (module: core) - View Product Configs\n    URL: product-forecast\n\n  Total to add: 6\n\n🔧 STANDARDIZING MODULE NAMES\n--------------------------------------------------------------------------------\n  ✓ No obvious standardization issues found\n\n\n================================================================================\nSYNC COMPLETE\n================================================================================\n','Script executed successfully','2025-11-26 12:07:17'),
(12,'sync_permissions_menu',1,'{\"mode\":\"live\"}',1,'\n\n\n\n\n================================================================================\nPERMISSION SYNC UTILITY\nMODE: LIVE (changes WILL be applied to database)\n================================================================================\n\n📱 CHECKING APP GRID PERMISSIONS\n--------------------------------------------------------------------------------\n  ✓ All App Grid items have permissions\n\n📋 CHECKING MENU ITEM PERMISSIONS\n--------------------------------------------------------------------------------\n  ✓ All menu items have corresponding permissions\n\n🔧 STANDARDIZING MODULE NAMES\n--------------------------------------------------------------------------------\n  ✓ No obvious standardization issues found\n\n\n================================================================================\nSYNC COMPLETE\n================================================================================\n','Script executed successfully','2025-11-26 12:07:42'),
(13,'audit_menu_permissions',1,'[]',1,'\n\n\n\n\n================================================================================\nMENU ITEMS TO PERMISSIONS AUDIT\n================================================================================\n\n📋 MENU ITEMS ANALYSIS\n--------------------------------------------------------------------------------\n\nTOP_LEVEL:\n  - Dashboard → dashboard\n  - DEPARTMENTS → (no URL)\n  - TOOLS → (no URL)\n  - QUICK LINKS → (no URL)\n  - ADMIN → (no URL)\n  - APP GRID → (no URL)\n\nDEPARTMENTS:\n  - Accounting → #\n  - CRM → #\n  - Forecaster → (no URL)\n  - HR → #\n  - Inventory → #\n  - Manufacturing → #\n  - Purchases → #\n  - Sales → #\n\nCRM:\n  - Dashboard → crm/dashboard\n  - Activities → crm/activities\n  - Contacts → crm/contacts\n  - Companies → companies\n  - Email Marketing → email-marketing\n  - Opportunities → crm/opportunities\n  - NDAs → ndas\n  - Support → #\n  - Reports → crm/reports\n\nSupport:\n  - Tickets → crm/support\n  - FAQs → crm/faqs\n\nADMIN:\n  - Announcements → announcements\n  - Settings → #\n\nSettings:\n  - Administrative → (no URL)\n  - Automation → settings/automation\n  - Company Settings → #\n  - Financial Settings → #\n  - Location Settings → #\n  - System Configuration → #\n\nCompany Settings:\n  - Company Info → settings/company\n  - Email Settings → settings/email\n  - Locations → locations\n  - Positions → hr/positions\n  - User Groups → settings/user-groups\n\nFinancial Settings:\n  - Cost Allocation → settings/cost-allocation\n  - Fiscal Year → settings/fiscal-year\n  - Payment Terms → settings/payment-terms\n  - PP&E Parameters → settings/ppe-parameters\n  - Tax Settings → settings/tax\n\nLocation Settings:\n  - Business Parameters → settings/business-parameters\n  - Facilities & Leasing → settings/facilities\n  - Payroll Settings → settings/payroll\n\nAccess & Roles:\n  - Audit Log → audit-logs\n  - Users → users\n  - Roles & Permissions → roles\n  - Specific Data Roles → data_access\n\nSystem Configuration:\n  - Action Menu Editor → settings/action-menus\n  - Dropdowns → #\n  - QuickBooks Mgmt → quickbooks\n  - Templates → #\n\nDropdowns:\n  - Operations → settings/dropdowns/operations\n  - Sales & CRM → settings/dropdowns/sales\n\nTemplates:\n  - NDA Templates → settings/nda-templates\n  - Terms & Conditions → settings/terms-conditions\n\nAccounting:\n  - Dashboard → accounting\n  - Assets/Compliance → #\n  - Banking/Cash → #\n  - Core Accounting → #\n  - Multi-Currency → accounting/currency\n  - Operations → #\n  - Payments → (no URL)\n  - Recurring Transactions → /recurring\n  - Tax Management → #\n  - Reports → #\n\nCore Accounting:\n  - Chart of Accounts → accounting/accounts\n  - Journal Entries → accounting/journal\n  - General Ledger → accounting/ledger\n\nBanking/Cash:\n  - Bank Accounts → accounting/bank-accounts\n  - Bank Reconciliation → accounting/reconciliation\n\nOperations:\n  - Expenses → accounting/expenses\n  - Budgets → accounting/budgets\n\nAssets/Compliance:\n  - Fixed Assets → accounting/assets\n  - Depreciation → accounting/depreciation\n  - Period Closing → accounting/period\n\nReports:\n  - All Report Package → accounting/reports/package\n  - Balance Sheet → accounting/reports/balance-sheet\n  - Income Statement → accounting/reports/income-statement\n  - Cash Flow Statement → accounting/reports/cash-flow-statement\n  - Trial Balance → accounting/reports/trial-balance\n  - Aging Reports → accounting/reports/aging\n  - A/P Aging Detail → accounting/reports/ap-aging-detail\n  - A/R Aging Detail → accounting/reports/ar-aging-detail\n  - Payment Terms List → accounting/reports/payment-terms-list\n  - Production Reports → manufacturing/reports/production\n  - OEE Reports → manufacturing/reports/oee\n  - Report Builder → reports/custom/builder\n  - My Reports → reports/custom/my\n  - Shared Reports → reports/custom/shared\n  - Scheduled Reports → reports/custom/scheduled\n\nHR:\n  - Dashboard → hr/dashboard\n  - Employees → employees\n  - Recruitment → #\n  - Development → #\n  - Relations → #\n  - Attendance → hr/attendance\n  - Time Off → hr/timeoff\n  - Timesheets → hr/timesheets\n\nRecruitment:\n  - Dashboard → hr/recruitment/dashboard\n  - Job Positions → hr/recruitment/positions\n  - Applications → hr/recruitment/applications\n  - Interviews → hr/recruitment/interviews\n  - Assessments → hr/recruitment/assessments\n  - Offers → hr/recruitment/offers\n\nDevelopment:\n  - Contracts → hr/development/contracts\n  - Training → hr/development/training\n  - Performance Reviews → hr/development/reviews\n\nRelations:\n  - Issues & Challenges → hr/relations/issues\n  - Separations → hr/relations/separations\n\nInventory:\n  - Dashboard → inventory/dashboard\n  - Product Management → #\n  - Stock Levels → /inventory/stock-levels\n  - Lot/Serial Numbers → inventory/lots\n  - Visual Audits → /camera-audit\n\nProduct Management:\n  - Products → products\n  - Categories → inventory/categories\n\nManufacturing:\n  - Dashboard → manufacturing\n  - Capacity Planning → #\n  - Planning & Materials → #\n  - Production → #\n  - Resources → #\n  - Quality Control → #\n  - Maintenance → #\n  - Costing → #\n  - Reports → #\n\nCapacity Planning:\n  - Dashboard → manufacturing/capacity\n  - Real-time Status → manufacturing/capacity/machineStatus\n  - Analytics → manufacturing/capacity/analytics\n  - Availability → manufacturing/capacity/availability\n  - Feasibility → manufacturing/capacity/feasibility\n\nPlanning & Materials:\n  - Bill of Materials → manufacturing/boms\n  - MRP → manufacturing/mrp\n  - Production Scheduling → manufacturing/scheduling\n\nProduction:\n  - Work Orders → manufacturing/workorders\n  - Shop Floor Control → manufacturing/shopfloor\n\nResources:\n  - Business Lines → manufacturing/business-lines\n  - Equipment Lines → manufacturing/equipment-lines\n  - Equipment Units → manufacturing/equipment\n\nQuality Control:\n  - Dashboard → manufacturing/quality\n  - Inspections → manufacturing/quality/inspections\n  - NCR → manufacturing/quality/ncr\n  - Metrics → manufacturing/quality/metrics\n  - Templates → manufacturing/quality/templates\n\nMaintenance:\n  - Maintenance Schedules → manufacturing/maintenance/schedules\n  - Maintenance Work Orders → manufacturing/maintenance/work-orders\n  - Downtime Tracking → manufacturing/maintenance/downtime\n\nCosting:\n  - Production Costing → manufacturing/costing/production\n  - Job Costing → manufacturing/costing/jobs\n\nSales:\n  - Dashboard → sales/dashboard\n  - Sales Documents → #\n  - Fulfillment → #\n  - Configuration → #\n  - Reports → sales/reports\n\nSales Documents:\n  - Quotes → quotes\n  - Agreements → agreements\n  - Orders → sales/orders\n  - Invoices → invoices\n  - Credit Notes → creditnotes\n\nFulfillment:\n  - Shipments → shipments\n  - Delivery Notes → sales/delivery_notes\n  - Returns (RMA) → sales/returns\n\nConfiguration:\n  - Pricing Rules → sales/pricing_rules\n  - Discounts & Promotions → sales/promotions\n\nPurchases:\n  - Dashboard → purchases/dashboard\n  - Suppliers → suppliers\n  - Procurement Process → #\n  - Payments & Documents → #\n  - Supplier Contracts → purchases/contracts\n  - Reports → purchases/reports\n\nSuppliers:\n  - Suppliers → suppliers\n  - 1099 Contractors → /suppliers?filter=1099\n\nProcurement Process:\n  - Purchase Requisitions → purchases/requisitions\n  - RFQs (Quotes) → purchases/rfqs\n  - Purchase Orders → purchases/orders\n  - Goods Receipt → purchases/receiving\n\nPayments & Documents:\n  - Bills/Invoices → purchases/bills\n  - Payments Made (Legacy) → purchases/payments\n  - Purchase Returns → purchases/returns\n  - Debit Notes → purchases/debit-notes\n\nTime Off:\n  - My Time Off → hr/timeoff/my\n  - All Requests → hr/timeoff/all\n  - Approve Requests → hr/timeoff/approve\n  - Time Off Types → hr/timeoff/types\n  - Accrual Rules → hr/timeoff/accruals\n\nTimesheets:\n  - My Timesheet → hr/timesheets/my\n  - All Timesheets → hr/timesheets/all\n  - Approve Timesheets → hr/timesheets/approve\n  - Timesheet Reports → hr/timesheets/reports\n\nLot/Serial Numbers:\n  - All Lots/Serials → inventory/lots/all\n  - Traceability → inventory/lots/traceability\n  - Expiration Dates → inventory/lots/expiration\n\nMulti-Currency:\n  - Currencies → accounting/currency/list\n  - Exchange Rates → accounting/currency/rates\n  - Currency Gains/Losses → accounting/currency/revaluation\n\nAutomation:\n  - AI Testing → ai-test\n  - Approval Rules → settings/automation/approvals\n  - Templates → automation/email-templates\n  - Scheduled Actions → settings/automation/scheduled\n  - Workflows → settings/automation/workflows\n\nProjects:\n  - Dashboard → projects/dashboard\n  - My Projects → projects/?my_projects=1\n  - My Tasks → projects/my-tasks\n  - Gantt Chart → projects/gantt\n  - Time Tracking → projects/time\n  - Resource Planning → projects/resources\n  - Project Profitability → projects/profitability\n\nFiles:\n  - All Files → /files\n  - My Files → /files?context=user\n  - Shared With Me → files/shared\n  - Accounting Files → /files?context=accounting\n  - Company Files → /files?context=company\n  - HR Documents → /files?context=hr\n  - Inventory Documents → /files?context=inventory\n  - Manufacturing Documents → /files?context=manufacturing\n  - Project Files → /files?context=project\n  - Purchases Documents → /files?context=purchases\n  - Sales Documents → /files?context=sales\n\nEmail Marketing:\n  - Dashboard → email-marketing/dashboard\n  - Campaigns → email-marketing/campaigns\n  - Email Templates → email-marketing/templates\n  - Mailing Lists → email-marketing/lists\n  - Automation → email-marketing/automation\n  - Analytics → email-marketing/analytics\n\nHelpdesk:\n  - Dashboard → helpdesk/dashboard\n  - Documentation → documentation\n  - Tickets → helpdesk/tickets\n  - My Tickets → helpdesk/my-tickets\n  - SLA Management → helpdesk/sla\n  - Knowledge Base → helpdesk/kb\n  - Live Chat → helpdesk/chat\n  - Reports → helpdesk/reports\n\nAPP GRID:\n  - DASHBOARD → dashboard\n  - CALENDAR → calendar\n  - EMPLOYEES → employees/directory\n  - PRODUCTS → products\n  - SALES → salesorders\n  - SETTINGS → settings\n\nTOOLS:\n  - Files → /files\n  - Helpdesk → helpdesk\n  - Projects → projects\n  - Reports → reports/custom\n\nTax Management:\n  - Tax Jurisdictions → /tax/jurisdictions\n  - Tax Payments → /tax/payments\n  - Tax Reports → /tax/reports/liability\n\nPayments:\n  - Customer Payments → /accounting/customer-payments\n  - Vendor Payments → /accounting/vendor-payments\n\nAdministrative:\n  - Access & Roles → #\n  - Document Mgmt → #\n  - Menu Mgmt → menus\n  - PHPmyadmin → /phpmyadmin\n  - System Backup → backup\n  - System Scripts → admin/system-scripts\n\nDocument Mgmt:\n  - Dashboard → nextcloud/admin/dashboard\n  - Activity Log → nextcloud/admin/activity\n  - Storage Report → nextcloud/admin/storage\n  - User Activity → nextcloud/admin/users\n  - Settings → nextcloud/settings\n\nForecaster:\n  - Getting Started → /product-forecast/getting-started\n  - Command Center → /product-forecast/command-center\n  - Daily Update → assumptions\n  - Assumption Sets → assumptions/sets\n  - Product Configs → product-forecast\n  - Generate Projections → product-forecast/generate\n  - Pro Forma Stmts → product-forecast/proforma\n  - Variance Tracking → /product-forecast/variance\n  - Sensitivity Analysis → product-forecast/sensitivity\n  - Compare Scenarios → product-forecast/compare\n  - Variance Report → assumptions/variance\n  - Advanced Tools → (no URL)\n  - Scenario Modeler → forecaster\n\nTotal menu items: 273\n\n🔐 PERMISSIONS ANALYSIS\n--------------------------------------------------------------------------------\n  (empty/top-level)               27 permissions\n  1099                             7 permissions\n  1099_contractors                 3 permissions\n  accounting                      48 permissions\n  admin                            4 permissions\n  audit                            2 permissions\n  automation                       1 permissions\n  bank_import                      8 permissions\n  credit_notes                     4 permissions\n  crm                             34 permissions\n  documents                        3 permissions\n  Forecasting                      7 permissions\n  helpdesk                         5 permissions\n  hr                              46 permissions\n  inventory                       31 permissions\n  manufacturing                   26 permissions\n  marketing                        8 permissions\n  nextcloud                        4 permissions\n  permissions                      1 permissions\n  procurement                      5 permissions\n  projects                         3 permissions\n  purchases                       24 permissions\n  recurring                        6 permissions\n  reports                          2 permissions\n  roles                            4 permissions\n  sales                           41 permissions\n  security                         5 permissions\n  settings                         2 permissions\n  statements                       4 permissions\n  system                           5 permissions\n  tax                             11 permissions\n  users                            4 permissions\n\nTotal permissions: 385\n\n⚠️  MISSING PERMISSIONS (Menu items without corresponding permissions)\n--------------------------------------------------------------------------------\n  Found 1 menu items without clear permission mappings:\n\n    - #\n\n🗑️  ORPHANED PERMISSIONS (Permissions without menu items)\n--------------------------------------------------------------------------------\n  Found 75 permissions without clear menu mappings:\n\n    - 1099_contractors.manage (1099): Manage 1099 contractor designations\n    - 1099_contractors.view (1099): View 1099 contractors\n    - 1099_filings.file (1099): File 1099 forms\n    - 1099_filings.prepare (1099): Prepare 1099 forms\n    - 1099_payments.manage (1099): Manage 1099 payment classifications\n    - 1099_payments.view (1099): View 1099 reportable payments\n    - 1099_reports.view (1099): View 1099 reports\n    - 1099_contractors.export (1099_contractors): Export 1099 Contractors\n    - 1099_contractors.generate_reports (1099_contractors): Generate Reports 1099 Contractors\n    - 1099_contractors.view_payments (1099_contractors): View Payments 1099 Contractors\n    - audit_trail.export (audit): Export audit trail\n    - audit_trail.view (audit): View audit trail\n    - bank_import.categorize (bank_import): Categorize imported transactions\n    - bank_import.create (bank_import): Import bank transactions\n    - bank_import.delete (bank_import): Delete Bank Import\n    - bank_import.edit (bank_import): Edit Bank Import\n    - bank_import.import (bank_import): Import Bank Import\n    - bank_import.manage_rules (bank_import): Manage Rules Bank Import\n    - bank_import.rules (bank_import): Manage categorization rules\n    - bank_import.view (bank_import): View bank imports\n    ... and 55 more\n\n📱 APP GRID ANALYSIS\n--------------------------------------------------------------------------------\nApp Grid items:\n  - DASHBOARD (dashboard) → ✓ Has permission: dashboard.view\n  - CALENDAR (calendar) → ✓ Has permission: calendar.view\n  - EMPLOYEES (employees/directory) → ✓ Has permission: employees.view\n  - PRODUCTS (products) → ✓ Has permission: products.view\n  - SALES (salesorders) → ✓ Has permission: salesorders.view\n  - SETTINGS (settings) → ✓ Has permission: settings.view\n\nRECOMMENDATION: Create \'App Grid\' permission category in role editor\nThese should be DEFAULT permissions for all users:\n  ☑ DASHBOARD\n  ☑ CALENDAR\n  ☑ EMPLOYEES\n  ☑ PRODUCTS\n  ☑ SALES\n  ☑ SETTINGS\n\n💡 STANDARDIZATION RECOMMENDATIONS\n--------------------------------------------------------------------------------\n\nModule naming issues:\n  ✓ No obvious case inconsistencies found\n\n  ℹ️  27 permissions have empty module (top-level items)\n\nRECOMMENDATIONS:\n  1. Standardize all module names to lowercase\n  2. Add \'app_grid\' or \'quick_access\' module for App Grid items\n  3. Consider grouping top-level items (empty module) into \'core\' or \'general\'\n  4. Ensure every menu item has at least a \'view\' permission\n  5. Update role editor to show \'App Grid\' as first category\n\n\n================================================================================\nAUDIT COMPLETE\n================================================================================\n','Script executed successfully','2025-11-26 12:08:07'),
(14,'check_documentation_coverage',1,'[]',1,'\n\n\n\n=== Documentation Coverage Report ===\nCoverage: 99.3%\nTotal Controllers: 143\nDocumented: 142\nUndocumented: 1\n\nUndocumented Controllers:\n  - RFQ (RFQController.php)\n\n✓ Results saved to database','Script executed successfully','2025-11-26 12:10:09'),
(15,'scan_permissions',1,'{\"mode\":\"dry-run\"}',1,'\n\n\n\n\n================================================================================\nPERMISSION SCANNER & SYNC UTILITY\nMODE: DRY RUN (no changes will be made)\n================================================================================\n\n📚 LOADING DATABASE PERMISSIONS\n--------------------------------------------------------------------------------\n  Loaded 385 permissions from database\n\n🔍 SCANNING CONTROLLERS\n--------------------------------------------------------------------------------\n  Scanned 147 controller files\n  Found 132 files with permission checks\n  Discovered 148 unique permissions\n\n📋 DISCOVERED PERMISSIONS REPORT\n--------------------------------------------------------------------------------\n  Permission                               Checks   Controllers\n--------------------------------------------------------------------------------\n\n  (CORE):\n  admin                                    101      ActionMenuEditorController,... ✓\n\n  1099_CONTRACTORS:\n  1099_contractors.export                  1        Form1099Controller ✓\n  1099_contractors.generate_reports        1        Form1099Controller ✓\n  1099_contractors.view                    1        Form1099Controller ✓\n  1099_contractors.view_payments           1        Form1099Controller ✓\n\n  ACCOUNTING:\n  accounting.approve                       3        ExpenseController ✓\n  accounting.create                        30       AccountController, BankAcco... ✓\n  accounting.customer_payments.create      2        CustomerPaymentController ✓\n  accounting.customer_payments.view        2        CustomerPaymentController ✓\n  accounting.delete                        21       BankAccountController, Budg... ✓\n  accounting.edit                          25       BankAccountController, Bank... ✓\n  accounting.vendor_payments.create        4        VendorPaymentController ✓\n  accounting.vendor_payments.delete        1        VendorPaymentController ✓\n  accounting.vendor_payments.edit          2        VendorPaymentController ✓\n  accounting.vendor_payments.print_checks  1        VendorPaymentController ✓\n  accounting.vendor_payments.view          3        VendorPaymentController ✓\n  accounting.vendor_payments.void          1        VendorPaymentController ✓\n  accounting.view                          36       AccountController, Accounti... ✓\n\n  ADMIN:\n  admin.agreement_templates                9        AgreementTemplateController ✓\n  admin.create                             7        PipedriveImportController, ... ✗\n  admin.delete                             2        QuickBooksController, UserG... ✗\n  admin.edit                               5        QuickBooksController, UserG... ✗\n  admin.settings                           1        PipedriveImportController ✓\n  admin.system_scripts                     3        SystemScriptsController ✓\n\n  AUDIT_LOGS:\n  audit_logs.view                          1        AuditLogController ✓\n\n  BANK_IMPORT:\n  bank_import.create                       2        BankImportController ✓\n  bank_import.delete                       1        BankImportController ✓\n  bank_import.edit                         2        BankImportController ✓\n  bank_import.import                       1        BankImportController ✓\n  bank_import.manage_rules                 4        BankImportController ✓\n  bank_import.view                         2        BankImportController ✓\n\n  CALENDAR:\n  calendar.create                          1        CalendarController ✗\n  calendar.delete                          1        CalendarController ✗\n  calendar.edit                            1        CalendarController ✗\n\n  CAMERA_AUDIT:\n  camera_audit.capture                     1        CameraAuditController ✓\n  camera_audit.delete                      1        CameraAuditController ✓\n  camera_audit.stations                    3        CameraAuditController ✓\n  camera_audit.verify                      1        CameraAuditController ✓\n  camera_audit.view                        3        CameraAuditController ✓\n\n  CRM:\n  crm.create                               11       ActivityController, ClientC... ✓\n  crm.delete                               13       ActivityController, ClientC... ✓\n  crm.edit                                 13       ActivityController, ClientC... ✓\n  crm.view                                 55       ActivityController, CRMCont... ✓\n\n  DASHBOARD:\n  dashboard.edit                           2        DashboardController ✗\n\n  DOCUMENTS:\n  documents.create                         1        DocumentsController ✗\n  documents.delete                         1        DocumentsController ✓\n\n  FORECASTING:\n  forecasting.create                       10       FinancialPlannerController,... ✓\n  forecasting.delete                       8        ForecasterController ✓\n  forecasting.edit                         16       FinancialPlannerController,... ✓\n  forecasting.generate_projections         1        ProductForecastController ✓\n  forecasting.manage_assumptions           5        AssumptionsController ✓\n  forecasting.manage_products              3        ProductForecastController ✓\n  forecasting.update_daily                 3        AssumptionsController ✓\n  forecasting.view                         9        FinancialPlannerController,... ✓\n  forecasting.view_actuals                 1        AssumptionsController ✓\n  forecasting.view_proforma                7        FinancialProFormaController... ✓\n\n  HR:\n  hr.create                                28       ApplicationController, Asse... ✓\n  hr.delete                                16       ApplicationController, Asse... ✓\n  hr.edit                                  25       ApplicationController, Asse... ✓\n  hr.view                                  30       ApplicationController, Asse... ✓\n\n  INVENTORY:\n  inventory.create                         9        CategoryController, Locatio... ✓\n  inventory.delete                         10       CategoryController, Locatio... ✓\n  inventory.edit                           7        CategoryController, Locatio... ✓\n  inventory.manage                         12       CategoryController, StockMo... ✓\n  inventory.view                           20       CategoryController, Invento... ✓\n\n  MANUFACTURING:\n  manufacturing.approve                    2        MRPController ✓\n  manufacturing.create                     13       BOMController, BusinessLine... ✓\n  manufacturing.delete                     6        BusinessLineController, Equ... ✓\n  manufacturing.edit                       44       BOMController, BusinessLine... ✓\n  manufacturing.view                       53       AnalyticsController, BOMCon... ✓\n\n  MESSAGING:\n  messaging.create                         1        MessagingController ✗\n  messaging.delete                         1        MessagingController ✗\n  messaging.edit                           2        MessagingController ✗\n\n  NDAS:\n  ndas.countersign                         2        NDAController ✓\n  ndas.create                              2        NDAController ✓\n  ndas.delete                              1        NDAController ✓\n  ndas.edit                                2        NDAController ✓\n  ndas.send                                2        NDAController ✓\n  ndas.view                                5        NDAController ✓\n\n  NETWORK_MONITOR:\n  network_monitor.manage                   3        NetworkMonitorController ✓\n  network_monitor.view                     1        NetworkMonitorController ✓\n\n  NEXTCLOUD:\n  nextcloud.delete                         1        NextcloudController ✓\n  nextcloud.manage                         7        NextcloudAdminController, N... ✓\n  nextcloud.upload                         6        NextcloudController ✓\n  nextcloud.view                           7        NextcloudController ✓\n\n  PAYROLL:\n  payroll.view                             1        PayrollController ✓\n\n  PERMISSIONS:\n  permissions.manage                       10       PermissionGroupController ✓\n\n  PROCUREMENT:\n  procurement.approve                      2        PurchaseRequisitionController ✓\n  procurement.create                       16       DebitNoteController, GoodsR... ✓\n  procurement.delete                       12       DebitNoteController, GoodsR... ✓\n  procurement.edit                         12       DebitNoteController, Purcha... ✓\n  procurement.view                         18       DebitNoteController, GoodsR... ✓\n\n  PRODUCT_FORECAST:\n  product_forecast.view                    2        ProductForecastController ✓\n\n  PROFILE:\n  profile.edit                             2        ProfileController ✗\n\n  PROJECTS:\n  projects.create                          3        ProjectsController ✓\n  projects.delete                          5        ProjectsController ✓\n  projects.edit                            9        ProjectsController ✓\n  projects.view                            5        ProjectsController ✓\n\n  PURCHASES:\n  purchases.create                         3        SupplierController ✓\n  purchases.delete                         3        SupplierController ✓\n  purchases.edit                           2        SupplierController ✓\n  purchases.view                           3        PurchasesController, Suppli... ✓\n\n  PURCHASING:\n  purchasing.create                        1        MRPController ✓\n\n  RECURRING_TEMPLATES:\n  recurring_templates.activate             1        RecurringTransactionController ✓\n  recurring_templates.create               2        RecurringTransactionController ✓\n  recurring_templates.delete               1        RecurringTransactionController ✓\n  recurring_templates.edit                 2        RecurringTransactionController ✓\n  recurring_templates.execute              2        RecurringTransactionController ✓\n  recurring_templates.view                 3        RecurringTransactionController ✓\n\n  REPORTS:\n  reports.create                           2        CustomReportsController ✗\n  reports.delete                           1        CustomReportsController ✗\n  reports.edit                             2        CustomReportsController ✗\n  reports.view                             7        ReportsController ✓\n\n  ROLES:\n  roles.create                             2        RoleController ✓\n  roles.delete                             1        RoleController ✓\n  roles.edit                               2        RoleController ✓\n  roles.view                               4        RoleController ✓\n\n  SALES:\n  sales.agreements.create                  3        AgreementController ✓\n  sales.agreements.delete                  3        AgreementController ✓\n  sales.agreements.edit                    3        AgreementController ✓\n  sales.agreements.send                    2        AgreementController ✓\n  sales.agreements.view                    5        AgreementController ✓\n  sales.approve                            2        ReturnController ✗\n  sales.create                             28       BatteryQuoteController, Cre... ✓\n  sales.delete                             23       BatteryQuoteController, Cre... ✓\n  sales.edit                               20       BatteryQuoteController, Inv... ✓\n  sales.view                               34       BatteryQuoteController, Cre... ✓\n\n  SETTINGS:\n  settings.edit                            23       MenuController, TermsCondit... ✓\n  settings.view                            4        MenuController, TermsCondit... ✓\n\n  SYSTEM:\n  system.backup                            1        BackupController ✓\n  system.edit                              1        ProfileController ✗\n  system.files.delete                      3        FileManagerController ✗\n\n  TAX_JURISDICTIONS:\n  tax_jurisdictions.create                 2        TaxJurisdictionController ✓\n  tax_jurisdictions.delete                 1        TaxJurisdictionController ✓\n  tax_jurisdictions.edit                   3        TaxJurisdictionController ✓\n  tax_jurisdictions.view                   2        TaxJurisdictionController ✓\n\n  TAX_PAYMENTS:\n  tax_payments.create                      2        TaxPaymentController ✓\n  tax_payments.edit                        4        TaxPaymentController ✓\n  tax_payments.file                        1        TaxPaymentController ✓\n  tax_payments.view                        2        TaxPaymentController ✓\n\n  TAX_REPORTS:\n  tax_reports.view                         1        TaxPaymentController ✓\n\n  TICKETS:\n  tickets.create                           4        HelpDeskController, Support... ✓\n  tickets.delete                           2        SupportController ✗\n  tickets.edit                             2        HelpDeskController, Support... ✓\n\n  USERS:\n  users.create                             2        UserController ✓\n  users.delete                             3        UserController ✓\n  users.edit                               2        UserController ✓\n  users.view                               3        UserController ✓\n\n➕ CREATING MISSING PERMISSIONS\n--------------------------------------------------------------------------------\n  Found 19 missing permissions:\n\n  + calendar.create (calendar) - \"Create Calendar\"\n    Used in: CalendarController\n\n  + calendar.edit (calendar) - \"Edit Calendar\"\n    Used in: CalendarController\n\n  + calendar.delete (calendar) - \"Delete Calendar\"\n    Used in: CalendarController\n\n  + reports.create (reports) - \"Create Reports\"\n    Used in: CustomReportsController\n\n  + reports.edit (reports) - \"Edit Reports\"\n    Used in: CustomReportsController\n\n  + reports.delete (reports) - \"Delete Reports\"\n    Used in: CustomReportsController\n\n  + dashboard.edit (dashboard) - \"Edit Dashboard\"\n    Used in: DashboardController\n\n  + documents.create (documents) - \"Create Documents\"\n    Used in: DocumentsController\n\n  + system.files.delete (system) - \"System Files Delete\"\n    Used in: FileManagerController\n\n  + messaging.create (messaging) - \"Create Messaging\"\n    Used in: MessagingController\n\n  + messaging.edit (messaging) - \"Edit Messaging\"\n    Used in: MessagingController\n\n  + messaging.delete (messaging) - \"Delete Messaging\"\n    Used in: MessagingController\n\n  + admin.create (admin) - \"Create Admin\"\n    Used in: PipedriveImportController, UserGroupController\n\n  + profile.edit (profile) - \"Edit Profile\"\n    Used in: ProfileController\n\n  + system.edit (system) - \"Edit System\"\n    Used in: ProfileController\n\n  + admin.edit (admin) - \"Edit Admin\"\n    Used in: QuickBooksController, UserGroupController\n\n  + admin.delete (admin) - \"Delete Admin\"\n    Used in: QuickBooksController, UserGroupController\n\n  + sales.approve (sales) - \"Approve Sales\"\n    Used in: ReturnController\n\n  + tickets.delete (tickets) - \"Delete Tickets\"\n    Used in: SupportController\n\n🗑️  UNUSED PERMISSIONS\n--------------------------------------------------------------------------------\n  Found 256 permissions in database not used in controllers:\n\n  (CORE):\n    - agreements.view - \"View Agreements\"\n    - ai-test.view - \"View AI Testing\"\n    - analytics.view - \"View analytics\"\n    - announcements.view - \"View Announcements\"\n    - assumptions.view - \"View Daily Update\"\n    - audit-logs.view - \"View Audit Log\"\n    - backup.view - \"View System Backup\"\n    - calendar.view - \"View calendar\"\n    - companies.view - \"View Companies\"\n    - creditnotes.view - \"View Credit Notes\"\n    ... and 16 more\n\n  1099:\n    - 1099_contractors.manage - \"Manage 1099 contractor designations\"\n    - 1099_filings.file - \"File 1099 forms\"\n    - 1099_filings.prepare - \"Prepare 1099 forms\"\n    - 1099_payments.manage - \"Manage 1099 payment classifications\"\n    - 1099_payments.view - \"View 1099 reportable payments\"\n    - 1099_reports.view - \"View 1099 reports\"\n\n  ACCOUNTING:\n    - accounting.customer_payments.delete - \"Delete customer payments\"\n    - accounting.customer_payments.edit - \"Edit customer payments\"\n    - accounting.post - \"Post journal entries\"\n    - accounts.create - \"Create accounts\"\n    - accounts.delete - \"Delete accounts\"\n    - accounts.edit - \"Edit accounts\"\n    - accounts.view - \"View chart of accounts\"\n    - bank_accounts.create - \"Create bank accounts\"\n    - bank_accounts.edit - \"Edit bank accounts\"\n    - bank_accounts.view - \"View bank accounts\"\n    ... and 21 more\n\n  AUDIT:\n    - audit_trail.export - \"Export audit trail\"\n    - audit_trail.view - \"View audit trail\"\n\n  AUTOMATION:\n    - automation.view - \"View Templates\"\n\n  BANK_IMPORT:\n    - bank_import.categorize - \"Categorize imported transactions\"\n    - bank_import.rules - \"Manage categorization rules\"\n\n  CREDIT_NOTES:\n    - credit_notes.apply - \"Apply Credit Notes to Invoices\"\n    - credit_notes.auto_apply - \"Auto-apply Credit Notes\"\n    - credit_notes.reverse - \"Reverse Credit Note Applications\"\n    - credit_notes.view_balances - \"View Customer Credit Balances\"\n\n  CRM:\n    - activities.create - \"Create CRM activities\"\n    - activities.edit - \"Edit CRM activities\"\n    - activities.view - \"View CRM activities\"\n    - clients.create - \"Create clients\"\n    - clients.delete - \"Delete clients\"\n    - clients.edit - \"Edit clients\"\n    - clients.view - \"View clients\"\n    - contacts.create - \"Create contacts\"\n    - contacts.delete - \"Delete contacts\"\n    - contacts.edit - \"Edit contacts\"\n    ... and 14 more\n\n  DOCUMENTS:\n    - documents.edit - \"Edit documents\"\n    - documents.upload - \"Upload documents\"\n\n  HELPDESK:\n    - tickets.assign - \"Assign support tickets\"\n    - tickets.close - \"Close support tickets\"\n    - tickets.view - \"View support tickets\"\n\n  HR:\n    - applications.create - \"Create job applications\"\n    - applications.edit - \"Edit job applications\"\n    - applications.view - \"View job applications\"\n    - assessments.create - \"Create assessments\"\n    - assessments.view - \"View assessments\"\n    - attendance.create - \"Record attendance\"\n    - attendance.view - \"View attendance\"\n    - contracts.create - \"Create employee contracts\"\n    - contracts.edit - \"Edit employee contracts\"\n    - contracts.view - \"View employee contracts\"\n    ... and 31 more\n\n  INVENTORY:\n    - camera_audit.annotate - \"Add annotations to audit images\"\n    - camera_audit.export - \"Export camera audit data\"\n    - categories.create - \"Create product categories\"\n    - categories.delete - \"Delete product categories\"\n    - categories.edit - \"Edit product categories\"\n    - categories.view - \"View product categories\"\n    - inventory.adjust - \"Adjust inventory levels\"\n    - lots.create - \"Create lot/serial numbers\"\n    - lots.edit - \"Edit lot/serial numbers\"\n    - lots.view - \"View lot/serial numbers\"\n    ... and 11 more\n\n  MANUFACTURING:\n    - boms.create - \"Create bills of materials\"\n    - boms.delete - \"Delete bills of materials\"\n    - boms.edit - \"Edit bills of materials\"\n    - boms.view - \"View bills of materials\"\n    - capacity.edit - \"Edit capacity planning\"\n    - capacity.view - \"View capacity planning\"\n    - equipment.create - \"Create equipment\"\n    - equipment.edit - \"Edit equipment\"\n    - equipment.maintenance - \"Perform equipment maintenance\"\n    - equipment.view - \"View equipment\"\n    ... and 11 more\n\n  MARKETING:\n    - campaigns.create - \"Create email campaigns\"\n    - campaigns.edit - \"Edit email campaigns\"\n    - campaigns.send - \"Send email campaigns\"\n    - campaigns.view - \"View email campaigns\"\n    - lists.create - \"Create mailing lists\"\n    - lists.view - \"View mailing lists\"\n    - templates.create - \"Create email templates\"\n    - templates.view - \"View email templates\"\n\n  PURCHASES:\n    - bills.approve - \"Approve supplier bills\"\n    - bills.create - \"Create supplier bills\"\n    - bills.view - \"View supplier bills\"\n    - goods_receipts.create - \"Create goods receipts\"\n    - goods_receipts.view - \"View goods receipts\"\n    - purchase_orders.approve - \"Approve purchase orders\"\n    - purchase_orders.create - \"Create purchase orders\"\n    - purchase_orders.delete - \"Delete purchase orders\"\n    - purchase_orders.edit - \"Edit purchase orders\"\n    - purchase_orders.view - \"View purchase orders\"\n    ... and 9 more\n\n  REPORTS:\n    - reports.export - \"Export reports\"\n\n  SALES:\n    - delivery_notes.create - \"Create delivery notes\"\n    - delivery_notes.view - \"View delivery notes\"\n    - invoices.create - \"Create invoices\"\n    - invoices.delete - \"Delete invoices\"\n    - invoices.edit - \"Edit invoices\"\n    - invoices.view - \"View invoices\"\n    - orders.approve - \"Approve sales orders\"\n    - orders.create - \"Create sales orders\"\n    - orders.delete - \"Delete sales orders\"\n    - orders.edit - \"Edit sales orders\"\n    ... and 22 more\n\n  SECURITY:\n    - mfa.admin_override - \"Admin: Override MFA for any user\"\n    - mfa.manage_own - \"Manage own MFA settings\"\n    - security.view_audit - \"View security audit logs\"\n\n  STATEMENTS:\n    - statements.bulk_generate - \"Generate Bulk Statements\"\n    - statements.email - \"Email Statements to Customers\"\n    - statements.generate - \"Generate Customer Statements\"\n    - statements.view_history - \"View Statement History\"\n\n  SYSTEM:\n    - files.delete - \"Delete files and folders\"\n    - files.manage - \"Manage all files and folders\"\n    - files.upload - \"Upload files\"\n\n  TAX:\n    - tax_exemptions.manage - \"Manage tax exemptions\"\n    - tax_exemptions.view - \"View tax exemptions\"\n\n  ⚠️  NOTE: These may be used in views or future features.\n  Review carefully before deleting.\n\n📊 COVERAGE STATISTICS\n--------------------------------------------------------------------------------\n  Permissions in database:        385\n  Permissions in controllers:     148\n  Matching (in both):             129\n  Missing from database:          19\n  Unused in controllers:          256\n  Coverage:                       87.2%\n\n  PERMISSIONS BY MODULE:\n    accounting                      13 permissions\n    sales                           10 permissions\n    forecasting                     10 permissions\n    admin                            6 permissions\n    bank_import                      6 permissions\n    ndas                             6 permissions\n    recurring_templates              6 permissions\n    manufacturing                    5 permissions\n    camera_audit                     5 permissions\n    inventory                        5 permissions\n\n\n================================================================================\nSCAN COMPLETE\n================================================================================\n\nThis was a dry run. Run with --live flag to apply changes.\n','Script executed successfully','2025-11-28 12:33:48'),
(16,'scan_permissions',1,'{\"mode\":\"live\"}',1,'\n\n\n\n\n================================================================================\nPERMISSION SCANNER & SYNC UTILITY\nMODE: LIVE (changes WILL be applied to database)\n================================================================================\n\n📚 LOADING DATABASE PERMISSIONS\n--------------------------------------------------------------------------------\n  Loaded 385 permissions from database\n\n🔍 SCANNING CONTROLLERS\n--------------------------------------------------------------------------------\n  Scanned 147 controller files\n  Found 132 files with permission checks\n  Discovered 148 unique permissions\n\n📋 DISCOVERED PERMISSIONS REPORT\n--------------------------------------------------------------------------------\n  Permission                               Checks   Controllers\n--------------------------------------------------------------------------------\n\n  (CORE):\n  admin                                    101      ActionMenuEditorController,... ✓\n\n  1099_CONTRACTORS:\n  1099_contractors.export                  1        Form1099Controller ✓\n  1099_contractors.generate_reports        1        Form1099Controller ✓\n  1099_contractors.view                    1        Form1099Controller ✓\n  1099_contractors.view_payments           1        Form1099Controller ✓\n\n  ACCOUNTING:\n  accounting.approve                       3        ExpenseController ✓\n  accounting.create                        30       AccountController, BankAcco... ✓\n  accounting.customer_payments.create      2        CustomerPaymentController ✓\n  accounting.customer_payments.view        2        CustomerPaymentController ✓\n  accounting.delete                        21       BankAccountController, Budg... ✓\n  accounting.edit                          25       BankAccountController, Bank... ✓\n  accounting.vendor_payments.create        4        VendorPaymentController ✓\n  accounting.vendor_payments.delete        1        VendorPaymentController ✓\n  accounting.vendor_payments.edit          2        VendorPaymentController ✓\n  accounting.vendor_payments.print_checks  1        VendorPaymentController ✓\n  accounting.vendor_payments.view          3        VendorPaymentController ✓\n  accounting.vendor_payments.void          1        VendorPaymentController ✓\n  accounting.view                          36       AccountController, Accounti... ✓\n\n  ADMIN:\n  admin.agreement_templates                9        AgreementTemplateController ✓\n  admin.create                             7        PipedriveImportController, ... ✗\n  admin.delete                             2        QuickBooksController, UserG... ✗\n  admin.edit                               5        QuickBooksController, UserG... ✗\n  admin.settings                           1        PipedriveImportController ✓\n  admin.system_scripts                     3        SystemScriptsController ✓\n\n  AUDIT_LOGS:\n  audit_logs.view                          1        AuditLogController ✓\n\n  BANK_IMPORT:\n  bank_import.create                       2        BankImportController ✓\n  bank_import.delete                       1        BankImportController ✓\n  bank_import.edit                         2        BankImportController ✓\n  bank_import.import                       1        BankImportController ✓\n  bank_import.manage_rules                 4        BankImportController ✓\n  bank_import.view                         2        BankImportController ✓\n\n  CALENDAR:\n  calendar.create                          1        CalendarController ✗\n  calendar.delete                          1        CalendarController ✗\n  calendar.edit                            1        CalendarController ✗\n\n  CAMERA_AUDIT:\n  camera_audit.capture                     1        CameraAuditController ✓\n  camera_audit.delete                      1        CameraAuditController ✓\n  camera_audit.stations                    3        CameraAuditController ✓\n  camera_audit.verify                      1        CameraAuditController ✓\n  camera_audit.view                        3        CameraAuditController ✓\n\n  CRM:\n  crm.create                               11       ActivityController, ClientC... ✓\n  crm.delete                               13       ActivityController, ClientC... ✓\n  crm.edit                                 13       ActivityController, ClientC... ✓\n  crm.view                                 55       ActivityController, CRMCont... ✓\n\n  DASHBOARD:\n  dashboard.edit                           2        DashboardController ✗\n\n  DOCUMENTS:\n  documents.create                         1        DocumentsController ✗\n  documents.delete                         1        DocumentsController ✓\n\n  FORECASTING:\n  forecasting.create                       10       FinancialPlannerController,... ✓\n  forecasting.delete                       8        ForecasterController ✓\n  forecasting.edit                         16       FinancialPlannerController,... ✓\n  forecasting.generate_projections         1        ProductForecastController ✓\n  forecasting.manage_assumptions           5        AssumptionsController ✓\n  forecasting.manage_products              3        ProductForecastController ✓\n  forecasting.update_daily                 3        AssumptionsController ✓\n  forecasting.view                         9        FinancialPlannerController,... ✓\n  forecasting.view_actuals                 1        AssumptionsController ✓\n  forecasting.view_proforma                7        FinancialProFormaController... ✓\n\n  HR:\n  hr.create                                28       ApplicationController, Asse... ✓\n  hr.delete                                16       ApplicationController, Asse... ✓\n  hr.edit                                  25       ApplicationController, Asse... ✓\n  hr.view                                  30       ApplicationController, Asse... ✓\n\n  INVENTORY:\n  inventory.create                         9        CategoryController, Locatio... ✓\n  inventory.delete                         10       CategoryController, Locatio... ✓\n  inventory.edit                           7        CategoryController, Locatio... ✓\n  inventory.manage                         12       CategoryController, StockMo... ✓\n  inventory.view                           20       CategoryController, Invento... ✓\n\n  MANUFACTURING:\n  manufacturing.approve                    2        MRPController ✓\n  manufacturing.create                     13       BOMController, BusinessLine... ✓\n  manufacturing.delete                     6        BusinessLineController, Equ... ✓\n  manufacturing.edit                       44       BOMController, BusinessLine... ✓\n  manufacturing.view                       53       AnalyticsController, BOMCon... ✓\n\n  MESSAGING:\n  messaging.create                         1        MessagingController ✗\n  messaging.delete                         1        MessagingController ✗\n  messaging.edit                           2        MessagingController ✗\n\n  NDAS:\n  ndas.countersign                         2        NDAController ✓\n  ndas.create                              2        NDAController ✓\n  ndas.delete                              1        NDAController ✓\n  ndas.edit                                2        NDAController ✓\n  ndas.send                                2        NDAController ✓\n  ndas.view                                5        NDAController ✓\n\n  NETWORK_MONITOR:\n  network_monitor.manage                   3        NetworkMonitorController ✓\n  network_monitor.view                     1        NetworkMonitorController ✓\n\n  NEXTCLOUD:\n  nextcloud.delete                         1        NextcloudController ✓\n  nextcloud.manage                         7        NextcloudAdminController, N... ✓\n  nextcloud.upload                         6        NextcloudController ✓\n  nextcloud.view                           7        NextcloudController ✓\n\n  PAYROLL:\n  payroll.view                             1        PayrollController ✓\n\n  PERMISSIONS:\n  permissions.manage                       10       PermissionGroupController ✓\n\n  PROCUREMENT:\n  procurement.approve                      2        PurchaseRequisitionController ✓\n  procurement.create                       16       DebitNoteController, GoodsR... ✓\n  procurement.delete                       12       DebitNoteController, GoodsR... ✓\n  procurement.edit                         12       DebitNoteController, Purcha... ✓\n  procurement.view                         18       DebitNoteController, GoodsR... ✓\n\n  PRODUCT_FORECAST:\n  product_forecast.view                    2        ProductForecastController ✓\n\n  PROFILE:\n  profile.edit                             2        ProfileController ✗\n\n  PROJECTS:\n  projects.create                          3        ProjectsController ✓\n  projects.delete                          5        ProjectsController ✓\n  projects.edit                            9        ProjectsController ✓\n  projects.view                            5        ProjectsController ✓\n\n  PURCHASES:\n  purchases.create                         3        SupplierController ✓\n  purchases.delete                         3        SupplierController ✓\n  purchases.edit                           2        SupplierController ✓\n  purchases.view                           3        PurchasesController, Suppli... ✓\n\n  PURCHASING:\n  purchasing.create                        1        MRPController ✓\n\n  RECURRING_TEMPLATES:\n  recurring_templates.activate             1        RecurringTransactionController ✓\n  recurring_templates.create               2        RecurringTransactionController ✓\n  recurring_templates.delete               1        RecurringTransactionController ✓\n  recurring_templates.edit                 2        RecurringTransactionController ✓\n  recurring_templates.execute              2        RecurringTransactionController ✓\n  recurring_templates.view                 3        RecurringTransactionController ✓\n\n  REPORTS:\n  reports.create                           2        CustomReportsController ✗\n  reports.delete                           1        CustomReportsController ✗\n  reports.edit                             2        CustomReportsController ✗\n  reports.view                             7        ReportsController ✓\n\n  ROLES:\n  roles.create                             2        RoleController ✓\n  roles.delete                             1        RoleController ✓\n  roles.edit                               2        RoleController ✓\n  roles.view                               4        RoleController ✓\n\n  SALES:\n  sales.agreements.create                  3        AgreementController ✓\n  sales.agreements.delete                  3        AgreementController ✓\n  sales.agreements.edit                    3        AgreementController ✓\n  sales.agreements.send                    2        AgreementController ✓\n  sales.agreements.view                    5        AgreementController ✓\n  sales.approve                            2        ReturnController ✗\n  sales.create                             28       BatteryQuoteController, Cre... ✓\n  sales.delete                             23       BatteryQuoteController, Cre... ✓\n  sales.edit                               20       BatteryQuoteController, Inv... ✓\n  sales.view                               34       BatteryQuoteController, Cre... ✓\n\n  SETTINGS:\n  settings.edit                            23       MenuController, TermsCondit... ✓\n  settings.view                            4        MenuController, TermsCondit... ✓\n\n  SYSTEM:\n  system.backup                            1        BackupController ✓\n  system.edit                              1        ProfileController ✗\n  system.files.delete                      3        FileManagerController ✗\n\n  TAX_JURISDICTIONS:\n  tax_jurisdictions.create                 2        TaxJurisdictionController ✓\n  tax_jurisdictions.delete                 1        TaxJurisdictionController ✓\n  tax_jurisdictions.edit                   3        TaxJurisdictionController ✓\n  tax_jurisdictions.view                   2        TaxJurisdictionController ✓\n\n  TAX_PAYMENTS:\n  tax_payments.create                      2        TaxPaymentController ✓\n  tax_payments.edit                        4        TaxPaymentController ✓\n  tax_payments.file                        1        TaxPaymentController ✓\n  tax_payments.view                        2        TaxPaymentController ✓\n\n  TAX_REPORTS:\n  tax_reports.view                         1        TaxPaymentController ✓\n\n  TICKETS:\n  tickets.create                           4        HelpDeskController, Support... ✓\n  tickets.delete                           2        SupportController ✗\n  tickets.edit                             2        HelpDeskController, Support... ✓\n\n  USERS:\n  users.create                             2        UserController ✓\n  users.delete                             3        UserController ✓\n  users.edit                               2        UserController ✓\n  users.view                               3        UserController ✓\n\n➕ CREATING MISSING PERMISSIONS\n--------------------------------------------------------------------------------\n  Found 19 missing permissions:\n\n  + calendar.create (calendar) - \"Create Calendar\"\n    Used in: CalendarController\n    ✓ Created\n\n  + calendar.edit (calendar) - \"Edit Calendar\"\n    Used in: CalendarController\n    ✓ Created\n\n  + calendar.delete (calendar) - \"Delete Calendar\"\n    Used in: CalendarController\n    ✓ Created\n\n  + reports.create (reports) - \"Create Reports\"\n    Used in: CustomReportsController\n    ✓ Created\n\n  + reports.edit (reports) - \"Edit Reports\"\n    Used in: CustomReportsController\n    ✓ Created\n\n  + reports.delete (reports) - \"Delete Reports\"\n    Used in: CustomReportsController\n    ✓ Created\n\n  + dashboard.edit (dashboard) - \"Edit Dashboard\"\n    Used in: DashboardController\n    ✓ Created\n\n  + documents.create (documents) - \"Create Documents\"\n    Used in: DocumentsController\n    ✓ Created\n\n  + system.files.delete (system) - \"System Files Delete\"\n    Used in: FileManagerController\n    ✓ Created\n\n  + messaging.create (messaging) - \"Create Messaging\"\n    Used in: MessagingController\n    ✓ Created\n\n  + messaging.edit (messaging) - \"Edit Messaging\"\n    Used in: MessagingController\n    ✓ Created\n\n  + messaging.delete (messaging) - \"Delete Messaging\"\n    Used in: MessagingController\n    ✓ Created\n\n  + admin.create (admin) - \"Create Admin\"\n    Used in: PipedriveImportController, UserGroupController\n    ✓ Created\n\n  + profile.edit (profile) - \"Edit Profile\"\n    Used in: ProfileController\n    ✓ Created\n\n  + system.edit (system) - \"Edit System\"\n    Used in: ProfileController\n    ✓ Created\n\n  + admin.edit (admin) - \"Edit Admin\"\n    Used in: QuickBooksController, UserGroupController\n    ✓ Created\n\n  + admin.delete (admin) - \"Delete Admin\"\n    Used in: QuickBooksController, UserGroupController\n    ✓ Created\n\n  + sales.approve (sales) - \"Approve Sales\"\n    Used in: ReturnController\n    ✓ Created\n\n  + tickets.delete (tickets) - \"Delete Tickets\"\n    Used in: SupportController\n    ✓ Created\n\n🗑️  UNUSED PERMISSIONS\n--------------------------------------------------------------------------------\n  Found 256 permissions in database not used in controllers:\n\n  (CORE):\n    - agreements.view - \"View Agreements\"\n    - ai-test.view - \"View AI Testing\"\n    - analytics.view - \"View analytics\"\n    - announcements.view - \"View Announcements\"\n    - assumptions.view - \"View Daily Update\"\n    - audit-logs.view - \"View Audit Log\"\n    - backup.view - \"View System Backup\"\n    - calendar.view - \"View calendar\"\n    - companies.view - \"View Companies\"\n    - creditnotes.view - \"View Credit Notes\"\n    ... and 16 more\n\n  1099:\n    - 1099_contractors.manage - \"Manage 1099 contractor designations\"\n    - 1099_filings.file - \"File 1099 forms\"\n    - 1099_filings.prepare - \"Prepare 1099 forms\"\n    - 1099_payments.manage - \"Manage 1099 payment classifications\"\n    - 1099_payments.view - \"View 1099 reportable payments\"\n    - 1099_reports.view - \"View 1099 reports\"\n\n  ACCOUNTING:\n    - accounting.customer_payments.delete - \"Delete customer payments\"\n    - accounting.customer_payments.edit - \"Edit customer payments\"\n    - accounting.post - \"Post journal entries\"\n    - accounts.create - \"Create accounts\"\n    - accounts.delete - \"Delete accounts\"\n    - accounts.edit - \"Edit accounts\"\n    - accounts.view - \"View chart of accounts\"\n    - bank_accounts.create - \"Create bank accounts\"\n    - bank_accounts.edit - \"Edit bank accounts\"\n    - bank_accounts.view - \"View bank accounts\"\n    ... and 21 more\n\n  AUDIT:\n    - audit_trail.export - \"Export audit trail\"\n    - audit_trail.view - \"View audit trail\"\n\n  AUTOMATION:\n    - automation.view - \"View Templates\"\n\n  BANK_IMPORT:\n    - bank_import.categorize - \"Categorize imported transactions\"\n    - bank_import.rules - \"Manage categorization rules\"\n\n  CREDIT_NOTES:\n    - credit_notes.apply - \"Apply Credit Notes to Invoices\"\n    - credit_notes.auto_apply - \"Auto-apply Credit Notes\"\n    - credit_notes.reverse - \"Reverse Credit Note Applications\"\n    - credit_notes.view_balances - \"View Customer Credit Balances\"\n\n  CRM:\n    - activities.create - \"Create CRM activities\"\n    - activities.edit - \"Edit CRM activities\"\n    - activities.view - \"View CRM activities\"\n    - clients.create - \"Create clients\"\n    - clients.delete - \"Delete clients\"\n    - clients.edit - \"Edit clients\"\n    - clients.view - \"View clients\"\n    - contacts.create - \"Create contacts\"\n    - contacts.delete - \"Delete contacts\"\n    - contacts.edit - \"Edit contacts\"\n    ... and 14 more\n\n  DOCUMENTS:\n    - documents.edit - \"Edit documents\"\n    - documents.upload - \"Upload documents\"\n\n  HELPDESK:\n    - tickets.assign - \"Assign support tickets\"\n    - tickets.close - \"Close support tickets\"\n    - tickets.view - \"View support tickets\"\n\n  HR:\n    - applications.create - \"Create job applications\"\n    - applications.edit - \"Edit job applications\"\n    - applications.view - \"View job applications\"\n    - assessments.create - \"Create assessments\"\n    - assessments.view - \"View assessments\"\n    - attendance.create - \"Record attendance\"\n    - attendance.view - \"View attendance\"\n    - contracts.create - \"Create employee contracts\"\n    - contracts.edit - \"Edit employee contracts\"\n    - contracts.view - \"View employee contracts\"\n    ... and 31 more\n\n  INVENTORY:\n    - camera_audit.annotate - \"Add annotations to audit images\"\n    - camera_audit.export - \"Export camera audit data\"\n    - categories.create - \"Create product categories\"\n    - categories.delete - \"Delete product categories\"\n    - categories.edit - \"Edit product categories\"\n    - categories.view - \"View product categories\"\n    - inventory.adjust - \"Adjust inventory levels\"\n    - lots.create - \"Create lot/serial numbers\"\n    - lots.edit - \"Edit lot/serial numbers\"\n    - lots.view - \"View lot/serial numbers\"\n    ... and 11 more\n\n  MANUFACTURING:\n    - boms.create - \"Create bills of materials\"\n    - boms.delete - \"Delete bills of materials\"\n    - boms.edit - \"Edit bills of materials\"\n    - boms.view - \"View bills of materials\"\n    - capacity.edit - \"Edit capacity planning\"\n    - capacity.view - \"View capacity planning\"\n    - equipment.create - \"Create equipment\"\n    - equipment.edit - \"Edit equipment\"\n    - equipment.maintenance - \"Perform equipment maintenance\"\n    - equipment.view - \"View equipment\"\n    ... and 11 more\n\n  MARKETING:\n    - campaigns.create - \"Create email campaigns\"\n    - campaigns.edit - \"Edit email campaigns\"\n    - campaigns.send - \"Send email campaigns\"\n    - campaigns.view - \"View email campaigns\"\n    - lists.create - \"Create mailing lists\"\n    - lists.view - \"View mailing lists\"\n    - templates.create - \"Create email templates\"\n    - templates.view - \"View email templates\"\n\n  PURCHASES:\n    - bills.approve - \"Approve supplier bills\"\n    - bills.create - \"Create supplier bills\"\n    - bills.view - \"View supplier bills\"\n    - goods_receipts.create - \"Create goods receipts\"\n    - goods_receipts.view - \"View goods receipts\"\n    - purchase_orders.approve - \"Approve purchase orders\"\n    - purchase_orders.create - \"Create purchase orders\"\n    - purchase_orders.delete - \"Delete purchase orders\"\n    - purchase_orders.edit - \"Edit purchase orders\"\n    - purchase_orders.view - \"View purchase orders\"\n    ... and 9 more\n\n  REPORTS:\n    - reports.export - \"Export reports\"\n\n  SALES:\n    - delivery_notes.create - \"Create delivery notes\"\n    - delivery_notes.view - \"View delivery notes\"\n    - invoices.create - \"Create invoices\"\n    - invoices.delete - \"Delete invoices\"\n    - invoices.edit - \"Edit invoices\"\n    - invoices.view - \"View invoices\"\n    - orders.approve - \"Approve sales orders\"\n    - orders.create - \"Create sales orders\"\n    - orders.delete - \"Delete sales orders\"\n    - orders.edit - \"Edit sales orders\"\n    ... and 22 more\n\n  SECURITY:\n    - mfa.admin_override - \"Admin: Override MFA for any user\"\n    - mfa.manage_own - \"Manage own MFA settings\"\n    - security.view_audit - \"View security audit logs\"\n\n  STATEMENTS:\n    - statements.bulk_generate - \"Generate Bulk Statements\"\n    - statements.email - \"Email Statements to Customers\"\n    - statements.generate - \"Generate Customer Statements\"\n    - statements.view_history - \"View Statement History\"\n\n  SYSTEM:\n    - files.delete - \"Delete files and folders\"\n    - files.manage - \"Manage all files and folders\"\n    - files.upload - \"Upload files\"\n\n  TAX:\n    - tax_exemptions.manage - \"Manage tax exemptions\"\n    - tax_exemptions.view - \"View tax exemptions\"\n\n  ⚠️  NOTE: These may be used in views or future features.\n  Review carefully before deleting.\n\n📊 COVERAGE STATISTICS\n--------------------------------------------------------------------------------\n  Permissions in database:        385\n  Permissions in controllers:     148\n  Matching (in both):             129\n  Missing from database:          19\n  Unused in controllers:          256\n  Coverage:                       87.2%\n\n  PERMISSIONS BY MODULE:\n    accounting                      13 permissions\n    sales                           10 permissions\n    forecasting                     10 permissions\n    admin                            6 permissions\n    bank_import                      6 permissions\n    ndas                             6 permissions\n    recurring_templates              6 permissions\n    manufacturing                    5 permissions\n    camera_audit                     5 permissions\n    inventory                        5 permissions\n\n\n================================================================================\nSCAN COMPLETE\n================================================================================\n','Script executed successfully','2025-11-28 13:23:58'),
(17,'sync_permissions_menu',1,'{\"mode\":\"dry-run\"}',1,'\n\n\n\n\n================================================================================\nPERMISSION SYNC UTILITY\nMODE: DRY RUN (no changes will be made)\n================================================================================\n\n📱 CHECKING APP GRID PERMISSIONS\n--------------------------------------------------------------------------------\n  ✓ All App Grid items have permissions\n\n📋 CHECKING MENU ITEM PERMISSIONS\n--------------------------------------------------------------------------------\n  ✓ All menu items have corresponding permissions\n\n🔧 STANDARDIZING MODULE NAMES\n--------------------------------------------------------------------------------\n  ✓ No obvious standardization issues found\n\n\n================================================================================\nSYNC COMPLETE\n================================================================================\n\nThis was a dry run. Run with --live flag to apply changes.\n','Script executed successfully','2025-11-28 13:24:11'),
(18,'sync_permissions_menu',1,'{\"mode\":\"live\"}',1,'\n\n\n\n\n================================================================================\nPERMISSION SYNC UTILITY\nMODE: LIVE (changes WILL be applied to database)\n================================================================================\n\n📱 CHECKING APP GRID PERMISSIONS\n--------------------------------------------------------------------------------\n  ✓ All App Grid items have permissions\n\n📋 CHECKING MENU ITEM PERMISSIONS\n--------------------------------------------------------------------------------\n  ✓ All menu items have corresponding permissions\n\n🔧 STANDARDIZING MODULE NAMES\n--------------------------------------------------------------------------------\n  ✓ No obvious standardization issues found\n\n\n================================================================================\nSYNC COMPLETE\n================================================================================\n','Script executed successfully','2025-11-28 13:24:35'),
(19,'categorize_unprotected',1,'[]',1,'=== Unprotected Methods Analysis ===\nGenerated: 2025-11-28 14:15:31\n\nTotal unprotected methods: 302\n\n╔══════════════════════════════════════════════════════════════╗\n║  1. INTENTIONALLY PUBLIC (9 methods) - OK           ║\n╚══════════════════════════════════════════════════════════════╝\nThese methods are designed to be public (login, agreements, etc.)\nAction: ✓ Document and keep as-is\n\n  ✓ AgreementController::publicView()\n  ✓ AgreementController::acceptAgreement()\n  ✓ AgreementController::declineAgreement()\n  ✓ AgreementController::thankYou()\n  ✓ AuthController::loginForm()\n  ✓ AuthController::login()\n  ✓ AuthController::logout()\n  ✓ AuthController::forgotPassword()\n  ✓ AuthController::resetPassword()\n\n╔══════════════════════════════════════════════════════════════╗\n║  2. TEST/DEVELOPMENT (10 methods)                  ║\n╚══════════════════════════════════════════════════════════════╝\nTest controllers that should be removed or protected in production\nAction: ⚠ Remove from production OR add admin-only protection\n\n  ⚠ AITestController (9 methods)\n     - index()\n     - chat()\n     - generate()\n     - extract()\n     - sentiment()\n     ... and 4 more\n  ⚠ TestController (1 methods)\n     - formGenerator()\n\n╔══════════════════════════════════════════════════════════════╗\n║  3. NEEDS REVIEW (11 methods)                      ║\n╚══════════════════════════════════════════════════════════════╝\nSystem/utility methods that may need special handling\nAction: ⏳ Review each to determine if protection is needed\n\n  ? AuthController::forgotPasswordForm()\n  ? AuthController::resetPasswordForm()\n  ? BackupController::index()\n  ? BackupController::triggerDatabaseBackup()\n  ? BackupController::triggerGitPush()\n  ? BackupController::triggerFullBackup()\n  ? BackupController::getHistory()\n  ? BackupController::getStats()\n  ? BackupController::showDetails()\n  ? QuoteController::publicView()\n  ? QuoteController::thankYou()\n\n╔══════════════════════════════════════════════════════════════╗\n║  4. AUTH ONLY (107 methods) - Medium Priority      ║\n╚══════════════════════════════════════════════════════════════╝\nMethods with authentication but no permission check\nAction: ⏳ Evaluate if permission check needed based on sensitivity\n\n  ⏳ ApprovalsController (1 methods)\n     - dashboard()\n  ⏳ CalendarController (2 methods)\n     - index()\n     - getEvents()\n  ⏳ CurrencyController (2 methods)\n     - getRate()\n     - convertAmount()\n  ⏳ CustomReportsController (5 methods)\n     - builder()\n     - my()\n     - shared()\n     ... and 2 more\n  ⏳ DashboardController (2 methods)\n     - index()\n     - customize()\n  ⏳ DocumentsController (7 methods)\n     - all()\n     - my()\n     - shared()\n     ... and 4 more\n  ⏳ EmailController (20 methods)\n     - index()\n     - folder()\n     - viewEmail()\n     ... and 17 more\n  ⏳ EmployeeController (1 methods)\n     - directory()\n  ⏳ FileManagerController (9 methods)\n     - index()\n     - browse()\n     - tree()\n     ... and 6 more\n  ⏳ FinancialProFormaController (2 methods)\n     - index()\n     - assumptions()\n  ⏳ GoodsReceiptController (1 methods)\n     - getPOItemsAjax()\n  ⏳ HelpDeskController (11 methods)\n     - dashboard()\n     - tickets()\n     - myTickets()\n     ... and 8 more\n  ⏳ InternalNoteAPIController (2 methods)\n     - add()\n     - togglePin()\n  ⏳ MFAController (5 methods)\n     - setupForm()\n     - setup()\n     - showBackupCodes()\n     ... and 2 more\n  ⏳ MessagingController (9 methods)\n     - index()\n     - channel()\n     - getChannelMembers()\n     ... and 6 more\n  ⏳ NextcloudProxyController (1 methods)\n     - proxyLogin()\n  ⏳ NextcloudSSOController (2 methods)\n     - generateToken()\n     - autoLogin()\n  ⏳ NotificationController (1 methods)\n     - index()\n  ⏳ ProFormaController (3 methods)\n     - index()\n     - location()\n     - compare()\n  ⏳ ProfileController (4 methods)\n     - index()\n     - uploadAvatar()\n     - changePassword()\n     ... and 1 more\n  ⏳ QuickBooksController (11 methods)\n     - index()\n     - connect()\n     - callback()\n     ... and 8 more\n  ⏳ QuoteTemplateController (1 methods)\n     - getTemplate()\n  ⏳ SearchController (1 methods)\n     - searchCustomers()\n  ⏳ TaxJurisdictionController (2 methods)\n     - getCitiesByState()\n     - calculateCustomerTax()\n  ⏳ TermsConditionsController (2 methods)\n     - show()\n     - getByType()\n\n╔══════════════════════════════════════════════════════════════╗\n║  5. NEEDS PROTECTION (165 methods) - HIGH PRIORITY!   ║\n╚══════════════════════════════════════════════════════════════╝\n🚨 These methods MUST have protection added immediately!\nAction: 🚨 Add requireAuth() + checkPermission() ASAP\n\n  🚨 ApiController (2 methods)\n     - usersList()  [controllers/ApiController.php]\n     - allUsers()  [controllers/ApiController.php]\n\n  🚨 BankImportController (4 methods)\n     - upload()  [controllers/BankImportController.php]\n     - categorizeTransaction()  [controllers/BankImportController.php]\n     - applyRules()  [controllers/BankImportController.php]\n     - toggleRule()  [controllers/BankImportController.php]\n\n  🚨 CameraAuditController (3 methods)\n     - capture()  [controllers/CameraAuditController.php]\n     - createStation()  [controllers/CameraAuditController.php]\n     - editStation()  [controllers/CameraAuditController.php]\n\n  🚨 ContactAPIController (1 methods)\n     - getByCompany()  [controllers/ContactAPIController.php]\n\n  🚨 CurrencyController (2 methods)\n     - createCurrency()  [controllers/CurrencyController.php]\n     - createRevaluation()  [controllers/CurrencyController.php]\n\n  🚨 CustomReportsController (1 methods)\n     - index()  [controllers/CustomReportsController.php]\n\n  🚨 DashboardController (3 methods)\n     - addWidget()  [controllers/DashboardController.php]\n     - toggleWidget()  [controllers/DashboardController.php]\n     - refreshWidget()  [controllers/DashboardController.php]\n\n  🚨 DocumentationController (4 methods)\n     - index()  [controllers/DocumentationController.php]\n     - search()  [controllers/DocumentationController.php]\n     - download()  [controllers/DocumentationController.php]\n     - refreshCoverage()  [controllers/DocumentationController.php]\n\n  🚨 EmailTemplateController (1 methods)\n     - toggleActive()  [controllers/EmailTemplateController.php]\n\n  🚨 EmailWebhookController (2 methods)\n     - receive()  [controllers/EmailWebhookController.php]\n     - test()  [controllers/EmailWebhookController.php]\n\n  🚨 FileManagerController (9 methods)\n     - upload()  [controllers/FileManagerController.php]\n     - createFolder()  [controllers/FileManagerController.php]\n     - rename()  [controllers/FileManagerController.php]\n     - move()  [controllers/FileManagerController.php]\n     - moveFolder()  [controllers/FileManagerController.php]\n     - compress()  [controllers/FileManagerController.php]\n     - extract()  [controllers/FileManagerController.php]\n     - shareFile()  [controllers/FileManagerController.php]\n     - shareFolder()  [controllers/FileManagerController.php]\n\n  🚨 FinancialProFormaController (2 methods)\n     - generate()  [controllers/FinancialProFormaController.php]\n     - compare()  [controllers/FinancialProFormaController.php]\n\n  🚨 ForecasterController (4 methods)\n     - createForecast()  [controllers/ForecasterController.php]\n     - createScenario()  [controllers/ForecasterController.php]\n     - createFinancing()  [controllers/ForecasterController.php]\n     - createInvestment()  [controllers/ForecasterController.php]\n\n  🚨 HelpDeskController (3 methods)\n     - chatAssignSession()  [controllers/HelpDeskController.php]\n     - chatEndSession()  [controllers/HelpDeskController.php]\n     - chatCreateSession()  [controllers/HelpDeskController.php]\n\n  🚨 InternalNoteAPIController (1 methods)\n     - index()  [controllers/InternalNoteAPIController.php]\n\n  🚨 MFAController (3 methods)\n     - verifyForm()  [controllers/MFAController.php]\n     - verify()  [controllers/MFAController.php]\n     - resendOTP()  [controllers/MFAController.php]\n\n  🚨 MRPController (4 methods)\n     - calculate()  [controllers/MRPController.php]\n     - generateRequisitions()  [controllers/MRPController.php]\n     - autoCalculateSafetyStock()  [controllers/MRPController.php]\n     - convertToPO()  [controllers/MRPController.php]\n\n  🚨 MachineDataController (5 methods)\n     - updateStatus()  [controllers/MachineDataController.php]\n     - updateProduction()  [controllers/MachineDataController.php]\n     - updateUtilization()  [controllers/MachineDataController.php]\n     - getStatus()  [controllers/MachineDataController.php]\n     - health()  [controllers/MachineDataController.php]\n\n  🚨 MaintenanceController (6 methods)\n     - createSchedule()  [controllers/MaintenanceController.php]\n     - storeSchedule()  [controllers/MaintenanceController.php]\n     - createWorkOrder()  [controllers/MaintenanceController.php]\n     - storeWorkOrder()  [controllers/MaintenanceController.php]\n     - createDowntime()  [controllers/MaintenanceController.php]\n     - storeDowntime()  [controllers/MaintenanceController.php]\n\n  🚨 MessagingController (5 methods)\n     - createChannel()  [controllers/MessagingController.php]\n     - addMember()  [controllers/MessagingController.php]\n     - uploadFile()  [controllers/MessagingController.php]\n     - addReaction()  [controllers/MessagingController.php]\n     - leaveChannel()  [controllers/MessagingController.php]\n\n  🚨 NDAController (3 methods)\n     - publicSign()  [controllers/NDAController.php]\n     - signNDA()  [controllers/NDAController.php]\n     - declineNDA()  [controllers/NDAController.php]\n\n  🚨 NDATemplateController (1 methods)\n     - toggle()  [controllers/NDATemplateController.php]\n\n  🚨 NetworkMonitorController (8 methods)\n     - status()  [controllers/NetworkMonitorController.php]\n     - logs()  [controllers/NetworkMonitorController.php]\n     - statistics()  [controllers/NetworkMonitorController.php]\n     - feed()  [controllers/NetworkMonitorController.php]\n     - clearLogs()  [controllers/NetworkMonitorController.php]\n     - addAllowedHost()  [controllers/NetworkMonitorController.php]\n     - testConnection()  [controllers/NetworkMonitorController.php]\n     - logDetail()  [controllers/NetworkMonitorController.php]\n\n  🚨 NextcloudController (5 methods)\n     - settings()  [controllers/NextcloudController.php]\n     - viewDocument()  [controllers/NextcloudController.php]\n     - quickCreateWord()  [controllers/NextcloudController.php]\n     - quickCreateExcel()  [controllers/NextcloudController.php]\n     - quickCreatePowerPoint()  [controllers/NextcloudController.php]\n\n  🚨 NextcloudSSOController (1 methods)\n     - validateToken()  [controllers/NextcloudSSOController.php]\n\n  🚨 NotificationController (4 methods)\n     - getUnread()  [controllers/NotificationController.php]\n     - markAsRead()  [controllers/NotificationController.php]\n     - markAllAsRead()  [controllers/NotificationController.php]\n     - delete()  [controllers/NotificationController.php]\n\n  🚨 OpportunityController (5 methods)\n     - addTask()  [controllers/OpportunityController.php]\n     - logReceivedEmail()  [controllers/OpportunityController.php]\n     - uploadDocument()  [controllers/OpportunityController.php]\n     - addCompetitor()  [controllers/OpportunityController.php]\n     - assign()  [controllers/OpportunityController.php]\n\n  🚨 PeriodClosingController (1 methods)\n     - processClose()  [controllers/PeriodClosingController.php]\n\n  🚨 PermissionGroupController (2 methods)\n     - assignPermissions()  [controllers/PermissionGroupController.php]\n     - reorder()  [controllers/PermissionGroupController.php]\n\n  🚨 PipedriveImportController (3 methods)\n     - index()  [controllers/PipedriveImportController.php]\n     - viewLog()  [controllers/PipedriveImportController.php]\n     - getStats()  [controllers/PipedriveImportController.php]\n\n  🚨 PricingRuleController (1 methods)\n     - calculatePrice()  [controllers/PricingRuleController.php]\n\n  🚨 ProFormaController (1 methods)\n     - calculate()  [controllers/ProFormaController.php]\n\n  🚨 ProductForecastController (1 methods)\n     - gettingStarted()  [controllers/ProductForecastController.php]\n\n  🚨 ProjectsController (31 methods)\n     - dashboard()  [controllers/ProjectsController.php]\n     - myTasks()  [controllers/ProjectsController.php]\n     - index()  [controllers/ProjectsController.php]\n     - show()  [controllers/ProjectsController.php]\n     - listView()  [controllers/ProjectsController.php]\n     - moveTask()  [controllers/ProjectsController.php]\n     - getTask()  [controllers/ProjectsController.php]\n     - addComment()  [controllers/ProjectsController.php]\n     - assignUser()  [controllers/ProjectsController.php]\n     - unassignUser()  [controllers/ProjectsController.php]\n     - addChecklistItem()  [controllers/ProjectsController.php]\n     - toggleChecklistItem()  [controllers/ProjectsController.php]\n     - addTeamMember()  [controllers/ProjectsController.php]\n     - addTeamGroup()  [controllers/ProjectsController.php]\n     - assignGroupToTask()  [controllers/ProjectsController.php]\n     - unassignGroupFromTask()  [controllers/ProjectsController.php]\n     - financials()  [controllers/ProjectsController.php]\n     - createTransaction()  [controllers/ProjectsController.php]\n     - storeTransaction()  [controllers/ProjectsController.php]\n     - editTransaction()  [controllers/ProjectsController.php]\n     - linkTransactionToTask()  [controllers/ProjectsController.php]\n     - migrateTransactions()  [controllers/ProjectsController.php]\n     - processMigration()  [controllers/ProjectsController.php]\n     - gantt()  [controllers/ProjectsController.php]\n     - calculateCriticalPath()  [controllers/ProjectsController.php]\n     - addTaskDependency()  [controllers/ProjectsController.php]\n     - resources()  [controllers/ProjectsController.php]\n     - resourceDayDetails()  [controllers/ProjectsController.php]\n     - autoAllocateResources()  [controllers/ProjectsController.php]\n     - getTaskComments()  [controllers/ProjectsController.php]\n     - addTaskComment()  [controllers/ProjectsController.php]\n\n  🚨 PromotionController (2 methods)\n     - validateCode()  [controllers/PromotionController.php]\n     - applyPromotion()  [controllers/PromotionController.php]\n\n  🚨 QualityController (4 methods)\n     - createInspection()  [controllers/QualityController.php]\n     - completeInspection()  [controllers/QualityController.php]\n     - createNCR()  [controllers/QualityController.php]\n     - createTemplate()  [controllers/QualityController.php]\n\n  🚨 QuoteController (2 methods)\n     - acceptQuote()  [controllers/QuoteController.php]\n     - declineQuote()  [controllers/QuoteController.php]\n\n  🚨 ReturnController (1 methods)\n     - complete()  [controllers/ReturnController.php]\n\n  🚨 SalesReportController (10 methods)\n     - getSummary()  [controllers/SalesReportController.php]\n     - getTopProducts()  [controllers/SalesReportController.php]\n     - getTopCustomers()  [controllers/SalesReportController.php]\n     - getByStatus()  [controllers/SalesReportController.php]\n     - getByChannel()  [controllers/SalesReportController.php]\n     - getInvoiceAnalytics()  [controllers/SalesReportController.php]\n     - getPaymentAnalytics()  [controllers/SalesReportController.php]\n     - getCategoryPerformance()  [controllers/SalesReportController.php]\n     - getSalesGrowth()  [controllers/SalesReportController.php]\n     - getQuoteConversion()  [controllers/SalesReportController.php]\n\n  🚨 SchedulingController (3 methods)\n     - autoSchedule()  [controllers/SchedulingController.php]\n     - rescheduleAssignment()  [controllers/SchedulingController.php]\n     - createAssignment()  [controllers/SchedulingController.php]\n\n  🚨 SearchController (1 methods)\n     - search()  [controllers/SearchController.php]\n\n  🚨 SettingsController (1 methods)\n     - testSmtpConnection()  [controllers/SettingsController.php]\n\n  🚨 ShopFloorController (3 methods)\n     - startProduction()  [controllers/ShopFloorController.php]\n     - pauseProduction()  [controllers/ShopFloorController.php]\n     - completeProduction()  [controllers/ShopFloorController.php]\n\n  🚨 SupportController (1 methods)\n     - addResponse()  [controllers/SupportController.php]\n\n  🚨 TaxPaymentController (1 methods)\n     - calculatePeriodTax()  [controllers/TaxPaymentController.php]\n\n  🚨 TransferController (2 methods)\n     - receive()  [controllers/TransferController.php]\n     - cancel()  [controllers/TransferController.php]\n\n  🚨 UserGroupController (2 methods)\n     - addMember()  [controllers/UserGroupController.php]\n     - addUse()  [controllers/UserGroupController.php]\n\n═══════════════════════════════════════════════════════════════\nSUMMARY\n═══════════════════════════════════════════════════════════════\n✓ Intentionally Public:  9 (OK)\n⚠ Test/Dev Controllers:  10 (Remove/Protect)\n? Needs Review:          11 (Evaluate)\n⏳ Auth Only:            107 (Medium Priority)\n🚨 Needs Protection:     165 (HIGH PRIORITY!)\n─────────────────────────────────────────────────────────────\nTotal:                   302 methods\n\n🚨 IMMEDIATE ACTION REQUIRED:\n165 methods need protection added immediately!\n\n⚠ BEFORE PRODUCTION:\nRemove 10 test/dev methods or add admin protection\n','Script executed successfully','2025-11-28 14:15:31'),
(20,'categorize_unprotected',1,'[]',1,'=== Unprotected Methods Analysis ===\nGenerated: 2025-11-28 14:20:24\n\nTotal unprotected methods: 302\n\n╔══════════════════════════════════════════════════════════════╗\n║  1. INTENTIONALLY PUBLIC (9 methods) - OK           ║\n╚══════════════════════════════════════════════════════════════╝\nThese methods are designed to be public (login, agreements, etc.)\nAction: ✓ Document and keep as-is\n\n  ✓ AgreementController::publicView()\n  ✓ AgreementController::acceptAgreement()\n  ✓ AgreementController::declineAgreement()\n  ✓ AgreementController::thankYou()\n  ✓ AuthController::loginForm()\n  ✓ AuthController::login()\n  ✓ AuthController::logout()\n  ✓ AuthController::forgotPassword()\n  ✓ AuthController::resetPassword()\n\n╔══════════════════════════════════════════════════════════════╗\n║  2. TEST/DEVELOPMENT (10 methods)                  ║\n╚══════════════════════════════════════════════════════════════╝\nTest controllers that should be removed or protected in production\nAction: ⚠ Remove from production OR add admin-only protection\n\n  ⚠ AITestController (9 methods)\n     - index()\n     - chat()\n     - generate()\n     - extract()\n     - sentiment()\n     ... and 4 more\n  ⚠ TestController (1 methods)\n     - formGenerator()\n\n╔══════════════════════════════════════════════════════════════╗\n║  3. NEEDS REVIEW (11 methods)                      ║\n╚══════════════════════════════════════════════════════════════╝\nSystem/utility methods that may need special handling\nAction: ⏳ Review each to determine if protection is needed\n\n  ? AuthController::forgotPasswordForm()\n  ? AuthController::resetPasswordForm()\n  ? BackupController::index()\n  ? BackupController::triggerDatabaseBackup()\n  ? BackupController::triggerGitPush()\n  ? BackupController::triggerFullBackup()\n  ? BackupController::getHistory()\n  ? BackupController::getStats()\n  ? BackupController::showDetails()\n  ? QuoteController::publicView()\n  ? QuoteController::thankYou()\n\n╔══════════════════════════════════════════════════════════════╗\n║  4. AUTH ONLY (107 methods) - Medium Priority      ║\n╚══════════════════════════════════════════════════════════════╝\nMethods with authentication but no permission check\nAction: ⏳ Evaluate if permission check needed based on sensitivity\n\n  ⏳ ApprovalsController (1 methods)\n     - dashboard()\n  ⏳ CalendarController (2 methods)\n     - index()\n     - getEvents()\n  ⏳ CurrencyController (2 methods)\n     - getRate()\n     - convertAmount()\n  ⏳ CustomReportsController (5 methods)\n     - builder()\n     - my()\n     - shared()\n     ... and 2 more\n  ⏳ DashboardController (2 methods)\n     - index()\n     - customize()\n  ⏳ DocumentsController (7 methods)\n     - all()\n     - my()\n     - shared()\n     ... and 4 more\n  ⏳ EmailController (20 methods)\n     - index()\n     - folder()\n     - viewEmail()\n     ... and 17 more\n  ⏳ EmployeeController (1 methods)\n     - directory()\n  ⏳ FileManagerController (9 methods)\n     - index()\n     - browse()\n     - tree()\n     ... and 6 more\n  ⏳ FinancialProFormaController (2 methods)\n     - index()\n     - assumptions()\n  ⏳ GoodsReceiptController (1 methods)\n     - getPOItemsAjax()\n  ⏳ HelpDeskController (11 methods)\n     - dashboard()\n     - tickets()\n     - myTickets()\n     ... and 8 more\n  ⏳ InternalNoteAPIController (2 methods)\n     - add()\n     - togglePin()\n  ⏳ MFAController (5 methods)\n     - setupForm()\n     - setup()\n     - showBackupCodes()\n     ... and 2 more\n  ⏳ MessagingController (9 methods)\n     - index()\n     - channel()\n     - getChannelMembers()\n     ... and 6 more\n  ⏳ NextcloudProxyController (1 methods)\n     - proxyLogin()\n  ⏳ NextcloudSSOController (2 methods)\n     - generateToken()\n     - autoLogin()\n  ⏳ NotificationController (1 methods)\n     - index()\n  ⏳ ProFormaController (3 methods)\n     - index()\n     - location()\n     - compare()\n  ⏳ ProfileController (4 methods)\n     - index()\n     - uploadAvatar()\n     - changePassword()\n     ... and 1 more\n  ⏳ QuickBooksController (11 methods)\n     - index()\n     - connect()\n     - callback()\n     ... and 8 more\n  ⏳ QuoteTemplateController (1 methods)\n     - getTemplate()\n  ⏳ SearchController (1 methods)\n     - searchCustomers()\n  ⏳ TaxJurisdictionController (2 methods)\n     - getCitiesByState()\n     - calculateCustomerTax()\n  ⏳ TermsConditionsController (2 methods)\n     - show()\n     - getByType()\n\n╔══════════════════════════════════════════════════════════════╗\n║  5. NEEDS PROTECTION (165 methods) - HIGH PRIORITY!   ║\n╚══════════════════════════════════════════════════════════════╝\n🚨 These methods MUST have protection added immediately!\nAction: 🚨 Add requireAuth() + checkPermission() ASAP\n\n  🚨 ApiController (2 methods)\n     - usersList()  [controllers/ApiController.php]\n     - allUsers()  [controllers/ApiController.php]\n\n  🚨 BankImportController (4 methods)\n     - upload()  [controllers/BankImportController.php]\n     - categorizeTransaction()  [controllers/BankImportController.php]\n     - applyRules()  [controllers/BankImportController.php]\n     - toggleRule()  [controllers/BankImportController.php]\n\n  🚨 CameraAuditController (3 methods)\n     - capture()  [controllers/CameraAuditController.php]\n     - createStation()  [controllers/CameraAuditController.php]\n     - editStation()  [controllers/CameraAuditController.php]\n\n  🚨 ContactAPIController (1 methods)\n     - getByCompany()  [controllers/ContactAPIController.php]\n\n  🚨 CurrencyController (2 methods)\n     - createCurrency()  [controllers/CurrencyController.php]\n     - createRevaluation()  [controllers/CurrencyController.php]\n\n  🚨 CustomReportsController (1 methods)\n     - index()  [controllers/CustomReportsController.php]\n\n  🚨 DashboardController (3 methods)\n     - addWidget()  [controllers/DashboardController.php]\n     - toggleWidget()  [controllers/DashboardController.php]\n     - refreshWidget()  [controllers/DashboardController.php]\n\n  🚨 DocumentationController (4 methods)\n     - index()  [controllers/DocumentationController.php]\n     - search()  [controllers/DocumentationController.php]\n     - download()  [controllers/DocumentationController.php]\n     - refreshCoverage()  [controllers/DocumentationController.php]\n\n  🚨 EmailTemplateController (1 methods)\n     - toggleActive()  [controllers/EmailTemplateController.php]\n\n  🚨 EmailWebhookController (2 methods)\n     - receive()  [controllers/EmailWebhookController.php]\n     - test()  [controllers/EmailWebhookController.php]\n\n  🚨 FileManagerController (9 methods)\n     - upload()  [controllers/FileManagerController.php]\n     - createFolder()  [controllers/FileManagerController.php]\n     - rename()  [controllers/FileManagerController.php]\n     - move()  [controllers/FileManagerController.php]\n     - moveFolder()  [controllers/FileManagerController.php]\n     - compress()  [controllers/FileManagerController.php]\n     - extract()  [controllers/FileManagerController.php]\n     - shareFile()  [controllers/FileManagerController.php]\n     - shareFolder()  [controllers/FileManagerController.php]\n\n  🚨 FinancialProFormaController (2 methods)\n     - generate()  [controllers/FinancialProFormaController.php]\n     - compare()  [controllers/FinancialProFormaController.php]\n\n  🚨 ForecasterController (4 methods)\n     - createForecast()  [controllers/ForecasterController.php]\n     - createScenario()  [controllers/ForecasterController.php]\n     - createFinancing()  [controllers/ForecasterController.php]\n     - createInvestment()  [controllers/ForecasterController.php]\n\n  🚨 HelpDeskController (3 methods)\n     - chatAssignSession()  [controllers/HelpDeskController.php]\n     - chatEndSession()  [controllers/HelpDeskController.php]\n     - chatCreateSession()  [controllers/HelpDeskController.php]\n\n  🚨 InternalNoteAPIController (1 methods)\n     - index()  [controllers/InternalNoteAPIController.php]\n\n  🚨 MFAController (3 methods)\n     - verifyForm()  [controllers/MFAController.php]\n     - verify()  [controllers/MFAController.php]\n     - resendOTP()  [controllers/MFAController.php]\n\n  🚨 MRPController (4 methods)\n     - calculate()  [controllers/MRPController.php]\n     - generateRequisitions()  [controllers/MRPController.php]\n     - autoCalculateSafetyStock()  [controllers/MRPController.php]\n     - convertToPO()  [controllers/MRPController.php]\n\n  🚨 MachineDataController (5 methods)\n     - updateStatus()  [controllers/MachineDataController.php]\n     - updateProduction()  [controllers/MachineDataController.php]\n     - updateUtilization()  [controllers/MachineDataController.php]\n     - getStatus()  [controllers/MachineDataController.php]\n     - health()  [controllers/MachineDataController.php]\n\n  🚨 MaintenanceController (6 methods)\n     - createSchedule()  [controllers/MaintenanceController.php]\n     - storeSchedule()  [controllers/MaintenanceController.php]\n     - createWorkOrder()  [controllers/MaintenanceController.php]\n     - storeWorkOrder()  [controllers/MaintenanceController.php]\n     - createDowntime()  [controllers/MaintenanceController.php]\n     - storeDowntime()  [controllers/MaintenanceController.php]\n\n  🚨 MessagingController (5 methods)\n     - createChannel()  [controllers/MessagingController.php]\n     - addMember()  [controllers/MessagingController.php]\n     - uploadFile()  [controllers/MessagingController.php]\n     - addReaction()  [controllers/MessagingController.php]\n     - leaveChannel()  [controllers/MessagingController.php]\n\n  🚨 NDAController (3 methods)\n     - publicSign()  [controllers/NDAController.php]\n     - signNDA()  [controllers/NDAController.php]\n     - declineNDA()  [controllers/NDAController.php]\n\n  🚨 NDATemplateController (1 methods)\n     - toggle()  [controllers/NDATemplateController.php]\n\n  🚨 NetworkMonitorController (8 methods)\n     - status()  [controllers/NetworkMonitorController.php]\n     - logs()  [controllers/NetworkMonitorController.php]\n     - statistics()  [controllers/NetworkMonitorController.php]\n     - feed()  [controllers/NetworkMonitorController.php]\n     - clearLogs()  [controllers/NetworkMonitorController.php]\n     - addAllowedHost()  [controllers/NetworkMonitorController.php]\n     - testConnection()  [controllers/NetworkMonitorController.php]\n     - logDetail()  [controllers/NetworkMonitorController.php]\n\n  🚨 NextcloudController (5 methods)\n     - settings()  [controllers/NextcloudController.php]\n     - viewDocument()  [controllers/NextcloudController.php]\n     - quickCreateWord()  [controllers/NextcloudController.php]\n     - quickCreateExcel()  [controllers/NextcloudController.php]\n     - quickCreatePowerPoint()  [controllers/NextcloudController.php]\n\n  🚨 NextcloudSSOController (1 methods)\n     - validateToken()  [controllers/NextcloudSSOController.php]\n\n  🚨 NotificationController (4 methods)\n     - getUnread()  [controllers/NotificationController.php]\n     - markAsRead()  [controllers/NotificationController.php]\n     - markAllAsRead()  [controllers/NotificationController.php]\n     - delete()  [controllers/NotificationController.php]\n\n  🚨 OpportunityController (5 methods)\n     - addTask()  [controllers/OpportunityController.php]\n     - logReceivedEmail()  [controllers/OpportunityController.php]\n     - uploadDocument()  [controllers/OpportunityController.php]\n     - addCompetitor()  [controllers/OpportunityController.php]\n     - assign()  [controllers/OpportunityController.php]\n\n  🚨 PeriodClosingController (1 methods)\n     - processClose()  [controllers/PeriodClosingController.php]\n\n  🚨 PermissionGroupController (2 methods)\n     - assignPermissions()  [controllers/PermissionGroupController.php]\n     - reorder()  [controllers/PermissionGroupController.php]\n\n  🚨 PipedriveImportController (3 methods)\n     - index()  [controllers/PipedriveImportController.php]\n     - viewLog()  [controllers/PipedriveImportController.php]\n     - getStats()  [controllers/PipedriveImportController.php]\n\n  🚨 PricingRuleController (1 methods)\n     - calculatePrice()  [controllers/PricingRuleController.php]\n\n  🚨 ProFormaController (1 methods)\n     - calculate()  [controllers/ProFormaController.php]\n\n  🚨 ProductForecastController (1 methods)\n     - gettingStarted()  [controllers/ProductForecastController.php]\n\n  🚨 ProjectsController (31 methods)\n     - dashboard()  [controllers/ProjectsController.php]\n     - myTasks()  [controllers/ProjectsController.php]\n     - index()  [controllers/ProjectsController.php]\n     - show()  [controllers/ProjectsController.php]\n     - listView()  [controllers/ProjectsController.php]\n     - moveTask()  [controllers/ProjectsController.php]\n     - getTask()  [controllers/ProjectsController.php]\n     - addComment()  [controllers/ProjectsController.php]\n     - assignUser()  [controllers/ProjectsController.php]\n     - unassignUser()  [controllers/ProjectsController.php]\n     - addChecklistItem()  [controllers/ProjectsController.php]\n     - toggleChecklistItem()  [controllers/ProjectsController.php]\n     - addTeamMember()  [controllers/ProjectsController.php]\n     - addTeamGroup()  [controllers/ProjectsController.php]\n     - assignGroupToTask()  [controllers/ProjectsController.php]\n     - unassignGroupFromTask()  [controllers/ProjectsController.php]\n     - financials()  [controllers/ProjectsController.php]\n     - createTransaction()  [controllers/ProjectsController.php]\n     - storeTransaction()  [controllers/ProjectsController.php]\n     - editTransaction()  [controllers/ProjectsController.php]\n     - linkTransactionToTask()  [controllers/ProjectsController.php]\n     - migrateTransactions()  [controllers/ProjectsController.php]\n     - processMigration()  [controllers/ProjectsController.php]\n     - gantt()  [controllers/ProjectsController.php]\n     - calculateCriticalPath()  [controllers/ProjectsController.php]\n     - addTaskDependency()  [controllers/ProjectsController.php]\n     - resources()  [controllers/ProjectsController.php]\n     - resourceDayDetails()  [controllers/ProjectsController.php]\n     - autoAllocateResources()  [controllers/ProjectsController.php]\n     - getTaskComments()  [controllers/ProjectsController.php]\n     - addTaskComment()  [controllers/ProjectsController.php]\n\n  🚨 PromotionController (2 methods)\n     - validateCode()  [controllers/PromotionController.php]\n     - applyPromotion()  [controllers/PromotionController.php]\n\n  🚨 QualityController (4 methods)\n     - createInspection()  [controllers/QualityController.php]\n     - completeInspection()  [controllers/QualityController.php]\n     - createNCR()  [controllers/QualityController.php]\n     - createTemplate()  [controllers/QualityController.php]\n\n  🚨 QuoteController (2 methods)\n     - acceptQuote()  [controllers/QuoteController.php]\n     - declineQuote()  [controllers/QuoteController.php]\n\n  🚨 ReturnController (1 methods)\n     - complete()  [controllers/ReturnController.php]\n\n  🚨 SalesReportController (10 methods)\n     - getSummary()  [controllers/SalesReportController.php]\n     - getTopProducts()  [controllers/SalesReportController.php]\n     - getTopCustomers()  [controllers/SalesReportController.php]\n     - getByStatus()  [controllers/SalesReportController.php]\n     - getByChannel()  [controllers/SalesReportController.php]\n     - getInvoiceAnalytics()  [controllers/SalesReportController.php]\n     - getPaymentAnalytics()  [controllers/SalesReportController.php]\n     - getCategoryPerformance()  [controllers/SalesReportController.php]\n     - getSalesGrowth()  [controllers/SalesReportController.php]\n     - getQuoteConversion()  [controllers/SalesReportController.php]\n\n  🚨 SchedulingController (3 methods)\n     - autoSchedule()  [controllers/SchedulingController.php]\n     - rescheduleAssignment()  [controllers/SchedulingController.php]\n     - createAssignment()  [controllers/SchedulingController.php]\n\n  🚨 SearchController (1 methods)\n     - search()  [controllers/SearchController.php]\n\n  🚨 SettingsController (1 methods)\n     - testSmtpConnection()  [controllers/SettingsController.php]\n\n  🚨 ShopFloorController (3 methods)\n     - startProduction()  [controllers/ShopFloorController.php]\n     - pauseProduction()  [controllers/ShopFloorController.php]\n     - completeProduction()  [controllers/ShopFloorController.php]\n\n  🚨 SupportController (1 methods)\n     - addResponse()  [controllers/SupportController.php]\n\n  🚨 TaxPaymentController (1 methods)\n     - calculatePeriodTax()  [controllers/TaxPaymentController.php]\n\n  🚨 TransferController (2 methods)\n     - receive()  [controllers/TransferController.php]\n     - cancel()  [controllers/TransferController.php]\n\n  🚨 UserGroupController (2 methods)\n     - addMember()  [controllers/UserGroupController.php]\n     - addUse()  [controllers/UserGroupController.php]\n\n═══════════════════════════════════════════════════════════════\nSUMMARY\n═══════════════════════════════════════════════════════════════\n✓ Intentionally Public:  9 (OK)\n⚠ Test/Dev Controllers:  10 (Remove/Protect)\n? Needs Review:          11 (Evaluate)\n⏳ Auth Only:            107 (Medium Priority)\n🚨 Needs Protection:     165 (HIGH PRIORITY!)\n─────────────────────────────────────────────────────────────\nTotal:                   302 methods\n\n🚨 IMMEDIATE ACTION REQUIRED:\n165 methods need protection added immediately!\n\n⚠ BEFORE PRODUCTION:\nRemove 10 test/dev methods or add admin protection\n','Script executed successfully','2025-11-28 14:20:24'),
(21,'auto_fix_permissions',1,'{\"mode\":\"dry-run\",\"exclude_auth_only\":\"yes\"}',1,'╔══════════════════════════════════════════════════════════════╗\n║         Permission Auto-Fix Script                          ║\n╚══════════════════════════════════════════════════════════════╝\n\n🔍 DRY RUN MODE - No files will be modified\n\n⚠️  Skipping AITestController (test controller - should be removed)\n📄 Processing AccountController...\n📄 Processing AccountingController...\n📄 Processing ActionMenuEditorController...\n📄 Processing ActivityController...\n⏭️  Skipping AgreementController (intentionally public)\n📄 Processing AgreementTemplateController...\n📄 Processing AnalyticsController...\n📄 Processing AnnouncementController...\n📄 Processing ApiController...\n  ✓ Would fix allUsers() - add: api.view\n  ✓ Would fix usersList() - add: api.view\n\n📄 Processing ApplicationController...\n📄 Processing ApprovalsController...\n📄 Processing AssessmentController...\n📄 Processing AssumptionsController...\n📄 Processing AttendanceController...\n📄 Processing AuditLogController...\n⏭️  Skipping AuthController (intentionally public)\n📄 Processing BOMController...\n📄 Processing BackupController...\n  ✓ Would fix showDetails() - add: backup.view\n  ✓ Would fix getStats() - add: backup.view\n  ✓ Would fix getHistory() - add: backup.view\n  ✓ Would fix triggerFullBackup() - add: backup.view\n  ✓ Would fix triggerGitPush() - add: backup.view\n  ✓ Would fix triggerDatabaseBackup() - add: backup.view\n  ✓ Would fix index() - add: backup.view\n\n📄 Processing BankAccountController...\n📄 Processing BankImportController...\n📄 Processing BankReconciliationController...\n📄 Processing BatteryQuoteController...\n📄 Processing BudgetController...\n📄 Processing BusinessLineController...\n📄 Processing CRMController...\n📄 Processing CalendarController...\n📄 Processing CameraAuditController...\n📄 Processing CapacityController...\n📄 Processing CategoryController...\n📄 Processing ClientController...\n📄 Processing CompanyController...\n📄 Processing ContactAPIController...\n📄 Processing ContactController...\n📄 Processing ContractController...\n📄 Processing CostingController...\n📄 Processing CreditNoteController...\n📄 Processing CurrencyController...\n📄 Processing CustomReportsController...\n  ✓ Would fix index() - add: reports.view\n\n📄 Processing CustomerController...\n📄 Processing CustomerPaymentController...\n📄 Processing DashboardController...\n📄 Processing DataAccessController...\n📄 Processing DebitNoteController...\n📄 Processing DeliveryNoteController...\n📄 Processing DepreciationController...\n📄 Processing DocumentController...\n📄 Processing DocumentationController...\n  ✓ Would fix refreshCoverage() - add: documentation.view\n  ✓ Would fix download() - add: documentation.export\n  ✓ Would fix search() - add: documentation.view\n  ✓ Would fix index() - add: documentation.view\n\n📄 Processing DocumentsController...\n📄 Processing EmailController...\n📄 Processing EmailTemplateController...\n📄 Processing EmailWebhookController...\n  ✓ Would fix test() - add: email.view\n  ✓ Would fix receive() - add: email.view\n\n📄 Processing EmployeeController...\n📄 Processing EquipmentController...\n📄 Processing EquipmentLineController...\n📄 Processing EquipmentTypeController...\n📄 Processing ExpenseController...\n📄 Processing FileManagerController...\n📄 Processing FinancialPlannerController...\n📄 Processing FinancialProFormaController...\n📄 Processing FixedAssetController...\n📄 Processing ForecasterController...\n📄 Processing Form1099Controller...\n📄 Processing GoodsReceiptController...\n📄 Processing HRController...\n📄 Processing HelpDeskController...\n📄 Processing InternalNoteAPIController...\n📄 Processing InterviewController...\n📄 Processing InventoryController...\n📄 Processing InvoiceController...\n📄 Processing IssueController...\n📄 Processing JobPositionController...\n📄 Processing JournalEntryController...\n📄 Processing LocationController...\n📄 Processing LotSerialController...\n📄 Processing MFAController...\n  ✓ Would fix resendOTP() - add: security.view\n  ✓ Would fix verify() - add: security.approve\n  ✓ Would fix verifyForm() - add: security.approve\n\n📄 Processing MRPController...\n📄 Processing MachineDataController...\n  ✓ Would fix health() - add: machine_data.view\n  ✓ Would fix getStatus() - add: machine_data.view\n\n📄 Processing MaintenanceController...\n📄 Processing ManufacturingController...\n📄 Processing MenuController...\n📄 Processing MessagingController...\n📄 Processing NDAController...\n  ✓ Would fix declineNDA() - add: nda.view\n  ✓ Would fix signNDA() - add: nda.view\n  ✓ Would fix publicSign() - add: nda.view\n\n📄 Processing NDATemplateController...\n📄 Processing NetworkMonitorController...\n  ✓ Would fix logDetail() - add: network_monitor.view\n  ✓ Would fix feed() - add: network_monitor.view\n  ✓ Would fix statistics() - add: network_monitor.view\n  ✓ Would fix logs() - add: network_monitor.view\n  ✓ Would fix status() - add: network_monitor.view\n\n📄 Processing NextcloudAdminController...\n📄 Processing NextcloudController...\n  ✓ Would fix viewDocument() - add: nextcloud.view\n\n📄 Processing NextcloudProxyController...\n📄 Processing NextcloudSSOController...\n  ✓ Would fix validateToken() - add: nextcloud_sso.view\n\n📄 Processing NotificationController...\n  ✓ Would fix delete() - add: notifications.delete\n  ✓ Would fix markAllAsRead() - add: notifications.view\n  ✓ Would fix markAsRead() - add: notifications.view\n  ✓ Would fix getUnread() - add: notifications.view\n\n📄 Processing OfferController...\n📄 Processing OpportunityController...\n📄 Processing PaymentController...\n📄 Processing PayrollController...\n📄 Processing PeriodClosingController...\n📄 Processing PermissionGroupController...\n📄 Processing PipedriveImportController...\n  ✓ Would fix getStats() - add: pipedrive_import.view\n  ✓ Would fix viewLog() - add: pipedrive_import.view\n  ✓ Would fix index() - add: pipedrive_import.view\n\n📄 Processing PositionController...\n📄 Processing PricingRuleController...\n  ✓ Would fix calculatePrice() - add: pricing_rule.view\n\n📄 Processing ProFormaController...\n  ✓ Would fix calculate() - add: pro_forma.view\n\n📄 Processing ProductController...\n📄 Processing ProductForecastController...\n  ✓ Would fix gettingStarted() - add: product_forecast.view\n\n📄 Processing ProfileController...\n📄 Processing ProjectsController...\n  ✓ Would fix addTaskComment() - add: projects.create\n  ✓ Would fix getTaskComments() - add: projects.view\n  ✓ Would fix autoAllocateResources() - add: projects.view\n  ✓ Would fix resourceDayDetails() - add: projects.view\n  ✓ Would fix resources() - add: projects.view\n  ✓ Would fix addTaskDependency() - add: projects.create\n  ✓ Would fix calculateCriticalPath() - add: projects.view\n  ✓ Would fix gantt() - add: projects.view\n  ✓ Would fix processMigration() - add: projects.view\n  ✓ Would fix migrateTransactions() - add: projects.view\n  ✓ Would fix linkTransactionToTask() - add: projects.view\n  ✓ Would fix editTransaction() - add: projects.edit\n  ✓ Would fix storeTransaction() - add: projects.create\n  ✓ Would fix createTransaction() - add: projects.create\n  ✓ Would fix financials() - add: projects.view\n  ✓ Would fix unassignGroupFromTask() - add: projects.view\n  ✓ Would fix assignGroupToTask() - add: projects.view\n  ✓ Would fix addTeamGroup() - add: projects.create\n  ✓ Would fix addTeamMember() - add: projects.create\n  ✓ Would fix toggleChecklistItem() - add: projects.view\n  ✓ Would fix addChecklistItem() - add: projects.view\n  ✓ Would fix unassignUser() - add: projects.view\n  ✓ Would fix assignUser() - add: projects.view\n  ✓ Would fix addComment() - add: projects.create\n  ✓ Would fix getTask() - add: projects.view\n  ✓ Would fix moveTask() - add: projects.view\n  ✓ Would fix listView() - add: projects.view\n  ✓ Would fix show() - add: projects.view\n  ✓ Would fix index() - add: projects.view\n  ✓ Would fix myTasks() - add: projects.view\n  ✓ Would fix dashboard() - add: projects.view\n\n📄 Processing PromotionController...\n  ✓ Would fix applyPromotion() - add: promotion.view\n  ✓ Would fix validateCode() - add: promotion.view\n\n📄 Processing PurchaseBillController...\n📄 Processing PurchaseOrderController...\n📄 Processing PurchasePaymentController...\n📄 Processing PurchaseRequisitionController...\n📄 Processing PurchaseReturnController...\n📄 Processing PurchasesController...\n📄 Processing QualityController...\n📄 Processing QuickBooksController...\n📄 Processing QuoteController...\n  ✓ Would fix declineQuote() - add: quote.view\n  ✓ Would fix acceptQuote() - add: quote.view\n\n📄 Processing QuoteTemplateController...\n📄 Processing RFQController...\n📄 Processing RecruitmentController...\n📄 Processing RecurringTransactionController...\n📄 Processing ReportsController...\n📄 Processing ReturnController...\n  ✓ Would fix complete() - add: return.view\n\n📄 Processing ReviewController...\n📄 Processing RoleController...\n📄 Processing SalesController...\n📄 Processing SalesOrderController...\n📄 Processing SalesReportController...\n  ✓ Would fix getQuoteConversion() - add: sales.view\n  ✓ Would fix getSalesGrowth() - add: sales.view\n  ✓ Would fix getCategoryPerformance() - add: sales.view\n  ✓ Would fix getPaymentAnalytics() - add: sales.view\n  ✓ Would fix getInvoiceAnalytics() - add: sales.view\n  ✓ Would fix getByChannel() - add: sales.view\n  ✓ Would fix getByStatus() - add: sales.view\n  ✓ Would fix getTopCustomers() - add: sales.view\n  ✓ Would fix getTopProducts() - add: sales.view\n  ✓ Would fix getSummary() - add: sales.view\n\n📄 Processing SchedulingController...\n📄 Processing SearchController...\n📄 Processing SeparationController...\n📄 Processing SettingsController...\n📄 Processing ShipmentController...\n📄 Processing ShopFloorController...\n📄 Processing StockMovementController...\n📄 Processing SupplierController...\n📄 Processing SupportController...\n📄 Processing SystemScriptsController...\n📄 Processing TaxFilingController...\n📄 Processing TaxJurisdictionController...\n📄 Processing TaxPaymentController...\n📄 Processing TermsConditionsController...\n⚠️  Skipping TestController (test controller - should be removed)\n📄 Processing TrainingController...\n📄 Processing TransferController...\n📄 Processing UserController...\n📄 Processing UserGroupController...\n📄 Processing VendorPaymentController...\n📄 Processing WarehouseController...\n📄 Processing WorkOrderController...\n═══════════════════════════════════════════════════════════════\nSUMMARY\n═══════════════════════════════════════════════════════════════\nMode: DRY RUN (no changes made)\n\n✅ Complete!','Script executed successfully','2025-11-28 14:21:21'),
(22,'auto_fix_permissions',1,'{\"mode\":\"apply\",\"exclude_auth_only\":\"yes\"}',1,'╔══════════════════════════════════════════════════════════════╗\n║         Permission Auto-Fix Script                          ║\n╚══════════════════════════════════════════════════════════════╝\n\n⚠️  Skipping AITestController (test controller - should be removed)\n📄 Processing AccountController...\n📄 Processing AccountingController...\n📄 Processing ActionMenuEditorController...\n📄 Processing ActivityController...\n⏭️  Skipping AgreementController (intentionally public)\n📄 Processing AgreementTemplateController...\n📄 Processing AnalyticsController...\n📄 Processing AnnouncementController...\n📄 Processing ApiController...\n  ✓ Fixed allUsers() - added: api.view\n  ✓ Fixed usersList() - added: api.view\n  💾 Saved changes (2 methods fixed)\n\n📄 Processing ApplicationController...\n📄 Processing ApprovalsController...\n📄 Processing AssessmentController...\n📄 Processing AssumptionsController...\n📄 Processing AttendanceController...\n📄 Processing AuditLogController...\n⏭️  Skipping AuthController (intentionally public)\n📄 Processing BOMController...\n📄 Processing BackupController...\n  ✓ Fixed showDetails() - added: backup.view\n  ✓ Fixed getStats() - added: backup.view\n  ✓ Fixed getHistory() - added: backup.view\n  ✓ Fixed triggerFullBackup() - added: backup.view\n  ✓ Fixed triggerGitPush() - added: backup.view\n  ✓ Fixed triggerDatabaseBackup() - added: backup.view\n  ✓ Fixed index() - added: backup.view\n  💾 Saved changes (7 methods fixed)\n\n📄 Processing BankAccountController...\n📄 Processing BankImportController...\n📄 Processing BankReconciliationController...\n📄 Processing BatteryQuoteController...\n📄 Processing BudgetController...\n📄 Processing BusinessLineController...\n📄 Processing CRMController...\n📄 Processing CalendarController...\n📄 Processing CameraAuditController...\n📄 Processing CapacityController...\n📄 Processing CategoryController...\n📄 Processing ClientController...\n📄 Processing CompanyController...\n📄 Processing ContactAPIController...\n📄 Processing ContactController...\n📄 Processing ContractController...\n📄 Processing CostingController...\n📄 Processing CreditNoteController...\n📄 Processing CurrencyController...\n📄 Processing CustomReportsController...\n  ✓ Fixed index() - added: reports.view\n  💾 Saved changes (1 methods fixed)\n\n📄 Processing CustomerController...\n📄 Processing CustomerPaymentController...\n📄 Processing DashboardController...\n📄 Processing DataAccessController...\n📄 Processing DebitNoteController...\n📄 Processing DeliveryNoteController...\n📄 Processing DepreciationController...\n📄 Processing DocumentController...\n📄 Processing DocumentationController...\n  ✓ Fixed refreshCoverage() - added: documentation.view\n  ✓ Fixed download() - added: documentation.export\n  ✓ Fixed search() - added: documentation.view\n  ✓ Fixed index() - added: documentation.view\n  💾 Saved changes (4 methods fixed)\n\n📄 Processing DocumentsController...\n📄 Processing EmailController...\n📄 Processing EmailTemplateController...\n📄 Processing EmailWebhookController...\n  ✓ Fixed test() - added: email.view\n  ✓ Fixed receive() - added: email.view\n  💾 Saved changes (2 methods fixed)\n\n📄 Processing EmployeeController...\n📄 Processing EquipmentController...\n📄 Processing EquipmentLineController...\n📄 Processing EquipmentTypeController...\n📄 Processing ExpenseController...\n📄 Processing FileManagerController...\n📄 Processing FinancialPlannerController...\n📄 Processing FinancialProFormaController...\n📄 Processing FixedAssetController...\n📄 Processing ForecasterController...\n📄 Processing Form1099Controller...\n📄 Processing GoodsReceiptController...\n📄 Processing HRController...\n📄 Processing HelpDeskController...\n📄 Processing InternalNoteAPIController...\n📄 Processing InterviewController...\n📄 Processing InventoryController...\n📄 Processing InvoiceController...\n📄 Processing IssueController...\n📄 Processing JobPositionController...\n📄 Processing JournalEntryController...\n📄 Processing LocationController...\n📄 Processing LotSerialController...\n📄 Processing MFAController...\n  ✓ Fixed resendOTP() - added: security.view\n  ✓ Fixed verify() - added: security.approve\n  ✓ Fixed verifyForm() - added: security.approve\n  💾 Saved changes (3 methods fixed)\n\n📄 Processing MRPController...\n📄 Processing MachineDataController...\n  ✓ Fixed health() - added: machine_data.view\n  ✓ Fixed getStatus() - added: machine_data.view\n  💾 Saved changes (2 methods fixed)\n\n📄 Processing MaintenanceController...\n📄 Processing ManufacturingController...\n📄 Processing MenuController...\n📄 Processing MessagingController...\n📄 Processing NDAController...\n  ✓ Fixed declineNDA() - added: nda.view\n  ✓ Fixed signNDA() - added: nda.view\n  ✓ Fixed publicSign() - added: nda.view\n  💾 Saved changes (3 methods fixed)\n\n📄 Processing NDATemplateController...\n📄 Processing NetworkMonitorController...\n  ✓ Fixed logDetail() - added: network_monitor.view\n  ✓ Fixed feed() - added: network_monitor.view\n  ✓ Fixed statistics() - added: network_monitor.view\n  ✓ Fixed logs() - added: network_monitor.view\n  ✓ Fixed status() - added: network_monitor.view\n  💾 Saved changes (5 methods fixed)\n\n📄 Processing NextcloudAdminController...\n📄 Processing NextcloudController...\n  ✓ Fixed viewDocument() - added: nextcloud.view\n  💾 Saved changes (1 methods fixed)\n\n📄 Processing NextcloudProxyController...\n📄 Processing NextcloudSSOController...\n  ✓ Fixed validateToken() - added: nextcloud_sso.view\n  💾 Saved changes (1 methods fixed)\n\n📄 Processing NotificationController...\n  ✓ Fixed delete() - added: notifications.delete\n  ✓ Fixed markAllAsRead() - added: notifications.view\n  ✓ Fixed markAsRead() - added: notifications.view\n  ✓ Fixed getUnread() - added: notifications.view\n  💾 Saved changes (4 methods fixed)\n\n📄 Processing OfferController...\n📄 Processing OpportunityController...\n📄 Processing PaymentController...\n📄 Processing PayrollController...\n📄 Processing PeriodClosingController...\n📄 Processing PermissionGroupController...\n📄 Processing PipedriveImportController...\n  ✓ Fixed getStats() - added: pipedrive_import.view\n  ✓ Fixed viewLog() - added: pipedrive_import.view\n  ✓ Fixed index() - added: pipedrive_import.view\n  💾 Saved changes (3 methods fixed)\n\n📄 Processing PositionController...\n📄 Processing PricingRuleController...\n  ✓ Fixed calculatePrice() - added: pricing_rule.view\n  💾 Saved changes (1 methods fixed)\n\n📄 Processing ProFormaController...\n  ✓ Fixed calculate() - added: pro_forma.view\n  💾 Saved changes (1 methods fixed)\n\n📄 Processing ProductController...\n📄 Processing ProductForecastController...\n  ✓ Fixed gettingStarted() - added: product_forecast.view\n  💾 Saved changes (1 methods fixed)\n\n📄 Processing ProfileController...\n📄 Processing ProjectsController...\n  ✓ Fixed addTaskComment() - added: projects.create\n  ✓ Fixed getTaskComments() - added: projects.view\n  ✓ Fixed autoAllocateResources() - added: projects.view\n  ✓ Fixed resourceDayDetails() - added: projects.view\n  ✓ Fixed resources() - added: projects.view\n  ✓ Fixed addTaskDependency() - added: projects.create\n  ✓ Fixed calculateCriticalPath() - added: projects.view\n  ✓ Fixed gantt() - added: projects.view\n  ✓ Fixed processMigration() - added: projects.view\n  ✓ Fixed migrateTransactions() - added: projects.view\n  ✓ Fixed linkTransactionToTask() - added: projects.view\n  ✓ Fixed editTransaction() - added: projects.edit\n  ✓ Fixed storeTransaction() - added: projects.create\n  ✓ Fixed createTransaction() - added: projects.create\n  ✓ Fixed financials() - added: projects.view\n  ✓ Fixed unassignGroupFromTask() - added: projects.view\n  ✓ Fixed assignGroupToTask() - added: projects.view\n  ✓ Fixed addTeamGroup() - added: projects.create\n  ✓ Fixed addTeamMember() - added: projects.create\n  ✓ Fixed toggleChecklistItem() - added: projects.view\n  ✓ Fixed addChecklistItem() - added: projects.view\n  ✓ Fixed unassignUser() - added: projects.view\n  ✓ Fixed assignUser() - added: projects.view\n  ✓ Fixed addComment() - added: projects.create\n  ✓ Fixed getTask() - added: projects.view\n  ✓ Fixed moveTask() - added: projects.view\n  ✓ Fixed listView() - added: projects.view\n  ✓ Fixed show() - added: projects.view\n  ✓ Fixed index() - added: projects.view\n  ✓ Fixed myTasks() - added: projects.view\n  ✓ Fixed dashboard() - added: projects.view\n  💾 Saved changes (31 methods fixed)\n\n📄 Processing PromotionController...\n  ✓ Fixed applyPromotion() - added: promotion.view\n  ✓ Fixed validateCode() - added: promotion.view\n  💾 Saved changes (2 methods fixed)\n\n📄 Processing PurchaseBillController...\n📄 Processing PurchaseOrderController...\n📄 Processing PurchasePaymentController...\n📄 Processing PurchaseRequisitionController...\n📄 Processing PurchaseReturnController...\n📄 Processing PurchasesController...\n📄 Processing QualityController...\n📄 Processing QuickBooksController...\n📄 Processing QuoteController...\n  ✓ Fixed declineQuote() - added: quote.view\n  ✓ Fixed acceptQuote() - added: quote.view\n  💾 Saved changes (2 methods fixed)\n\n📄 Processing QuoteTemplateController...\n📄 Processing RFQController...\n📄 Processing RecruitmentController...\n📄 Processing RecurringTransactionController...\n📄 Processing ReportsController...\n📄 Processing ReturnController...\n  ✓ Fixed complete() - added: return.view\n  💾 Saved changes (1 methods fixed)\n\n📄 Processing ReviewController...\n📄 Processing RoleController...\n📄 Processing SalesController...\n📄 Processing SalesOrderController...\n📄 Processing SalesReportController...\n  ✓ Fixed getQuoteConversion() - added: sales.view\n  ✓ Fixed getSalesGrowth() - added: sales.view\n  ✓ Fixed getCategoryPerformance() - added: sales.view\n  ✓ Fixed getPaymentAnalytics() - added: sales.view\n  ✓ Fixed getInvoiceAnalytics() - added: sales.view\n  ✓ Fixed getByChannel() - added: sales.view\n  ✓ Fixed getByStatus() - added: sales.view\n  ✓ Fixed getTopCustomers() - added: sales.view\n  ✓ Fixed getTopProducts() - added: sales.view\n  ✓ Fixed getSummary() - added: sales.view\n  💾 Saved changes (10 methods fixed)\n\n📄 Processing SchedulingController...\n📄 Processing SearchController...\n📄 Processing SeparationController...\n📄 Processing SettingsController...\n📄 Processing ShipmentController...\n📄 Processing ShopFloorController...\n📄 Processing StockMovementController...\n📄 Processing SupplierController...\n📄 Processing SupportController...\n📄 Processing SystemScriptsController...\n📄 Processing TaxFilingController...\n📄 Processing TaxJurisdictionController...\n📄 Processing TaxPaymentController...\n📄 Processing TermsConditionsController...\n⚠️  Skipping TestController (test controller - should be removed)\n📄 Processing TrainingController...\n📄 Processing TransferController...\n📄 Processing UserController...\n📄 Processing UserGroupController...\n📄 Processing VendorPaymentController...\n📄 Processing WarehouseController...\n📄 Processing WorkOrderController...\n═══════════════════════════════════════════════════════════════\nSUMMARY\n═══════════════════════════════════════════════════════════════\nFiles modified: 21\nMethods fixed: 87\n\nPermissions used: 26\n\n📋 Next Steps:\n1. Review the changes in your controllers\n2. Add missing permissions to database:\n   php scripts/generate_missing_permissions_sql.php > missing.sql\n   mysql -u rpmbbu brickwal_m1_ds < missing.sql\n3. Assign permissions to roles: http://localhost:8080/roles/111/edit\n4. Test the application thoroughly\n5. Run audit again: php scripts/audit_permissions.php | head -30\n\n✅ Complete!','Script executed successfully','2025-11-28 14:22:15'),
(23,'generate_missing_permissions_sql',1,'[]',0,'-- Missing Permissions SQL\n-- Generated: 2025-11-28 14:23:59\n-- Total missing: 166\n\n-- 1 Module Permissions\nPHP Fatal error:  Uncaught Error: Call to undefined method Database::quote() in /Users/rpmbbu/LocalPHPStorm/m1_erp_web/scripts/generate_missing_permissions_sql.php:114\nStack trace:\n#0 /Users/rpmbbu/LocalPHPStorm/m1_erp_web/scripts/generate_missing_permissions_sql.php(53): MissingPermissionsGenerator->generateSQL(Array)\n#1 /Users/rpmbbu/LocalPHPStorm/m1_erp_web/scripts/generate_missing_permissions_sql.php(136): MissingPermissionsGenerator->generate()\n#2 {main}\n  thrown in /Users/rpmbbu/LocalPHPStorm/m1_erp_web/scripts/generate_missing_permissions_sql.php on line 114\n\nFatal error: Uncaught Error: Call to undefined method Database::quote() in /Users/rpmbbu/LocalPHPStorm/m1_erp_web/scripts/generate_missing_permissions_sql.php:114\nStack trace:\n#0 /Users/rpmbbu/LocalPHPStorm/m1_erp_web/scripts/generate_missing_permissions_sql.php(53): MissingPermissionsGenerator->generateSQL(Array)\n#1 /Users/rpmbbu/LocalPHPStorm/m1_erp_web/scripts/generate_missing_permissions_sql.php(136): MissingPermissionsGenerator->generate()\n#2 {main}\n  thrown in /Users/rpmbbu/LocalPHPStorm/m1_erp_web/scripts/generate_missing_permissions_sql.php on line 114','Script execution failed with exit code 255','2025-11-28 14:23:59'),
(24,'generate_missing_permissions_sql',1,'[]',1,'-- Missing Permissions SQL\n-- Generated: 2025-11-28 14:26:52\n-- Total missing: 166\n\n-- 1 Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\nINSERT INTO permissions (name, module, description) VALUES (\'1\', \'1\', \' 1\');\n','Script executed successfully','2025-11-28 14:26:52'),
(25,'generate_missing_permissions_sql',1,'[]',1,'-- Missing Permissions SQL\n-- Generated: 2025-11-28 14:28:52\n-- Total missing: 16\n\n-- api Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'api.view\', \'api\', \'View Api\');\n\n-- documentation Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'documentation.export\', \'documentation\', \'Export Documentation\');\n\n-- email Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'email.view\', \'email\', \'View Email\');\n\n-- machine_data Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'machine_data.view\', \'machine_data\', \'View Machine Data\');\n\n-- nda Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'nda.view\', \'nda\', \'View Nda\');\n\n-- nextcloud_sso Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'nextcloud_sso.view\', \'nextcloud_sso\', \'View Nextcloud Sso\');\n\n-- notifications Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'notifications.delete\', \'notifications\', \'Delete Notifications\');\nINSERT INTO permissions (name, module, description) VALUES (\'notifications.view\', \'notifications\', \'View Notifications\');\n\n-- pipedrive_import Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'pipedrive_import.view\', \'pipedrive_import\', \'View Pipedrive Import\');\n\n-- pricing_rule Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'pricing_rule.view\', \'pricing_rule\', \'View Pricing Rule\');\n\n-- pro_forma Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'pro_forma.view\', \'pro_forma\', \'View Pro Forma\');\n\n-- promotion Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'promotion.view\', \'promotion\', \'View Promotion\');\n\n-- quote Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'quote.view\', \'quote\', \'View Quote\');\n\n-- return Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'return.view\', \'return\', \'View Return\');\n\n-- security Module Permissions\nINSERT INTO permissions (name, module, description) VALUES (\'security.approve\', \'security\', \'Approve Security\');\nINSERT INTO permissions (name, module, description) VALUES (\'security.view\', \'security\', \'View Security\');\n','Script executed successfully','2025-11-28 14:28:52'),
(26,'scan_permissions',1,'{\"mode\":\"live\"}',1,'\n\n\n\n\n================================================================================\nPERMISSION SCANNER & SYNC UTILITY\nMODE: LIVE (changes WILL be applied to database)\n================================================================================\n\n📚 LOADING DATABASE PERMISSIONS\n--------------------------------------------------------------------------------\n  Loaded 420 permissions from database\n\n🔍 SCANNING CONTROLLERS\n--------------------------------------------------------------------------------\n  Scanned 147 controller files\n  Found 138 files with permission checks\n  Discovered 166 unique permissions\n\n📋 DISCOVERED PERMISSIONS REPORT\n--------------------------------------------------------------------------------\n  Permission                               Checks   Controllers\n--------------------------------------------------------------------------------\n\n  (CORE):\n  admin                                    101      ActionMenuEditorController,... ✓\n\n  1099_CONTRACTORS:\n  1099_contractors.export                  1        Form1099Controller ✓\n  1099_contractors.generate_reports        1        Form1099Controller ✓\n  1099_contractors.view                    1        Form1099Controller ✓\n  1099_contractors.view_payments           1        Form1099Controller ✓\n\n  ACCOUNTING:\n  accounting.approve                       3        ExpenseController ✓\n  accounting.create                        30       AccountController, BankAcco... ✓\n  accounting.customer_payments.create      2        CustomerPaymentController ✓\n  accounting.customer_payments.view        2        CustomerPaymentController ✓\n  accounting.delete                        21       BankAccountController, Budg... ✓\n  accounting.edit                          25       BankAccountController, Bank... ✓\n  accounting.vendor_payments.create        4        VendorPaymentController ✓\n  accounting.vendor_payments.delete        1        VendorPaymentController ✓\n  accounting.vendor_payments.edit          2        VendorPaymentController ✓\n  accounting.vendor_payments.print_checks  1        VendorPaymentController ✓\n  accounting.vendor_payments.view          3        VendorPaymentController ✓\n  accounting.vendor_payments.void          1        VendorPaymentController ✓\n  accounting.view                          36       AccountController, Accounti... ✓\n\n  ADMIN:\n  admin.agreement_templates                9        AgreementTemplateController ✓\n  admin.create                             7        PipedriveImportController, ... ✓\n  admin.delete                             2        QuickBooksController, UserG... ✓\n  admin.edit                               5        QuickBooksController, UserG... ✓\n  admin.settings                           1        PipedriveImportController ✓\n  admin.system_scripts                     3        SystemScriptsController ✓\n\n  API:\n  api.view                                 2        ApiController ✓\n\n  AUDIT_LOGS:\n  audit_logs.view                          1        AuditLogController ✓\n\n  BACKUP:\n  backup.view                              7        BackupController ✓\n\n  BANK_IMPORT:\n  bank_import.create                       2        BankImportController ✓\n  bank_import.delete                       1        BankImportController ✓\n  bank_import.edit                         2        BankImportController ✓\n  bank_import.import                       1        BankImportController ✓\n  bank_import.manage_rules                 4        BankImportController ✓\n  bank_import.view                         2        BankImportController ✓\n\n  CALENDAR:\n  calendar.create                          1        CalendarController ✓\n  calendar.delete                          1        CalendarController ✓\n  calendar.edit                            1        CalendarController ✓\n\n  CAMERA_AUDIT:\n  camera_audit.capture                     1        CameraAuditController ✓\n  camera_audit.delete                      1        CameraAuditController ✓\n  camera_audit.stations                    3        CameraAuditController ✓\n  camera_audit.verify                      1        CameraAuditController ✓\n  camera_audit.view                        3        CameraAuditController ✓\n\n  CRM:\n  crm.create                               11       ActivityController, ClientC... ✓\n  crm.delete                               13       ActivityController, ClientC... ✓\n  crm.edit                                 13       ActivityController, ClientC... ✓\n  crm.view                                 55       ActivityController, CRMCont... ✓\n\n  DASHBOARD:\n  dashboard.edit                           2        DashboardController ✓\n\n  DOCUMENTATION:\n  documentation.export                     1        DocumentationController ✓\n  documentation.view                       3        DocumentationController ✓\n\n  DOCUMENTS:\n  documents.create                         1        DocumentsController ✓\n  documents.delete                         1        DocumentsController ✓\n\n  EMAIL:\n  email.view                               2        EmailWebhookController ✓\n\n  FORECASTING:\n  forecasting.create                       10       FinancialPlannerController,... ✓\n  forecasting.delete                       8        ForecasterController ✓\n  forecasting.edit                         16       FinancialPlannerController,... ✓\n  forecasting.generate_projections         1        ProductForecastController ✓\n  forecasting.manage_assumptions           5        AssumptionsController ✓\n  forecasting.manage_products              3        ProductForecastController ✓\n  forecasting.update_daily                 3        AssumptionsController ✓\n  forecasting.view                         9        FinancialPlannerController,... ✓\n  forecasting.view_actuals                 1        AssumptionsController ✓\n  forecasting.view_proforma                7        FinancialProFormaController... ✓\n\n  HR:\n  hr.create                                28       ApplicationController, Asse... ✓\n  hr.delete                                16       ApplicationController, Asse... ✓\n  hr.edit                                  25       ApplicationController, Asse... ✓\n  hr.view                                  30       ApplicationController, Asse... ✓\n\n  INVENTORY:\n  inventory.create                         9        CategoryController, Locatio... ✓\n  inventory.delete                         10       CategoryController, Locatio... ✓\n  inventory.edit                           7        CategoryController, Locatio... ✓\n  inventory.manage                         12       CategoryController, StockMo... ✓\n  inventory.view                           20       CategoryController, Invento... ✓\n\n  MACHINE_DATA:\n  machine_data.view                        2        MachineDataController ✓\n\n  MANUFACTURING:\n  manufacturing.approve                    2        MRPController ✓\n  manufacturing.create                     13       BOMController, BusinessLine... ✓\n  manufacturing.delete                     6        BusinessLineController, Equ... ✓\n  manufacturing.edit                       44       BOMController, BusinessLine... ✓\n  manufacturing.view                       53       AnalyticsController, BOMCon... ✓\n\n  MESSAGING:\n  messaging.create                         1        MessagingController ✓\n  messaging.delete                         1        MessagingController ✓\n  messaging.edit                           2        MessagingController ✓\n\n  NDA:\n  nda.view                                 3        NDAController ✓\n\n  NDAS:\n  ndas.countersign                         2        NDAController ✓\n  ndas.create                              2        NDAController ✓\n  ndas.delete                              1        NDAController ✓\n  ndas.edit                                2        NDAController ✓\n  ndas.send                                2        NDAController ✓\n  ndas.view                                5        NDAController ✓\n\n  NETWORK_MONITOR:\n  network_monitor.manage                   3        NetworkMonitorController ✓\n  network_monitor.view                     6        NetworkMonitorController ✓\n\n  NEXTCLOUD:\n  nextcloud.delete                         1        NextcloudController ✓\n  nextcloud.manage                         7        NextcloudAdminController, N... ✓\n  nextcloud.upload                         6        NextcloudController ✓\n  nextcloud.view                           8        NextcloudController ✓\n\n  NEXTCLOUD_SSO:\n  nextcloud_sso.view                       1        NextcloudSSOController ✓\n\n  NOTIFICATIONS:\n  notifications.delete                     1        NotificationController ✓\n  notifications.view                       3        NotificationController ✓\n\n  PAYROLL:\n  payroll.view                             1        PayrollController ✓\n\n  PERMISSIONS:\n  permissions.manage                       10       PermissionGroupController ✓\n\n  PIPEDRIVE_IMPORT:\n  pipedrive_import.view                    3        PipedriveImportController ✓\n\n  PRICING_RULE:\n  pricing_rule.view                        1        PricingRuleController ✓\n\n  PRO_FORMA:\n  pro_forma.view                           1        ProFormaController ✓\n\n  PROCUREMENT:\n  procurement.approve                      2        PurchaseRequisitionController ✓\n  procurement.create                       16       DebitNoteController, GoodsR... ✓\n  procurement.delete                       12       DebitNoteController, GoodsR... ✓\n  procurement.edit                         12       DebitNoteController, Purcha... ✓\n  procurement.view                         18       DebitNoteController, GoodsR... ✓\n\n  PRODUCT_FORECAST:\n  product_forecast.view                    3        ProductForecastController ✓\n\n  PROFILE:\n  profile.edit                             2        ProfileController ✓\n\n  PROJECTS:\n  projects.create                          10       ProjectsController ✓\n  projects.delete                          5        ProjectsController ✓\n  projects.edit                            10       ProjectsController ✓\n  projects.view                            28       ProjectsController ✓\n\n  PROMOTION:\n  promotion.view                           2        PromotionController ✓\n\n  PURCHASES:\n  purchases.create                         3        SupplierController ✓\n  purchases.delete                         3        SupplierController ✓\n  purchases.edit                           2        SupplierController ✓\n  purchases.view                           3        PurchasesController, Suppli... ✓\n\n  PURCHASING:\n  purchasing.create                        1        MRPController ✓\n\n  QUOTE:\n  quote.view                               2        QuoteController ✓\n\n  RECURRING_TEMPLATES:\n  recurring_templates.activate             1        RecurringTransactionController ✓\n  recurring_templates.create               2        RecurringTransactionController ✓\n  recurring_templates.delete               1        RecurringTransactionController ✓\n  recurring_templates.edit                 2        RecurringTransactionController ✓\n  recurring_templates.execute              2        RecurringTransactionController ✓\n  recurring_templates.view                 3        RecurringTransactionController ✓\n\n  REPORTS:\n  reports.create                           2        CustomReportsController ✓\n  reports.delete                           1        CustomReportsController ✓\n  reports.edit                             2        CustomReportsController ✓\n  reports.view                             8        CustomReportsController, Re... ✓\n\n  RETURN:\n  return.view                              1        ReturnController ✓\n\n  ROLES:\n  roles.create                             2        RoleController ✓\n  roles.delete                             1        RoleController ✓\n  roles.edit                               2        RoleController ✓\n  roles.view                               4        RoleController ✓\n\n  SALES:\n  sales.agreements.create                  3        AgreementController ✓\n  sales.agreements.delete                  3        AgreementController ✓\n  sales.agreements.edit                    3        AgreementController ✓\n  sales.agreements.send                    2        AgreementController ✓\n  sales.agreements.view                    5        AgreementController ✓\n  sales.approve                            2        ReturnController ✓\n  sales.create                             28       BatteryQuoteController, Cre... ✓\n  sales.delete                             23       BatteryQuoteController, Cre... ✓\n  sales.edit                               20       BatteryQuoteController, Inv... ✓\n  sales.view                               44       BatteryQuoteController, Cre... ✓\n\n  SECURITY:\n  security.approve                         2        MFAController ✓\n  security.view                            1        MFAController ✓\n\n  SETTINGS:\n  settings.edit                            23       MenuController, TermsCondit... ✓\n  settings.view                            4        MenuController, TermsCondit... ✓\n\n  SYSTEM:\n  system.backup                            1        BackupController ✓\n  system.edit                              1        ProfileController ✓\n  system.files.delete                      3        FileManagerController ✓\n\n  TAX_JURISDICTIONS:\n  tax_jurisdictions.create                 2        TaxJurisdictionController ✓\n  tax_jurisdictions.delete                 1        TaxJurisdictionController ✓\n  tax_jurisdictions.edit                   3        TaxJurisdictionController ✓\n  tax_jurisdictions.view                   2        TaxJurisdictionController ✓\n\n  TAX_PAYMENTS:\n  tax_payments.create                      2        TaxPaymentController ✓\n  tax_payments.edit                        4        TaxPaymentController ✓\n  tax_payments.file                        1        TaxPaymentController ✓\n  tax_payments.view                        2        TaxPaymentController ✓\n\n  TAX_REPORTS:\n  tax_reports.view                         1        TaxPaymentController ✓\n\n  TICKETS:\n  tickets.create                           4        HelpDeskController, Support... ✓\n  tickets.delete                           2        SupportController ✓\n  tickets.edit                             2        HelpDeskController, Support... ✓\n\n  USERS:\n  users.create                             2        UserController ✓\n  users.delete                             3        UserController ✓\n  users.edit                               2        UserController ✓\n  users.view                               3        UserController ✓\n\n➕ CREATING MISSING PERMISSIONS\n--------------------------------------------------------------------------------\n  ✓ All discovered permissions exist in database\n\n🗑️  UNUSED PERMISSIONS\n--------------------------------------------------------------------------------\n  Found 254 permissions in database not used in controllers:\n\n  (CORE):\n    - agreements.view - \"View Agreements\"\n    - ai-test.view - \"View AI Testing\"\n    - analytics.view - \"View analytics\"\n    - announcements.view - \"View Announcements\"\n    - assumptions.view - \"View Daily Update\"\n    - audit-logs.view - \"View Audit Log\"\n    - calendar.view - \"View calendar\"\n    - companies.view - \"View Companies\"\n    - creditnotes.view - \"View Credit Notes\"\n    - dashboard.view - \"View dashboard\"\n    ... and 14 more\n\n  1099:\n    - 1099_contractors.manage - \"Manage 1099 contractor designations\"\n    - 1099_filings.file - \"File 1099 forms\"\n    - 1099_filings.prepare - \"Prepare 1099 forms\"\n    - 1099_payments.manage - \"Manage 1099 payment classifications\"\n    - 1099_payments.view - \"View 1099 reportable payments\"\n    - 1099_reports.view - \"View 1099 reports\"\n\n  ACCOUNTING:\n    - accounting.customer_payments.delete - \"Delete customer payments\"\n    - accounting.customer_payments.edit - \"Edit customer payments\"\n    - accounting.post - \"Post journal entries\"\n    - accounts.create - \"Create accounts\"\n    - accounts.delete - \"Delete accounts\"\n    - accounts.edit - \"Edit accounts\"\n    - accounts.view - \"View chart of accounts\"\n    - bank_accounts.create - \"Create bank accounts\"\n    - bank_accounts.edit - \"Edit bank accounts\"\n    - bank_accounts.view - \"View bank accounts\"\n    ... and 21 more\n\n  AUDIT:\n    - audit_trail.export - \"Export audit trail\"\n    - audit_trail.view - \"View audit trail\"\n\n  AUTOMATION:\n    - automation.view - \"View Templates\"\n\n  BANK_IMPORT:\n    - bank_import.categorize - \"Categorize imported transactions\"\n    - bank_import.rules - \"Manage categorization rules\"\n\n  CREDIT_NOTES:\n    - credit_notes.apply - \"Apply Credit Notes to Invoices\"\n    - credit_notes.auto_apply - \"Auto-apply Credit Notes\"\n    - credit_notes.reverse - \"Reverse Credit Note Applications\"\n    - credit_notes.view_balances - \"View Customer Credit Balances\"\n\n  CRM:\n    - activities.create - \"Create CRM activities\"\n    - activities.edit - \"Edit CRM activities\"\n    - activities.view - \"View CRM activities\"\n    - clients.create - \"Create clients\"\n    - clients.delete - \"Delete clients\"\n    - clients.edit - \"Edit clients\"\n    - clients.view - \"View clients\"\n    - contacts.create - \"Create contacts\"\n    - contacts.delete - \"Delete contacts\"\n    - contacts.edit - \"Edit contacts\"\n    ... and 14 more\n\n  DOCUMENTS:\n    - documents.edit - \"Edit documents\"\n    - documents.upload - \"Upload documents\"\n\n  HELPDESK:\n    - tickets.assign - \"Assign support tickets\"\n    - tickets.close - \"Close support tickets\"\n    - tickets.view - \"View support tickets\"\n\n  HR:\n    - applications.create - \"Create job applications\"\n    - applications.edit - \"Edit job applications\"\n    - applications.view - \"View job applications\"\n    - assessments.create - \"Create assessments\"\n    - assessments.view - \"View assessments\"\n    - attendance.create - \"Record attendance\"\n    - attendance.view - \"View attendance\"\n    - contracts.create - \"Create employee contracts\"\n    - contracts.edit - \"Edit employee contracts\"\n    - contracts.view - \"View employee contracts\"\n    ... and 31 more\n\n  INVENTORY:\n    - camera_audit.annotate - \"Add annotations to audit images\"\n    - camera_audit.export - \"Export camera audit data\"\n    - categories.create - \"Create product categories\"\n    - categories.delete - \"Delete product categories\"\n    - categories.edit - \"Edit product categories\"\n    - categories.view - \"View product categories\"\n    - inventory.adjust - \"Adjust inventory levels\"\n    - lots.create - \"Create lot/serial numbers\"\n    - lots.edit - \"Edit lot/serial numbers\"\n    - lots.view - \"View lot/serial numbers\"\n    ... and 11 more\n\n  MANUFACTURING:\n    - boms.create - \"Create bills of materials\"\n    - boms.delete - \"Delete bills of materials\"\n    - boms.edit - \"Edit bills of materials\"\n    - boms.view - \"View bills of materials\"\n    - capacity.edit - \"Edit capacity planning\"\n    - capacity.view - \"View capacity planning\"\n    - equipment.create - \"Create equipment\"\n    - equipment.edit - \"Edit equipment\"\n    - equipment.maintenance - \"Perform equipment maintenance\"\n    - equipment.view - \"View equipment\"\n    ... and 11 more\n\n  MARKETING:\n    - campaigns.create - \"Create email campaigns\"\n    - campaigns.edit - \"Edit email campaigns\"\n    - campaigns.send - \"Send email campaigns\"\n    - campaigns.view - \"View email campaigns\"\n    - lists.create - \"Create mailing lists\"\n    - lists.view - \"View mailing lists\"\n    - templates.create - \"Create email templates\"\n    - templates.view - \"View email templates\"\n\n  PURCHASES:\n    - bills.approve - \"Approve supplier bills\"\n    - bills.create - \"Create supplier bills\"\n    - bills.view - \"View supplier bills\"\n    - goods_receipts.create - \"Create goods receipts\"\n    - goods_receipts.view - \"View goods receipts\"\n    - purchase_orders.approve - \"Approve purchase orders\"\n    - purchase_orders.create - \"Create purchase orders\"\n    - purchase_orders.delete - \"Delete purchase orders\"\n    - purchase_orders.edit - \"Edit purchase orders\"\n    - purchase_orders.view - \"View purchase orders\"\n    ... and 9 more\n\n  REPORTS:\n    - reports.export - \"Export reports\"\n\n  SALES:\n    - delivery_notes.create - \"Create delivery notes\"\n    - delivery_notes.view - \"View delivery notes\"\n    - invoices.create - \"Create invoices\"\n    - invoices.delete - \"Delete invoices\"\n    - invoices.edit - \"Edit invoices\"\n    - invoices.view - \"View invoices\"\n    - orders.approve - \"Approve sales orders\"\n    - orders.create - \"Create sales orders\"\n    - orders.delete - \"Delete sales orders\"\n    - orders.edit - \"Edit sales orders\"\n    ... and 22 more\n\n  SECURITY:\n    - mfa.admin_override - \"Admin: Override MFA for any user\"\n    - mfa.manage_own - \"Manage own MFA settings\"\n    - security.view_audit - \"View security audit logs\"\n\n  STATEMENTS:\n    - statements.bulk_generate - \"Generate Bulk Statements\"\n    - statements.email - \"Email Statements to Customers\"\n    - statements.generate - \"Generate Customer Statements\"\n    - statements.view_history - \"View Statement History\"\n\n  SYSTEM:\n    - files.delete - \"Delete files and folders\"\n    - files.manage - \"Manage all files and folders\"\n    - files.upload - \"Upload files\"\n\n  TAX:\n    - tax_exemptions.manage - \"Manage tax exemptions\"\n    - tax_exemptions.view - \"View tax exemptions\"\n\n  ⚠️  NOTE: These may be used in views or future features.\n  Review carefully before deleting.\n\n📊 COVERAGE STATISTICS\n--------------------------------------------------------------------------------\n  Permissions in database:        420\n  Permissions in controllers:     166\n  Matching (in both):             166\n  Missing from database:          0\n  Unused in controllers:          254\n  Coverage:                       100%\n\n  PERMISSIONS BY MODULE:\n    accounting                      13 permissions\n    sales                           10 permissions\n    forecasting                     10 permissions\n    admin                            6 permissions\n    bank_import                      6 permissions\n    ndas                             6 permissions\n    recurring_templates              6 permissions\n    manufacturing                    5 permissions\n    camera_audit                     5 permissions\n    inventory                        5 permissions\n\n\n================================================================================\nSCAN COMPLETE\n================================================================================\n','Script executed successfully','2025-11-28 14:32:22'),
(27,'test_permission_system',1,'[]',1,'=== PERMISSION SYSTEM TEST SUITE ===\n\nRunning comprehensive tests...\n\nTEST 1: Menu Items Have Valid Permissions\n------------------------------------------------------------\n✅ PASS: All menu items reference valid permissions\n\nTEST 2: Controller Permissions Exist in Database\n------------------------------------------------------------\n✅ PASS: All 171 permissions used in controllers exist\n\nTEST 3: All Roles Have Permissions\n------------------------------------------------------------\n⚠️  WARNING: 17 roles have no permissions:\n  - Accounts Payable Manager (ID 70)\n  - Accounts Receivable Manager (ID 72)\n  - VP/Director of Sales (ID 76)\n  - Customer Service Manager (ID 79)\n  - Customer Service Representative (ID 80)\n  - Purchasing Manager (ID 85)\n  - Inventory Controller (ID 87)\n  - VP/Director of Manufacturing (ID 88)\n  - Quality Manager (ID 92)\n  - Quality Inspector (ID 93)\n  - HR Coordinator (ID 96)\n  - Recruiting Manager (ID 97)\n  - Payroll Manager (ID 99)\n  - System Administrator (ID 100)\n  - IT Manager (ID 101)\n  - VP/Director of Business Development (ID 132)\n  - VP/Director of Autonomous Systems (ID 133)\n\nTEST 4: Permissions Are Grouped\n------------------------------------------------------------\n⚠️  WARNING: 503 permissions are not grouped:\n  - projects.view: View projects\n  - helpdesk.view: View help desk module\n  - documents.view: View documents\n  - messaging.view: View messaging module\n  - marketing.view: View marketing module\n  - analytics.view: View analytics\n  - salesorders.view: View SALES\n  - announcements.view: View Announcements\n  - audit-logs.view: View Audit Log\n  - backup.view: View System Backup\n  ... and 493 more\n\nTEST 5: Menu Permissions Match Controller Checks\n------------------------------------------------------------\n✅ PASS: Checked 20 menu items\n\nTEST 6: No Duplicate Permission Names\n------------------------------------------------------------\n✅ PASS: No duplicate permission names found\n\nTEST 7: All Users Have Valid Roles\n------------------------------------------------------------\n✅ PASS: All users have valid roles\n\n=== TEST SUMMARY ===\nTests passed: 5 / 7\nErrors: 0\nWarnings: 18\n\n⚠️  WARNINGS:\n1. Role \'Accounts Payable Manager\' has no permissions assigned\n2. Role \'Accounts Receivable Manager\' has no permissions assigned\n3. Role \'VP/Director of Sales\' has no permissions assigned\n4. Role \'Customer Service Manager\' has no permissions assigned\n5. Role \'Customer Service Representative\' has no permissions assigned\n6. Role \'Purchasing Manager\' has no permissions assigned\n7. Role \'Inventory Controller\' has no permissions assigned\n8. Role \'VP/Director of Manufacturing\' has no permissions assigned\n9. Role \'Quality Manager\' has no permissions assigned\n10. Role \'Quality Inspector\' has no permissions assigned\n11. Role \'HR Coordinator\' has no permissions assigned\n12. Role \'Recruiting Manager\' has no permissions assigned\n13. Role \'Payroll Manager\' has no permissions assigned\n14. Role \'System Administrator\' has no permissions assigned\n15. Role \'IT Manager\' has no permissions assigned\n16. Role \'VP/Director of Business Development\' has no permissions assigned\n17. Role \'VP/Director of Autonomous Systems\' has no permissions assigned\n18. 503 permissions are not assigned to permission groups\n\n⚠️  TESTS PASSED WITH WARNINGS','Script executed successfully','2025-11-28 22:42:24'),
(28,'update_excalidraw',1,'{\"force\":\"no\"}',1,'\n# Excalidraw Update Script\n# Downloads the latest Excalidraw standalone build and checks for updates\n# Usage: ./scripts/update-excalidraw.sh [--force]\n\nset -e\n\n# Configuration\nEXCALIDRAW_DIR=\"/Users/rpmbbu/LocalPHPStorm/m1_erp_web/public/assets/excalidraw\"\nCURRENT_VERSION_FILE=\"$EXCALIDRAW_DIR/.version\"\nEXCALIDRAW_CDN=\"https://unpkg.com/@excalidraw/excalidraw\"\nFORCE_UPDATE=false\n\n# Parse arguments\nif [[ \"$1\" == \"--force\" ]]; then\n    FORCE_UPDATE=true\nfi\n\n# Colors for output\nRED=\'\\033[0;31m\'\nGREEN=\'\\033[0;32m\'\nYELLOW=\'\\033[1;33m\'\nNC=\'\\033[0m\' # No Color\n\necho \"================================================\"\necho \"Excalidraw Local Update Script\"\necho \"================================================\"\necho \"\"\n\n# Create directory if it doesn\'t exist\nmkdir -p \"$EXCALIDRAW_DIR\"\n\n# Function to get latest version from npm\nget_latest_version() {\n    echo \"Checking latest version from npm...\"\n    LATEST_VERSION=$(curl -s https://registry.npmjs.org/@excalidraw/excalidraw/latest | grep -o \'\"version\":\"[^\"]*\"\' | cut -d\'\"\' -f4)\n    if [ -z \"$LATEST_VERSION\" ]; then\n        echo -e \"${RED}Error: Could not fetch latest version${NC}\"\n        exit 1\n    fi\n    echo -e \"${GREEN}Latest version: $LATEST_VERSION${NC}\"\n}\n\n# Function to get current version\nget_current_version() {\n    if [ -f \"$CURRENT_VERSION_FILE\" ]; then\n        CURRENT_VERSION=$(cat \"$CURRENT_VERSION_FILE\")\n        echo -e \"${GREEN}Current version: $CURRENT_VERSION${NC}\"\n    else\n        CURRENT_VERSION=\"\"\n        echo -e \"${YELLOW}No current version found${NC}\"\n    fi\n}\n\n# Function to download Excalidraw\ndownload_excalidraw() {\n    local version=$1\n    echo \"\"\n    echo \"Downloading Excalidraw v$version...\"\n\n    # Download main files\n    echo \"  → Downloading excalidraw.min.js...\"\n    curl -s -o \"$EXCALIDRAW_DIR/excalidraw.min.js\" \\\n        \"$EXCALIDRAW_CDN@$version/dist/excalidraw.production.min.js\"\n\n    echo \"  → Downloading excalidraw.min.css...\"\n    curl -s -o \"$EXCALIDRAW_DIR/excalidraw.min.css\" \\\n        \"$EXCALIDRAW_CDN@$version/dist/excalidraw.min.css\"\n\n    # Download assets\n    echo \"  → Downloading fonts and assets...\"\n    mkdir -p \"$EXCALIDRAW_DIR/fonts\"\n\n    # Download common fonts (these don\'t change often)\n    curl -s -o \"$EXCALIDRAW_DIR/fonts/Virgil.woff2\" \\\n        \"https://unpkg.com/@excalidraw/excalidraw@$version/dist/excalidraw-assets/Virgil.woff2\" || true\n    curl -s -o \"$EXCALIDRAW_DIR/fonts/Cascadia.woff2\" \\\n        \"https://unpkg.com/@excalidraw/excalidraw@$version/dist/excalidraw-assets/Cascadia.woff2\" || true\n\n    # Save version\n    echo \"$version\" > \"$CURRENT_VERSION_FILE\"\n\n    echo -e \"${GREEN}✓ Download complete!${NC}\"\n}\n\n# Function to create wrapper\ncreate_wrapper() {\n    echo \"\"\n    echo \"Creating local wrapper...\"\n\n    cat > \"$EXCALIDRAW_DIR/excalidraw-wrapper.js\" << \'EOF\'\n/**\n * Excalidraw Local Wrapper\n * Provides a simple interface to initialize Excalidraw locally\n */\n\nexport function initExcalidraw(containerId, options = {}) {\n    const container = typeof containerId === \'string\'\n        ? document.getElementById(containerId)\n        : containerId;\n\n    if (!container) {\n        throw new Error(\'Container not found: \' + containerId);\n    }\n\n    // Load Excalidraw CSS\n    const cssId = \'excalidraw-styles\';\n    if (!document.getElementById(cssId)) {\n        const link = document.createElement(\'link\');\n        link.id = cssId;\n        link.rel = \'stylesheet\';\n        link.href = \'/assets/excalidraw/excalidraw.min.css\';\n        document.head.appendChild(link);\n    }\n\n    // Load Excalidraw script\n    return new Promise((resolve, reject) => {\n        const scriptId = \'excalidraw-script\';\n        if (window.ExcalidrawLib) {\n            initExcalidrawInstance(container, options, resolve);\n            return;\n        }\n\n        if (!document.getElementById(scriptId)) {\n            const script = document.createElement(\'script\');\n            script.id = scriptId;\n            script.src = \'/assets/excalidraw/excalidraw.min.js\';\n            script.onload = () => {\n                initExcalidrawInstance(container, options, resolve);\n            };\n            script.onerror = reject;\n            document.head.appendChild(script);\n        }\n    });\n}\n\nfunction initExcalidrawInstance(container, options, callback) {\n    const {\n        initialData,\n        theme = \'light\',\n        onChange,\n        onReady\n    } = options;\n\n    // Wait for React and Excalidraw to be ready\n    if (typeof window.React === \'undefined\' || typeof window.ExcalidrawLib === \'undefined\') {\n        setTimeout(() => initExcalidrawInstance(container, options, callback), 100);\n        return;\n    }\n\n    const React = window.React;\n    const ReactDOM = window.ReactDOM;\n    const { Excalidraw, MainMenu } = window.ExcalidrawLib;\n\n    let excalidrawAPI = null;\n\n    const excalidrawElement = React.createElement(Excalidraw, {\n        initialData: initialData || { elements: [], appState: {} },\n        theme: theme,\n        onChange: (elements, appState, files) => {\n            if (onChange) onChange(elements, appState, files);\n        },\n        ref: (api) => {\n            if (api) {\n                excalidrawAPI = api;\n                if (onReady) onReady(api);\n            }\n        }\n    });\n\n    const root = ReactDOM.createRoot(container);\n    root.render(excalidrawElement);\n\n    callback({\n        api: excalidrawAPI,\n        root: root\n    });\n}\nEOF\n\n    echo -e \"${GREEN}✓ Wrapper created${NC}\"\n}\n\n# Main execution\nget_latest_version\nget_current_version\n\n# Check if update is needed\nif [ \"$FORCE_UPDATE\" = true ]; then\n    echo -e \"${YELLOW}Force update requested${NC}\"\n    download_excalidraw \"$LATEST_VERSION\"\n    create_wrapper\nelif [ \"$CURRENT_VERSION\" != \"$LATEST_VERSION\" ]; then\n    echo -e \"${YELLOW}Update available: $CURRENT_VERSION → $LATEST_VERSION${NC}\"\n    read -p \"Update now? (y/n) \" -n 1 -r\n    echo\n    if [[ $REPLY =~ ^[Yy]$ ]]; then\n        download_excalidraw \"$LATEST_VERSION\"\n        create_wrapper\n    else\n        echo \"Update skipped\"\n        exit 0\n    fi\nelse\n    echo -e \"${GREEN}✓ Already up to date (v$CURRENT_VERSION)${NC}\"\n\n    # Check if files exist\n    if [ ! -f \"$EXCALIDRAW_DIR/excalidraw.min.js\" ]; then\n        echo -e \"${YELLOW}Files missing, re-downloading...${NC}\"\n        download_excalidraw \"$LATEST_VERSION\"\n        create_wrapper\n    fi\nfi\n\necho \"\"\necho \"================================================\"\necho -e \"${GREEN}Excalidraw is ready for offline use!${NC}\"\necho \"Location: $EXCALIDRAW_DIR\"\necho \"Version: $(cat $CURRENT_VERSION_FILE)\"\necho \"================================================\"','Script executed successfully','2025-12-02 20:37:50');
commit;

--
-- Table structure for table `system_settings`
--

CREATE TABLE `system_settings` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `setting_key` varchar(100) NOT NULL,
  `setting_value` text DEFAULT NULL,
  `setting_type` varchar(50) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `ss_cap` decimal(12,2) DEFAULT 1051951.50,
  `ss_rate` decimal(5,2) DEFAULT 6.20,
  `futa_cap` decimal(12,2) DEFAULT 7000.00,
  `futa_rate` decimal(5,2) DEFAULT 0.60,
  `suta_cap` decimal(12,2) DEFAULT 7000.00,
  `suta_rate` decimal(5,2) DEFAULT 2.70,
  `match_cap` decimal(12,2) DEFAULT 69000.00,
  `match_rate` decimal(5,2) DEFAULT 2.00,
  `cola_rate` decimal(5,2) DEFAULT 4.00,
  `medicare_rate` decimal(5,2) DEFAULT 1.45,
  `health_ins` decimal(10,2) DEFAULT 700.00,
  `disability_ins` decimal(10,2) DEFAULT 40.00,
  `life_ins` decimal(10,2) DEFAULT 10.00,
  `pto_days` decimal(5,2) DEFAULT 0.04,
  `uniform_cost` decimal(10,2) DEFAULT 1.00,
  `wc_salary` decimal(5,2) DEFAULT 1.00,
  `protective_gear` decimal(10,2) DEFAULT 2.00,
  `overtime_rate` decimal(5,2) DEFAULT 1.50,
  `wc_hourly` decimal(5,2) DEFAULT 2.85,
  `overtime_hours` decimal(5,2) DEFAULT 10.00,
  `labor_utilization_rate` decimal(5,2) DEFAULT 95.00 COMMENT 'Expected labor utilization %',
  `hours_per_day` decimal(5,1) DEFAULT 24.0 COMMENT 'Total hours available per day',
  `facility_size_sqft` decimal(12,2) DEFAULT 0.00 COMMENT 'Default facility size in square feet',
  `capitalization_limit` decimal(12,2) DEFAULT 5000.00 COMMENT 'Min amount to capitalize vs expense',
  `cpi_increase_rate` decimal(5,2) DEFAULT 5.50 COMMENT 'Expected CPI increase %',
  `project_start_date` date DEFAULT NULL COMMENT 'Default project start date',
  `base_year` int(11) DEFAULT 2026 COMMENT 'Base year for projections',
  PRIMARY KEY (`id`),
  UNIQUE KEY `setting_key` (`setting_key`)
) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `system_settings`
--

set autocommit=0;

commit;

--
-- Table structure for table `table_columns`
--

CREATE TABLE `table_columns` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `table_config_id` int(10) unsigned NOT NULL,
  `column_key` varchar(100) NOT NULL,
  `column_label` varchar(255) NOT NULL,
  `data_field` varchar(100) NOT NULL COMMENT 'Database field or expression',
  `data_type` enum('text','number','currency','date','datetime','boolean','badge','link','image','html','action','buttons') DEFAULT 'text',
  `format_options` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Formatter options (e.g., currency symbol, date format)' CHECK (json_valid(`format_options`)),
  `is_sortable` tinyint(1) DEFAULT 1,
  `is_searchable` tinyint(1) DEFAULT 1,
  `is_visible` tinyint(1) DEFAULT 1,
  `width` varchar(20) DEFAULT NULL,
  `css_class` varchar(255) DEFAULT NULL,
  `align` enum('left','center','right') DEFAULT 'left',
  `display_order` int(11) DEFAULT 0,
  `permission_required` varchar(100) DEFAULT NULL,
  `hidden_roles` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Array of roles that cannot see this column' CHECK (json_valid(`hidden_roles`)),
  `is_active` tinyint(1) DEFAULT 1,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_table_config` (`table_config_id`),
  KEY `idx_display_order` (`display_order`),
  CONSTRAINT `table_columns_ibfk_1` FOREIGN KEY (`table_config_id`) REFERENCES `table_configurations` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=217 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `table_columns`
--

set autocommit=0;
INSERT INTO `table_columns` VALUES
(1,1,'sku','SKU','sku','text',NULL,1,1,1,'120px',NULL,'left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(2,1,'name','Product Name','name','link','{\"url_template\": \"/products/{id}\"}',1,1,1,NULL,NULL,'left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(3,1,'category','Category','category_name','text',NULL,1,1,1,'150px',NULL,'left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(4,1,'type','Type','product_type','badge','{\"badges\": {\"goods\": \"primary\", \"digital\": \"success\", \"service\": \"info\"}}',1,1,1,'100px',NULL,'left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(5,1,'cost_price','Cost','cost_price','currency','{\"symbol\": \"$\"}',1,1,1,'100px',NULL,'left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(6,1,'selling_price','Price','selling_price','currency','{\"symbol\": \"$\"}',1,1,1,'100px',NULL,'left',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(7,1,'status','Status','status','badge','{\"badges\": {\"active\": \"success\", \"inactive\": \"secondary\", \"discontinued\": \"danger\"}}',1,1,1,'100px',NULL,'left',7,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(8,1,'created_at','Created','created_at','date','{\"format\": \"m/d/y\"}',1,1,0,'120px',NULL,'left',8,NULL,NULL,1,'2025-11-11 00:36:47','2025-12-05 10:21:44'),
(26,4,'company_name','Company Name','company_name','link','{\"url_template\": \"/suppliers/{id}\"}',1,1,1,'250px',NULL,'left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(27,4,'contact_person','Contact Person','contact_person','text',NULL,1,1,1,'200px',NULL,'left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(28,4,'email','Email','email','link','{\"url_template\": \"mailto:{email}\"}',1,1,1,'200px',NULL,'left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(29,4,'phone','Phone','phone','text',NULL,0,1,1,'130px',NULL,'left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(30,4,'status','Status','status','badge','{\"badges\": {\"active\": \"success\", \"inactive\": \"secondary\"}}',1,1,1,'100px',NULL,'left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(31,4,'created_at','Created','created_at','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(32,5,'order_number','Order #','order_number','link','{\"url_template\": \"/salesorders/{id}\"}',1,1,1,'150px',NULL,'left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(33,5,'customer_name','Customer','customer_name','text',NULL,1,1,1,'200px',NULL,'left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(34,5,'order_date','Order Date','order_date','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(35,5,'delivery_date','Delivery Date','delivery_date','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(36,5,'total_amount','Total','total_amount','currency','{\"symbol\": \"$\"}',1,1,1,'120px',NULL,'left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(37,5,'status','Status','status','badge','{\"badges\": {\"draft\": \"secondary\", \"pending\": \"warning\", \"cancelled\": \"danger\", \"completed\": \"success\", \"confirmed\": \"info\", \"processing\": \"primary\"}}',1,1,1,'100px',NULL,'left',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(38,5,'created_at','Created','created_at','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',7,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(39,6,'po_number','PO #','po_number','link','{\"url_template\": \"/purchaseorders/{id}\"}',1,1,1,'150px',NULL,'left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(40,6,'supplier_name','Supplier','supplier_name','text',NULL,1,1,1,'200px',NULL,'left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(41,6,'order_date','Order Date','order_date','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(42,6,'expected_delivery_date','Expected Delivery','expected_delivery_date','date','{\"format\": \"m/d/y\"}',1,1,1,'150px',NULL,'left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(43,6,'total_amount','Total','total_amount','currency','{\"symbol\": \"$\"}',1,1,1,'120px',NULL,'left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(44,6,'status','Status','status','badge','{\"badges\": {\"draft\": \"secondary\", \"ordered\": \"primary\", \"pending\": \"warning\", \"approved\": \"info\", \"received\": \"success\", \"cancelled\": \"danger\"}}',1,1,1,'100px',NULL,'left',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(45,6,'created_at','Created','created_at','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',7,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(46,7,'wo_number','WO #','wo_number','link','{\"url_template\": \"/workorders/{id}\"}',1,1,1,'150px',NULL,'left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(47,7,'product_name','Product','product_name','text',NULL,1,1,1,'200px',NULL,'left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(48,7,'quantity','Quantity','quantity','number','{\"decimals\": 0}',1,1,1,'100px',NULL,'left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(49,7,'start_date','Start Date','start_date','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(50,7,'end_date','End Date','end_date','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(51,7,'priority','Priority','priority','badge','{\"badges\": {\"low\": \"secondary\", \"high\": \"warning\", \"normal\": \"info\", \"urgent\": \"danger\"}}',1,1,1,'100px',NULL,'left',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(52,7,'status','Status','status','badge','{\"badges\": {\"draft\": \"secondary\", \"cancelled\": \"danger\", \"completed\": \"success\", \"scheduled\": \"info\", \"in_progress\": \"primary\"}}',1,1,1,'100px',NULL,'left',7,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(53,7,'created_at','Created','created_at','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',8,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(54,8,'invoice_number','Invoice #','invoice_number','link','{\"url_template\": \"/invoices/{id}\"}',1,1,1,'150px',NULL,'left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(55,8,'customer_name','Customer','customer_name','text',NULL,1,1,1,'200px',NULL,'left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(56,8,'invoice_date','Invoice Date','invoice_date','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(57,8,'due_date','Due Date','due_date','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(58,8,'total_amount','Total','total_amount','currency','{\"symbol\": \"$\"}',1,1,1,'120px',NULL,'left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(59,8,'payment_status','Payment','payment_status','badge','{\"badges\": {\"paid\": \"success\", \"unpaid\": \"warning\", \"overdue\": \"danger\", \"partial\": \"info\"}}',1,1,1,'100px',NULL,'left',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(60,8,'status','Status','status','badge','{\"badges\": {\"paid\": \"success\", \"sent\": \"info\", \"draft\": \"secondary\", \"viewed\": \"primary\", \"cancelled\": \"danger\"}}',1,1,1,'100px',NULL,'left',7,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(61,8,'created_at','Created','created_at','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',8,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(64,10,'email','Email','email','link','{\"url_template\": \"mailto:{email}\"}',1,1,1,'200px',NULL,'left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(65,10,'phone','Phone','phone','text',NULL,0,1,1,'130px',NULL,'left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(66,10,'position','Position','position','text',NULL,1,1,1,'150px',NULL,'left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(67,10,'is_primary','Primary','is_primary','boolean','{\"true_label\": \"Yes\", \"false_label\": \"No\"}',0,1,1,'80px',NULL,'left',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(68,10,'created_at','Created','created_at','date','{\"format\": \"m/d/y\"}',1,1,1,'120px',NULL,'left',7,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(69,10,'first_name','First Name','first_name','text',NULL,1,1,1,'150px',NULL,'left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(70,10,'last_name','Last Name','last_name','text',NULL,1,1,1,'150px',NULL,'left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(71,11,'name','Name','name','link','{\"url_template\": \"/inventory/categories/{id}\"}',1,1,1,'250px',NULL,'left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(72,11,'description','Description','description','text',NULL,0,1,1,NULL,NULL,'left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(73,11,'product_count','Products','product_count','badge','{\"badges\": {\"0\": \"secondary\", \"1\": \"info\"}}',1,1,1,'120px',NULL,'left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(74,11,'total_stock','Total Stock','total_stock','number','{\"decimals\": 0}',1,1,1,'120px',NULL,'left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(75,11,'is_active','Status','is_active','badge','{\"badges\": {\"0\": \"secondary\", \"1\": \"success\"}, \"true_label\": \"Active\", \"false_label\": \"Inactive\"}',1,1,1,'100px',NULL,'left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(76,12,'lot_number','Lot Number','lot_number','link','{\"url_template\": \"inventory/lots/{id}\"}',1,1,1,NULL,NULL,'left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(77,12,'serial_number','Serial Number','serial_number','text',NULL,1,1,1,NULL,NULL,'left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(78,12,'product_sku','SKU','product_sku','text',NULL,1,1,1,NULL,NULL,'left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(79,12,'product_name','Product','product_name','link','{\"url_template\": \"products/{product_id}\"}',1,1,1,NULL,NULL,'left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(80,12,'location_name','Location','location_name','text',NULL,1,1,1,NULL,NULL,'left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(81,12,'manufacture_date','Mfg Date','manufacture_date','date','{\"format\": \"m/d/y\"}',1,0,1,NULL,NULL,'left',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(82,12,'expiration_date','Exp Date','expiration_date','date','{\"format\": \"m/d/y\"}',1,0,1,NULL,NULL,'left',7,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(83,12,'quantity','Quantity','quantity','number',NULL,1,0,1,NULL,NULL,'left',8,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(84,12,'status','Status','status','badge','{\"badges\": {\"sold\": \"secondary\", \"active\": \"success\", \"expired\": \"danger\", \"reserved\": \"info\", \"returned\": \"warning\"}}',1,1,1,NULL,NULL,'left',9,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(85,12,'created_at','Created','created_at','datetime',NULL,1,0,1,NULL,NULL,'left',10,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(104,3,'employee_id','Employee ID','employee_id','text',NULL,1,1,1,NULL,'','left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(105,3,'full_name','Name','full_name','link','{\"url_template\": \"employees/{id}\"}',1,1,1,NULL,'fw-bold','left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(106,3,'email','Email','email','link','{\"url_template\": \"mailto:{email}\"}',1,1,1,NULL,'','left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(107,3,'department','Department','department_name','text',NULL,1,1,1,NULL,'','left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(108,3,'position','Position','position','text',NULL,1,1,1,NULL,'','left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(109,3,'status','Status','status','badge','{\"badges\": {\"active\": \"success\", \"inactive\": \"secondary\", \"on_leave\": \"warning\", \"terminated\": \"danger\"}}',1,1,1,NULL,'','center',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(110,2,'customer_name','Customer','display_name','text',NULL,1,1,1,NULL,'fw-bold','left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-26 15:42:15'),
(111,2,'type','Type','company_type','badge','{\"badges\": {\"company\": \"primary\", \"individual\": \"info\"}}',1,1,1,'100px','','center',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-24 15:49:09'),
(112,2,'client','Client','client_name','text',NULL,1,1,1,NULL,'','left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(114,2,'phone','Phone','phone','text',NULL,1,1,1,NULL,'','left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(115,2,'city','City','city','text',NULL,1,1,1,NULL,'','left',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(116,2,'status','Status','status','badge','{\"badges\": {\"active\": \"success\", \"inactive\": \"secondary\"}}',1,1,1,'100px','','center',7,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(136,21,'contact_name','Contact','full_name','text',NULL,1,1,1,NULL,'fw-bold','left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-26 15:42:15'),
(137,21,'type','Type','contact_type','badge','{\"badges\": {\"Client\": \"primary\", \"General\": \"secondary\", \"Customer\": \"info\"}}',1,1,1,'100px','','center',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(138,21,'title','Title','title','text',NULL,1,1,1,NULL,'','left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(139,21,'entity','Related To','entity_name','text',NULL,1,1,1,NULL,'','left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(141,21,'phone','Phone','phone','text',NULL,1,1,1,NULL,'','left',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(142,20,'client_name','Client','display_name','link','{\"url_template\": \"clients/{id}\"}',1,1,1,NULL,'fw-bold','left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(143,20,'type','Type','client_type','badge','{\"badges\": {\"company\": \"primary\", \"individual\": \"info\"}}',1,1,1,'100px','','center',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(144,20,'email','Email','email','link','{\"url_template\": \"mailto:{email}\"}',1,1,1,NULL,'','left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(145,20,'phone','Phone','phone','text',NULL,1,1,1,NULL,'','left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(146,20,'city','City','city','text',NULL,1,1,1,NULL,'','left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(147,20,'customers','Customers','customer_count','number','{\"decimals\": 0}',1,0,1,'100px','','center',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(148,20,'status','Status','status','badge','{\"badges\": {\"active\": \"success\", \"inactive\": \"secondary\"}}',1,1,1,'100px','','center',7,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(149,25,'document_name','Document Name','document_name','link','{\"icon\": \"bi-file-earmark-pdf\", \"icon_color\": \"text-danger\", \"url_template\": \"crm/documents/{id}\"}',1,1,1,NULL,'','left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(150,25,'type','Type','document_type','badge','{\"badges\": {\"nda\": \"warning\", \"other\": \"secondary\", \"invoice\": \"primary\", \"contract\": \"secondary\", \"proposal\": \"info\", \"agreement\": \"success\"}, \"transform\": \"ucfirst\"}',1,1,1,'100px','','left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(151,25,'customer','Customer','customer_name','link','{\"url_template\": \"customers/{customer_id}\"}',1,1,1,NULL,'','left',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(152,25,'version','Version','version','text',NULL,1,0,1,'80px','','center',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(153,25,'status','Status','is_signed','badge','{\"icon\": {\"1\": \"bi-check-circle\"}, \"badges\": {\"0\": \"warning\", \"1\": \"success\"}, \"labels\": {\"0\": \"Unsigned\", \"1\": \"Signed\"}}',1,0,1,'120px','','left',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(154,25,'expiry_date','Expiry Date','expiry_date','date','{\"empty\": \"-\", \"format\": \"m/d/y\"}',1,0,1,'120px','','left',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(155,25,'uploaded','Uploaded','created_at','date','{\"format\": \"m/d/y\", \"secondary_class\": \"small text-muted\", \"secondary_field\": \"uploader_name\", \"secondary_prefix\": \"by \"}',1,0,1,'150px','','left',7,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-12 14:07:02'),
(156,25,'actions','Actions','id','buttons','{\"buttons\": [{\"icon\": \"bi-eye\", \"class\": \"btn-sm btn-outline-theme\", \"title\": \"Preview\", \"url_template\": \"\", \"modal\": \"docPreview_{id}\"}, {\"icon\": \"bi-pencil\", \"class\": \"btn-sm btn-outline-theme\", \"title\": \"Edit\", \"url_template\": \"crm/documents/{id}/edit\"}, {\"icon\": \"bi-trash\", \"class\": \"btn-sm btn-outline-danger\", \"title\": \"Delete\", \"url_template\": \"crm/documents/{id}/delete\", \"confirm\": \"Are you sure you want to delete this document?\"}]}',0,0,1,NULL,'text-end','right',8,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-21 04:02:28'),
(163,26,'title','Position Title','title','link','{\"url_template\": \"hr/positions/{id}/edit\"}',1,1,1,'200px','fw-bold','left',1,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(164,26,'department','Department','department','text',NULL,1,1,1,'150px','','left',2,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(165,26,'level','Level','level','badge','{\"badges\": {\"Mid\": \"light\", \"Lead\": \"warning\", \"Entry\": \"light\", \"Other\": \"dark\", \"Junior\": \"light\", \"Senior\": \"secondary\", \"Manager\": \"success\", \"Director\": \"info\", \"Executive\": \"primary\"}}',1,1,1,'120px','','center',3,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(166,26,'reports_to','Reports To','reports_to','text',NULL,1,0,1,'180px','','left',4,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(167,26,'employee_count','Employees','employee_count','number',NULL,1,0,1,'100px','text-primary fw-bold','center',5,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(168,26,'is_active','Status','is_active','badge','{\"badges\": {\"0\": \"secondary\", \"1\": \"success\"}}',1,1,1,'100px','','center',6,NULL,NULL,1,'2025-11-11 00:36:47','2025-11-11 00:36:47'),
(169,29,'entry_date','Date','entry_date','date','{\"format\":\"m/d/y\"}',1,1,1,NULL,NULL,'left',1,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:51:47'),
(170,29,'entry_number','Entry Number','entry_number','text',NULL,1,1,1,NULL,NULL,'left',2,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:31:55'),
(172,29,'description','Description','description','text',NULL,1,1,1,NULL,NULL,'left',4,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:31:55'),
(173,29,'name','Name','name','text',NULL,1,1,1,NULL,NULL,'left',5,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:31:55'),
(174,29,'department','Department','department','text',NULL,1,1,1,NULL,NULL,'left',6,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:31:55'),
(175,29,'location','Location','location','text',NULL,1,1,1,NULL,NULL,'left',7,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:31:55'),
(176,29,'status','Status','status','badge','{\"badges\":{\"posted\":\"success\",\"draft\":\"secondary\"}}',1,1,1,NULL,NULL,'left',8,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:31:55'),
(177,29,'actions','Actions','id','action','{\"url_template\":\"accounting/journal/{id}\",\"icon\":\"bi-eye\",\"title\":\"View\"}',0,0,1,NULL,NULL,'left',9,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:55:32'),
(178,30,'date','Date','date','date','{\"format\":\"m/d/y\"}',1,1,1,NULL,NULL,'left',1,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:55:32'),
(179,30,'journal_entry','Entry','entry_number','text',NULL,1,1,1,NULL,NULL,'left',2,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 12:52:12'),
(180,30,'account_code','Account','account_code','text',NULL,1,1,1,NULL,NULL,'left',3,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 12:52:12'),
(181,30,'account_name','Account Name','account_name','text',NULL,1,1,0,NULL,NULL,'left',4,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 12:52:12'),
(182,30,'description','Description','description','text',NULL,1,1,1,NULL,NULL,'left',5,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:31:55'),
(183,30,'debit','Debit','debit','currency','{\"symbol\":\"$\"}',1,0,1,NULL,NULL,'left',6,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:31:55'),
(184,30,'credit','Credit','credit','currency','{\"symbol\":\"$\"}',1,0,1,NULL,NULL,'left',7,NULL,NULL,1,'2025-11-12 00:31:55','2025-11-12 00:31:55'),
(185,29,'amount','Amount','amount','currency','{\"symbol\":\"$\"}',1,0,1,NULL,NULL,'left',8,NULL,NULL,1,'2025-11-12 00:37:08','2025-11-12 00:37:08'),
(186,30,'actions','Actions','journal_entry_id','action','{\"url_template\":\"accounting/journal/{journal_entry_id}\",\"icon\":\"bi-eye\",\"title\":\"View\"}',0,0,1,NULL,NULL,'left',8,NULL,NULL,1,'2025-11-12 12:50:06','2025-11-12 12:50:06'),
(187,31,'reconciliation_date','Date','reconciliation_date','date','{\"format\":\"m/d/y\"}',1,1,1,NULL,NULL,'left',1,NULL,NULL,1,'2025-11-12 14:26:15','2025-11-12 14:26:15'),
(188,31,'account_name','Bank Account','account_name','text',NULL,1,1,1,NULL,NULL,'left',2,NULL,NULL,1,'2025-11-12 14:26:15','2025-11-12 14:26:15'),
(189,31,'statement_date','Statement Date','statement_date','date','{\"format\":\"m/d/y\"}',1,1,1,NULL,NULL,'left',3,NULL,NULL,1,'2025-11-12 14:26:15','2025-11-12 14:26:15'),
(190,31,'statement_balance','Statement Balance','statement_balance','currency','{\"symbol\":\"$\"}',1,0,1,NULL,NULL,'left',4,NULL,NULL,1,'2025-11-12 14:26:15','2025-11-12 14:26:15'),
(191,31,'book_balance','Book Balance','book_balance','currency','{\"symbol\":\"$\"}',1,0,1,NULL,NULL,'left',5,NULL,NULL,1,'2025-11-12 14:26:15','2025-11-12 14:26:15'),
(192,31,'difference','Difference','difference','currency','{\"symbol\":\"$\"}',1,0,1,NULL,NULL,'left',6,NULL,NULL,1,'2025-11-12 14:26:15','2025-11-12 14:26:15'),
(193,31,'status','Status','status','badge','{\"badges\":{\"completed\":\"success\",\"in_progress\":\"warning\",\"draft\":\"secondary\"}}',1,1,1,NULL,NULL,'left',7,NULL,NULL,1,'2025-11-12 14:26:15','2025-11-12 14:26:15'),
(194,31,'completed_by','Completed By','completed_by','text',NULL,1,1,1,NULL,NULL,'left',8,NULL,NULL,1,'2025-11-12 14:26:15','2025-11-12 14:26:15'),
(195,31,'actions','Actions','id','action','{\"url_template\":\"accounting/reconciliation/{id}\",\"icon\":\"bi-eye\",\"title\":\"View\"}',0,0,1,NULL,NULL,'left',9,NULL,NULL,1,'2025-11-12 14:26:15','2025-11-12 14:26:15'),
(196,32,'expense_date','Date','expense_date','date','{\"format\":\"m/d/y\"}',1,1,1,NULL,NULL,'left',1,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(197,32,'expense_number','Expense #','expense_number','text',NULL,1,1,1,NULL,NULL,'left',2,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(198,32,'category','Category','category','badge','{\"color\":\"secondary\"}',1,1,1,NULL,NULL,'left',3,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(199,32,'vendor','Vendor','vendor','text',NULL,1,1,1,NULL,NULL,'left',4,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(200,32,'employee_name','Employee','employee_name','text',NULL,1,1,1,NULL,NULL,'left',5,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(201,32,'total_amount','Amount','total_amount','currency',NULL,1,1,1,NULL,NULL,'right',6,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(202,32,'status','Status','status','badge','{\"color_map\":{\"paid\":\"success\",\"approved\":\"primary\",\"pending_approval\":\"warning\",\"rejected\":\"danger\",\"draft\":\"secondary\"}}',1,1,1,NULL,NULL,'left',7,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(203,32,'receipt_file','Receipt','receipt_file','boolean','{\"true_icon\":\"bi-paperclip\",\"false_icon\":\"bi-dash\",\"align\":\"center\"}',0,1,1,NULL,NULL,'center',8,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(204,32,'actions','Actions','id','action','{\"url_template\":\"accounting/expenses/{id}\",\"icon\":\"bi-eye\",\"title\":\"View\"}',0,1,1,NULL,NULL,'center',9,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(205,33,'budget_name','Budget Name','budget_name','text',NULL,1,1,1,NULL,NULL,'left',1,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(206,33,'department','Department','department','text',NULL,1,1,1,NULL,NULL,'left',2,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(207,33,'start_date','Start Date','start_date','date','{\"format\":\"m/d/y\"}',1,1,1,NULL,NULL,'left',3,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(208,33,'end_date','End Date','end_date','date','{\"format\":\"m/d/y\"}',1,1,1,NULL,NULL,'left',4,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(209,33,'budgeted_amount','Budgeted','budgeted_amount','currency',NULL,1,1,1,NULL,NULL,'right',5,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(210,33,'actual_spent','Spent','actual_spent','currency',NULL,1,1,1,NULL,NULL,'right',6,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(211,33,'status','Status','status','badge','{\"color_map\":{\"active\":\"success\",\"approved\":\"primary\",\"closed\":\"secondary\",\"draft\":\"warning\"}}',1,1,1,NULL,NULL,'left',7,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(212,33,'actions','Actions','id','action','{\"url_template\":\"accounting/budgets/{id}\",\"icon\":\"bi-eye\",\"title\":\"View\"}',0,1,1,NULL,NULL,'center',8,NULL,NULL,1,'2025-11-12 14:42:10','2025-11-12 14:42:10'),
(213,2,'actions','Actions','id','buttons','{\"buttons\": [{\"icon\": \"bi-envelope\", \"class\": \"btn-sm btn-outline-primary\", \"title\": \"Send Email\", \"url_template\": \"email/compose?to={email}&name={display_name}\"}, {\"icon\": \"bi-eye\", \"class\": \"btn-sm btn-outline-theme\", \"title\": \"View\", \"url_template\": \"companies/{id}\"}, {\"icon\": \"bi-pencil\", \"class\": \"btn-sm btn-outline-theme\", \"title\": \"Edit\", \"url_template\": \"companies/{id}/edit\"}]}',0,0,1,'100px',NULL,'center',100,NULL,NULL,1,'2025-11-26 15:35:30','2025-11-26 15:49:19'),
(214,21,'actions','Actions','id','buttons','{\"buttons\": [{\"icon\": \"bi-envelope\", \"class\": \"btn-sm btn-outline-primary\", \"title\": \"Send Email\", \"url_template\": \"email/compose?to={email}&name={full_name}\"}, {\"icon\": \"bi-eye\", \"class\": \"btn-sm btn-outline-theme\", \"title\": \"View\", \"url_template\": \"crm/contacts/{id}\"}, {\"icon\": \"bi-pencil\", \"class\": \"btn-sm btn-outline-theme\", \"title\": \"Edit\", \"url_template\": \"crm/contacts/{id}/edit\"}]}',0,0,1,'100px',NULL,'center',100,NULL,NULL,1,'2025-11-26 15:35:30','2025-11-26 15:49:19'),
(215,1,'actions','Actions','id','buttons','{\"buttons\": [{\"icon\": \"bi-eye\", \"class\": \"btn-sm btn-outline-theme\", \"title\": \"View\", \"url_template\": \"products/{id}\"}, {\"icon\": \"bi-pencil\", \"class\": \"btn-sm btn-outline-theme\", \"title\": \"Edit\", \"url_template\": \"products/{id}/edit\", \"permission\": \"inventory.edit\"}, {\"icon\": \"bi-trash\", \"class\": \"btn-sm btn-outline-danger\", \"title\": \"Delete\", \"url_template\": \"products/{id}/delete\", \"permission\": \"inventory.delete\", \"method\": \"POST\", \"confirm\": \"Are you sure you want to delete this product?\"}]}',0,0,1,'150px','text-end','right',100,NULL,NULL,1,'2025-12-05 10:23:36','2025-12-05 10:23:36'),
(216,11,'actions','Actions','id','buttons','{\n    \"buttons\": [\n        {\n            \"url_template\": \"inventory/categories/{id}\",\n            \"icon\": \"bi-eye\",\n            \"class\": \"btn-outline-theme\",\n            \"title\": \"View\"\n        },\n        {\n            \"url_template\": \"inventory/categories/{id}/edit\",\n            \"icon\": \"bi-pencil\",\n            \"class\": \"btn-outline-primary\",\n            \"title\": \"Edit\"\n        },\n        {\n            \"url_template\": \"inventory/categories/{id}/delete\",\n            \"icon\": \"bi-trash\",\n            \"class\": \"btn-outline-danger\",\n            \"title\": \"Delete\",\n            \"method\": \"POST\",\n            \"confirm\": \"Are you sure you want to delete this category?\"\n        }\n    ]\n}',0,0,1,'150px','','center',6,'',NULL,1,'2025-12-05 10:44:58','2025-12-05 10:51:33');
commit;

--
