Compare commits

...

309 Commits

Author SHA1 Message Date
Bernd Bestel
e273158796 Prepared next release 2024-12-23 17:50:40 +01:00
Bernd Bestel
a1008eac30 Pulled translations from Transifex 2024-12-23 17:46:12 +01:00
Bernd Bestel
d7b5b8958a Stage changes of 27f9d70b56 (not ready yet) 2024-12-23 17:39:59 +01:00
Bernd Bestel
04c5928612 Allow underscores in Userfield names (closes #2611) 2024-12-23 17:35:49 +01:00
Bernd Bestel
9a319a6ee0 Fixed/optimized shopping list invalidation when removing table rows (fixes #2608) 2024-12-23 17:31:22 +01:00
Bernd Bestel
cd25284d35 Fixed DOMSubtreeModified deprecation notice 2024-12-23 17:20:23 +01:00
Bernd Bestel
58eda2f152 Upgraded iframe-resizer package 2024-12-23 17:11:35 +01:00
Bernd Bestel
ceb6774260 Updated dependencies 2024-12-23 16:46:33 +01:00
Bernd Bestel
7b7293e108 Updated footer 2024-12-23 16:43:31 +01:00
Bernd Bestel
11ea8f3716 Fixed shopping list print view table/list sorting (fixes #2602) 2024-11-08 16:40:30 +01:00
Bernd Bestel
1b8f4e6a4f Updated README 2024-11-01 10:44:16 +01:00
Bernd Bestel
3321deec70 Added changelog of #2596 2024-10-25 23:25:17 +02:00
Daniel Reinoso
5b48004449 Exclude self-produced product prices from spending reports (#2596)
* Exclude self-produced product prices from spending reports

* Fix SQL query

* Code style

---------

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2024-10-25 23:19:00 +02:00
Bernd Bestel
9e1020b7f8 Round amount picker max by stock_decimal_places_amounts (closes #2578) 2024-09-10 21:55:31 +02:00
Stefan
185e6b20ad Make date in backup filename ISO 8601 compliant (#2574) 2024-09-01 17:23:06 +02:00
Bernd Bestel
2bc58e083d Fixed recipe edit button on recipes page gallery view (fixes #2541) 2024-08-24 20:01:01 +02:00
Bernd Bestel
1323fff3e2 Add table options also to userobjects view (closes #2573) 2024-08-24 19:42:41 +02:00
Bernd Bestel
d186e26898 Fixed products page table filter regex (references #2570) 2024-08-24 18:28:38 +02:00
Bernd Bestel
4f6075d8c5 Fixed product barcode scanning on the recipe ingredient edit page (fixes #2572) 2024-08-24 18:22:39 +02:00
Bernd Bestel
d5dacb1053 Optimized product Grocycode handling on consume page (and others / general) (fixes #2571) 2024-08-24 18:20:40 +02:00
Bernd Bestel
1246f402e5 Fixed product Grocycode handling on /purchase (references #2571) 2024-08-24 11:32:15 +02:00
Bernd Bestel
7080ec9a8f Pulled translations from Transifex 2024-08-24 11:01:37 +02:00
Bernd Bestel
df28026a80 Updated dependencies 2024-08-24 10:53:33 +02:00
Bernd Bestel
434525826e Fixed products page product group filter to use an exact search instead of contains (fixes #2570) 2024-08-24 10:49:19 +02:00
Bernd Bestel
c21090f522 Allow non-ASCII characters in file names of uploaded files (closes #2484) 2024-08-19 20:51:47 +02:00
Bernd Bestel
5a2600209f Fixed recipe shopping list button feature flag relation (fixes #2552) 2024-07-13 13:41:18 +02:00
Bernd Bestel
8ac8000f30 Updated dependencies 2024-05-10 17:45:29 +02:00
Bernd Bestel
8821280642 Pulled translations from Transifex 2024-05-10 17:42:13 +02:00
Bernd Bestel
2047d38c6e Updated about page 2024-04-14 19:24:32 +02:00
Bernd Bestel
a68c1087dd Update README 2024-04-13 17:43:57 +02:00
Bernd Bestel
2f7478bddb Update README 2024-04-13 13:20:35 +02:00
Bernd Bestel
af1f2aef96 Don't allow amounts <= 0 on purchase/consume
References https://github.com/grocy/grocy/issues/2156#issuecomment-2040336492
2024-04-05 20:12:11 +02:00
Bernd Bestel
6602c76005 Completed changelog for #2501 2024-03-17 21:26:06 +01:00
TheDodger
8f9b295e68 Also copy treat_opened_as_out_of_stock when copying a product (#2501) 2024-03-17 21:24:35 +01:00
Bernd Bestel
5167ba1154 Add recipe name to note of the created stock entry when self producing products (closes #2497) 2024-03-17 17:11:09 +01:00
Bernd Bestel
b26dfe3fb0 Restored staged changes of 27f9d70b56 2024-03-15 18:48:51 +01:00
Bernd Bestel
402d98757e Optimized iframe-resizer handling 2024-03-15 18:39:31 +01:00
Bernd Bestel
a7fc87c9bc Prepared next release 2024-03-15 18:12:58 +01:00
Bernd Bestel
5c1814989a Stage changes of 27f9d70b56 (not ready yet) 2024-03-15 18:06:46 +01:00
Bernd Bestel
e005c51b1a Pulled translations from Transifex 2024-03-15 18:04:16 +01:00
Bernd Bestel
f14110aa1e Updated dependencies 2024-03-15 18:01:05 +01:00
Bernd Bestel
affa7c41a1 Added missing DataTables option (fixes #2494) 2024-03-13 22:05:05 +01:00
Bernd Bestel
9c123bd92a Completed changelog for #2492 2024-03-10 18:59:16 +01:00
TheDodger
7f1dfd0496 Align settings (wrench) menu entries (#2492)
* Made settings menu (wrench) entries aligned by changing the icons to fixed width

* If, then take care of all those kind of menus

---------

Co-authored-by: Manuel Worschech <mw@abot.xyz>
Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2024-03-10 18:57:10 +01:00
Bernd Bestel
49ff780e3f Completed changelog for #2490 2024-03-10 18:16:43 +01:00
TheDodger
477f333466 Add userfields to battery charge cycle tracking (#2490)
Co-authored-by: Manuel Worschech <mw@abot.xyz>
2024-03-10 18:12:02 +01:00
Bernd Bestel
e01e0f3abe Revamped iframe modal handling (references #2480 and #2421) 2024-02-25 10:40:11 +01:00
Bernd Bestel
8ba3305a21 Default any add-to-shopping-list-actions to the default shopping list (closes #2472) 2024-02-24 20:15:23 +01:00
Bernd Bestel
24cac247f5 Don't resize invisible embedded iframes (references #2480 and #2421) 2024-02-24 20:13:39 +01:00
Bernd Bestel
6a68e410e4 Prefill specific stock entry information by a scanned stock entry Grocycode on /transfer (closes #2481) 2024-02-24 17:48:58 +01:00
Bernd Bestel
88d0d32ea0 Added changelog for #2480 2024-02-24 15:47:57 +01:00
Bernd Bestel
11ac985e57 Added a workaround for sporadically (not fully reproducible) empty modal iframes in Chrome based Browsers (references #2480 and #2421) 2024-02-24 15:36:43 +01:00
Bernd Bestel
ac26c5510b Prefill desired_servings by base_servings when creating a recipe (closes #2479) 2024-02-23 18:09:55 +01:00
Bernd Bestel
85bff136de Added changelog for #2477 2024-02-23 17:58:24 +01:00
bbx0
d2a878e98e Stream uploads to file (#2477)
* Stream uploads to file

* Adapt code style / use up to date reasonable chunk size

---------

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2024-02-23 17:56:32 +01:00
Bernd Bestel
4d8f08eddd Also copy move_on_open when copying a product (fixes #2478) 2024-02-23 17:08:34 +01:00
Bernd Bestel
edf973df00 Improved meal plan item buttons (closes #2471) 2024-02-13 20:07:24 +01:00
Bernd Bestel
8497f37b24 Fixed product's last_price related to empty / 0 stock transactions (fixes #2470) 2024-02-13 13:12:56 +01:00
Bernd Bestel
40d1a9c3d0 Show the number of items per shopping list in the shopping lists dropdown (closes #2467) 2024-02-12 20:36:33 +01:00
Bernd Bestel
c7abed0d68 Restored staged changes (ref 27f9d70b56 and 7b1a864486) 2024-02-09 18:26:23 +01:00
Bernd Bestel
bf05434a5c Prepared next release 2024-02-09 17:32:35 +01:00
Bernd Bestel
18125d8989 Pulled translations from Transifex 2024-02-09 17:25:00 +01:00
Bernd Bestel
75f0af2bd3 Updated dependencies 2024-02-09 16:46:33 +01:00
Bernd Bestel
7b1a864486 Revert / disable 27f9d70b56 (not ready yet) 2024-02-09 16:38:55 +01:00
Bernd Bestel
f2f9a16e59 Fixed stock entry page consume amount handling (fixes #2397) 2024-02-09 16:29:19 +01:00
Bernd Bestel
9f94ba55a4 Improved API doc related to the /stock endpoint (closes #2456) 2024-02-03 09:28:18 +01:00
Bernd Bestel
15ab198af0 Enable night mode on /login if that's the system preferred color scheme (references #71) 2024-01-28 09:39:58 +01:00
Bernd Bestel
4659f51551 Fixed user create handling in embedded mode (closes grocy/grocy-desktop#51) 2024-01-15 17:10:36 +01:00
Bernd Bestel
33d5ec44d2 Again more iframe dialog handling optimizations (references #2421) 2024-01-13 20:27:35 +01:00
Bernd Bestel
fc072b13f2 More iframe dialog handling optimizations (references #2421) 2024-01-13 09:32:59 +01:00
Bernd Bestel
efae5fea5b Don't lazy load iframes (fixes #2421) 2024-01-10 21:52:54 +01:00
jan-karwowski
3aeecfa24d Fix data types in opeanapi description (#2433)
* In Openapi schema mark fields that return only date as date

next_due_data and last_uset were using date-time format instead of date

* In Openapi description fix type product_barcodes to be array

Openapi schema should say thatn product_barcodes field in
ProductDetailsResponse is an array of ProductBarcode not a single
object.

Make the value an array not a single field

* In openapi schema fix purchased date format in stock log entry

It should be just date not a date-time format.

---------

Co-authored-by: Jan Karwowski <jan_karwowski@wp.pl>
2024-01-09 18:49:38 +01:00
Bernd Bestel
bae83535dd Merge branch 'master' of https://github.com/grocy/grocy 2024-01-09 18:39:57 +01:00
Bernd Bestel
fb407a7fa7 Added changelog for #2432 2024-01-09 18:39:42 +01:00
Torqu3Wr3nch
151bd7f025 Fix blank/missing items in spending report (#2432)
* Fixes blank/missing items in spending report

Use left (outer) join when connecting product to optional product group

* Properly display ungrouped items in table and chart

---------

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2024-01-09 18:36:09 +01:00
Bernd Bestel
99f448dd64 Strip spaces from uploaded file names (fixes #2415) 2023-12-30 19:49:21 +01:00
Bernd Bestel
7f7f1e8dce Added changelog for #2412 2023-12-25 08:49:29 +01:00
geoffwright240
6b69487bc5 Added 'category' filter to tasks view. (#2412)
* Added 'category' filter to tasks view.

* Remove extraneous css attributes.

* Applied code style rules

* Use correct column

* Task categories are not something that is translated...

* Added "Uncategorized" as additional filter option

---------

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2023-12-25 08:47:21 +01:00
Bernd Bestel
ee01f41979 Support PHP 8.3, no longer support PHP 8.1 2023-12-16 15:08:59 +01:00
Bernd Bestel
97ecbd25b6 Pulled translations from Transifex 2023-12-16 15:07:59 +01:00
Bernd Bestel
9458eb8b90 Updated dependencies 2023-12-16 15:04:07 +01:00
Bernd Bestel
3c35a69c32 Optimized created API key table highlighting (closes #2403) 2023-12-11 22:03:00 +01:00
Bernd Bestel
c9bc10820d Fixed typo in localization string 2023-12-01 19:26:29 +01:00
Bernd Bestel
8f52aaeadc Handle stock userfields in generic entity interaction API endpoints (closes #2381) 2023-11-14 21:07:30 +01:00
Bernd Bestel
dc05476d09 Reload calendar after color config changed (references #2368) 2023-11-04 14:18:51 +01:00
Bernd Bestel
80d7284d72 Implemented calendar category colors (closes #2368) 2023-11-04 14:11:02 +01:00
Bernd Bestel
b3a5128dbd Pulled translations from Transifex 2023-11-04 13:26:58 +01:00
Bernd Bestel
7969145bbf Updated dependencies 2023-11-04 13:23:18 +01:00
Bernd Bestel
f01ca33c33 Optimized initial focus / workflow handling for recipeposform and shoppinglistitemform 2023-11-04 13:19:46 +01:00
Bernd Bestel
fdf5559c25 Fixed typo 2023-11-03 20:51:42 +01:00
Bernd Bestel
27f9d70b56 Implemented a way to use the external barcode lookup plugin also from within the frontend as a product picker workflow 2023-11-03 20:47:43 +01:00
Bernd Bestel
c9215a9a4e Added a workaround for the not working customRangeLabel option of the daterangepicker component (fixes #2353) 2023-10-04 16:46:24 +02:00
Bernd Bestel
69db4b558b Fixed typo 2023-10-01 21:43:28 +02:00
Bernd Bestel
35a4b75432 Added changelog for #2344 2023-09-19 18:08:36 +02:00
Chris Thorn
f36ad805b3 Optimize sidebar icon spacing (#2344)
* Update default.blade.php

Add `fa-fw` class to all side navigation icons to make them all fixed width

* Do this also for userentities

---------

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2023-09-19 18:07:30 +02:00
Bernd Bestel
35766bf5b3 Optimized CurrentVolatileStock handling (fixes #2341) 2023-09-15 17:24:29 +02:00
Bernd Bestel
3308e79027 Use bind params when copying a recipe (fixes #2337) 2023-09-15 13:58:57 +02:00
Bernd Bestel
1e60f940e4 Properly handle empty select-multiple userfield (fixes #2339) 2023-09-15 13:43:58 +02:00
Bernd Bestel
c8891236e6 Optimized meal plan weekRecipe handling (fixes #2333) 2023-09-05 21:07:38 +02:00
Bernd Bestel
b0d6e24bd4 Fixed consume page location dropdown handling (fixes #2328) 2023-09-02 10:17:43 +02:00
Bernd Bestel
b2295ce6d2 Prepared next release 2023-09-02 09:28:19 +02:00
Bernd Bestel
32ce04a1b7 Pulled translations from Transifex 2023-09-02 09:25:43 +02:00
Bernd Bestel
dfa3262426 Updated dependencies 2023-09-02 09:15:11 +02:00
Bernd Bestel
1f7580af3f Fixed GetCurrentStock caching 2023-09-02 09:12:37 +02:00
Bernd Bestel
60adda2b42 Optimized performance of CurrentVolatileStock 2023-09-01 18:11:36 +02:00
Bernd Bestel
387a5f7dd3 Move GetParsedAndFilteredRequestBody into BaseApiController 2023-09-01 17:58:02 +02:00
Bernd Bestel
f6bdb6e836 Added new Userfield type "Number (currency)" (closes #2276) 2023-09-01 17:48:46 +02:00
Bernd Bestel
82d899d609 Optimized DataTables state save handling performance 2023-09-01 17:04:11 +02:00
Bernd Bestel
fdbb8a045a Optimized performance of GetProductDetails 2023-09-01 17:03:22 +02:00
Bernd Bestel
07db1f35bc Cache multiple single-key user setting queries (closes #2323) 2023-09-01 17:02:36 +02:00
Bernd Bestel
dde577b98b Updated README 2023-09-01 17:00:50 +02:00
Bernd Bestel
5080d776a7 Only accept application/json requests for (JSON) API requests 2023-09-01 00:53:25 +02:00
Bernd Bestel
8c21969b84 Added changelog for PR #2322 2023-08-22 19:43:43 +02:00
Aleksandar Kuzmanoski
13e99d3f07 stock_current view now uses cached QUCs -> Recipes consume 50% faster (#2322)
* stock_current view now uses cache__quantity_unit_conversions_resolved -> Recipes consume 50% faster

* Adapted code style

---------

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2023-08-22 19:41:44 +02:00
Bernd Bestel
dedbee3181 Allow user editing in embedded (+ disabled authentication) mode (closes grocy/grocy-desktop#47) 2023-08-19 08:48:52 +02:00
Bernd Bestel
16f686deb8 Prepared next release 2023-08-19 08:24:52 +02:00
Bernd Bestel
973e4226b6 Pulled translations from Transifex 2023-08-19 08:18:36 +02:00
Bernd Bestel
6e22d3b100 Updated dependencies 2023-08-19 08:15:33 +02:00
Bernd Bestel
9b119da8e0 Merged the by @alkuzman contributed new quantity_unit_conversions_resolved view (closes #2297) 2023-08-19 08:13:34 +02:00
Bernd Bestel
03f9ba45ea Fixed initial product QU conversion handling (fixes #2312) 2023-08-16 17:05:18 +02:00
Bernd Bestel
a965d01fb9 Optimized server error display handling when consuming a recipe (closes #2310) 2023-08-15 18:51:40 +02:00
Bernd Bestel
a123535b0a Optimized locale number display handling (fixes #2309) 2023-08-15 09:35:40 +02:00
Bernd Bestel
3a2929c016 stockreports/spendings: Support grouping by store (closes #2308) 2023-08-14 18:12:40 +02:00
Bernd Bestel
106f25cc6b Fixed stock entry open button amount on /stockentries (fixes #2303) 2023-08-13 08:27:02 +02:00
Bernd Bestel
d6cc87ac86 More optimizations around edited stock entries handling (references #2292) 2023-08-13 00:27:37 +02:00
Bernd Bestel
a47bccab3f Added some comments to newest changed SQL views (references #2292) 2023-08-12 20:16:44 +02:00
Bernd Bestel
393a312186 More fixes regarding edited stock entries and calculating the products average price + price history (fixes #2292) 2023-08-12 18:08:12 +02:00
Bernd Bestel
7f21e2de34 Switched back to original gettext/gettext package
References https://github.com/php-gettext/Gettext/pull/289
2023-08-10 16:58:40 +02:00
Bernd Bestel
82ac996b3a Fixed typo 2023-08-09 22:36:50 +02:00
Bernd Bestel
827134c972 Changelog wording improvements 2023-08-09 22:34:30 +02:00
Bernd Bestel
787d5f11e0 Fixed dynamic manifest didn't work with enabled authentication 2023-08-09 21:00:35 +02:00
Bernd Bestel
2d2039f988 Fixed recipe cost/energy calculation (fixes #2301) 2023-08-08 17:59:10 +02:00
Bernd Bestel
268f0d8a50 Fixed typo 2023-08-08 09:43:17 +02:00
Bernd Bestel
9dde46d419 Changelog wording improvements 2023-08-07 22:13:47 +02:00
Bernd Bestel
162ba267a1 Changelog wording improvements 2023-08-07 22:12:00 +02:00
Bernd Bestel
4691b45510 Removed unnecessary calculation step in view uihelper_shopping_list (closes #2298) 2023-08-07 21:57:12 +02:00
Bernd Bestel
e2ebc037f2 Prepared next release 2023-08-06 15:29:28 +02:00
Bernd Bestel
550aa5565b Pulled translations from Transifex 2023-08-06 15:17:38 +02:00
Bernd Bestel
c105ebc979 Enabled Composer optimize-autoloader 2023-08-06 15:11:27 +02:00
Bernd Bestel
7ef744a995 Relate prices on the shopping to the there selected QU (closes #2294) 2023-08-06 14:31:38 +02:00
Bernd Bestel
ee4a082c74 Fixed handling of edited stock entries when calculating a product's average price (references #2292) 2023-08-06 14:05:35 +02:00
Bernd Bestel
1d7f7b2992 Cache expensive stock data calculations 2023-08-06 13:28:14 +02:00
Bernd Bestel
7689356a57 Changed manifest title 2023-08-06 09:28:41 +02:00
Bernd Bestel
1401ed5c00 Updated dependencies 2023-08-06 09:27:41 +02:00
Bernd Bestel
bae4a7f04c Added missing semicolon 2023-08-05 21:51:13 +02:00
Bernd Bestel
a44d746176 Fixed stock_edited_entries view (references #2292) 2023-08-05 21:44:22 +02:00
Bernd Bestel
3afb9643c4 Fix handling when there are no single edited stock entries at all (references #2292) 2023-08-05 18:28:49 +02:00
Bernd Bestel
61a3a4329b Unified edited stock transactions handling (fixes #2292) 2023-08-05 09:58:21 +02:00
Bernd Bestel
491ad8c791 Optimized indentation 2023-08-04 15:44:14 +02:00
Bernd Bestel
339a1ebffc Mention supported browsers in README 2023-08-04 15:41:44 +02:00
Bernd Bestel
1c35fecc85 Added the possibility to skip demo data generation in dev/demo/prerelease mode 2023-08-02 21:10:03 +02:00
Bernd Bestel
d006436d49 Upgraded PHP-CS-Fixer / applied optimized rules 2023-08-02 18:44:30 +02:00
Bernd Bestel
6c4cc00fd5 Added PHP 8.2 support 2023-08-01 21:23:59 +02:00
Bernd Bestel
847337443d Optimized /shoppinglist performance 2023-08-01 20:47:47 +02:00
Bernd Bestel
b74fbddd94 Use a dynamic (title / URL) manifest 2023-08-01 17:12:35 +02:00
Bernd Bestel
8b444a03e5 Simplified initial /mealplan start date handling (fixes #2286) 2023-07-31 21:29:28 +02:00
Bernd Bestel
e946ec79d5 Fixed typo 2023-07-31 18:27:53 +02:00
Bernd Bestel
ca740e8cee Improved product average shelf life calculation (references #2283) 2023-07-31 17:41:36 +02:00
Bernd Bestel
5d48b02b37 Added the possibility to log executed SQL statements (DEV mode only) 2023-07-31 17:08:55 +02:00
Bernd Bestel
73ad9d39ab Workaround for crap product specific QU conversions for migration 0207 (fixes #2285) 2023-07-31 16:58:41 +02:00
Bernd Bestel
fd7e24b7d1 Optimized StockService->GetProductDetails performance (fixes #2283) 2023-07-31 16:54:58 +02:00
Bernd Bestel
57ccb8645e Updated screenshots 2023-07-30 17:18:59 +02:00
Bernd Bestel
e8d6d455f4 grocy-desktop => Grocy Desktop 2023-07-29 21:17:59 +02:00
Bernd Bestel
f7c22ec384 Prepared next release 2023-07-29 14:44:48 +02:00
Bernd Bestel
98768bd846 Upgraded package swagger-ui-dist 2023-07-29 14:12:18 +02:00
Bernd Bestel
e52b1c5f60 Upgraded package php-di/php-di 2023-07-29 14:02:56 +02:00
Bernd Bestel
c263aba6a5 Updated dependencies 2023-07-29 14:00:24 +02:00
Bernd Bestel
edca302b71 Pulled translations from Transifex 2023-07-29 13:55:18 +02:00
Bernd Bestel
f6d6e933e3 Recalculate chore assignments when undoing an execution (fixes #2278) 2023-07-29 13:49:14 +02:00
Bernd Bestel
78e4e918c6 Added Estonian translation 2023-07-22 11:16:06 +02:00
Bernd Bestel
fa35d933e0 Pulled translations from Transifex 2023-07-22 11:00:45 +02:00
Bernd Bestel
9ae7c72e87 Unified calendar time format (closes #2266) 2023-07-05 21:30:00 +02:00
Bernd Bestel
c415e2f8da Fixed a (theoretical, not practically relevant for the target use case of Grocy) SQL injection possibility (closes #2259) 2023-06-22 15:07:47 +02:00
Bernd Bestel
297cc57244 Expose recipes_pos_resolved via the API (read only) (closes #2258) 2023-06-21 22:06:46 +02:00
Bernd Bestel
1496a58673 Show sidebar scroll bar only on hover (closes #2255) 2023-06-17 10:39:26 +02:00
Bernd Bestel
d05038e311 Exclude products with hide_on_stock_overview enabled in current stock info on /stockoverview (fixes #2250) 2023-06-08 22:15:33 +02:00
Bernd Bestel
de4c6e8b60 Renamed third party packages directories 2023-06-03 17:36:01 +02:00
Bernd Bestel
70bb014c9f Removed pre-release special version handling 2023-05-24 20:32:48 +02:00
Bernd Bestel
8c033ff6c8 Revert "Cache StockService->GetCurrentStock result"
This (partly) reverts commit bc5051351a.
2023-05-23 21:26:53 +02:00
Bernd Bestel
8c79cc4f8e Fixed new API key modal 2023-05-23 21:22:54 +02:00
Bernd Bestel
89c6d6683a Remove unused frontend package on /manageapikeys 2023-05-23 20:34:24 +02:00
Bernd Bestel
d0e0102752 API keys can now have a description 2023-05-23 20:31:51 +02:00
Bernd Bestel
bc5051351a Cache StockService->GetCurrentStock result 2023-05-23 17:34:38 +02:00
Bernd Bestel
08c1efa0ad Unified product-/chore-/battery-card modal handling 2023-05-23 17:32:54 +02:00
Bernd Bestel
2633d3d1a5 Fixed stock entry label info handling when the corresponding feature flag is disabled 2023-05-22 22:33:36 +02:00
Bernd Bestel
aec71bd408 Fixed typo 2023-05-22 22:09:20 +02:00
Bernd Bestel
10661706b9 Updated README 2023-05-22 22:08:32 +02:00
Bernd Bestel
2c0a71078f Fixed productcard opened amount display 2023-05-22 21:53:15 +02:00
Bernd Bestel
02fe3f2119 Show to amount of "Label per unit" stock entry labels (closes #2241) 2023-05-22 21:23:19 +02:00
Bernd Bestel
55adc140b2 Updated README 2023-05-21 20:41:06 +02:00
Bernd Bestel
04f362b723 Added a product context menu on /stockjournal (the same as on /stockoverview) (closes #2239) 2023-05-21 18:40:59 +02:00
Bernd Bestel
979c67b44c Various JS optimizations 2023-05-21 18:01:47 +02:00
Bernd Bestel
825321593b Optimized content spacing with collapsed sidebar 2023-05-21 17:33:40 +02:00
Bernd Bestel
99db10a490 Fixed <select> style 2023-05-21 14:47:37 +02:00
Bernd Bestel
2cba3ce7e9 Updated dependencies 2023-05-21 14:41:00 +02:00
Bernd Bestel
b53cdd4c42 Use minified files of packages (where available) 2023-05-21 14:29:19 +02:00
Bernd Bestel
cd7139c6cf Optmized imports 2023-05-21 14:19:01 +02:00
Bernd Bestel
c3dd1c4187 Cache routes 2023-05-21 14:13:05 +02:00
Bernd Bestel
89761ac141 Fixed syntax error 2023-05-21 14:12:43 +02:00
Bernd Bestel
f427849e89 Load all frontend packages conditionally 2023-05-21 10:56:38 +02:00
Bernd Bestel
d16d976d0b Simplified viewjs / active page handling 2023-05-20 18:20:30 +02:00
Bernd Bestel
ddf0ff0aef Various small layout adjustments 2023-05-20 11:03:13 +02:00
Bernd Bestel
fb57d9ef13 Fixed frontend translation with numbered arguments did not work (after upgrading gettext-translator) 2023-05-20 09:58:33 +02:00
Bernd Bestel
c43fe24e47 Changed font 2023-05-20 09:31:03 +02:00
Bernd Bestel
6ab5bc3a29 Optimized sidebar collapsed state / active nav handling 2023-05-19 21:14:57 +02:00
Bernd Bestel
ecb9f53bb4 Declare logo width 2023-05-19 20:59:03 +02:00
Bernd Bestel
6e3182884a Changed app icon background color 2023-05-19 19:23:50 +02:00
Bernd Bestel
ceb50774dc Adjusted README logo height 2023-05-19 18:12:50 +02:00
Bernd Bestel
5f65f2abd0 New logo 2023-05-19 18:08:26 +02:00
Bernd Bestel
49daed6c2b Upgraded some frontend dependencies 2023-05-19 17:23:32 +02:00
Bernd Bestel
628e779902 Moved sidebar / menu layout into own (customized) component 2023-05-19 15:12:11 +02:00
Bernd Bestel
99546815f9 Remove unneeded meta tags 2023-05-19 14:19:14 +02:00
Bernd Bestel
7ceba3c0c1 Updated README 2023-05-18 17:55:46 +02:00
Bernd Bestel
d03175f75a Added a separate QU for displaying prices (closes #2225) 2023-05-18 13:37:13 +02:00
Bernd Bestel
f4639c9bb2 Stream files directly from disk (instead of loading them completely in memory first) 2023-05-18 10:51:14 +02:00
Bernd Bestel
f6d77ac8d7 Pulled translations from Transifex 2023-05-18 10:44:17 +02:00
Bernd Bestel
d43f59d9a9 Updated README 2023-05-18 10:43:40 +02:00
Bernd Bestel
631f03e62c Optimized DataTables fixedOrder handling (fixes #2235) 2023-05-17 22:44:42 +02:00
Bernd Bestel
778cf847d3 Fixed more missing fields when copying a product (fixes #2231) 2023-05-17 21:10:14 +02:00
Shamshid
02a71a5edb fix syntax error (#2230) 2023-05-17 21:04:39 +02:00
Bernd Bestel
629333e1ab Fixed QU conversion factor selection (API) 2023-05-14 17:05:28 +02:00
Bernd Bestel
dd5bd3852a Optimized imports 2023-05-13 14:43:51 +02:00
Bernd Bestel
491412807c Fixed table column visibility selection 2023-05-13 14:28:50 +02:00
Bernd Bestel
9cdb0908d6 Make it possible to hide locations/stores/QUs/product_groups/task_categories (closes #2222) 2023-05-13 14:24:52 +02:00
Bernd Bestel
b5d3e68d68 Added a "today button" to the calendar (closes #2218) 2023-05-12 20:53:04 +02:00
Bernd Bestel
48564b5286 Fixed that default_consume_location_id wasn't copied on copying a product (fixes #2223) 2023-05-12 20:48:44 +02:00
Bernd Bestel
8bdb74a8e0 Optimized button click tooltip hide handling (fixes #2206) 2023-05-03 08:32:49 +02:00
Bernd Bestel
5ab31f726a Support dynamic "today" for MEAL_PLAN_FIRST_DAY_OF_WEEK (closes #2205) 2023-05-01 14:49:02 +02:00
Bernd Bestel
7ee79ec56c Fixed permission check when deleting API keys (fixes #2204) 2023-04-30 22:32:08 +02:00
Bernd Bestel
df4907f5d4 Fixed a theoretical (not relevant for SQLite) SQL injection possibility (references #2201) 2023-04-29 08:57:05 +02:00
Bernd Bestel
a4992ff602 Optimized purchase/inventory price hint / last price suggestion decimals handling 2023-04-24 18:17:39 +02:00
Bernd Bestel
f4874ed8d0 Prefill barcode note on /purchase and /inventory (closes #2193) 2023-04-17 19:54:24 +02:00
Bernd Bestel
84bd74a1bc Show the product card also on /products (closes #2185) 2023-04-13 20:36:21 +02:00
Bernd Bestel
16011b91c6 Added a filter option to only show currently out-of-stock products on /products (closes #2192) 2023-04-13 20:28:28 +02:00
Bernd Bestel
2bce428339 Fixed missing plural localization strings.pot
(Report from a translator on Transifex)
2023-04-12 09:06:39 +02:00
Bernd Bestel
a56de30268 Fixed /stockoverview "Min. stock amount" column sorting (fixes #2189) 2023-04-03 18:35:38 +02:00
Bernd Bestel
71d44edb8c Optimized week recipe handling in mealplan (fixes #2168) 2023-04-01 22:04:30 +02:00
Bernd Bestel
cc6b01de08 Added changelog for #2135 (also references #64) 2023-04-01 17:12:03 +02:00
Travis Raup
340832c361 Feature: Stock Purchase Metrics (#2135)
* Feature: Stock Purchase Metrics

* chart update

* Refactor to chartjs

* More suggestion edits

- locale in javascript
- global translations
- commit migrations sql file

* Rename 0215.sql to 0216.sql

Fixed merge conflict

* Fixed merge conflict

* Applied code style

* Added missing demo data translations

* Removed unused package "canvasjs"

* Don't include daterangepicker globally when only needed on a single page / fixed view section imports

* Rename this to "Spendings" / name it more generically "Stock reports"

* Reuse the existing product_price_history view

* Final cleanup

* Whitespace fix

---------

Co-authored-by: Travis Raup <travis.raup@platform.sh>
Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2023-04-01 17:05:41 +02:00
Bernd Bestel
98469248eb Optimized tracking button handling on /choresoverview (closes #2186) 2023-03-31 20:12:06 +02:00
Bernd Bestel
3d01854fa1 Don't use double quotes for SQL string literals (references #2170) 2023-03-16 21:16:27 +01:00
Bernd Bestel
756133a9eb Removed shopping list table fixed order (fixes #2167) 2023-03-16 18:52:41 +01:00
Bernd Bestel
1090f070c9 Optimized shopping list done items filter handling (fixes #2169) 2023-03-16 18:47:01 +01:00
Bernd Bestel
6857796ef0 Fixed produces product amount handling when consuming meal plan shadow recipes (references #2160) 2023-03-12 22:45:04 +01:00
Bernd Bestel
792c710bdc Fixed produces product handling when consuming meal plan shadow recipes (fixes #2160) 2023-03-12 16:35:18 +01:00
Bernd Bestel
7336693ca2 Optimized stock_missing_products view (fixes #2154) 2023-03-02 19:36:57 +01:00
Bernd Bestel
91700e7dae Fixed JS syntax error 2023-02-06 20:42:11 +01:00
Bernd Bestel
c9c0baefeb Optimized datetime Userfields handling (fixes #2108) 2023-02-06 20:36:26 +01:00
Bernd Bestel
b18bd2ff87 Fixed table dropdown menu overflow handling when columns are reordered (fixes #2130) 2023-02-06 20:25:51 +01:00
Bernd Bestel
d9667b4534 Removed type conversions where no longer needed
PHP 8.1 PDO SQLite now returns native data types
2023-02-06 20:22:10 +01:00
Bernd Bestel
d8d3c3ef0b Split the quick consume and open amount product option (closes #2127) 2023-02-05 20:37:39 +01:00
Bernd Bestel
b64d726c42 Added a new config option for energy unit display (closes #2109) 2023-02-05 15:55:45 +01:00
Bernd Bestel
0bd698c968 Print stock entry labels when consuming a "Produces product" recipe (closes #2123) 2023-02-05 15:24:28 +01:00
Bernd Bestel
9ef5045c9b Added changelog for #2118 2023-02-05 15:09:13 +01:00
Webysther Sperandio
902cb20710 Add Sub feature flag FEATURE_FLAG_RECIPES_MEALPLAN (#2118)
* Update routes.php

Added sub feature FEATURE_FLAG_RECIPES_MEALPLAN

* Update default.blade.php

Added sub feature flag FEATURE_FLAG_RECIPES_MEALPLAN

* Update SystemController.php

Added Sub feature flags FEATURE_FLAG_RECIPES_MEALPLAN

* Update config-dist.php

Sub feature flags FEATURE_FLAG_RECIPES_MEALPLAN

* Update routes.php

TYPO

* Code formatting / structure

---------

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2023-02-05 15:06:59 +01:00
Bernd Bestel
1e9a4d9590 Added Romanian translation 2023-02-05 14:55:23 +01:00
Bernd Bestel
5d7efebd40 Pulled translations from Transifex 2023-02-05 14:43:15 +01:00
Bernd Bestel
b9c58423a9 Updated dependencies 2023-02-05 14:40:25 +01:00
Bernd Bestel
efc7b999bb Fixed product average price/last price/price history chart handling regarding empty/0 prices (fixes #2106) 2023-01-13 13:19:22 +01:00
Bernd Bestel
995df64054 Support OFFSET without LIMIT in API query filters (closes #2105) 2023-01-12 13:32:12 +01:00
Bernd Bestel
a5788511e3 Optimized productform sticky footer spacing (fixes #2104) 2023-01-11 16:25:06 +01:00
Bernd Bestel
4e56dee6f0 Finalized "Auto reprint stock entry label" (closes #2092) 2023-01-05 20:12:15 +01:00
Bernd Bestel
3b160659f3 Typo 2023-01-05 18:28:57 +01:00
Bernd Bestel
83fa02d8ad Added an option to reprint stock entry labels when editing them (closes #2092) 2023-01-05 18:15:21 +01:00
Bernd Bestel
daf5ad33c7 Show recipe ingredients/preparation side by side in fullscreen mode (closes #2051) 2023-01-05 17:44:07 +01:00
Bernd Bestel
597abe236d AddMissingProductsToShoppingList also on adding/editing products (references #2094) 2023-01-04 22:54:12 +01:00
Bernd Bestel
0c8e8cab97 Revert "Refresh product/chore/battery card only when actually visible"
This reverts commit c934bfb7b3.
2023-01-04 20:06:19 +01:00
Bernd Bestel
f057ae7e06 Add note to barcode created by the workflow InplaceAddBarcodeToExistingProduct on /purchase and /inventory (closes #2093) 2023-01-04 19:56:55 +01:00
Bernd Bestel
c0fbc4adaf Fixed /stockoverview value column sort format (fixes #2088) 2023-01-01 20:33:08 +01:00
Bernd Bestel
efae0b193d Add amount to barcode created by the workflow InplaceAddBarcodeToExistingProduct on /purchase (closes #2085) 2022-12-29 11:21:33 +01:00
Bernd Bestel
c934bfb7b3 Refresh product/chore/battery card only when actually visible 2022-12-26 20:22:38 +01:00
Bernd Bestel
76500c57bd Optimize recipe ingredient costs/calories calculation when only_check_single_unit_in_stock is used (closes #780) 2022-12-26 19:48:26 +01:00
Bernd Bestel
3f2ad17460 Make it possible to add recipes from /recipes to the meal plan (closes #2003) 2022-12-26 14:25:33 +01:00
Luís Neto
c60a1783da Fix typo (conume -> consume) in 3.3.2 changelog (#2083) 2022-12-26 13:43:46 +01:00
Bernd Bestel
0585e80c70 Implemented "Default quantity unit consume" (closes #1845) 2022-12-26 11:11:55 +01:00
Bernd Bestel
39d1f49431 Fixed demo data generation 2022-12-26 10:12:29 +01:00
Bernd Bestel
2d62f8ddeb Automatically create a default (product specific 1 to 1) QU conversion when a product with qu_stock != qu_purchase was created and when no default QU conversion applies 2022-12-26 09:28:18 +01:00
Bernd Bestel
b76abf54ab Simplified qu_factor_purchase_to_stock handling 2022-12-26 09:20:41 +01:00
Bernd Bestel
337cbb73ee Added new .devtools script 2022-12-26 09:11:49 +01:00
Daniel Albert
79590cd5ac Add migration for improved quantity_unit_conversions_resolved view (#2082) 2022-12-26 09:06:17 +01:00
Bernd Bestel
383ac49919 Added note in README and Changelog about better performance when using a more recent SQLite version (references #2056) 2022-12-26 08:46:44 +01:00
Bernd Bestel
15f7ac3da0 Fixed required SQLite version in PrerequisiteChecker 2022-12-25 20:53:49 +01:00
Bernd Bestel
46c4cdb81a Return numbers as numbers on all API endpoints 2022-12-25 20:49:11 +01:00
Bernd Bestel
639ef0da5b Fixed PHP 8.1 deprecation notice 2022-12-25 20:35:25 +01:00
Bernd Bestel
0229d187ae Removed qu_factor_purchase_to_stock (migrated existing factors to normal product specific QU conversions) 2022-12-25 19:48:22 +01:00
Bernd Bestel
dea6f3f820 Replace also the unit when displaying a recipe ingredient with a variable amount (closes #2080) 2022-12-24 13:06:27 +01:00
Bernd Bestel
dd409b4bf9 Fixed consume amount calculation when consuming multiple substituted subproducts at once and when multiple/different conversion factors were involved (fixes #2076) 2022-12-21 21:00:49 +01:00
Bernd Bestel
407344e86a Fixed recipe ingredient costs/calories calculation when product substitution and unit conversions is involved at the same time (fixes #2075) 2022-12-21 20:16:22 +01:00
Bernd Bestel
f6e0ff11f1 Fixed column visibility handling when there is a shadow rowgroup column (fixes #2074) 2022-12-20 22:11:35 +01:00
Bernd Bestel
2ebb9b2cd9 Show product group Userfields on the shopping list (closes #2069) 2022-12-18 20:56:02 +01:00
Bernd Bestel
38a4ad8ec4 Upgraded to PHP 8.1 2022-12-10 15:19:11 +01:00
Bernd Bestel
84e3707f4f Optimized .devtools 2022-12-06 20:41:09 +01:00
Bernd Bestel
fce6458df6 Optimized modal dialog sizing 2022-12-04 21:59:20 +01:00
Bernd Bestel
018449c648 Added more demo QU conversions 2022-12-04 20:39:16 +01:00
Bernd Bestel
8175b1bcfe Simplified product specific QU display/edit and added more demo QU conversions 2022-12-04 20:25:33 +01:00
Bernd Bestel
c1dea5c254 Optimized /quantityunitconversionsresolved view 2022-12-04 19:52:48 +01:00
Bernd Bestel
50fac692ad Added a dialog to show product related resolved QU conversions (references #2056 and #1360) 2022-12-04 19:02:15 +01:00
Daniel Albert
d889e9d3ad Fix quantity_unit_conversions_resolved view (#2057)
This change makes the view work for products to which only default
conversions apply.
Before, they would not have appeared in the results.
2022-12-04 18:39:33 +01:00
Bernd Bestel
4be447fc60 Expose quantity_unit_conversions_resolved via the API (read only) (references #2056 and #1360) 2022-12-04 13:41:44 +01:00
Bernd Bestel
daa0a59c5f Support transitive QU conversions on the frontend (references #2056, closes #1360) 2022-12-04 13:12:01 +01:00
Bernd Bestel
df39f94fca Added changelog for #2056 2022-12-04 12:37:50 +01:00
Bernd Bestel
46313e2c75 Applied code formatting rules for #2056 2022-12-04 12:33:12 +01:00
Daniel Albert
541c0be6be Add support for transitive unit conversions (#2056)
* Add support for transitive unit conversions

* Rewrite quantity_unit_conversions_resolved view
2022-12-04 12:18:18 +01:00
Bernd Bestel
3b3212d101 Updated README + Changelog regarding supported PHP runtime info 2022-11-29 20:03:40 +01:00
Bernd Bestel
f03bb5eeee Optimized default consume location empty check (references #2053) 2022-11-28 17:58:30 +01:00
Bernd Bestel
6affa01f81 Added a "Clear done items" button to the shopping list (closes #1999) 2022-11-19 19:45:00 +01:00
Bernd Bestel
605ceb1b19 Fixed typos 2022-11-19 19:35:10 +01:00
Bernd Bestel
7d4a9602ab Return the battery object in endpoint /batteries (closes #2045) 2022-11-19 19:33:50 +01:00
Bernd Bestel
eb370dad1e Fixed changelog typo 2022-11-13 14:22:29 +01:00
598 changed files with 26796 additions and 8203 deletions

View File

@@ -0,0 +1,19 @@
<?php
// This is executed inside DatabaseMigrationService class/context
$db = $this->getDatabaseService()->GetDbConnection();
// Reset the password of the user "admin" to "admin"
$adminUserRow = $db->users()->where('username', 'admin')->fetch();
if ($adminUserRow == null)
{
$adminUserRow = $db->users()->createRow([
'username' => 'admin'
]);
}
$adminUserRow->update([
'password' => password_hash('admin', PASSWORD_DEFAULT)
]);

View File

@@ -1,4 +1,4 @@
pushd ..
call composer install
yarn install
call yarn install
popd

View File

@@ -1,4 +1,4 @@
pushd ..
call composer update
yarn upgrade
call yarn upgrade
popd

View File

@@ -1,7 +1,7 @@
---
name: Bug Report
about: If you've found something that does not work, please report it to help improve
grocy
Grocy
title: 'Bug: '
labels: bug
assignees: ''
@@ -18,5 +18,5 @@ Please make sure to:
Please also try to reproduce the problem on the pre-release demo: => https://demo-prerelease.grocy.info
- Use a private demo instance to make your example persistent
- If the problem is not reproducible there, it's most likely not a bug - please use the r/grocy subreddit for general questions / help: => https://www.reddit.com/r/grocy
- If the problem is not reproducible there, it's most likely not a bug - please use the r/grocy subreddit for general help and usage questions: => https://www.reddit.com/r/grocy
-->

View File

@@ -2,4 +2,4 @@ blank_issues_enabled: false
contact_links:
- name: Questions / Help
url: https://www.reddit.com/r/grocy
about: Please use the r/grocy subreddit for general questions / help
about: Please use the r/grocy subreddit for general help and usage questions

View File

@@ -11,7 +11,7 @@ assignees: ''
<!--
Please make sure to:
- Describe what you would find useful
- Describe what you would find useful as detailed as possible
- Check if your idea was maybe already requested by searching open requests here
- Keep it to one topic per request
-->

6
.github/SECURITY.md vendored
View File

@@ -1,5 +1,5 @@
grocy is not an enterprise application and neither one you (should) host publicly (means without authentication) on the internet.
Grocy is not an enterprise application and neither one you (should) host publicly (means without authentication) on the internet.
So unless something really bad can be abused _unauthenticated_, please just open a regular issue on the [Issue Tracker](https://github.com/grocy/grocy/issues/new/choose).
So unless something really bad can be abused _unauthenticated_, it's considered practically irrelevant for the target use case of Grocy and therefore not even worth reporting that.
You can also contact me directly, please see [berrnd.de](https://berrnd.de) for any contact information.
If you really think you've found something critical and valid for the target use case of Grocy and you feel the need to contact me privately on that, please see [berrnd.de](https://berrnd.de) for any contact information.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 KiB

After

Width:  |  Height:  |  Size: 476 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 170 KiB

6
.gitignore vendored
View File

@@ -1,5 +1,5 @@
/public/node_modules
/vendor
/.release
embedded.txt
.DS_Store
/.release
/packages
/public/packages

View File

@@ -1,11 +1,10 @@
<?php
$finder = PhpCsFixer\Finder::create()
->exclude(['vendor'])
->exclude(['packages'])
->ignoreVCSIgnored(true)
->files()->name('*.php')
->in(__DIR__)
;
->in(__DIR__);
$cfg = new PhpCsFixer\Config();
return $cfg
@@ -15,81 +14,41 @@ return $cfg
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
'class_attributes_separation' => true,
'class_attributes_separation' => ['elements' => ['const' => 'none', 'property' => 'none']],
'multiline_whitespace_before_semicolons' => false,
'single_quote' => true,
// 'blank_line_after_opening_tag' => true,
// 'blank_line_before_return' => true,
'braces' => [
'allow_single_line_closure' => true,
'position_after_anonymous_constructs' => 'same',
'position_after_control_structures' => 'next',
'position_after_functions_and_oop_constructs' => 'next',
'blank_line_after_opening_tag' => true,
'curly_braces_position' => [
'control_structures_opening_brace' => 'next_line_unless_newline_at_signature_end',
'anonymous_functions_opening_brace' => 'next_line_unless_newline_at_signature_end'
],
'control_structure_continuation_position' => [
'position' => 'next_line'
],
'cast_spaces' => [
'space' => 'none'
],
// 'cast_spaces' => true,
// 'class_definition' => array('singleLine' => true),
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => true,
'function_typehint_space' => true,
'type_declaration_spaces' => true,
'single_line_comment_style' => ['comment_types' => ['hash']],
'include' => true,
'lowercase_cast' => true,
// 'native_function_casing' => true,
// 'new_with_braces' => true,
// 'no_blank_lines_after_class_opening' => true,
// 'no_blank_lines_after_phpdoc' => true,
// 'no_empty_comment' => true,
// 'no_empty_phpdoc' => true,
// 'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
// 'no_mixed_echo_print' => array('use' => 'echo'),
'no_multiline_whitespace_around_double_arrow' => true,
// 'no_short_bool_cast' => true,
// 'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_around_offset' => true,
// 'no_trailing_comma_in_list_call' => true,
// 'no_trailing_comma_in_singleline_array' => true,
// 'no_unneeded_control_parentheses' => true,
// 'no_unused_imports' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
// 'normalize_index_brace' => true,
'object_operator_without_whitespace' => true,
// 'php_unit_fqcn_annotation' => true,
// 'phpdoc_align' => true,
// 'phpdoc_annotation_without_dot' => true,
// 'phpdoc_indent' => true,
// 'phpdoc_inline_tag' => true,
// 'phpdoc_no_access' => true,
// 'phpdoc_no_alias_tag' => true,
// 'phpdoc_no_empty_return' => true,
// 'phpdoc_no_package' => true,
// 'phpdoc_no_useless_inheritdoc' => true,
// 'phpdoc_return_self_reference' => true,
// 'phpdoc_scalar' => true,
// 'phpdoc_separation' => true,
// 'phpdoc_single_line_var_spacing' => true,
// 'phpdoc_summary' => true,
// 'phpdoc_to_comment' => true,
// 'phpdoc_trim' => true,
// 'phpdoc_types' => true,
// 'phpdoc_var_without_name' => true,
// 'pre_increment' => true,
// 'return_type_declaration' => true,
// 'self_accessor' => true,
// 'short_scalar_cast' => true,
'single_blank_line_before_namespace' => true,
// 'single_class_element_per_statement' => true,
// 'space_after_semicolon' => true,
// 'standardize_not_equals' => true,
'blank_lines_before_namespace' => true,
'ternary_operator_spaces' => true,
// 'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true,
'no_trailing_comma_in_singleline' => true
])
->setIndent("\t")
->setLineEnding("\n")
->setUsingCache(false)
->setFinder($finder)
;
->setFinder($finder);

View File

@@ -1,4 +1,4 @@
--modules-folder public/node_modules
--modules-folder public/packages
--install.production true
--install.ignore-scripts true
--install.ignore-optional true

View File

@@ -1,7 +1,10 @@
-----
<div align="center">
<img alt="Logo" height="50" src="https://raw.githubusercontent.com/grocy/grocy/master/public/img/grocy_logo.svg?sanitize=true" />
<h3>ERP beyond your fridge</h3>
<h4>grocy is a web-based self-hosted groceries & household management solution for your home<br>Created by <a href="https://github.com/berrnd">@berrnd</a></h4>
<img alt="Logo" height="50" src="https://raw.githubusercontent.com/grocy/grocy/master/public/img/logo.svg?sanitize=true" />
<h2>ERP beyond your fridge</h2>
<h3>Grocy is a web-based self-hosted groceries & household management solution for your home</h3>
<em><h4>This is a hobby project by <a href="https://berrnd.de">Bernd Bestel</a></h4></em>
</div>
-----
@@ -11,12 +14,16 @@
- Public demo of the latest stable version (`release` branch) &rarr; [https://demo.grocy.info](https://demo.grocy.info)
- Public demo of the current development version (`master` branch) &rarr; [https://demo-prerelease.grocy.info](https://demo-prerelease.grocy.info)
## Features
See the website. &rarr; <https://grocy.info>
## Questions / Help / Bug Reports / Feature Requests
- General help and usage questions &rarr; [r/grocy subreddit](https://www.reddit.com/r/grocy)
- Bug Reports and Feature Requests &rarr; [Issue Tracker](https://github.com/grocy/grocy/issues/new/choose)
_Please don't send me private messages or call me regarding grocy help. I check the issue tracker and the subreddit pretty much daily, but don't provide grocy support beyond that._
_Please don't send me private messages or call me regarding anything Grocy. I check the issue tracker and the subreddit pretty much daily, but don't provide any support beyond that._
## Community contributions
@@ -24,13 +31,11 @@ See the website for a list of community contributed Add-ons / Tools. &rarr; [htt
## How to install
> Checkout [grocy-desktop](https://github.com/grocy/grocy-desktop), if you want to run grocy without having to manage a webserver just like a normal (Windows) desktop application.
> Checkout [Grocy Desktop](https://github.com/grocy/grocy-desktop), if you want to run Grocy without having to manage a webserver just like a normal (Windows) desktop application.
>
> Directly download the [latest release](https://releases.grocy.info/latest-desktop) - the installation is nothing more than just clicking 2 times "next".
See the website for some installation guides and troubleshooting help. &rarr; [https://grocy.info/links](https://grocy.info/links)
grocy is technically a pretty simple PHP application, so the basic notes to get it running are:
Grocy is technically a pretty simple PHP application, so the basic notes to get it running are:
- Unpack the [latest release](https://releases.grocy.info/latest)
- Copy `config-dist.php` to `data/config.php` + edit to your needs
- Ensure that the `data` directory is writable
@@ -38,9 +43,17 @@ grocy is technically a pretty simple PHP application, so the basic notes to get
- Include `try_files $uri /index.php$is_args$query_string;` in your location block if you use nginx
- Or disable URL rewriting (see the option `DISABLE_URL_REWRITING` in `data/config.php`)
- &rarr; Default login is user `admin` with password `admin`, please change the password immediately (user menu at the top right corner)
- _Currently everything is only tested against (means 100 % works with) PHP 8.0 with SQLite 3.27.2_
Alternatively clone this repository (the `release` branch always references the latest released version, or checkout the latest tagged revision) and install Composer and Yarn dependencies manually.
Alternatively clone this repository (the `release` branch always references the latest released version) and install Composer and Yarn dependencies manually.
See the website for more installation guides and troubleshooting help. &rarr; [https://grocy.info/links](https://grocy.info/links)
### Platform support
- PHP 8.2 or 8.3 (with SQLite 3.34.0+)
- Required PHP extensions: `fileinfo`, `pdo_sqlite`, `gd`, `ctype`, `intl`, `zlib`, `mbstring`
- _Recommendation: Benchmark tests showed that e.g. unit conversion handling is up to 5 times faster when using a more recent (3.39.4+) SQLite version._
- Recent Firefox, Chrome or Edge
## How to run using Docker
@@ -53,13 +66,13 @@ See [grocy/grocy-docker](https://github.com/grocy/grocy-docker) or [linuxserver/
- Empty the `data/viewcache` directory
- Visit the main route once to apply database migrations ([see below](https://github.com/grocy/grocy#database-migrations))
If you run grocy on Linux, there is also `update.sh` (remember to make the script executable (`chmod +x update.sh`) and ensure that you have `unzip` installed) which does exactly this and additionally creates a backup (`.tgz` archive) of the current installation in `data/backups` (backups older than 60 days will be deleted during the update).
If you run Grocy on Linux, there is also `update.sh` (remember to make the script executable (`chmod +x update.sh`) and ensure that you have `unzip` installed) which does exactly this and additionally creates a backup (`.tgz` archive) of the current installation in `data/backups` (backups older than 60 days will be deleted during the update).
## Localization
grocy is fully localizable - the default language is English (integrated into code), a German localization is always maintained by me.
Grocy is fully localizable - the default language is English (integrated into code), a German localization is always maintained by me.
You can easily help translating grocy on [Transifex](https://www.transifex.com/grocy/grocy/dashboard/) if your language is incomplete or not available yet.
You can easily help translating Grocy on [Transifex](https://www.transifex.com/grocy/grocy/dashboard/) if your language is incomplete or not available yet.
The default language can be set in `data/config.php`, e. g. `Setting('DEFAULT_LOCALE', 'it');` and there is also a user setting (see the user settings page) to set a different language per user.
@@ -71,7 +84,7 @@ _RTL languages are unfortunately not yet supported._
## Motivation
A household needs to be managed. I did this so far (almost 10 years) with my first self written software (a C# Windows forms application) and with a bunch of Excel sheets. The software was a pain to use at the end and Excel is Excel. So I searched for and tried different things for a (very) long time, nothing 100 % fitted, so this is my aim for a "complete household management"-thing. ERP your fridge!
A household needs to be managed. Before Grocy I did this (for almost 10 years) using my first self written software (a C# Windows forms application) and with a bunch of Excel sheets. The software was a pain to use at the end and Excel is Excel. So I searched for and tried different things for a (very) long time, nothing 100 % fitted, so this is my aim for a "complete household management"-thing. ERP your fridge!
## Things worth to know
@@ -79,11 +92,13 @@ A household needs to be managed. I did this so far (almost 10 years) with my fir
See the integrated Swagger UI instance on [/api](https://demo.grocy.info/api).
The web frontend uses exactly this API for pretty much everything. So everything you can do there is also possible via the API.
### Barcode readers & camera scanning
Some fields (with a barcode icon above) also allow to select a value by scanning a barcode. It works best when your barcode reader prefixes every barcode with a letter which is normally not part of a item name (I use a `$`) and sends a `TAB` after a scan.
Additionally it's also possible to use your device camera to scan a barcode by using the camera button on the right side of the corresponding field (powered by [Quagga2](https://github.com/ericblade/quagga2), totally offline / client-side camera stream processing, please note due to browser security restrictions, this only works when serving grocy via a secure connection (`https://`)). Quick video demo: https://www.youtube.com/watch?v=Y5YH6IJFnfc
Additionally it's also possible to use your device camera to scan a barcode by using the camera button on the right side of the corresponding field (powered by [Quagga2](https://github.com/ericblade/quagga2), totally offline / client-side camera stream processing, please note due to browser security restrictions, this only works when serving Grocy via a secure connection (`https://`)). Quick video demo: <https://www.youtube.com/watch?v=Y5YH6IJFnfc>
_My personal recommendation: Use a USB barcode laser scanner. They are cheap and work 1000 % better, faster, under any lighting condition and from any angle._
@@ -92,12 +107,12 @@ _My personal recommendation: Use a USB barcode laser scanner. They are cheap and
For (productivity) reasons all date (and time) input (and display) fields use the ISO-8601 format regardless of localization.
The following shorthands are available:
- `MMDD` gets expanded to the given day on the current year, if > today, or to the given day next year, if < today, in proper notation
- Example: `0517` will be converted to `2021-05-17`
- Example: `0517` will be converted to `2024-05-17`
- `YYYYMMDD` gets expanded to the proper ISO-8601 notation
- Example: `20210417` will be converted to `2021-04-17`
- Example: `20240417` will be converted to `2024-04-17`
- `YYYYMMe` or `YYYYMM+` gets expanded to the end of the given month in the given year in proper notation
- Example: `202107e` will be converted to `2021-07-31`
- `[+/-]n[d/m/y]` gets expanded to a date relative to today, while adding (**+**) or subtracting (**-**) the **n**umber of**d**ays/**m**onths/**y**ears, in proper notation
- Example: `202407e` will be converted to `2024-07-31`
- `[+/-]n[d/m/y]` gets expanded to a date relative to today, while adding (**+**) or subtracting (**-**) the **n**umber of **d**ays/**m**onths/**y**ears, in proper notation
- Example: `+1m` will be converted to the same day next month
- `x` gets expanded to `2999-12-31` (which is an alias for "never overdue")
- Down/up arrow keys will increase/decrease the date by 1 day
@@ -113,18 +128,20 @@ Example: Button "**P** Add as new product" can be "pressed" by using the `P` key
### Barcode lookup via external services
Products can be directly added to the database via looking them up against external services by a barcode.
This is currently only possible through the REST API.
There is no plugin included for any service, see the reference implementation in `data/plugins/DemoBarcodeLookupPlugin.php`.
### Database migrations
Database schema migration is automatically done when visiting the root (`/`) route (click on the logo in the left upper edge).
_Please note: Database migrations are supposed to work between releases, not between every commit. If you want to run the current `master` branch (which is the development version), however, you need to handle that (and maybe more) yourself._
_Please note: Database migrations are supposed to work between releases, not between every commit. If you want to run the current `master` branch (which is the development version), you need to handle that (and more) yourself._
### Disable certain features
If you don't use certain feature sets of grocy (for example if you don't need "Chores"), there are feature flags per major feature set to hide/disable the related UI elements (see `config-dist.php`).
If you don't use certain feature sets of Grocy (for example if you don't need "Chores"), there are feature flags per major feature set to hide/disable the related UI elements (see `config-dist.php`).
### Adding your own CSS or JS without to have to modify the application itself
@@ -133,24 +150,24 @@ If you don't use certain feature sets of grocy (for example if you don't need "C
### Demo mode
When the `MODE` setting is set to `dev`, `demo` or `prerelease`, the application will work in a demo mode which means authentication is disabled and some demo data will be generated during the database schema migration.
When the `MODE` setting is set to `dev`, `demo` or `prerelease`, the application will work in a demo mode which means authentication is disabled and some demo data will be generated during the database schema migration (pass the query parameter `nodemodata`, e.g. `https://grocy.example.com/?nodemodata` to skip that).
### Embedded mode
When the file `embedded.txt` exists, it must contain a valid and writable path which will be used as the data directory instead of `data` and authentication will be disabled (used in [grocy-desktop](https://github.com/grocy/grocy-desktop)).
When the file `embedded.txt` exists, it must contain a valid and writable path which will be used as the data directory instead of `data` and authentication will be disabled (used in [Grocy Desktop](https://github.com/grocy/grocy-desktop)).
In embedded mode, settings can be overridden by text files in `data/settingoverrides`, the file name must be `<SettingName>.txt` (e. g. `BASE_URL.txt`) and the content must be the setting value (normally one single line).
## Contributing / Say Thanks
Any help is more than appreciated. Feel free to pick any open unassigned issue and submit a pull request, but please leave a short comment or assign the issue yourself, to avoid working on the same thing.
See https://grocy.info/#say-thanks for more ideas if you just want to say thanks.
Any help is welcome, feel free to contribute anything which comes to your mind or see <https://grocy.info/#say-thanks> if you just want to say thanks.
## Roadmap
There is none. The progress of a specific bug/enhancement is always tracked in the corresponding issue, at least by commit comment references.
[Milestones](https://github.com/grocy/grocy/milestones) are used to indicate in which version the corresponding request was done (`vNEXT` means it's currently planned to do that for the next release).
## Screenshots
### Stock overview

20
app.php
View File

@@ -1,14 +1,15 @@
<?php
use Grocy\Controllers\LoginController;
use Grocy\Controllers\ExceptionController;
use Grocy\Helpers\UrlManager;
use Grocy\Middleware\LocaleMiddleware;
use Grocy\Middleware\CorsMiddleware;
use Psr\Container\ContainerInterface as Container;
use Slim\Factory\AppFactory;
use Slim\Views\Blade;
// Load composer dependencies
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/packages/autoload.php';
// Load config files
require_once GROCY_DATAPATH . '/config.php';
@@ -61,15 +62,18 @@ AppFactory::setContainer(new DI\Container());
$app = AppFactory::create();
$container = $app->getContainer();
$container->set('view', function (Container $container) {
$container->set('view', function (Container $container)
{
return new Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache');
});
$container->set('UrlManager', function (Container $container) {
$container->set('UrlManager', function (Container $container)
{
return new UrlManager(GROCY_BASE_URL);
});
$container->set('ApiKeyHeaderName', function (Container $container) {
$container->set('ApiKeyHeaderName', function (Container $container)
{
return 'GROCY-API-KEY';
});
@@ -84,7 +88,7 @@ if (!empty(GROCY_BASE_PATH))
if (GROCY_MODE === 'production' || GROCY_MODE === 'dev')
{
$app->add(new \Grocy\Middleware\LocaleMiddleware($container));
$app->add(new LocaleMiddleware($container));
}
else
{
@@ -97,10 +101,12 @@ $app->add(new $authMiddlewareClass($container, $app->getResponseFactory()));
$app->addRoutingMiddleware();
$errorMiddleware = $app->addErrorMiddleware(true, false, false);
$errorMiddleware->setDefaultErrorHandler(
new \Grocy\Controllers\ExceptionController($app, $container)
new ExceptionController($app, $container)
);
$app->add(new CorsMiddleware($app->getResponseFactory()));
$app->getRouteCollector()->setCacheFile(GROCY_DATAPATH . '/viewcache/route_cache.php');
ob_clean(); // No response output before here
$app->run();

View File

@@ -1 +1 @@
- grocy is now fully localizable and ships by default with English and German translations
- Grocy is now fully localizable and ships by default with English and German translations

View File

@@ -1,3 +1,3 @@
- Upgraded Bootstrap and some other dependencies (grocy now looks even better!)
- Upgraded Bootstrap and some other dependencies (Grocy now looks even better!)
- Added Italian translation (thanks @davidoskky)
- => Demo for this language available at: https://it.demo.grocy.info

View File

@@ -1,5 +1,5 @@
This was released shortly after the last release to fix a small regression bug, original changes from Version 1.13.0:
- Upgraded Bootstrap and some other dependencies (grocy now looks even better!)
- Upgraded Bootstrap and some other dependencies (Grocy now looks even better!)
- Added Italian translation (thanks @davidoskky)
- => Demo for this language available at: https://it.demo.grocy.info

View File

@@ -10,4 +10,4 @@
- Sidebar collapse state is now remembered
- Fixed datetimepicker border
- 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/berrnd/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)

View File

@@ -1,9 +1,9 @@
- New related project: **grocy-desktop**
- => https://github.com/berrnd/grocy-desktop
- 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/berrnd/grocy#embedded-mode)
- => https://github.com/grocy/grocy-desktop
- 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 datepicker shorthands and improvements
- `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
- [see README](https://github.com/berrnd/grocy#input-shorthands-for-date-fields)
- [see README](https://github.com/grocy/grocy#input-shorthands-for-date-fields)
- Some other small bug fixes

View File

@@ -2,7 +2,7 @@
- The currently defined user will automatically be migrated, please remove `HTTP_USER` and `HTTP_PASSWORD` from your config file afterwards
- For this it was necessary to delete all sessions and API keys during the migration
- Added an update script (`/update.sh`) to make updates (on Linux machines) easier
- See also ["How to update" in README](https://github.com/berrnd/grocy#how-to-update)
- See also ["How to update" in README](https://github.com/grocy/grocy#how-to-update)
- Added the possibility to track who did a habit
- Added a rudimentary habit analysis possibility
- Different small UI, code and translation improvements

View File

@@ -2,5 +2,5 @@
- Manage all your household equipment/devices in one place and have the information/instruction manual at hand when needed
- New feature: Products can now have pictures
- Add them in the product edit page
- Will be shown in the productcard (purchase/consume/etc. pages) and when you click the product name on the stock overview page (a little image icon next to the product name indicates if the product has an image)
- Will be shown in the product card (purchase/consume/etc. pages) and when you click the product name on the stock overview page (a little image icon next to the product name indicates if the product has an image)
- Recipes and the new equipment edit page now have a little editor with text formatting capabilities

View File

@@ -19,5 +19,5 @@
- Other improvements
- The calendar can now be shared/integrated in iCal format (button in the header on the calendar page)
- Added feature flags to hide/disable certain parts of grocy when you don't use them (for example hide "Chores" and all related UI elements, when you don't use it, see `config-dist.php`)
- Added a "Apple Touch Icon" and a "Web App Manifest" which should improve grocy on mobile devices and also enables "Add to Home screen" on major mobile browsers
- Added a "Apple Touch Icon" and a "Web App Manifest" which should improve Grocy on mobile devices and also enables "Add to Home screen" on major mobile browsers
- A lot of other minor small and bigger UI improvements

View File

@@ -29,6 +29,6 @@
- Also applies to quantity units, n-plural forms can be entered on the quantity unit edit page
- It's not required to install the PHP gettext extension, on both, server and client, managed implementations of gettext are used ([oscarotero/Gettext](https://github.com/oscarotero/Gettext) & [oscarotero/gettext-translator](https://github.com/oscarotero/gettext-translator))
- Some other small fixes and improvements
- The "Add as barcode to existing product" productpicker workflow failed to add the barcode to the given product
- The "Add as barcode to existing product" product picker workflow failed to add the barcode to the given product
- Recipes can now be filter by stock availability
- Added a feature flag (`config.php` setting) to also be able to hide all stock related UI elements and routes

View File

@@ -2,7 +2,7 @@
- Fixed a problem that the user settings were not properly initialized for the frontend JS part when not logged only (so potentially affected only the login page)
- Fixed an issue that the shopping list did not load when a plural translation for a quantity unit was missing
- Fixed that tooltips were visible forever when consuming all products on the stock overview page
- Fixed that login did not work when "Stay logged in permanently" was set and grocy runs on a 32-bit system (thanks @matejdro)
- Fixed that login did not work when "Stay logged in permanently" was set and Grocy runs on a 32-bit system (thanks @matejdro)
- Fixed page reloads when "Auto reload on external changes" is enabled and there is unsaved form data (the detection did not work for forms in modal dialogs, e. g. when adding a entry to the meal plan)
- Fixed (again) that the product picker did not work properly when the product name contains single quotes
- Fixed that a entered barcode on the product edit page was only saved when "adding" it to the barcodes list by pressing `TAB` (is now automatically added to the list also when just leaving the field)

View File

@@ -1,12 +1,13 @@
### New feature: Custom entities / objects / lists
- Custom entities are based on Userfields and can be used to add any custom lists you want to have in grocy
- Custom entities are based on Userfields and can be used to add any custom lists you want to have in Grocy
- They can have an own menu entry in the sidebar
- => See "Manage master data" -> "Userentities" or try it on the demo: https://demo.grocy.info/userobjects/exampleuserentity
### New feature: Use the device camera for barcode scanning
- Available on any barcode-enabled field (so currently only for picking products) - a new camera button at the right of side the text field
- Implemented using [QuaggaJS](https://github.com/serratus/quaggaJS) - camera stream processing happens totally offline / client-side
- Please note due to browser security restrictions, this only works when serving grocy via a secure connection (`https://`)
- Please note due to browser security restrictions, this only works when serving Grocy via a secure connection (`https://`)
- There is also a `config.php` setting `DISABLE_BROWSER_BARCODE_CAMERA_SCANNING` to disable this, if you don't need it at all (defaults to `false`)
- I you have problems that barcodes are not recognized properly, there is a little "barcode scanner testing page" at [/barcodescannertesting](https://demo.grocy.info/barcodescannertesting)
- => Quick video demo: https://www.youtube.com/watch?v=Y5YH6IJFnfc
@@ -20,7 +21,7 @@
- Quantity units can now be linked (related measurements / unit conversion)
- On the quantity unit edit page default conversion can be defined for each unit
- Products "inherit" the default conversion and additionally can have their own / override the default ones
- It's now possible to print a "Location Content Sheet" with the current stock per location - new button at the top of the stock overview page (thought to hang it at the location, note used amounts on paper and track it in grocy later)
- It's now possible to print a "Location Content Sheet" with the current stock per location - new button at the top of the stock overview page (thought to hang it at the location, note used amounts on paper and track it in Grocy later)
- Stock overview page improvements
- Options in the more/context-menu to directly open the purchase/consume/inventory pages prefilled with the current product in a popup/dialog
- Option in the more/context-menu to add the current product directly to a shopping list
@@ -104,4 +105,4 @@
- It's now also possible to provide the API key via a query parameter (same name as the header, so `GROCY-API-KEY`)
#### Say thanks
Because there were some questions about that in the past: If grocy is useful for you, [say thanks](https://grocy.info/#say-thanks)!
Because there were some questions about that in the past: If Grocy is useful for you, [say thanks](https://grocy.info/#say-thanks)!

View File

@@ -27,12 +27,12 @@
- There is also a new sub feature flag `FEATURE_FLAG_STOCK_PRODUCT_FREEZING` to disable this if you don't need it (defaults to `true`)
### Stock improvements/fixes
- The productcard gets now also refreshed after a transaction was posted (purchase/consume/etc.) (thanks @kriddles)
- The product card gets now also refreshed after a transaction was posted (purchase/consume/etc.) (thanks @kriddles)
- The product field calories (kcal) now also allows decimal numbers
- On the inventory page, "New amount" is now prefilled with the current stock amount of the selected product
- Fixed that entering partial amounts was not possible on the inventory page (only applies if the product option "Allow partial units in stock" is enabled)
- Fixed that on purchase a wrong minimum amount was enforced for products with enabled tare weight handling in combination with different purchase/stock quantity units
- Fixed that the productcard did not load correctly when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was set to `false` (thanks @kriddles)
- Fixed that the product card did not load correctly when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was set to `false` (thanks @kriddles)
- Fixed that the "Add as barcode to existing product" workflow did not work twice when not switching the page inbetween
### Shopping list improvements/fixes

View File

@@ -1,5 +1,5 @@
## !! Important notice
If you run grocy in a subdirectory, you need to set a new `config.php` setting (`BASE_PATH`, see `config-dist.php`)
If you run Grocy in a subdirectory, you need to set a new `config.php` setting (`BASE_PATH`, see `config-dist.php`)
### Stock fixes
- Fixed purchase/consume/inventory problems when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was set to `false`

View File

@@ -4,7 +4,7 @@
>
> [Here](https://github.com/grocy/grocy/issues/1209#issuecomment-749760765) is a workaround if you still run a SQLite version >= 3.8.3 < 3.9.0
>
> _PHP 7.2 with SQLite 3.8.3 was the formerly in [README mentioned](https://github.com/grocy/grocy#how-to-install) minimum runtime requirement, any future release will only be tested against a reasonable recent runtime (currently PHP 7.4 with SQLite 3.27.2) - supporting those (very) old runtime stuff is too time consuming..._
> _PHP 7.2 (with SQLite 3.8.3+) was the formerly minimum runtime requirement, any future release will only support PHP 7.4 (with SQLite 3.27.2+) - supporting those (very) old runtime stuff is too time consuming..._
> ❗ If some pages/tables doesn't load at all, please check that your `/data/config.php` setting `CURRENCY` is a valid ISO 4217 currency code - that's most probably the issue then.
@@ -31,10 +31,10 @@
- New `config.php` setting `AUTH_CLASS` to change the used authentication provider
- Via LDAP
- New `config.php` settings `LDAP_DOMAIN`, `LDAP_ADDRESS` and `LDAP_BASE_DN`
- If you set `AUTH_CLASS` to `Grocy\Middleware\LdapAuthMiddleware`, users will be authenticated against your directory (and will also be created (in grocy), if not already present)
- If you set `AUTH_CLASS` to `Grocy\Middleware\LdapAuthMiddleware`, users will be authenticated against your directory (and will also be created (in Grocy), if not already present)
- Via a reverse proxy
- New `config.php` setting `REVERSE_PROXY_AUTH_HEADER`
- If you set `AUTH_CLASS` to `Grocy\Middleware\ReverseProxyAuthMiddleware` and your reverse proxy sends a username in the HTTP header `REMOTE_USER` (header name can be changed by the setting `REVERSE_PROXY_AUTH_HEADER`), the user is automatically authenticated (and will also be created (in grocy), if not already present)
- If you set `AUTH_CLASS` to `Grocy\Middleware\ReverseProxyAuthMiddleware` and your reverse proxy sends a username in the HTTP header `REMOTE_USER` (header name can be changed by the setting `REVERSE_PROXY_AUTH_HEADER`), the user is automatically authenticated (and will also be created (in Grocy), if not already present)
- (Thanks @fipwmaqzufheoxq92ebc for the initial work on this)
### Stock improvements/fixes
@@ -174,7 +174,7 @@
- Products, quantity units and product groups are possible to use now
- Means you can use for example the shopping list, recipes and the meal plan with products while the "stock handling part" is hidden
- Ordering now happens case-insensitive
- The data path (previously fixed to the `data` folder) is now configurable, making it possible to run multiple grocy instances from the same directory (with different `config.php` files / different database, etc.) (thanks @fgrsnau)
- The data path (previously fixed to the `data` folder) is now configurable, making it possible to run multiple Grocy instances from the same directory (with different `config.php` files / different database, etc.) (thanks @fgrsnau)
- Via an environment variable `GROCY_DATAPATH` (higher priority)
- Via an FastCGI parameter `GROCY_DATAPATH` (lower priority)
- The language can now be set per user (see the new user settings page / top right corner settings menu) (thanks @fipwmaqzufheoxq92ebc)

View File

@@ -2,7 +2,7 @@
>
> [Here](https://github.com/grocy/grocy/issues/1209#issuecomment-749760765) is a workaround if you still run a SQLite version >= 3.8.3 < 3.9.0
>
> _PHP 7.2 with SQLite 3.8.3 was the formerly in [README mentioned](https://github.com/grocy/grocy#how-to-install) minimum runtime requirement, any future release will only be tested against a reasonable recent runtime (currently PHP 7.4 with SQLite 3.27.2) - supporting those (very) old runtime stuff is too time consuming..._
> _PHP 7.2 (with SQLite 3.8.3+) was the formerly minimum runtime requirement, any future release will only support PHP 7.4 (with SQLite 3.27.2+) - supporting those (very) old runtime stuff is too time consuming..._
- Improved the prerequisites checker (added missing required PHP extension `ctype`) (thanks @Forceu)
- Added validation checks for most `data/config.php` settings to prevent using invalid ones (thanks @Forceu)

View File

@@ -1,8 +1,9 @@
> ⚠️ The following PHP extensions are now additionally required: `json`, `intl`, `zlib`
> ⚠️ PHP 8 is now supported and from now on the only tested runtime version (although currently PHP 7.2 should still work).
> ⚠️ PHP 8.0 (with SQLite 3.27.2+) is from now on the only supported runtime version.
### New feature: Grocycode / label printer support
### New feature: grocycode / label printer support
#### (Own) Product/stock entry/chores/batteries labels/barcodes
- Print own labels/barcodes for products/stock entries/chores/batteries and then scan that code on every place a product/stock entry/chore/battery can be selected
- Can be printed (or downloaded) via
@@ -27,7 +28,7 @@
### New feature: Shopping list thermal printer support
- The shopping list can now be printed on a thermal printer
- The printer must be compatible to the `ESC/POS` protocol and needs to be locally attached or network reachable to/by the machine hosting grocy (so the server)
- The printer must be compatible to the `ESC/POS` protocol and needs to be locally attached or network reachable to/by the machine hosting Grocy (so the server)
- See the new `TPRINTER*` `config.php` options to configure the printer connection and other options
- => New button on the shopping list print dialog
- Can be enabled via the new feature flag `FEATURE_FLAG_THERMAL_PRINTER` (defaults to disabled)
@@ -37,7 +38,7 @@
- Product barcodes are now enforced to be unique across products
- On the stock overview page it's now also possible to search/filter by product barcodes (via the general search field)
- The product picker on the consume and transfer page now only shows products which are currently in stock
- Added a filter option to only show in-stock products on the stock overview and products list (master data) page
- Added a filter option to only show currently in-stock products on the stock overview and products list (master data) page
- Added new columns on the stock overview page (hidden by default): Product description, product default location, parent product, product picture
- Added a new product option "Should not be frozen" (defaults to disabled and only visible when `FEATURE_FLAG_STOCK_PRODUCT_FREEZING` is enabled)
- When enabled, on moving the product to a freezer location (so when freezing it), a corresponding warning will be shown
@@ -63,7 +64,7 @@
- Fixed the form validation on the shopping list item page (thanks @Forceu)
- Fixed that when adding products to the shopping list from the stock overview page, the used quantity unit was always the products default purchase QU (and not the selected one)
- Fixed that the displayed last unit/total price was wrong when the used quantity unit was not the products stock QU
- Fixed that the "Add as barcode to existing product" productpicker workflow did not work
- Fixed that the "Add as barcode to existing product" product picker workflow did not work
### Recipe improvements/fixes
- Recipe printing improvements (thanks @Ape)

View File

@@ -3,7 +3,7 @@
- More information on this: Only 1 level is currently supported; creating > 1 level nestings was _never_ possible via the UI/frontend, but not checked/enforced by the backend before `v3.0.0` - so it was potentially possible via the API (or any third party app/tool which utilizes it) to create such a nesting which then made this upgrade to fail
- Fixed that it was not possible to select a chore/battery on the corresponding tracking pages by mouse/touch
- Fixed that grouping by columns in tables may caused duplicate groups
- Fixed that grocycode camera barcode scanning didn't recognize the scanned code for chore/battery tracking
- Fixed that Grocycode camera barcode scanning didn't recognize the scanned code for chore/battery tracking
- Fixed that when having any "Track date only" chore on the calendar, the iCal export was broken
- Optimized the meal plan page to be properly printable (thanks @MrKrisKrisu)
@@ -11,6 +11,6 @@
> ❗ The release before (v3.1.0) introduced that "numbers are now returned as numbers": **This was reverted** since it had unintended side effects (so all fields are technically strings now again, just like before - sorry for that)
- Fixed that `missing_products` of the `/stock/volatile` endpoint also contained inactive products
- Fixed that when having multiple Userfields for an entity, the `/objects/{entity}` endpoint returned wrong Userfield values
- Fixed that the `/stock/products/by-barcode/{barcode}/consume` and `/stock/products/by-barcode/{barcode}/transfer` endpoints haven't used the stock entry given by a stock entry grocycode (thanks @lowlee for the initial work on this)
- Fixed that the `/stock/products/by-barcode/{barcode}/consume` and `/stock/products/by-barcode/{barcode}/transfer` endpoints haven't used the stock entry given by a stock entry Grocycode (thanks @lowlee for the initial work on this)
- Fixed that the "Stock by-barcode" API routes were broken for normal barcodes (only grocycodes were accepted) (thanks @larsverp)
- Fixed that the "Stock by-barcode" API routes also accepted chore or battery grocycodes (thanks @lowlee)

View File

@@ -5,7 +5,7 @@
- When adding (purchase) a product with "Default due days after freezing" set directly to a freezer location, the due date is now prefilled by that (instead of the normal "Default due days") (thanks @grahamc for the initial work on this)
- Chores can now be merged (new item in the context-/more-menu on the chores list page)
- Fixed that "Label per unit" stock entry labels (on purchase) weren't unique per unit
- Fixed that the "Add as new product" productpicker workflow, started from the shopping list item form, always selected the default shopping list after finishing the flow
- Fixed that the "Add as new product" product picker workflow, started from the shopping list item form, always selected the default shopping list after finishing the flow
- Fixed that when undoing a product opened transaction and when the product has "Default due days after opened" set, the original due date wasn't restored
- Fixed that "Track date only"-chores were shown as overdue on the due day on the chores overview page
- Fixed that dropdown filters for tables maybe did not work after reordering columns

View File

@@ -3,7 +3,7 @@
- The `config.php` option `FEATURE_SETTING_STOCK_COUNT_OPENED_PRODUCTS_AGAINST_MINIMUM_STOCK_AMOUNT` was removed and is now a new product option `Treat opened as out of stock`, means, if opened stock entries will be counted as missing for calculating if a product is below its minimum stock amount, can now be configured per product
- The existing option will be migrated to all existing products, so no changed behavior after the update
- There is also a new stock setting (section "Presets for new products") which can be used to configure the default when adding products (also that will be set based on the old setting on migration)
- When using/scanning a stock entry grocycode on the consume page, the amount is now prefilled by the stock entry amount (making it essentially possible to consume the corresponding stock entry in one go)
- When using/scanning a stock entry Grocycode on the consume page, the amount is now prefilled by the stock entry amount (making it essentially possible to consume the corresponding stock entry in one go)
- Stock entry labels get now also printed on inventory (only when adding products, same option "Stock entry label" like on the purchase page)
- Fixed that stock entry labels on purchase were printed, even when "No label" was selected (was only a problem when running label printer WebHooks server side)
- Fixed that formatted (HTML) text for the (hidden by default) product description column on the stock overview page was not correctly displayed
@@ -17,7 +17,7 @@
- Background: Before v3.0.0 recipe costs were only based on the last price per product and since v3.0.0 the "real costs" (based on the default consume rule "Opened first, then first due first, then first in first out") are used, means out of stock items have no price - so using the last price for out of stock items should reflect the current real costs better
- Added a new recipes setting (top right corner settings menu) "Show the recipe list and the recipe side by side" (defaults to enabled, so no changed behaviour when not configured)
- When disabled, on the recipes page, the recipe list is displayed full-width and the recipe will be shown in a popup instead of on the right side
- Recipes are now also grocycode enabled (works like any other grocycode; download/print it via the recipes edit page or the more/context menu on the recipes page; use/scan it at any place a recipe can be selected)
- Recipes are now also Grocycode enabled (works like any other Grocycode; download/print it via the recipes edit page or the more/context menu on the recipes page; use/scan it at any place a recipe can be selected)
- Performance improvements (page loading time) of the recipes page
- Fixed that when adding missing recipe ingredients, with the option "Only check if any amount is in stock" enabled, to the shopping list, unit conversions (if any) weren't considered
- Fixed that the recipe stock fulfillment information about shopping list amounts was not correct when the ingredient had a decimal amount

View File

@@ -42,7 +42,7 @@
- When enabled, the corresponding product can't have own stock, means it will not be selectable on purchase (useful for parent products which are just used as a summary/total view of the sub products)
- The location content sheet can now optionally list also out of stock products (at the products default location, new checkbox "Show only in-stock products" at the top of the page, defaults to enabled)
- Added a location filter to the stock entries page
- Added the product grocycode as a (hidden by default) column to the products list (master data)
- Added the product Grocycode as a (hidden by default) column to the products list (master data)
- The price entered on the inventory page is now related to the selected quantity unit (like on the purchase page, was always related to the products stock QU before)
- Fixed that consuming via the consume page was not possible when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was disabled
@@ -89,7 +89,7 @@
### Batteries
- Fixed that the batteries overview page was broken when there was any battery Userfield with enabled "Show as column in tables" option
- Fixed that grocycode label printer printing didn't work from the battery edit page (master data) (thanks @andreheuer)
- Fixed that Grocycode label printer printing didn't work from the battery edit page (master data) (thanks @andreheuer)
- Fixed that undoing a battery charge cycle had no effect on "Last charged" and "Next planned charge cycle" of the corresponding battery
### Equipment

View File

@@ -29,5 +29,5 @@
- Endpoint `/stock/products/{productId}`: New field/property `default_consume_location` (contains the products default consume location object)
- Endpoint `/stock/products/{productId}/add`: Fixed that the request body parameter `transaction_type` was ignored / always set to `purchase`
- Fixed that the endpoint `/stock/products/by-barcode/{barcode}/open` didn't handle stock entries provided by a grocycode (thanks @jtommi)
- Fixed that the endpoint `/stock/products/by-barcode/{barcode}/open` didn't handle stock entries provided by a Grocycode (thanks @jtommi)
- Fixed that less or equal (`<=`) and greater or equal (`>=`) filter comparisons didn't work (optional `query[]` request query parameter on most endpoints)

View File

@@ -1,9 +1,9 @@
### Stock
- Improved that when editing a unit conversion, the "Quantity unit from" and "Quantity unit to" of the corresponding inverse conversion is now also updated accordingly if changed (until now only the factor was updated automatically)
- Changed that the "Move on open" product option can now always be used/set, even when the "Default location" and "Default conume location" are the same
- Changed that the "Move on open" product option can now always be used/set, even when the "Default location" and "Default consume location" are the same
- Fixed that stock entry notes were lost when consuming/opening/transferring a partial amount of the corresponding stock entry (thanks @akoshpinter)
- Fixed that the average shelf life of a product (on the productcard) was wrong when the corresponding stock entry was edited
- Fixed that the average shelf life of a product (on the product card) was wrong when the corresponding stock entry was edited
- Fixed that when the stock setting "Decimal places allowed for amounts" was set to `0`, unit conversion (if any) failed when adding the corresponding product to stock
- Fixed that consuming a parent product which is not in stock itself (so essentially using any of the child products) may failed when unit conversions were involved (the current stock amount check was wrong in that case)
- Fixed that the status button counters on the stock overview page ("X products are overdue" and so on) included products which have the option `Never show on stock overview` enabled
@@ -28,7 +28,7 @@
### General
- It's now possible to edit a user without necessarily updating the users password
- Fixed that column reordering didn't work on the stock overview, stock entries and shopping list page when showing column which are not shown by default
- Fixed that column reordering didn't work on the stock overview, stock entries and shopping list page when showing columns which are not shown by default
- Fixed that when running label printer WebHooks client side (so when `LABEL_PRINTER_RUN_SERVER` = `false`), the setting `LABEL_PRINTER_HOOK_JSON` was ignored (the WebHook data was always sent as form data)
- Fixed that granular user permissions (like "Shopping list / Add items" or "Equipment") didn't allow to add/edit the corresponding items without also having the "Edit master data" permission
- New translations: (thanks all the translators)

View File

@@ -0,0 +1,118 @@
> ⚠️ PHP 8.1 (with SQLite 3.34.0+) is from now on the only supported runtime version.
> ❗ The major version bump is due to breaking API changes, please see below if you use the API.
> _Recommendation: Benchmark tests showed that e.g. unit conversion handling is up to 5 times faster when using a more recent (3.39.4+) SQLite version._
### New feature: Indirect quantity unit conversions with unlimited levels
- Quantity unit conversions now support indirect conversions with unlimited levels (thanks a lot @esclear)
- _Explained by a practical example: When a conversion between Teaspoons and Milliliters and another one between Milliliters and Liters exists (and so forth; unlimited levels), Grocy can now calculate Teaspoons to Liters (before a direct conversion definition between Teaspoons and Liters was required)_
- **Heads up:** If you have such "each to each absolute conversion definitions" currently (for the example above the conversion between Teaspoons and Liters), you should clean them up, since they are no longer needed
- The product option "Factor purchase to stock quantity unit" was removed
- => Use normal product specific QU conversions instead, if needed
- An existing "Factor purchase to stock quantity unit" was automatically migrated to a product specific QU conversion
### New feature: Stock reports
- New button "Reports" on the stock overview page
- The first report (more to come) "Spendings" makes it possible to explore (pie chart and table data) the total value spend by product or product group in any time range
- (Thanks for the initial work on this @raupie)
### Stock
- New product option "Default quantity unit consume"
- Will be used/selected as the default quantity unit on the consume page
- The product's "Quick consume amount" is now displayed related to this quantity unit ("quick consume/open buttons" on the stock overview page)
- Defaults to the product's "Quantity unit stock" (so no changed behavior when not configured)
- New product option "Quantity unit for prices"
- Prices are now shown related to this quantity unit (instead of per "Default quantity unit purchase") on the product card, price history chart, stock overiew and stock entries page
- Defaults to the product's "Default quantity unit purchase" (so no changed behavior when not configured)
- Changed that when the ingredient option "Only check if any amount is in stock" is enabled, costs and calories are now based on the original entered amount instead of an "virtual" fixed amount of `1`
- When using the "Add as barcode to existing product" workflow on a purchase transaction, the selected quantity unit and the entered amount and note are now also added to the new barcode
- New product option "Auto reprint stock entry label"
- When enabled, auto-changing the due date of a stock entry (by opening/freezing/thawing and having corresponding default due days set) will reprint its label (only server side label printer WebHooks are supported)
- Defaults to disabled, so no changed behavior when not configured
- Added a new option "Reprint stock entry label" on the stock entry edit page (will print the correspondind stock entry label on save)
- This option will be automatically set on changing the entry's due date
- The product option "Quick consume amount" (the amount used for the "quick consume/open buttons" on the stock overview page) has been split into another option "Quick open amount", to be able to set different amounts for consume and open (defaults to the "Quick consume amount" per product, so no changed behavior when not configured)
- Changed that for the product's average and last price (and for the price history chart) stock transactions with an empty or `0` price are ignored
- Added a filter option to only show currently out-of-stock products on the products list (master data) page
- When clicking a product name on the products list (master data) or on the stock journal page, the product card will now be displayed (like on the stock overview page)
- When using/scanning a product barcode and the purchase or inventory page, the barcode's note will now also be prefilled (if any)
- Each row on the stock journal now also has a context-/more menu for quick access to product related actions (the same as on the stock overview page)
- The amount of "Label per unit" stock entry labels (on purchase and inventory) is now displayed, to help prevent printing a lot of labels where this maybe is not intended
- Fixed that hiding the "Purchased date" column (table options) on the stock entries page didn't work
- Fixed that sorting by the "Value" and "Min. stock amount" columns on the stock overview page didn't work
- Fixed that the consumed amount was wrong, when consuming multiple substituted subproducts at once and when multiple/different conversion factors were involved
- Fixed that for a product's average price, only currently in-stock items were considered, not already consumed ones
- Fixed that when copying a product, some fields (like "Default consume location" or "Disable own stock) weren't copied along
- Fixed that the total product count on the stock overview page also included products with "Never show on stock overview" enabled
### Shopping list
- Added a new button "Clear done items" (to clear all done items with one click)
### Recipes
- Added a new entry "Add to meal plan" in the context/more menu per recipe to directly add a recipe to the meal plan from the recipes page
- Changed that when a ingredient has a "Variable amount" set, the text entered there now also replaces the unit when displaying the recipe (not only the amount as before)
- When displaying a recipe in fullscreen mode, the ingredients and preparation is now shown side by side (or below each other on small screens) instead of in tabs
- When consuming a recipe which has a "Produces product" set and when the product's "Default stock entry label" is configured accordingly, the corresponding label will now be printed on that action (only server side label printer WebHooks are supported)
- Fixed that hiding the "Requirements fulfilled" column (table options) on the recipes page didn't work
- Fixed that ingredient costs and calories were wrong when product substitution and unit conversions were involved at the same time
### Meal plan
- Added a new sub feature flag `FEATURE_FLAG_RECIPES_MEALPLAN` (in `config.php`) to only disable the meal plan if not needed (thanks @webysther)
- The `config.php` setting `MEAL_PLAN_FIRST_DAY_OF_WEEK` can now be set to `-1` to dynamically start the meal plan week on _today_
- Fixed that consuming a recipe from the meal plan didn't add its "Produces product"-product to stock (if any)
- Fixed that the "Put missing products on shopping list"-button in the header (to put all missing products on the shopping list for a whole week) was missing under certain circumstances (related to locale week numbers and turn of the year)
### Chores
- Changed the handling of the tracking buttons on the chores overview page
- The green button now tracks an execution of the corresponding chore on the next scheduled time, rather than for now/today
- New context-/more menu option "Track chore execution now" to track an execution for now/today (so the same what the green button did before)
- Removed the limitation on the chore tracking page that the tracked time couldn't be in the future
- Fixed that "assidgned to" was not recalculated when undoing chores
### Calendar
- Added a button to jump to today (between the prev/next buttons, top right corner)
### Tasks
- Fixed that hiding the "Category" column (table options) on the tasks page didn't work
### Userfields
- Product group Userfields are now also rendered on the shopping list
- Fixed that when having e.g. a Userfield for the `stock` entity and using the "Never overdue" shortcut checkbox for the due date on purchase, this Userfield would also be set to the corresponding "never overdue date"
### General
- Like already possible for products/chores/batteries, locations, stores, quantity units, product groups and task categories can now be disabled to keep them for existing references without deleting them, but to hide them everywhere for selections and so on (new option "Active")
- Added a new `config.php` setting `ENERGY_UNIT` to customize the label to display energy values (was fixed `kcal` before and defaults to that, so no changed behavior when not configured)
- New logo and "Grocy" is now officially spelled with a capital initial letter (before everything was lowercase)
- Various frontend performance enhancements
- Fixed that users were unable to delete their own API keys (when not having the `All permissions` permission)
- Fixed that button tooltips on some places didn't disappear after clicking the corresponding button
- New translations: (thanks all the translators)
- Estonian (demo available at <https://et.demo.grocy.info>)
- Romanian (demo available at <https://ro.demo.grocy.info>)
### API
- ⚠️ **Breaking changes**:
- The product property `qu_factor_purchase_to_stock` was removed (existing factors were migrated to normal product specific QU conversions, see above)
- Numbers are now returned as numbers (so technically without quotes around them, were strings for nearly all endpoints before)
- Endpoint `/stock/products/{productId}`:
- Added a new field/property `qu_conversion_factor_purchase_to_stock` for convenience (contains the conversion factor of the corresponding QU conversion from the product's `qu_id_purchase` to `qu_id_stock`)
- Added a new field/property `qu_conversion_factor_price_to_stock` for convenience (contains the conversion factor of the corresponding QU conversion from the product's `qu_id_price` to `qu_id_stock`)
- Added a new field/property `default_quantity_unit_consume` (contains the quantity unit object of the product's "Default quantity unit consume")
- The following entities are now also available via the endpoint `/objects/{entity}` (only listing, no edit)
- `quantity_unit_conversions_resolved` (returns all final/resolved conversion factors per product and any directly or indirectly related quantity units)
- `recipes_pos_resolved` (returns stock fulfilment information for all recipe ingredients)
- The endpoint `/batteries` now also returns the corresponding battery object (as field/property `battery`)
- API keys can now have a description (to e.g. track where the corresponding key is used)

View File

@@ -0,0 +1,19 @@
> 💡 PHP 8.2 is from now on (additionally to PHP 8.1) supported.
### Stock
- Fixed performance issues affecting all places where quantity unit conversions / prices are involved
- Fixed that the upgrade failed when having improperly defined product specific quantity unit conversions
- Fixed that edited stock entries were not considered in some cases (affecting the product's last price, average price, the price history and the stock reports)
### Shopping list
- Changed that unit prices on the shopping list (table column "Last price (Unit)") are now related to the there selected quantity unit (instead of to the product's QU stock as before)
### Meal plan
- Fixed that the meal plan did initially not display the current week when the settings `MEAL_PLAN_FIRST_DAY_OF_WEEK` and `CALENDAR_FIRST_DAY_OF_WEEK` were set to different values
### API
- Fixed performance issues on the endpoint `/stock/products/{productId}`

View File

@@ -0,0 +1,13 @@
### Stock
- The stock report "Spendings" now also supports grouping by stores
- Fixed that the upgrade failed when having (a lot of) redundant ("each to each") default quantity unit conversion definitions (thanks a lot @alkuzman and @esclear)
- More on that by a practical example: When a conversion between Teaspoons and Milliliters and another one between Milliliters and Liters exists (and so forth; unlimited levels), Grocy can now (since v4.0.0) calculate the derived factor to convert Teaspoons to Liters on its own (before a direct conversion definition between Teaspoons and Liters was required)
- So you might have a lot of such "each to each absolute conversion definitions" currently, when you were affected by failed upgrades (timeout problems due to that resolving indirect conversion factors took very long)
- **Heads up:** This is now fixed, but you should clean up those redundant "each to each" definitions (in the example above the conversion between Teaspoons and Liters), since they are no longer needed
- Fixed that the "Mark this stock entry as open"-button on the stock entries page opened always one unit instead of the whole stock entry
- Fixed that edited stock entries were not considered in some cases (affecting the product's average price and the stock reports)
### Recipes
- Fixed that ingredient cost/energy values were wrong when unit conversions but _no_ product substitutions were involved

View File

@@ -0,0 +1,12 @@
### Stock
- Performance improvements related to the stock overview page / displaying a product card
- Performance improvements related to consuming products (thanks @alkuzman)
### Userfields
- New Userfield type "Number (currency)", just like the type "Number (decimal)", but it will render the value according to / with the configured currency
### General
- Performance improvements related to table (layout) loading handling

View File

@@ -0,0 +1,43 @@
> 💡 PHP 8.3 is from now on (additionally to PHP 8.2) supported.
>
> ⚠️ PHP 8.1 is no longer supported.
### Stock
- Fixed that the location dropdown on the consume page contained the same location multiple times if there are currently stock entries at multiple locations of the corresponding product
- Fixed that the status filter "_n_ products are overdue" on the stock overview page also counted/included stock entries due today or tomorrow
- Fixed that the stock report "Spendings" did not take products without an assigned product group into account (thanks @Torqu3Wr3nch for the initial work on this)
- Fixed that the success message after opening a stock entry on the stock entries page displayed always an amount of `1` instead of the actual amount opened
- Fixed that the "Consume this stock entry as spoiled" context menu action on the stock entries page consumed always an amount of `1` instead of the whole stock entry
### Recipes
- Fixed that copying recipes with special characters in the name was not possible
### Meal plan
- Fixed that the meal plan page was broken after deleting all meal plan items of a week
### Calendar
- The different event types (due products, chores, tasks and so on) can now have different colors
- => New button "Configure colors" on the calendar page to configure these colors (top right corner)
### Tasks
- Added a new table filter for categories (thanks @geoffwright240 for the initial work on this)
### Userfields
- Fixed that when having a userfield of type "Select list (multiple items can be selected)" and selecting no item, editing of the corresponding form was broken
### General
- Night mode is now also used on the login page if that's the system preferred color scheme (generally if night mode is on or not is based on user settings and before logging in no user context is available)
- Optimized sidebar icon spacing (thanks @chris-thorn)
- Fixed that file uploads (product pictures and so on) didn't work for files where the file name contains multiple spaces
- Fixed that some dialogs were not properly (too small) displayed (mostly affecting Firefox >= 121)
### API
- Optimized that the endpoints `GET /objects/{entity}` and `GET /objects/{entity}/{objectId}` now also return Userfields for the entity `stock`

View File

@@ -0,0 +1,26 @@
### Stock
- When using/scanning a stock entry Grocycode on the transfer page, the "Use specific stock item" dropdown (and "From location") is now also prefilled accordingly
- Fixed that for the product's last price stock transactions with an empty or `0` price weren't ignored
- Fixed that when copying a product, the field "Move on open" wasn't copied along
### Shopping list
- The shopping lists dropdown on the shopping list page now also shows the number of items on the corresponding shopping list
### Recipes
- Optimized that when creating a recipe, the desired serving amount is now initially prefilled by the recipe's base serving amount
### Batteries
- It's now possible to track any addtional info on a battery charge cycle by using Userfields (thanks @TheDodger)
- => Configure the desired Userfields for the entity `battery_charge_cycles`
- => The on a battery charge cycle tracking entered information is then visible on the corresponding battery charge cycle journal entry
### General
- Optimized that file uploads are no longer completely buffered in memory before writing them to disk (thanks @bbx0)
- Optimized top right corner menus icon spacing (thanks @TheDodger for the initial work on this)
- Fixed again that some dialogs were not properly (too small) displayed (this time mostly affecting Chrome/Edge)
- Fixed that table states (visible columns, sorting, column order and so on) could be reset to default after not accessing/using the corresponding page for a certain amount of time

View File

@@ -0,0 +1,28 @@
### Stock
- Optimized form validation (max amount checks) related to unit conversion with a lot of decimal places on the consume and transfer page
- Optimized that the stock report "Spendings" now excludes self produced products (thanks @danielr18 for the initial work on this)
- Fixed that when copying a product, the field "Treat opened as out of stock" wasn't copied along (thanks @TheDodger)
- Fixed that the product groups filter on the master data products page used a contains search instead of an exact search
- Fixed that Scan Mode on the purchase and consume page didn't work (not all fields were properly populated) when using/scanning a product Grocycode
### Shopping list
- Fixed that when printing a shoppping list, the table/list wasn't sorted (will now be sorted alphabetically by the product name of the corresponding list item)
- Fixed that when deleting a shopping list item and marking another one as done while not reloading the page in-between, the deleted item reappeared (was only a visual problem, there was no problem on deleting the item on the backend / in the database)
### Recipes
- When self producing a product ("Produces product" recipe option) the name of the recipe is now added to the note field of the created stock entry
- Fixed that when `FEATURE_FLAG_STOCK_STOCK` was set to `false`, the "Put missing products on shopping list"-button was not visible
- Fixed that scanning a product barcode on the recipe ingredient edit page didn't work
- Fixed that the recipe edit button on the recipes page gallery view didn't work
### Userfields
- Userentity tables (custom objects / lists) now also have the table options icon (top left corner eye icon, to e.g. add a grouping condition)
- Userfield names can now also contain underscores
### API
- Optimized that uploading files where the file name contains non-ASCII characters is now also possible

View File

@@ -2,6 +2,8 @@
> ❗ xxxImportant upgrade informationXXX
> 💡 xxxMinor upgrade informationXXX
### New feature: xxxx
- xxx

View File

@@ -1,13 +1,13 @@
{
"require": {
"php": "^8.0",
"php": ">=8.2",
"slim/slim": "^4.0",
"slim/psr7": "^1.0",
"slim/http": "^1.0",
"php-di/php-di": "^6.0",
"php-di/php-di": "^7.0.3",
"berrnd/slim-blade-view": "^1.0.0",
"morris/lessql": "^1.0",
"gettext/gettext": "^4.8",
"morris/lessql": "dev-php82",
"gettext/gettext": "^4.8.10",
"eluceo/ical": "^2.2.0",
"erusev/parsedown": "^1.7",
"gumlet/php-image-resize": "^2.0",
@@ -16,6 +16,12 @@
"guzzlehttp/guzzle": "^7.0",
"mike42/escpos-php": "^3.0"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/berrnd/lessql"
}
],
"autoload": {
"psr-4": {
"Grocy\\Services\\": "services/",
@@ -28,6 +34,8 @@
]
},
"config": {
"platform-check": false
"vendor-dir": "packages",
"platform-check": false,
"optimize-autoloader": true
}
}

1482
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -14,8 +14,9 @@
// The settings defined here below
// Either "production", "dev", "demo" or "prerelease"
// When not "production", authentication will be disabled and
// demo data will be populated during database migrations
// When not "production", the application will work in a demo mode which means
// authentication is disabled and some demo data will be generated during the database schema migration
// (pass the query parameter "nodemodata", e.g. https://grocy.example.com/?nodemodata to skip that)
Setting('MODE', 'production');
// The directory name of one of the available localization folders
@@ -33,15 +34,20 @@ Setting('CALENDAR_SHOW_WEEK_OF_YEAR', true);
// Set this if you want to have a different start day for the weekly meal plan view,
// leave empty to use CALENDAR_FIRST_DAY_OF_WEEK (see above)
// Needs to be a number where Sunday = 0, Monday = 1 and so forth
// Can also be set to -1 to dynamically start the meal plan week on "today"
Setting('MEAL_PLAN_FIRST_DAY_OF_WEEK', '');
// To keep it simple: grocy does not handle any currency conversions,
// To keep it simple: Grocy does not handle any currency conversions,
// this here is used to format all money values,
// so doesn't really matter, but needs to be the
// ISO 4217 code of the currency ("USD", "EUR", "GBP", etc.)
Setting('CURRENCY', 'USD');
// When running grocy in a subdirectory, this should be set to the relative path, otherwise empty
// Your preferred unit for energy
// E.g. "kcal" or "kJ" or something else (doesn't really matter, it's only used to display energy values)
Setting('ENERGY_UNIT', 'kcal');
// When running Grocy in a subdirectory, this should be set to the relative path, otherwise empty
// It needs to be set to the part (of the URL) AFTER the document root,
// if URL rewriting is disabled, including index.php
// Example with URL Rewriting support:
@@ -100,7 +106,7 @@ Setting('GROCYCODE_TYPE', '1D');
// Label printer settings
Setting('LABEL_PRINTER_WEBHOOK', ''); // The URI that grocy will POST to when asked to print a label
Setting('LABEL_PRINTER_WEBHOOK', ''); // The URI that Grocy will POST to when asked to print a label
Setting('LABEL_PRINTER_RUN_SERVER', true); // Whether the webhook will be called server- or client-side
Setting('LABEL_PRINTER_PARAMS', ['font_family' => 'Source Sans Pro (Regular)']); // Additional parameters supplied to the webhook
Setting('LABEL_PRINTER_HOOK_JSON', false); // TRUE to use JSON or FALSE to use normal POST request variables
@@ -140,6 +146,7 @@ Setting('FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING', true);
Setting('FEATURE_FLAG_STOCK_PRODUCT_FREEZING', true);
Setting('FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD', true); // Activate the number pad in due date fields on (supported) mobile browsers
Setting('FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS', true);
Setting('FEATURE_FLAG_RECIPES_MEALPLAN', true);
Setting('FEATURE_FLAG_CHORES_ASSIGNMENTS', true);
Setting('FEATURE_FLAG_THERMAL_PRINTER', false);
@@ -206,6 +213,13 @@ DefaultUserSetting('batteries_due_soon_days', 5); // The "due soon" days
// Tasks settings
DefaultUserSetting('tasks_due_soon_days', 5); // The "due soon" days
// Calendar settings
DefaultUserSetting('calendar_color_products', '#007bff'); // The event color (hex code) for due products
DefaultUserSetting('calendar_color_tasks', '#28a745'); // The event color (hex code) for due tasks
DefaultUserSetting('calendar_color_chores', '#ffc107'); // The event color (hex code) for due chores
DefaultUserSetting('calendar_color_batteries', '#17a2b8'); // The event color (hex code) for due battery charge cycles
DefaultUserSetting('calendar_color_meal_plan', '#6c757d'); // The event color (hex code) for meal plan items
// Component configuration for Quagga2 - read https://github.com/ericblade/quagga2#configobject for details
// Below is a generic good configuration,
// for an iPhone 7 Plus, halfsample = true, patchsize = small, frequency = 5 yields very good results

View File

@@ -3,18 +3,18 @@
namespace Grocy\Controllers;
use LessQL\Result;
use Psr\Http\Message\ResponseInterface as Response;
use Slim\Exception\HttpException;
class BaseApiController extends BaseController
{
const PATTERN_FIELD = '[A-Za-z_][A-Za-z0-9_]+';
const PATTERN_OPERATOR = '!?((>=)|(<=)|=|~|<|>|(§))';
const PATTERN_VALUE = '[A-Za-z\p{L}\p{M}0-9*_.$#^| -\\\]+';
protected $OpenApiSpec = null;
protected function ApiResponse(\Psr\Http\Message\ResponseInterface $response, $data, $cache = false)
protected function ApiResponse(Response $response, $data, $cache = false)
{
if ($cache)
{
@@ -25,19 +25,19 @@ class BaseApiController extends BaseController
return $response;
}
protected function EmptyApiResponse(\Psr\Http\Message\ResponseInterface $response, $status = 204)
protected function EmptyApiResponse(Response $response, $status = 204)
{
return $response->withStatus($status);
}
protected function GenericErrorResponse(\Psr\Http\Message\ResponseInterface $response, $errorMessage, $status = 400)
protected function GenericErrorResponse(Response $response, $errorMessage, $status = 400)
{
return $response->withStatus($status)->withJson([
'error_message' => $errorMessage
]);
}
public function FilteredApiResponse(\Psr\Http\Message\ResponseInterface $response, Result $data, array $query)
public function FilteredApiResponse(Response $response, Result $data, array $query)
{
$data = $this->queryData($data, $query);
return $this->ApiResponse($response, $data);
@@ -50,8 +50,13 @@ class BaseApiController extends BaseController
$data = $this->filter($data, $query['query']);
}
if (isset($query['limit']))
if (isset($query['limit']) || isset($query['offset']))
{
if (!isset($query['limit']))
{
$query['limit'] = -1;
}
$data = $data->limit(intval($query['limit']), intval($query['offset'] ?? 0));
}
@@ -101,7 +106,8 @@ class BaseApiController extends BaseController
$sqlOrNull = ' OR ' . $matches['field'] . ' IS NULL';
}
switch ($matches['op']) {
switch ($matches['op'])
{
case '=':
$data = $data->where($matches['field'] . ' = ?' . $sqlOrNull, $matches['value']);
break;
@@ -129,7 +135,6 @@ class BaseApiController extends BaseController
case '§':
$data = $data->where($matches['field'] . ' REGEXP ?', $matches['value']);
break;
}
}
@@ -145,4 +150,47 @@ class BaseApiController extends BaseController
return $this->OpenApiSpec;
}
private static $htmlPurifierInstance = null;
protected function GetParsedAndFilteredRequestBody($request)
{
if ($request->getHeaderLine('Content-Type') != 'application/json')
{
throw new HttpException($request, 'Bad Content-Type', 400);
}
if (self::$htmlPurifierInstance == null)
{
$htmlPurifierConfig = \HTMLPurifier_Config::createDefault();
$htmlPurifierConfig->set('Cache.SerializerPath', GROCY_DATAPATH . '/viewcache');
$htmlPurifierConfig->set('HTML.Allowed', 'div,b,strong,i,em,u,a[href|title|target],iframe[src|width|height|frameborder],ul,ol,li,p[style],br,span[style],img[style|width|height|alt|src],table[border|width|style],tbody,tr,td,th,blockquote,*[style|class|id],h1,h2,h3,h4,h5,h6');
$htmlPurifierConfig->set('Attr.EnableID', true);
$htmlPurifierConfig->set('HTML.SafeIframe', true);
$htmlPurifierConfig->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align,width,height');
$htmlPurifierConfig->set('URI.AllowedSchemes', ['data' => true, 'http' => true, 'https' => true]);
$htmlPurifierConfig->set('URI.SafeIframeRegexp', '%^.*%'); // Allow any iframe source
$htmlPurifierConfig->set('CSS.MaxImgLength', null);
self::$htmlPurifierInstance = new \HTMLPurifier($htmlPurifierConfig);
}
$requestBody = $request->getParsedBody();
foreach ($requestBody as $key => &$value)
{
// HTMLPurifier removes boolean values (true/false) and arrays, so explicitly keep them
// Maybe also possible through HTMLPurifier config (http://htmlpurifier.org/live/configdoc/plain.html)
if (!is_bool($value) && !is_array($value))
{
$value = self::$htmlPurifierInstance->purify($value);
// Allow some special chars
// Maybe also possible through HTMLPurifier config (http://htmlpurifier.org/live/configdoc/plain.html)
$value = str_replace('&amp;', '&', $value);
$value = str_replace('&gt;', '>', $value);
$value = str_replace('&lt;', '<', $value);
}
}
return $requestBody;
}
}

View File

@@ -18,16 +18,18 @@ use Grocy\Services\StockService;
use Grocy\Services\TasksService;
use Grocy\Services\UserfieldsService;
use Grocy\Services\UsersService;
use DI\Container;
class BaseController
{
public function __construct(\DI\Container $container)
public function __construct(Container $container)
{
$this->AppContainer = $container;
$this->View = $container->get('view');
}
protected $AppContainer;
private $View;
protected function getApiKeyService()
{
@@ -114,19 +116,20 @@ class BaseController
return UsersService::getInstance();
}
protected function render($response, $page, $data = [])
protected function render($response, $viewName, $data = [])
{
$container = $this->AppContainer;
$versionInfo = $this->getApplicationService()->GetInstalledVersion();
$this->View->set('version', $versionInfo->Version);
$this->View->set('releaseDate', $versionInfo->ReleaseDate);
$localizationService = $this->getLocalizationService();
$this->View->set('__t', function (string $text, ...$placeholderValues) use ($localizationService) {
$this->View->set('__t', function (string $text, ...$placeholderValues) use ($localizationService)
{
return $localizationService->__t($text, $placeholderValues);
});
$this->View->set('__n', function ($number, $singularForm, $pluralForm, $isQu = false) use ($localizationService) {
$this->View->set('__n', function ($number, $singularForm, $pluralForm, $isQu = false) use ($localizationService)
{
return $localizationService->__n($number, $singularForm, $pluralForm, $isQu);
});
$this->View->set('LocalizationStrings', $localizationService->GetPoAsJsonString());
@@ -140,7 +143,8 @@ class BaseController
}
$this->View->set('dir', $dir);
$this->View->set('U', function ($relativePath, $isResource = false) use ($container) {
$this->View->set('U', function ($relativePath, $isResource = false) use ($container)
{
return $container->get('UrlManager')->ConstructUrl($relativePath, $isResource);
});
@@ -159,13 +163,13 @@ class BaseController
unset($constants[$constant]);
}
}
$this->View->set('featureFlags', $constants);
if (GROCY_AUTHENTICATED)
{
$this->View->set('permissions', User::PermissionList());
$decimalPlacesAmounts = intval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_decimal_places_amounts'));
$decimalPlacesAmounts = $this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_decimal_places_amounts');
if ($decimalPlacesAmounts <= 0)
{
$defaultMinAmount = 1;
@@ -177,10 +181,12 @@ class BaseController
$this->View->set('DEFAULT_MIN_AMOUNT', $defaultMinAmount);
}
return $this->View->render($response, $page, $data);
$this->View->set('viewName', $viewName);
return $this->View->render($response, $viewName, $data);
}
protected function renderPage($response, $page, $data = [])
protected function renderPage($response, $viewName, $data = [])
{
$this->View->set('userentitiesForSidebar', $this->getDatabase()->userentities()->where('show_in_sidebar_menu = 1')->orderBy('name'));
try
@@ -200,45 +206,6 @@ class BaseController
// Happens when database is not initialised or migrated...
}
return $this->render($response, $page, $data);
}
private static $htmlPurifierInstance = null;
protected function GetParsedAndFilteredRequestBody($request)
{
if (self::$htmlPurifierInstance == null)
{
$htmlPurifierConfig = \HTMLPurifier_Config::createDefault();
$htmlPurifierConfig->set('Cache.SerializerPath', GROCY_DATAPATH . '/viewcache');
$htmlPurifierConfig->set('HTML.Allowed', 'div,b,strong,i,em,u,a[href|title|target],iframe[src|width|height|frameborder],ul,ol,li,p[style],br,span[style],img[style|width|height|alt|src],table[border|width|style],tbody,tr,td,th,blockquote,*[style|class|id],h1,h2,h3,h4,h5,h6');
$htmlPurifierConfig->set('Attr.EnableID', true);
$htmlPurifierConfig->set('HTML.SafeIframe', true);
$htmlPurifierConfig->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align,width,height');
$htmlPurifierConfig->set('URI.AllowedSchemes', ['data' => true, 'http' => true, 'https' => true]);
$htmlPurifierConfig->set('URI.SafeIframeRegexp', '%^.*%'); // Allow any iframe source
$htmlPurifierConfig->set('CSS.MaxImgLength', null);
self::$htmlPurifierInstance = new \HTMLPurifier($htmlPurifierConfig);
}
$requestBody = $request->getParsedBody();
foreach ($requestBody as $key => &$value)
{
// HTMLPurifier removes boolean values (true/false) and arrays, so explicitly keep them
// Maybe also possible through HTMLPurifier config (http://htmlpurifier.org/live/configdoc/plain.html)
if (!is_bool($value) && !is_array($value))
{
$value = self::$htmlPurifierInstance->purify($value);
// Allow some special chars
// Maybe also possible through HTMLPurifier config (http://htmlpurifier.org/live/configdoc/plain.html)
$value = str_replace('&amp;', '&', $value);
$value = str_replace('&gt;', '>', $value);
$value = str_replace('&lt;', '<', $value);
}
}
return $requestBody;
return $this->render($response, $viewName, $data);
}
}

View File

@@ -5,10 +5,12 @@ namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
use Grocy\Helpers\WebhookRunner;
use Grocy\Helpers\Grocycode;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class BatteriesApiController extends BaseApiController
{
public function BatteryDetails(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function BatteryDetails(Request $request, Response $response, array $args)
{
try
{
@@ -20,12 +22,12 @@ class BatteriesApiController extends BaseApiController
}
}
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Current(Request $request, Response $response, array $args)
{
return $this->FilteredApiResponse($response, $this->getBatteriesService()->GetCurrent(), $request->getQueryParams());
}
public function TrackChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function TrackChargeCycle(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_BATTERIES_TRACK_CHARGE_CYCLE);
@@ -48,7 +50,7 @@ class BatteriesApiController extends BaseApiController
}
}
public function UndoChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UndoChargeCycle(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_BATTERIES_UNDO_CHARGE_CYCLE);
@@ -63,7 +65,7 @@ class BatteriesApiController extends BaseApiController
}
}
public function BatteryPrintLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function BatteryPrintLabel(Request $request, Response $response, array $args)
{
try
{

View File

@@ -3,12 +3,14 @@
namespace Grocy\Controllers;
use Grocy\Helpers\Grocycode;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class BatteriesController extends BaseController
{
use GrocycodeTrait;
public function BatteriesList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function BatteriesList(Request $request, Response $response, array $args)
{
if (isset($request->getQueryParams()['include_disabled']))
{
@@ -26,12 +28,12 @@ class BatteriesController extends BaseController
]);
}
public function BatteriesSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function BatteriesSettings(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'batteriessettings');
}
public function BatteryEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function BatteryEditForm(Request $request, Response $response, array $args)
{
if ($args['batteryId'] == 'new')
{
@@ -50,7 +52,7 @@ class BatteriesController extends BaseController
}
}
public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Journal(Request $request, Response $response, array $args)
{
if (isset($request->getQueryParams()['months']) && filter_var($request->getQueryParams()['months'], FILTER_VALIDATE_INT) !== false)
{
@@ -71,16 +73,18 @@ class BatteriesController extends BaseController
return $this->renderPage($response, 'batteriesjournal', [
'chargeCycles' => $this->getDatabase()->battery_charge_cycles()->where($where)->orderBy('tracked_time', 'DESC'),
'batteries' => $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE')
'batteries' => $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'userfields' => $this->getUserfieldsService()->GetFields('battery_charge_cycles'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('battery_charge_cycles')
]);
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Overview(Request $request, Response $response, array $args)
{
$usersService = $this->getUsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['batteries_due_soon_days'];
$batteries = $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
$batteries = $this->getDatabase()->batteries()->where('active = 1');
$currentBatteries = $this->getBatteriesService()->GetCurrent();
foreach ($currentBatteries as $currentBattery)
{
@@ -110,14 +114,15 @@ class BatteriesController extends BaseController
]);
}
public function TrackChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function TrackChargeCycle(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'batterytracking', [
'batteries' => $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE')
'batteries' => $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'userfields' => $this->getUserfieldsService()->GetFields('battery_charge_cycles')
]);
}
public function BatteryGrocycodeImage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function BatteryGrocycodeImage(Request $request, Response $response, array $args)
{
$gc = new Grocycode(Grocycode::BATTERY, $args['batteryId']);
return $this->ServeGrocycodeImage($request, $response, $gc);

View File

@@ -2,6 +2,7 @@
namespace Grocy\Controllers;
use Grocy\Services\ApiKeyService;
use Eluceo\iCal\Domain\Entity\Calendar;
use Eluceo\iCal\Domain\Entity\Event;
use Eluceo\iCal\Domain\Entity\TimeZone;
@@ -10,10 +11,12 @@ use Eluceo\iCal\Domain\ValueObject\DateTime;
use Eluceo\iCal\Domain\ValueObject\SingleDay;
use Eluceo\iCal\Domain\ValueObject\TimeSpan;
use Eluceo\iCal\Presentation\Factory\CalendarFactory;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class CalendarApiController extends BaseApiController
{
public function Ical(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Ical(Request $request, Response $response, array $args)
{
try
{
@@ -22,7 +25,7 @@ class CalendarApiController extends BaseApiController
$maxDate = null;
$vCalendar = new Calendar();
$vCalendar->setProductIdentifier('grocy');
$vCalendar->setProductIdentifier('Grocy');
foreach ($events as $event)
{
@@ -79,7 +82,7 @@ class CalendarApiController extends BaseApiController
$response->write((new CalendarFactory())->createCalendar($vCalendar));
$response = $response->withHeader('Content-Type', 'text/calendar; charset=utf-8');
return $response->withHeader('Content-Disposition', 'attachment; filename="grocy.ics"');
return $response->withHeader('Content-Disposition', 'attachment; filename="Grocy.ics"');
}
catch (\Exception $ex)
{
@@ -87,12 +90,12 @@ class CalendarApiController extends BaseApiController
}
}
public function IcalSharingLink(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function IcalSharingLink(Request $request, Response $response, array $args)
{
try
{
return $this->ApiResponse($response, [
'url' => $this->AppContainer->get('UrlManager')->ConstructUrl('/api/calendar/ical?secret=' . $this->getApiKeyService()->GetOrCreateApiKey(\Grocy\Services\ApiKeyService::API_KEY_TYPE_SPECIAL_PURPOSE_CALENDAR_ICAL))
'url' => $this->AppContainer->get('UrlManager')->ConstructUrl('/api/calendar/ical?secret=' . $this->getApiKeyService()->GetOrCreateApiKey(ApiKeyService::API_KEY_TYPE_SPECIAL_PURPOSE_CALENDAR_ICAL))
]);
}
catch (\Exception $ex)

View File

@@ -2,9 +2,12 @@
namespace Grocy\Controllers;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class CalendarController extends BaseController
{
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Overview(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'calendar', [
'fullcalendarEventSources' => $this->getCalendarService()->GetEvents()

View File

@@ -5,10 +5,12 @@ namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
use Grocy\Helpers\WebhookRunner;
use Grocy\Helpers\Grocycode;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class ChoresApiController extends BaseApiController
{
public function CalculateNextExecutionAssignments(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function CalculateNextExecutionAssignments(Request $request, Response $response, array $args)
{
try
{
@@ -42,7 +44,7 @@ class ChoresApiController extends BaseApiController
}
}
public function ChoreDetails(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ChoreDetails(Request $request, Response $response, array $args)
{
try
{
@@ -54,12 +56,12 @@ class ChoresApiController extends BaseApiController
}
}
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Current(Request $request, Response $response, array $args)
{
return $this->FilteredApiResponse($response, $this->getChoresService()->GetCurrent(), $request->getQueryParams());
}
public function TrackChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function TrackChoreExecution(Request $request, Response $response, array $args)
{
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
@@ -99,7 +101,7 @@ class ChoresApiController extends BaseApiController
}
}
public function UndoChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UndoChoreExecution(Request $request, Response $response, array $args)
{
try
{
@@ -114,7 +116,7 @@ class ChoresApiController extends BaseApiController
}
}
public function ChorePrintLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ChorePrintLabel(Request $request, Response $response, array $args)
{
try
{
@@ -138,7 +140,7 @@ class ChoresApiController extends BaseApiController
}
}
public function MergeChores(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function MergeChores(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);

View File

@@ -3,12 +3,14 @@
namespace Grocy\Controllers;
use Grocy\Helpers\Grocycode;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class ChoresController extends BaseController
{
use GrocycodeTrait;
public function ChoreEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ChoreEditForm(Request $request, Response $response, array $args)
{
$usersService = $this->getUsersService();
$users = $usersService->GetUsersAsDto();
@@ -38,7 +40,7 @@ class ChoresController extends BaseController
}
}
public function ChoresList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ChoresList(Request $request, Response $response, array $args)
{
if (isset($request->getQueryParams()['include_disabled']))
{
@@ -56,12 +58,12 @@ class ChoresController extends BaseController
]);
}
public function ChoresSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ChoresSettings(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'choressettings');
}
public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Journal(Request $request, Response $response, array $args)
{
if (isset($request->getQueryParams()['months']) && filter_var($request->getQueryParams()['months'], FILTER_VALIDATE_INT) !== false)
{
@@ -89,7 +91,7 @@ class ChoresController extends BaseController
]);
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Overview(Request $request, Response $response, array $args)
{
$usersService = $this->getUsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['chores_due_soon_days'];
@@ -125,7 +127,7 @@ class ChoresController extends BaseController
]);
}
public function TrackChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function TrackChoreExecution(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'choretracking', [
'chores' => $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
@@ -134,7 +136,7 @@ class ChoresController extends BaseController
]);
}
public function ChoreGrocycodeImage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ChoreGrocycodeImage(Request $request, Response $response, array $args)
{
$gc = new Grocycode(Grocycode::CHORE, $args['choreId']);
return $this->ServeGrocycodeImage($request, $response, $gc);

View File

@@ -2,11 +2,14 @@
namespace Grocy\Controllers;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class EquipmentController extends BaseController
{
protected $UserfieldsService;
public function EditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function EditForm(Request $request, Response $response, array $args)
{
if ($args['equipmentId'] == 'new')
{
@@ -25,7 +28,7 @@ class EquipmentController extends BaseController
}
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Overview(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'equipment', [
'equipment' => $this->getDatabase()->equipment()->orderBy('name', 'COLLATE NOCASE'),

View File

@@ -2,6 +2,7 @@
namespace Grocy\Controllers;
use DI\Container;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Log\LoggerInterface;
use Slim\Exception\HttpException;
@@ -11,15 +12,12 @@ use Throwable;
class ExceptionController extends BaseApiController
{
public function __construct(\Slim\App $app, \DI\Container $container)
public function __construct(\Slim\App $app, Container $container)
{
parent::__construct($container);
$this->app = $app;
}
/**
* @var \Slim\App
*/
private $app;
public function __invoke(ServerRequestInterface $request, Throwable $exception, bool $displayErrorDetails, bool $logErrors, bool $logErrorDetails, ?LoggerInterface $logger = null)
@@ -78,7 +76,7 @@ class ExceptionController extends BaseApiController
return $this->renderPage($response->withStatus(500), 'errors/500', [
'exception' => $exception,
'system_info' => $this->getApplicationService()->GetSystemInfo()
'systemInfo' => $this->getApplicationService()->GetSystemInfo()
]);
}
}

View File

@@ -3,11 +3,14 @@
namespace Grocy\Controllers;
use Grocy\Services\FilesService;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Exception\HttpNotFoundException;
use Slim\Psr7\Stream;
class FilesApiController extends BaseApiController
{
public function DeleteFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function DeleteFile(Request $request, Response $response, array $args)
{
try
{
@@ -35,7 +38,7 @@ class FilesApiController extends BaseApiController
}
}
public function ServeFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ServeFile(Request $request, Response $response, array $args)
{
try
{
@@ -49,10 +52,10 @@ class FilesApiController extends BaseApiController
if (file_exists($filePath))
{
$response->write(file_get_contents($filePath));
$response = $response->withHeader('Cache-Control', 'max-age=2592000');
$response = $response->withHeader('Content-Type', mime_content_type($filePath));
return $response->withHeader('Content-Disposition', 'inline; filename="' . $fileName . '"');
$response = $response->withHeader('Content-Disposition', 'inline; filename="' . $fileName . '"');
return $response->withBody(new Stream(fopen($filePath, 'rb')));
}
else
{
@@ -65,7 +68,7 @@ class FilesApiController extends BaseApiController
}
}
public function ShowFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ShowFile(Request $request, Response $response, array $args)
{
try
{
@@ -80,10 +83,10 @@ class FilesApiController extends BaseApiController
if (file_exists($filePath))
{
$response->write(file_get_contents($filePath));
$response = $response->withHeader('Cache-Control', 'max-age=2592000');
$response = $response->withHeader('Content-Type', mime_content_type($filePath));
return $response->withHeader('Content-Disposition', 'inline; filename="' . $fileName . '"');
$response = $response->withHeader('Content-Disposition', 'inline; filename="' . $fileName . '"');
return $response->withBody(new Stream(fopen($filePath, 'rb')));
}
else
{
@@ -96,7 +99,7 @@ class FilesApiController extends BaseApiController
}
}
public function UploadFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UploadFile(Request $request, Response $response, array $args)
{
try
{
@@ -106,9 +109,27 @@ class FilesApiController extends BaseApiController
}
$fileName = $this->checkFileName($args['fileName']);
$data = $request->getBody()->getContents();
file_put_contents($this->getFilesService()->GetFilePath($args['group'], $fileName), $data);
$fileHandle = fopen($this->getFilesService()->GetFilePath($args['group'], $fileName), 'xb');
if($fileHandle === false)
{
throw new \Exception("Error while creating file $fileName");
}
// Save the file to disk in chunks of 1 MB
$requestBody = $request->getBody();
while ($data = $requestBody->read(1048576))
{
if (fwrite($fileHandle, $data) === false)
{
throw new \Exception("Error while writing file $fileName");
}
}
if (fclose($fileHandle) === false)
{
throw new \Exception("Error while closing file $fileName");
}
return $this->EmptyApiResponse($response);
}
@@ -118,11 +139,6 @@ class FilesApiController extends BaseApiController
}
}
/**
* @param string $fileName base64-encoded file-name
* @return false|string the decoded file-name
* @throws \Exception if the file-name is invalid.
*/
protected function checkFileName(string $fileName)
{
if (IsValidFileName(base64_decode($fileName)))
@@ -137,12 +153,6 @@ class FilesApiController extends BaseApiController
return $fileName;
}
/**
* @param string $group The group the requested files belongs to.
* @param string $fileName The name of the requested file.
* @param array $queryParams Parameter, e.g. for scaling. Optional.
* @return string
*/
protected function getFilePath(string $group, string $fileName, array $queryParams = [])
{
$forceServeAs = null;

View File

@@ -3,11 +3,12 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
use Slim\Exception\HttpBadRequestException;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class GenericEntityApiController extends BaseApiController
{
public function AddObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function AddObject(Request $request, Response $response, array $args)
{
if ($args['entity'] == 'shopping_list' || $args['entity'] == 'shopping_lists')
{
@@ -48,10 +49,16 @@ class GenericEntityApiController extends BaseApiController
$newRow = $this->getDatabase()->{$args['entity']}()->createRow($requestBody);
$newRow->save();
$success = $newRow->isClean();
$newObjectId = $this->getDatabase()->lastInsertId();
// TODO: This should be better done somehow in StockService
if ($args['entity'] == 'products' && boolval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'shopping_list_auto_add_below_min_stock_amount')))
{
$this->getStockService()->AddMissingProductsToShoppingList($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'shopping_list_auto_add_below_min_stock_amount_list_id'));
}
return $this->ApiResponse($response, [
'created_object_id' => $this->getDatabase()->lastInsertId()
'created_object_id' => $newObjectId
]);
}
catch (\Exception $ex)
@@ -65,7 +72,7 @@ class GenericEntityApiController extends BaseApiController
}
}
public function DeleteObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function DeleteObject(Request $request, Response $response, array $args)
{
if ($args['entity'] == 'shopping_list' || $args['entity'] == 'shopping_lists')
{
@@ -83,6 +90,10 @@ class GenericEntityApiController extends BaseApiController
{
User::checkPermission($request, User::PERMISSION_EQUIPMENT);
}
elseif ($args['entity'] == 'api_keys')
{
// Always allowed
}
else
{
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
@@ -102,7 +113,6 @@ class GenericEntityApiController extends BaseApiController
}
$row->delete();
$success = $row->isClean();
return $this->EmptyApiResponse($response);
}
@@ -112,7 +122,7 @@ class GenericEntityApiController extends BaseApiController
}
}
public function EditObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function EditObject(Request $request, Response $response, array $args)
{
if ($args['entity'] == 'shopping_list' || $args['entity'] == 'shopping_lists')
{
@@ -158,7 +168,12 @@ class GenericEntityApiController extends BaseApiController
}
$row->update($requestBody);
$success = $row->isClean();
// TODO: This should be better done somehow in StockService
if ($args['entity'] == 'products' && boolval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'shopping_list_auto_add_below_min_stock_amount')))
{
$this->getStockService()->AddMissingProductsToShoppingList($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'shopping_list_auto_add_below_min_stock_amount_list_id'));
}
return $this->EmptyApiResponse($response);
}
@@ -173,33 +188,36 @@ class GenericEntityApiController extends BaseApiController
}
}
public function GetObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetObject(Request $request, Response $response, array $args)
{
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoListing($args['entity']))
{
$userfields = $this->getUserfieldsService()->GetValues($args['entity'], $args['objectId']);
if (count($userfields) === 0)
{
$userfields = null;
}
$object = $this->getDatabase()->{$args['entity']}($args['objectId']);
if ($object == null)
{
return $this->GenericErrorResponse($response, 'Object not found', 404);
}
$object['userfields'] = $userfields;
return $this->ApiResponse($response, $object);
}
else
if (!$this->IsValidExposedEntity($args['entity']) || $this->IsEntityWithNoListing($args['entity']))
{
return $this->GenericErrorResponse($response, 'Entity does not exist or is not exposed');
}
$object = $this->getDatabase()->{$args['entity']}($args['objectId']);
if ($object == null)
{
return $this->GenericErrorResponse($response, 'Object not found', 404);
}
// TODO: Handle this somehow more generically
$referencingId = $args['objectId'];
if ($args['entity'] == 'stock')
{
$referencingId = $object->stock_id;
}
$userfields = $this->getUserfieldsService()->GetValues($args['entity'], $referencingId);
if (count($userfields) === 0)
{
$userfields = null;
}
$object['userfields'] = $userfields;
return $this->ApiResponse($response, $object);
}
public function GetObjects(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetObjects(Request $request, Response $response, array $args)
{
if (!$this->IsValidExposedEntity($args['entity']) || $this->IsEntityWithNoListing($args['entity']))
{
@@ -207,8 +225,8 @@ class GenericEntityApiController extends BaseApiController
}
$objects = $this->queryData($this->getDatabase()->{$args['entity']}(), $request->getQueryParams());
$userfields = $this->getUserfieldsService()->GetFields($args['entity']);
$userfields = $this->getUserfieldsService()->GetFields($args['entity']);
if (count($userfields) > 0)
{
$allUserfieldValues = $this->getUserfieldsService()->GetAllValues($args['entity']);
@@ -218,7 +236,14 @@ class GenericEntityApiController extends BaseApiController
$userfieldKeyValuePairs = null;
foreach ($userfields as $userfield)
{
$value = FindObjectInArrayByPropertyValue(FindAllObjectsInArrayByPropertyValue($allUserfieldValues, 'object_id', $object->id), 'name', $userfield->name);
// TODO: Handle this somehow more generically
$userfieldReference = 'id';
if ($args['entity'] == 'stock')
{
$userfieldReference = 'stock_id';
}
$value = FindObjectInArrayByPropertyValue(FindAllObjectsInArrayByPropertyValue($allUserfieldValues, 'object_id', $object->{$userfieldReference}), 'name', $userfield->name);
if ($value)
{
$userfieldKeyValuePairs[$userfield->name] = $value->value;
@@ -236,7 +261,7 @@ class GenericEntityApiController extends BaseApiController
return $this->ApiResponse($response, $objects);
}
public function GetUserfields(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetUserfields(Request $request, Response $response, array $args)
{
try
{
@@ -248,7 +273,7 @@ class GenericEntityApiController extends BaseApiController
}
}
public function SetUserfields(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function SetUserfields(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);

View File

@@ -2,16 +2,19 @@
namespace Grocy\Controllers;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class GenericEntityController extends BaseController
{
public function UserentitiesList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UserentitiesList(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'userentities', [
'userentities' => $this->getDatabase()->userentities()->orderBy('name', 'COLLATE NOCASE')
]);
}
public function UserentityEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UserentityEditForm(Request $request, Response $response, array $args)
{
if ($args['userentityId'] == 'new')
{
@@ -28,7 +31,7 @@ class GenericEntityController extends BaseController
}
}
public function UserfieldEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UserfieldEditForm(Request $request, Response $response, array $args)
{
if ($args['userfieldId'] == 'new')
{
@@ -49,7 +52,7 @@ class GenericEntityController extends BaseController
}
}
public function UserfieldsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UserfieldsList(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'userfields', [
'userfields' => $this->getUserfieldsService()->GetAllFields(),
@@ -57,7 +60,7 @@ class GenericEntityController extends BaseController
]);
}
public function UserobjectEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UserobjectEditForm(Request $request, Response $response, array $args)
{
$userentity = $this->getDatabase()->userentities()->where('name = :1', $args['userentityName'])->fetch();
@@ -80,7 +83,7 @@ class GenericEntityController extends BaseController
}
}
public function UserobjectsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UserobjectsList(Request $request, Response $response, array $args)
{
$userentity = $this->getDatabase()->userentities()->where('name = :1', $args['userentityName'])->fetch();

View File

@@ -3,31 +3,31 @@
namespace Grocy\Controllers;
use Grocy\Helpers\Grocycode;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use jucksearm\barcode\lib\BarcodeFactory;
use jucksearm\barcode\lib\DatamatrixFactory;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
trait GrocycodeTrait
{
public function ServeGrocycodeImage(ServerRequestInterface $request, ResponseInterface $response, Grocycode $grocycode)
public function ServeGrocycodeImage(Request $request, Response $response, Grocycode $grocycode)
{
$size = $request->getQueryParam('size', null);
if (GROCY_GROCYCODE_TYPE == '2D')
{
$png = (new DatamatrixFactory())->setCode((string) $grocycode)->setSize($size)->getDatamatrixPngData();
$png = (new DatamatrixFactory())->setCode((string)$grocycode)->setSize($size)->getDatamatrixPngData();
}
else
{
$png = (new BarcodeFactory())->setType('C128')->setCode((string) $grocycode)->setHeight($size)->getBarcodePngData();
$png = (new BarcodeFactory())->setType('C128')->setCode((string)$grocycode)->setHeight($size)->getBarcodePngData();
}
$isDownload = $request->getQueryParam('download', false);
if ($isDownload)
{
$response = $response->withHeader('Content-Type', 'application/octet-stream')
->withHeader('Content-Disposition', 'attachment; filename=grocycode.png')
->withHeader('Content-Disposition', 'attachment; filename=Grocycode.png')
->withHeader('Content-Length', strlen($png))
->withHeader('Cache-Control', 'no-cache')
->withHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT');

View File

@@ -3,24 +3,26 @@
namespace Grocy\Controllers;
use Grocy\Services\SessionService;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class LoginController extends BaseController
{
public function LoginPage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function LoginPage(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'login');
}
public function Logout(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Logout(Request $request, Response $response, array $args)
{
$this->getSessionService()->RemoveSession($_COOKIE[SessionService::SESSION_COOKIE_NAME]);
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl('/'));
}
public function ProcessLogin(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProcessLogin(Request $request, Response $response, array $args)
{
$authMiddlewareClass = GROCY_AUTH_CLASS;
if ($authMiddlewareClass::ProcessLogin($this->GetParsedAndFilteredRequestBody($request)))
if ($authMiddlewareClass::ProcessLogin($request->getParsedBody()))
{
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl('/'));
}

View File

@@ -3,30 +3,47 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
use Grocy\Services\ApiKeyService;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class OpenApiController extends BaseApiController
{
public function ApiKeysList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ApiKeysList(Request $request, Response $response, array $args)
{
$selectedKeyId = -1;
if (isset($request->getQueryParams()['key']) && filter_var($request->getQueryParams()['key'], FILTER_VALIDATE_INT))
{
$selectedKeyId = $request->getQueryParams()['key'];
}
$apiKeys = $this->getDatabase()->api_keys();
if (!User::hasPermissions(User::PERMISSION_ADMIN))
{
$apiKeys = $apiKeys->where('user_id', GROCY_USER_ID);
}
return $this->renderPage($response, 'manageapikeys', [
'apiKeys' => $apiKeys,
'users' => $this->getDatabase()->users()
'users' => $this->getDatabase()->users(),
'selectedKeyId' => $selectedKeyId
]);
}
public function CreateNewApiKey(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function CreateNewApiKey(Request $request, Response $response, array $args)
{
$newApiKey = $this->getApiKeyService()->CreateApiKey();
$description = null;
if (isset($request->getQueryParams()['description']))
{
$description = $request->getQueryParams()['description'];
}
$newApiKey = $this->getApiKeyService()->CreateApiKey(ApiKeyService::API_KEY_TYPE_DEFAULT, $description);
$newApiKeyId = $this->getApiKeyService()->GetApiKeyId($newApiKey);
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl("/manageapikeys?CreatedApiKeyId=$newApiKeyId"));
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl("/manageapikeys?key=$newApiKeyId"));
}
public function DocumentationSpec(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function DocumentationSpec(Request $request, Response $response, array $args)
{
$spec = $this->getOpenApiSpec();
@@ -36,7 +53,8 @@ class OpenApiController extends BaseApiController
$spec->info->description = str_replace('PlaceHolderManageApiKeysUrl', $this->AppContainer->get('UrlManager')->ConstructUrl('/manageapikeys'), $spec->info->description);
$spec->servers[0]->url = $this->AppContainer->get('UrlManager')->ConstructUrl('/api');
$spec->components->schemas->ExposedEntity_IncludingUserEntities = clone $spec->components->schemas->StringEnumTemplate;;
$spec->components->schemas->ExposedEntity_IncludingUserEntities = clone $spec->components->schemas->StringEnumTemplate;
;
foreach ($this->getUserfieldsService()->GetEntities() as $userEntity)
{
array_push($spec->components->schemas->ExposedEntity_IncludingUserEntities->enum, $userEntity);
@@ -87,7 +105,7 @@ class OpenApiController extends BaseApiController
return $this->ApiResponse($response, $spec);
}
public function DocumentationUi(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function DocumentationUi(Request $request, Response $response, array $args)
{
return $this->render($response, 'openapiui');
}

View File

@@ -3,11 +3,12 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
use Grocy\Services\StockService;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class PrintApiController extends BaseApiController
{
public function PrintShoppingListThermal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function PrintShoppingListThermal(Request $request, Response $response, array $args)
{
try
{

View File

@@ -5,10 +5,12 @@ namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
use Grocy\Helpers\WebhookRunner;
use Grocy\Helpers\Grocycode;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class RecipesApiController extends BaseApiController
{
public function AddNotFulfilledProductsToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function AddNotFulfilledProductsToShoppingList(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
@@ -24,7 +26,7 @@ class RecipesApiController extends BaseApiController
return $this->EmptyApiResponse($response);
}
public function ConsumeRecipe(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ConsumeRecipe(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_STOCK_CONSUME);
@@ -39,7 +41,7 @@ class RecipesApiController extends BaseApiController
}
}
public function GetRecipeFulfillment(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetRecipeFulfillment(Request $request, Response $response, array $args)
{
try
{
@@ -65,7 +67,7 @@ class RecipesApiController extends BaseApiController
}
}
public function CopyRecipe(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function CopyRecipe(Request $request, Response $response, array $args)
{
try
{
@@ -79,7 +81,7 @@ class RecipesApiController extends BaseApiController
}
}
public function RecipePrintLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function RecipePrintLabel(Request $request, Response $response, array $args)
{
try
{

View File

@@ -4,12 +4,14 @@ namespace Grocy\Controllers;
use Grocy\Services\RecipesService;
use Grocy\Helpers\Grocycode;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class RecipesController extends BaseController
{
use GrocycodeTrait;
public function MealPlan(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function MealPlan(Request $request, Response $response, array $args)
{
$start = date('Y-m-d');
if (isset($request->getQueryParams()['start']) && IsIsoDate($request->getQueryParams()['start']))
@@ -23,7 +25,7 @@ class RecipesController extends BaseController
$days = $request->getQueryParams()['days'];
}
$mealPlanWhereTimespan = "day BETWEEN DATE('$start') AND DATE('$start', '+$days days')";
$mealPlanWhereTimespan = "day BETWEEN DATE('$start', '-$days days') AND DATE('$start', '+$days days')";
$recipes = $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->fetchAll();
$events = [];
@@ -55,20 +57,28 @@ class RecipesController extends BaseController
];
}
$weekRecipe = $this->getDatabase()->recipes()->where("type = 'mealplan-week' AND name = LTRIM(STRFTIME('%Y-%W', DATE('$start')), '0')")->fetch();
$weekRecipeId = 0;
if ($weekRecipe != null)
{
$weekRecipeId = $weekRecipe->id;
}
return $this->renderPage($response, 'mealplan', [
'fullcalendarEventSources' => $events,
'recipes' => $recipes,
'internalRecipes' => $this->getDatabase()->recipes()->where("id IN (SELECT recipe_id FROM meal_plan_internal_recipe_relation WHERE $mealPlanWhereTimespan)")->fetchAll(),
'recipesResolved' => $this->getRecipesService()->GetRecipesResolved("recipe_id IN (SELECT recipe_id FROM meal_plan_internal_recipe_relation WHERE $mealPlanWhereTimespan)"),
'internalRecipes' => $this->getDatabase()->recipes()->where("id IN (SELECT recipe_id FROM meal_plan_internal_recipe_relation WHERE $mealPlanWhereTimespan) OR id = $weekRecipeId")->fetchAll(),
'recipesResolved' => $this->getRecipesService()->GetRecipesResolved("recipe_id IN (SELECT recipe_id FROM meal_plan_internal_recipe_relation WHERE $mealPlanWhereTimespan) OR recipe_id = $weekRecipeId"),
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
'mealplanSections' => $this->getDatabase()->meal_plan_sections()->orderBy('sort_number'),
'usedMealplanSections' => $this->getDatabase()->meal_plan_sections()->where("id IN (SELECT section_id FROM meal_plan WHERE $mealPlanWhereTimespan)")->orderBy('sort_number')
'usedMealplanSections' => $this->getDatabase()->meal_plan_sections()->where("id IN (SELECT section_id FROM meal_plan WHERE $mealPlanWhereTimespan)")->orderBy('sort_number'),
'weekRecipe' => $weekRecipe
]);
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Overview(Request $request, Response $response, array $args)
{
$recipes = $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name', 'COLLATE NOCASE');
$recipesResolved = $this->getRecipesService()->GetRecipesResolved('recipe_id > 0');
@@ -95,7 +105,7 @@ class RecipesController extends BaseController
$totalCalories = FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $selectedRecipe->id)->calories;
}
$renderArray = [
$viewData = [
'recipes' => $recipes,
'recipesResolved' => $recipesResolved,
'recipePositionsResolved' => $this->getDatabase()->recipes_pos_resolved()->where('recipe_id', $selectedRecipe->id),
@@ -104,9 +114,10 @@ class RecipesController extends BaseController
'quantityUnits' => $this->getDatabase()->quantity_units(),
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('recipes'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
'selectedRecipeTotalCosts' => $totalCosts,
'selectedRecipeTotalCalories' => $totalCalories
'selectedRecipeTotalCalories' => $totalCalories,
'mealplanSections' => $this->getDatabase()->meal_plan_sections()->orderBy('sort_number')
];
if ($selectedRecipe)
@@ -137,15 +148,15 @@ class RecipesController extends BaseController
}
}
$renderArray['selectedRecipeSubRecipes'] = $selectedRecipeSubRecipes;
$renderArray['includedRecipeIdsAbsolute'] = $includedRecipeIdsAbsolute;
$renderArray['allRecipePositions'] = $allRecipePositions;
$viewData['selectedRecipeSubRecipes'] = $selectedRecipeSubRecipes;
$viewData['includedRecipeIdsAbsolute'] = $includedRecipeIdsAbsolute;
$viewData['allRecipePositions'] = $allRecipePositions;
}
return $this->renderPage($response, 'recipes', $renderArray);
return $this->renderPage($response, 'recipes', $viewData);
}
public function RecipeEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function RecipeEditForm(Request $request, Response $response, array $args)
{
$recipeId = $args['recipeId'];
@@ -158,11 +169,11 @@ class RecipesController extends BaseController
'recipes' => $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name', 'COLLATE NOCASE'),
'recipeNestings' => $this->getDatabase()->recipes_nestings()->where('recipe_id', $recipeId),
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved()
]);
}
public function RecipePosEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function RecipePosEditForm(Request $request, Response $response, array $args)
{
if ($args['recipePosId'] == 'new')
{
@@ -171,8 +182,9 @@ class RecipesController extends BaseController
'recipe' => $this->getDatabase()->recipes($args['recipeId']),
'recipePos' => new \stdClass(),
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved()
]);
}
else
@@ -182,18 +194,19 @@ class RecipesController extends BaseController
'recipe' => $this->getDatabase()->recipes($args['recipeId']),
'recipePos' => $this->getDatabase()->recipes_pos($args['recipePosId']),
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved()
]);
}
}
public function RecipesSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function RecipesSettings(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'recipessettings');
}
public function MealPlanSectionEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function MealPlanSectionEditForm(Request $request, Response $response, array $args)
{
if ($args['sectionId'] == 'new')
{
@@ -210,14 +223,14 @@ class RecipesController extends BaseController
}
}
public function MealPlanSectionsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function MealPlanSectionsList(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'mealplansections', [
'mealplanSections' => $this->getDatabase()->meal_plan_sections()->where('id > 0')->orderBy('sort_number')
]);
}
public function RecipeGrocycodeImage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function RecipeGrocycodeImage(Request $request, Response $response, array $args)
{
$gc = new Grocycode(Grocycode::RECIPE, $args['recipeId']);
return $this->ServeGrocycodeImage($request, $response, $gc);

View File

@@ -6,10 +6,12 @@ use Grocy\Controllers\Users\User;
use Grocy\Services\StockService;
use Grocy\Helpers\WebhookRunner;
use Grocy\Helpers\Grocycode;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class StockApiController extends BaseApiController
{
public function AddMissingProductsToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function AddMissingProductsToShoppingList(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
@@ -33,7 +35,7 @@ class StockApiController extends BaseApiController
}
}
public function AddOverdueProductsToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function AddOverdueProductsToShoppingList(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
@@ -57,7 +59,7 @@ class StockApiController extends BaseApiController
}
}
public function AddExpiredProductsToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function AddExpiredProductsToShoppingList(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
@@ -81,7 +83,7 @@ class StockApiController extends BaseApiController
}
}
public function AddProduct(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function AddProduct(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_STOCK_PURCHASE);
@@ -158,7 +160,7 @@ class StockApiController extends BaseApiController
}
}
public function AddProductByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function AddProductByBarcode(Request $request, Response $response, array $args)
{
try
{
@@ -171,7 +173,7 @@ class StockApiController extends BaseApiController
}
}
public function AddProductToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function AddProductToShoppingList(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
@@ -224,7 +226,7 @@ class StockApiController extends BaseApiController
}
}
public function ClearShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ClearShoppingList(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_DELETE);
@@ -253,7 +255,7 @@ class StockApiController extends BaseApiController
}
}
public function ConsumeProduct(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ConsumeProduct(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_STOCK_CONSUME);
@@ -324,7 +326,7 @@ class StockApiController extends BaseApiController
}
}
public function ConsumeProductByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ConsumeProductByBarcode(Request $request, Response $response, array $args)
{
try
{
@@ -349,12 +351,12 @@ class StockApiController extends BaseApiController
}
}
public function CurrentStock(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function CurrentStock(Request $request, Response $response, array $args)
{
return $this->ApiResponse($response, $this->getStockService()->GetCurrentStock());
}
public function CurrentVolatileStock(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function CurrentVolatileStock(Request $request, Response $response, array $args)
{
$nextXDays = 5;
@@ -375,7 +377,7 @@ class StockApiController extends BaseApiController
]);
}
public function EditStockEntry(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function EditStockEntry(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);
@@ -433,14 +435,13 @@ class StockApiController extends BaseApiController
}
}
public function ExternalBarcodeLookup(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ExternalBarcodeLookup(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
try
{
$addFoundProduct = false;
if (isset($request->getQueryParams()['add']) && ($request->getQueryParams()['add'] === 'true' || $request->getQueryParams()['add'] === 1))
{
$addFoundProduct = true;
@@ -454,7 +455,7 @@ class StockApiController extends BaseApiController
}
}
public function InventoryProduct(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function InventoryProduct(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_STOCK_INVENTORY);
@@ -524,7 +525,7 @@ class StockApiController extends BaseApiController
}
}
public function InventoryProductByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function InventoryProductByBarcode(Request $request, Response $response, array $args)
{
try
{
@@ -537,7 +538,7 @@ class StockApiController extends BaseApiController
}
}
public function OpenProduct(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function OpenProduct(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_STOCK_OPEN);
@@ -578,7 +579,7 @@ class StockApiController extends BaseApiController
}
}
public function OpenProductByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function OpenProductByBarcode(Request $request, Response $response, array $args)
{
try
{
@@ -603,7 +604,7 @@ class StockApiController extends BaseApiController
}
}
public function ProductDetails(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductDetails(Request $request, Response $response, array $args)
{
try
{
@@ -615,7 +616,7 @@ class StockApiController extends BaseApiController
}
}
public function ProductDetailsByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductDetailsByBarcode(Request $request, Response $response, array $args)
{
try
{
@@ -628,7 +629,7 @@ class StockApiController extends BaseApiController
}
}
public function ProductPriceHistory(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductPriceHistory(Request $request, Response $response, array $args)
{
try
{
@@ -640,7 +641,7 @@ class StockApiController extends BaseApiController
}
}
public function ProductStockEntries(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductStockEntries(Request $request, Response $response, array $args)
{
$allowSubproductSubstitution = false;
if (isset($request->getQueryParams()['include_sub_products']) && filter_var($request->getQueryParams()['include_sub_products'], FILTER_VALIDATE_BOOLEAN) !== false)
@@ -651,12 +652,12 @@ class StockApiController extends BaseApiController
return $this->FilteredApiResponse($response, $this->getStockService()->GetProductStockEntries($args['productId'], false, $allowSubproductSubstitution), $request->getQueryParams());
}
public function LocationStockEntries(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function LocationStockEntries(Request $request, Response $response, array $args)
{
return $this->FilteredApiResponse($response, $this->getStockService()->GetLocationStockEntries($args['locationId']), $request->getQueryParams());
}
public function ProductStockLocations(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductStockLocations(Request $request, Response $response, array $args)
{
$allowSubproductSubstitution = false;
if (isset($request->getQueryParams()['include_sub_products']) && filter_var($request->getQueryParams()['include_sub_products'], FILTER_VALIDATE_BOOLEAN) !== false)
@@ -667,7 +668,7 @@ class StockApiController extends BaseApiController
return $this->FilteredApiResponse($response, $this->getStockService()->GetProductStockLocations($args['productId'], $allowSubproductSubstitution), $request->getQueryParams());
}
public function ProductPrintLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductPrintLabel(Request $request, Response $response, array $args)
{
try
{
@@ -691,7 +692,7 @@ class StockApiController extends BaseApiController
}
}
public function StockEntryPrintLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function StockEntryPrintLabel(Request $request, Response $response, array $args)
{
try
{
@@ -721,7 +722,7 @@ class StockApiController extends BaseApiController
}
}
public function RemoveProductFromShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function RemoveProductFromShoppingList(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_DELETE);
@@ -762,7 +763,7 @@ class StockApiController extends BaseApiController
}
}
public function StockBooking(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function StockBooking(Request $request, Response $response, array $args)
{
try
{
@@ -781,12 +782,12 @@ class StockApiController extends BaseApiController
}
}
public function StockEntry(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function StockEntry(Request $request, Response $response, array $args)
{
return $this->ApiResponse($response, $this->getStockService()->GetStockEntry($args['entryId']));
}
public function StockTransactions(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function StockTransactions(Request $request, Response $response, array $args)
{
try
{
@@ -804,7 +805,7 @@ class StockApiController extends BaseApiController
}
}
public function TransferProduct(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function TransferProduct(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_STOCK_TRANSFER);
@@ -849,7 +850,7 @@ class StockApiController extends BaseApiController
}
}
public function TransferProductByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function TransferProductByBarcode(Request $request, Response $response, array $args)
{
try
{
@@ -874,7 +875,7 @@ class StockApiController extends BaseApiController
}
}
public function UndoBooking(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UndoBooking(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);
@@ -889,7 +890,7 @@ class StockApiController extends BaseApiController
}
}
public function UndoTransaction(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UndoTransaction(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);
@@ -904,7 +905,7 @@ class StockApiController extends BaseApiController
}
}
public function MergeProducts(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function MergeProducts(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);

View File

@@ -4,12 +4,14 @@ namespace Grocy\Controllers;
use Grocy\Helpers\Grocycode;
use Grocy\Services\RecipesService;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class StockController extends BaseController
{
use GrocycodeTrait;
public function Consume(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Consume(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'consume', [
'products' => $this->getDatabase()->products()->where('active = 1')->where('id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)')->orderBy('name'),
@@ -17,24 +19,24 @@ class StockController extends BaseController
'recipes' => $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved()
]);
}
public function Inventory(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Inventory(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'inventory', [
'products' => $this->getDatabase()->products()->where('active = 1 AND no_own_stock = 0')->orderBy('name', 'COLLATE NOCASE'),
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
'userfields' => $this->getUserfieldsService()->GetFields('stock')
]);
}
public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Journal(Request $request, Response $response, array $args)
{
if (isset($request->getQueryParams()['months']) && filter_var($request->getQueryParams()['months'], FILTER_VALIDATE_INT) !== false)
{
@@ -66,7 +68,7 @@ class StockController extends BaseController
]);
}
public function LocationContentSheet(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function LocationContentSheet(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'locationcontentsheet', [
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
@@ -76,7 +78,7 @@ class StockController extends BaseController
]);
}
public function LocationEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function LocationEditForm(Request $request, Response $response, array $args)
{
if ($args['locationId'] == 'new')
{
@@ -95,35 +97,43 @@ class StockController extends BaseController
}
}
public function LocationsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function LocationsList(Request $request, Response $response, array $args)
{
if (isset($request->getQueryParams()['include_disabled']))
{
$locations = $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE');
}
else
{
$locations = $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
}
return $this->renderPage($response, 'locations', [
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'locations' => $locations,
'userfields' => $this->getUserfieldsService()->GetFields('locations'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('locations')
]);
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Overview(Request $request, Response $response, array $args)
{
$usersService = $this->getUsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['stock_due_soon_days'];
return $this->renderPage($response, 'stockoverview', [
'currentStock' => $this->getStockService()->GetCurrentStockOverview(),
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
'nextXDays' => $nextXDays,
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE'),
'productGroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'userfields' => $this->getUserfieldsService()->GetFields('products'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('products')
]);
}
public function ProductBarcodesEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductBarcodesEditForm(Request $request, Response $response, array $args)
{
$product = null;
if (isset($request->getQueryParams()['product']))
{
$product = $this->getDatabase()->products($request->getQueryParams()['product']);
@@ -135,9 +145,9 @@ class StockController extends BaseController
'mode' => 'create',
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
'product' => $product,
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
'userfields' => $this->getUserfieldsService()->GetFields('product_barcodes')
]);
}
@@ -147,25 +157,26 @@ class StockController extends BaseController
'mode' => 'edit',
'barcode' => $this->getDatabase()->product_barcodes($args['productBarcodeId']),
'product' => $product,
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
'userfields' => $this->getUserfieldsService()->GetFields('product_barcodes')
]);
}
}
public function ProductEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductEditForm(Request $request, Response $response, array $args)
{
if ($args['productId'] == 'new')
{
return $this->renderPage($response, 'productform', [
'locations' => $this->getDatabase()->locations()->orderBy('name'),
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name'),
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityunitsStock' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'productgroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE'),
'referencedQuantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'productgroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'userfields' => $this->getUserfieldsService()->GetFields('products'),
'products' => $this->getDatabase()->products()->where('parent_product_id IS NULL and active = 1')->orderBy('name', 'COLLATE NOCASE'),
'isSubProductOfOthers' => false,
@@ -178,30 +189,31 @@ class StockController extends BaseController
return $this->renderPage($response, 'productform', [
'product' => $product,
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityunitsStock' => $this->getDatabase()->quantity_units()->where('id IN (SELECT to_qu_id FROM quantity_unit_conversions_resolved WHERE product_id = :1) OR NOT EXISTS(SELECT 1 FROM stock_log WHERE product_id = :1)', $product->id)->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'productgroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE'),
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityunitsStock' => $this->getDatabase()->quantity_units()->where('id IN (SELECT to_qu_id FROM cache__quantity_unit_conversions_resolved WHERE product_id = :1) OR NOT EXISTS(SELECT 1 FROM stock_log WHERE product_id = :1)', $product->id)->orderBy('name', 'COLLATE NOCASE'),
'referencedQuantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->where('id IN (SELECT to_qu_id FROM cache__quantity_unit_conversions_resolved WHERE product_id = :1)', $product->id)->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'productgroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'userfields' => $this->getUserfieldsService()->GetFields('products'),
'products' => $this->getDatabase()->products()->where('id != :1 AND parent_product_id IS NULL and active = 1', $product->id)->orderBy('name', 'COLLATE NOCASE'),
'isSubProductOfOthers' => $this->getDatabase()->products()->where('parent_product_id = :1', $product->id)->count() !== 0,
'mode' => 'edit',
'quConversions' => $this->getDatabase()->quantity_unit_conversions(),
'quConversions' => $this->getDatabase()->quantity_unit_conversions()->where('product_id', $product->id),
'productBarcodeUserfields' => $this->getUserfieldsService()->GetFields('product_barcodes'),
'productBarcodeUserfieldValues' => $this->getUserfieldsService()->GetAllValues('product_barcodes')
]);
}
}
public function ProductGrocycodeImage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductGrocycodeImage(Request $request, Response $response, array $args)
{
$gc = new Grocycode(Grocycode::PRODUCT, $args['productId']);
return $this->ServeGrocycodeImage($request, $response, $gc);
}
public function ProductGroupEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductGroupEditForm(Request $request, Response $response, array $args)
{
if ($args['productGroupId'] == 'new')
{
@@ -220,17 +232,26 @@ class StockController extends BaseController
}
}
public function ProductGroupsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductGroupsList(Request $request, Response $response, array $args)
{
if (isset($request->getQueryParams()['include_disabled']))
{
$productGroups = $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE');
}
else
{
$productGroups = $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
}
return $this->renderPage($response, 'productgroups', [
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE'),
'productGroups' => $productGroups,
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'userfields' => $this->getUserfieldsService()->GetFields('product_groups'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('product_groups')
]);
}
public function ProductsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ProductsList(Request $request, Response $response, array $args)
{
$products = $this->getDatabase()->products();
if (!isset($request->getQueryParams()['include_disabled']))
@@ -242,6 +263,10 @@ class StockController extends BaseController
{
$products = $products->where('id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)');
}
if (isset($request->getQueryParams()['only_out_of_stock']))
{
$products = $products->where('id NOT IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)');
}
$products = $products->orderBy('name', 'COLLATE NOCASE');
@@ -249,30 +274,29 @@ class StockController extends BaseController
'products' => $products,
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE'),
'productGroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'shoppingLocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'userfields' => $this->getUserfieldsService()->GetFields('products'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('products')
]);
}
public function Purchase(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Purchase(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'purchase', [
'products' => $this->getDatabase()->products()->where('active = 1 AND no_own_stock = 0')->orderBy('name', 'COLLATE NOCASE'),
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
'userfields' => $this->getUserfieldsService()->GetFields('stock')
]);
}
public function QuantityUnitConversionEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function QuantityUnitConversionEditForm(Request $request, Response $response, array $args)
{
$product = null;
if (isset($request->getQueryParams()['product']))
{
$product = $this->getDatabase()->products($request->getQueryParams()['product']);
@@ -290,7 +314,7 @@ class StockController extends BaseController
return $this->renderPage($response, 'quantityunitconversionform', [
'mode' => 'create',
'userfields' => $this->getUserfieldsService()->GetFields('quantity_unit_conversions'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'product' => $product,
'defaultQuUnit' => $defaultQuUnit
]);
@@ -301,14 +325,14 @@ class StockController extends BaseController
'quConversion' => $this->getDatabase()->quantity_unit_conversions($args['quConversionId']),
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('quantity_unit_conversions'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'product' => $product,
'defaultQuUnit' => $defaultQuUnit
]);
}
}
public function QuantityUnitEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function QuantityUnitEditForm(Request $request, Response $response, array $args)
{
if ($args['quantityunitId'] == 'new')
{
@@ -335,47 +359,57 @@ class StockController extends BaseController
}
}
public function QuantityUnitPluralFormTesting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function QuantityUnitPluralFormTesting(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'quantityunitpluraltesting', [
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE')
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE')
]);
}
public function QuantityUnitsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function QuantityUnitsList(Request $request, Response $response, array $args)
{
if (isset($request->getQueryParams()['include_disabled']))
{
$quantityUnits = $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE');
}
else
{
$quantityUnits = $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
}
return $this->renderPage($response, 'quantityunits', [
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityunits' => $quantityUnits,
'userfields' => $this->getUserfieldsService()->GetFields('quantity_units'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('quantity_units')
]);
}
public function ShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ShoppingList(Request $request, Response $response, array $args)
{
$listId = 1;
if (isset($request->getQueryParams()['list']))
{
$listId = $request->getQueryParams()['list'];
}
return $this->renderPage($response, 'shoppinglist', [
'listItems' => $this->getDatabase()->uihelper_shopping_list()->where('shopping_list_id = :1', $listId),
'listItems' => $this->getDatabase()->uihelper_shopping_list()->where('shopping_list_id = :1', $listId)->orderBy('product_name', 'COLLATE NOCASE'),
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'missingProducts' => $this->getStockService()->GetMissingProducts(),
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
'shoppingLists' => $this->getDatabase()->shopping_lists_view()->orderBy('name', 'COLLATE NOCASE'),
'selectedShoppingListId' => $listId,
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
'productUserfields' => $this->getUserfieldsService()->GetFields('products'),
'productUserfieldValues' => $this->getUserfieldsService()->GetAllValues('products'),
'productGroupUserfields' => $this->getUserfieldsService()->GetFields('product_groups'),
'productGroupUserfieldValues' => $this->getUserfieldsService()->GetAllValues('product_groups'),
'userfields' => $this->getUserfieldsService()->GetFields('shopping_list'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('shopping_list')
]);
}
public function ShoppingListEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ShoppingListEditForm(Request $request, Response $response, array $args)
{
if ($args['listId'] == 'new')
{
@@ -394,7 +428,7 @@ class StockController extends BaseController
}
}
public function ShoppingListItemEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ShoppingListItemEditForm(Request $request, Response $response, array $args)
{
if ($args['itemId'] == 'new')
{
@@ -403,8 +437,8 @@ class StockController extends BaseController
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
'mode' => 'create',
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
'userfields' => $this->getUserfieldsService()->GetFields('shopping_list')
]);
}
@@ -416,21 +450,21 @@ class StockController extends BaseController
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
'mode' => 'edit',
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
'userfields' => $this->getUserfieldsService()->GetFields('shopping_list')
]);
}
}
public function ShoppingListSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ShoppingListSettings(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'shoppinglistsettings', [
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE')
]);
}
public function ShoppingLocationEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ShoppingLocationEditForm(Request $request, Response $response, array $args)
{
if ($args['shoppingLocationId'] == 'new')
{
@@ -442,41 +476,50 @@ class StockController extends BaseController
else
{
return $this->renderPage($response, 'shoppinglocationform', [
'shoppinglocation' => $this->getDatabase()->shopping_locations($args['shoppingLocationId']),
'shoppingLocation' => $this->getDatabase()->shopping_locations($args['shoppingLocationId']),
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('shopping_locations')
]);
}
}
public function ShoppingLocationsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ShoppingLocationsList(Request $request, Response $response, array $args)
{
if (isset($request->getQueryParams()['include_disabled']))
{
$shoppingLocations = $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE');
}
else
{
$shoppingLocations = $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
}
return $this->renderPage($response, 'shoppinglocations', [
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $shoppingLocations,
'userfields' => $this->getUserfieldsService()->GetFields('shopping_locations'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('shopping_locations')
]);
}
public function StockEntryEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function StockEntryEditForm(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'stockentryform', [
'stockEntry' => $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch(),
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'userfields' => $this->getUserfieldsService()->GetFields('stock')
]);
}
public function StockEntryGrocycodeImage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function StockEntryGrocycodeImage(Request $request, Response $response, array $args)
{
$stockEntry = $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch();
$gc = new Grocycode(Grocycode::PRODUCT, $stockEntry->product_id, [$stockEntry->stock_id]);
return $this->ServeGrocycodeImage($request, $response, $gc);
}
public function StockEntryGrocycodeLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function StockEntryGrocycodeLabel(Request $request, Response $response, array $args)
{
$stockEntry = $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch();
return $this->renderPage($response, 'stockentrylabel', [
@@ -485,26 +528,26 @@ class StockController extends BaseController
]);
}
public function StockSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function StockSettings(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'stocksettings', [
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE')
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'productGroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE')
]);
}
public function Stockentries(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Stockentries(Request $request, Response $response, array $args)
{
$usersService = $this->getUsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['stock_due_soon_days'];
return $this->renderPage($response, 'stockentries', [
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'stockEntries' => $this->getDatabase()->stock()->orderBy('product_id'),
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'stockEntries' => $this->getDatabase()->uihelper_stock_entries()->orderBy('product_id'),
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
'nextXDays' => $nextXDays,
'userfieldsProducts' => $this->getUserfieldsService()->GetFields('products'),
@@ -514,18 +557,18 @@ class StockController extends BaseController
]);
}
public function Transfer(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Transfer(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'transfer', [
'products' => $this->getDatabase()->products()->where('active = 1')->where('no_own_stock = 0 AND id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)')->orderBy('name', 'COLLATE NOCASE'),
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved()
]);
}
public function JournalSummary(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function JournalSummary(Request $request, Response $response, array $args)
{
$entries = $this->getDatabase()->uihelper_stock_journal_summary();
if (isset($request->getQueryParams()['product_id']))
@@ -549,4 +592,24 @@ class StockController extends BaseController
'transactionTypes' => GetClassConstants('\Grocy\Services\StockService', 'TRANSACTION_TYPE_')
]);
}
public function QuantityUnitConversionsResolved(Request $request, Response $response, array $args)
{
$product = null;
if (isset($request->getQueryParams()['product']))
{
$product = $this->getDatabase()->products($request->getQueryParams()['product']);
$quantityUnitConversionsResolved = $this->getDatabase()->cache__quantity_unit_conversions_resolved()->where('product_id', $product->id);
}
else
{
$quantityUnitConversionsResolved = $this->getDatabase()->cache__quantity_unit_conversions_resolved()->where('product_id IS NULL');
}
return $this->renderPage($response, 'quantityunitconversionsresolved', [
'product' => $product,
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $quantityUnitConversionsResolved
]);
}
}

View File

@@ -0,0 +1,105 @@
<?php
namespace Grocy\Controllers;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class StockReportsController extends BaseController
{
public function Spendings(Request $request, Response $response, array $args)
{
$where = "pph.transaction_type != 'self-production'";
if (isset($request->getQueryParams()['start_date']) && isset($request->getQueryParams()['end_date']) && IsIsoDate($request->getQueryParams()['start_date']) && IsIsoDate($request->getQueryParams()['end_date']))
{
$startDate = $request->getQueryParams()['start_date'];
$endDate = $request->getQueryParams()['end_date'];
$where .= " AND pph.purchased_date BETWEEN '$startDate' AND '$endDate'";
}
else
{
// Default to this month
$where .= " AND pph.purchased_date >= DATE(DATE('now', 'localtime'), 'start of month')";
}
$groupBy = 'product';
if (isset($request->getQueryParams()['group-by']) && in_array($request->getQueryParams()['group-by'], ['product', 'productgroup', 'store']))
{
$groupBy = $request->getQueryParams()['group-by'];
}
if ($groupBy == 'product')
{
if (isset($request->getQueryParams()['product-group']))
{
if ($request->getQueryParams()['product-group'] == 'ungrouped')
{
$where .= ' AND pg.id IS NULL';
}
elseif ($request->getQueryParams()['product-group'] != 'all')
{
$where .= ' AND pg.id = ' . $request->getQueryParams()['product-group'];
}
}
$sql = "
SELECT
p.id AS id,
p.name AS name,
pg.id AS group_id,
pg.name AS group_name,
SUM(pph.amount * pph.price) AS total
FROM products_price_history pph
JOIN products p
ON pph.product_id = p.id
LEFT JOIN product_groups pg
ON p.product_group_id = pg.id
WHERE $where
GROUP BY p.id, p.name, pg.id, pg.name
ORDER BY p.name COLLATE NOCASE
";
}
elseif ($groupBy == 'productgroup')
{
$sql = "
SELECT
pg.id AS id,
pg.name AS name,
SUM(pph.amount * pph.price) AS total
FROM products_price_history pph
JOIN products p
ON pph.product_id = p.id
LEFT JOIN product_groups pg
ON p.product_group_id = pg.id
WHERE $where
GROUP BY pg.id, pg.name
ORDER BY pg.name COLLATE NOCASE
";
}
elseif ($groupBy == 'store')
{
$sql = "
SELECT
sl.id AS id,
sl.name AS name,
SUM(pph.amount * pph.price) AS total
FROM products_price_history pph
JOIN products p
ON pph.product_id = p.id
LEFT JOIN shopping_locations sl
ON pph.shopping_location_id = sl.id
WHERE $where
GROUP BY sl.id, sl.name
ORDER BY sl.NAME COLLATE NOCASE
";
}
return $this->renderPage($response, 'stockreportspendings', [
'metrics' => $this->getDatabaseService()->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ),
'productGroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'selectedGroup' => isset($request->getQueryParams()['product-group']) ? $request->getQueryParams()['product-group'] : null,
'groupBy' => $groupBy
]);
}
}

View File

@@ -2,9 +2,12 @@
namespace Grocy\Controllers;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class SystemApiController extends BaseApiController
{
public function GetConfig(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetConfig(Request $request, Response $response, array $args)
{
try
{
@@ -31,19 +34,19 @@ class SystemApiController extends BaseApiController
}
}
public function GetDbChangedTime(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetDbChangedTime(Request $request, Response $response, array $args)
{
return $this->ApiResponse($response, [
'changed_time' => $this->getDatabaseService()->GetDbChangedTime()
]);
}
public function GetSystemInfo(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetSystemInfo(Request $request, Response $response, array $args)
{
return $this->ApiResponse($response, $this->getApplicationService()->GetSystemInfo());
}
public function GetSystemTime(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetSystemTime(Request $request, Response $response, array $args)
{
try
{
@@ -67,7 +70,7 @@ class SystemApiController extends BaseApiController
}
}
public function LogMissingLocalization(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function LogMissingLocalization(Request $request, Response $response, array $args)
{
if (GROCY_MODE === 'dev')
{
@@ -85,7 +88,7 @@ class SystemApiController extends BaseApiController
}
}
public function GetLocalizationStrings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetLocalizationStrings(Request $request, Response $response, array $args)
{
return $this->ApiResponse($response, json_decode($this->getLocalizationService()->GetPoAsJsonString()), true);
}

View File

@@ -4,23 +4,26 @@ namespace Grocy\Controllers;
use Grocy\Services\DatabaseMigrationService;
use Grocy\Services\DemoDataGeneratorService;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class SystemController extends BaseController
{
public function About(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function About(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'about', [
'system_info' => $this->getApplicationService()->GetSystemInfo(),
'systemInfo' => $this->getApplicationService()->GetSystemInfo(),
'versionInfo' => $this->getApplicationService()->GetInstalledVersion(),
'changelog' => $this->getApplicationService()->GetChangelog()
]);
}
public function BarcodeScannerTesting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function BarcodeScannerTesting(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'barcodescannertesting');
}
public function Root(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Root(Request $request, Response $response, array $args)
{
// Schema migration is done here
$databaseMigrationService = DatabaseMigrationService::getInstance();
@@ -29,20 +32,34 @@ class SystemController extends BaseController
if (GROCY_MODE === 'dev' || GROCY_MODE === 'demo' || GROCY_MODE === 'prerelease')
{
$demoDataGeneratorService = DemoDataGeneratorService::getInstance();
$demoDataGeneratorService->PopulateDemoData();
$demoDataGeneratorService->PopulateDemoData(isset($request->getQueryParams()['nodemodata']));
}
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl($this->GetEntryPageRelative()));
}
/**
* Get the entry page of the application based on the value of the entry page setting.
*
* We fallback to the about page when no entry page is specified or
* when the specified entry page has been disabled.
*
* @return string
*/
public function Manifest(Request $request, Response $response, array $args)
{
$data = explode('#', base64_decode($request->getQueryParams()['data']));
$manifest = [
'name' => 'Grocy ' . $data[0],
'short_name' => 'Grocy ' . $data[0],
'icons' => [[
'src' => './img/icon-1024.png',
'sizes'=> '1024x1024',
'type' => 'image/png'
]],
'start_url' => $data[1],
'background_color' => '#333131',
'theme_color' => '#333131',
'display' => 'standalone'
];
$response->getBody()->write(json_encode($manifest));
return $response->withHeader('Content-Type', 'application/json');
}
private function GetEntryPageRelative()
{
if (defined('GROCY_ENTRY_PAGE'))
@@ -102,7 +119,7 @@ class SystemController extends BaseController
}
// Meal Plan
if ($entryPage === 'mealplan' && constant('GROCY_FEATURE_FLAG_RECIPES'))
if ($entryPage === 'mealplan' && constant('GROCY_FEATURE_FLAG_RECIPES_MEALPLAN'))
{
return '/mealplan';
}

View File

@@ -3,15 +3,17 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class TasksApiController extends BaseApiController
{
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Current(Request $request, Response $response, array $args)
{
return $this->FilteredApiResponse($response, $this->getTasksService()->GetCurrent(), $request->getQueryParams());
}
public function MarkTaskAsCompleted(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function MarkTaskAsCompleted(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_TASKS_MARK_COMPLETED);
@@ -35,7 +37,7 @@ class TasksApiController extends BaseApiController
}
}
public function UndoTask(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UndoTask(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_TASKS_UNDO_EXECUTION);

View File

@@ -2,9 +2,12 @@
namespace Grocy\Controllers;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class TasksController extends BaseController
{
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Overview(Request $request, Response $response, array $args)
{
$usersService = $this->getUsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['tasks_due_soon_days'];
@@ -41,23 +44,32 @@ class TasksController extends BaseController
return $this->renderPage($response, 'tasks', [
'tasks' => $tasks,
'nextXDays' => $nextXDays,
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE'),
'taskCategories' => $this->getDatabase()->task_categories()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'users' => $this->getDatabase()->users(),
'userfields' => $this->getUserfieldsService()->GetFields('tasks'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('tasks')
]);
}
public function TaskCategoriesList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function TaskCategoriesList(Request $request, Response $response, array $args)
{
if (isset($request->getQueryParams()['include_disabled']))
{
$categories = $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE');
}
else
{
$categories = $this->getDatabase()->task_categories()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
}
return $this->renderPage($response, 'taskcategories', [
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE'),
'taskCategories' => $categories,
'userfields' => $this->getUserfieldsService()->GetFields('task_categories'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('task_categories')
]);
}
public function TaskCategoryEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function TaskCategoryEditForm(Request $request, Response $response, array $args)
{
if ($args['categoryId'] == 'new')
{
@@ -76,13 +88,13 @@ class TasksController extends BaseController
}
}
public function TaskEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function TaskEditForm(Request $request, Response $response, array $args)
{
if ($args['taskId'] == 'new')
{
return $this->renderPage($response, 'taskform', [
'mode' => 'create',
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE'),
'taskCategories' => $this->getDatabase()->task_categories()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'users' => $this->getDatabase()->users()->orderBy('username'),
'userfields' => $this->getUserfieldsService()->GetFields('tasks')
]);
@@ -92,14 +104,14 @@ class TasksController extends BaseController
return $this->renderPage($response, 'taskform', [
'task' => $this->getDatabase()->tasks($args['taskId']),
'mode' => 'edit',
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE'),
'taskCategories' => $this->getDatabase()->task_categories()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'users' => $this->getDatabase()->users()->orderBy('username'),
'userfields' => $this->getUserfieldsService()->GetFields('tasks')
]);
}
}
public function TasksSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function TasksSettings(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'taskssettings');
}

View File

@@ -8,63 +8,34 @@ use LessQL\Result;
class User
{
const PERMISSION_ADMIN = 'ADMIN';
const PERMISSION_BATTERIES = 'BATTERIES';
const PERMISSION_BATTERIES_TRACK_CHARGE_CYCLE = 'BATTERIES_TRACK_CHARGE_CYCLE';
const PERMISSION_BATTERIES_UNDO_CHARGE_CYCLE = 'BATTERIES_UNDO_CHARGE_CYCLE';
const PERMISSION_CALENDAR = 'CALENDAR';
const PERMISSION_CHORES = 'CHORES';
const PERMISSION_CHORE_TRACK_EXECUTION = 'CHORE_TRACK_EXECUTION';
const PERMISSION_CHORE_UNDO_EXECUTION = 'CHORE_UNDO_EXECUTION';
const PERMISSION_EQUIPMENT = 'EQUIPMENT';
const PERMISSION_MASTER_DATA_EDIT = 'MASTER_DATA_EDIT';
const PERMISSION_RECIPES = 'RECIPES';
const PERMISSION_RECIPES_MEALPLAN = 'RECIPES_MEALPLAN';
const PERMISSION_SHOPPINGLIST = 'SHOPPINGLIST';
const PERMISSION_SHOPPINGLIST_ITEMS_ADD = 'SHOPPINGLIST_ITEMS_ADD';
const PERMISSION_SHOPPINGLIST_ITEMS_DELETE = 'SHOPPINGLIST_ITEMS_DELETE';
const PERMISSION_STOCK = 'STOCK';
const PERMISSION_STOCK_CONSUME = 'STOCK_CONSUME';
const PERMISSION_STOCK_EDIT = 'STOCK_EDIT';
const PERMISSION_STOCK_INVENTORY = 'STOCK_INVENTORY';
const PERMISSION_STOCK_OPEN = 'STOCK_OPEN';
const PERMISSION_STOCK_PURCHASE = 'STOCK_PURCHASE';
const PERMISSION_STOCK_TRANSFER = 'STOCK_TRANSFER';
const PERMISSION_TASKS = 'TASKS';
const PERMISSION_TASKS_MARK_COMPLETED = 'TASKS_MARK_COMPLETED';
const PERMISSION_TASKS_UNDO_EXECUTION = 'TASKS_UNDO_EXECUTION';
const PERMISSION_USERS = 'USERS';
const PERMISSION_USERS_CREATE = 'USERS_CREATE';
const PERMISSION_USERS_EDIT = 'USERS_EDIT';
const PERMISSION_USERS_EDIT_SELF = 'USERS_EDIT_SELF';
const PERMISSION_USERS_READ = 'USERS_READ';
public function __construct()
@@ -72,9 +43,6 @@ class User
$this->db = DatabaseService::getInstance()->GetDbConnection();
}
/**
* @var \LessQL\Database|null
*/
protected $db;
public static function PermissionList()

View File

@@ -3,10 +3,12 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class UsersApiController extends BaseApiController
{
public function AddPermission(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function AddPermission(Request $request, Response $response, array $args)
{
try
{
@@ -29,7 +31,7 @@ class UsersApiController extends BaseApiController
}
}
public function CreateUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function CreateUser(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_USERS_CREATE);
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
@@ -50,7 +52,7 @@ class UsersApiController extends BaseApiController
}
}
public function DeleteUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function DeleteUser(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_USERS_EDIT);
try
@@ -64,7 +66,7 @@ class UsersApiController extends BaseApiController
}
}
public function EditUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function EditUser(Request $request, Response $response, array $args)
{
if ($args['userId'] == GROCY_USER_ID)
{
@@ -88,7 +90,7 @@ class UsersApiController extends BaseApiController
}
}
public function GetUserSetting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetUserSetting(Request $request, Response $response, array $args)
{
try
{
@@ -101,7 +103,7 @@ class UsersApiController extends BaseApiController
}
}
public function GetUserSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetUserSettings(Request $request, Response $response, array $args)
{
try
{
@@ -113,7 +115,7 @@ class UsersApiController extends BaseApiController
}
}
public function GetUsers(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetUsers(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_USERS_READ);
try
@@ -126,7 +128,7 @@ class UsersApiController extends BaseApiController
}
}
public function CurrentUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function CurrentUser(Request $request, Response $response, array $args)
{
try
{
@@ -138,7 +140,7 @@ class UsersApiController extends BaseApiController
}
}
public function ListPermissions(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ListPermissions(Request $request, Response $response, array $args)
{
try
{
@@ -159,7 +161,7 @@ class UsersApiController extends BaseApiController
}
}
public function SetPermissions(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function SetPermissions(Request $request, Response $response, array $args)
{
try
{
@@ -204,7 +206,7 @@ class UsersApiController extends BaseApiController
}
}
public function SetUserSetting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function SetUserSetting(Request $request, Response $response, array $args)
{
try
{
@@ -219,7 +221,7 @@ class UsersApiController extends BaseApiController
}
}
public function DeleteUserSetting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function DeleteUserSetting(Request $request, Response $response, array $args)
{
try
{

View File

@@ -3,10 +3,12 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class UsersController extends BaseController
{
public function PermissionList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function PermissionList(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_USERS_READ);
return $this->renderPage($response, 'userpermissions', [
@@ -16,7 +18,7 @@ class UsersController extends BaseController
]);
}
public function UserEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UserEditForm(Request $request, Response $response, array $args)
{
if ($args['userId'] == 'new')
{
@@ -46,10 +48,11 @@ class UsersController extends BaseController
}
}
public function UserSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UserSettings(Request $request, Response $response, array $args)
{
return $this->renderPage($response, 'usersettings', [
'languages' => array_filter(scandir(__DIR__ . '/../localization'), function ($item) {
'languages' => array_filter(scandir(__DIR__ . '/../localization'), function ($item)
{
if ($item == '.' || $item == '..')
{
return false;
@@ -60,7 +63,7 @@ class UsersController extends BaseController
]);
}
public function UsersList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UsersList(Request $request, Response $response, array $args)
{
User::checkPermission($request, User::PERMISSION_USERS_READ);
return $this->renderPage($response, 'users', [

View File

@@ -3,7 +3,7 @@
use Grocy\Helpers\BaseBarcodeLookupPlugin;
/*
This class must extend BaseBarcodeLookupPlugin (in namespace \Grocy\Helpers)
This class must extend BaseBarcodeLookupPlugin (in namespace Grocy\Helpers)
*/
class DemoBarcodeLookupPlugin extends BaseBarcodeLookupPlugin
{
@@ -14,8 +14,11 @@ class DemoBarcodeLookupPlugin extends BaseBarcodeLookupPlugin
/*
To try it:
Call the API function at /api/stock/barcodes/external-lookup/{barcode}
Or use the product picker workflow "External barcode lookup (via plugin)"
When you also add ?add=true as a query parameter to the API call,
on a successful lookup the product is added to the database and in the output
the new product id is included (automatically, nothing to do here in the plugin)
@@ -55,12 +58,14 @@ class DemoBarcodeLookupPlugin extends BaseBarcodeLookupPlugin
*/
protected function ExecuteLookup($barcode)
{
if ($barcode === 'x')
{ // Demonstration when nothing is found
if ($barcode === 'nothing')
{
// Demonstration when nothing is found
return null;
}
elseif ($barcode === 'e')
{ // Demonstration when an error occurred
elseif ($barcode === 'error')
{
// Demonstration when an error occurred
throw new \Exception('This is the error message from the plugin...');
}
else

View File

@@ -1,15 +1,15 @@
grocycode
Grocycode
==========
grocycode is, in essence, a simple way to reference to arbitrary grocy entities.
Each grocycode includes a magic, an entitiy identifier, an id and an ordered set of extra data.
It is supported to be entered anywhere grocy expects one to read a barcode, but can also reference
grocy-internal properties like specific stock entries, or specific batteries.
Grocycode is, in essence, a simple way to reference to arbitrary Grocy entities.
Each Grocycode includes a magic, an entitiy identifier, an id and an ordered set of extra data.
It is supported to be entered anywhere Grocy expects one to read a barcode, but can also reference
Grocy-internal properties like specific stock entries, or specific batteries.
Serialization
----
There are three mandatory parts in a grocycode:
There are three mandatory parts in a Grocycode:
1. The magic `grcy`
2. An entity identifer matching the regular expression `[a-z]+` (that is, lowercase english alphabet without any fancy accents, minimum length 1 character).

View File

@@ -6,8 +6,8 @@ To enable label printing, set `FEATURE_FLAG_LABEL_PRINTER` to `true`in your `con
Why webhook?
---
Label printers come in all shapes and forms, and your particular one is probably not the one used by the author of this feature. Also, grocy may does not have a
direct connection to a local label printer (e.g. grocy is hosted in a cloud vps). Thus, a lightweight implementation is provided by grocy: whenever something
Label printers come in all shapes and forms, and your particular one is probably not the one used by the author of this feature. Also, Grocy may does not have a
direct connection to a local label printer (e.g. Grocy is hosted in a cloud vps). Thus, a lightweight implementation is provided by Grocy: whenever something
should print, a POST request to a configured URL is made. The target then is responsible for label printing.
Reference implementation
@@ -19,8 +19,8 @@ implemented into [a fork of brother_ql_web](https://github.com/mistressofjellyfi
Webhook request
---
Requests can be configured to be sent server-side (that is, from the machine hosting grocy through GuzzleHttp) or by an AJAX request directly from the browser.
The latter is neccesary for situations where the grocy hosting machine cannot reach your label printer, however server-side requests are a bit faster and
Requests can be configured to be sent server-side (that is, from the machine hosting Grocy through GuzzleHttp) or by an AJAX request directly from the browser.
The latter is neccesary for situations where the Grocy hosting machine cannot reach your label printer, however server-side requests are a bit faster and
tend to be more stable.
Both methods fire this request upon printing:

View File

@@ -1,7 +1,7 @@
{
"openapi": "3.0.0",
"openapi": "3.1.0",
"info": {
"title": "grocy REST API",
"title": "Grocy REST API",
"description": "Authentication is done via API keys (header *GROCY-API-KEY* or same named query parameter), which you can manage [here](PlaceHolderManageApiKeysUrl).<br>Additionally requests from within the frontend are also valid (via session cookie).",
"version": "xxx",
"license": {
@@ -60,7 +60,7 @@
"paths": {
"/system/info": {
"get": {
"summary": "Returns information about the installed grocy version, PHP runtime and OS",
"summary": "Returns information about the installed Grocy version, PHP runtime and OS",
"tags": [
"System"
],
@@ -1550,7 +1550,7 @@
},
"/stock/entry/{entryId}/printlabel": {
"get": {
"summary": "Prints the grocycode / stock entry label of the given entry on the configured label printer",
"summary": "Prints the Grocycode / stock entry label of the given entry on the configured label printer",
"tags": [
"Stock"
],
@@ -2281,7 +2281,7 @@
},
"/stock/products/{productId}/printlabel": {
"get": {
"summary": "Prints the grocycode label of the given product on the configured label printer",
"summary": "Prints the Grocycode label of the given product on the configured label printer",
"tags": [
"Stock"
],
@@ -3582,7 +3582,7 @@
},
"/recipes/{recipeId}/printlabel": {
"get": {
"summary": "Prints the grocycode label of the given recipe on the configured label printer",
"summary": "Prints the Grocycode label of the given recipe on the configured label printer",
"tags": [
"Recipes"
],
@@ -3855,7 +3855,7 @@
},
"/chores/{choreId}/printlabel": {
"get": {
"summary": "Prints the grocycode label of the given chore on the configured label printer",
"summary": "Prints the Grocycode label of the given chore on the configured label printer",
"tags": [
"Chores"
],
@@ -4120,7 +4120,7 @@
},
"/batteries/{batteryId}/printlabel": {
"get": {
"summary": "Prints the grocycode label of the given battery on the configured label printer",
"summary": "Prints the Grocycode label of the given battery on the configured label printer",
"tags": [
"Batteries"
],
@@ -4368,7 +4368,7 @@
"in": "query",
"name": "printHeader",
"required": false,
"description": "Prints grocy logo if true",
"description": "Prints Grocy logo if true",
"schema": {
"type": "boolean",
"default": true
@@ -4437,9 +4437,110 @@
"product_group_id": {
"type": "integer"
},
"qu_factor_purchase_to_stock": {
"tare_weight": {
"type": "number"
},
"min_stock_amount": {
"type": "number",
"minimum": 0,
"default": 0
},
"default_best_before_days": {
"type": "integer",
"minimum": 0,
"default": 0
},
"default_best_before_days_after_open": {
"type": "integer",
"minimum": 0,
"default": 0
},
"picture_file_name": {
"type": "string"
},
"row_created_timestamp": {
"type": "string",
"format": "date-time"
},
"shopping_location_id": {
"type": "integer"
},
"treat_opened_as_out_of_stock": {
"type": "integer"
},
"auto_reprint_stock_label": {
"type": "integer"
},
"no_own_stock": {
"type": "integer"
},
"userfields": {
"type": "object",
"description": "Key/value pairs of userfields"
},
"should_not_be_frozen": {
"type": "integer"
},
"default_consume_location_id": {
"type": "integer"
},
"move_on_open": {
"type": "integer"
}
},
"example": {
"id": "1",
"name": "Cookies",
"description": null,
"location_id": "4",
"qu_id_purchase": "3",
"qu_id_stock": "3",
"min_stock_amount": "8",
"default_best_before_days": "0",
"row_created_timestamp": "2019-05-02 20:12:26",
"product_group_id": "1",
"picture_file_name": "cookies.jpg",
"default_best_before_days_after_open": "0",
"enable_tare_weight_handling": "0",
"tare_weight": "0.0",
"not_check_stock_fulfillment_for_recipes": "0",
"shopping_location_id": null,
"userfields": null,
"should_not_be_frozen": "1",
"default_consume_location_id": "5",
"move_on_open": "1"
}
},
"ProductWithoutUserfields": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"location_id": {
"type": "integer"
},
"qu_id_purchase": {
"type": "integer"
},
"qu_id_stock": {
"type": "integer"
},
"enable_tare_weight_handling": {
"type": "integer"
},
"not_check_stock_fulfillment_for_recipes": {
"type": "integer"
},
"product_group_id": {
"type": "integer"
},
"tare_weight": {
"type": "number"
},
@@ -4471,12 +4572,11 @@
"treat_opened_as_out_of_stock": {
"type": "integer"
},
"no_own_stock": {
"auto_reprint_stock_label": {
"type": "integer"
},
"userfields": {
"type": "object",
"description": "Key/value pairs of userfields"
"no_own_stock": {
"type": "integer"
},
"should_not_be_frozen": {
"type": "integer"
@@ -4495,7 +4595,6 @@
"location_id": "4",
"qu_id_purchase": "3",
"qu_id_stock": "3",
"qu_factor_purchase_to_stock": "1.0",
"min_stock_amount": "8",
"default_best_before_days": "0",
"row_created_timestamp": "2019-05-02 20:12:26",
@@ -4734,12 +4833,21 @@
"$ref": "#/components/schemas/Product"
},
"product_barcodes": {
"$ref": "#/components/schemas/ProductBarcode"
"type": "array",
"items": {
"$ref": "#/components/schemas/ProductBarcode"
}
},
"quantity_unit_stock": {
"$ref": "#/components/schemas/QuantityUnit"
},
"default_quantity_unit_purchase": {
"$ref": "#/components/schemas/QuantityUnit"
},
"quantity_unit_stock": {
"default_quantity_unit_consume": {
"$ref": "#/components/schemas/QuantityUnit"
},
"quantity_unit_price": {
"$ref": "#/components/schemas/QuantityUnit"
},
"last_purchased": {
@@ -4748,7 +4856,7 @@
},
"last_used": {
"type": "string",
"format": "date-time"
"format": "date"
},
"stock_amount": {
"type": "number"
@@ -4758,7 +4866,7 @@
},
"next_due_date": {
"type": "string",
"format": "date-time"
"format": "date"
},
"last_price": {
"type": "number",
@@ -4795,6 +4903,14 @@
},
"default_location": {
"$ref": "#/components/schemas/Location"
},
"qu_conversion_factor_purchase_to_stock": {
"type": "number",
"description": "The conversion factor of the corresponding QU conversion from the product's qu_id_purchase to qu_id_stock"
},
"qu_conversion_factor_price_to_stock": {
"type": "number",
"description": "The conversion factor of the corresponding QU conversion from the product's qu_id_price to qu_id_stock"
}
},
"example": {
@@ -4805,7 +4921,6 @@
"location_id": "4",
"qu_id_purchase": "3",
"qu_id_stock": "3",
"qu_factor_purchase_to_stock": "1.0",
"min_stock_amount": "8",
"default_best_before_days": "0",
"row_created_timestamp": "2019-05-02 20:12:26",
@@ -4847,6 +4962,14 @@
"name_plural": "Packs",
"plural_forms": null
},
"quantity_unit_price": {
"id": "3",
"name": "Pack",
"description": null,
"row_created_timestamp": "2019-05-02 20:12:25",
"name_plural": "Packs",
"plural_forms": null
},
"last_price": null,
"avg_price": null,
"current_price": null,
@@ -5306,7 +5429,7 @@
},
"purchased_date": {
"type": "string",
"format": "date-time"
"format": "date"
},
"used_date": {
"type": "string",
@@ -5501,7 +5624,7 @@
"description": "Indicates wheter this product has sub-products or not / if the fields `amount_aggregated` and `amount_opened_aggregated` are filled"
},
"product": {
"$ref": "#/components/schemas/Product"
"$ref": "#/components/schemas/ProductWithoutUserfields"
}
}
},
@@ -5779,7 +5902,11 @@
"chores_log",
"meal_plan_sections",
"products_last_purchased",
"products_average_price"
"products_average_price",
"quantity_unit_conversions_resolved",
"recipes_pos_resolved",
"battery_charge_cycles",
"product_barcodes_view"
]
},
"ExposedEntityNoListing": {
@@ -5797,7 +5924,11 @@
"stock_current_locations",
"chores_log",
"products_last_purchased",
"products_average_price"
"products_average_price",
"quantity_unit_conversions_resolved",
"recipes_pos_resolved",
"battery_charge_cycles",
"product_barcodes_view"
]
},
"ExposedEntityNoDelete": {
@@ -5808,14 +5939,16 @@
"stock_current_locations",
"chores_log",
"products_last_purchased",
"products_average_price"
"products_average_price",
"quantity_unit_conversions_resolved",
"recipes_pos_resolved",
"battery_charge_cycles",
"product_barcodes_view"
]
},
"ExposedEntityEditRequiresAdmin": {
"type": "string",
"enum": [
"api_keys"
]
"enum": []
},
"StockTransactionType": {
"type": "string",

View File

@@ -11,7 +11,6 @@ abstract class BaseBarcodeLookupPlugin
}
protected $Locations;
protected $QuantityUnits;
final public function Lookup($barcode)
@@ -30,7 +29,8 @@ abstract class BaseBarcodeLookupPlugin
}
if (!IsAssociativeArray($pluginOutput))
{ // $pluginOutput is at least an indexed array here
{
// $pluginOutput is at least an indexed array here
throw new \Exception('Plugin output must be an associative array');
}
@@ -54,7 +54,7 @@ abstract class BaseBarcodeLookupPlugin
// $pluginOutput contains all needed properties here
// Check referenced entity ids are valid
// Check if referenced entity ids are valid
$locationId = $pluginOutput['location_id'];
if (FindObjectInArrayByPropertyValue($this->Locations, 'id', $locationId) === null)
{

View File

@@ -63,7 +63,7 @@ class ConfigurationValidator
private function checkMealplanFirstDayOfWeek()
{
if (!(GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK == '' ||
(is_numeric(GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK) && GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK >= 0 && GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK <= 6)))
(is_numeric(GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK) && GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK >= -1 && GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK <= 6)))
{
throw new EInvalidConfig('Invalid value for MEAL_PLAN_FIRST_DAY_OF_WEEK');
}

View File

@@ -3,10 +3,10 @@
namespace Grocy\Helpers;
/**
* A class that abstracts grocycode.
* A class that abstracts Grocycode.
*
* grocycode is a simple, easily serializable format to reference
* stuff within grocy. It consists of n (n ≥ 3) double-colon seperated parts:
* Grocycode is a simple, easily serializable format to reference
* stuff within Grocy. It consists of n (n ≥ 3) double-colon seperated parts:
*
* 1. The magic `grcy`
* 2. A type identifer, must match `[a-z]+` (i.e. only lowercase ascii, minimum length 1 character)
@@ -18,21 +18,11 @@ namespace Grocy\Helpers;
class Grocycode
{
public const PRODUCT = 'p';
public const BATTERY = 'b';
public const CHORE = 'c';
public const RECIPE = 'r';
public const MAGIC = 'grcy';
/**
* Constructs a new instance of the Grocycode class.
*
* Because php doesn't support overloading, this is a proxy
* to either setFromCode($code) or setFromData($type, $id, $extra_data = []).
*/
public function __construct(...$args)
{
$argc = count($args);
@@ -54,24 +44,11 @@ class Grocycode
throw new \Exception('No suitable overload found.');
}
/**
* An array that registers all valid grocycode types. Register yours here by appending to this array.
*/
public static $Items = [self::PRODUCT, self::BATTERY, self::CHORE, self::RECIPE];
private $type;
private $id;
private $extra_data = [];
/**
* Validates a grocycode.
*
* Returns true, if a supplied $code is a valid grocycode, false otherwise.
*
* @return bool
*/
public static function Validate(string $code)
{
try
@@ -107,29 +84,23 @@ class Grocycode
return implode(':', $arr);
}
/**
* Parses a grocycode.
*/
private function setFromCode($code)
{
$parts = array_reverse(explode(':', $code));
if (array_pop($parts) != self::MAGIC)
{
throw new \Exception('Not a grocycode');
throw new \Exception('Not a Grocycode');
}
if (!in_array($this->type = array_pop($parts), self::$Items))
{
throw new \Exception('Unknown grocycode type');
throw new \Exception('Unknown Grocycode type');
}
$this->id = array_pop($parts);
$this->extra_data = array_reverse($parts);
}
/**
* Constructs a grocycode from data.
*/
private function setFromData($type, $id, $extra_data = [])
{
if (!is_array($extra_data))
@@ -138,7 +109,7 @@ class Grocycode
}
if (!in_array($type, self::$Items))
{
throw new \Exception('Unknown grocycode type');
throw new \Exception('Unknown Grocycode type');
}
$this->type = $type;

View File

@@ -4,17 +4,20 @@ class ERequirementNotMet extends Exception
{
}
const REQUIRED_PHP_EXTENSIONS = ['fileinfo', 'pdo_sqlite', 'gd', 'ctype', 'json', 'intl', 'zlib', 'mbstring',
const REQUIRED_PHP_EXTENSIONS = ['fileinfo', 'pdo_sqlite', 'gd', 'ctype', 'intl', 'zlib', 'mbstring',
// These are core extensions, so normally can't be missing, but seems to be the case, however, on FreeBSD
'filter', 'iconv', 'tokenizer'
'filter', 'iconv', 'tokenizer', 'json'
];
const REQUIRED_SQLITE_VERSION = '3.22.0';
const REQUIRED_PHP_VERSION = '8.2.0';
const REQUIRED_SQLITE_VERSION = '3.34.0';
class PrerequisiteChecker
{
public function checkRequirements()
{
self::checkForPhpVersion();
self::checkForConfigFile();
self::checkForConfigDistFile();
self::checkForComposer();
@@ -24,9 +27,9 @@ class PrerequisiteChecker
private function checkForComposer()
{
if (!file_exists(__DIR__ . '/../vendor/autoload.php'))
if (!file_exists(__DIR__ . '/../packages/autoload.php'))
{
throw new ERequirementNotMet('/vendor/autoload.php not found. Have you run Composer?');
throw new ERequirementNotMet('/packages/autoload.php not found. Have you run Composer?');
}
}
@@ -49,7 +52,6 @@ class PrerequisiteChecker
private function checkForPhpExtensions()
{
$loadedExtensions = get_loaded_extensions();
foreach (REQUIRED_PHP_EXTENSIONS as $extension)
{
if (!in_array($extension, $loadedExtensions))
@@ -62,13 +64,21 @@ class PrerequisiteChecker
private function checkForSqliteVersion()
{
$sqliteVersion = self::getSqlVersionAsString();
if (version_compare($sqliteVersion, REQUIRED_SQLITE_VERSION, '<'))
{
throw new ERequirementNotMet('SQLite ' . REQUIRED_SQLITE_VERSION . ' is required, however you are running ' . $sqliteVersion);
}
}
private function checkForPhpVersion()
{
$phpVersion = phpversion();
if (version_compare($phpVersion, REQUIRED_PHP_VERSION, '<'))
{
throw new ERequirementNotMet('PHP ' . REQUIRED_PHP_VERSION . ' is required, however you are running ' . $phpVersion);
}
}
private function getSqlVersionAsString()
{
$dbh = new PDO('sqlite::memory:');

View File

@@ -253,3 +253,12 @@ function string_ends_with($haystack, $needle)
return (substr($haystack, -$length) === $needle);
}
global $GROCY_REQUIRED_FRONTEND_PACKAGES;
$GROCY_REQUIRED_FRONTEND_PACKAGES = [];
function require_frontend_packages(array $packages)
{
global $GROCY_REQUIRED_FRONTEND_PACKAGES;
$GROCY_REQUIRED_FRONTEND_PACKAGES = array_unique(array_merge($GROCY_REQUIRED_FRONTEND_PACKAGES, $packages));
}

View File

@@ -2,6 +2,7 @@
# Translators:
# gimy16 <gimy16@hotmail.com>, 2021
# Carles Riera <blauigris@gmail.com>, 2022
# Auri, 2024
#
msgid ""
msgstr ""
@@ -9,8 +10,8 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-09-17 10:45+0000\n"
"Last-Translator: Carles Riera <blauigris@gmail.com>, 2022\n"
"Language-Team: Catalan (https://www.transifex.com/grocy/teams/93189/ca/)\n"
"Last-Translator: Auri, 2024\n"
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -19,7 +20,7 @@ msgstr ""
"X-Domain: grocy/chore_assignment_types\n"
msgid "no-assignment"
msgstr "sense actius"
msgstr "no assignat"
msgid "who-least-did-first"
msgstr "qui menys ha fet primer"

View File

@@ -1,7 +1,8 @@
#
# Translators:
# Joan Rodas <joanrc93@gmail.com>, 2020
# gimy16 <gimy16@hotmail.com>, 2021
# Martí Gombau, 2023
# Auri, 2024
#
msgid ""
msgstr ""
@@ -9,8 +10,8 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-05-01 17:42+0000\n"
"Last-Translator: gimy16 <gimy16@hotmail.com>, 2021\n"
"Language-Team: Catalan (https://www.transifex.com/grocy/teams/93189/ca/)\n"
"Last-Translator: Auri, 2024\n"
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -22,19 +23,19 @@ msgid "manually"
msgstr "manualment"
msgid "daily"
msgstr "diari"
msgstr "cada dia"
msgid "weekly"
msgstr "setmanalment"
msgstr "cada setmana"
msgid "monthly"
msgstr "mensual"
msgstr "cada mes"
msgid "yearly"
msgstr "anual"
msgstr "cada any"
msgid "hourly"
msgstr ""
msgstr "cada hora"
msgid "adaptive"
msgstr ""
msgstr "adaptable"

View File

@@ -9,7 +9,7 @@ msgstr ""
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-05-01 17:42+0000\n"
"Last-Translator: Bernd Bestel <bernd@berrnd.de>, 2022\n"
"Language-Team: Catalan (https://www.transifex.com/grocy/teams/93189/ca/)\n"
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@@ -2,6 +2,8 @@
# Translators:
# Joan Rodas <joanrc93@gmail.com>, 2020
# gimy16 <gimy16@hotmail.com>, 2021
# Martí Gombau, 2023
# Auri, 2024
#
msgid ""
msgstr ""
@@ -9,8 +11,8 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-05-01 17:42+0000\n"
"Last-Translator: gimy16 <gimy16@hotmail.com>, 2021\n"
"Language-Team: Catalan (https://www.transifex.com/grocy/teams/93189/ca/)\n"
"Last-Translator: Auri, 2024\n"
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -28,10 +30,10 @@ msgid "Pantry"
msgstr "rebost"
msgid "Candy cupboard"
msgstr ""
msgstr "Armari de les llaminadures"
msgid "Tinned food cupboard"
msgstr ""
msgstr "Armari de les conserves"
msgid "Fridge"
msgstr "Nevera"
@@ -63,14 +65,14 @@ msgstr[1] "Llaunes"
msgid "Bunch"
msgid_plural "Bunches"
msgstr[0] ""
msgstr[1] ""
msgstr[0] "Ram"
msgstr[1] "Rams"
msgid "Gummy bears"
msgstr ""
msgstr "Ossets de gominoles"
msgid "Crisps"
msgstr ""
msgstr "Xips"
msgid "Eggs"
msgstr "Ous"
@@ -106,10 +108,10 @@ msgid "Tomato"
msgstr "Tomàquet"
msgid "Change towels in the bathroom"
msgstr ""
msgstr "Cambiar tovalloles del bany"
msgid "Mop the kitchen floor"
msgstr ""
msgstr "Fregar el terra de la cuina"
msgid "Warranty ends"
msgstr "S'acaba la garantia"
@@ -121,10 +123,10 @@ msgid "Alarm clock"
msgstr "Alarma"
msgid "Heat remote control"
msgstr ""
msgstr "Control remot de la calefacció"
msgid "Take out the trash"
msgstr ""
msgstr "Llençar les escombraries"
msgid "Some good snacks"
msgstr "Uns bons aperitius"
@@ -133,7 +135,7 @@ msgid "Pizza dough"
msgstr "Massa de pizza"
msgid "Sieved tomatoes"
msgstr ""
msgstr "Tomàquets tamisats"
msgid "Salami"
msgstr "Salami"
@@ -163,7 +165,7 @@ msgid "Italian"
msgstr "Italià"
msgid "This is the note content of the recipe ingredient"
msgstr ""
msgstr "Aquest és el contingut de la nota de l'ingredient de la recepta"
msgid "Demo User"
msgstr "Usuari de prova"
@@ -177,7 +179,7 @@ msgid "Flour"
msgstr "Farina"
msgid "Pancakes"
msgstr ""
msgstr "Panqueques"
msgid "Sugar"
msgstr "Sucre"
@@ -222,7 +224,7 @@ msgid "Milk"
msgstr "Llet"
msgid "Chocolate sauce"
msgstr ""
msgstr "Salsa de xocolata"
msgid "Milliliters"
msgstr "Mil·lilitres"
@@ -249,13 +251,13 @@ msgid "Russian"
msgstr "Rus"
msgid "Vacuum the living room floor"
msgstr ""
msgstr "Passar l'aspirador al terra del menjador"
msgid "Clean the litter box"
msgstr ""
msgstr "Netejar el cubell de la brossa"
msgid "Change the bed sheets"
msgstr ""
msgstr "Canviar els llençols"
msgid "Swedish"
msgstr "Suec"
@@ -367,22 +369,48 @@ msgid "Finnish"
msgstr "Finès"
msgid "Breakfast"
msgstr ""
msgstr "Esmorzar"
msgid "Lunch"
msgstr ""
msgstr "Dinar"
msgid "Dinner"
msgstr ""
msgstr "Sopar"
msgid "Catalan"
msgstr ""
msgstr "Català "
msgid "Slovenian"
msgstr ""
msgstr "Eslovè "
msgid "Lithuanian"
msgstr ""
msgstr "Lituà "
msgid "Ukrainian"
msgstr ""
msgstr "Ucrania"
msgid "Kilogram"
msgid_plural "Kilograms"
msgstr[0] "Kilogram"
msgstr[1] "Kilograms"
msgid "Romanian"
msgstr "Romanès "
msgid "Pint"
msgstr "Terrina/es"
msgid "Beverages"
msgstr "Begudes"
msgid "Ice Cream"
msgstr "Gelats"
msgid "Soda"
msgstr "Refresc"
msgid "Beer"
msgstr "Cervesa"
msgid "Estonian"
msgstr "Estonià"

View File

@@ -1,11 +1,16 @@
#
# Translators:
# Martí Gombau, 2023
# Auri, 2024
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2020-08-31 19:11+0000\n"
"Language-Team: Catalan (https://www.transifex.com/grocy/teams/93189/ca/)\n"
"Last-Translator: Auri, 2024\n"
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -15,120 +20,128 @@ msgstr ""
# Czech
msgid "cs"
msgstr ""
msgstr "cs"
# Danish
msgid "da"
msgstr ""
msgstr "da"
# German
msgid "de"
msgstr ""
msgstr "de"
# Greek
msgid "el_GR"
msgstr ""
msgstr "el_GR"
# English
msgid "en"
msgstr ""
msgstr "en"
# English (Great Britain)
msgid "en_GB"
msgstr ""
msgstr "en_GB"
# Spanish
msgid "es"
msgstr ""
msgstr "es"
# French
msgid "fr"
msgstr ""
msgstr "fr"
# Hungarian
msgid "hu"
msgstr ""
msgstr "hu"
# Italian
msgid "it"
msgstr ""
msgstr "lt"
# Japanese
msgid "ja"
msgstr ""
msgstr "ja"
# Korean
msgid "ko_KR"
msgstr ""
msgstr "ko_KR"
# Dutch
msgid "nl"
msgstr ""
msgstr "nl"
# Norwegian
msgid "no"
msgstr ""
msgstr "no"
# Polish
msgid "pl"
msgstr ""
msgstr "pl"
# Portuguese (Brazil)
msgid "pt_BR"
msgstr ""
msgstr "pt_BR"
# Portuguese (Portugal)
msgid "pt_PT"
msgstr ""
msgstr "pt_PT"
# Russian
msgid "ru"
msgstr ""
msgstr "ru"
# Slovak
msgid "sk_SK"
msgstr ""
msgstr "sk_SK"
# Slovenian
msgid "sl"
msgstr ""
msgstr "sl"
# Swedish
msgid "sv_SE"
msgstr ""
msgstr "sv_SE"
# Turkish
msgid "tr"
msgstr ""
msgstr "tr"
# Chinese (Taiwan)
msgid "zh_TW"
msgstr ""
msgstr "zh_TW"
# Chinese (China)
msgid "zh_CN"
msgstr ""
msgstr "zh_CN"
# Hebrew (Israel)
msgid "he_IL"
msgstr ""
msgstr "he_IL"
# Tamil
msgid "ta"
msgstr ""
msgstr "ta"
# Finnish
msgid "fi"
msgstr ""
msgstr "fl"
# Catalan
msgid "ca"
msgstr ""
msgstr "ca"
# Lithuanian
msgid "lt"
msgstr ""
msgstr "it"
# Ukrainian
msgid "uk"
msgstr ""
msgstr "uk"
# Romanian
msgid "ro_RO"
msgstr "ro_RO"
# Estonian
msgid "et_EE"
msgstr "et_EE"

View File

@@ -1,6 +1,7 @@
#
# Translators:
# gimy16 <gimy16@hotmail.com>, 2021
# Martí Gombau, 2023
#
msgid ""
msgstr ""
@@ -8,8 +9,8 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2020-08-29 16:33+0000\n"
"Last-Translator: gimy16 <gimy16@hotmail.com>, 2021\n"
"Language-Team: Catalan (https://www.transifex.com/grocy/teams/93189/ca/)\n"
"Last-Translator: Martí Gombau, 2023\n"
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -55,7 +56,7 @@ msgstr "EXECUCIÓ-NO-REALITZADA-DE-LA-FEINA"
# Edit master data
msgid "MASTER_DATA_EDIT"
msgstr ""
msgstr "EDICIO_DADES_MESTRES"
# Undo execution
msgid "TASKS_UNDO_EXECUTION"
@@ -95,7 +96,7 @@ msgstr "ELEMENTS_AFEGITS_DE_LA_LLISTA_DE_LA_COMPRA"
# Remove items
msgid "SHOPPINGLIST_ITEMS_DELETE"
msgstr ""
msgstr "ELIMINAR_ELEMENTS_LLISTA_DE_LA_COMPRA"
# User management
msgid "USERS"

View File

@@ -1,6 +1,7 @@
#
# Translators:
# gimy16 <gimy16@hotmail.com>, 2021
# Auri, 2024
#
msgid ""
msgstr ""
@@ -8,8 +9,8 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-05-01 17:42+0000\n"
"Last-Translator: gimy16 <gimy16@hotmail.com>, 2021\n"
"Language-Team: Catalan (https://www.transifex.com/grocy/teams/93189/ca/)\n"
"Last-Translator: Auri, 2024\n"
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -36,10 +37,10 @@ msgid "product-opened"
msgstr "Producte_obert"
msgid "stock-edit-old"
msgstr "Edició_d'estoc_antic"
msgstr "edició-existència-antiga"
msgid "stock-edit-new"
msgstr "Edició_d'estoc_nou"
msgstr "edició-existència-nova"
msgid "self-production"
msgstr "Producció_pròpia"

View File

@@ -3,6 +3,10 @@
# Joan Rodas <joanrc93@gmail.com>, 2020
# Carles Riera <blauigris@gmail.com>, 2021
# jorclaret, 2022
# Martí Gombau, 2023
# Auri, 2024
# Pau Nofuentes Sendra, 2024
# Roger Solé Vilajuliu, 2024
#
msgid ""
msgstr ""
@@ -10,8 +14,8 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-05-01 17:42+0000\n"
"Last-Translator: jorclaret, 2022\n"
"Language-Team: Catalan (https://www.transifex.com/grocy/teams/93189/ca/)\n"
"Last-Translator: Roger Solé Vilajuliu, 2024\n"
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -128,7 +132,7 @@ msgid "Product overview"
msgstr "Resum de productes"
msgid "Stock quantity unit"
msgstr "Unitat d'inventari"
msgstr "Unitat d'existències"
msgid "Stock amount"
msgstr "Existències"
@@ -212,10 +216,7 @@ msgid "Default quantity unit purchase"
msgstr "Unitat predeterminada"
msgid "Quantity unit stock"
msgstr "Unitat d'inventari"
msgid "Factor purchase to stock quantity unit"
msgstr "Factor d'unitat de compra a unitat d'inteventari"
msgstr "Unitat d'existències"
msgid "Create location"
msgstr "Afegir ubicació"
@@ -271,10 +272,6 @@ msgstr "mai"
msgid "Add products that are below defined min. stock amount"
msgstr "Afegeix productes que estan per sota de les existències mínimes"
msgid "This means 1 %1$s purchased will be converted into %2$s %3$s in stock"
msgstr ""
"Això significa que 1 %1$s comprat es convertiran en %2$s %3$s en l'inventari"
msgid "Login"
msgstr "Iniciar sessió"
@@ -362,8 +359,8 @@ msgstr "Això vol dir que s'eliminaran %s de l'inventari"
msgid "Removed %1$s of %2$s from stock"
msgstr "%1$s de %2$s eliminats de l'inventari"
msgid "About grocy"
msgstr "Sobre el grocy"
msgid "About Grocy"
msgstr "Sobre Grocy"
msgid "Close"
msgstr "Tancar"
@@ -714,6 +711,7 @@ msgstr "Mantenir-se connectat permanentment"
msgid "When not set, you will get logged out at latest after 30 days"
msgstr ""
"Si no s'estableix, es tancarà la sessió com a molt tard al cap de 30 dies"
msgid "Status"
msgstr "Estat"
@@ -746,7 +744,7 @@ msgid "To"
msgstr "A"
msgid "Time range goes over midnight"
msgstr ""
msgstr "L'interval de temps supera la mitjanit"
msgid "Product picture"
msgstr "Imatge del producte"
@@ -767,22 +765,22 @@ msgid "Deletion not possible"
msgstr "No es pot eliminar"
msgid "Equipment"
msgstr ""
msgstr "Equipament"
msgid "Instruction manual"
msgstr "Manual d'instruccions"
msgid "The selected equipment has no instruction manual"
msgstr ""
msgstr "L'equipament seleccionat no té cap manual d'instruccions"
msgid "Notes"
msgstr "Notes"
msgid "Edit equipment"
msgstr ""
msgstr "Editar equipament"
msgid "Create equipment"
msgstr ""
msgstr "Crear equipament"
msgid "The current file will be deleted on save"
msgstr "L'arxiu actual serà eliminat al guardar"
@@ -791,7 +789,7 @@ msgid "No picture available"
msgstr "Imatge no disponible"
msgid "Presets for new products"
msgstr ""
msgstr "Paràmetres per defecte per a nous productes"
msgid "Included recipes"
msgstr "Receptes incloses"
@@ -812,16 +810,16 @@ msgid "This will be used as a headline to group ingredients together"
msgstr "Això serà utilitzat de capçalera per a agrupar ingredients"
msgid "Journal"
msgstr ""
msgstr "Diari"
msgid "Stock journal"
msgstr ""
msgstr "Diari d'existències"
msgid "Undone on"
msgstr "Desfet a "
msgid "Batteries journal"
msgstr ""
msgstr "Diari de bateries"
msgid "Undo charge cycle"
msgstr "Desfer cicle de càrrega"
@@ -836,13 +834,13 @@ msgid "Undo"
msgstr "Desfer"
msgid "Booking successfully undone"
msgstr ""
msgstr "Reserva anul·lada correctament"
msgid "Charge cycle successfully undone"
msgstr "Cicle de càrrrega desfet correctament"
msgid "Disable stock fulfillment checking for this ingredient"
msgstr ""
msgstr "Deshabilitar la comprovació d'existències per aquest ingredient"
msgid "Add all list items to stock"
msgstr "Afegeix tots els elements de la llista a les existències"
@@ -860,6 +858,9 @@ msgid ""
"The first item in this list would be picked by the default rule consume rule"
" (Opened first, then first due first, then first in first out)"
msgstr ""
"El primer element d'aquesta llista serà utilitzat per la regla de consum per"
" defecte (Primer l'obert, després el que caduca primer, després el primer "
"que entra el primer que surt)"
msgid "Mark %1$s of %2$s as open"
msgstr "Marcar %1$s de %2$s com a obert"
@@ -880,16 +881,16 @@ msgid "%s opened"
msgstr "%s obert"
msgid "Product due"
msgstr ""
msgstr "Venciment de producte"
msgid "Task due"
msgstr ""
msgstr "Venciment de tasca"
msgid "Chore due"
msgstr ""
msgstr "Venciment de feina"
msgid "Battery charge cycle due"
msgstr ""
msgstr "Venciment de cicle de càrrega de bateria"
msgid "Show clock in header"
msgstr "Mostra la hora a la capçalera"
@@ -951,13 +952,17 @@ msgstr ""
"format iCal"
msgid "Enable tare weight handling"
msgstr ""
msgstr "Habilitar el maneig de la tara"
msgid ""
"This is useful e.g. for flour in jars - on purchase/consume/inventory you "
"always weigh the whole jar, the amount to be posted is then automatically "
"calculated based on what is in stock and the tare weight defined below"
msgstr ""
"Això serà útil per exemple per a farina en pots - quan es "
"compra/consumeix/inventaria, sempre es pesa el pot sencer, la quantitat "
"final és calculada automàticament basat en la quantitat en existències i la "
"tara definida a continuació."
msgid "Tare weight"
msgstr "Tara"
@@ -966,6 +971,8 @@ msgid ""
"Tare weight handling enabled - please weigh the whole container, the amount "
"to be posted will be automatically calculcated"
msgstr ""
"Maneig de la tara habilitat - si us plau pesa tot el contenidor, la "
"quantitat publicada es calcularà automàticament"
msgid "You have to select a location"
msgstr "Cal seleccionar una ubicació"
@@ -983,7 +990,7 @@ msgid "The current picture will be deleted on save"
msgstr "La imathe actual serà eliminada al guardar"
msgid "Journal for this battery"
msgstr ""
msgstr "Diari per aquesta bateria"
msgid "System info"
msgstr "Informació de sistema"
@@ -1003,6 +1010,8 @@ msgstr "Quantitat de productes"
msgid ""
"Type a new product name or barcode and hit TAB or ENTER to start a workflow"
msgstr ""
"Escriu un nom o un codi de barres per al nou producte i prem TAB o ENTER "
"per començar un flux de treball"
msgid ""
"This will be used as the default setting when adding this product as a "
@@ -1036,7 +1045,7 @@ msgid "Create shopping list"
msgstr "Crear llista de la compra"
msgid "Are you sure to delete shopping list \"%s\"?"
msgstr ""
msgstr "Estàs segur d'eliminar la llista de la compra \"%s\"?"
msgid "Average shelf life"
msgstr "Temps de vida mitjà de l'inventari"
@@ -1087,7 +1096,7 @@ msgid "Entity"
msgstr "Entitat"
msgid "Caption"
msgstr ""
msgstr "Títol"
msgid "Type"
msgstr "Tipus"
@@ -1099,7 +1108,7 @@ msgid "A entity is required"
msgstr "Es requereix una entitat"
msgid "A caption is required"
msgstr ""
msgstr "Es requereix un títol"
msgid "A type is required"
msgstr "Es requereix un tipus"
@@ -1117,10 +1126,10 @@ msgid "Plural forms"
msgstr "Formes plurals"
msgid "One plural form per line, the current language requires"
msgstr ""
msgstr "Una forma plural per línia, requereix la llengua actual"
msgid "Plural count"
msgstr ""
msgstr "Recompte plural"
msgid "Plural rule"
msgstr "Norma de plural"
@@ -1157,18 +1166,23 @@ msgid ""
"When this is not empty, it will be shown instead of the amount entered above"
" while the amount there will still be used for stock fulfillment checking"
msgstr ""
"Quan no estigui buit, es mostrarà enlloc de la quantitat introduïda a dalt. "
"La quantitat de dalt seguirà sent la utilitzada en les comprovacions "
"d'existències a l'inventari. "
msgid "Track date only"
msgstr "Només seguiment de data"
msgid "When enabled only the day of an execution is tracked, not the time"
msgstr ""
"Si s'habilita, només es farà el seguiment del dia d'una execució, no pas "
"l'hora"
msgid "Consume %1$s of %2$s"
msgstr "Consumir %1$s de %2$s"
msgid "Meal plan"
msgstr "Calendari de menús"
msgstr "Calendari d'àpats"
msgid "%s serving"
msgid_plural "%s servings"
@@ -1192,6 +1206,7 @@ msgstr "Tasca %s marcada com a completada en %s"
msgid "Booking has subsequent dependent bookings, undo not possible"
msgstr ""
"La reserva té reserves posteriors dependents, l'anul·lació no és possible"
msgid "per serving"
msgstr "per ració"
@@ -1202,21 +1217,18 @@ msgstr "Mai"
msgid "Today"
msgstr "Avui"
msgid "Not all ingredients of recipe \"%s\" are in stock, nothing removed"
msgstr ""
"No tots els ingredients de la recepta \"%s\" tenen existències, no s'ha "
"eliminat res"
msgid "Undo task"
msgstr "Desfer tasca"
msgid "Due date rollover"
msgstr ""
msgstr "transferència de la data de venciment"
msgid ""
"When enabled the chore can never be overdue, the due date will shift forward"
" each day when due"
msgstr ""
"Quan s'activa, la tasca no pot vèncer mai, la dada de venciment és moure un "
"dia endavant cada dia després del venciment."
msgid "Location Content Sheet"
msgstr "Full de continguts d'ubicació"
@@ -1244,7 +1256,7 @@ msgid "Time of printing"
msgstr "Hora d'impressi"
msgid "Are you sure to delete equipment \"%s\"?"
msgstr ""
msgstr "Estàs segur d'eliminar l'equipament \"%s\"?"
msgid "Parent product"
msgstr "Producte pare"
@@ -1286,11 +1298,8 @@ msgstr "Significa que 1 %1$s equival a %2$s %3$s"
msgid "QU conversions"
msgstr "Conversions QU"
msgid "Product overrides"
msgstr ""
msgid "Override for product"
msgstr ""
msgstr "Anul·lació del producte"
msgid "This equals %1$s %2$s"
msgstr "Equival %1$s %2$s"
@@ -1299,10 +1308,10 @@ msgid "Edit QU conversion"
msgstr "Edita conversió QU"
msgid "An assignment type is required"
msgstr ""
msgstr "Es requereix un tipus d'assignació "
msgid "Assignment type"
msgstr ""
msgstr "Tipus d'assignació "
msgid ""
"This means the next execution of this chore is scheduled at the same time "
@@ -1311,7 +1320,11 @@ msgid_plural ""
"This means the next execution of this chore is scheduled at the same time "
"(based on the start date) every %s days"
msgstr[0] ""
"Això vol dir que la pròxima execució de la tasca està programada a la "
"mateixa hora (basat en la data d'inici) cada dia"
msgstr[1] ""
"Això vol dir que la pròxima execució de la tasca està programada a la "
"mateixa hora (basat en la data d'inici) cada %s dies"
msgid ""
"This means the next execution of this chore is scheduled %s hour after the "
@@ -1320,7 +1333,11 @@ msgid_plural ""
"This means the next execution of this chore is scheduled %s hours after the "
"last execution"
msgstr[0] ""
"Això vol dir que la pròxima execució de la tasca està programada 1 hora "
"després de l'última execució"
msgstr[1] ""
"Això vol dir que la pròxima execució de la tasca està programada %s hores "
"després de l'última execució"
msgid ""
"This means the next execution of this chore is scheduled every week on the "
@@ -1329,7 +1346,11 @@ msgid_plural ""
"This means the next execution of this chore is scheduled every %s weeks on "
"the selected weekdays"
msgstr[0] ""
"Això vol dir que la pròxima execució de la tasca està programada cada "
"setmana als dies seleccionats"
msgstr[1] ""
"Això vol dir que la pròxima execució de la tasca està programada cada %s "
"setmanes als dies seleccionats"
msgid ""
"This means the next execution of this chore is scheduled on the selected day"
@@ -1338,38 +1359,50 @@ msgid_plural ""
"This means the next execution of this chore is scheduled on the selected day"
" every %s months"
msgstr[0] ""
"Això vol dir que la pròxima execució de la tasca està programada al dia "
"seleccionat cada mes"
msgstr[1] ""
"Això vol dir que la pròxima execució de la tasca està programada al dia "
"seleccionat cada %s mesos"
msgid "This means the next execution of this chore is not scheduled"
msgstr ""
"Això significa que l'execució següent d'aquesta feina no està programada"
msgid ""
"This means the next execution of this chore will not be assigned to anyone"
msgstr ""
"Això vol dir que la pròxima execució de la tasca no serà assignada a ningú"
msgid ""
"This means the next execution of this chore will be assigned to the one who "
"executed it least"
msgstr ""
"Això vol dir que la pròxima execució de la tasca serà assignada a qui l'hagi"
" executat l'última vegada"
msgid "This means the next execution of this chore will be assigned randomly"
msgstr ""
"Això vol dir que la pròxima execució de la tasca serà assignada "
"aleatòriament a algú"
msgid ""
"This means the next execution of this chore will be assigned to the next one"
" in alphabetical order"
msgstr ""
"Això vol dir que la pròxima execució de la tasca serà assignada la següent "
"persona en ordre alfabètic"
msgid "Assign to"
msgstr ""
msgstr "Assigna a"
msgid "This assignment type requires that at least one is assigned"
msgstr ""
msgid "%s chore is assigned to me"
msgid_plural "%s chores are assigned to me"
msgstr[0] ""
msgstr[1] ""
msgstr[0] "Tens assignada %s feina"
msgstr[1] "Tens assignades %s feines"
msgid "Assigned to me"
msgstr "Assignat a mi"
@@ -1439,8 +1472,8 @@ msgstr ""
msgid "Price factor"
msgstr "Factor de preu"
msgid "Do you find grocy useful?"
msgstr "Trobes grocy útil?"
msgid "Do you find Grocy useful?"
msgstr "Trobes que Grocy t'és d'utilitat?"
msgid "Say thanks"
msgstr "Dir gràcies"
@@ -1457,8 +1490,8 @@ msgstr "Afegit %1$s de %2$s a la llista de la compra \"%3$s\""
msgid "Output"
msgstr "Resultat"
msgid "Energy (kcal)"
msgstr "Energia (kcal)"
msgid "Energy"
msgstr "Energia"
msgid "Per stock quantity unit"
msgstr "Per unitat d'existències"
@@ -1491,6 +1524,9 @@ msgid ""
"If enabled, the min. stock amount of sub products will be accumulated into "
"this product, means the sub product will never be missing, only this product"
msgstr ""
"Si s'activa, el mínim d'existències dels subproductes seran acumulats en "
"aquest producte, volent dir que el subproducte mai podrà faltar, només "
"aquest producte."
msgid "Are you sure to remove this conversion?"
msgstr "Estas segur d'eliminar aquesta conversió?"
@@ -1523,10 +1559,14 @@ msgid_plural ""
"This means the next execution of this chore is scheduled every %s years on "
"the same day (based on the start date)"
msgstr[0] ""
"Això vol dir que la pròxima execució de la tasca està programada cada any al"
" mateix dia (basat en la data d'inici)"
msgstr[1] ""
"Això vol dir que la pròxima execució de la tasca està programada cada %s "
"anys al mateix dia (basat en la data d'inici)"
msgid "Transfer"
msgstr ""
msgstr "Transfereix"
msgid "From location"
msgstr "D'ubicació"
@@ -1559,17 +1599,15 @@ msgid "The amount cannot be lower than %1$s"
msgstr "La quantitat no pot ser inferior a %1$s"
msgid "Stock entry successfully updated"
msgstr ""
msgstr "Entrada d'existències actualitzada correctament"
msgid "Edit stock entry"
msgstr ""
msgstr "Edita l'entrada d'inventari"
msgid ""
"Camera access is only possible when supported and allowed by your browser "
"and when grocy is served via a secure (https://) connection"
"and when Grocy is served via a secure (https://) connection"
msgstr ""
"L'accés a la càmera només és possible quan és suportat i permès per el teu "
"navegador i quan Grocy és servit a través d'una connexió segura (https)"
msgid "Keep screen on"
msgstr "Mantenir la pantalla activa"
@@ -1876,10 +1914,10 @@ msgid "Transaction time"
msgstr "Hora de la transacció"
msgid "Chore journal"
msgstr ""
msgstr "Resum de tasques"
msgid "Track chore execution"
msgstr "Seguiment d'execució de tasques"
msgid "Track next chore schedule"
msgstr ""
msgid "Mark task as completed"
msgstr "Marcar tasca com a completada"
@@ -1903,11 +1941,11 @@ msgid "Show a QR-Code for this API key"
msgstr "Mostra codi QR per a aquesta clau API"
msgid ""
"This is the default quantity unit used when adding this product to the "
"shopping list"
"This is the default quantity unit used on purchase and when adding this "
"product to the shopping list"
msgstr ""
"La unitat per defecte quan s'afegeix aquest producte a la llista de la "
"compra"
"Aquesta és la unitat per defecte que es farà servir en comprar i quan "
"s'afegeix el producte a la llista de la compra"
msgid ""
"Show a warning when the due date of the purchased product is earlier than "
@@ -1930,12 +1968,18 @@ msgid "Quick consume amount"
msgstr "Consumir ràpidament"
msgid ""
"This amount is used for the \"quick consume/open buttons\" on the stock "
"overview page (related to quantity unit stock)"
"This amount is used for the \"quick consume button\" on the stock overview "
"page (related to quantity unit stock)"
msgstr ""
"Aquesta quantitat és utilitzada per els botons \"consumir/obrir ràpidament\""
" en la pàgina principal de revisió d'existències (relacionada amb la "
"quantitat d'existències)"
"Aquesta quantitat és utilitzada pel botó de \"consumir ràpidament\" en la "
"pàgina d'existències (en unitats d'existències)"
msgid ""
"This amount is used for the \"quick open button\" on the stock overview page"
" (related to quantity unit stock)"
msgstr ""
"Aquesta quantitat és utilitzada pel botó de \"obrir ràpidament\" en la "
"pàgina d'existències (en unitats d'existències)"
msgid "Copy"
msgstr "Copiar"
@@ -2064,11 +2108,15 @@ msgid ""
"This cannot be lower than %1$s and needs to be a valid number with max. %2$s"
" decimal places"
msgstr ""
"Això no pot ser més baix que %1$s i ha de ser un nombre vàlid amb un màxim "
"de %2$s decimals"
msgid ""
"This must between %1$s and %2$s and needs to be a valid number with max. "
"%3$s decimal places"
msgstr ""
"Aquest ha de ser entre %1$s i %2$s i ha de ser un nombre vàlid amb un màxim "
"de %3$s decimals"
msgid ""
"Automatically do the booking using the last price and the amount of the "
@@ -2125,13 +2173,13 @@ msgid "Ingredient group"
msgstr "Grup d'ingredients"
msgid "Reset"
msgstr "Reiniciar"
msgstr "Reinicia"
msgid "Are you sure to reset the table options?"
msgstr "Segur que vols reiniciar les opcions de la taula?"
msgid "Hide/view columns"
msgstr "Ocultar/mostrar columnes"
msgstr "Oculta/mostra columnes"
msgid ""
"A different amount/unit can then be used below while for stock fulfillment "
@@ -2142,7 +2190,7 @@ msgid "Last price (Unit)"
msgstr "Últim preu (unitat)"
msgid "Last price (Total)"
msgstr "Últim preu (Total)"
msgstr "Últim preu (total)"
msgid "Show header"
msgstr "Mostrar capçalera"
@@ -2193,6 +2241,9 @@ msgid ""
"below their min. stock amount - enable this to hide this product there "
"always"
msgstr ""
"La pàgina d'existències mostra tots els productes que estan actualment en "
"existències o tenen existències per sota de la quantitat mínima - activa "
"aquesta opció per amagar aquest producte a aquella pàgina sempre."
msgid "Print options"
msgstr "Opcions d'impressió"
@@ -2200,27 +2251,24 @@ msgstr "Opcions d'impressió"
msgid "A product or a note is required"
msgstr "Es requereix un producte o nota"
msgid "grocycode"
msgstr "grocycode"
msgid "Grocycode"
msgstr "Grocycode"
msgid "Download"
msgstr "Descàrrega"
# Example: Download *Product* grocycode
msgid "Download %s grocycode"
msgstr "Descarregar grocycode %s"
# Example: Download *Product* Grocycode
msgid "Download %s Grocycode"
msgstr ""
msgid ""
"grocycode is a unique referer to this %s in your grocy instance - print it "
"Grocycode is a unique referer to this %s in your Grocy instance - print it "
"onto a label and scan it like any other barcode"
msgstr ""
"grocycode és una referència única a aquest %s en la teva instància de grocy "
"- imprimeix-la en una etiqueta i escaneja-la com qualsevol altre codi de "
"barres"
# Abbreviation for "due date"
msgid "DD"
msgstr ""
msgstr "DC"
msgid "Print on label printer"
msgstr "Imprimir en una impressora d'etiquetes"
@@ -2243,9 +2291,9 @@ msgstr "Etiqueta per unitat"
msgid "Error while executing WebHook"
msgstr "Error a l'executar el WebHook"
# Example: Print *Product* grocycode on label printer
msgid "Print %s grocycode on label printer"
msgstr "Imprimir el grocycode %s en una impressora d'etiquetes"
# Example: Print *Product* Grocycode on label printer
msgid "Print %s Grocycode on label printer"
msgstr ""
msgid "Open stock entry label in new window"
msgstr ""
@@ -2353,19 +2401,19 @@ msgid ""
msgstr ""
msgid "Stock entry"
msgstr ""
msgstr "Entrada d'existències"
msgid "Configure sections"
msgstr "Configurar seccions"
msgid "Meal plan sections"
msgstr ""
msgstr "Seccions de planificador d'àpats"
msgid "Create meal plan section"
msgstr ""
msgstr "Crea una secció al planificador d'àpats"
msgid "Sections will be ordered by that number on the meal plan"
msgstr ""
msgstr "Les seccions seran ordenades pel número en el planificador d'àpats."
msgid "Edit meal plan section"
msgstr ""
@@ -2409,8 +2457,8 @@ msgstr[1] ""
msgid "%s chore is due to be done today"
msgid_plural "%s chores are due to be done today"
msgstr[0] ""
msgstr[1] ""
msgstr[0] "%s tasca s'ha d'acabar avui"
msgstr[1] "%s tasques s'han d'acabar avui"
msgid "%s battery is due to be charged today"
msgid_plural "%s batteries are due to be charged today"
@@ -2421,18 +2469,20 @@ msgid "Set to 0 to hide due soon filters/highlighting"
msgstr ""
msgid "Save & close"
msgstr ""
msgstr "Desa i tanca"
msgid "Save & add another task"
msgstr ""
msgstr "Desa i afegeix una altra tasca"
msgid "Treat opened as out of stock"
msgstr ""
msgstr "Tracta obert com a esgotat"
msgid ""
"When enabled, opened items will be counted as missing for calculating if "
"this product is below its minimum stock amount"
msgstr ""
"Quan s'activa, els elements oberts seran comptats com a absents per calcular"
" si aquest producte es troba per sota els mínims d'existències."
msgid "Skipped"
msgstr ""
@@ -2441,16 +2491,18 @@ msgid "Skip next chore schedule"
msgstr ""
msgid "Time"
msgstr ""
msgstr "Hora"
msgid "A start date is required"
msgstr ""
msgstr "La data d'inici és necessària"
msgid "Start date"
msgstr ""
msgstr "Data d'inici"
msgid "The start date cannot be changed when the chore was once tracked"
msgstr ""
"La data d'inici no es pot canviar després de començar el seguiment de la "
"tasca"
msgid "Show the recipe list and the recipe side by side"
msgstr ""
@@ -2459,18 +2511,20 @@ msgid ""
"This means the next execution of this chore is scheduled dynamically based "
"on the past average execution frequency"
msgstr ""
"Això vol dir que la pròxima execució de la tasca està programada "
"dinàmicament basant-se en la freqüència mitjana d'execució "
msgid "Average execution frequency"
msgstr ""
msgstr "Freqüència mitjana de realització"
msgid "Reschedule next execution"
msgstr ""
msgstr "Re-programa la següent realització"
msgid "This can only be in the future"
msgstr ""
msgid "Rescheduled"
msgstr ""
msgstr "Re-programada"
msgid "Due score"
msgstr ""
@@ -2481,13 +2535,16 @@ msgid ""
msgstr ""
msgid "Disable own stock"
msgstr ""
msgstr "Deshabilitar inventari propi"
msgid ""
"When enabled, this product can't have own stock, means it will not be "
"selectable on purchase (useful for parent products which are just used as a "
"summary/total view of the child products)"
msgstr ""
"Quan s'habilita, aquest producte no pot tenir quantitat d'existències "
"pròpies, això vol dir que no es podrà seleccionar per comprar (útil per "
"productes para que són una vista resum/total dels subproductes)"
msgid "Out of stock items will be shown at the products default location"
msgstr ""
@@ -2507,45 +2564,47 @@ msgid ""
msgstr ""
msgid "Night mode"
msgstr ""
msgstr "Mode nocturn"
msgid "On"
msgstr ""
msgstr "ON"
msgid "Use system setting"
msgstr ""
msgstr "Utilitza la configuració del sistema"
msgid "Off"
msgstr ""
msgstr "OFF"
msgid ""
"Automatically add products that are below their defined min. stock amount to"
" the shopping list"
msgstr ""
"Afegeix automàticament els productes que estiguin per sota el seu valor "
"d'existències mínim definit a la llista de compra"
msgid "Reassigned"
msgstr ""
msgstr "Re-assignada"
msgid "Default value"
msgstr ""
msgstr "Valor predeterminat"
msgid "Now / today"
msgstr ""
msgstr "Ara / avui"
msgid "Add meal plan entry"
msgstr ""
msgstr "Afegeix entrada al menú"
msgid "Edit meal plan entry"
msgstr ""
msgstr "Edita entrada del menú"
msgid "Default consume location"
msgstr ""
msgstr "Ubicació de consum predeterminada"
msgid "Stock entries at this location will be consumed first"
msgstr ""
msgstr "Les existències en aquesta ubicació es consumiran primer"
msgid "Move on open"
msgstr ""
msgstr "Mou quan s'obri"
msgid ""
"When enabled, on marking this product as opened, the corresponding amount "
@@ -2553,10 +2612,127 @@ msgid ""
msgstr ""
msgid "Moved to %1$s"
msgstr ""
msgstr "S'ha mogut a %1$s"
msgid "Decimal places allowed for prices (input)"
msgstr ""
msgstr "Posicions decimals permeses pels preus (entrada)"
msgid "Decimal places allowed for prices (display)"
msgstr "Posicions decimals permeses pels preus (visualització)"
msgid "Clear done items"
msgstr ""
msgid ""
"This shows all to this product directly or indirectly related quantity units"
" and their derived conversion factors"
msgstr ""
msgid "Show resolved conversions"
msgstr "Mostra les conversions resoltes"
msgid "QU conversions resolved"
msgstr "Conversions QU resoltes"
msgid "Product specific QU conversions"
msgstr "Conversions QU específiques de producte"
msgid "Default quantity unit consume"
msgstr "Unitat de consum predeterminada"
msgid "This is the default quantity unit used when consuming this product"
msgstr ""
"Aquesta és la unitat per defecte que es farà servir en consumir aquest "
"producte"
msgid "Add to meal plan"
msgstr "Afegeix al menú"
msgid "Successfully added the recipe to the meal plan"
msgstr "Recepta afegida al menú correctament"
msgid "Reprint stock entry label"
msgstr ""
msgid "Auto reprint stock entry label"
msgstr ""
msgid ""
"When enabled, auto-changing the due date of a stock entry (by "
"opening/freezing/thawing and having corresponding default due days set) will"
" reprint its label"
msgstr ""
msgid "Quick open amount"
msgstr ""
msgid "Track chore execution now"
msgstr ""
msgid "Total"
msgstr "Total"
msgid "Apply"
msgstr "Aplica"
msgid "Custom range"
msgstr "Interval personalitzat"
msgid "Yesterday"
msgstr "Ahir"
msgid "Last %1$s day"
msgid_plural "Last %1$s days"
msgstr[0] "L'últim %1$s dia"
msgstr[1] "Els últims %1$s dies"
msgid "This month"
msgstr "Aquest mes"
msgid "Last month"
msgstr "El mes passat"
msgid "This year"
msgstr "Aquest any"
msgid "Last year"
msgstr "L'any passat"
msgid "Reports"
msgstr "Informes"
msgid "Spendings"
msgstr "Despeses"
msgid "Stock report"
msgstr "Informe d'existències"
msgid "Out-of-stock products"
msgstr "Productes sense existències"
msgid "Quantity unit for prices"
msgstr ""
msgid ""
"When displaying prices for this product, they will be related to this "
"quantity unit"
msgstr ""
"Quan es mostrin els preus per aquest producte, seran referits a aquesta "
"unitat"
msgid "This means 1 label will be printed"
msgid_plural "This means %1$s labels will be printed"
msgstr[0] ""
msgstr[1] ""
msgid "External barcode lookup (via plugin)"
msgstr ""
msgid "Error while executing the barcode lookup plugin"
msgstr ""
msgid "Nothing was found for the given barcode"
msgstr ""
msgid "Configure colors"
msgstr "Configura els colors"

View File

@@ -1,6 +1,7 @@
#
# Translators:
# gimy16 <gimy16@hotmail.com>, 2021
# Roger Solé Vilajuliu, 2024
#
msgid ""
msgstr ""
@@ -8,8 +9,8 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-05-01 17:43+0000\n"
"Last-Translator: gimy16 <gimy16@hotmail.com>, 2021\n"
"Language-Team: Catalan (https://www.transifex.com/grocy/teams/93189/ca/)\n"
"Last-Translator: Roger Solé Vilajuliu, 2024\n"
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -33,6 +34,10 @@ msgstr "nombre-integral"
msgid "number-decimal"
msgstr "nombre-decimal"
# Number (currency)
msgid "number-currency"
msgstr "nombre-moneda"
# Date (without time)
msgid "date"
msgstr "data"

View File

@@ -10,7 +10,7 @@ msgstr ""
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-09-17 10:45+0000\n"
"Last-Translator: Pavel Paseka, 2022\n"
"Language-Team: Czech (https://www.transifex.com/grocy/teams/93189/cs/)\n"
"Language-Team: Czech (https://app.transifex.com/grocy/teams/93189/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@@ -11,7 +11,7 @@ msgstr ""
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-05-01 17:42+0000\n"
"Last-Translator: Pavel Paseka, 2022\n"
"Language-Team: Czech (https://www.transifex.com/grocy/teams/93189/cs/)\n"
"Language-Team: Czech (https://app.transifex.com/grocy/teams/93189/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@@ -10,7 +10,7 @@ msgstr ""
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-05-01 17:42+0000\n"
"Last-Translator: Bernd Bestel <bernd@berrnd.de>, 2020\n"
"Language-Team: Czech (https://www.transifex.com/grocy/teams/93189/cs/)\n"
"Language-Team: Czech (https://app.transifex.com/grocy/teams/93189/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@@ -3,7 +3,7 @@
# Michal Petříček <michal@petricek.org>, 2019
# Ondřej Suk <ondra.suk.55@gmail.com>, 2020
# Radim Kabeláč <radim.ekk@gmail.com>, 2020
# Pavel Paseka, 2022
# Pavel Paseka, 2023
#
msgid ""
msgstr ""
@@ -11,8 +11,8 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-05-01 17:42+0000\n"
"Last-Translator: Pavel Paseka, 2022\n"
"Language-Team: Czech (https://www.transifex.com/grocy/teams/93189/cs/)\n"
"Last-Translator: Pavel Paseka, 2023\n"
"Language-Team: Czech (https://app.transifex.com/grocy/teams/93189/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -404,3 +404,31 @@ msgstr "Litevština"
msgid "Ukrainian"
msgstr "Ukrajinština"
msgid "Kilogram"
msgid_plural "Kilograms"
msgstr[0] "kilogram"
msgstr[1] "kilogramy"
msgstr[2] "kilogramů"
msgstr[3] "kilogramů"
msgid "Romanian"
msgstr "Rumunština"
msgid "Pint"
msgstr "Pinta"
msgid "Beverages"
msgstr "Nápoje"
msgid "Ice Cream"
msgstr "Zmrzlina"
msgid "Soda"
msgstr "Soda"
msgid "Beer"
msgstr "Pivo"
msgid "Estonian"
msgstr ""

Some files were not shown because too many files have changed in this diff Show More