From 37fa7a85e7b5df6765e10a1233c8d2d5a1c52884 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 29 Mar 2021 14:08:55 +0000 Subject: [PATCH 01/61] Formula CSV Import improvements/Various bug fixes --- CHANGELOG.md | 4 ++ VERSION.md | 2 +- db/schema.ver | 2 +- pages/csvImport.php | 112 -------------------------------------- pages/ingredients.php | 2 +- pages/listFormulas.php | 96 +++++++++++++++++++++++++++++++- pages/update_settings.php | 2 +- pages/upload.php | 38 +++++++++++++ pages/viewFormula.php | 2 +- releasenotes.md | 6 +- 10 files changed, 141 insertions(+), 125 deletions(-) delete mode 100755 pages/csvImport.php diff --git a/CHANGELOG.md b/CHANGELOG.md index c1af6ccd..d0776bcf 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # CHANGELOG +### Version 2.8 +Formula CSV Import improvements +Various bug fixes + ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity Create entry in ingredients from allergens diff --git a/VERSION.md b/VERSION.md index 1effb003..a4412fa7 100755 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -2.7 +2.8 diff --git a/db/schema.ver b/db/schema.ver index 1effb003..a4412fa7 100644 --- a/db/schema.ver +++ b/db/schema.ver @@ -1 +1 @@ -2.7 +2.8 diff --git a/pages/csvImport.php b/pages/csvImport.php deleted file mode 100755 index 485d5475..00000000 --- a/pages/csvImport.php +++ /dev/null @@ -1,112 +0,0 @@ -xError: '.$name.' already exists! Click here to view/edit!'; - }else{ - - $filename=$_FILES["file"]["tmp_name"]; - if($_FILES["file"]["size"] > 0){ - $file = fopen($filename, "r"); - while (($data = fgetcsv($file, 10000, ",")) !== FALSE){ - if(!mysqli_num_rows(mysqli_query($conn, "SELECT name FROM ingredients WHERE name = '".trim(ucwords($data['0']))."'"))){ - - mysqli_query($conn, "INSERT INTO ingredients (name, ml) VALUES ('".trim(ucwords($data['0']))."', '10')"); - } - if(empty($data['1'])){ - $data['1'] = '100'; - } - $sql = "INSERT INTO formulas (fid, name,ingredient,concentration,quantity) VALUES ('$fid', '$name','".trim(ucwords($data['0']))."','$data[1]','$data[2]')"; - $res = mysqli_query($conn, $sql); - - } - if($res){ - mysqli_query($conn, "INSERT INTO formulasMetaData (fid,name,notes,profile,image) VALUES ('$fid','$name','Imported via csv','$profile','$def_app_img')"); - $msg='
'.$name.' added!
'; - }else{ - $msg='
Error adding: '.$name.'
'; - } - fclose($file); - } - } -} -?> - - - - -Import CSV file - - - - - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Import CSV
Name:
Profile: - -
Choose file: - -
  
 
  
-

*If your CSV file contains an ingredient which is not already in your inventory, then will automatically create it using the minimum values.

-

*CSV delimeter: ','

-

*CSV format:

-

ingrdedient,concentration,quantity

-

eg:

-

Ambroxan,10,0.15

-
-
-
- - diff --git a/pages/ingredients.php b/pages/ingredients.php index 358d55d0..afa75e64 100755 --- a/pages/ingredients.php +++ b/pages/ingredients.php @@ -48,11 +48,11 @@ + + + diff --git a/pages/update_settings.php b/pages/update_settings.php index 20ffeb2c..c64acda6 100644 --- a/pages/update_settings.php +++ b/pages/update_settings.php @@ -151,7 +151,7 @@ $notes = mysqli_real_escape_string($conn, $_POST['cat_notes']); if(empty($cat)){ - echo '
xCategory namae is required.
'; + echo '
xCategory name is required.
'; return; } if(mysqli_num_rows(mysqli_query($conn, "SELECT name FROM ingCategory WHERE name = '$cat'"))){ diff --git a/pages/upload.php b/pages/upload.php index edc17047..1c728967 100644 --- a/pages/upload.php +++ b/pages/upload.php @@ -102,4 +102,42 @@ return; } +if($_GET['type'] == 'frmCSVImport'){ + $name = mysqli_real_escape_string($conn,trim($_GET['name'])); + $fid = base64_encode($name); + + $profile = mysqli_real_escape_string($conn,$_GET['profile']); + + if(mysqli_num_rows(mysqli_query($conn, "SELECT id FROM formulasMetaData WHERE fid = '$fid'"))){ + echo '
xError: '.$name.' already exists! Click here to view/edit!
'; + return; + } + + $filename=$_FILES["CSVFile"]["tmp_name"]; + if($_FILES["CSVFile"]["size"] > 0){ + $file = fopen($filename, "r"); + while (($data = fgetcsv($file, 10000, ",")) !== FALSE){ + if(!mysqli_num_rows(mysqli_query($conn, "SELECT name FROM ingredients WHERE name = '".trim(ucwords($data['0']))."'"))){ + + mysqli_query($conn, "INSERT INTO ingredients (name, ml) VALUES ('".trim(ucwords($data['0']))."', '10')"); + } + if(empty($data['1'])){ + $data['1'] = '100'; + } + $sql = "INSERT INTO formulas (fid,name,ingredient,concentration,dilutant,quantity) VALUES ('$fid', '$name','".trim(ucwords($data['0']))."','".$data['1']."','".$data['2']."','".$data['3']."')"; + $res = mysqli_query($conn, $sql); + } + + if($res){ + mysqli_query($conn, "INSERT INTO formulasMetaData (fid,name,notes,profile,image) VALUES ('$fid','$name','Imported via csv','$profile','$def_app_img')"); + echo '
'.$name.' added!
'; + }else{ + echo '
Error adding: '.$name.'
'; + } + fclose($file); + } + + + return; +} ?> \ No newline at end of file diff --git a/pages/viewFormula.php b/pages/viewFormula.php index d15c477c..2c1e74af 100644 --- a/pages/viewFormula.php +++ b/pages/viewFormula.php @@ -199,7 +199,7 @@ function addTODO() { ], diff --git a/releasenotes.md b/releasenotes.md index 7c886dc2..2b1c685c 100755 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,7 +1,3 @@ Whats New: ---------------------- -You can now add basic ingredient info when adding allergens -Override usage limits in ingredients -Ingredients management improvements -We added option to exclude specific ingredients from uploading to PV Online -The ingredient management page has a new layout for Usage & Limits for better user experience + From aed82756f2b62e84967f75ae0b04522bb0282b7d Mon Sep 17 00:00:00 2001 From: John Date: Mon, 29 Mar 2021 15:21:30 +0000 Subject: [PATCH 02/61] IFRA Library import improvements --- CHANGELOG.md | 2 ++ css/vault.css | 7 ++++ pages/IFRA.php | 78 ++++++++++++++++++++++++++++++++++++++++--- pages/maintenance.php | 48 -------------------------- pages/settings.php | 10 +----- pages/upload.php | 52 +++++++++++++++++++++++++++++ 6 files changed, 136 insertions(+), 61 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0776bcf..9cfa2296 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ # CHANGELOG ### Version 2.8 Formula CSV Import improvements +IFRA Library import improvements Various bug fixes + ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity Create entry in ingredients from allergens diff --git a/css/vault.css b/css/vault.css index 27999165..14a8085c 100755 --- a/css/vault.css +++ b/css/vault.css @@ -344,3 +344,10 @@ a:hover{ .odd_ing { background-color: #EEE !important; } + +.modal-ifra { + width: 800px; + max-width: 800px; + margin: auto; +} + diff --git a/pages/IFRA.php b/pages/IFRA.php index 6ab712ba..0df1a4a3 100755 --- a/pages/IFRA.php +++ b/pages/IFRA.php @@ -24,7 +24,7 @@ @@ -67,8 +67,45 @@ - - diff --git a/pages/maintenance.php b/pages/maintenance.php index 7aec2acb..3e060fa8 100755 --- a/pages/maintenance.php +++ b/pages/maintenance.php @@ -51,54 +51,6 @@ header("Location: maintenance.php?do=restoreDB&err=2"); } - -}elseif(isset($_FILES['IFRAfile'])){ - $filename = $_FILES["IFRAfile"]["tmp_name"]; - $file_ext = strtolower(end(explode('.',$_FILES['IFRAfile']['name']))); - $all_ext = "xls,xlsx"; - $ext = explode(",",$all_ext); - - if(in_array($file_ext,$ext)=== false){ - echo '
File upload error: Extension not allowed, please choose a '.$all_ext.' file.
'; - }else{ - if($_FILES["IFRAfile"]["size"] > 0){ - require_once('../func/SimpleXLSX.php'); - mysqli_query($conn, "TRUNCATE IFRALibrary"); - - $xlsx = SimpleXLSX::parse($filename); - - try { - $link = new PDO( "mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass); - $link->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } - catch(PDOException $e) - { - echo $sql . "
" . $e->getMessage(); - } - - $fields = 'ifra_key,image,amendment,prev_pub,last_pub,deadline_existing ,deadline_new,name,cas,cas_comment,synonyms,formula,flavor_use,prohibited_notes,restricted_photo_notes,restricted_notes,specified_notes,type,risk,contrib_others,contrib_others_notes,cat1,cat2,cat3,cat4,cat5A ,cat5B,cat5C,cat5D,cat6,cat7A,cat7B,cat8,cat9,cat10A,cat10B,cat11A,cat11B,cat12'; - $values = substr(str_repeat('?,', count(explode(',' , $fields))), 0 , strlen($x) - 1); - $stmt = $link->prepare( "INSERT INTO IFRALibrary ($fields) VALUES ($values)"); - $cols = $xlsx->dimension()[0];//$dim[0]; - foreach ( $xlsx->rows() as $k => $r ) { - for ( $i = 0; $i < $cols; $i ++ ) { - $l = $i+1; - $stmt->bindValue( $l, $r[ $i]); - } - try { - $stmt->execute(); - $err = '0'; - } catch (Exception $e) { - $err = '1'; - } - } - if($_POST['updateCAS'] == '1'){ - fixIFRACas($conn); - } - header("Location: maintenance.php?do=IFRA&err=$err"); - } -} - }elseif($_GET['do'] == 'restoreDB'){ ?> diff --git a/pages/settings.php b/pages/settings.php index c4e0c5ee..d457be5d 100755 --- a/pages/settings.php +++ b/pages/settings.php @@ -378,18 +378,10 @@     - - - - +   diff --git a/pages/upload.php b/pages/upload.php index 1c728967..2b5a29e2 100644 --- a/pages/upload.php +++ b/pages/upload.php @@ -5,6 +5,8 @@ require_once(__ROOT__.'/inc/opendb.php'); require_once(__ROOT__.'/func/validateInput.php'); require_once(__ROOT__.'/inc/settings.php'); +require_once(__ROOT__.'/func/fixIFRACas.php'); + if($_GET['type'] == 'SDS' && $_GET['ingredient_id']){ @@ -140,4 +142,54 @@ return; } + +if($_GET['type'] == 'IFRA'){ + if(isset($_FILES['ifraXLS'])){ + $filename = $_FILES["ifraXLS"]["tmp_name"]; + $file_ext = strtolower(end(explode('.',$_FILES['ifraXLS']['name']))); + $all_ext = "xls,xlsx"; + $ext = explode(",",$all_ext); + + if(in_array($file_ext,$ext)=== false){ + echo '
File upload error: Extension not allowed, please choose a '.$all_ext.' file.
'; + return; + } + + if($_FILES["ifraXLS"]["size"] > 0){ + require_once(__ROOT__.'/func/SimpleXLSX.php'); + mysqli_query($conn, "TRUNCATE IFRALibrary"); + + $xlsx = SimpleXLSX::parse($filename); + + try { + $link = new PDO( "mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass); + $link->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + }catch(PDOException $e){ + echo $sql . "
" . $e->getMessage(); + } + + $fields = 'ifra_key,image,amendment,prev_pub,last_pub,deadline_existing ,deadline_new,name,cas,cas_comment,synonyms,formula,flavor_use,prohibited_notes,restricted_photo_notes,restricted_notes,specified_notes,type,risk,contrib_others,contrib_others_notes,cat1,cat2,cat3,cat4,cat5A ,cat5B,cat5C,cat5D,cat6,cat7A,cat7B,cat8,cat9,cat10A,cat10B,cat11A,cat11B,cat12'; + $values = substr(str_repeat('?,', count(explode(',' , $fields))), 0 , strlen($x) - 1); + $stmt = $link->prepare( "INSERT INTO IFRALibrary ($fields) VALUES ($values)"); + $cols = $xlsx->dimension()[0];//$dim[0]; + foreach ( $xlsx->rows() as $k => $r ) { + for ( $i = 0; $i < $cols; $i ++ ) { + $l = $i+1; + $stmt->bindValue( $l, $r[ $i]); + } + try { + $stmt->execute(); + $err = '0'; + } catch (Exception $e) { + $err = '1'; + } + } + if($_GET['updateCAS'] == '1'){ + fixIFRACas($conn); + } + echo '
Import success.
'; + } + } + return; +} ?> \ No newline at end of file From c08c39a745e2eb7b171b21c14f99615af0359dfa Mon Sep 17 00:00:00 2001 From: John Date: Tue, 30 Mar 2021 07:27:51 +0000 Subject: [PATCH 03/61] Formula view page improvements --- pages/viewFormula.php | 54 +++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/pages/viewFormula.php b/pages/viewFormula.php index 2c1e74af..46fc6fc0 100644 --- a/pages/viewFormula.php +++ b/pages/viewFormula.php @@ -251,8 +251,8 @@ function addTODO() { Purity % Dilutant Quantity (ml) - Concentration* - Cost + Concentration %* + Cost () Properties Actions @@ -278,25 +278,27 @@ function addTODO() { }else{ $ingName = $formula['ingredient']; } - - echo''; - if($settings['grp_formula'] == '1'){ + ?> + + Unknown'; - }else{ - echo ''.$ing_q['profile'].''; - } + ?> + Unknown + + + - None'; - }else{ - echo ''.$formula['dilutant'].''; - } + + None + + + '.number_format($formula['quantity'],$settings['qStep']).''; - echo''.$conc_p.'%'; - echo ''.utf8_encode($settings['currency']).calcCosts($ing_q['price'],$formula['quantity'], $formula['concentration'], $ing_q['ml']).''; - echo ''.ucfirst($ing_q['odor']).''; - echo '     - '; + ?> + + > + + +     + + + + ?> - '; }?> + + + + Total: From 92380c7fde12352415542adf5a15752005edceb5 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 30 Mar 2021 08:05:58 +0000 Subject: [PATCH 04/61] Ingredient managment minor fix --- .gitignore | 1 + pages/searchTGSC.php | 21 --------------------- pages/update_data.php | 6 ++++-- 3 files changed, 5 insertions(+), 23 deletions(-) delete mode 100755 pages/searchTGSC.php diff --git a/.gitignore b/.gitignore index ce4c3664..0a35040c 100755 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ inc/config.php *.swp t.php tests/ +searchTGSC.php diff --git a/pages/searchTGSC.php b/pages/searchTGSC.php deleted file mode 100755 index c4ecba8f..00000000 --- a/pages/searchTGSC.php +++ /dev/null @@ -1,21 +0,0 @@ -loadHTMLFile($url); -$xpath = new DOMXpath($doc); -$elements = $xpath->query('//*/tr'); - foreach ($elements as $element) { - $x[] = $element->nodeValue; - } -$l = str_replace('Flavor', '',explode('Odor : ',$x[2])); -$k = explode(': ',$l['1']); -if ($k[0]){ - echo ''; - -}else{ - echo ''; -} -?> \ No newline at end of file diff --git a/pages/update_data.php b/pages/update_data.php index 273b684c..7607542a 100755 --- a/pages/update_data.php +++ b/pages/update_data.php @@ -217,8 +217,10 @@ $ing = mysqli_real_escape_string($conn, $_POST['ing']); $INCI = trim(mysqli_real_escape_string($conn, $_POST["INCI"])); - $cas = trim(mysqli_real_escape_string($conn, $_POST["cas"])); - $fema = trim(mysqli_real_escape_string($conn, $_POST["fema"])); + + $cas = preg_replace('/\s+/', '', trim(mysqli_real_escape_string($conn, $_POST["cas"]))); + $fema = preg_replace('/\s+/', '', trim(mysqli_real_escape_string($conn, $_POST["fema"]))); + $type = mysqli_real_escape_string($conn, $_POST["type"]); $strength = mysqli_real_escape_string($conn, $_POST["strength"]); $category = mysqli_real_escape_string($conn, $_POST["category"]); From 36b8f651c13686ab16465ea4c639f1942e9b5961 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 30 Mar 2021 16:18:23 +0000 Subject: [PATCH 05/61] Validate name when importing a fromula from CSV --- pages/upload.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pages/upload.php b/pages/upload.php index 2b5a29e2..3c397465 100644 --- a/pages/upload.php +++ b/pages/upload.php @@ -106,6 +106,12 @@ if($_GET['type'] == 'frmCSVImport'){ $name = mysqli_real_escape_string($conn,trim($_GET['name'])); + + if(empty($name)){ + echo '
Error: Name is required.
'; + return; + } + $fid = base64_encode($name); $profile = mysqli_real_escape_string($conn,$_GET['profile']); From bfeaa351a86e697f55162b7e4b6bce69e9aab373 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 30 Mar 2021 17:22:40 +0000 Subject: [PATCH 06/61] Added protection from accidental deletion in formulas --- CHANGELOG.md | 1 + db/pvault.sql | 3 ++- db/updates/update_2.7-2.8.sql | 1 + func/formulaProfile.php | 5 +++-- index.php | 2 +- pages/getFormMeta.php | 28 ++++++++++++++++++++++++---- pages/manageFormula.php | 6 ++++++ pages/update_data.php | 16 ++++++++++++++++ releasenotes.md | 1 + 9 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 db/updates/update_2.7-2.8.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cfa2296..527fe142 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # CHANGELOG ### Version 2.8 Formula CSV Import improvements +Added protection from accidental deletion in formulas IFRA Library import improvements Various bug fixes diff --git a/db/pvault.sql b/db/pvault.sql index 28c5ff9c..f737b47e 100755 --- a/db/pvault.sql +++ b/db/pvault.sql @@ -88,7 +88,8 @@ CREATE TABLE `formulasMetaData` ( `sex` varchar(255) COLLATE utf8_bin DEFAULT NULL, `notes` text COLLATE utf8_bin DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `image` varchar(255) COLLATE utf8_bin NOT NULL + `image` varchar(255) COLLATE utf8_bin NOT NULL, + `isPrivate` INT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `IFRALibrary`; diff --git a/db/updates/update_2.7-2.8.sql b/db/updates/update_2.7-2.8.sql new file mode 100644 index 00000000..db525faf --- /dev/null +++ b/db/updates/update_2.7-2.8.sql @@ -0,0 +1 @@ +ALTER TABLE `formulasMetaData` ADD `isProtected` INT NOT NULL DEFAULT '0' AFTER `image`; diff --git a/func/formulaProfile.php b/func/formulaProfile.php index 2089748b..396edb10 100755 --- a/func/formulaProfile.php +++ b/func/formulaProfile.php @@ -21,11 +21,12 @@ function formulaProfile($conn, $profile, $sex){ - +   -     +     + diff --git a/index.php b/index.php index dd373e58..1280a91b 100755 --- a/index.php +++ b/index.php @@ -285,7 +285,7 @@ function list_cat(){
diff --git a/pages/getFormMeta.php b/pages/getFormMeta.php index 9d553101..eccc720e 100755 --- a/pages/getFormMeta.php +++ b/pages/getFormMeta.php @@ -77,7 +77,7 @@

- +
Formula Name: @@ -87,6 +87,10 @@ Product Name: + + Protected: + checked="checked" /> + Profile: @@ -126,8 +130,8 @@ type: "POST", mode: 'inline', dataType: 'json', - success: function(response, newValue) { - if(response.status == 'error') return response.msg; + success: function(response) { + $('#msg').html(response); }, }); @@ -182,5 +186,21 @@ {value: 'women', text: 'Women'}, ] }); - }) + }); + + $("#isProtected").change(function() { + $.ajax({ + url: 'update_data.php', + type: 'GET', + data: { + protect: '', + isProtected: $("#isProtected").is(':checked'), + }, + dataType: 'html', + success: function (data) { + $('#msg').html(data); + } + }); + }); + diff --git a/pages/manageFormula.php b/pages/manageFormula.php index 8927f3fe..2acffd1a 100644 --- a/pages/manageFormula.php +++ b/pages/manageFormula.php @@ -160,6 +160,12 @@ //DELETE FORMULA if($_GET['action'] == 'delete' && $_GET['fid']){ $fid = mysqli_real_escape_string($conn, $_GET['fid']); + + if(mysqli_num_rows(mysqli_query($conn, "SELECT id FROM formulasMetaData WHERE fid = '$fid' AND isProtected = '1'"))){ + echo '
xError: formula '.base64_decode($fid).' is protected.
'; + return; + } + if(mysqli_query($conn, "DELETE FROM formulas WHERE fid = '$fid'")){ mysqli_query($conn, "DELETE FROM formulasMetaData WHERE fid = '$fid'"); echo '
xFormula '.base64_decode($fid).' deleted!
'; diff --git a/pages/update_data.php b/pages/update_data.php index 7607542a..ec9bfb3a 100755 --- a/pages/update_data.php +++ b/pages/update_data.php @@ -27,6 +27,22 @@ return; } +if($_GET['protect']){ + $fid = mysqli_real_escape_string($conn, $_GET['protect']); + + if($_GET['isProtected'] == 'true'){ + $isProtected = '1'; + }else{ + $isProtected = '0'; + } + if(mysqli_query($conn, "UPDATE formulasMetaData SET isProtected = '$isProtected' WHERE fid = '$fid'")){ + echo '
xSuccess!
'; + }else{ + echo '
xSomething went wrong.
'; + } + return; +} + if($_GET['rename']){ $value = mysqli_real_escape_string($conn, $_POST['value']); $formula = mysqli_real_escape_string($conn, $_GET['rename']); diff --git a/releasenotes.md b/releasenotes.md index 2b1c685c..454e9ac1 100755 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,3 +1,4 @@ Whats New: ---------------------- +We added an option to enable protection in formulas against accidental deletion From 64f6f7d9810d71d3cde770b9138db3ace68c2732 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 30 Mar 2021 17:48:46 +0000 Subject: [PATCH 07/61] Added protection from accidental deletion in formulas --- pages/getFormMeta.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pages/getFormMeta.php b/pages/getFormMeta.php index eccc720e..d65f5ff9 100755 --- a/pages/getFormMeta.php +++ b/pages/getFormMeta.php @@ -56,9 +56,12 @@ + + - + + @@ -88,7 +91,7 @@ - Protected: + Protected: checked="checked" /> @@ -121,7 +124,8 @@ From fd55eb69f3224e2cd13b5c4c603cbade9091488e Mon Sep 17 00:00:00 2001 From: John Date: Tue, 30 Mar 2021 19:02:37 +0000 Subject: [PATCH 08/61] Fix data table in formulas listing --- CHANGELOG.md | 2 +- func/calcPerc.php | 27 +++++++++++++++------------ func/formulaProfile.php | 2 +- pages/listFormulas.php | 2 +- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 527fe142..1c2704bd 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Formula CSV Import improvements Added protection from accidental deletion in formulas IFRA Library import improvements Various bug fixes - +Fix data table in formulas listing ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/func/calcPerc.php b/func/calcPerc.php index 6d4c0eff..60f54b29 100755 --- a/func/calcPerc.php +++ b/func/calcPerc.php @@ -1,13 +1,16 @@ - \ No newline at end of file diff --git a/func/formulaProfile.php b/func/formulaProfile.php index 396edb10..7037102b 100755 --- a/func/formulaProfile.php +++ b/func/formulaProfile.php @@ -9,7 +9,7 @@ function formulaProfile($conn, $profile, $sex){ $formulas_n = mysqli_query($conn, "SELECT * FROM formulasMetaData WHERE profile = '$profile' OR sex = '$sex' ORDER by name DESC"); } ?> - +
diff --git a/pages/listFormulas.php b/pages/listFormulas.php index f0ad4209..ae6ac77e 100644 --- a/pages/listFormulas.php +++ b/pages/listFormulas.php @@ -180,7 +180,7 @@ showCloseBtn: true, }); -$('#tdData').DataTable({ +$('#tdData,#tdDataoriental,#tdDatawoody,#tdDatafloral,#tdDatafresh,#tdDataunisex,#tdDatamen,#tdDatawomen').DataTable({ "paging": true, "info": true, "lengthMenu": [[20, 35, 60, -1], [20, 35, 60, "All"]] From 394f97de3666289c669596027911208bbfee62a5 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 31 Mar 2021 09:22:47 +0000 Subject: [PATCH 09/61] Bug fixes --- CHANGELOG.md | 1 + func/genBatchPDF.php | 14 +++++++------- pages/genFinishedProduct.php | 2 +- pages/getFormMeta.php | 2 +- pages/update_data.php | 7 +++++-- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c2704bd..6532b062 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Added protection from accidental deletion in formulas IFRA Library import improvements Various bug fixes Fix data table in formulas listing +Fix a bug preventing CAS number to be shown in batch PDF ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/func/genBatchPDF.php b/func/genBatchPDF.php index b00dba10..1123da97 100644 --- a/func/genBatchPDF.php +++ b/func/genBatchPDF.php @@ -1,6 +1,6 @@ Ln(); $pdf->SetFont('Arial','',9); - $ing_q = mysqli_fetch_array(mysqli_query($conn, "SELECT IFRA,price,ml,profile,cas FROM ingredients WHERE name = '".$formula['ingredient']."'")); + $ing_q = mysqli_fetch_array(mysqli_query($conn, "SELECT $defCatClass,price,ml,profile,cas FROM ingredients WHERE name = '".$formula['ingredient']."'")); $new_quantity = $formula['quantity']/$mg*$new_conc; $conc = $new_quantity/$bottle * 100; $conc_p = number_format($formula['concentration'] / 100 * $conc, 3); @@ -199,7 +199,7 @@ function Code39($xpos, $ypos, $code, $baseline=0.5, $height=5){ $pdf->MultiCell(250,10,"Also contains \n"); foreach($hd_blends as $heading) { - $pdf->Cell(45,12,$heading,1,0,'C'); + $pdf->Cell(68,12,$heading,1,0,'C'); } $qAllIng = mysqli_query($conn, "SELECT ingredient,quantity,concentration FROM formulas WHERE fid = '$fid'"); @@ -210,11 +210,11 @@ function Code39($xpos, $ypos, $code, $baseline=0.5, $height=5){ $pdf->Ln(); $pdf->SetFont('Arial','',8); - $pdf->Cell(45,8,$bld['ing'],1,0,'C'); + $pdf->Cell(68,8,$bld['ing'],1,0,'C'); - $pdf->Cell(45,8,$bld['name'],1,0,'C'); - $pdf->Cell(45,8,$bld['cas'],1,0,'C'); - $pdf->Cell(45,8,$bld['percentage'],1,0,'C'); + $pdf->Cell(68,8,$bld['name'],1,0,'C'); + $pdf->Cell(68,8,$bld['cas'],1,0,'C'); + $pdf->Cell(68,8,$bld['percentage'],1,0,'C'); } } diff --git a/pages/genFinishedProduct.php b/pages/genFinishedProduct.php index e2cb708c..749a5ec3 100644 --- a/pages/genFinishedProduct.php +++ b/pages/genFinishedProduct.php @@ -46,7 +46,7 @@ $batchFile = $uploads_path.'batches/'.$batchID; mysqli_query($conn, "INSERT INTO batchIDHistory (id,fid,pdf) VALUES ('$batchID','$fid','$batchFile')"); - genBatchPDF($fid,$batchID,$bottle,$new_conc,$mg['total_mg'],$ver,$uploads_path,$conn); + genBatchPDF($fid,$batchID,$bottle,$new_conc,$mg['total_mg'],$ver,$uploads_path,$settings['defCatClass'],$conn); }else{ $batchID = 'N/A'; } diff --git a/pages/getFormMeta.php b/pages/getFormMeta.php index d65f5ff9..5dec8627 100755 --- a/pages/getFormMeta.php +++ b/pages/getFormMeta.php @@ -34,7 +34,7 @@ $dst = imagecreatetruecolor( $new_width, $new_height ); imagecopyresampled( $dst, $src, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); imagedestroy( $src ); - imagepng( $dst, $targetfilename ); // adjust format as needed + imagepng( $dst, $targetfilename ); //if($_FILES["file"]["size"] > 0){ move_uploaded_file($targetfilename,"../uploads/formulas/".base64_encode($targetfilename)); diff --git a/pages/update_data.php b/pages/update_data.php index ec9bfb3a..1a628af4 100755 --- a/pages/update_data.php +++ b/pages/update_data.php @@ -49,10 +49,13 @@ $fid = base64_encode($value); if(mysqli_num_rows(mysqli_query($conn, "SELECT name FROM formulasMetaData WHERE fid = '$fid'"))){ - echo 'Name already exists'; + echo '
xName already exists'; }else{ mysqli_query($conn, "UPDATE formulasMetaData SET name = '$value', fid = '$fid' WHERE name = '$formula'"); - mysqli_query($conn, "UPDATE formulas SET name = '$value', fid = '$fid' WHERE name = '$formula'"); + if(mysqli_query($conn, "UPDATE formulas SET name = '$value', fid = '$fid' WHERE name = '$formula'")){ + echo '
xFormula renamed.'; + } + } return; } From a64185af74f0b9e90b336dc422f4c6ba12bee6da Mon Sep 17 00:00:00 2001 From: John Date: Wed, 31 Mar 2021 10:37:36 +0000 Subject: [PATCH 10/61] Label print improvements --- CHANGELOG.md | 1 + pages/genFinishedProduct.php | 28 +++----------- pages/manageFormula.php | 73 ++---------------------------------- 3 files changed, 11 insertions(+), 91 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6532b062..245c0984 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ IFRA Library import improvements Various bug fixes Fix data table in formulas listing Fix a bug preventing CAS number to be shown in batch PDF +Label print improvements ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/pages/genFinishedProduct.php b/pages/genFinishedProduct.php index 749a5ec3..790bf61d 100644 --- a/pages/genFinishedProduct.php +++ b/pages/genFinishedProduct.php @@ -75,7 +75,7 @@ function printLabel() { }; -function printBoxLabel() { +function BoxLabel(download) { $("#inf").html(''); @@ -89,33 +89,17 @@ function printBoxLabel() { batchID: "", name: "", carrier: "", - copies: $("#copiesToPrint").val() + copies: $("#copiesToPrint").val(), + download: download }, dataType: 'html', success: function (data) { - $('#printBoxLabel').modal('toggle'); + $('#BoxLabel').modal('toggle'); $('#inf').html(data); } }); }; - -function downloadBoxLabel() { - $.ajax({ - url: 'pages/manageFormula.php', - type: 'get', - data: { - action: "downloadBoxLabel", - batchID: "", - name: "", - carrier: "", - }, - dataType: 'html', - success: function (data) { - $('#inf').html(data); - } - }); -};
@@ -289,7 +273,7 @@ function downloadBoxLabel() {
From c0a7208a9dcc23ff9a92116d13e46e1ad0741c58 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 31 Mar 2021 17:34:55 +0000 Subject: [PATCH 13/61] List cat from db in finished product --- pages/genFinishedProduct.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/genFinishedProduct.php b/pages/genFinishedProduct.php index 6c062e9c..1b860ad4 100644 --- a/pages/genFinishedProduct.php +++ b/pages/genFinishedProduct.php @@ -333,7 +333,7 @@ function BoxLabel(download) { return; } - $cats_q = mysqli_query($conn, "SELECT id,name,description,type FROM IFRACategories ORDER BY id ASC"); + $cats_q = mysqli_query($conn, "SELECT name FROM IFRACategories ORDER BY id ASC"); while($cats_res = mysqli_fetch_array($cats_q)){ $cats[] = $cats_res; From 5043b4101aa9c44968efb086e47bb1d08a76c07f Mon Sep 17 00:00:00 2001 From: John Date: Fri, 2 Apr 2021 14:35:26 +0000 Subject: [PATCH 14/61] Multi-dimensional ingredient lookup in alleregens and re-calculate the usage percentages --- CHANGELOG.md | 2 ++ db/pvault.sql | 1 + db/updates/update_2.7-2.8.sql | 1 + func/calcPerc.php | 41 ++++++++++++++++++++++ pages/genFinishedProduct.php | 12 +++++-- pages/genIFRAcert.php | 66 ++++++++++++++++++++--------------- pages/makeFormula.php | 9 ++++- pages/settings.php | 16 ++++++--- pages/update_settings.php | 10 ++++-- pages/viewFormula.php | 17 +++++++-- releasenotes.md | 2 +- 11 files changed, 134 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 245c0984..e3d2db9e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ Various bug fixes Fix data table in formulas listing Fix a bug preventing CAS number to be shown in batch PDF Label print improvements +Multi-dimensional ingredient lookup in alleregens and re-calculate the usage percentages + ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/db/pvault.sql b/db/pvault.sql index f737b47e..3b51bb07 100755 --- a/db/pvault.sql +++ b/db/pvault.sql @@ -292,6 +292,7 @@ CREATE TABLE `settings` ( `chkVersion` int(11) DEFAULT NULL, `qStep` INT(5) NOT NULL DEFAULT '2', `pubchem_view` VARCHAR(4) NOT NULL DEFAULT '2d', + `multi_dim_perc` INT NOT NULL DEFAULT '0', `defCatClass` VARCHAR(255) NOT NULL DEFAULT 'cat4' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/db/updates/update_2.7-2.8.sql b/db/updates/update_2.7-2.8.sql index db525faf..d0c6858a 100644 --- a/db/updates/update_2.7-2.8.sql +++ b/db/updates/update_2.7-2.8.sql @@ -1 +1,2 @@ ALTER TABLE `formulasMetaData` ADD `isProtected` INT NOT NULL DEFAULT '0' AFTER `image`; +ALTER TABLE `settings` ADD `multi_dim_perc` INT NOT NULL DEFAULT '0' AFTER `pubchem_view`; diff --git a/func/calcPerc.php b/func/calcPerc.php index 60f54b29..2af0d00e 100755 --- a/func/calcPerc.php +++ b/func/calcPerc.php @@ -13,4 +13,45 @@ function calcPerc($formula, $profile, $percent, $conn){ } return; } + +function multi_dim_search($array, $key, $value){ + $results = array(); + + if (is_array($array)) { + if (isset($array[$key]) && $array[$key] == $value) { + $results[] = $array; + } + + foreach ($array as $subarray) { + $results = array_merge($results, multi_dim_search($subarray, $key, $value)); + } + + } + + return $results; +} + +function multi_dim_perc($conn, $form) { + foreach ($form as $formula){ + + $allIngQuery = mysqli_query($conn, "SELECT name,percentage FROM allergens WHERE ing = '".$formula['ingredient']."'"); + + while($allgIng_res = mysqli_fetch_array($allIngQuery)){ + $allgIng[] = $allgIng_res; + } + + foreach ($allgIng as $aa){ + $arrayLength = count($aa); + $i = 0; + while ($i < $arrayLength){ + + $c = multi_dim_search($aa, 'name', $formula['ingredient'])[$i]; + $conc[$formula['ingredient']] += number_format($formula['quantity'] / 100 * $c['percentage'], 3); + + $i++; + } + } + } + return array_unique(array_merge(array_filter($conc))); +} ?> \ No newline at end of file diff --git a/pages/genFinishedProduct.php b/pages/genFinishedProduct.php index 1b860ad4..beedf79e 100644 --- a/pages/genFinishedProduct.php +++ b/pages/genFinishedProduct.php @@ -5,7 +5,9 @@ $meta = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM formulasMetaData WHERE name = '$f_name'")); $formula_q = mysqli_query($conn, "SELECT * FROM formulas WHERE name = '$f_name' ORDER BY ingredient ASC"); - + while ($formula = mysqli_fetch_array($formula_q)){ + $form[] = $formula; + } $mg = mysqli_fetch_assoc(mysqli_query($conn, "SELECT SUM(quantity) AS total_mg FROM formulas WHERE name = '$f_name'")); $bottle = mysqli_real_escape_string($conn, $_POST['bottle']); @@ -153,7 +155,7 @@ function BoxLabel(download) { - @@ -300,7 +306,7 @@ function BoxLabel(download) { - - + +
Formula Name
Category Class:  
Cost
'.$formula['ingredient'].' '.$ing_q['cas'].'
Category 4%%

*Actual use level or maximum use level

@@ -116,37 +123,38 @@ Concentration (%) in finished product: 0" ))){ - $msg = 'None found'; - } - */ - echo '
';
-				
-				$q2 = mysqli_query($conn, "SELECT DISTINCT name,cat4,risk,type,cas FROM IFRALibrary WHERE name LIKE '".$ing['ingredient']."' OR cas = '".$cas['cas']."' GROUP BY name");
-
+		$formula_q = mysqli_query($conn, "SELECT ingredient,quantity,concentration FROM formulas WHERE fid = '$fid'");
+		while ($formula = mysqli_fetch_array($formula_q)){
+				$form[] = $formula;
+		}
+		
+		foreach ($form as $formula){
+			$cas = mysqli_fetch_array(mysqli_query($conn, "SELECT cas FROM ingredients WHERE name = '".$formula['ingredient']."'"));
+			if ($cas['cas']){
+
+				$q2 = mysqli_query($conn, "SELECT DISTINCT name,$defCatClass,risk,type,cas FROM IFRALibrary WHERE name LIKE '".$formula['ingredient']."' OR cas = '".$cas['cas']."' GROUP BY name");
+	
 				while($ifra = mysqli_fetch_array($q2)){
-			
-					$new_quantity = $ing['quantity']/$mg['total_mg']*$new_conc;
+					$new_quantity = $formula['quantity']/$mg['total_mg']*$new_conc;
 					$conc = $new_quantity/$bottle * 100;						
-					$conc_p = number_format($ing['concentration'] / 100 * $conc, 3);
+					$conc_p = number_format($formula['concentration'] / 100 * $conc, 3);
 					
-						echo '
-						'.$ifra['name'].'
-						'.$ifra['cas'].'
-						'.$ifra['risk']."
"; - if($ifra['cat4']){ - echo 'MAX usage: '.$ifra['cat4'].'%'; - } - echo ''.$conc_p.'% - '; + if($settings['multi_dim_perc'] == '1'){ + $conc_p += multi_dim_perc($conn, $form)[$formula['ingredient']]; + } + ?> + + + +
+ + MAX usage: % + + % + + diff --git a/pages/makeFormula.php b/pages/makeFormula.php index d0f2fe37..e4940be0 100644 --- a/pages/makeFormula.php +++ b/pages/makeFormula.php @@ -22,6 +22,9 @@ $formula_q = mysqli_query($conn, "SELECT * FROM makeFormula WHERE fid = '$fid' ORDER BY toAdd DESC"); +while ($formula = mysqli_fetch_array($formula_q)){ + $form[] = $formula; +} $mg = mysqli_fetch_assoc(mysqli_query($conn, "SELECT SUM(quantity) AS total_mg FROM formulas WHERE fid = '$fid'")); $meta = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM formulasMetaData WHERE fid = '$fid'")); @@ -199,7 +202,7 @@ function printLabel() { -
- Currency: + Currency: -   +   Group Formula: @@ -96,6 +96,11 @@ checked="checked" />   + + Multi-dimensional lookup: + checked="checked" /> +   +   @@ -106,8 +111,8 @@ Top notes: - - % + + %   @@ -416,8 +421,9 @@ chem_vs_brand: $("#chem_vs_brand").is(':checked'), pubChem: $("#pubChem").is(':checked'), chkVersion: $("#chkVersion").is(':checked'), + multi_dim_perc: $("#multi_dim_perc").is(':checked'), - }, + }, dataType: 'html', success: function (data) { $('#inMsg').html(data); diff --git a/pages/update_settings.php b/pages/update_settings.php index c64acda6..59ea4b0d 100644 --- a/pages/update_settings.php +++ b/pages/update_settings.php @@ -40,8 +40,14 @@ }else{ $chkVersion = '0'; } - - if(mysqli_query($conn, "UPDATE settings SET currency = '$currency', top_n = '$top_n', heart_n = '$heart_n', base_n = '$base_n', chem_vs_brand = '$chem_vs_brand', grp_formula = '$grp_formula', pubChem='$pubChem', chkVersion='$chkVersion', qStep = '$qStep', defCatClass = '$defCatClass', pubchem_view = '$pubchem_view'")){ + + if($_POST["multi_dim_perc"] == 'true') { + $multi_dim_perc = '1'; + }else{ + $multi_dim_perc = '0'; + } + + if(mysqli_query($conn, "UPDATE settings SET currency = '$currency', top_n = '$top_n', heart_n = '$heart_n', base_n = '$base_n', chem_vs_brand = '$chem_vs_brand', grp_formula = '$grp_formula', pubChem='$pubChem', chkVersion='$chkVersion', qStep = '$qStep', defCatClass = '$defCatClass', pubchem_view = '$pubchem_view', multi_dim_perc = '$multi_dim_perc'")){ echo '
xSettings updated!
'; }else{ echo '
xAn error occured.
'; diff --git a/pages/viewFormula.php b/pages/viewFormula.php index 46fc6fc0..0e119cb4 100644 --- a/pages/viewFormula.php +++ b/pages/viewFormula.php @@ -14,6 +14,11 @@ require_once(__ROOT__.'/func/ml2L.php'); require_once(__ROOT__.'/func/countElement.php'); +if(!$_GET['id']){ + echo 'Formula id is missing.'; + return; +} + $fid = mysqli_real_escape_string($conn, $_GET['id']); $f_name = base64_decode($fid); @@ -23,6 +28,10 @@ } $formula_q = mysqli_query($conn, "SELECT * FROM formulas WHERE fid = '$fid' ORDER BY ingredient ASC"); +while ($formula = mysqli_fetch_array($formula_q)){ + $form[] = $formula; +} + $defCatClass = $settings['defCatClass']; $mg = mysqli_fetch_assoc(mysqli_query($conn, "SELECT SUM(quantity) AS total_mg FROM formulas WHERE fid = '$fid'")); @@ -258,8 +267,8 @@ function addTODO() { - Date: Fri, 2 Apr 2021 17:41:27 +0000 Subject: [PATCH 15/61] Add measurement units --- CHANGELOG.md | 2 +- db/pvault.sql | 3 ++- db/updates/update_2.7-2.8.sql | 1 + func/ml2L.php | 28 ++++++++++++++-------------- pages/genFinishedProduct.php | 13 ++++++------- pages/makeFormula.php | 4 ++-- pages/mgmIngredient.php | 2 +- pages/settings.php | 10 ++++++++++ pages/update_settings.php | 3 ++- pages/viewFormula.php | 4 ++-- releasenotes.md | 1 + 11 files changed, 42 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3d2db9e..f2dca2af 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ Fix data table in formulas listing Fix a bug preventing CAS number to be shown in batch PDF Label print improvements Multi-dimensional ingredient lookup in alleregens and re-calculate the usage percentages - +Add measurement units ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/db/pvault.sql b/db/pvault.sql index 3b51bb07..4275afd1 100755 --- a/db/pvault.sql +++ b/db/pvault.sql @@ -291,7 +291,8 @@ CREATE TABLE `settings` ( `pubChem` int(11) DEFAULT NULL, `chkVersion` int(11) DEFAULT NULL, `qStep` INT(5) NOT NULL DEFAULT '2', - `pubchem_view` VARCHAR(4) NOT NULL DEFAULT '2d', + `pubchem_view` VARCHAR(4) NOT NULL DEFAULT '2d', + `mUnit` VARCHAR(10) NOT NULL DEFAULT 'ml', `multi_dim_perc` INT NOT NULL DEFAULT '0', `defCatClass` VARCHAR(255) NOT NULL DEFAULT 'cat4' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/db/updates/update_2.7-2.8.sql b/db/updates/update_2.7-2.8.sql index d0c6858a..1ad40be3 100644 --- a/db/updates/update_2.7-2.8.sql +++ b/db/updates/update_2.7-2.8.sql @@ -1,2 +1,3 @@ ALTER TABLE `formulasMetaData` ADD `isProtected` INT NOT NULL DEFAULT '0' AFTER `image`; ALTER TABLE `settings` ADD `multi_dim_perc` INT NOT NULL DEFAULT '0' AFTER `pubchem_view`; +ALTER TABLE `settings` ADD `mUnit` VARCHAR(10) NOT NULL DEFAULT 'ml' AFTER `multi_dim_perc`; diff --git a/func/ml2L.php b/func/ml2L.php index ece03e29..a625663d 100644 --- a/func/ml2L.php +++ b/func/ml2L.php @@ -1,15 +1,15 @@ - 1000){ - $conv = number_format($ml/1000, $s) .'L'; - }else{ - $conv = number_format($ml, $s).'ml'; - } - return $conv; - -} - + 1000){ + $conv = number_format($ml/1000, $s) .'L'; + }else{ + $conv = number_format($ml, $s).' '.$mUnit; + } + return $conv; + +} + ?> \ No newline at end of file diff --git a/pages/genFinishedProduct.php b/pages/genFinishedProduct.php index beedf79e..b857fef8 100644 --- a/pages/genFinishedProduct.php +++ b/pages/genFinishedProduct.php @@ -115,7 +115,7 @@ function BoxLabel(download) {

Formula name:
-
Bottle: ml
+
Bottle:
Concentration: %
'.$batchID.''; }else{ echo 'Batch ID: N/A';}?>
Category Class:
@@ -211,7 +211,7 @@ function BoxLabel(download) { Sub Total: - ml + % @@ -221,17 +221,16 @@ function BoxLabel(download) { Carrier/Solvent: - ml + % - - + Bottle: - ml + - @@ -258,7 +257,7 @@ function BoxLabel(download) { Total: - ml + % diff --git a/pages/makeFormula.php b/pages/makeFormula.php index e4940be0..96cb555e 100644 --- a/pages/makeFormula.php +++ b/pages/makeFormula.php @@ -195,7 +195,7 @@ function printLabel() { '; } ?> Ingredient Purity % - Quantity (ml) + Quantity () Concentration* Cost Actions @@ -285,7 +285,7 @@ function printLabel() { '; }?> Total: -

Total:

+

Total:

Total: % Cost: diff --git a/pages/mgmIngredient.php b/pages/mgmIngredient.php index 021e0074..d2bf139e 100755 --- a/pages/mgmIngredient.php +++ b/pages/mgmIngredient.php @@ -405,7 +405,7 @@ function reload_data() { - Size (ml): + Size (): diff --git a/pages/settings.php b/pages/settings.php index 4cd6ff7e..2d828a96 100755 --- a/pages/settings.php +++ b/pages/settings.php @@ -91,6 +91,15 @@   + + Measurement Unit: + +   + Chemical names: checked="checked" /> @@ -422,6 +431,7 @@ pubChem: $("#pubChem").is(':checked'), chkVersion: $("#chkVersion").is(':checked'), multi_dim_perc: $("#multi_dim_perc").is(':checked'), + mUnit: $("#mUnit").val(), }, dataType: 'html', diff --git a/pages/update_settings.php b/pages/update_settings.php index 59ea4b0d..c6ba5495 100644 --- a/pages/update_settings.php +++ b/pages/update_settings.php @@ -16,6 +16,7 @@ $qStep = mysqli_real_escape_string($conn, $_POST['qStep']); $defCatClass = mysqli_real_escape_string($conn, $_POST['defCatClass']); $pubchem_view = mysqli_real_escape_string($conn, $_POST['pubchem_view']); + $mUnit = mysqli_real_escape_string($conn, $_POST['mUnit']); if($_POST["chem_vs_brand"] == 'true') { $chem_vs_brand = '1'; @@ -47,7 +48,7 @@ $multi_dim_perc = '0'; } - if(mysqli_query($conn, "UPDATE settings SET currency = '$currency', top_n = '$top_n', heart_n = '$heart_n', base_n = '$base_n', chem_vs_brand = '$chem_vs_brand', grp_formula = '$grp_formula', pubChem='$pubChem', chkVersion='$chkVersion', qStep = '$qStep', defCatClass = '$defCatClass', pubchem_view = '$pubchem_view', multi_dim_perc = '$multi_dim_perc'")){ + if(mysqli_query($conn, "UPDATE settings SET currency = '$currency', top_n = '$top_n', heart_n = '$heart_n', base_n = '$base_n', chem_vs_brand = '$chem_vs_brand', grp_formula = '$grp_formula', pubChem='$pubChem', chkVersion='$chkVersion', qStep = '$qStep', defCatClass = '$defCatClass', pubchem_view = '$pubchem_view', multi_dim_perc = '$multi_dim_perc', mUnit = '$mUnit'")){ echo '
xSettings updated!
'; }else{ echo '
xAn error occured.
'; diff --git a/pages/viewFormula.php b/pages/viewFormula.php index 0e119cb4..fb8d038f 100644 --- a/pages/viewFormula.php +++ b/pages/viewFormula.php @@ -259,7 +259,7 @@ function addTODO() { CAS # Purity % Dilutant - Quantity (ml) + Quantity () Concentration %* Cost () Properties @@ -353,7 +353,7 @@ function addTODO() { -

Total:

+

Total:

Total: % Cost: diff --git a/releasenotes.md b/releasenotes.md index 740e6bbb..d95834f2 100755 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,4 +1,5 @@ Whats New: ---------------------- We added an option to enable protection in formulas against accidental deletion +Swhitch between ml, liter or fl. oz. EXPERIMENTAL: Multi-dimensional ingredient lookup in alleregens and re-calculate the usage percentages From 12674521a6fc0a0433081e9759282004ce896ee4 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 3 Apr 2021 11:28:25 +0000 Subject: [PATCH 16/61] UI minor improvements --- index.php | 9 +- login.php | 285 ++++++++++++++++++++++-------------------- pages/getFormMeta.php | 52 ++++++-- 3 files changed, 193 insertions(+), 153 deletions(-) diff --git a/index.php b/index.php index 1280a91b..a99fae4a 100755 --- a/index.php +++ b/index.php @@ -50,7 +50,14 @@ - + <?php echo $product;?> - Dashboard diff --git a/login.php b/login.php index 0605deb4..ca225e57 100755 --- a/login.php +++ b/login.php @@ -1,139 +1,146 @@ -Error: Password must be at least 5 characters long!
'; - }else{ - if(mysqli_query($conn,"INSERT INTO users (username,password,fullName,email) VALUES ('$ruser', PASSWORD('$rpass'),'$rfname','$remail')")){ - header('Location: login.php'); - }else{ - $msg = '
Failed to register the user
'; - } - } - -} -if($_POST['username'] && $_POST['password']){ - $_POST['username'] = mysqli_real_escape_string($conn,$_POST['username']); - $_POST['password'] = mysqli_real_escape_string($conn,$_POST['password']); - - $row = mysqli_fetch_assoc(mysqli_query($conn,"SELECT id FROM users WHERE username='{$_POST['username']}' AND password=PASSWORD('".$_POST['password']."')")); - - if($row['id']){ // If everything is OK login - $_SESSION['parfumvault'] = true; - $_SESSION['userID'] = $row['id']; - header('Location: index.php'); - }else{ - $msg = '
Username or password error
'; - } -} - - -?> - - - - - - - - - - - - <?php echo $product;?> - Login - - - - - - - -
-
-
-
-
- -
- -
-
-
-
-

Please register a user!

-
- - -
-
- -
-
- -
-
- -
-
- -
-
- - - - -
-
-
-

Welcome back!

-
- -
-
- -
-
- -
-
- -
- -
-
- -
-
-
-
-
-
-
-
-
- - - +Error: Password must be at least 5 characters long!
'; + }else{ + if(mysqli_query($conn,"INSERT INTO users (username,password,fullName,email) VALUES ('$ruser', PASSWORD('$rpass'),'$rfname','$remail')")){ + header('Location: login.php'); + }else{ + $msg = '
Failed to register the user
'; + } + } + +} +if($_POST['username'] && $_POST['password']){ + $_POST['username'] = mysqli_real_escape_string($conn,$_POST['username']); + $_POST['password'] = mysqli_real_escape_string($conn,$_POST['password']); + + $row = mysqli_fetch_assoc(mysqli_query($conn,"SELECT id FROM users WHERE username='{$_POST['username']}' AND password=PASSWORD('".$_POST['password']."')")); + + if($row['id']){ // If everything is OK login + $_SESSION['parfumvault'] = true; + $_SESSION['userID'] = $row['id']; + header('Location: index.php'); + }else{ + $msg = '
Username or password error
'; + } +} + + +?> + + + + + + + + + + + + <?php echo $product;?> - Login + + + + + + + +
+
+
+
+
+ +
+ +
+
+
+
+

Please register a user!

+
+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + +
+
+
+

Welcome back!

+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+
+
+
+
+
+
+
+
+ + + diff --git a/pages/getFormMeta.php b/pages/getFormMeta.php index 5dec8627..79db2017 100755 --- a/pages/getFormMeta.php +++ b/pages/getFormMeta.php @@ -4,6 +4,7 @@ require_once(__ROOT__.'/inc/config.php'); require_once(__ROOT__.'/inc/opendb.php'); require_once(__ROOT__.'/inc/settings.php'); +require_once(__ROOT__.'/inc/product.php'); if($_GET['id']){ $id = mysqli_real_escape_string($conn, $_GET['id']); @@ -50,20 +51,42 @@ } ?> - - - - - - - - - - - + + + + + + + + + + + <?php echo $product;?> + + + + + + + + + + + + + + + + + - - + @@ -207,3 +231,5 @@ }); }); + + \ No newline at end of file From 045dc0c96f05cbdb59717cae1f8496d950fcba28 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 3 Apr 2021 11:44:48 +0000 Subject: [PATCH 17/61] DB schema typo fi --- db/pvault.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/pvault.sql b/db/pvault.sql index 4275afd1..bb05f0e3 100755 --- a/db/pvault.sql +++ b/db/pvault.sql @@ -89,7 +89,7 @@ CREATE TABLE `formulasMetaData` ( `notes` text COLLATE utf8_bin DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), `image` varchar(255) COLLATE utf8_bin NOT NULL, - `isPrivate` INT NULL DEFAULT '0' + `isProtected` INT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `IFRALibrary`; From 372d2e325290d714238e98f1b59e5c7cb1d95b3f Mon Sep 17 00:00:00 2001 From: John Date: Sat, 3 Apr 2021 12:26:29 +0000 Subject: [PATCH 18/61] Fix a bug preventing to download labels for printing --- pages/manageFormula.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pages/manageFormula.php b/pages/manageFormula.php index c7787fa2..7842a68f 100644 --- a/pages/manageFormula.php +++ b/pages/manageFormula.php @@ -265,6 +265,9 @@ //PRINTING if($_GET['action'] == 'printLabel' && $_GET['name']){ + if (file_exists(__ROOT__.'/tmp/labels/') === FALSE) { + mkdir(__ROOT__.'/tmp/labels/', 0740, true); + } $name = $_GET['name']; if($settings['label_printer_size'] == '62' || $settings['label_printer_size'] == '62 --red'){ @@ -292,7 +295,7 @@ imagefilledrectangle($lbl, 0, 0, $w, $h, $white); $text = trim($name.$extras); - $font = '../fonts/Arial.ttf'; + $font = __ROOT__.'/fonts/Arial.ttf'; imagettftext($lbl, $settings['label_printer_font_size'], 0, 0, 150, $black, $font, $text); $lblF = imagerotate($lbl, 90 ,0); @@ -305,7 +308,7 @@ $extras = ' @'.$_GET['dilution'].'% in '.$_GET['dilutant']; imagettftext($lblF, 40, 90, 200, 600, $black, $font, $extras); } - $save = "../tmp/labels/".base64_encode($text.'png'); + $save = __ROOT__.'/tmp/labels/'.base64_encode($text.'png'); if(imagepng($lblF, $save)){ imagedestroy($lblF); @@ -319,6 +322,10 @@ //PRINT BOX LABEL if($_GET['action'] == 'printBoxLabel' && $_GET['name']){ + if (file_exists(__ROOT__.'/tmp/labels/') === FALSE) { + mkdir(__ROOT__.'/tmp/labels/', 0740, true); + } + if(empty($_GET['copies']) || !is_numeric($_GET['copies'])){ $copies = '1'; }else{ @@ -370,7 +377,7 @@ imagefilledrectangle($lbl, 0, 0, $h, $w, $white); $text = strtoupper($q['product_name']); - $font = '../fonts/Arial.ttf'; + $font = __ROOT__.'/fonts/Arial.ttf'; //font size 15 rotate 0 center 360 top 50 imagettftext($lbl, 30, 0, 250, 50, $black, $font, $text); imagettftext($lbl, 25, 0, 300, 100, $black, $font, 'INGREDIENTS'); @@ -379,12 +386,12 @@ imagettftext($lblF, 20, 0, 50, 150, $black, $font, wordwrap ($allergenFinal, 60)); imagettftext($lblF, 20, 0, 150, 490, $black, $font, wordwrap ($info, 50)); - $save = "../tmp/labels/".base64_encode($text.'png'); + $save = __ROOT__.'/tmp/labels/'.base64_encode($text.'png'); if(imagepng($lblF, $save)){ imagedestroy($lblF); if($_GET['download'] == '1'){ - echo ''; + echo ''; return; } for ($k = 0; $k < $copies; $k++){ From 9fd15896b8974c65a51bd072028ce4e5759561c7 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 5 Apr 2021 09:00:41 +0000 Subject: [PATCH 19/61] Add custom replace function --- func/replace.php | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 func/replace.php diff --git a/func/replace.php b/func/replace.php new file mode 100644 index 00000000..d63ab1f6 --- /dev/null +++ b/func/replace.php @@ -0,0 +1,9 @@ + From a4c0f2527184a004d4fc7b16ae1804445d79ee03 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 5 Apr 2021 15:08:30 +0000 Subject: [PATCH 20/61] typo fix --- pages/listFormulas.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/listFormulas.php b/pages/listFormulas.php index ae6ac77e..caeb132a 100644 --- a/pages/listFormulas.php +++ b/pages/listFormulas.php @@ -152,7 +152,7 @@ - From fea0932e55af6794c3f8840e343b3a70c7ce284e Mon Sep 17 00:00:00 2001 From: John Date: Tue, 6 Apr 2021 10:43:41 +0000 Subject: [PATCH 21/61] Add category image --- CHANGELOG.md | 1 + css/vault.css | 3 ++ db/pvault.sql | 3 +- db/updates/update_2.7-2.8.sql | 1 + pages/editCat.php | 70 +++++++++++++++++++++++++++++++++++ pages/listCat.php | 18 +++++++-- 6 files changed, 91 insertions(+), 5 deletions(-) create mode 100644 pages/editCat.php diff --git a/CHANGELOG.md b/CHANGELOG.md index f2dca2af..54592cf6 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Fix a bug preventing CAS number to be shown in batch PDF Label print improvements Multi-dimensional ingredient lookup in alleregens and re-calculate the usage percentages Add measurement units +Add category image ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/css/vault.css b/css/vault.css index 14a8085c..271b4895 100755 --- a/css/vault.css +++ b/css/vault.css @@ -351,3 +351,6 @@ a:hover{ margin: auto; } +.img_ing { + width:50px; +} diff --git a/db/pvault.sql b/db/pvault.sql index bb05f0e3..6926b3fe 100755 --- a/db/pvault.sql +++ b/db/pvault.sql @@ -140,7 +140,8 @@ DROP TABLE IF EXISTS `ingCategory`; CREATE TABLE `ingCategory` ( `id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8_bin NOT NULL, - `notes` text COLLATE utf8_bin DEFAULT NULL + `notes` text COLLATE utf8_bin DEFAULT NULL, + `image` VARCHAR(255) COLLATE utf8_bin NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `ingProfiles`; diff --git a/db/updates/update_2.7-2.8.sql b/db/updates/update_2.7-2.8.sql index 1ad40be3..981036ac 100644 --- a/db/updates/update_2.7-2.8.sql +++ b/db/updates/update_2.7-2.8.sql @@ -1,3 +1,4 @@ ALTER TABLE `formulasMetaData` ADD `isProtected` INT NOT NULL DEFAULT '0' AFTER `image`; ALTER TABLE `settings` ADD `multi_dim_perc` INT NOT NULL DEFAULT '0' AFTER `pubchem_view`; ALTER TABLE `settings` ADD `mUnit` VARCHAR(10) NOT NULL DEFAULT 'ml' AFTER `multi_dim_perc`; +ALTER TABLE `ingCategory` ADD `image` VARCHAR(255) NULL DEFAULT NULL AFTER `notes`; diff --git a/pages/editCat.php b/pages/editCat.php new file mode 100644 index 00000000..3cf64537 --- /dev/null +++ b/pages/editCat.php @@ -0,0 +1,70 @@ +File upload error: Extension '.$file_ext.' not allowed, please choose a '.$allowed_ext.' file.'; + }elseif($file_size > $max_filesize){ + $msg = '
File upload error: File size must not exceed '.formatBytes($max_filesize).'
'; + }else{ + move_uploaded_file($file_tmp,$path.base64_encode($file_name)); + if(mysqli_query($conn, "UPDATE ingCategory SET image = '".base64_encode($file_name)."' WHERE id = '$id'")){ + $msg = '
File uploaded
'; + } + } +} + +$cat = mysqli_fetch_array(mysqli_query($conn, "SELECT image,name FROM ingCategory WHERE id = '$id'")); + +?> + + + + +
+
 

CSV format: ingrdedient,concentration,dilutant,quantity

+

CSV format: ingredient,concentration,dilutant,quantity

Example: Ambroxan,10,TEC,0.15

+ + + + + + + + + + + + + + + + +
Edit
Image:
Recommended size: 50x50px
+ \ No newline at end of file diff --git a/pages/listCat.php b/pages/listCat.php index 17cc1330..169b6aa3 100644 --- a/pages/listCat.php +++ b/pages/listCat.php @@ -29,17 +29,20 @@ + Image Name Description - Actions + Actions - - \n");?> - + + + \n");?> + + @@ -99,5 +102,12 @@ validate: function(value){ } }); + +$('.popup-link').magnificPopup({ + type: 'iframe', + closeOnContentClick: false, + closeOnBgClick: false, + showCloseBtn: true, +}); \ No newline at end of file From e6befe4130a798b78cfe34b69d6f89314a8c945a Mon Sep 17 00:00:00 2001 From: John Date: Tue, 6 Apr 2021 12:29:16 +0000 Subject: [PATCH 22/61] Add category image --- img/molecule.png | Bin 0 -> 7765 bytes pages/listCat.php | 17 ++++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 img/molecule.png diff --git a/img/molecule.png b/img/molecule.png new file mode 100644 index 0000000000000000000000000000000000000000..9572dea75d792a05c9249640abb3c2f629187eb9 GIT binary patch literal 7765 zcmeHKd05g}_or=aGM8+zu~ec=CquxkBvEt8rCdr#N)TC+Jn7JULO=V?&-Bk0f9jDe0@AOKp>L=2xL30va` zPDGfi%M9lvGzdT^aq-Y3I*q|WCt+Y?xM*;!T}Hs5V=UY_3@pq)27++7#IwsL*IZC2@}|?1U799nMgp8Xe2s`!Q~)O zHYmjV{45HS%j8g)tO+p&=S|GO=piP^pdj)CK`xd2&W#Ubw3J`5gYo-q4M}*`Z!!D( z|1mqA{(&_dt``rC#G9yoV9r|w9BeX+gxEmhFca7Wk{1sQ$Kv-RK}w?jjze0?I~$1v zG?~e!<3V*)IzEPkU@>CGa3*4f_F&SOY=0(^gn`+8MDq3U2x2qIR2oR*Z18r6`g(ad zqMRHZ;kGuYF(7syabtFa%mx6)W+dF(j38fOX1V<sp;QKunaKHkOutslA3QunJQqKq1_ejj z!;y|y6sW@%ZR=5D`=dRXgamEk`+8zvpgtQSm56q5vc;1LWP7+1 zodHG27(a23=S91AducdQ2#naAe#yn8$9hlvPPSQ z=pbqmi5BKb1%2XxJN+&N-cdKbM}3<)W7M&%3|xS^=Aq5^dWlbK89(n#78^QOqG zrg6t-<28py)m9cX4bO-HLkK65$oK>r7v|#bgLOt|ix7?aMtE%YR@xcy0kreG!+|9w zao6FKNo>x0N`p!9A1WQQ2MT>BHYO5)r-R0O_>652Xz)j5E%X=}@#n$D59se<*}?t- z)IWBCHHgKe_S1N;;0hVUoFtcs6Nu z40!+k*`8oRI*~#G&HMenwCa+plgISZC36uOSeJl^o0rqGXBG@%w7iS40+tyyT3Ar*0NwSxqwx ziuWF$Yi4|EbDfDkQ&)Q7JZ19`wv|vbZ4c8F6LQ~pU-q;ScI(02yY4gQg=AH(R3B(M za$dK#w)<|Qb!@*&{aTZf+qX+@1oZ1K|Nh`CH~h}^JBPXnK4jO(?m*#1tL(noCxKU% zmtDC1N!+pJnM=Ip9X@BhAtL*jVMKN&xvqP(vm!iw$B6sjUI-Q=SL0UPqg_j^2V4#4 z8qM@&WZRQ8heO9-2?t@;>$&rCy$Loh* zDqs}+D1P8l^}=vduJGHPO3c&D0sjN8m~UblzaJ%R2H%sapmkWUnKNfbMn?Mh_}JUq z8yXr;ojMiF9hppKWMstUa*;^n{Q2{}y}em178Z-$y?ghZIdgP$bPgOiU}tCN<>dvw z0r`AB3;k$P2GB!322??Q4D1Lr^OO`B2 zOG~S&s?ycfojiH6hlj_)g$t9ClFZD^Dl036LSaiwOKfbcfq}uDJ9lz(b1f|`^Yim> z-MSSN6mC04 z&ehb^z~S)J)YN_Z_AT|gb!gckI4Bdy-4GBw`nP@{n2^h25c*S=&n6B8qJKmCo0Ma% zzW^Ng_G7H&VYP4mf(mvtD(xy87tu>S*Jzguc{S*hjiwI(M@5}>#pXRi3-bVPG~ z{+a%FM58rR^~HkO35nS^m(oogiTtwVr4H*8S5RqpoAIGQ3^U-K(qFrmt+}c)#aq5# z;PffrFRFCCAcxkBXE zsqRdd2*)|a$`_d9D;0=P6AMMaA$qx**Zcay5AyodHOGe7*?#*?_*;51qyvN)KIT!n zan{TuJ|;NjR?YD1{ql}gU%kxIvfvb3`%u5ci}GF{MD}}G<`_BvqQTe#gn@K;w$NW* zZ>lWYF=j@dpetTstx!ZIZuoRP;g&j2R(W=_6HGDehZ9x=o7*VNPt7pEiIl2_<|>0` zgRfN9-f7vs%NE5xR|#2E{i=uHEMOUT&JgfLFv)a(VWMxLWkA* zOSIaLs0J&~4t0xDIj>%&NmAu_Ur^a@S7!Scxuf)B2|;&TkJEJXjc&xH#b&8+eZ3x9 zb2@3|kq;$yJuiqVacTudYjEldetYq#6Nbcj;qR(P9ySF z7ZsR_aw~G2Ebj&Pj{0UfZQgaI!{<1D-Bn>SkT@E@DOdKInfKC-!E zFF&i$S@qS$lRu&r+xN9T-+NG?x2C@PB>lVKi>%@Og5C_VNzAGQ9RX?%;?!k_Gl~j% zeTSPO<5K9;9^OdJXG)-sH=<6CUde0PE|{g{)dAdrnW%*o(cd+1XPhA8DjRWqgXe1p zJKHK1r{rd3jhfy;c^o*cP#l#5Bdw(m&?+gf51;}%Y4W|Y@~1GR)UgjB09DN6SN9}H zx@DNeJsnEN+v@hZkd9u7up=d|hoK?yUonb%U%U$KEthblDiK{XeCQDg$E3H@rL@r0 zO7Z=T9TjID`D3s4idvp4=we!~vQLt@`6a4kpczoAYj{f2D9vMPXT?pNjHg(pIMsQM zIW#M-Q{XRC9ii8D!fS=muNS-2>2x&-OWg};Eu8}c%!iqwtl^wB@<5BJh^-;{G>a9( z&-3S)zG~v9$+MzTM{^v6{52IZo0y)5)|9Bqi@v}Ejp#|$q!`53f8}m(aiXPtu?NcaMRuq zN@c>c<~-HNs`wtg+`X5FvUggvF*Ck(h>0sR2t{0o6#cxTr?_aXw1bvvkWpKhZ5oPE z7jHh?W^OEvcsVx?XfC?h)tsjK_SuyvQU;(m(Ab>R9mO2IX&8`p!=lZ+y))}GjPYgZ zZjQm`3#saK@vzyBuA+RM>lSTME*#)eQSK|mvXsgBF1SY0;RM+>KPyo}#87qTC!y=o zJ%Ng~#zKE!irhq~?2AI3f#Q0ataB|DJ7{$+`R4b{6rajN>MeB12rrN)q~2ln<5A@? zo}ZyeaI$#Kx`+mj!|-yYuOJ$%HFh;s_nPfqd@nN|aAn~1y5&7T2lfE>=*eLrQX z+`xfA=gr`XMmfGx#vfl9(5vQs0%{P1AF^Gfs43f6yM8GMCyjNg*-f*45(4)={w2Mu z{X&=3Y)~UkvXJBs;uRk)TnDORG_j9p4gE*>e=}eMdW@)J^Gwz*LynDF zzFh#9S9ogEOs64BwU(&3@$mDEn{AnNT?2DTr%48VJ8i+SbfB(vUUf6Wrfn(V1QaLj z)-%1yTMekEiD$niXrQ=(!6!PURXlf~xj57&5V-!N9tc0w-&TKiIOS(rs?$Al33gS= zD;mbjP~}9_&_|2boW>lWjWU_@Q>=L=@{!Ak&1MqaFI9p3SI{<#YIUw&x}ge2)a*ph zcDZ-S9S~Yw?^-X@msb>gv4;{0Q%ILwGgO5WH65=gLqW3n@<_2G2vD1;O6a+}D14Hr z9KX@Uv)Bz-A@JF6ATc5GtK_VgDPMzK$jKS$l!R(^#Y5CAfuY=mz1+%7vVo`x!+d^v z?qbEKZ8Oq=L$o67U066qlxKg!_;8zPHLr~(mE72>OxMt5df5u!c*XfMs2mPf1*+iaOiZNEJ=wcN8*`@7Z_**6q64lxfwx z3|zdCV5392Ays6N0ha41Xyb?pg7`GSz-!> wC^KuQ$rM1EE`WdX|Ls5c +
@@ -38,7 +46,7 @@ - + @@ -103,11 +111,6 @@ } }); -$('.popup-link').magnificPopup({ - type: 'iframe', - closeOnContentClick: false, - closeOnBgClick: false, - showCloseBtn: true, -}); + \ No newline at end of file From 6f7333ccc1e12e336f22cd4ecab5f0ed2a45e4c4 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 6 Apr 2021 18:08:26 +0000 Subject: [PATCH 23/61] Add category image --- pages/listCat.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pages/listCat.php b/pages/listCat.php index f8e217a7..075b181b 100644 --- a/pages/listCat.php +++ b/pages/listCat.php @@ -34,13 +34,11 @@
\n");?>
- - - + @@ -49,9 +47,8 @@ - - - + +
Image Name DescriptionActionsActions
\n");?>
 
From 98553361dde2f127c4b26269a6201a17b6a8fea6 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 7 Apr 2021 11:08:17 +0000 Subject: [PATCH 24/61] Notes summary in formula per ingrdient profile --- CHANGELOG.md | 1 + css/vault.css | 13 +++++++ func/arrFilter.php | 16 ++++++++ pages/formula.php | 27 +++++++++++++- pages/viewSummary.php | 86 +++++++++++++++++++++++++++++++++++++++++++ releasenotes.md | 2 + 6 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 func/arrFilter.php create mode 100644 pages/viewSummary.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 54592cf6..2a147d77 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Label print improvements Multi-dimensional ingredient lookup in alleregens and re-calculate the usage percentages Add measurement units Add category image +Notes summary in formula per ingrdient profile ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/css/vault.css b/css/vault.css index 271b4895..4d6e5c14 100755 --- a/css/vault.css +++ b/css/vault.css @@ -354,3 +354,16 @@ a:hover{ .img_ing { width:50px; } + +figure { + display: inline-block; + border: none; + margin: 20px; /* adjust as needed */ +} +figure img { + vertical-align: top; +} +figure figcaption { + border: none; + text-align: center; +} diff --git a/func/arrFilter.php b/func/arrFilter.php new file mode 100644 index 00000000..302ded68 --- /dev/null +++ b/func/arrFilter.php @@ -0,0 +1,16 @@ + diff --git a/pages/formula.php b/pages/formula.php index 3bbeed45..99c54f85 100755 --- a/pages/formula.php +++ b/pages/formula.php @@ -41,6 +41,7 @@
  • Formula
  • Notes Impact
  • Olfactory Pyramid
  • +
  • Notes Summary
  • @@ -111,7 +112,13 @@
    - + +
    +
    +
    +
    +
    +
    @@ -259,5 +266,23 @@ function fetch_impact(){ } }); } + fetch_impact(); + +function fetch_summary(){ +$.ajax({ + url: 'pages/viewSummary.php', + type: 'get', + data: { + id: "" + }, + dataType: 'html', + success: function (data) { + $('#fetch_summary').html(data); + } + }); +} + +fetch_summary(); + diff --git a/pages/viewSummary.php b/pages/viewSummary.php new file mode 100644 index 00000000..a7485ae2 --- /dev/null +++ b/pages/viewSummary.php @@ -0,0 +1,86 @@ +Incomplete formula. Please add ingredients.
    '; + return; +} + +$description = mysqli_fetch_array(mysqli_query($conn, "SELECT notes FROM formulasMetaData WHERE fid = '$fid'")); + +$formula_q = mysqli_query($conn, "SELECT ingredient FROM formulas WHERE fid = '$fid'"); +while ($formula = mysqli_fetch_array($formula_q)){ + $form[] = $formula; +} + + +foreach ($form as $formula){ + $top_ing = mysqli_fetch_array(mysqli_query($conn, "SELECT category FROM ingredients WHERE name = '".$formula['ingredient']."' AND profile = 'Top' AND category IS NOT NULL")); + $heart_ing = mysqli_fetch_array(mysqli_query($conn, "SELECT category FROM ingredients WHERE name = '".$formula['ingredient']."' AND profile = 'Heart' AND category IS NOT NULL")); + $base_ing = mysqli_fetch_array(mysqli_query($conn, "SELECT category FROM ingredients WHERE name = '".$formula['ingredient']."' AND profile = 'Base' AND category IS NOT NULL")); + + $top_cat[] = mysqli_fetch_array(mysqli_query($conn, "SELECT image,name FROM ingCategory WHERE name = '".$top_ing['category']."' AND image IS NOT NULL")); + $heart_cat[] = mysqli_fetch_array(mysqli_query($conn, "SELECT image,name FROM ingCategory WHERE name = '".$heart_ing['category']."' AND image IS NOT NULL")); + $base_cat[] = mysqli_fetch_array(mysqli_query($conn, "SELECT image,name FROM ingCategory WHERE name = '".$base_ing['category']."' AND image IS NOT NULL")); +} +$top_cat = arrFilter(array_filter($top_cat)); +$heart_cat = arrFilter(array_filter($heart_cat)); +$base_cat = arrFilter(array_filter($base_cat)); + + +?> + + + + + + + + + +
    Top Notes
    /> +
    + + + + + + + + + +
    Heart Notes
    /> +
    + + + + + + + + + +
    Base Notes
    /> +
    +

     

    + + + + + + + +
    Description
    diff --git a/releasenotes.md b/releasenotes.md index d95834f2..5cc9b15a 100755 --- a/releasenotes.md +++ b/releasenotes.md @@ -2,4 +2,6 @@ Whats New: ---------------------- We added an option to enable protection in formulas against accidental deletion Swhitch between ml, liter or fl. oz. +Added option to add image in ingredeient categories +Notes summary in formula per ingrdient profile EXPERIMENTAL: Multi-dimensional ingredient lookup in alleregens and re-calculate the usage percentages From c7c2e8f937ece66e72ac395e9b1b13dd165230d9 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 7 Apr 2021 12:18:40 +0000 Subject: [PATCH 25/61] Notes summary in formula per ingrdient profile --- pages/viewSummary.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pages/viewSummary.php b/pages/viewSummary.php index a7485ae2..4d3593da 100644 --- a/pages/viewSummary.php +++ b/pages/viewSummary.php @@ -42,7 +42,7 @@ ?> - + @@ -51,8 +51,11 @@ - + +
    Top Notes
    />
    + + @@ -64,6 +67,8 @@
    Heart Notes
    + + @@ -75,7 +80,9 @@
    Base Notes
    +

     

    + @@ -84,3 +91,4 @@
    Description
    + From ea10c3f1103d7f7792b6985e2020e1a1d85eb684 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 7 Apr 2021 12:40:27 +0000 Subject: [PATCH 26/61] Notes summary in formula per ingrdient profile --- pages/viewSummary.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/viewSummary.php b/pages/viewSummary.php index 4d3593da..637d26de 100644 --- a/pages/viewSummary.php +++ b/pages/viewSummary.php @@ -83,9 +83,9 @@

     

    - +
    - + From d01b0dd8410e49d720bfda82a2f37074ebdefa7a Mon Sep 17 00:00:00 2001 From: John Date: Wed, 7 Apr 2021 15:03:15 +0000 Subject: [PATCH 27/61] Notes summary in formula per ingrdient profile --- pages/viewSummary.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pages/viewSummary.php b/pages/viewSummary.php index 637d26de..e57f0bd2 100644 --- a/pages/viewSummary.php +++ b/pages/viewSummary.php @@ -42,6 +42,8 @@ ?> + +
    DescriptionDescription
    @@ -91,4 +93,13 @@
    - +

    + +

    +

     

    +

     

    +

    To include this page in your web site, copy this line and paste it into your html code

    +

    +<iframe src="https://vault.jbparfum.com/pages/viewSummary.php?id=" title=""></iframe>
    +

    +

     

    From 937e66c696efd40473e5906cc0f1ea3cf1dd05b5 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 7 Apr 2021 15:53:28 +0000 Subject: [PATCH 28/61] Notes summary in formula per ingrdient profile --- pages/viewSummary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/viewSummary.php b/pages/viewSummary.php index e57f0bd2..a8f06c7b 100644 --- a/pages/viewSummary.php +++ b/pages/viewSummary.php @@ -100,6 +100,6 @@

     

    To include this page in your web site, copy this line and paste it into your html code

    -<iframe src="https://vault.jbparfum.com/pages/viewSummary.php?id=" title=""></iframe>
    +<iframe src=":///pages/viewSummary.php?id=" title=""></iframe>
     

     

    From c227e15d50c9e1192c127cd509b7ec526f87596a Mon Sep 17 00:00:00 2001 From: John Date: Wed, 7 Apr 2021 16:20:32 +0000 Subject: [PATCH 29/61] Category lookup by ID --- CHANGELOG.md | 1 + func/getCatByID.php | 9 +++++++++ pages/formula.php | 2 ++ pages/listIngredients.php | 14 ++++++++------ pages/mgmIngredient.php | 2 +- pages/viewSummary.php | 17 +++++++---------- 6 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 func/getCatByID.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a147d77..19e5a2a3 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Multi-dimensional ingredient lookup in alleregens and re-calculate the usage per Add measurement units Add category image Notes summary in formula per ingrdient profile +Category lookup by ID ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/func/getCatByID.php b/func/getCatByID.php new file mode 100644 index 00000000..7d4c2d10 --- /dev/null +++ b/func/getCatByID.php @@ -0,0 +1,9 @@ + diff --git a/pages/formula.php b/pages/formula.php index 99c54f85..d7ac3bb3 100755 --- a/pages/formula.php +++ b/pages/formula.php @@ -116,6 +116,8 @@
    +

    To include this page in your web site, copy this line and paste it into your html code

    +

    <iframe src=":///pages/viewSummary.php?id=" title=""></iframe>

    diff --git a/pages/listIngredients.php b/pages/listIngredients.php index 6a2183fe..9a7650d2 100644 --- a/pages/listIngredients.php +++ b/pages/listIngredients.php @@ -10,6 +10,7 @@ require_once(__ROOT__.'/func/checkAllergen.php'); require_once(__ROOT__.'/func/searchIFRA.php'); +require_once(__ROOT__.'/func/getCatByID.php'); $ingredient_q = mysqli_query($conn, "SELECT * FROM ingredients ORDER BY name ASC"); $defCatClass = $settings['defCatClass']; @@ -59,12 +60,13 @@ echo ''.$ingredient['cas'].''; }else{ echo 'N/A'; - } - echo ' - '.$ingredient['odor'].' - '.$ingredient['profile'].' - '.$ingredient['category'].''; - if($limit = searchIFRA($ingredient['cas'],$ingredient['name'],null,$conn,$defCatClass)){ + }?> + + + + + '.$limit['0'].''; }elseif($ingredient[$defCatClass]){ diff --git a/pages/mgmIngredient.php b/pages/mgmIngredient.php index d2bf139e..42ec522a 100755 --- a/pages/mgmIngredient.php +++ b/pages/mgmIngredient.php @@ -304,7 +304,7 @@ function reload_data() { diff --git a/pages/viewSummary.php b/pages/viewSummary.php index a8f06c7b..367e22ca 100644 --- a/pages/viewSummary.php +++ b/pages/viewSummary.php @@ -1,10 +1,12 @@

     

    -

     

    -

    To include this page in your web site, copy this line and paste it into your html code

    -

    -<iframe src=":///pages/viewSummary.php?id=" title=""></iframe>
    -

    -

     

    + From 4473c8612dd48e6274352af21c5bb79674ab5b62 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 8 Apr 2021 13:30:00 +0000 Subject: [PATCH 30/61] Add category image in ingredients list --- CHANGELOG.md | 1 + css/vault.css | 3 ++- func/getCatByID.php | 19 ++++++++++++++++--- pages/listIngredients.php | 2 +- releasenotes.md | 1 + 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19e5a2a3..e5109e55 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Add measurement units Add category image Notes summary in formula per ingrdient profile Category lookup by ID +Add category image in ingredients list ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/css/vault.css b/css/vault.css index 4d6e5c14..7e264e1b 100755 --- a/css/vault.css +++ b/css/vault.css @@ -352,7 +352,8 @@ a:hover{ } .img_ing { - width:50px; + max-width: 50px; + max-height: 50px; } figure { diff --git a/func/getCatByID.php b/func/getCatByID.php index 7d4c2d10..20d97f5e 100644 --- a/func/getCatByID.php +++ b/func/getCatByID.php @@ -1,9 +1,22 @@
    '; + }else{ + $result = ''.$cat['name'].''; + } + + return $result; } ?> diff --git a/pages/listIngredients.php b/pages/listIngredients.php index 9a7650d2..df80d37b 100644 --- a/pages/listIngredients.php +++ b/pages/listIngredients.php @@ -64,7 +64,7 @@ - + Date: Thu, 8 Apr 2021 15:28:29 +0000 Subject: [PATCH 31/61] Category size fix --- css/vault.css | 3 +-- pages/viewSummary.php | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/css/vault.css b/css/vault.css index 7e264e1b..8a4d0a77 100755 --- a/css/vault.css +++ b/css/vault.css @@ -352,8 +352,7 @@ a:hover{ } .img_ing { - max-width: 50px; - max-height: 50px; + max-height: 40px; } figure { diff --git a/pages/viewSummary.php b/pages/viewSummary.php index 367e22ca..22bdc9ac 100644 --- a/pages/viewSummary.php +++ b/pages/viewSummary.php @@ -53,7 +53,7 @@ -
    /> +
    />
    @@ -66,7 +66,7 @@ -
    /> +
    />
    @@ -79,7 +79,7 @@ -
    /> +
    />
    From e9316c00977484244c4259678af78c68d09d0344 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 8 Apr 2021 18:34:36 +0000 Subject: [PATCH 32/61] Add category icons in ingredient dropdown menu --- css/vault.css | 7 +++++++ pages/mgmIngredient.php | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/css/vault.css b/css/vault.css index 8a4d0a77..1ef273c3 100755 --- a/css/vault.css +++ b/css/vault.css @@ -355,6 +355,12 @@ a:hover{ max-height: 40px; } +.img_ing_sel { + max-height: 30px; + max-width: 30px; + padding: 0 10px 0 0; +} + figure { display: inline-block; border: none; @@ -367,3 +373,4 @@ figure figcaption { border: none; text-align: center; } + diff --git a/pages/mgmIngredient.php b/pages/mgmIngredient.php index 42ec522a..73780e4e 100755 --- a/pages/mgmIngredient.php +++ b/pages/mgmIngredient.php @@ -32,7 +32,7 @@ $res_ingTypes = mysqli_query($conn, "SELECT id,name FROM ingTypes ORDER BY name ASC"); $res_ingStrength = mysqli_query($conn, "SELECT id,name FROM ingStrength ORDER BY name ASC"); -$res_ingCategory = mysqli_query($conn, "SELECT id,name FROM ingCategory ORDER BY name ASC"); +$res_ingCategory = mysqli_query($conn, "SELECT id,image,name,notes FROM ingCategory ORDER BY name ASC"); $res_ingSupplier = mysqli_query($conn, "SELECT id,name FROM ingSuppliers ORDER BY name ASC"); $res_ingProfiles = mysqli_query($conn, "SELECT id,name FROM ingProfiles ORDER BY name ASC"); @@ -75,6 +75,16 @@ max-width: 100%; width: 1000px; } +.dropdown-menu > li > a { + font-weight: 700; + padding: 10px 20px; +} + +.bootstrap-select.btn-group .dropdown-menu li small { + display: block; + padding: 6px 0 0 0; + font-weight: 100; +} diff --git a/pages/update_data.php b/pages/update_data.php index 1a628af4..4abf7216 100755 --- a/pages/update_data.php +++ b/pages/update_data.php @@ -284,6 +284,7 @@ $impact_base = mysqli_real_escape_string($conn, $_POST["impact_base"]); $impact_heart = mysqli_real_escape_string($conn, $_POST["impact_heart"]); $usage_type = mysqli_real_escape_string($conn, $_POST["usage_type"]); + $molecularWeight = mysqli_real_escape_string($conn, $_POST["molecularWeight"]); if($_POST["isAllergen"] == 'true') { $allergen = '1'; @@ -312,7 +313,7 @@ } if(empty($_POST['name'])){ - $query = "UPDATE ingredients SET cas = '$cas', FEMA = '$fema', type = '$type', strength = '$strength', category='$category', supplier='$supplier', supplier_link='$supplier_link', profile='$profile', price='$price', tenacity='$tenacity', chemical_name='$chemical_name', flash_point='$flash_point', appearance='$appearance', notes='$notes', ml='$ml', odor='$odor', purity='$purity', allergen='$allergen', formula='$formula', flavor_use='$flavor_use', cat1 = '$cat1', cat2 = '$cat2', cat3 = '$cat3', cat4 = '$cat4', cat5A = '$cat5A', cat5B = '$cat5B', cat5C = '$cat5C', cat5D = '$cat5D', cat6 = '$cat6', cat7A = '$cat7A', cat7B = '$cat7B', cat8 = '$cat8', cat9 = '$cat9', cat10A = '$cat10A', cat10B = '$cat10B', cat11A = '$cat11A', cat11B = '$cat11B', cat12 = '$cat12', soluble = '$soluble', logp = '$logp', manufacturer = '$manufacturer', impact_top = '$impact_top', impact_heart = '$impact_heart', impact_base = '$impact_base', usage_type = '$usage_type', solvent = '$solvent', INCI = '$INCI', noUsageLimit = '$noUsageLimit', isPrivate = '$isPrivate' WHERE name='$ing'"; + $query = "UPDATE ingredients SET cas = '$cas', FEMA = '$fema', type = '$type', strength = '$strength', category='$category', supplier='$supplier', supplier_link='$supplier_link', profile='$profile', price='$price', tenacity='$tenacity', chemical_name='$chemical_name', flash_point='$flash_point', appearance='$appearance', notes='$notes', ml='$ml', odor='$odor', purity='$purity', allergen='$allergen', formula='$formula', flavor_use='$flavor_use', cat1 = '$cat1', cat2 = '$cat2', cat3 = '$cat3', cat4 = '$cat4', cat5A = '$cat5A', cat5B = '$cat5B', cat5C = '$cat5C', cat5D = '$cat5D', cat6 = '$cat6', cat7A = '$cat7A', cat7B = '$cat7B', cat8 = '$cat8', cat9 = '$cat9', cat10A = '$cat10A', cat10B = '$cat10B', cat11A = '$cat11A', cat11B = '$cat11B', cat12 = '$cat12', soluble = '$soluble', logp = '$logp', manufacturer = '$manufacturer', impact_top = '$impact_top', impact_heart = '$impact_heart', impact_base = '$impact_base', usage_type = '$usage_type', solvent = '$solvent', INCI = '$INCI', noUsageLimit = '$noUsageLimit', isPrivate = '$isPrivate', molecularWeight = '$molecularWeight' WHERE name='$ing'"; if(mysqli_query($conn, $query)){ echo '
    xIngredient '.$ing.' updated!
    '; }else{ diff --git a/releasenotes.md b/releasenotes.md index cbea9f66..1aaff5da 100755 --- a/releasenotes.md +++ b/releasenotes.md @@ -5,4 +5,5 @@ Swhitch between ml, liter or fl. oz. Added option to add image in ingredeient categories Notes summary in formula per ingrdient profile Category image is now shown next to each ingredient, if is set in categories page +Added Molecular Weight for ingredients EXPERIMENTAL: Multi-dimensional ingredient lookup in alleregens and re-calculate the usage percentages From 557c7c4cf46f57b2d639168e686c933f04dd1e5f Mon Sep 17 00:00:00 2001 From: John Date: Tue, 13 Apr 2021 18:00:10 +0000 Subject: [PATCH 40/61] Add Mass for ingredients --- CHANGELOG.md | 1 + pages/pubChem.php | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56036ac8..d7b41724 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Add category image in ingredients list Add pubChem function IFRA certification improvements Add Molecular Weight for ingredients +Add Mass for ingredients ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/pages/pubChem.php b/pages/pubChem.php index 6a801f35..01ee5c3b 100644 --- a/pages/pubChem.php +++ b/pages/pubChem.php @@ -49,7 +49,7 @@
    - + @@ -61,6 +61,14 @@ + + + + + + + + From 1fc39d5b83ca7919f1fad3a8e15574c2a9afc4dc Mon Sep 17 00:00:00 2001 From: John Date: Tue, 13 Apr 2021 18:16:31 +0000 Subject: [PATCH 41/61] linguist fix --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..c1e877aa --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.* linguist-language=PHP From 60a895c182e3b9fb57d9740557fd897b6d760fb1 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 13 Apr 2021 18:18:21 +0000 Subject: [PATCH 42/61] linguist fix --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index c1e877aa..642db914 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -*.* linguist-language=PHP +*.js linguist-detectable=false From 654558bfe40ab6349a8c5339dae6d75d000f5c36 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 14 Apr 2021 08:56:30 +0000 Subject: [PATCH 43/61] Remove legend/share if formula is empty --- CHANGELOG.md | 1 + pages/formula.php | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7b41724..ac9ad50e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Add pubChem function IFRA certification improvements Add Molecular Weight for ingredients Add Mass for ingredients +Remove legend/share if formula is empty ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/pages/formula.php b/pages/formula.php index d7ac3bb3..2320dbc6 100755 --- a/pages/formula.php +++ b/pages/formula.php @@ -7,16 +7,9 @@ echo 'Formula doesn\'t exist'; exit; } -$formula_q = mysqli_query($conn, "SELECT * FROM formulas WHERE name = '$f_name' ORDER BY ingredient ASC"); - - -$mg = mysqli_fetch_assoc(mysqli_query($conn, "SELECT SUM(quantity) AS total_mg FROM formulas WHERE name = '$f_name'")); -$meta = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM formulasMetaData WHERE name = '$f_name'")); - -$top_calc = calcPerc($f_name, 'Top', $settings['top_n'], $conn); -$heart_calc = calcPerc($f_name, 'Heart', $settings['heart_n'], $conn); -$base_calc = calcPerc($f_name, 'Base', $settings['base_n'], $conn); - +if(mysqli_num_rows(mysqli_query($conn, "SELECT fid FROM formulas WHERE fid = '$fid'"))){ + $legend = 1; +} ?> +
    Molecular Formula:
    Canonical Smiles:
    Mass:
      
     
    @@ -87,13 +93,10 @@

     

    - + - - - - +
    Description
    From 77505c7d100a860b55c36216e6a3b7cfd4fc5bd2 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Apr 2021 11:22:23 +0000 Subject: [PATCH 48/61] UI minor improvements --- pages/listIngredients.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/listIngredients.php b/pages/listIngredients.php index df80d37b..a859b2da 100644 --- a/pages/listIngredients.php +++ b/pages/listIngredients.php @@ -39,11 +39,11 @@ Name INCI - CAS # + CAS# Odor Profile Category - % + % Supplier SDS TGSC From f6165a85192ffc257bbe47ed16db3bf03066c2aa Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Apr 2021 11:31:02 +0000 Subject: [PATCH 49/61] Recover deleted file --- func/replace.php | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 func/replace.php diff --git a/func/replace.php b/func/replace.php new file mode 100644 index 00000000..d63ab1f6 --- /dev/null +++ b/func/replace.php @@ -0,0 +1,9 @@ + From e88fdaff6860d0710c5ead511c4b3a3e4e2f2978 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 22 Apr 2021 12:50:54 +0000 Subject: [PATCH 50/61] Add update instructions link / Typo fix --- CHANGELOG.md | 1 + func/checkVer.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac9ad50e..004380f8 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ IFRA certification improvements Add Molecular Weight for ingredients Add Mass for ingredients Remove legend/share if formula is empty +Add update instructions link ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/func/checkVer.php b/func/checkVer.php index 3513c6cc..4d64fee1 100755 --- a/func/checkVer.php +++ b/func/checkVer.php @@ -5,10 +5,11 @@ function checkVer($app_ver) { if($app_ver){ $githubVer = 'https://github.com/raw/globaldyne/parfumvault/master/VERSION.md'; $gitHubRep = 'https://www.jbparfum.com/features/'; + $docUrl = 'https://www.jbparfum.com/knowledge-base/how-to-update-pv-to-its-latest-version/'; $data = trim(pv_file_get_contents($githubVer)); if($app_ver < $data){ - echo '
    xNew version ('.$data.') is availale!
    '; + echo '
    xNew version ('.$data.') is availale! Please refer here for update instructions.
    '; } } From 5e7342781d6b509557218636059ef853f22ef889 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 23 Apr 2021 11:23:13 +0000 Subject: [PATCH 51/61] Add auto update option when non docker image / IFRA Typo fix --- CHANGELOG.md | 1 + func/checkVer.php | 13 +++++++---- func/pvCopy.php | 33 ++++++++++++++++++++++++++++ index.php | 2 ++ pages/IFRA.php | 2 +- pages/UpgradeCore.php | 50 +++++++++++++++++++++++++++++++++++++++++++ pages/top.php | 2 +- 7 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 func/pvCopy.php create mode 100644 pages/UpgradeCore.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 004380f8..c3cffe1e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Add Molecular Weight for ingredients Add Mass for ingredients Remove legend/share if formula is empty Add update instructions link +Add auto-update function when non docker ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/func/checkVer.php b/func/checkVer.php index 4d64fee1..aa116862 100755 --- a/func/checkVer.php +++ b/func/checkVer.php @@ -4,14 +4,19 @@ function checkVer($app_ver) { if($app_ver){ $githubVer = 'https://github.com/raw/globaldyne/parfumvault/master/VERSION.md'; - $gitHubRep = 'https://www.jbparfum.com/features/'; $docUrl = 'https://www.jbparfum.com/knowledge-base/how-to-update-pv-to-its-latest-version/'; - $data = trim(pv_file_get_contents($githubVer)); - if($app_ver < $data){ - echo '
    xNew version ('.$data.') is availale! Please refer here for update instructions.
    '; + $gitHubRep = 'https://github.com/globaldyne/parfumvault/archive/refs/tags/v'.$data.'.zip'; + + if($app_ver < $data){ + if(file_exists('.DOCKER') == TRUE){ + $r = '
    xNew version ('.$data.') is availale! Please refer here for update instructions.
    '; + }else{ + $r = ''; + } } } + return $r; } ?> diff --git a/func/pvCopy.php b/func/pvCopy.php new file mode 100644 index 00000000..355baa2e --- /dev/null +++ b/func/pvCopy.php @@ -0,0 +1,33 @@ + diff --git a/index.php b/index.php index a99fae4a..e664e104 100755 --- a/index.php +++ b/index.php @@ -330,6 +330,8 @@ function list_cat(){ require_once(__ROOT__.'/pages/sellFormula.php'); }elseif($_GET['do'] == 'customers'){ require_once(__ROOT__.'/pages/customers.php'); + }elseif($_GET['do'] == 'UpgradeCore'){ + require_once(__ROOT__.'/pages/UpgradeCore.php'); }else{ require_once(__ROOT__.'/pages/dashboard.php'); diff --git a/pages/IFRA.php b/pages/IFRA.php index 0df1a4a3..6388c10e 100755 --- a/pages/IFRA.php +++ b/pages/IFRA.php @@ -72,7 +72,7 @@ + + +
    diff --git a/pages/listFormulas.php b/pages/listFormulas.php index caeb132a..7d2a6e86 100644 --- a/pages/listFormulas.php +++ b/pages/listFormulas.php @@ -34,8 +34,7 @@ if(mysqli_num_rows(mysqli_query($conn, "SELECT id FROM ingredients"))== 0){ echo '
    INFO: no ingredients yet, click here to add.
    '; }elseif(mysqli_num_rows(mysqli_query($conn, "SELECT id FROM formulasMetaData"))== 0){ - echo '
    INFO: no formulas yet, click here to add.
    '; - + echo '
    INFO: no formulas yet, click here to add.
    '; }else{ ?>
    From 90d6da256502cbec075f7c1f7ea9eaa7316a62d6 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 23 Apr 2021 11:51:25 +0000 Subject: [PATCH 53/61] Release notes update --- releasenotes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/releasenotes.md b/releasenotes.md index 1aaff5da..44906087 100755 --- a/releasenotes.md +++ b/releasenotes.md @@ -6,4 +6,5 @@ Added option to add image in ingredeient categories Notes summary in formula per ingrdient profile Category image is now shown next to each ingredient, if is set in categories page Added Molecular Weight for ingredients +Auto update function when non-docker EXPERIMENTAL: Multi-dimensional ingredient lookup in alleregens and re-calculate the usage percentages From 1bc438841f648952234a1aaaae1cf5adfae15aea Mon Sep 17 00:00:00 2001 From: John Date: Fri, 23 Apr 2021 13:45:39 +0000 Subject: [PATCH 54/61] Moving ingredients list from index.php --- index.php | 2 +- pages/ingredients.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index e664e104..01c354e4 100755 --- a/index.php +++ b/index.php @@ -114,7 +114,7 @@ }); list_formulas(); - list_ingredients(); + //list_ingredients(); }); diff --git a/pages/ingredients.php b/pages/ingredients.php index afa75e64..faed4388 100755 --- a/pages/ingredients.php +++ b/pages/ingredients.php @@ -137,7 +137,7 @@
    \ No newline at end of file diff --git a/pages/update_data.php b/pages/update_data.php index 4abf7216..a5a85fa5 100755 --- a/pages/update_data.php +++ b/pages/update_data.php @@ -43,6 +43,18 @@ return; } +if($_GET['formula'] && $_GET['defView']){ + $fid = mysqli_real_escape_string($conn, $_GET['formula']); + $defView = mysqli_real_escape_string($conn, $_GET['defView']); + + if(mysqli_query($conn, "UPDATE formulasMetaData SET defView = '$defView' WHERE fid = '$fid'")){ + echo '
    xDefault formula view changed!
    '; + }else{ + echo '
    xSomething went wrong.
    '; + } + return; +} + if($_GET['rename']){ $value = mysqli_real_escape_string($conn, $_POST['value']); $formula = mysqli_real_escape_string($conn, $_GET['rename']); diff --git a/pages/viewFormula.php b/pages/viewFormula.php index c5f7da3b..c2d167f0 100644 --- a/pages/viewFormula.php +++ b/pages/viewFormula.php @@ -262,7 +262,11 @@ function addTODO() { Quantity () Concentration %* Cost () + Properties + + Notes + Actions @@ -332,8 +336,12 @@ function addTODO() { > + -     + + + +     ", + title: 'Notes', + type: "POST", + dataType: 'json', + success: function(response, newValue) { + if(response.status == 'error'){ + return response.msg; + }else{ + fetch_formula(); + } + }, +}); + $('#formula_data').editable({ container: 'body', selector: 'td.dilutant', diff --git a/releasenotes.md b/releasenotes.md index 44906087..db496913 100755 --- a/releasenotes.md +++ b/releasenotes.md @@ -7,4 +7,5 @@ Notes summary in formula per ingrdient profile Category image is now shown next to each ingredient, if is set in categories page Added Molecular Weight for ingredients Auto update function when non-docker +Add option for notes per ingredient in formula EXPERIMENTAL: Multi-dimensional ingredient lookup in alleregens and re-calculate the usage percentages From 8cd552f398802302d0441d6503dedcf190d0909e Mon Sep 17 00:00:00 2001 From: John Date: Sat, 24 Apr 2021 18:11:17 +0000 Subject: [PATCH 56/61] Install process update --- install.php | 284 ++++++++++++++++++++++++++-------------------------- login.php | 2 +- 2 files changed, 143 insertions(+), 143 deletions(-) diff --git a/install.php b/install.php index 782fd7a3..22fc8793 100755 --- a/install.php +++ b/install.php @@ -1,142 +1,142 @@ - -Error: Password must be at least 5 chars long!'; - }else{ - if($_POST['dbhost'] && $_POST['dbuser'] && $_POST['dbpass'] && $_POST['dbname'] && $_POST['username'] && $_POST['password'] && $_POST['fullName'] && $_POST['email']){ - - if(!$link = mysqli_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname'])){ - $msg = '
    Error connecting to the database, make sure the details provided are correct. Make sure the database exists and the user has the write permissions.
    '; - }else{ - $cmd = "mysql -u$_POST[dbuser] -p$_POST[dbpass] -h$_POST[dbhost] $_POST[dbname] < ./db/pvault.sql"; - passthru($cmd,$e); - if(!$e){ - mysqli_query($link,"INSERT INTO users (username,password,fullName,email) VALUES ('$_POST[username]',PASSWORD('$_POST[password]'),'$_POST[fullName]','$_POST[email]')"); - - $conf = ' -'; - if(file_exists('.DOCKER') == TRUE){ - $cfg = '/config/config.php'; - }else{ - $cfg = 'inc/config.php'; - } - - if(file_put_contents($cfg, $conf) == FALSE){ - $msg = '
    Error: failed to create config file! Make sure your web server has write permissions to the install directory.
    '; - }else{ - if(file_exists('.DOCKER') == TRUE){ - symlink($cfg, 'inc/config.php'); - } - $msg = '
    System configured!
    '; - header('location: login.php'); - } - - }else{ - $msg = '
    Error: failed to create user! '.mysqli_error($link).'
    '; - } - } - - - - }else{ - $msg = '
    Error: all fields required!
    '; - }//FIELDS VALIDATION - }//PASS CHECK -}//SAVE -?> - - - - - - - - - - - <?php echo $product;?> - First time setup! - - - - - - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -

    First time setup

    -
    - -
    - Database Settings: -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - User Settings: -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    - -

     

    -

    *All fields required

    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - + +Error: Password must be at least 5 chars long!'; + }else{ + if($_POST['dbhost'] && $_POST['dbuser'] && $_POST['dbpass'] && $_POST['dbname'] && $_POST['username'] && $_POST['password'] && $_POST['fullName'] && $_POST['email']){ + + if(!$link = mysqli_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname'])){ + $msg = '
    Error connecting to the database, make sure the details provided are correct. Make sure the database exists and the user has the write permissions.
    '; + }else{ + $cmd = 'mysql -u'.$_POST['dbuser'].' -p'.$_POST['dbpass'].' -h'.$_POST['dbhost'].' '.$_POST['dbname'].' < ./db/pvault.sql'; + passthru($cmd,$e); + if(!$e){ + mysqli_query($link,"INSERT INTO users (username,password,fullName,email) VALUES ('".$_POST['username']."',PASSWORD('".$_POST['password']."'),'".$_POST['fullName']."','".$_POST['email']."')"); + + $conf = ' +'; + if(file_exists('.DOCKER') == TRUE){ + $cfg = '/config/config.php'; + }else{ + $cfg = 'inc/config.php'; + } + + if(file_put_contents($cfg, $conf) == FALSE){ + $msg = '
    Error: failed to create config file! Make sure your web server has write permissions to the install directory.
    '; + }else{ + if(file_exists('.DOCKER') == TRUE){ + symlink($cfg, 'inc/config.php'); + } + $msg = '
    System configured!
    '; + header('location: login.php'); + } + + }else{ + $msg = '
    Error: failed to create user! '.mysqli_error($link).'
    '; + } + } + + + + }else{ + $msg = '
    Error: all fields required!
    '; + }//FIELDS VALIDATION + }//PASS CHECK +}//SAVE +?> + + + + + + + + + + + <?php echo $product;?> - First time setup! + + + + + + + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    First time setup

    +
    + +
    + Database Settings: +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + User Settings: +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + +

     

    +

    *All fields required

    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git a/login.php b/login.php index ca225e57..77d00495 100755 --- a/login.php +++ b/login.php @@ -35,7 +35,7 @@ $_POST['username'] = mysqli_real_escape_string($conn,$_POST['username']); $_POST['password'] = mysqli_real_escape_string($conn,$_POST['password']); - $row = mysqli_fetch_assoc(mysqli_query($conn,"SELECT id FROM users WHERE username='{$_POST['username']}' AND password=PASSWORD('".$_POST['password']."')")); + $row = mysqli_fetch_assoc(mysqli_query($conn,"SELECT id FROM users WHERE username='".$_POST['username']."' AND password=PASSWORD('".$_POST['password']."')")); if($row['id']){ // If everything is OK login $_SESSION['parfumvault'] = true; From 8f0a8ab5a2f871d3fbec6860ee43f551f9e60fb6 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 25 Apr 2021 09:53:45 +0000 Subject: [PATCH 57/61] Making username case insensitive --- CHANGELOG.md | 1 + install.php | 2 +- login.php | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5022883c..a8b71b48 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Remove legend/share if formula is empty Add update instructions link Add auto-update function when non docker Add option for notes per ingredient in formula +Making username case insensitive ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/install.php b/install.php index 22fc8793..dffefd15 100755 --- a/install.php +++ b/install.php @@ -13,7 +13,7 @@ $cmd = 'mysql -u'.$_POST['dbuser'].' -p'.$_POST['dbpass'].' -h'.$_POST['dbhost'].' '.$_POST['dbname'].' < ./db/pvault.sql'; passthru($cmd,$e); if(!$e){ - mysqli_query($link,"INSERT INTO users (username,password,fullName,email) VALUES ('".$_POST['username']."',PASSWORD('".$_POST['password']."'),'".$_POST['fullName']."','".$_POST['email']."')"); + mysqli_query($link,"INSERT INTO users (username,password,fullName,email) VALUES ('"strtolower(.$_POST['username'])."',PASSWORD('".$_POST['password']."'),'".$_POST['fullName']."','".$_POST['email']."')"); $conf = ' Date: Mon, 26 Apr 2021 16:48:25 +0000 Subject: [PATCH 58/61] Making ingredient name case insensitive --- CHANGELOG.md | 1 + db/pvault.sql | 2 +- db/updates/update_2.7-2.8.sql | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8b71b48..bd221214 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Add update instructions link Add auto-update function when non docker Add option for notes per ingredient in formula Making username case insensitive +Making ingredient name case insensitive ### Version 2.7 Making sure the percentage symbol is striped out from allergens quantity diff --git a/db/pvault.sql b/db/pvault.sql index a0c53da1..d33bf466 100755 --- a/db/pvault.sql +++ b/db/pvault.sql @@ -161,7 +161,7 @@ INSERT INTO `ingProfiles` (`id`, `name`, `notes`) VALUES DROP TABLE IF EXISTS `ingredients`; CREATE TABLE `ingredients` ( `id` int(11) NOT NULL, - `name` varchar(255) COLLATE utf8_bin NOT NULL, + `name` varchar(255) COLLATE utf8_general_ci NOT NULL, `INCI` varchar(255) COLLATE utf8_bin DEFAULT NULL, `type` varchar(255) COLLATE utf8_bin DEFAULT NULL, `strength` varchar(255) COLLATE utf8_bin DEFAULT NULL, diff --git a/db/updates/update_2.7-2.8.sql b/db/updates/update_2.7-2.8.sql index 498d439c..aa25b00b 100644 --- a/db/updates/update_2.7-2.8.sql +++ b/db/updates/update_2.7-2.8.sql @@ -5,3 +5,4 @@ ALTER TABLE `ingCategory` ADD `image` LONGTEXT NULL AFTER `notes`; ALTER TABLE `ingredients` ADD `molecularWeight` VARCHAR(255) NULL AFTER `isPrivate`; ALTER TABLE `formulas` ADD `notes` VARCHAR(255) NULL AFTER `quantity`; ALTER TABLE `formulasMetaData` ADD `defView` INT NOT NULL DEFAULT '1' COMMENT '1 = Ingredient properties, 2 = Notes' AFTER `isProtected`; +ALTER TABLE `ingredients` CHANGE `name` `name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; From b146f66c5faded3488a2d59cb5e45bdc9319de40 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 26 Apr 2021 16:53:32 +0000 Subject: [PATCH 59/61] INSTALL.txt update --- INSTALL.txt | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/INSTALL.txt b/INSTALL.txt index 1fa938c6..28cfe746 100755 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,18 +1,21 @@ -LINUX ------------- - -****Assuming you already have a working php/mysql system configured. - - -Copy/clone the repo under your web server's home dir (eg. /var/www/) -*Highly recomended to create a vhost - -Create a new db eg. pvault and import the schema located under db/ folder - -Edit inc/config.php and update it with your db details -*Higly recomended to create a new user with permissions only to the pvault db. - - -To Enable label printing support, additional software is required: - -https://github.com/pklaus/brother_ql \ No newline at end of file +LINUX +------------ + +****Assuming you already have a working php/mysql system configured. + + +Download or clone the repo under your web server's home dir (eg. /var/www/) +*Highly recomended to create a vhost + +Create a new db eg. pvault and a user with admin rights to it + +Open your web browser to you server's url and follow the instruction on the installation wizard. + +For more info please refer to: + + https://www.jbparfum.com/knowledge-base/ + + +To Enable label printing support, additional software is required: + + https://github.com/pklaus/brother_ql \ No newline at end of file From 8272d55ec98133c48972a454db3351f5947fa259 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 27 Apr 2021 15:12:48 +0000 Subject: [PATCH 60/61] Performance update in formula calculations --- pages/genFinishedProduct.php | 8 ++-- pages/makeFormula.php | 82 +++++++++--------------------------- pages/viewFormula.php | 10 ++--- 3 files changed, 28 insertions(+), 72 deletions(-) diff --git a/pages/genFinishedProduct.php b/pages/genFinishedProduct.php index b857fef8..6387fb61 100644 --- a/pages/genFinishedProduct.php +++ b/pages/genFinishedProduct.php @@ -158,9 +158,7 @@ function BoxLabel(download) { '.$formula['dilutant'].''; } - if($limit != null){ - if($limit < $conc_p){ + if($limit['0'] != null){ + if($limit['0'] < $conc_p){ $IFRA_WARN = 'class="alert-danger"';//VALUE IS TO HIGH AGAINST IFRA }else{ $IFRA_WARN = 'class="alert-success"'; //VALUE IS OK diff --git a/pages/makeFormula.php b/pages/makeFormula.php index 96cb555e..8afeec06 100644 --- a/pages/makeFormula.php +++ b/pages/makeFormula.php @@ -44,10 +44,7 @@ - - - - + @@ -123,44 +120,6 @@ function printLabel() { }; - -$(document).ready(function() { - var groupColumn = 0; - var table = $('#formula').DataTable({ - "columnDefs": [ - { "visible": false, "targets": groupColumn } - ], - "order": [[ groupColumn, 'desc' ]], - "paging": false, - "info": false, - "drawCallback": function ( settings ) { - var api = this.api(); - var rows = api.rows( {page:'current'} ).nodes(); - var last=null; - - api.column(groupColumn, {page:'current'} ).data().each( function ( group, i ) { - if ( last !== group ) { - $(rows).eq( i ).before( - ''+group+' Notes' - ); - - last = group; - } - } ); - } - } ); - - // Order by the grouping - $('#formula tbody').on( 'click', 'tr.group', function () { - var currentOrder = table.order()[0]; - if ( currentOrder[0] === groupColumn && currentOrder[1] === 'asc' ) { - table.order( [ groupColumn, 'desc' ] ).draw(); - } - else { - table.order( [ groupColumn, 'asc' ] ).draw(); - } - } ); -} ); @@ -205,9 +164,7 @@ function printLabel() { '.$ing_q['profile'].''; } } - echo ''.$ingName.' '.checkIng($formula['ingredient'],$defCatClass,$conn).''; - echo ''.$formula['concentration'].''; - - if($limit != null){ - if($limit < $conc_p){ + ?> + + + '.$formula['quantity'].''; - echo ''.$conc_p.'%'; - echo ''.utf8_encode($settings['currency']).calcCosts($ing_q['price'],$formula['quantity'], $formula['concentration'], $ing_q['ml']).''; - echo ''; - + ?> + + >% + + + '; } - - echo '   '; - echo ''; - echo ''; - $tot[] = calcCosts($ing_q['price'],$formula['quantity'], $formula['concentration'], $ing_q['ml']); + ?> +     + + + + diff --git a/pages/viewFormula.php b/pages/viewFormula.php index c2d167f0..aafb9308 100644 --- a/pages/viewFormula.php +++ b/pages/viewFormula.php @@ -274,10 +274,8 @@ function addTODO() { Date: Tue, 27 Apr 2021 15:13:36 +0000 Subject: [PATCH 61/61] Fix sql query in MakeFormula --- pages/makeFormula.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/makeFormula.php b/pages/makeFormula.php index 8afeec06..00f67255 100644 --- a/pages/makeFormula.php +++ b/pages/makeFormula.php @@ -25,7 +25,7 @@ while ($formula = mysqli_fetch_array($formula_q)){ $form[] = $formula; } -$mg = mysqli_fetch_assoc(mysqli_query($conn, "SELECT SUM(quantity) AS total_mg FROM formulas WHERE fid = '$fid'")); +$mg = mysqli_fetch_assoc(mysqli_query($conn, "SELECT SUM(quantity) AS total_mg FROM makeFormula WHERE fid = '$fid'")); $meta = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM formulasMetaData WHERE fid = '$fid'")); $settings['grp_formula'] = '0';