diff --git a/CHANGELOG.md b/CHANGELOG.md index d1ac7651..528ba258 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,23 @@ # CHANGELOG +### Version 10.0 +- Discord server link added +- Added archive option when deleting a formula +- Added JSON export for customers +- Added inventory create/update info for customers +- Customers messages changed to toast +- Added JSON export for lids +- Added inventory create/update info for compounds +- Added JSON import/export for compounds +- Allow a formula to be marked complete when contains skipped materials +- Bottle edit page format update +- Weight added for the bottles inventory +- Bottles inventory messages changed to toast +- Added Inventory for finished Compounds +- Added document size and created date in fotmula attachements page +- Fix search when replacing a material +- PV Scale integration - WIP +- Log ingredient id in history + ### Version 9.9 - Record replaced ingredients when finalising a formula in the generated PDF - Increase toast duration for formula making to 10 seconds diff --git a/README.md b/README.md index 585330b3..42943dcd 100755 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ A sophisticated tool to help perfumers organize their formulas, ingredients and This is a FREE software provided as is without ANY warranty under MIT license. [![Current Release](https://img.shields.io/github/v/release/globaldyne/parfumvault.svg "Current Release")](https://github.com/globaldyne/parfumvault/releases/latest) [![PayPal](https://img.shields.io/badge/donate-PayPal-green.svg)](https://paypal.me/jbparfum) +![Discord](https://img.shields.io/discord/1238069309356638217) # Features diff --git a/VERSION.md b/VERSION.md index a61a79be..2f52450b 100755 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -9.9 +10.0 diff --git a/core/formula_timeline_data.php b/core/formula_timeline_data.php index 3ded40df..02f6696d 100644 --- a/core/formula_timeline_data.php +++ b/core/formula_timeline_data.php @@ -38,6 +38,7 @@ $r['id'] = (int)$h['id']; $r['fid'] = (string)$h['fid']; + $r['ing_id'] = (int)$h['ing_id']; $r['change_made'] = (string)$h['change_made']; $r['date_time'] = (string)$h['date_time']; $r['user'] = (string)$h['user']; diff --git a/core/list_bottle_data.php b/core/list_bottle_data.php index 9ae801db..1481a4b3 100644 --- a/core/list_bottle_data.php +++ b/core/list_bottle_data.php @@ -34,11 +34,14 @@ $r['height'] = (double)$rq['height']?:0; $r['width'] = (double)$rq['width']?:0; $r['diameter'] = (double)$rq['diameter']?:0; + $r['weight'] = (double)$rq['weight']?:0; $r['supplier'] = (string)$rq['supplier']?:'N/A'; $r['supplier_link'] = (string)$rq['supplier_link']?:'N/A'; $r['notes'] = (string)$rq['notes']?:'N/A'; $r['pieces'] = (int)$rq['pieces']?:0; - + $r['created'] = (string)$rq['created']?:'00:00:00'; + $r['updated'] = (string)$rq['updated']?:'00:00:00'; + $photo = mysqli_fetch_array(mysqli_query($conn,"SELECT docData FROM documents WHERE type = '4' AND ownerID = '".$r['id']."'")); $r['photo'] = (string)$photo['docData']?:'data:image/png;base64,'.$defImage; diff --git a/core/list_customer_data.php b/core/list_customer_data.php index a97320e8..0c5a6ce8 100644 --- a/core/list_customer_data.php +++ b/core/list_customer_data.php @@ -33,7 +33,9 @@ $r['phone'] = (string)$rq['phone']?:'N/A'; $r['email'] = (string)$rq['email']?:'N/A'; $r['web'] = (string)$rq['web']?:'N/A'; - + $r['created'] = (string)$rq['created']?:'00:00:00'; + $r['updated'] = (string)$rq['updated']?:'00:00:00'; + $rx[]=$r; } $total = mysqli_fetch_assoc(mysqli_query($conn,"SELECT COUNT(id) AS entries FROM customers")); diff --git a/core/list_formula_attachments_data.php b/core/list_formula_attachments_data.php index 4ae53f10..93bb47e4 100644 --- a/core/list_formula_attachments_data.php +++ b/core/list_formula_attachments_data.php @@ -20,6 +20,7 @@ $r['type'] = (int)$doc['type']; $r['name'] = (string)$doc['name']?:'N/A'; $r['notes'] = (string)$doc['notes']?:'N/A'; + $r['created'] = (string)$doc['created']?:'N/A'; $r['docData'] = (string)$doc['docData']; $r['docSize'] = (string)formatBytes(strlen($doc['docData'])); diff --git a/core/list_inventory_compounds_data.php b/core/list_inventory_compounds_data.php new file mode 100644 index 00000000..fcccfbb8 --- /dev/null +++ b/core/list_inventory_compounds_data.php @@ -0,0 +1,88 @@ + $type['name'], + 'concentration' => $type['concentration'], + 'bottles_total' => calculateBottles($bottleSize, $type['concentration'], $defBtlSize) + ]; + } + + $r['breakDown'] = $rt; + $rx[] = $r; +} + +$total = mysqli_fetch_assoc(mysqli_query($conn,"SELECT COUNT(id) AS entries FROM $t")); +$filtered = mysqli_fetch_assoc(mysqli_query($conn,"SELECT COUNT(id) AS entries FROM $t ".$f)); + +$response = array( + "draw" => (int)$_POST['draw'], + "recordsTotal" => (int)$total['entries'], + "recordsFiltered" => (int)$filtered['entries'], + "data" => $rx +); + +if(empty($r)){ + $response['data'] = []; +} + +header('Content-Type: application/json; charset=utf-8'); +echo json_encode($response); +return; +?> diff --git a/css/vault.css b/css/vault.css index 5c855629..00004414 100755 --- a/css/vault.css +++ b/css/vault.css @@ -1449,3 +1449,9 @@ th.dt-center, td.dt-center { #liveToast { width: 100%; } + +.pvScale-data-footer { + position: -webkit-sticky; + position: sticky; + bottom: 0; +} diff --git a/db/pvault.sql b/db/pvault.sql index 46a1e640..288b6b68 100755 --- a/db/pvault.sql +++ b/db/pvault.sql @@ -28,10 +28,13 @@ CREATE TABLE `bottles` ( `height` varchar(255) COLLATE utf8_general_ci DEFAULT NULL, `width` varchar(255) COLLATE utf8_general_ci DEFAULT NULL, `diameter` varchar(255) COLLATE utf8_general_ci DEFAULT NULL, + `weight` DOUBLE NOT NULL DEFAULT '0', `supplier` varchar(255) COLLATE utf8_general_ci DEFAULT NULL, `supplier_link` varchar(255) COLLATE utf8_general_ci DEFAULT NULL, `notes` text COLLATE utf8_general_ci DEFAULT NULL, - `pieces` int(11) NOT NULL DEFAULT 0 + `pieces` int(11) NOT NULL DEFAULT 0, + `updated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL, + `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; CREATE TABLE `customers` ( @@ -40,7 +43,10 @@ CREATE TABLE `customers` ( `address` varchar(255) COLLATE utf8_general_ci DEFAULT NULL, `email` varchar(225) COLLATE utf8_general_ci DEFAULT NULL, `phone` varchar(255) COLLATE utf8_general_ci DEFAULT NULL, - `web` varchar(255) COLLATE utf8_general_ci DEFAULT NULL + `web` varchar(255) COLLATE utf8_general_ci DEFAULT NULL, + `owner_id` INT NOT NULL DEFAULT '0', + `updated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL, + `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; CREATE TABLE `formulas` ( @@ -495,6 +501,7 @@ CREATE TABLE `documents` ( `name` varchar(255) COLLATE utf8_general_ci NOT NULL, `notes` varchar(255) COLLATE utf8_general_ci DEFAULT NULL, `docData` longblob NOT NULL, + `isBatch` INT NOT NULL DEFAULT '0', `created` datetime NOT NULL DEFAULT current_timestamp(), `updated` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), @@ -599,6 +606,7 @@ CREATE TABLE `formulasRevisions` ( CREATE TABLE `formula_history` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fid` varchar(255) NOT NULL, + `ing_id` INT NOT NULL DEFAULT '0', `change_made` text COLLATE utf8_general_ci NOT NULL, `date_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` varchar(255) COLLATE utf8_general_ci NOT NULL, @@ -679,7 +687,9 @@ CREATE TABLE `backup_provider` ( `description` varchar(255) NOT NULL, `gdrive_name` varchar(255) NOT NULL DEFAULT 'pvault', UNIQUE KEY `id` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; INSERT INTO `backup_provider` (`id`, `credentials`, `provider`, `schedule`, `enabled`, `description`, `gdrive_name`) VALUES -(1, '{}', 'Google', '00:00:00', 1, 'My PV Backups', 'pvault'); \ No newline at end of file +(1, '{}', 'Google', '00:00:00', 1, 'My PV Backups', 'pvault'); + +CREATE TABLE `inventory_compounds` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL , `description` TEXT NOT NULL , `batch_id` VARCHAR(255) NOT NULL DEFAULT '-' , `size` DOUBLE NOT NULL DEFAULT '0' , `updated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `owner_id` INT NOT NULL DEFAULT '0' , `location` VARCHAR(255) NOT NULL , `label_info` TEXT NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB CHARSET=utf8 COLLATE utf8_general_ci; \ No newline at end of file diff --git a/db/schema.ver b/db/schema.ver index a61a79be..2f52450b 100644 --- a/db/schema.ver +++ b/db/schema.ver @@ -1 +1 @@ -9.9 +10.0 diff --git a/db/updates/update_9.9-10.0.sql b/db/updates/update_9.9-10.0.sql new file mode 100644 index 00000000..95c4af1f --- /dev/null +++ b/db/updates/update_9.9-10.0.sql @@ -0,0 +1,6 @@ +CREATE TABLE `inventory_compounds` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL , `description` TEXT NOT NULL , `batch_id` VARCHAR(255) NOT NULL DEFAULT '-' , `size` DOUBLE NOT NULL DEFAULT '0' , `updated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `owner_id` INT NOT NULL DEFAULT '0' , `location` VARCHAR(255) NOT NULL , `label_info` TEXT NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB CHARSET=utf8 COLLATE utf8_general_ci; +ALTER TABLE `documents` ADD `isBatch` INT NOT NULL DEFAULT '0' AFTER `docData`; +ALTER TABLE `bottles` ADD `weight` DOUBLE NOT NULL DEFAULT '0' AFTER `supplier`; +ALTER TABLE `customers` ADD `owner_id` INT NOT NULL DEFAULT '0' AFTER `web`, ADD `updated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL AFTER `owner_id`, ADD `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `updated`; +ALTER TABLE `bottles` ADD `updated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL AFTER `pieces`, ADD `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `updated`; +ALTER TABLE `formula_history` ADD `ing_id` INT NOT NULL DEFAULT '0' AFTER `fid`; \ No newline at end of file diff --git a/func/genBatchPDF.php b/func/genBatchPDF.php index 253148fb..d282af8f 100644 --- a/func/genBatchPDF.php +++ b/func/genBatchPDF.php @@ -284,7 +284,7 @@ function Code39($xpos, $ypos, $code, $baseline=0.5, $height=5){ $docData = 'data:application/pdf;base64,' .$pdf; if($formulaTable == "makeFormula"){ - mysqli_query($conn, "INSERT INTO documents (ownerID,type,name,notes,docData) VALUES (".$meta['id'].",'5','$batchID','Auto generated by Formula Make','$docData')"); + mysqli_query($conn, "INSERT INTO documents (ownerID,type,name,notes,docData,isBatch) VALUES (".$meta['id'].",'5','$batchID','Auto generated by Formula Make','$docData','1')"); }else{ diff --git a/img/pvScaleSP1.png b/img/pvScaleSP1.png new file mode 100644 index 00000000..da328997 Binary files /dev/null and b/img/pvScaleSP1.png differ diff --git a/index.php b/index.php index fd9c4b09..012597ac 100755 --- a/index.php +++ b/index.php @@ -212,7 +212,7 @@ function chkUpdate() {