๐Ÿ“š ERP Documentation Viewer

Beautiful, colorful documentation for your ERP system

Project Type Management Controller Documentation

File: /controllers/projectKindController.php

Purpose: Manage project type definitions and categories

Last Updated: 2024-12-20

---

๐Ÿ“‹ Overview

Primary Functions

Related Controllers

---

๐Ÿ—„๏ธ Database Tables

Primary Tables

Table NamePurposeKey Columns
projectkindProject type definitionsprojectkindid, projectkindname, projectkindcomment, conditions
### Secondary Tables (Referenced)

Table NamePurposeRelationship
youtubelinkHelp videosGeneral reference
---

๐Ÿ”ง Key Functions

1. add()

Purpose: Create new project type

Called By: POST action to ?do=add

Parameters:

Returns: Project kind ID

Database Operations:

Business Logic:

1. Validate project type name

2. Set default conditions (active = 0)

3. Record creation timestamp and user

4. Insert new project type

Example:

$_POST['projectkindname'] = 'Construction Project';
$_POST['projectkindcomment'] = 'Building and construction works';
add();

2. edit($id)

Purpose: Load project type for editing

Called By: GET action to ?do=edit&id=$id

Parameters:

Returns: Project kind data

Database Operations:

Business Logic:

1. Load project kind data by ID

2. Return data for form population

3. tempdelete()

Purpose: Soft delete project type

Called By: GET action to ?do=tempdelete&projectkindid=$id

Parameters:

Returns: Success/error redirect

Database Operations:

Business Logic:

1. Mark project type as inactive

2. Preserve data for historical references

---

๐Ÿ“Š Main Workflows

Workflow 1: Project Type Creation

1. User accesses creation form
   โ†“
2. Fill type name and description
   โ†“
3. Submit form data
   โ†“
4. Validate input fields
   โ†“
5. Insert project type record
   โ†“
6. Success/Error Response

Files Involved:

Workflow 2: Project Type Management

1. Display project types list
   โ†“
2. Select type for editing
   โ†“
3. Load existing data
   โ†“
4. Modify fields
   โ†“
5. Save changes
   โ†“
6. Update confirmation

---

๐Ÿ”— File Dependencies

Includes

include("../public/impOpreation.php");
include_once("../public/config.php");
include_once("dailyentryfun.php");
include("../public/include_dao.php");

Required Models

Related Views

---

๐ŸŽฏ URL Routes & Actions

Action (`?do=`)MethodDescriptionView Template
(empty)GETDisplay creation formadd.html
addPOSTCreate new project type-
showGETList all project typesshow.html
tempdeleteGETSoft delete project type-
editGETDisplay edit formedit.html
sucessGETSuccess messagesucces.html
errorGETError messageerror.html
---

โš ๏ธ Known Issues & Fixes

Issue 1: Wrong DAO Reference in Edit Function (Line 146)

Problem: Function references $myAccountmovementRecord instead of project kind DAO

Cause: Copy-paste error from another controller

Fix: Replace with $myProjectkindRecord->load($id)

File: Lines 142-148

Issue 2: Inconsistent Variable Naming

Problem: Mixed use of $myProjectkind and $myProjectkindRecord

Cause: Inconsistent naming convention

Fix: Standardize variable names

File: Throughout controller

Issue 3: Missing Rollback on Error (Line 77)

Problem: Transaction rollback called on undefined $mytransactions

Cause: Transaction management not properly initialized

Fix: Add proper transaction initialization or remove rollback

File: Line 77

---

๐Ÿ” Permissions & Security

Required Permissions

Security Checks

include_once("../public/authentication.php");

Input Validation

---

๐Ÿ“ Notes

Important Considerations

Future Improvements

Database Schema

CREATE TABLE projectkind (
    projectkindid INT PRIMARY KEY AUTO_INCREMENT,
    projectkindname VARCHAR(255),
    projectkindcomment TEXT,
    conditions TINYINT DEFAULT 0,
    projectkinddate DATETIME,
    userid INT
);

---

๐Ÿ“š Related Documentation

โ†‘