From 7afef0fcc4d84fab7c1313016d81bb74bb1ea277 Mon Sep 17 00:00:00 2001 From: JB Date: Sat, 5 Oct 2024 12:08:06 +0100 Subject: [PATCH 1/9] [9eef1c5] - v11.7 --- CHANGELOG.md | 5 +---- VERSION.md | 2 +- db/schema.ver | 2 +- releasenotes.md | 4 +--- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c7ce271..6eeeaf43 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,5 @@ # CHANGELOG -### Version 11.6 -- Fix a bug incorrectly marking materials as banned in a formula -- Fix a typo in db schema creation for new installations -- Minor updates in sys-upgrade +### Version 11.7 ### Version 11.5 - Fix revisions comparison diff --git a/VERSION.md b/VERSION.md index 1ed6da4f..37659925 100755 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -11.6 +11.7 diff --git a/db/schema.ver b/db/schema.ver index 1ed6da4f..37659925 100644 --- a/db/schema.ver +++ b/db/schema.ver @@ -1 +1 @@ -11.6 +11.7 diff --git a/releasenotes.md b/releasenotes.md index d82e651c..fa608677 100755 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,5 +1,3 @@ -Whats New in v11.6 +Whats New in v11.7 -------------------------- -- Fix a bug incorrectly marking materials as banned in a formula -- Fix a bug preventing db creation for new installations - This release may include more changes, for full details please refer to the CHANGELOG From 4460be0c77bde89dfc7f2e9180e345bcccadde00 Mon Sep 17 00:00:00 2001 From: JB Date: Fri, 11 Oct 2024 20:23:47 +0100 Subject: [PATCH 2/9] [7afef0f] - Make sure empty formula returns array for meta data --- CHANGELOG.md | 2 ++ core/full_formula_data.php | 1 + pages/views/formula/viewFormula.php | 46 ++++++++++++++++++------ pages/views/ingredients/compos.php | 2 +- pages/views/ingredients/ingDocuments.php | 2 +- pages/views/ingredients/ingSuppliers.php | 2 +- pages/views/ingredients/synonyms.php | 2 +- 7 files changed, 43 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6eeeaf43..28cee582 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # CHANGELOG ### Version 11.7 +- Make sure empty formula returns array for meta data +- Set scroll collapse for datatbales in ingredients to false ### Version 11.5 - Fix revisions comparison diff --git a/core/full_formula_data.php b/core/full_formula_data.php index 6f31d715..a55095e7 100644 --- a/core/full_formula_data.php +++ b/core/full_formula_data.php @@ -274,6 +274,7 @@ if(empty($r)){ $response['data'] = []; + $response['meta'] = []; echo json_encode($response); return; } diff --git a/pages/views/formula/viewFormula.php b/pages/views/formula/viewFormula.php index 3d88ae5b..d3dd4488 100644 --- a/pages/views/formula/viewFormula.php +++ b/pages/views/formula/viewFormula.php @@ -172,16 +172,42 @@ }, footerCallback : function( tfoot, data, start, end, display ) { - var response = this.api().ajax.json(); - if(response){ - var $td = $(tfoot).find('th'); - $td.eq(0).html("Ingredients: " + response.meta['total_ingredients'] ); - $td.eq(4).html("Total: " + response.meta['total_quantity']);// + response.meta['quantity_unit'] ); - $td.eq(5).html("Total: " + response.meta['concentration'] + "%" ); - $td.eq(7).html("Total: " + response.meta['currency'] + response.meta['total_cost'] + ''); - $(formula_table.columns(7).header()).html("Final Concentration " + response.meta['product_concentration'] + "%"); - $('#max_usage').html('Max usage: ' + response.meta['max_usage'] + '% '); - } + var response = this.api().ajax.json(); + + if (response && response.meta) { + var $tfoot = $(tfoot); + if ($tfoot.length > 0) { + var $td = $tfoot.find('th'); + + // Update "Ingredients" + if ($td.eq(0)) { + $td.eq(0).html("Ingredients: " + (response.meta.total_ingredients || 0)); + } + // Update "Total Quantity" + if ($td.eq(4)) { + $td.eq(4).html("Total: " + (response.meta.total_quantity || 0)); + } + // Update "Total Concentration" + if ($td.eq(5)) { + $td.eq(5).html("Total: " + (response.meta.concentration || 0) + "%"); + } + // Update "Total Cost" + if ($td.eq(7)) { + $td.eq(7).html("Total: " + (response.meta.currency || '') + (response.meta.total_cost || 0) + + '' + ); + } + // Update table column header + if (formula_table && formula_table.columns(7).header()) { + $(formula_table.columns(7).header()).html("Final Concentration " + (response.meta.product_concentration || 0) + "%"); + } + // Update "Max Usage" + $('#max_usage').html('Max usage: ' + (response.meta.max_usage || 0) + '% ' + + '' + ); + } + } + }, order: [[ groupColumn, 'desc' ]], diff --git a/pages/views/ingredients/compos.php b/pages/views/ingredients/compos.php index f5d0ef71..fa08f4b1 100644 --- a/pages/views/ingredients/compos.php +++ b/pages/views/ingredients/compos.php @@ -93,7 +93,7 @@ lengthMenu: [[20, 50, 100, -1], [20, 50, 100, "All"]], pageLength: 20, displayLength: 20, - scrollCollapse: true, + scrollCollapse: false, scrollY: '500px' }); diff --git a/pages/views/ingredients/ingDocuments.php b/pages/views/ingredients/ingDocuments.php index 4fd3796b..a048257e 100644 --- a/pages/views/ingredients/ingDocuments.php +++ b/pages/views/ingredients/ingDocuments.php @@ -63,7 +63,7 @@ lengthMenu: [[20, 50, 100, -1], [20, 50, 100, "All"]], pageLength: 20, displayLength: 20, - scrollCollapse: true, + scrollCollapse: false, scrollY: '500px' }); diff --git a/pages/views/ingredients/ingSuppliers.php b/pages/views/ingredients/ingSuppliers.php index 97a739cc..584628ac 100644 --- a/pages/views/ingredients/ingSuppliers.php +++ b/pages/views/ingredients/ingSuppliers.php @@ -129,7 +129,7 @@ lengthMenu: [[20, 50, 100, -1], [20, 50, 100, "All"]], pageLength: 20, displayLength: 20, - scrollCollapse: true, + scrollCollapse: false, scrollY: '500px', stateSave: true, stateDuration : -1, diff --git a/pages/views/ingredients/synonyms.php b/pages/views/ingredients/synonyms.php index e3238cba..924ccd53 100644 --- a/pages/views/ingredients/synonyms.php +++ b/pages/views/ingredients/synonyms.php @@ -66,7 +66,7 @@ lengthMenu: [[20, 50, 100, -1], [20, 50, 100, "All"]], pageLength: 20, displayLength: 20, - scrollCollapse: true, + scrollCollapse: false, scrollY: '500px' }); From 9c9291c24a24fcdf2cf07f07918def08b57d986b Mon Sep 17 00:00:00 2001 From: JB Date: Sun, 13 Oct 2024 12:35:36 +0100 Subject: [PATCH 3/9] [4460be0] - Add IFRA Categories explanation in usage page --- CHANGELOG.md | 1 + core/list_frmCat_data.php | 2 +- core/list_ifra_cat_data.php | 34 +++++++++++++++++++++++++++ pages/views/formula/usage.php | 43 ++++++++++++++++++++++++++++++++++- releasenotes.md | 3 ++- 5 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 core/list_ifra_cat_data.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 28cee582..8bd1b23e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # CHANGELOG ### Version 11.7 +- Add IFRA Categories explanation in usage page - Make sure empty formula returns array for meta data - Set scroll collapse for datatbales in ingredients to false diff --git a/core/list_frmCat_data.php b/core/list_frmCat_data.php index cd076ecb..8128b78a 100644 --- a/core/list_frmCat_data.php +++ b/core/list_frmCat_data.php @@ -18,7 +18,7 @@ $response['data'][] = $r; } -if(empty($r)){ +if(empty($c)){ $response['data'] = []; } diff --git a/core/list_ifra_cat_data.php b/core/list_ifra_cat_data.php new file mode 100644 index 00000000..fd62c804 --- /dev/null +++ b/core/list_ifra_cat_data.php @@ -0,0 +1,34 @@ + (int)$category['id'], + 'name' => (string)$category['name'], + 'description' => (string)$category['description'] + ]; + $data[] = $c; +} + +$total = mysqli_fetch_assoc(mysqli_query($conn,"SELECT COUNT(id) AS entries FROM IFRACategories")); + +$response = array( + "draw" => (int)$_POST['draw'], + "recordsTotal" => (int)$total['entries'], + "recordsFiltered" => (int)$total['entries'], + "data" => $data +); + +header('Content-Type: application/json; charset=utf-8'); +echo json_encode($response); +return; + + +?> diff --git a/pages/views/formula/usage.php b/pages/views/formula/usage.php index f30ac7e8..3254842e 100644 --- a/pages/views/formula/usage.php +++ b/pages/views/formula/usage.php @@ -31,7 +31,20 @@ - +
+
+ + IFRA Categories explanation + + + + + + + +
Category namePurpose
+
+
From f557a1a9d2c815ac99e6ea4865eb4461288b1139 Mon Sep 17 00:00:00 2001 From: JB Date: Thu, 17 Oct 2024 18:48:52 +0100 Subject: [PATCH 5/9] [02e28aa] - Show/hide api key - Formula settings page minor updates --- CHANGELOG.md | 1 + core/finished_formula_data.php | 7 ++++--- pages/views/formula/finishedProduct.php | 4 ++-- pages/views/formula/sell_formula.php | 7 ++++++- pages/views/formula/viewFormula.php | 5 ++--- pages/views/settings/api.php | 16 +++++++++++++++- 6 files changed, 30 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f213371d..e6de1f2d 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # CHANGELOG ### Version 11.7 +- Show/hide api key - Formula settings page minor updates - Add IFRA Categories explanation in usage page - Make sure empty formula returns array for meta data diff --git a/core/finished_formula_data.php b/core/finished_formula_data.php index e233e107..4f877259 100644 --- a/core/finished_formula_data.php +++ b/core/finished_formula_data.php @@ -167,9 +167,6 @@ } -if(empty($r)){ - $response['data'] = []; -} $carrier_sub_cost = number_format($carrier_cost['price'] / $carrier_cost['size'] * $carrier, $settings['qStep']); $m['sub_total_quantity'] = number_format(array_sum($new_tot), $settings['qStep']); @@ -224,6 +221,10 @@ $response['meta'] = $m; +if(empty($r)){ + $response['meta'] = []; + $response['data'] = []; +} header('Content-Type: application/json; charset=utf-8'); echo json_encode($response); return; diff --git a/pages/views/formula/finishedProduct.php b/pages/views/formula/finishedProduct.php index 61e85514..c032df1f 100644 --- a/pages/views/formula/finishedProduct.php +++ b/pages/views/formula/finishedProduct.php @@ -201,8 +201,8 @@ paging: false, language: { loadingRecords: ' ', - processing: 'Blending...', - emptyTable: '
Empty formula
', + //processing: '', + emptyTable: '
Empty or invalid formula
', }, //dom: 'B', buttons: [ diff --git a/pages/views/formula/sell_formula.php b/pages/views/formula/sell_formula.php index 686ac48b..e55dc3e9 100644 --- a/pages/views/formula/sell_formula.php +++ b/pages/views/formula/sell_formula.php @@ -119,7 +119,12 @@ }, } ], - processing: false, + processing: true, + language: { + loadingRecords: 'Blending...', + processing: '', + emptyTable: '
Empty or invalid formula
', + }, ajax: { url: '/core/full_formula_data.php', data: { diff --git a/pages/views/formula/viewFormula.php b/pages/views/formula/viewFormula.php index d3dd4488..2f50c82d 100644 --- a/pages/views/formula/viewFormula.php +++ b/pages/views/formula/viewFormula.php @@ -114,9 +114,8 @@ var reCalc=0; $(document).ready(function() { - - var groupColumn = 0; - var formula_table = $('#formula').DataTable( { + var groupColumn = 0; + var formula_table = $('#formula').DataTable( { columnDefs: [ { visible: false, targets: groupColumn }, { className: 'text-center', targets: '_all' }, diff --git a/pages/views/settings/api.php b/pages/views/settings/api.php index aa1d7a4f..fda0fd0e 100644 --- a/pages/views/settings/api.php +++ b/pages/views/settings/api.php @@ -20,7 +20,10 @@
- +
+ + +
@@ -30,6 +33,17 @@ diff --git a/releasenotes.md b/releasenotes.md index dc0ed73f..bed3b613 100755 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,4 +1,5 @@ Whats New in v11.7 -------------------------- +- Added formula obscure when in a locked state - Add IFRA Categories explanation in usage page - This release may include more changes, for full details please refer to the CHANGELOG \ No newline at end of file From 728fa30953a529b66e9e4c8d7a4f3761737a8d52 Mon Sep 17 00:00:00 2001 From: JB Date: Sat, 19 Oct 2024 11:57:36 +0100 Subject: [PATCH 7/9] [c1feedc] Auto remove/add decimal point in quantity depending user's input --- CHANGELOG.md | 5 ++- func/convert_to_decimal_point.php | 9 ++++- pages/formula.php | 63 ++++++++++++++++++++----------- releasenotes.md | 1 + 4 files changed, 53 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 669e529e..8f98a2e3 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # CHANGELOG ### Version 11.7 -- Added formula obscure when in a locked state -- Show/hide api key +- Formulation: Auto remove/add decimal point in quantity depending user's input +- Formulation: Added formula obscure when in a locked state +- Settings: Show/hide api key - Formula settings page minor updates - Add IFRA Categories explanation in usage page - Make sure empty formula returns array for meta data diff --git a/func/convert_to_decimal_point.php b/func/convert_to_decimal_point.php index bba29b0f..acff8458 100644 --- a/func/convert_to_decimal_point.php +++ b/func/convert_to_decimal_point.php @@ -1,11 +1,16 @@ 0) { - return '.' . str_repeat('0', $decimalPlaces); + if($decimal){ + + return '.' . str_repeat('0', $decimalPlaces); + }else { + return str_repeat('0', $decimalPlaces); + } } else { return '0'; // If 0 or negative, return plain 0 } diff --git a/pages/formula.php b/pages/formula.php index 3eabb5b3..1a7487ff 100755 --- a/pages/formula.php +++ b/pages/formula.php @@ -29,7 +29,7 @@ if($form[0]['ingredient']){ $legend = 1; } -require_once(__ROOT__.'/func/convert_to_decimal_point.php'); +//require_once(__ROOT__.'/func/convert_to_decimal_point.php'); ?> @@ -158,7 +158,7 @@
- +
@@ -281,23 +281,47 @@