mirror of https://github.com/itflow-org/itflow
Added Project Prefix and Project Numbering System
This commit is contained in:
parent
f4051fe718
commit
16fb1467a2
|
|
@ -217,6 +217,14 @@
|
|||
<?php } ?>
|
||||
|
||||
<?php if ($config_module_enable_ticketing) { ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "settings_project.php") { echo "active"; } ?>"
|
||||
href="settings_project.php">
|
||||
<i class="nav-icon fas fa-project-diagram"></i>
|
||||
<p>Project</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "settings_ticket.php") { echo "active"; } ?>"
|
||||
href="settings_ticket.php">
|
||||
|
|
|
|||
|
|
@ -1850,10 +1850,27 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.4'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.2.4') {
|
||||
// // Insert queries here required to update to DB version 1.2.5
|
||||
if (CURRENT_DATABASE_VERSION == '1.2.4') {
|
||||
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_project_prefix` VARCHAR(200) NOT NULL DEFAULT 'PRJ-' AFTER `config_default_hourly_rate`");
|
||||
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_project_next_number` INT(11) NOT NULL DEFAULT 1 AFTER `config_project_prefix`");
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.5'");
|
||||
}
|
||||
|
||||
if (CURRENT_DATABASE_VERSION == '1.2.5') {
|
||||
|
||||
mysqli_query($mysqli, "ALTER TABLE `projects` ADD `project_prefix` VARCHAR(200) DEFAULT NULL AFTER `project_id`");
|
||||
mysqli_query($mysqli, "ALTER TABLE `projects` ADD `project_number` INT(11) NOT NULL DEFAULT 1 AFTER `project_prefix`");
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.6'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.2.6') {
|
||||
// // Insert queries here required to update to DB version 1.2.7
|
||||
// // Then, update the database to the next sequential version
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.5");
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.7");
|
||||
// }
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
* It is used in conjunction with database_updates.php
|
||||
*/
|
||||
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.2.4");
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.2.6");
|
||||
|
|
|
|||
6
db.sql
6
db.sql
|
|
@ -973,6 +973,8 @@ DROP TABLE IF EXISTS `projects`;
|
|||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `projects` (
|
||||
`project_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`project_prefix` varchar(200) DEFAULT NULL,
|
||||
`project_number` int(11) NOT NULL DEFAULT 1,
|
||||
`project_name` varchar(255) NOT NULL,
|
||||
`project_description` text DEFAULT NULL,
|
||||
`project_due` date DEFAULT NULL,
|
||||
|
|
@ -1311,6 +1313,8 @@ CREATE TABLE `settings` (
|
|||
`config_default_calendar` int(11) DEFAULT NULL,
|
||||
`config_default_net_terms` int(11) DEFAULT NULL,
|
||||
`config_default_hourly_rate` decimal(15,2) NOT NULL DEFAULT 0.00,
|
||||
`config_project_prefix` varchar(200) NOT NULL DEFAULT 'PRJ-',
|
||||
`config_project_next_number` int(11) NOT NULL DEFAULT 1,
|
||||
`config_invoice_prefix` varchar(200) DEFAULT NULL,
|
||||
`config_invoice_next_number` int(11) DEFAULT NULL,
|
||||
`config_invoice_footer` text DEFAULT NULL,
|
||||
|
|
@ -1895,4 +1899,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2024-04-08 12:22:49
|
||||
-- Dump completed on 2024-04-08 16:47:46
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ $config_invoice_from_email = $row['config_invoice_from_email'];
|
|||
$config_invoice_late_fee_enable = intval($row['config_invoice_late_fee_enable']);
|
||||
$config_invoice_late_fee_percent = floatval($row['config_invoice_late_fee_percent']);
|
||||
|
||||
// Recurring
|
||||
// Recurring Invoices
|
||||
$config_recurring_prefix = $row['config_recurring_prefix'];
|
||||
$config_recurring_next_number = intval($row['config_recurring_next_number']);
|
||||
|
||||
|
|
@ -58,6 +58,10 @@ $config_quote_footer = $row['config_quote_footer'];
|
|||
$config_quote_from_name = $row['config_quote_from_name'];
|
||||
$config_quote_from_email = $row['config_quote_from_email'];
|
||||
|
||||
// Projects
|
||||
$config_project_prefix = $row['config_project_prefix'];
|
||||
$config_project_next_number = intval($row['config_project_next_number']);
|
||||
|
||||
// Tickets
|
||||
$config_ticket_prefix = $row['config_ticket_prefix'];
|
||||
$config_ticket_next_number = intval($row['config_ticket_next_number']);
|
||||
|
|
|
|||
|
|
@ -14,8 +14,17 @@ if (isset($_POST['add_project'])) {
|
|||
$project_manager = intval($_POST['project_manager']);
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$project_template_id = intval($_POST['project_template_id']);
|
||||
|
||||
// Sanitize Project Prefix
|
||||
$config_project_prefix = sanitizeInput($config_project_prefix);
|
||||
|
||||
// Get the next Project Number and add 1 for the new Project number
|
||||
$project_number = $config_project_next_number;
|
||||
$new_config_project_next_number = $config_project_next_number + 1;
|
||||
|
||||
mysqli_query($mysqli, "UPDATE settings SET config_project_next_number = $new_config_project_next_number WHERE company_id = 1");
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO projects SET project_name = '$project_name', project_description = '$project_description', project_due = '$due_date', project_manager = $project_manager, project_client_id = $client_id");
|
||||
mysqli_query($mysqli, "INSERT INTO projects SET project_prefix = '$config_project_prefix', project_number = $project_number, project_name = '$project_name', project_description = '$project_description', project_due = '$due_date', project_manager = $project_manager, project_client_id = $client_id");
|
||||
|
||||
$project_id = mysqli_insert_id($mysqli);
|
||||
|
||||
|
|
|
|||
|
|
@ -260,6 +260,25 @@ if (isset($_POST['edit_quote_settings'])) {
|
|||
|
||||
}
|
||||
|
||||
if (isset($_POST['edit_project_settings'])) {
|
||||
|
||||
validateCSRFToken($_POST['csrf_token']);
|
||||
validateAdminRole();
|
||||
|
||||
$config_project_prefix = sanitizeInput($_POST['config_project_prefix']);
|
||||
$config_project_next_number = intval($_POST['config_project_next_number']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_project_prefix = '$config_project_prefix', config_project_next_number = $config_project_next_number WHERE company_id = 1");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modify', log_description = '$session_name modified project settings', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Project Settings updated";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['edit_ticket_settings'])) {
|
||||
|
||||
validateAdminRole();
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ if (isset($_GET['project_id'])) {
|
|||
$row = mysqli_fetch_array($sql_project);
|
||||
|
||||
$project_id = intval($row['project_id']);
|
||||
$project_prefix = nullable_htmlentities($row['project_prefix']);
|
||||
$project_number = intval($row['project_number']);
|
||||
$project_name = nullable_htmlentities($row['project_name']);
|
||||
$project_description = nullable_htmlentities($row['project_description']);
|
||||
$project_due = nullable_htmlentities($row['project_due']);
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<table class="table table-striped table-hover table-borderless">
|
||||
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=project_number&order=<?php echo $disp; ?>">Number</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=project_name&order=<?php echo $disp; ?>">Project</a></th>
|
||||
<th>Tickets / Tasks</th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=project_due&order=<?php echo $disp; ?>">Due</a></th>
|
||||
|
|
@ -126,6 +127,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
while ($row = mysqli_fetch_array($sql_projects)) {
|
||||
$project_id = intval($row['project_id']);
|
||||
$project_prefix = nullable_htmlentities($row['project_prefix']);
|
||||
$project_number = intval($row['project_number']);
|
||||
$project_name = nullable_htmlentities($row['project_name']);
|
||||
$project_description = nullable_htmlentities($row['project_description']);
|
||||
$project_due = nullable_htmlentities($row['project_due']);
|
||||
|
|
@ -185,6 +188,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo "$project_prefix$project_number"; ?></td>
|
||||
<td>
|
||||
<a class="text-dark" href="project_details.php?project_id=<?php echo $project_id; ?>">
|
||||
<div class="media">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
require_once "inc_all_settings.php";
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-3">
|
||||
<h3 class="card-title"><i class="fas fa-fw fa-project-diagram mr-2"></i>Project Settings</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<h4>Project</h4>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Project Prefix</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="config_project_prefix" placeholder="Project Prefix" value="<?php echo nullable_htmlentities($config_project_prefix); ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Next Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
||||
</div>
|
||||
<input type="number" min="0" class="form-control" name="config_project_next_number" placeholder="Next Project Number" value="<?php echo intval($config_project_next_number); ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<button type="submit" name="edit_project_settings" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once "footer.php";
|
||||
|
|
@ -96,6 +96,14 @@
|
|||
<?php } ?>
|
||||
|
||||
<?php if ($config_module_enable_ticketing) { ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "settings_project.php") { echo "active"; } ?>"
|
||||
href="settings_project.php">
|
||||
<i class="nav-icon fas fa-project-diagram"></i>
|
||||
<p>Project</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "settings_ticket.php") { echo "active"; } ?>"
|
||||
href="settings_ticket.php">
|
||||
|
|
|
|||
Loading…
Reference in New Issue