From f29e692e819af3db2b515e5b8e24ab294430d364 Mon Sep 17 00:00:00 2001
From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com>
Date: Mon, 20 May 2024 13:09:38 +0100
Subject: [PATCH 1/5] update:
Added Additional Information
City
District
State
Zip
---
install/phpnuxbill.sql | 4 +++
system/controllers/customers.php | 18 +++++++++++++
system/updates.json | 3 +++
ui/ui/customers-add.tpl | 45 ++++++++++++++++++++++++++++++++
ui/ui/customers-edit.tpl | 45 ++++++++++++++++++++++++++++++++
ui/ui/customers-view.tpl | 16 +++++++++---
6 files changed, 128 insertions(+), 3 deletions(-)
diff --git a/install/phpnuxbill.sql b/install/phpnuxbill.sql
index a55baa64..30ecd5ad 100644
--- a/install/phpnuxbill.sql
+++ b/install/phpnuxbill.sql
@@ -24,6 +24,10 @@ CREATE TABLE `tbl_customers` (
`pppoe_password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'For PPPOE Login',
`fullname` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`address` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
+ `city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
+ `district` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
+ `state` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
+ `zip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`phonenumber` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
`email` varchar(128) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1',
`coordinates` VARCHAR(50) NOT NULL DEFAULT '' COMMENT 'Latitude and Longitude coordinates',
diff --git a/system/controllers/customers.php b/system/controllers/customers.php
index dfff613c..926aadb5 100644
--- a/system/controllers/customers.php
+++ b/system/controllers/customers.php
@@ -391,6 +391,11 @@ switch ($action) {
//post Customers Attributes
$custom_field_names = (array) $_POST['custom_field_name'];
$custom_field_values = (array) $_POST['custom_field_value'];
+ //additional information
+ $city = _post('city');
+ $district = _post('district');
+ $state = _post('state');
+ $zip = _post('zip');
run_hook('add_customer'); #HOOK
$msg = '';
@@ -422,6 +427,10 @@ switch ($action) {
$d->phonenumber = Lang::phoneFormat($phonenumber);
$d->service_type = $service_type;
$d->coordinates = $coordinates;
+ $d->city = $city;
+ $d->district = $district;
+ $d->state = $state;
+ $d->zip = $zip;
$d->save();
// Retrieve the customer ID of the newly created customer
@@ -460,6 +469,11 @@ switch ($action) {
$service_type = _post('service_type');
$coordinates = _post('coordinates');
$status = _post('status');
+ //additional information
+ $city = _post('city');
+ $district = _post('district');
+ $state = _post('state');
+ $zip = _post('zip');
run_hook('edit_customer'); #HOOK
$msg = '';
if (Validator::Length($username, 35, 2) == false) {
@@ -522,6 +536,10 @@ switch ($action) {
$d->phonenumber = $phonenumber;
$d->service_type = $service_type;
$d->coordinates = $coordinates;
+ $d->city = $city;
+ $d->district = $district;
+ $d->state = $state;
+ $d->zip = $zip;
$d->save();
diff --git a/system/updates.json b/system/updates.json
index aebb6960..d6ac2088 100644
--- a/system/updates.json
+++ b/system/updates.json
@@ -96,5 +96,8 @@
],
"2024.5.17" : [
"ALTER TABLE `tbl_customers` ADD `status` ENUM('Active','Banned','Disabled') NOT NULL DEFAULT 'Active' AFTER `auto_renewal`;"
+ ],
+ "2024.5.20" : [
+ "ALTER TABLE `tbl_customers` ADD `city` VARCHAR(255) NULL AFTER `address`, ADD `district` VARCHAR(255) NULL AFTER `city`, ADD `state` VARCHAR(255) NULL AFTER `district`, ADD `zip` VARCHAR(10) NULL AFTER `state`;"
]
}
\ No newline at end of file
diff --git a/ui/ui/customers-add.tpl b/ui/ui/customers-add.tpl
index db70e9cd..4985dfb5 100644
--- a/ui/ui/customers-add.tpl
+++ b/ui/ui/customers-add.tpl
@@ -121,6 +121,51 @@
+