diff --git a/changelog/77_UNRELEASED_xxxx-xx-xx.md b/changelog/77_UNRELEASED_xxxx-xx-xx.md index cdd17003..4a64f406 100644 --- a/changelog/77_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/77_UNRELEASED_xxxx-xx-xx.md @@ -58,6 +58,7 @@ ### Userfields - Fixed that Userfield default values were not initialized for the `stock` entity (so affecting the purchase and inventory page) +- Fixed that uploading bigger or multiple files (so when the upload usually takes a little longer) didn't work (Userfield type "File") ### General diff --git a/public/css/grocy.css b/public/css/grocy.css index 72e48df0..239fa9fa 100755 --- a/public/css/grocy.css +++ b/public/css/grocy.css @@ -362,8 +362,12 @@ html { min-height: inherit; } -.dropdown-toggle::after { - margin-left: -0.15em !important; +.dropdown-toggle:after { + vertical-align: 0; + margin: 0; + border: none; + content: '\f107'; + font-family: 'Font Awesome 6 Free'; } /* Third party component customizations - Tempus Dominus */ diff --git a/public/js/grocy.js b/public/js/grocy.js index 2dbe3525..6d20398a 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -491,11 +491,11 @@ Grocy.FrontendHelpers.RunWebhook = function(webhook, data, repetitions = 1) $(document).on("keyup paste change", "input, textarea", function() { - $(this).closest("form").addClass("is-dirty"); + $(this).addClass("is-dirty").closest("form").addClass("is-dirty"); }); $(document).on("click", "select", function() { - $(this).closest("form").addClass("is-dirty"); + $(this).addClass("is-dirty").closest("form").addClass("is-dirty"); }); // Auto saving user setting controls diff --git a/public/viewjs/batteryform.js b/public/viewjs/batteryform.js index 67d6b9eb..79678e75 100644 --- a/public/viewjs/batteryform.js +++ b/public/viewjs/batteryform.js @@ -36,7 +36,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("battery-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -60,7 +60,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("battery-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/choreform.js b/public/viewjs/choreform.js index ee9d7c58..08cc9180 100644 --- a/public/viewjs/choreform.js +++ b/public/viewjs/choreform.js @@ -46,7 +46,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("chore-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -73,7 +73,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("chore-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/choresoverview.js b/public/viewjs/choresoverview.js index bde3b9eb..27cddf85 100644 --- a/public/viewjs/choresoverview.js +++ b/public/viewjs/choresoverview.js @@ -344,7 +344,7 @@ $("#reschedule-chore-save-button").on("click", function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); }); @@ -369,7 +369,7 @@ $("#reschedule-chore-clear-button").on("click", function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); }); diff --git a/public/viewjs/components/userfieldsform.js b/public/viewjs/components/userfieldsform.js index 7b2ff297..9dbf3a3b 100644 --- a/public/viewjs/components/userfieldsform.js +++ b/public/viewjs/components/userfieldsform.js @@ -12,10 +12,21 @@ Grocy.Components.UserfieldsForm.Save = function(success, error) return; } - var jsonData = {}; + var editedUserfieldInputs = $("#userfields-form .userfield-input.is-dirty").not("div"); - $("#userfields-form .userfield-input").not("div").each(function() + if (!editedUserfieldInputs.length) { + if (success) + { + success(); + } + + return; + } + + editedUserfieldInputs.each(function(index, item) + { + var jsonData = {}; var input = $(this); var fieldName = input.attr("data-userfield-name"); var fieldValue = input.val(); @@ -30,33 +41,21 @@ Grocy.Components.UserfieldsForm.Save = function(success, error) } else if (input.attr("type") == "file") { - var oldFile = input.data('old-file') - if (oldFile) + if (input.hasAttr("data-old-file")) { - Grocy.Api.Delete('files/userfiles/' + oldFile, null, null, - function(xhr) - { - Grocy.FrontendHelpers.ShowGenericError('Could not delete file', xhr); - }); - jsonData[fieldName] = ""; + var oldFile = input.attr("data-old-file"); + if (oldFile) + { + jsonData[fieldName] = ""; + } } if (input[0].files.length > 0) { // Files service requires an extension - var fileName = RandomString() + '.' + CleanFileName(input[0].files[0].name.split('.').reverse()[0]); + var newFile = RandomString() + '.' + CleanFileName(input[0].files[0].name.split('.').reverse()[0]); + jsonData[fieldName] = btoa(newFile) + '_' + btoa(CleanFileName(input[0].files[0].name)); - jsonData[fieldName] = btoa(fileName) + '_' + btoa(CleanFileName(input[0].files[0].name)); - Grocy.Api.UploadFile(input[0].files[0], 'userfiles', fileName, - function(result) - { - }, - function(xhr) - { - // When navigating away immediately from the current page, this is maybe a false positive - so ignore this for now - // Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) - } - ); } } else if ($(this).hasAttr("multiple")) @@ -67,24 +66,100 @@ Grocy.Components.UserfieldsForm.Save = function(success, error) { jsonData[fieldName] = fieldValue; } - }); - Grocy.Api.Put('userfields/' + $("#userfields-form").data("entity") + '/' + Grocy.EditObjectId, jsonData, - function(result) - { - if (success) + Grocy.Api.Put('userfields/' + $("#userfields-form").data("entity") + '/' + Grocy.EditObjectId, jsonData, + function(result) { - success(); - } - }, - function(xhr) - { - if (error) + if (typeof newFile !== 'undefined' && typeof oldFile !== 'undefined') // Delete and Upload + { + Grocy.Api.DeleteFile(oldFile, 'userfiles', + function(result) + { + Grocy.Api.UploadFile(input[0].files[0], 'userfiles', newFile, + function(result2) + { + if (success && index === editedUserfieldInputs.length - 1) // Last item + { + success(); + } + }, + function(xhr) + { + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); + if (error && index === editedUserfieldInputs.length - 1) // Last item + { + error(); + } + } + ); + }, + function(xhr) + { + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); + if (error && index === editedUserfieldInputs.length - 1) // Last item + { + error(); + } + } + ); + } + else if (typeof newFile !== 'undefined') // Upload only + { + Grocy.Api.UploadFile(input[0].files[0], 'userfiles', newFile, + function(result2) + { + if (success && index === editedUserfieldInputs.length - 1) // Last item + { + success(); + } + }, + function(xhr) + { + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); + if (error && index === editedUserfieldInputs.length - 1) // Last item + { + error(); + } + } + ); + } + else if (typeof oldFile !== 'undefined') // Delete only + { + Grocy.Api.DeleteFile(oldFile, 'userfiles', + function(result) + { + if (success && index === editedUserfieldInputs.length - 1) // Last item + { + success(); + } + }, + function(xhr) + { + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); + if (error && index === editedUserfieldInputs.length - 1) // Last item + { + error(); + } + } + ); + } + else // Nothing else to do + { + if (success && index === editedUserfieldInputs.length - 1) // Last item + { + success(); + } + } + }, + function(xhr) { - error(); + if (error && index === editedUserfieldInputs.length - 1) // Last item + { + error(); + } } - } - ); + ); + }); } Grocy.Components.UserfieldsForm.Load = function() @@ -155,14 +230,13 @@ Grocy.Components.UserfieldsForm.Load = function() if (value) { var fileName = atob(value.split('_')[1]); - var fileSrc = value.split('_')[0]; + var fileSrc = atob(value.split('_')[0]); var formGroup = input.parent().parent().parent(); formGroup.find("label.custom-file-label").text(fileName); formGroup.find(".userfield-file-show").attr('href', U('/files/userfiles/' + value)); formGroup.find('.userfield-file-show').removeClass('d-none'); - formGroup.find('img.userfield-current-file') - .attr('src', U('/files/userfiles/' + value + '?force_serve_as=picture&best_fit_width=250&best_fit_height=250')); + formGroup.find('img.userfield-current-file').attr('src', U('/files/userfiles/' + value + '?force_serve_as=picture&best_fit_width=250&best_fit_height=250')); formGroup.find('.userfield-file-delete').click( function() @@ -170,6 +244,7 @@ Grocy.Components.UserfieldsForm.Load = function() formGroup.find("label.custom-file-label").text(__t("No file selected")); formGroup.find(".userfield-file-show").addClass('d-none'); input.attr('data-old-file', fileSrc); + input.addClass("is-dirty"); } ); diff --git a/public/viewjs/equipmentform.js b/public/viewjs/equipmentform.js index ee050c5f..285143f8 100644 --- a/public/viewjs/equipmentform.js +++ b/public/viewjs/equipmentform.js @@ -43,7 +43,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("equipment-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -56,7 +56,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("equipment-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -64,7 +64,7 @@ { if (Grocy.DeleteInstructionManualOnSave) { - Grocy.Api.DeleteFile(Grocy.InstructionManualFileNameName, 'equipmentmanuals', {}, + Grocy.Api.DeleteFile(Grocy.InstructionManualFileNameName, 'equipmentmanuals', function(result) { // Nothing to do @@ -72,7 +72,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("equipment-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); }; @@ -92,7 +92,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("equipment-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -105,7 +105,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("equipment-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/locationform.js b/public/viewjs/locationform.js index 9bdbc3a0..111bfa17 100644 --- a/public/viewjs/locationform.js +++ b/public/viewjs/locationform.js @@ -36,7 +36,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("location-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -60,7 +60,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("location-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/mealplan.js b/public/viewjs/mealplan.js index 8d372f5f..13edb516 100644 --- a/public/viewjs/mealplan.js +++ b/public/viewjs/mealplan.js @@ -512,7 +512,7 @@ $(document).on("click", ".remove-recipe-button, .remove-note-button, .remove-pro }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); }); @@ -540,7 +540,7 @@ $('#save-add-recipe-button').on('click', function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -553,7 +553,7 @@ $('#save-add-recipe-button').on('click', function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -582,7 +582,7 @@ $('#save-add-note-button').on('click', function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -595,7 +595,7 @@ $('#save-add-note-button').on('click', function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -630,7 +630,7 @@ $('#save-add-product-button').on('click', function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -643,7 +643,7 @@ $('#save-add-product-button').on('click', function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -843,7 +843,7 @@ $(document).on('click', '.product-consume-button', function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); }, @@ -901,7 +901,7 @@ $(document).on('click', '.recipe-consume-button', function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); }, @@ -967,7 +967,7 @@ $(document).on("click", ".mealplan-entry-done-button", function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); }); @@ -986,7 +986,7 @@ $(document).on("click", ".mealplan-entry-undone-button", function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); }); diff --git a/public/viewjs/mealplansectionform.js b/public/viewjs/mealplansectionform.js index 3113c0d5..c61d59b9 100644 --- a/public/viewjs/mealplansectionform.js +++ b/public/viewjs/mealplansectionform.js @@ -27,7 +27,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("mealplansection-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -48,7 +48,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("mealplansection-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/productform.js b/public/viewjs/productform.js index cbf89823..aa17a0ae 100644 --- a/public/viewjs/productform.js +++ b/public/viewjs/productform.js @@ -13,7 +13,7 @@ if (Grocy.ProductEditFormRedirectUri == "reload") { window.location.reload(); - return + return; } var returnTo = GetUriParam('returnto'); @@ -42,7 +42,7 @@ (xhr) => { Grocy.FrontendHelpers.EndUiBusy("product-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -107,7 +107,7 @@ $('.save-product-button').on('click', function(e) (xhr) => { Grocy.FrontendHelpers.EndUiBusy("product-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); }); return; } @@ -116,7 +116,7 @@ $('.save-product-button').on('click', function(e) { jsonData.picture_file_name = null; - Grocy.Api.DeleteFile(Grocy.ProductPictureFileName, 'productpictures', {}, + Grocy.Api.DeleteFile(Grocy.ProductPictureFileName, 'productpictures', function(result) { // Nothing to do @@ -124,7 +124,7 @@ $('.save-product-button').on('click', function(e) function(xhr) { Grocy.FrontendHelpers.EndUiBusy("product-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/productgroupform.js b/public/viewjs/productgroupform.js index 06ca14a2..d9d88cad 100644 --- a/public/viewjs/productgroupform.js +++ b/public/viewjs/productgroupform.js @@ -29,7 +29,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("product-group-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -46,7 +46,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("product-group-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/quantityunitconversionform.js b/public/viewjs/quantityunitconversionform.js index d81d7436..b5a08619 100644 --- a/public/viewjs/quantityunitconversionform.js +++ b/public/viewjs/quantityunitconversionform.js @@ -45,7 +45,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("quconversion-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -77,7 +77,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("quconversion-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/quantityunitform.js b/public/viewjs/quantityunitform.js index 14aacab3..5c5c23be 100644 --- a/public/viewjs/quantityunitform.js +++ b/public/viewjs/quantityunitform.js @@ -57,7 +57,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("quantityunit-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -93,7 +93,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("quantityunit-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/recipeform.js b/public/viewjs/recipeform.js index 0aede261..0a574443 100644 --- a/public/viewjs/recipeform.js +++ b/public/viewjs/recipeform.js @@ -15,7 +15,7 @@ (xhr) => { Grocy.FrontendHelpers.EndUiBusy("recipe-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -56,7 +56,7 @@ $('.save-recipe').on('click', function(e) { jsonData.picture_file_name = null; - Grocy.Api.DeleteFile(Grocy.RecipePictureFileName, 'recipepictures', {}, + Grocy.Api.DeleteFile(Grocy.RecipePictureFileName, 'recipepictures', function(result) { // Nothing to do @@ -64,7 +64,7 @@ $('.save-recipe').on('click', function(e) function(xhr) { Grocy.FrontendHelpers.EndUiBusy("recipe-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -317,7 +317,7 @@ $('#save-recipe-include-button').on('click', function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -330,7 +330,7 @@ $('#save-recipe-include-button').on('click', function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/recipeposform.js b/public/viewjs/recipeposform.js index 417e8c46..ae184591 100644 --- a/public/viewjs/recipeposform.js +++ b/public/viewjs/recipeposform.js @@ -52,7 +52,7 @@ $('#save-recipe-pos-button').on('click', function(e) function(xhr) { Grocy.FrontendHelpers.EndUiBusy("recipe-pos-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -67,7 +67,7 @@ $('#save-recipe-pos-button').on('click', function(e) function(xhr) { Grocy.FrontendHelpers.EndUiBusy("recipe-pos-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/recipes.js b/public/viewjs/recipes.js index 9b922c10..27c332c1 100644 --- a/public/viewjs/recipes.js +++ b/public/viewjs/recipes.js @@ -483,7 +483,7 @@ $('#save-add-to-mealplan-button').on('click', function(e) }, function(xhr) { - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); }); diff --git a/public/viewjs/shoppinglocationform.js b/public/viewjs/shoppinglocationform.js index 9604fac1..e322c22f 100644 --- a/public/viewjs/shoppinglocationform.js +++ b/public/viewjs/shoppinglocationform.js @@ -36,7 +36,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("shoppinglocation-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -60,7 +60,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("shoppinglocation-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/taskcategoryform.js b/public/viewjs/taskcategoryform.js index f3484e74..483a067c 100644 --- a/public/viewjs/taskcategoryform.js +++ b/public/viewjs/taskcategoryform.js @@ -36,7 +36,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("task-category-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -60,7 +60,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("task-category-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/taskform.js b/public/viewjs/taskform.js index d687047f..8e50dfdb 100644 --- a/public/viewjs/taskform.js +++ b/public/viewjs/taskform.js @@ -56,7 +56,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("task-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -80,7 +80,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("task-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/userentityform.js b/public/viewjs/userentityform.js index a83a8a48..3d38ef11 100644 --- a/public/viewjs/userentityform.js +++ b/public/viewjs/userentityform.js @@ -34,7 +34,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("userentity-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -55,7 +55,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("userentity-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/userfieldform.js b/public/viewjs/userfieldform.js index 6d73bf38..742de74e 100644 --- a/public/viewjs/userfieldform.js +++ b/public/viewjs/userfieldform.js @@ -38,7 +38,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("userfield-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -59,7 +59,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("userfield-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/userform.js b/public/viewjs/userform.js index e9ebc493..765e09b1 100644 --- a/public/viewjs/userform.js +++ b/public/viewjs/userform.js @@ -13,7 +13,7 @@ (xhr) => { Grocy.FrontendHelpers.EndUiBusy("user-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -63,7 +63,7 @@ $('#save-user-button').on('click', function(e) { jsonData.picture_file_name = null; - Grocy.Api.DeleteFile(Grocy.UserPictureFileName, 'userpictures', {}, + Grocy.Api.DeleteFile(Grocy.UserPictureFileName, 'userpictures', function(result) { // Nothing to do @@ -71,7 +71,7 @@ $('#save-user-button').on('click', function(e) function(xhr) { Grocy.FrontendHelpers.EndUiBusy("user-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/public/viewjs/userobjectform.js b/public/viewjs/userobjectform.js index ba4e79b5..7ddf8b00 100644 --- a/public/viewjs/userobjectform.js +++ b/public/viewjs/userobjectform.js @@ -38,7 +38,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("userobject-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } @@ -62,7 +62,7 @@ function(xhr) { Grocy.FrontendHelpers.EndUiBusy("userobject-form"); - Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response) + Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response); } ); } diff --git a/services/FilesService.php b/services/FilesService.php index 7d070350..113a6478 100644 --- a/services/FilesService.php +++ b/services/FilesService.php @@ -80,7 +80,6 @@ class FilesService extends BaseService if (file_exists($filePath)) { $fileNameWithoutExtension = pathinfo($filePath, PATHINFO_FILENAME); - $fileExtension = pathinfo($filePath, PATHINFO_EXTENSION); // Then the file is an image if (getimagesize($filePath) !== false)