mirror of
https://github.com/grocy/grocy.git
synced 2026-03-29 17:19:25 +02:00
Compare commits
No commits in common. "master" and "v4.6.0" have entirely different histories.
|
|
@ -15,5 +15,5 @@ if ($adminUserRow == null)
|
||||||
}
|
}
|
||||||
|
|
||||||
$adminUserRow->update([
|
$adminUserRow->update([
|
||||||
'password' => password_hash('admin', PASSWORD_ARGON2ID)
|
'password' => password_hash('admin', PASSWORD_DEFAULT)
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
8
.editorconfig
Normal file
8
.editorconfig
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
@ -8,6 +8,6 @@
|
||||||
- Show a calendar on the shopping list page (useful, at least for me)
|
- Show a calendar on the shopping list page (useful, at least for me)
|
||||||
- Table column ordering and sorting is now remembered
|
- Table column ordering and sorting is now remembered
|
||||||
- Sidebar collapse state is now remembered
|
- Sidebar collapse state is now remembered
|
||||||
- Fixed date time picker border
|
- Fixed datetimepicker border
|
||||||
- Keep the parent sidebar menu item expanded if the active page is a sub menu item
|
- Keep the parent sidebar menu item expanded if the active page is a sub menu item
|
||||||
- Custom JS/CSS file names have changed [see README](https://github.com/grocy/grocy#adding-your-own-css-or-js-without-to-have-to-modify-the-application-itself)
|
- Custom JS/CSS file names have changed [see README](https://github.com/grocy/grocy#adding-your-own-css-or-js-without-to-have-to-modify-the-application-itself)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
- => https://github.com/grocy/grocy-desktop
|
- => https://github.com/grocy/grocy-desktop
|
||||||
- Run Grocy without a webserver just like a normal (Windows) desktop application
|
- Run Grocy without a webserver just like a normal (Windows) desktop application
|
||||||
- New "embedded mode" for Grocy to help running in "desktop application mode" [see README](https://github.com/grocy/grocy#embedded-mode)
|
- New "embedded mode" for Grocy to help running in "desktop application mode" [see README](https://github.com/grocy/grocy#embedded-mode)
|
||||||
- New date time picker shorthands and improvements
|
- New datepicker shorthands and improvements
|
||||||
- `YYYYMMe` or `YYYYMM+` gets expanded to the end of the given month in the given year in proper notation
|
- `YYYYMMe` or `YYYYMM+` gets expanded to the end of the given month in the given year in proper notation
|
||||||
- Changed: `MMDD` will be expanded to the given day next year if > today
|
- Changed: `MMDD` will be expanded to the given day next year if > today
|
||||||
- [see README](https://github.com/grocy/grocy#input-shorthands-for-date-fields)
|
- [see README](https://github.com/grocy/grocy#input-shorthands-for-date-fields)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
- Fixed that price data (last price & chart) was not taken from inventory correction bookings, only purchases
|
- Fixed that price data (last price & chart) was not taken from inventory correction bookings, only purchases
|
||||||
- Fixed weekly chores were scheduled on the same day after execution
|
- Fixed weekly chores were scheduled on the same day after execution
|
||||||
- Fixed that undone chores were also included in "Last tracked"
|
- Fixed that undone chores were also included in "Last tracked"
|
||||||
- Fixed the date time picker width was too narrow sometimes
|
- Fixed the date-time-picker width was too narrow sometimes
|
||||||
- Improved that execution dates of "Track date only" chores will never display the time part
|
- Improved that execution dates of "Track date only" chores will never display the time part
|
||||||
- Improved date display for products that never expire (again, there was a display problem after consuming an item on the stock overview page)
|
- Improved date display for products that never expire (again, there was a display problem after consuming an item on the stock overview page)
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
### General & other improvements/fixes
|
### General & other improvements/fixes
|
||||||
- Added a new `config.php` setting `CALENDAR_SHOW_WEEK_OF_YEAR` to configure if calendars should show week numbers (defaults to `true`)
|
- Added a new `config.php` setting `CALENDAR_SHOW_WEEK_OF_YEAR` to configure if calendars should show week numbers (defaults to `true`)
|
||||||
- Fixed that date time pickers not considered the `config.php` setting `CALENDAR_FIRST_DAY_OF_WEEK`
|
- Fixed that date/time pickers not considered the `config.php` setting `CALENDAR_FIRST_DAY_OF_WEEK`
|
||||||
- Improved the handling which entry page to use with disabled feature flags (thanks @nielstholenaar)
|
- Improved the handling which entry page to use with disabled feature flags (thanks @nielstholenaar)
|
||||||
- Boolean settings provided via environment variables (so the strings `true` and `false`) are now parsed correctly (thanks @mduret)
|
- Boolean settings provided via environment variables (so the strings `true` and `false`) are now parsed correctly (thanks @mduret)
|
||||||
- All uploaded pictures (currently for products and recipes) are now automatically downscaled to the appropriate size when serving them to improve page load times (this requires the `php-gd` extension, if not installed, images will not be downscaled)
|
- All uploaded pictures (currently for products and recipes) are now automatically downscaled to the appropriate size when serving them to improve page load times (this requires the `php-gd` extension, if not installed, images will not be downscaled)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ If you run Grocy in a subdirectory, you need to set a new `config.php` setting (
|
||||||
- Added a button to enable the device flash light on the camera barcode scanner popup (thanks @radim-ek)
|
- Added a button to enable the device flash light on the camera barcode scanner popup (thanks @radim-ek)
|
||||||
- Optimized the top navbar height and overall spacing to waste less space
|
- Optimized the top navbar height and overall spacing to waste less space
|
||||||
- Replaced the scan-mode-switch-button by a native button because it's less disturbing
|
- Replaced the scan-mode-switch-button by a native button because it's less disturbing
|
||||||
- Fixed that the "contextual time ago" of date time pickers was not displayed
|
- Fixed that the "contextual time ago" of date/time pickers was not displayed
|
||||||
- New translations: (thanks all the translators)
|
- New translations: (thanks all the translators)
|
||||||
- Czech (demo available at https://cs.demo.grocy.info)
|
- Czech (demo available at https://cs.demo.grocy.info)
|
||||||
- Portuguese (Portugal) (demo available at https://pt-pt.demo.grocy.info)
|
- Portuguese (Portugal) (demo available at https://pt-pt.demo.grocy.info)
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
- Fixed that CORS was broken (there was no response to preflight OPTIONS requests)
|
- Fixed that CORS was broken (there was no response to preflight OPTIONS requests)
|
||||||
|
|
||||||
### General & other improvements/fixes
|
### General & other improvements/fixes
|
||||||
- Optimized that sometimes the corresponding form was not validated when selecting a date from the date time picker
|
- Optimized that sometimes the corresponding form was not validated when selecting a date from the datetimepicker
|
||||||
- New `config.php` setting `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD` which activates the number pad for best-before-date fields on (supported) mobile browsers (useful because of [shorthands](https://github.com/grocy/grocy#input-shorthands-for-date-fields)) (defaults to `true`) (thanks @Mik-)
|
- New `config.php` setting `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD` which activates the number pad for best-before-date fields on (supported) mobile browsers (useful because of [shorthands](https://github.com/grocy/grocy#input-shorthands-for-date-fields)) (defaults to `true`) (thanks @Mik-)
|
||||||
- Enhancements for the camera barcode scanner
|
- Enhancements for the camera barcode scanner
|
||||||
- Torch / light improvements (thanks @Mik-)
|
- Torch / light improvements (thanks @Mik-)
|
||||||
|
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
> ⚠️ xxxBREAKING CHANGESxxx
|
|
||||||
|
|
||||||
> ❗ xxxImportant upgrade informationXXX
|
|
||||||
|
|
||||||
> 💡 xxxMinor upgrade informationXXX
|
|
||||||
|
|
||||||
### New Feature: xxxx
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
||||||
### Stock
|
|
||||||
|
|
||||||
- Fixed that changing the location on the purchase page re-initialized the due date based on product defaults (if any)
|
|
||||||
- Fixed that when undoing a product consume or transfer transaction, the store of the corresponding stock entry wasn't restored
|
|
||||||
- This will only apply to new consume / transfer transactions, not when undoing transactions made before using this release
|
|
||||||
|
|
||||||
### Shopping list
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
||||||
### Recipes
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
||||||
### Meal plan
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
||||||
### Chores
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
||||||
### Calendar
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
||||||
### Tasks
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
||||||
### Batteries
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
||||||
### Equipment
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
||||||
### Userfields
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
||||||
### General
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
||||||
### API
|
|
||||||
|
|
||||||
- xxx
|
|
||||||
|
|
@ -40,10 +40,10 @@ class DefaultAuthMiddleware extends AuthMiddleware
|
||||||
$sessionKey = SessionService::getInstance()->CreateSession($user->id, $stayLoggedInPermanently);
|
$sessionKey = SessionService::getInstance()->CreateSession($user->id, $stayLoggedInPermanently);
|
||||||
self::SetSessionCookie($sessionKey);
|
self::SetSessionCookie($sessionKey);
|
||||||
|
|
||||||
if (password_needs_rehash($user->password, PASSWORD_ARGON2ID))
|
if (password_needs_rehash($user->password, PASSWORD_DEFAULT))
|
||||||
{
|
{
|
||||||
$user->update([
|
$user->update([
|
||||||
'password' => password_hash($inputPassword, PASSWORD_ARGON2ID)
|
'password' => password_hash($inputPassword, PASSWORD_DEFAULT)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ if (defined('GROCY_HTTP_USER'))
|
||||||
// Migrate old user defined in config file to database
|
// Migrate old user defined in config file to database
|
||||||
$newUserRow = $db->users()->createRow([
|
$newUserRow = $db->users()->createRow([
|
||||||
'username' => GROCY_HTTP_USER,
|
'username' => GROCY_HTTP_USER,
|
||||||
'password' => password_hash(GROCY_HTTP_PASSWORD, PASSWORD_ARGON2ID)
|
'password' => password_hash(GROCY_HTTP_PASSWORD, PASSWORD_DEFAULT)
|
||||||
]);
|
]);
|
||||||
$newUserRow->save();
|
$newUserRow->save();
|
||||||
}
|
}
|
||||||
|
|
@ -18,7 +18,7 @@ else
|
||||||
// Create default user "admin" with password "admin"
|
// Create default user "admin" with password "admin"
|
||||||
$newUserRow = $db->users()->createRow([
|
$newUserRow = $db->users()->createRow([
|
||||||
'username' => 'admin',
|
'username' => 'admin',
|
||||||
'password' => password_hash('admin', PASSWORD_ARGON2ID)
|
'password' => password_hash('admin', PASSWORD_DEFAULT)
|
||||||
]);
|
]);
|
||||||
$newUserRow->save();
|
$newUserRow->save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
var CurrentProductDetails;
|
var CurrentProductDetails;
|
||||||
|
|
||||||
$('#save-purchase-button').on('click', function (e)
|
$('#save-purchase-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ $('#save-purchase-button').on('click', function (e)
|
||||||
Grocy.FrontendHelpers.BeginUiBusy("purchase-form");
|
Grocy.FrontendHelpers.BeginUiBusy("purchase-form");
|
||||||
|
|
||||||
Grocy.Api.Get('stock/products/' + jsonForm.product_id,
|
Grocy.Api.Get('stock/products/' + jsonForm.product_id,
|
||||||
function (productDetails)
|
function(productDetails)
|
||||||
{
|
{
|
||||||
var jsonData = {};
|
var jsonData = {};
|
||||||
jsonData.amount = jsonForm.amount;
|
jsonData.amount = jsonForm.amount;
|
||||||
|
|
@ -76,14 +76,14 @@ $('#save-purchase-button').on('click', function (e)
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.Api.Post('stock/products/' + jsonForm.product_id + '/add', jsonData,
|
Grocy.Api.Post('stock/products/' + jsonForm.product_id + '/add', jsonData,
|
||||||
function (result)
|
function(result)
|
||||||
{
|
{
|
||||||
if ($("#purchase-form").hasAttr("data-used-barcode"))
|
if ($("#purchase-form").hasAttr("data-used-barcode"))
|
||||||
{
|
{
|
||||||
Grocy.Api.Put('objects/product_barcodes/' + $("#purchase-form").attr("data-used-barcode"), { last_price: $("#price").val() },
|
Grocy.Api.Put('objects/product_barcodes/' + $("#purchase-form").attr("data-used-barcode"), { last_price: $("#price").val() },
|
||||||
function (result)
|
function(result)
|
||||||
{ },
|
{ },
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{ }
|
{ }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -104,14 +104,14 @@ $('#save-purchase-button').on('click', function (e)
|
||||||
jsonDataBarcode.note = jsonForm.note;
|
jsonDataBarcode.note = jsonForm.note;
|
||||||
|
|
||||||
Grocy.Api.Post('objects/product_barcodes', jsonDataBarcode,
|
Grocy.Api.Post('objects/product_barcodes', jsonDataBarcode,
|
||||||
function (result)
|
function(result)
|
||||||
{
|
{
|
||||||
$("#flow-info-InplaceAddBarcodeToExistingProduct").addClass("d-none");
|
$("#flow-info-InplaceAddBarcodeToExistingProduct").addClass("d-none");
|
||||||
$('#barcode-lookup-disabled-hint').addClass('d-none');
|
$('#barcode-lookup-disabled-hint').addClass('d-none');
|
||||||
$('#barcode-lookup-hint').removeClass('d-none');
|
$('#barcode-lookup-hint').removeClass('d-none');
|
||||||
window.history.replaceState({}, document.title, U("/purchase"));
|
window.history.replaceState({}, document.title, U("/purchase"));
|
||||||
},
|
},
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
Grocy.FrontendHelpers.EndUiBusy("purchase-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);
|
||||||
|
|
@ -145,7 +145,7 @@ $('#save-purchase-button').on('click', function (e)
|
||||||
else if (jsonForm.stock_label_type == 2) // Label per unit
|
else if (jsonForm.stock_label_type == 2) // Label per unit
|
||||||
{
|
{
|
||||||
Grocy.Api.Get('stock/transactions/' + result[0].transaction_id,
|
Grocy.Api.Get('stock/transactions/' + result[0].transaction_id,
|
||||||
function (stockEntries)
|
function(stockEntries)
|
||||||
{
|
{
|
||||||
stockEntries.forEach(stockEntry =>
|
stockEntries.forEach(stockEntry =>
|
||||||
{
|
{
|
||||||
|
|
@ -160,7 +160,7 @@ $('#save-purchase-button').on('click', function (e)
|
||||||
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, webhookData);
|
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, webhookData);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +172,7 @@ $('#save-purchase-button').on('click', function (e)
|
||||||
Grocy.EditObjectId = result[0].transaction_id;
|
Grocy.EditObjectId = result[0].transaction_id;
|
||||||
if (GetUriParam("embedded") !== undefined)
|
if (GetUriParam("embedded") !== undefined)
|
||||||
{
|
{
|
||||||
Grocy.Components.UserfieldsForm.Save(function ()
|
Grocy.Components.UserfieldsForm.Save(function()
|
||||||
{
|
{
|
||||||
Grocy.GetTopmostWindow().postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("ProductChanged", jsonForm.product_id)), Grocy.BaseUrl);
|
Grocy.GetTopmostWindow().postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("ProductChanged", jsonForm.product_id)), Grocy.BaseUrl);
|
||||||
window.parent.postMessage(WindowMessageBag("AfterItemAdded", GetUriParam("listitemid")), Grocy.BaseUrl);
|
window.parent.postMessage(WindowMessageBag("AfterItemAdded", GetUriParam("listitemid")), Grocy.BaseUrl);
|
||||||
|
|
@ -187,7 +187,7 @@ $('#save-purchase-button').on('click', function (e)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Grocy.Components.UserfieldsForm.Save(function ()
|
Grocy.Components.UserfieldsForm.Save(function()
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
||||||
toastr.success(successMessage);
|
toastr.success(successMessage);
|
||||||
|
|
@ -239,14 +239,14 @@ $('#save-purchase-button').on('click', function (e)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
|
|
@ -256,7 +256,7 @@ $('#save-purchase-button').on('click', function (e)
|
||||||
|
|
||||||
if (Grocy.Components.ProductPicker !== undefined)
|
if (Grocy.Components.ProductPicker !== undefined)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetPicker().on('change', function (e)
|
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
|
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
|
||||||
{
|
{
|
||||||
|
|
@ -270,7 +270,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||||
Grocy.Components.ProductCard.Refresh(productId);
|
Grocy.Components.ProductCard.Refresh(productId);
|
||||||
|
|
||||||
Grocy.Api.Get('stock/products/' + productId,
|
Grocy.Api.Get('stock/products/' + productId,
|
||||||
function (productDetails)
|
function(productDetails)
|
||||||
{
|
{
|
||||||
CurrentProductDetails = productDetails;
|
CurrentProductDetails = productDetails;
|
||||||
|
|
||||||
|
|
@ -356,7 +356,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||||
$("#price-type-total-price").click();
|
$("#price-type-total-price").click();
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function ()
|
setTimeout(function()
|
||||||
{
|
{
|
||||||
$('#display_amount').focus();
|
$('#display_amount').focus();
|
||||||
}, Grocy.FormFocusDelay);
|
}, Grocy.FormFocusDelay);
|
||||||
|
|
@ -372,7 +372,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||||
if (document.getElementById("product_id").getAttribute("barcode") != "null")
|
if (document.getElementById("product_id").getAttribute("barcode") != "null")
|
||||||
{
|
{
|
||||||
Grocy.Api.Get('objects/product_barcodes_view?query[]=barcode=' + document.getElementById("product_id").getAttribute("barcode"),
|
Grocy.Api.Get('objects/product_barcodes_view?query[]=barcode=' + document.getElementById("product_id").getAttribute("barcode"),
|
||||||
function (barcodeResult)
|
function(barcodeResult)
|
||||||
{
|
{
|
||||||
if (barcodeResult && barcodeResult.length > 0)
|
if (barcodeResult && barcodeResult.length > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -416,7 +416,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||||
|
|
||||||
ScanModeSubmit(false);
|
ScanModeSubmit(false);
|
||||||
},
|
},
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
|
|
@ -430,7 +430,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||||
|
|
||||||
$('#display_amount').trigger("keyup");
|
$('#display_amount').trigger("keyup");
|
||||||
},
|
},
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
|
|
@ -441,81 +441,52 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||||
|
|
||||||
function PrefillBestBeforeDate(product, location)
|
function PrefillBestBeforeDate(product, location)
|
||||||
{
|
{
|
||||||
if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location == null)
|
if (location == null)
|
||||||
{
|
{
|
||||||
location = {}
|
location = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
var shortcutValue = $("#datetimepicker-shortcut").attr("data-datetimepicker-shortcut-value");
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
|
||||||
var dueDateCurrent = Grocy.Components.DateTimePicker.GetValue();
|
|
||||||
var dueDateDefault = null;
|
|
||||||
var dueDateFreezer = null;
|
|
||||||
|
|
||||||
if (product.default_best_before_days != 0)
|
|
||||||
{
|
{
|
||||||
dueDateDefault = moment().add(product.default_best_before_days, 'days').format('YYYY-MM-DD');
|
var dueDays;
|
||||||
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING && BoolVal(location.is_freezer))
|
||||||
if (product.default_best_before_days == -1)
|
|
||||||
{
|
{
|
||||||
dueDateDefault = shortcutValue;
|
dueDays = product.default_best_before_days_after_freezing;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING && BoolVal(location.is_freezer) && product.default_best_before_days_after_freezing != 0)
|
|
||||||
{
|
|
||||||
dueDateFreezer = moment().add(product.default_best_before_days_after_freezing, 'days').format('YYYY-MM-DD');
|
|
||||||
|
|
||||||
if (product.default_best_before_days_after_freezing == -1)
|
|
||||||
{
|
|
||||||
dueDateFreezer = shortcutValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the default due date when currently no one is set
|
|
||||||
if (dueDateDefault && !dueDateCurrent)
|
|
||||||
{
|
|
||||||
if (!$("#datetimepicker-shortcut").is(":checked") && dueDateDefault == shortcutValue)
|
|
||||||
{
|
|
||||||
$("#datetimepicker-shortcut").click();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Grocy.Components.DateTimePicker.SetValue(dueDateDefault);
|
dueDays = product.default_best_before_days;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the default due date after freezing when currently no one is set or when it was previously set to the default due date
|
if (dueDays != 0)
|
||||||
// (so essentially don't overwrite a by the user different entered due date)
|
|
||||||
if (dueDateFreezer && (!dueDateCurrent || dueDateCurrent == dueDateDefault))
|
|
||||||
{
|
{
|
||||||
if (!$("#datetimepicker-shortcut").is(":checked") && dueDateFreezer == shortcutValue)
|
if (dueDays == -1)
|
||||||
|
{
|
||||||
|
if (!$("#datetimepicker-shortcut").is(":checked"))
|
||||||
{
|
{
|
||||||
$("#datetimepicker-shortcut").click();
|
$("#datetimepicker-shortcut").click();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Grocy.Components.DateTimePicker.SetValue(dueDateFreezer);
|
Grocy.Components.DateTimePicker.SetValue(moment().add(dueDays, 'days').format('YYYY-MM-DD'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Grocy.Components.LocationPicker !== undefined)
|
if (Grocy.Components.LocationPicker !== undefined)
|
||||||
{
|
{
|
||||||
Grocy.Components.LocationPicker.GetPicker().on('change', function (e)
|
Grocy.Components.LocationPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING)
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING)
|
||||||
{
|
{
|
||||||
Grocy.Api.Get('objects/locations/' + Grocy.Components.LocationPicker.GetValue(),
|
Grocy.Api.Get('objects/locations/' + Grocy.Components.LocationPicker.GetValue(),
|
||||||
function (location)
|
function(location)
|
||||||
{
|
{
|
||||||
PrefillBestBeforeDate(CurrentProductDetails.product, location);
|
PrefillBestBeforeDate(CurrentProductDetails.product, location);
|
||||||
},
|
},
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{ }
|
{ }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -531,7 +502,7 @@ if (Grocy.Components.ProductPicker)
|
||||||
{
|
{
|
||||||
if (Grocy.Components.ProductPicker.InAnyFlow() === false && GetUriParam("embedded") === undefined)
|
if (Grocy.Components.ProductPicker.InAnyFlow() === false && GetUriParam("embedded") === undefined)
|
||||||
{
|
{
|
||||||
setTimeout(function ()
|
setTimeout(function()
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
}, Grocy.FormFocusDelay);
|
}, Grocy.FormFocusDelay);
|
||||||
|
|
@ -542,7 +513,7 @@ if (Grocy.Components.ProductPicker)
|
||||||
|
|
||||||
if (Grocy.Components.ProductPicker.InProductModifyWorkflow())
|
if (Grocy.Components.ProductPicker.InProductModifyWorkflow())
|
||||||
{
|
{
|
||||||
setTimeout(function ()
|
setTimeout(function()
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
}, Grocy.FormFocusDelay);
|
}, Grocy.FormFocusDelay);
|
||||||
|
|
@ -550,11 +521,11 @@ if (Grocy.Components.ProductPicker)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#display_amount').on('focus', function (e)
|
$('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
||||||
{
|
{
|
||||||
setTimeout(function ()
|
setTimeout(function()
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
}, Grocy.FormFocusDelay);
|
}, Grocy.FormFocusDelay);
|
||||||
|
|
@ -565,17 +536,17 @@ $('#display_amount').on('focus', function (e)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#price').on('focus', function (e)
|
$('#price').on('focus', function(e)
|
||||||
{
|
{
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#purchase-form input').keyup(function (event)
|
$('#purchase-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#purchase-form input').keydown(function (event)
|
$('#purchase-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) // Enter
|
if (event.keyCode === 13) // Enter
|
||||||
{
|
{
|
||||||
|
|
@ -594,12 +565,12 @@ $('#purchase-form input').keydown(function (event)
|
||||||
|
|
||||||
if (Grocy.Components.DateTimePicker)
|
if (Grocy.Components.DateTimePicker)
|
||||||
{
|
{
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().on('change', function (e)
|
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function (e)
|
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
});
|
});
|
||||||
|
|
@ -607,12 +578,12 @@ if (Grocy.Components.DateTimePicker)
|
||||||
|
|
||||||
if (Grocy.Components.DateTimePicker2)
|
if (Grocy.Components.DateTimePicker2)
|
||||||
{
|
{
|
||||||
Grocy.Components.DateTimePicker2.GetInputElement().on('change', function (e)
|
Grocy.Components.DateTimePicker2.GetInputElement().on('change', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.DateTimePicker2.GetInputElement().on('keypress', function (e)
|
Grocy.Components.DateTimePicker2.GetInputElement().on('keypress', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
});
|
});
|
||||||
|
|
@ -620,22 +591,22 @@ if (Grocy.Components.DateTimePicker2)
|
||||||
Grocy.Components.DateTimePicker2.GetInputElement().trigger("input");
|
Grocy.Components.DateTimePicker2.GetInputElement().trigger("input");
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#price').on('keyup', function (e)
|
$('#price').on('keyup', function(e)
|
||||||
{
|
{
|
||||||
RefreshPriceHint();
|
RefreshPriceHint();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#price-type-unit-price').on('change', function (e)
|
$('#price-type-unit-price').on('change', function(e)
|
||||||
{
|
{
|
||||||
RefreshPriceHint();
|
RefreshPriceHint();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#price-type-total-price').on('change', function (e)
|
$('#price-type-total-price').on('change', function(e)
|
||||||
{
|
{
|
||||||
RefreshPriceHint();
|
RefreshPriceHint();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#display_amount').on('change', function (e)
|
$('#display_amount').on('change', function(e)
|
||||||
{
|
{
|
||||||
RefreshPriceHint();
|
RefreshPriceHint();
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
|
|
@ -674,22 +645,22 @@ function RefreshPriceHint()
|
||||||
function UndoStockBooking(bookingId)
|
function UndoStockBooking(bookingId)
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', {},
|
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', {},
|
||||||
function (result)
|
function(result)
|
||||||
{
|
{
|
||||||
toastr.success(__t("Booking successfully undone"));
|
toastr.success(__t("Booking successfully undone"));
|
||||||
|
|
||||||
Grocy.Api.Get('stock/bookings/' + bookingId.toString(),
|
Grocy.Api.Get('stock/bookings/' + bookingId.toString(),
|
||||||
function (result)
|
function(result)
|
||||||
{
|
{
|
||||||
Grocy.GetTopmostWindow().postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("ProductChanged", result.product_id)), Grocy.BaseUrl);
|
Grocy.GetTopmostWindow().postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("ProductChanged", result.product_id)), Grocy.BaseUrl);
|
||||||
},
|
},
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
|
|
@ -699,29 +670,29 @@ function UndoStockBooking(bookingId)
|
||||||
function UndoStockTransaction(transactionId)
|
function UndoStockTransaction(transactionId)
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', {},
|
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', {},
|
||||||
function (result)
|
function(result)
|
||||||
{
|
{
|
||||||
toastr.success(__t("Transaction successfully undone"));
|
toastr.success(__t("Transaction successfully undone"));
|
||||||
|
|
||||||
Grocy.Api.Get('stock/transactions/' + transactionId.toString(),
|
Grocy.Api.Get('stock/transactions/' + transactionId.toString(),
|
||||||
function (result)
|
function(result)
|
||||||
{
|
{
|
||||||
Grocy.GetTopmostWindow().postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("ProductChanged", result[0].product_id)), Grocy.BaseUrl);
|
Grocy.GetTopmostWindow().postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("ProductChanged", result[0].product_id)), Grocy.BaseUrl);
|
||||||
},
|
},
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function (xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
$("#scan-mode").on("change", function (e)
|
$("#scan-mode").on("change", function(e)
|
||||||
{
|
{
|
||||||
if ($(this).prop("checked"))
|
if ($(this).prop("checked"))
|
||||||
{
|
{
|
||||||
|
|
@ -729,7 +700,7 @@ $("#scan-mode").on("change", function (e)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#scan-mode-button").on("click", function (e)
|
$("#scan-mode-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
$("#scan-mode").click();
|
$("#scan-mode").click();
|
||||||
$("#scan-mode-button").toggleClass("btn-success").toggleClass("btn-danger");
|
$("#scan-mode-button").toggleClass("btn-success").toggleClass("btn-danger");
|
||||||
|
|
@ -743,7 +714,7 @@ $("#scan-mode-button").on("click", function (e)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#qu_id').on('change', function (e)
|
$('#qu_id').on('change', function(e)
|
||||||
{
|
{
|
||||||
var priceTypeUnitPrice = $("#price-type-unit-price");
|
var priceTypeUnitPrice = $("#price-type-unit-price");
|
||||||
var priceTypeUnitPriceLabel = $("[for=" + priceTypeUnitPrice.attr("id") + "]");
|
var priceTypeUnitPriceLabel = $("[for=" + priceTypeUnitPrice.attr("id") + "]");
|
||||||
|
|
@ -776,7 +747,7 @@ function ScanModeSubmit(singleUnit = true)
|
||||||
|
|
||||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER)
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER)
|
||||||
{
|
{
|
||||||
$("#stock_label_type, #amount").on("change", function (e)
|
$("#stock_label_type, #amount").on("change", function(e)
|
||||||
{
|
{
|
||||||
if ($("#stock_label_type").val() == 2)
|
if ($("#stock_label_type").val() == 2)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -463,8 +463,7 @@ class StockService extends BaseService
|
||||||
'transaction_id' => $transactionId,
|
'transaction_id' => $transactionId,
|
||||||
'user_id' => GROCY_USER_ID,
|
'user_id' => GROCY_USER_ID,
|
||||||
'location_id' => $stockEntry->location_id,
|
'location_id' => $stockEntry->location_id,
|
||||||
'note' => $stockEntry->note,
|
'note' => $stockEntry->note
|
||||||
'shopping_location_id' => $stockEntry->shopping_location_id
|
|
||||||
]);
|
]);
|
||||||
$logRow->save();
|
$logRow->save();
|
||||||
|
|
||||||
|
|
@ -499,8 +498,7 @@ class StockService extends BaseService
|
||||||
'transaction_id' => $transactionId,
|
'transaction_id' => $transactionId,
|
||||||
'user_id' => GROCY_USER_ID,
|
'user_id' => GROCY_USER_ID,
|
||||||
'location_id' => $stockEntry->location_id,
|
'location_id' => $stockEntry->location_id,
|
||||||
'note' => $stockEntry->note,
|
'note' => $stockEntry->note
|
||||||
'shopping_location_id' => $stockEntry->shopping_location_id
|
|
||||||
]);
|
]);
|
||||||
$logRow->save();
|
$logRow->save();
|
||||||
|
|
||||||
|
|
@ -1534,8 +1532,7 @@ class StockService extends BaseService
|
||||||
'opened_date' => $logRow->opened_date,
|
'opened_date' => $logRow->opened_date,
|
||||||
'open' => $logRow->opened_date !== null,
|
'open' => $logRow->opened_date !== null,
|
||||||
'location_id' => $logRow->location_id,
|
'location_id' => $logRow->location_id,
|
||||||
'note' => $logRow->note,
|
'note' => $logRow->note
|
||||||
'shopping_location_id' => $logRow->shopping_location_id
|
|
||||||
]);
|
]);
|
||||||
$stockRow->save();
|
$stockRow->save();
|
||||||
|
|
||||||
|
|
@ -1586,8 +1583,7 @@ class StockService extends BaseService
|
||||||
'stock_id' => $logRow->stock_id,
|
'stock_id' => $logRow->stock_id,
|
||||||
'price' => $logRow->price,
|
'price' => $logRow->price,
|
||||||
'opened_date' => $logRow->opened_date,
|
'opened_date' => $logRow->opened_date,
|
||||||
'note' => $logRow->note,
|
'note' => $logRow->note
|
||||||
'shopping_location_id' => $logRow->shopping_location_id
|
|
||||||
]);
|
]);
|
||||||
$stockRow->save();
|
$stockRow->save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ class UsersService extends BaseService
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'first_name' => $firstName,
|
'first_name' => $firstName,
|
||||||
'last_name' => $lastName,
|
'last_name' => $lastName,
|
||||||
'password' => password_hash($password, PASSWORD_ARGON2ID),
|
'password' => password_hash($password, PASSWORD_DEFAULT),
|
||||||
'picture_file_name' => $pictureFileName
|
'picture_file_name' => $pictureFileName
|
||||||
]);
|
]);
|
||||||
$newUserRow = $newUserRow->save();
|
$newUserRow = $newUserRow->save();
|
||||||
|
|
@ -61,7 +61,7 @@ class UsersService extends BaseService
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'first_name' => $firstName,
|
'first_name' => $firstName,
|
||||||
'last_name' => $lastName,
|
'last_name' => $lastName,
|
||||||
'password' => password_hash($password, PASSWORD_ARGON2ID),
|
'password' => password_hash($password, PASSWORD_DEFAULT),
|
||||||
'picture_file_name' => $pictureFileName
|
'picture_file_name' => $pictureFileName
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user