Compare commits

...

401 Commits

Author SHA1 Message Date
Bernd Bestel
e3504464e5 Don't enforce barcodes to be unique (fixes #1205) 2020-12-22 11:32:26 +01:00
Bernd Bestel
94e4ee0659 Pulled translations from Transifex 2020-12-22 10:31:06 +01:00
Bernd Bestel
f1ddd4a57e Fixed JS error 2020-12-22 10:23:26 +01:00
Bernd Bestel
5c8ed05f68 Use dynamic barcode types (references #1133) 2020-12-22 10:20:31 +01:00
Bernd Bestel
a333ccbb78 Optimizes demo data 2020-12-22 10:12:37 +01:00
Bernd Bestel
00c8934046 Use better confirm dialog 2020-12-22 10:05:06 +01:00
Bernd Bestel
efb5f97ed4 Optimized README formatting 2020-12-22 09:58:36 +01:00
Bernd Bestel
ab29233f07 Added a head line on the shopping list print options dialog 2020-12-21 21:42:21 +01:00
Bernd Bestel
c1dd145b81 Clarified that database migrations are supposed to work between releases 2020-12-21 21:29:52 +01:00
Bernd Bestel
c1ac9e8a45 Optimized/clarified new "Hide product from stock overview" option (references #906) 2020-12-21 20:43:10 +01:00
Bernd Bestel
694b78f72a Optimized GROCY_FEATURE_FLAG_STOCK handling (closes #966) 2020-12-21 20:13:49 +01:00
Bernd Bestel
7478d9bb38 Removed RTL CSS handling (not needed until we have full RTL support) 2020-12-21 19:36:20 +01:00
Bernd Bestel
e866035f05 Removed unused code 2020-12-21 19:27:04 +01:00
Bernd Bestel
cf299a3d0b Optimized file save/delete handling 2020-12-21 19:16:14 +01:00
Bernd Bestel
5953e42d70 Updated icons 2020-12-21 19:04:48 +01:00
Bernd Bestel
d83271655c Fixed purchase success message amount 2020-12-21 18:27:12 +01:00
Bernd Bestel
bb5bcb9cbe Changelog wording 2020-12-21 18:09:03 +01:00
Bernd Bestel
431a2ab9f7 Added new Userfield type "Link (with title)" (closes #790) 2020-12-21 17:57:48 +01:00
Bernd Bestel
e97fccd03a Optimized shopping list header 2020-12-21 16:29:39 +01:00
Bernd Bestel
f0d99a5714 Fixed API key deletion was not possible (fixes #1203) 2020-12-21 16:20:12 +01:00
Bernd Bestel
e62994eb4a Fixed not required field initialization when GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING is disabled (references #1202 ) 2020-12-21 10:52:40 +01:00
Bernd Bestel
01306bc1ae Fixed product barcodes table display when FEATURE_FLAG_STOCK_PRICE_TRACKING is disabled (fixes #1202) 2020-12-21 09:54:20 +01:00
Bernd Bestel
360f25ec44 Make the new user picture a little bigger (references #1158) 2020-12-21 09:49:40 +01:00
Bernd Bestel
3b1f8cba70 Moved the new copy/merge products buttons in a dropdown menu 2020-12-21 09:30:19 +01:00
Bernd Bestel
2b13102299 Implemented Userfields for users (closes #1159) 2020-12-20 22:16:58 +01:00
Bernd Bestel
8f1ce607f7 Implemented user pictures (closes #1158) 2020-12-20 22:08:50 +01:00
Bernd Bestel
3f718eab60 Remove accidentally added localization strings 2020-12-20 21:00:48 +01:00
Bernd Bestel
c9b5e14473 Make it possible to merge products (closes #243) 2020-12-20 20:58:22 +01:00
Bernd Bestel
dadf93a94c Merge used libraries for Barcode/QR-Code generation 2020-12-20 19:53:28 +01:00
Bernd Bestel
1d16021404 Show barcode as barcode-image on shopping list (closes #1133) 2020-12-20 19:31:12 +01:00
Bernd Bestel
b2f555400c Fixed database migration error handling
(Error page was not shown properly)
2020-12-20 16:52:13 +01:00
Robert Resch
6ec3743d12 fix missing > (#1201) 2020-12-20 16:02:33 +01:00
Bernd Bestel
df7653f4e5 Optimized barcode concatenation handling 2020-12-20 16:00:14 +01:00
Bernd Bestel
3fb55b706b Refresh chore-/batterycard after tracking 2020-12-20 15:04:46 +01:00
Bernd Bestel
6eaee0c6f9 Fixed number display for quick consume buttons 2020-12-20 15:02:22 +01:00
Bernd Bestel
580598b817 Fixed max consume amount was not set 2020-12-20 15:01:59 +01:00
Bernd Bestel
a5326aa95c Improve API stock action endpoint response (closes #769) 2020-12-20 14:43:07 +01:00
Bernd Bestel
cef3086a63 Pulled translations from Transifex 2020-12-20 13:03:06 +01:00
Bernd Bestel
b2d7003335 Performance optimizations 2020-12-20 10:44:19 +01:00
Bernd Bestel
76e4a1578c Added Default store as a column to the shopping list (closes #957) 2020-12-20 10:26:02 +01:00
Bernd Bestel
268b8e87d7 Make it possible to hide chores/batteries (closes #1069) 2020-12-20 10:19:44 +01:00
Bernd Bestel
31dbb95c58 Typo 2020-12-20 00:04:44 +01:00
Bernd Bestel
832141a718 Made the shopping list print view configurable (closes #740) 2020-12-19 23:57:33 +01:00
Bernd Bestel
77e842a736 Fixed shopping list print button when FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS was disabled (references #1199) 2020-12-19 23:00:07 +01:00
Bernd Bestel
f5e0709913 Added columns for last price on shopping list (closes #410) 2020-12-19 17:55:49 +01:00
Bernd Bestel
7f24ffc484 Clarify string 2020-12-19 17:38:04 +01:00
Bernd Bestel
250b308d5d Support -1 for "Default due days after freezing" (closes #846) 2020-12-19 17:32:47 +01:00
Bernd Bestel
362b3f8508 Added min. stock amount column to stock overview (closes #856) 2020-12-19 17:25:13 +01:00
Bernd Bestel
3ad5f2cac5 Added a note field to product barcodes (closes #962) 2020-12-19 17:20:54 +01:00
Bernd Bestel
5421dfb6b2 Make the chore assignment type "Random" more random (closes #674) 2020-12-19 17:15:18 +01:00
Bernd Bestel
9d7ca55109 Typo 2020-12-19 17:09:48 +01:00
Bernd Bestel
1b864f990b Updated screenshots 2020-12-19 17:08:08 +01:00
Bernd Bestel
17d0821bae Typo 2020-12-19 15:42:39 +01:00
Bernd Bestel
cd57b00a18 Prepared next release 2020-12-19 15:32:32 +01:00
Bernd Bestel
1da51cde67 Reviewed config-dist.php 2020-12-19 15:00:31 +01:00
Bernd Bestel
063e4c214b Reviewed README 2020-12-19 14:53:51 +01:00
Bernd Bestel
ea888fffb7 Updated unmanaged dependencies 2020-12-19 14:28:32 +01:00
Bernd Bestel
796e35d60b Removed unneeded dependency 2020-12-19 14:19:26 +01:00
Bernd Bestel
b53f3bcef1 Updated dependencies 2020-12-19 14:18:01 +01:00
Bernd Bestel
574d17fa52 General UI review/test 2020-12-19 14:03:28 +01:00
Bernd Bestel
7ef5bc6f77 Add some more columns (hidden by default) (references https://github.com/grocy/grocy/issues/1058#issuecomment-744059155) 2020-12-19 10:51:07 +01:00
Bernd Bestel
eb4a748da3 Consume opened products first (closes #1183) 2020-12-19 10:28:35 +01:00
Bernd Bestel
44cdd42062 he_IL localization can't be released before #984 is done 2020-12-17 17:42:27 +01:00
Bernd Bestel
cc2ea93313 Make DataTable row groups collapsible everywhere (references #1189) 2020-12-17 17:41:31 +01:00
Bernd Bestel
b5fc64cf5d Fixed DataTables numeric/datetime sorting (fixes #1085) 2020-12-17 17:33:24 +01:00
Bernd Bestel
bbad049880 Forgot to save... 2020-12-17 16:54:26 +01:00
Bernd Bestel
9572652a8a Fixed total price for tare weight handling enabled products (fixes #1196) 2020-12-17 16:50:15 +01:00
Bernd Bestel
bb6ef5511d Fixed API equals/not equals filter comparison (fixes #1182) 2020-12-16 21:52:24 +01:00
Bernd Bestel
13b18ef410 Removed unused localization string 2020-12-16 21:40:12 +01:00
Bernd Bestel
0bd9a1dc4b Added changelog for #1189 2020-12-16 18:21:21 +01:00
Robert Resch
07ff28da39 Add row group customization (#1189)
* Add row group customization

* fix rowGroup state loading

* activate rowGroup for all datatables

* add reset button

* reload page done on success callback

* Review

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-12-16 18:18:03 +01:00
Bernd Bestel
d9a3c5169e Fixed product copy source / default value prefilling handling (fixes #1179) 2020-12-16 17:51:05 +01:00
Bernd Bestel
1567b9d9d9 Added missing localization strings 2020-12-16 17:48:30 +01:00
Bernd Bestel
25f5f98b75 Fixed undoing a consume transaction of an opened item added it back to stock unopened (fixes #1191) 2020-12-16 17:44:51 +01:00
Bernd Bestel
2e01ecbe58 Enforce product nesting level also for the API 2020-12-16 17:37:44 +01:00
Bernd Bestel
4c7318acd7 Added changelog for #1190 2020-12-16 17:28:39 +01:00
PhyberApex
596a7ccd36 Removing of resize event (#1190)
* Removing of resize event

Hey,

I removed that resize event as it get's thrown every time you scroll on a mobile device. Which prevented me from actually viewing the list view of the calender on mobile devices.

Let me know if you think it is still needed tho!

~Cheers

* Update calendar.js

Now it only get's called once :)

* Update mealplan.js

Same thing here as in calendar.js

* Update calendar.js

Removed redundant variable
2020-12-16 17:26:39 +01:00
Dominic Zedler
54e4d3217c Correct typo in changelog (#1177) 2020-12-12 15:52:44 +01:00
Bernd Bestel
bfbaa7e9d5 Expose stock and stock_current_locations also via generic entity interaction API endpoints (no edit) (closes #1147) 2020-12-12 10:59:36 +01:00
Bernd Bestel
59aad1c180 Added REGEXP operator for API query filter (closes #1174) 2020-12-12 10:44:27 +01:00
Bernd Bestel
d3883ba93a Reorganized API exposed entities 2020-12-12 10:10:21 +01:00
Bernd Bestel
f07a21b00b Added missing API query filter info 2020-12-11 19:36:29 +01:00
Bernd Bestel
51a95814e0 Handle null in API filter (closes #1173) 2020-12-11 19:32:08 +01:00
dependabot[bot]
24c9f31caf Bump ini from 1.3.5 to 1.3.7 (#1172)
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-11 18:18:44 +01:00
Bernd Bestel
672c4d33bf Added basic RTL support (reference #984) 2020-12-11 18:06:32 +01:00
Bernd Bestel
9e824a7afc Pulled translations from Transifex 2020-12-11 17:41:55 +01:00
Bernd Bestel
4b1766ead0 Return default user setting if not configured for API endpoint /user/settings/{settingKey} (fixes #1169) 2020-12-10 18:02:24 +01:00
Bernd Bestel
48aa9fd138 Added an API endpoint to get the authenticated user (closes #1165) 2020-12-09 21:16:49 +01:00
Bernd Bestel
fda8411ab3 Support descending ordering in generic API filter (closes #1167) 2020-12-09 21:04:04 +01:00
Bernd Bestel
19802bc122 Fixed localization string 2020-12-07 19:55:31 +01:00
Bernd Bestel
cf34df5e3f Squashed commit
Fixed some localization strings
Reviewed/optimized product deletion handling
Add option to hide products from the stock overview page (closes #906)
Prefill default_due_days also on the inventory page (closes #591)
Added DataTables accent chinese-string plugin (closes #872)
Show costs and calories per recipe ingredient (closes #1072)
Fixed user permission saving (fixes #1099)
User permissions should not have an effect for demo mode (closes #972)
Handle QU conversion when consuming a substituation (child) product (fixes #1118)
Consume/open any child product when the parent product is not in stock (closes #899)
Added a retry camera barcode scanning button to product picker workflow (closes #736)
2020-12-07 19:48:33 +01:00
Bernd Bestel
2bdb6ab2d4 Use the products "Quick consume amount" optionally also on the consume page (closes #1148) 2020-12-04 18:16:58 +01:00
Bernd Bestel
8ec7e9923c Fixed productcard aggregated amount was in wrong line 2020-11-19 18:41:09 +01:00
Bernd Bestel
166748788b Added an include_sub_products parameter to the API endpoint /stock/products/{productId}/locations 2020-11-19 18:37:16 +01:00
Bernd Bestel
211239a5d3 Fixed /stock/products/{productId}/entries endpoint query parameter include_sub_products did not work (however) 2020-11-19 18:28:16 +01:00
Bernd Bestel
631831e1e4 Use custom demo DB path suffix also for storage (references #395) 2020-11-19 12:24:26 +01:00
Bernd Bestel
f9d566c55c Support custom DB path suffixes for demo mode (closes #395) 2020-11-18 19:42:05 +01:00
Bernd Bestel
bbdc372dcf Use total price for product_barcodes.last_price (references #1131) 2020-11-17 22:06:52 +01:00
Bernd Bestel
2b4d8a7cc5 Load userobject forms in dialogs 2020-11-17 21:18:05 +01:00
Bernd Bestel
639ffe13f5 Reverted 41067b23bb because that's not needed (references #1049 and #958) 2020-11-17 21:10:26 +01:00
Bernd Bestel
7ef970a09f Forgot to save... 2020-11-17 21:05:55 +01:00
Bernd Bestel
604629ed5e Added a button to download equipment instruction manuals (closes #833) 2020-11-17 21:01:45 +01:00
Bernd Bestel
d2d09cf928 Removed dragscroll dependency (fixes #1135, references #1115) 2020-11-17 20:50:04 +01:00
Bernd Bestel
e32d12699e Properly initialize sort_number on the Userfield edit form (references #1134) 2020-11-17 20:28:26 +01:00
Bernd Bestel
5634abed82 Use transactions for database migrations 2020-11-17 20:22:38 +01:00
Bernd Bestel
6270f39688 Make Userfields reorderable (closes #1134) 2020-11-17 20:12:45 +01:00
Bernd Bestel
887526c727 Squashed commit
Fixed number input min/max amount handling
Only (auto) save valid user inputs
More filters on the stock journal pages
Save the last price per used barcode and preselect that as a total price on purchase if not empty (closes #1131)
Don't apply conversions for only_check_single_unit_in_stock ingredients (fixes #1120)
Render shopping list userfields (closes #1052)
Fixed Focus when adding included recipes (closes #1019)
Order all base objects with NOCASE (closes #1086)
2020-11-17 19:11:02 +01:00
Bernd Bestel
1316c1f25f Don't colorize validated custom checkboxes/radios 2020-11-16 22:33:24 +01:00
Bernd Bestel
8733ae17e7 Forgot to save before last commit... 2020-11-16 22:30:51 +01:00
Bernd Bestel
512ef745da Don't expose uihelper views via the API / allow to get stock_log via generic entity interaction endpoints (no edit) 2020-11-16 22:18:37 +01:00
Bernd Bestel
e85b21384f Remove "Allow partial units in stock" product option / unify number input validation messages 2020-11-16 17:10:41 +01:00
Bernd Bestel
95fc6a6faa Fixed RefreshLocaleNumberInput 2020-11-15 23:03:12 +01:00
Bernd Bestel
7b4edf3147 Adapt shopping list add expired products for #851 2020-11-15 22:38:21 +01:00
Bernd Bestel
1bbd7787d8 More proper number formatting 2020-11-15 22:29:47 +01:00
Bernd Bestel
293880c874 Typo 2020-11-15 20:30:50 +01:00
Bernd Bestel
948bf0a9c4 Removed unused localization string 2020-11-15 20:08:45 +01:00
Bernd Bestel
c62fa8c203 Changelog formatting fixes 2020-11-15 20:05:10 +01:00
Bernd Bestel
b393998601 Distinguish expiry/best before dates (closes #851) 2020-11-15 19:53:44 +01:00
Bernd Bestel
1d50d5dd22 Rmove unique constraint on tasks.name (closes #1001) 2020-11-15 16:19:55 +01:00
Bernd Bestel
9a7196b761 Make it possible to copy products (closes #571) 2020-11-15 16:05:25 +01:00
Bernd Bestel
7d7f9bf07a Changed default label of dialog close button 2020-11-15 15:28:50 +01:00
Bernd Bestel
3fc3bdd34c Make the help icons a little not so prominent 2020-11-15 15:23:47 +01:00
Bernd Bestel
6eef19dfc6 Fixed DataTables state load when there are no settings saved 2020-11-15 15:20:50 +01:00
Bernd Bestel
9942a2dbab Use new style also on the login page 2020-11-15 15:17:13 +01:00
Bernd Bestel
3568fd9dcb Added a "error info copy & paste" text box on the 500 error page 2020-11-15 15:12:15 +01:00
Bernd Bestel
22e9e4e311 Forgot to save... 2020-11-15 14:59:54 +01:00
Bernd Bestel
dd8fa5ff66 Save DataTable states server side 2020-11-15 14:58:35 +01:00
Bernd Bestel
6866109b97 Add clear filter button to stock entries page + mobile view optimizations (this now closes #1129) 2020-11-15 14:48:48 +01:00
Bernd Bestel
7bf973dd32 Fix stock entries page dropdown menu overflow (references #1129) 2020-11-15 14:30:00 +01:00
Bernd Bestel
4b342dbd43 Improved number input initial value decimal handling 2020-11-15 14:15:09 +01:00
Bernd Bestel
1d1642b464 Make the quick consume buttons on the stock overview page configurable per product (closes #613) 2020-11-15 09:57:45 +01:00
Bernd Bestel
17ae7e3d0c Added a tooltip what scan mode is 2020-11-15 09:27:07 +01:00
Bernd Bestel
3b73df57e5 Unify tooltips 2020-11-15 09:22:05 +01:00
Bernd Bestel
185627af7d Fixed table filters 2020-11-15 09:21:54 +01:00
Bernd Bestel
d1846b76ff Fixed parent product selection (fixes #1128) 2020-11-15 09:12:14 +01:00
Bernd Bestel
f85b89d4fa Show a warning on purchase when purchased best before date is < in stock (closes #948) 2020-11-14 23:15:34 +01:00
Bernd Bestel
db5c9ce3e8 stockentryform amount doesn't need to handle tare weight 2020-11-14 22:54:29 +01:00
Bernd Bestel
28276191cc Don't allow tare weight handling enabled products to be opened (closes #770) 2020-11-14 22:51:06 +01:00
Bernd Bestel
62c9c285ba Document API changes in grocy.openapi.json (closes #969) 2020-11-14 21:26:16 +01:00
fipwmaqzufheoxq92ebc
491b74efa8 Fix is_aggregate_amount always 0 on stock_current (#1127)
* Fix is_aggregate_amount always 0

* Restore performance indexes from #927

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-11-14 16:41:45 +01:00
Bernd Bestel
1d6e279b07 Added missing changelog (references #801) 2020-11-14 12:44:50 +01:00
Bernd Bestel
6e867cafbd Unify/remove used icons 2020-11-14 11:59:49 +01:00
Bernd Bestel
bb985c09ba Fixed purchase/inventory embedded mode initial input focus handling 2020-11-14 11:53:35 +01:00
Bernd Bestel
1fbda392c2 Fixed product edit page returnto handling 2020-11-14 11:49:46 +01:00
Bernd Bestel
c00411da81 Prevent qu_id_stock change after first purchase also via a trigger (for the API) (references #801) 2020-11-14 11:37:01 +01:00
Bernd Bestel
62997d39bc Removde the /objects/{entity}/search API endpoint, added the new filter capabilities to /objects/{entity} (references #985) 2020-11-14 11:27:13 +01:00
Bernd Bestel
16b17b25a4 Reordered input fields 2020-11-14 11:07:36 +01:00
Bernd Bestel
b267295e86 Fixed product picker workflows 2020-11-14 11:05:36 +01:00
Bernd Bestel
71f6b38cb2 Fixed chore edit page QU hint 2020-11-13 19:03:25 +01:00
Bernd Bestel
c45e5d1794 Trigger cascade_change_qu_id_stock is not longer needed 2020-11-13 19:01:01 +01:00
Bernd Bestel
ed2239c1f6 Wording correction 2020-11-13 17:58:46 +01:00
Bernd Bestel
96b86c230c Use sensible decimal amounts 2020-11-13 17:45:09 +01:00
Bernd Bestel
42f70b04e7 Also show the price hint for single unit prices when purchase QU != stock QU 2020-11-13 17:43:28 +01:00
Bernd Bestel
b0b3322266 Also relate the shopping list amount to QU stock 2020-11-13 17:30:57 +01:00
Bernd Bestel
ab68a51ba7 Recipe edit page fixes 2020-11-13 15:46:44 +01:00
Bernd Bestel
fa3a4ed688 Fixed productamountpicker initial converted amount was undefined 2020-11-12 22:47:00 +01:00
Bernd Bestel
1056252117 Typo 2020-11-12 21:41:21 +01:00
Bernd Bestel
c360cbec4c UI strings/tooltips/basic handling review/optimizations 2020-11-12 21:35:10 +01:00
Bernd Bestel
c121c0483a Fixed missing error message when trying to create a duplicate product 2020-11-12 13:09:46 +01:00
Bernd Bestel
ea9722bfa4 Fixed undefined variable warnings on product edit page 2020-11-12 13:08:50 +01:00
Bernd Bestel
6f3a3f62af Typo 2020-11-11 22:39:24 +01:00
Bernd Bestel
0c8b6c55c1 Added total calories as a column to stock overview (references #1058) 2020-11-11 22:38:01 +01:00
Bernd Bestel
0a600d3277 Fix hide/view columns dialog did not work on pages with more than 1 table (references #1058) 2020-11-11 22:28:05 +01:00
Bernd Bestel
c3e59d21b9 Only number picker help hint when not empty 2020-11-11 22:17:01 +01:00
Bernd Bestel
11f65629e3 Fixed number picker help hint 2020-11-11 22:09:26 +01:00
Bernd Bestel
7c8a17ce78 Add calories as a column to stock overview (references #1058) 2020-11-11 22:06:01 +01:00
Bernd Bestel
e7491fd8d1 Restored missing trigger after products table reorg (references #801) 2020-11-11 21:44:03 +01:00
Bernd Bestel
0245a925b7 Make it possible to hide columns (closes #1058)
Hide new overview page columns by default
2020-11-11 21:11:17 +01:00
Bernd Bestel
b15740bded Fixed dropdown menu in tables overflow 2020-11-11 20:14:16 +01:00
Bernd Bestel
e3ab943fe7 Use the custom-file-pickers also for the new file and image userfields 2020-11-11 18:49:08 +01:00
Bernd Bestel
9c81fc890b Simplified "checkboxUncheckedValue" handling 2020-11-11 17:34:37 +01:00
Bernd Bestel
9949f30c2b Unify hint texts 2020-11-10 22:01:23 +01:00
Bernd Bestel
06f345324f Fied wrong/missing product picker hint on product edit page 2020-11-10 21:59:19 +01:00
Bernd Bestel
8c8a51c06e Typo 2020-11-10 21:51:45 +01:00
Bernd Bestel
d816be6908 Use the proper plural QU form in productamountpicker 2020-11-10 21:41:12 +01:00
Bernd Bestel
d863e33343 Made the sidebar items a little smaller 2020-11-10 21:35:01 +01:00
Bernd Bestel
7f600bd8d9 Don't add the destination QU multiple time in productamountpicker 2020-11-10 21:19:51 +01:00
Bernd Bestel
4959e9e732 Fixed purchase page initial amount validation 2020-11-10 21:19:28 +01:00
Bernd Bestel
3831cb37b3 Fixed DateTimePicker2 contextual time 2020-11-10 20:57:49 +01:00
Bernd Bestel
0c17666cef Fixed default consume/purchase amount behaviour 2020-11-10 20:53:16 +01:00
Bernd Bestel
8c54131921 Fix is_aggregated_amount of stock_current did not work anymore 2020-11-10 20:11:43 +01:00
Bernd Bestel
62e8d88adb Reviewed changelog 2020-11-10 18:50:04 +01:00
Bernd Bestel
5d4aab063f Removed unused localization strings 2020-11-10 18:17:28 +01:00
Bernd Bestel
68eeb07e5f Test/review/rework (and hopefully finalized) new price handling 2020-11-10 18:11:33 +01:00
Bernd Bestel
33a6a28208 Also use the productamountpicker on the shopping list item page (refernces #1015) 2020-11-09 22:15:25 +01:00
Bernd Bestel
8400175f1d Improved productamountpicker stock amount display 2020-11-09 21:55:49 +01:00
Bernd Bestel
b6f4cfa851 Also use the productamountpicker for inventory (refernces #1015) 2020-11-09 21:51:55 +01:00
Bernd Bestel
ad3b91ef98 Improved form spacing 2020-11-09 21:30:22 +01:00
Bernd Bestel
44eb74ca52 Updated changelog 2020-11-09 19:28:58 +01:00
Bernd Bestel
8bd157ca9d Use producamountpicker "everywhere" (closes #1015) 2020-11-09 19:25:46 +01:00
Bernd Bestel
5f920e2cc6 Start product picker workflows also by TAB 2020-11-08 22:36:55 +01:00
Bernd Bestel
40283609b5 Product / QU form refinements 2020-11-08 22:13:36 +01:00
Bernd Bestel
4c399392eb Fixed recipes page when there are no recipes 2020-11-08 21:44:39 +01:00
Bernd Bestel
0134535a5e Fix/workaround for undfined constant GROCY_LOCALE 2020-11-08 21:37:43 +01:00
Bernd Bestel
ea5b3dcd51 UI test/review 2020-11-08 19:51:56 +01:00
Bernd Bestel
3e3321bf11 UI test/review 2020-11-08 19:00:12 +01:00
Bernd Bestel
d82fd09fba UI test/review 2020-11-08 15:09:10 +01:00
Bernd Bestel
7d237867b5 Updated changelog about the new clear filter button 2020-11-07 15:01:10 +01:00
Bernd Bestel
7324c14516 Added changelog for #1115 2020-11-07 14:59:09 +01:00
4lloyd
76cbf796b6 [WIP] Simplified overviews on mobile (#1115)
* Simplified stock overview on mobile.

* Stock table horizontally scrollable

* Use the new mobile views for all pages (except the shopping list page, use the existing special handling there for now)
And add a clear filter button to all pages

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-11-07 14:53:45 +01:00
Bernd Bestel
9aa9bd1cc7 Typo 2020-10-31 20:25:04 +01:00
Bernd Bestel
ec12b50cde Use GitHub issue templates 2020-10-31 20:23:44 +01:00
Bernd Bestel
2d4db25308 Use GitHub issue templates 2020-10-31 20:18:02 +01:00
Bernd Bestel
7b32d1d8a4 More compact page headers / streamlined new page design for all pages 2020-10-31 18:37:10 +01:00
Bernd Bestel
18617dc9fb Fixed undefined variable warning 2020-10-31 16:29:12 +01:00
Bernd Bestel
eec203700a Added changelog for #1111 2020-10-31 16:26:30 +01:00
kriddles
de85cb9e04 limit to normal recipes (#1111) 2020-10-31 16:25:33 +01:00
kriddles
cb3978cdbd AddProduct Fix (#1110) 2020-10-31 16:24:49 +01:00
Bernd Bestel
fca4b3bb10 Added changelog for #1109 2020-10-31 16:22:51 +01:00
Benoit Anastay
5303952be1 Unit stock name in the mealplan (#1109)
Stock name instead of purchase name
2020-10-31 16:15:26 +01:00
kriddles
af0a7dc2be delete double (#1108) 2020-10-29 21:37:54 +01:00
Bernd Bestel
7d175563ca Fixed stock overview status filter (fixes #1080) 2020-10-29 17:32:21 +01:00
Bernd Bestel
351e236353 Fixed initial state of user permission checkbox tree (fixes #1099) 2020-10-29 17:19:48 +01:00
Bernd Bestel
286c326768 Added missing localization string 2020-10-29 17:11:49 +01:00
Bernd Bestel
fb032ef721 Added changelog for #1103 2020-10-29 17:11:24 +01:00
kriddles
64a2f5b25e dialogs for shopping list (#1103) 2020-10-29 17:09:35 +01:00
Bernd Bestel
1563870021 Added changelog for #1102 2020-10-29 17:05:29 +01:00
kriddles
9bbcdafab9 Add purchased date to inventory (#1102)
* Add purchased date to inventory

* Clarify stock settings label

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-10-29 17:04:34 +01:00
kriddles
fb17c57dd3 inventory fix for quFactorPurchaseToStock - defaults to product details (#1081) 2020-10-26 10:10:10 +01:00
fipwmaqzufheoxq92ebc
7ef9ffe041 Fixes #1092: Repair QR-Codes for API-Keys (#1093) 2020-10-25 08:42:58 +01:00
Bernd Bestel
be18d59735 Fixed minimum for two number inputs (fixes 1083#) 2020-10-21 18:14:24 +02:00
Bernd Bestel
31fcdf377a Implemented LDAP authentication support (closes #305) 2020-10-20 21:43:58 +02:00
Bernd Bestel
def61eee6e Typo 2020-10-20 20:38:19 +02:00
Bernd Bestel
45236b2af2 Added changelog/new translation strings for #1078 and #1079 2020-10-20 20:16:57 +02:00
kriddles
ff254f8db2 stock entries button on product card (#1079) 2020-10-20 20:14:25 +02:00
kriddles
57aa6499eb display productCard when clicking item on shopping list (#1078) 2020-10-20 20:14:11 +02:00
Bernd Bestel
438cc08b98 Added changelog/new translation strings for #1077 2020-10-20 20:12:04 +02:00
kriddles
46e8123477 Allow price up to 4 decimals instead of 2 (#1077)
* Allow price to be 4 decimals

* remove logging

* Finalize custom decimal places by user setting

* Typo

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-10-20 20:08:54 +02:00
Bernd Bestel
9e982979c3 Allow 4 decimals for all amount inputs (this now closes #998) 2020-10-19 20:25:42 +02:00
Bernd Bestel
80beff2cae Fixed price input decimals, started reviewing all number inputs (fixes #1076, references #998) 2020-10-19 20:03:26 +02:00
Bernd Bestel
6e1e90984f Typo 2020-10-19 18:41:16 +02:00
Bernd Bestel
94214b867a More authentication refactoring to also provide "plugable" credentials handling (references #921, needed for #305) 2020-10-19 18:38:12 +02:00
Bernd Bestel
9f88dd3af3 Fixed login did not work 2020-10-19 17:19:13 +02:00
Bernd Bestel
a2b2f26628 Delete stock_log rows for not existing products in migration 0103 (fixes #1002) 2020-10-18 15:52:52 +02:00
Bernd Bestel
f93261404b Fixed by PHP-CS-Fixer broken formattings 2020-10-18 15:08:09 +02:00
Bernd Bestel
9115645e19 Fixed consuming tare weight handling enabled products on the stock entries page (fixes #988) 2020-10-18 14:51:32 +02:00
Bernd Bestel
196d304de6 Disable opening of tare weight handling enabled products also on the stock entries page (same as for the stock overview page, references #988) 2020-10-18 14:48:21 +02:00
Bernd Bestel
80cf68aeaa Allow no product for shopping list items & always in-/decrement by 1 when using the number input arrow buttons (fixes #964) 2020-10-18 14:27:23 +02:00
Bernd Bestel
7e08224c75 Fixed tooltip/model z-index (fixes #1065) 2020-10-18 14:13:39 +02:00
Bernd Bestel
ccd2caa44c Fixed GetProductIdFromBarcode returned wrong id & use default qu_factor_purchase_to_stock when not provided when adding products to stock (fixes #1068) 2020-10-18 14:09:54 +02:00
kriddles
f7a1634442 typo (#1062) 2020-10-18 13:57:10 +02:00
John M. Harris, Jr
2958ccfc14 Fix night mode (#1067)
This fixes a few lines of white when in night mode.

This change was done from a tablet, I can redo this commit properly on a computer when I get back home if needed. This just really annoyed me ;)
2020-10-18 13:54:33 +02:00
Bernd Bestel
ab1611081e Typo 2020-10-17 11:25:56 +02:00
Bernd Bestel
5ed7a0ca53 Don't strip boolean values (references #996, fixes #1055) 2020-10-17 11:15:31 +02:00
Bernd Bestel
e24f3143b5 Changelog/little naming changes/fixes/new translations strings for #1056 2020-10-17 11:03:47 +02:00
kriddles
cd65195532 add purchased date to purchase (#1056) 2020-10-17 10:54:10 +02:00
Bernd Bestel
235b96d17f Fixed recipe ingredient initial QU (fixes #1060) 2020-10-17 10:52:25 +02:00
kriddles
758a8d9708 fix for price and total price (#1057)
* fix for price and total price

* product card clarity
2020-10-15 19:55:58 +02:00
Bernd Bestel
17d296d173 Added changelog for #1045 2020-10-15 19:48:25 +02:00
kriddles
5ae36e6ba8 Value information (#1045)
* viewjs stockoverview: add total value to stock overview

* view stockoverview.blade: add Value column

* refresh stockOverview value column

* Removed the total units info

* Properly format the total stock value number

* Added new localization strings

* Resolved merge conflict

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-10-15 19:46:27 +02:00
Bernd Bestel
56d79d7db8 Added changelog for #996 2020-10-14 23:11:00 +02:00
kriddles
96c6faf208 fix expiring filter (#1051) 2020-10-14 22:59:58 +02:00
Bernd Bestel
08644f95bf Revert "Excape HTML (where needed, for bootbox) (references #996)"
This reverts commit 0df2590de2.

Revert "Excape shopping list item notes (references #996)"

This reverts commit 0624b0df59.
2020-10-14 22:58:26 +02:00
Bernd Bestel
c11001467b Sanitize user input on all API routes (references #996) 2020-10-14 22:49:29 +02:00
Bernd Bestel
7b8438bfa2 Added new localization strings for #1049 2020-10-14 18:03:49 +02:00
Bernd Bestel
1420952f29 Added changelog for #1049 2020-10-14 18:03:27 +02:00
fipwmaqzufheoxq92ebc
a85998dd40 Improvements (#1049)
* Fixes #1035: Check available amount after filtering by stock_entry_id

* Fixes #1036: Remove stock-related buttons/options from Shopping-list  if FEATURE_FLAG_STOCK is disabled

* Fixes #1010: Repair recipe-picture upload.

* Fixes #958: Disable auto-reload of equipments-page.

* Fix uncaught exception in locationpicker.js

* Fixes #761 and #762: Add "Remove exact amount" for products with tare weight handling and use it for recipe-consumption.

* Fixes #1048: Repair product-group-filter on "Master Data"/Products

* Renamed variable

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-10-14 17:48:37 +02:00
Bernd Bestel
a66a4d0c22 Fix missing property warnings (references #1025) 2020-10-12 17:50:33 +02:00
Bernd Bestel
e91bc0b01b Revert "Make sure that the view products_last_purchased always returns a row per product, also for not in stock items (references #801)"
This reverts commit 0a3e85dab4.

Revert "Make sure that the views products_average_price and products_oldest_stock_unit_price always returns a row per product, also for not in stock items (references #801)"

This reverts commit 939b98e470.
2020-10-12 17:31:38 +02:00
Bernd Bestel
9c92ec4748 Added changelog for #1026 2020-10-04 15:25:18 +02:00
Bernd Bestel
e60ef77b7b Applied formatting rules for by #1026 changed files 2020-10-04 15:22:51 +02:00
SourceFactory.at
617b25bda8 added button to add expired products to shoppinglist (#1026)
* added button to add expired products to shoppinglist

* Localizations are managed via Transifex

Revert "added button to add expired products to shoppinglist"

This reverts commit ad1ab5d6a0.

* Revert unnecessary change

* Reuse existing function (GetExpiringProducts) to get expired products

Co-authored-by: Mario Klug <mario.klug@sourcefactory.at>
Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-10-04 15:20:34 +02:00
Bernd Bestel
49588508bb Added changelog for #1018 2020-10-04 15:03:27 +02:00
Bernd Bestel
931e4b7e9a Applied formatting rules for by #1018 changed files 2020-10-04 15:02:08 +02:00
fipwmaqzufheoxq92ebc
b03e43b708 Ui fixes (#1018)
* Fixes #1005. Recipes: filter by stock-status in gallery

* Fixes #1017. Productform: Remove "Store"-Header from barcode-table if FEATURE_FLAG_STOCK_PRICE_TRACKING is not set.

* Fixed typo

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-10-04 15:00:34 +02:00
Bernd Bestel
4b5b7bcb19 Applied formatting rules for by #1000 changed files 2020-09-14 11:20:29 +02:00
Bernd Bestel
64c050fc0d Added changelog for #1000 2020-09-14 11:16:44 +02:00
fipwmaqzufheoxq92ebc
5056ca9397 Some bug fixes. (#1000)
* Fix #997. Remove datetimepicker if FEATURE_FLAG_STOCK_BEST_BEFORE_DATE is not set.

* datetimepicker: Fix that SetValue did not set the value if "shortcut-checkbox" (e.g. "never expires") was checked.

* Use parent div as clickable area for checkboxes in dropdowns

* Fix nightmode-enable

* Fix possibly undefined variables in CalendarService.php

* Fix undefined variable in GenericEntityApiController.php

* Fix "Trying to access property barcodes on non-object" in productpicker

* Fix undefined "hintId" in shoppinglocationpicker

* Fix undefined variables in locationpicker.blade.php
2020-09-14 11:15:11 +02:00
Bernd Bestel
0624b0df59 Excape shopping list item notes (references #996) 2020-09-08 18:25:42 +02:00
Bernd Bestel
0df2590de2 Excape HTML (where needed, for bootbox) (references #996) 2020-09-08 18:10:30 +02:00
Bernd Bestel
22434c85f0 Applied formatting rules for by #995 changed files 2020-09-08 17:52:35 +02:00
Bernd Bestel
61cfddb1e7 Added changelog for #995 2020-09-08 17:50:49 +02:00
Maximilian Bosch
34ffdb2b4b Adds a few small frontend fixes (#995)
* Add a few instructions to the readme on how to get `grocy` running locally

* Fix toggle for header-clock

I'm not 100% sure why, but with this change, the listener which calls
`CheckHeaderClockEnabled` will be invoked *before* the listener which
persists the setting.

If the setting is persisted before that, the clock doesn't show up when
enabling it in the settings-menu and appears/disappears in the exact
opposite way the setting is true/false.

* Allow replacing a product picture when removing it at first

Right now, a preview image of a product doesn't get updated when
pressing the delete-button at first and adding a new image the
upload-form which can be quite confusing for an end-user.

This patch allows to delete an image and add a new one in one go.

* Add `Save & return` button to product form

Same concept as for recipes: when pressing this button, the user will
stay at the form's site after saving.

* Removed unneeded class

* Revert "Add a few instructions to the readme on how to get `grocy` running locally"

This reverts commit 6ffad1d3c7.

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-09-08 17:46:37 +02:00
Bernd Bestel
38bb205a55 Fixed error when starting fresh / without existing database file (references #976) 2020-09-07 08:32:04 +02:00
Bernd Bestel
5b05254816 Fixed iCal sharing API route was always unauthenticated (fixes #993, references #921) 2020-09-07 08:30:08 +02:00
Bernd Bestel
3f1135713a Fixed string concat (fixes #994, references #985) 2020-09-07 08:16:05 +02:00
Bernd Bestel
6adac0588a Applied formatting rules for by #989 changed files 2020-09-06 13:31:54 +02:00
Bernd Bestel
f68e96a235 Added changelog for #989 2020-09-06 13:26:36 +02:00
fipwmaqzufheoxq92ebc
0454c128f0 Stock-Journal: API, Summary, Done By (#989)
* Stockjournal: Add "Done by"

* Add API for Stock-Journal

* Add "Journal-Summary"

* Use ALTER TABLE

* Moved the "Jounral summary" button to the stock journal page

* Changed icon & context menu position for new stock journal summary page

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-09-06 13:18:51 +02:00
Bernd Bestel
7498d8f13d Applied formatting rules for by #986 changed files 2020-09-06 10:10:30 +02:00
Bernd Bestel
d0a7756a67 Added changelog for #986 2020-09-06 10:08:08 +02:00
fipwmaqzufheoxq92ebc
85a95f1973 Apikeys (#986)
* Add QR-Code for API-Url/Key

* Show only API-Keys for current user

* Allow only admin users to create custom API-Keys

* Use a managed package of qrcode-generator instead of a copy of the JS file

* Reuse existing localization string (API key)

* Center QR-Code in popups

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-09-06 10:00:49 +02:00
dependabot[bot]
40f379b761 Bump bl from 4.0.2 to 4.0.3 (#987)
Bumps [bl](https://github.com/rvagg/bl) from 4.0.2 to 4.0.3.
- [Release notes](https://github.com/rvagg/bl/releases)
- [Commits](https://github.com/rvagg/bl/compare/v4.0.2...v4.0.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-09-03 15:57:12 +02:00
Bernd Bestel
836bcc82e5 Applied PHP-CS-Fixer rules 2020-09-01 21:29:47 +02:00
Bernd Bestel
3da8904cba Switch to use PHP-CS-Fixer to format PHP files 2020-09-01 21:22:50 +02:00
Bernd Bestel
0ed1813bee Added changelog for #985 2020-09-01 20:17:23 +02:00
fipwmaqzufheoxq92ebc
32a4f81f62 Filtering of API-Results (#985)
* Add FilteredApiResponse

* Use FilteredApiResponse for Generic-Entity-Search

* Use FilteredApiResponse for Recipe-Fullfillment

* Use FilteredApiResponse for GetUsers

* Use FilteredApiResponse for current Tasks

* Use FilteredApiResponse for ProductStockEntries & ProductStockLocations

* Use FilteredApiResponse for current chores

* Use FilteredApiResponse for batteries-current

* Fix missing highlighting of "< X days"

* Keep to use existing views

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-09-01 19:59:40 +02:00
Bernd Bestel
60f3d900e8 Display "Track date only"-chores as all-day also in iCal API endpoint (references #941) 2020-09-01 19:32:28 +02:00
Bernd Bestel
2bc3b53c63 Remove phpfmt again, doesn't really work well... 2020-09-01 19:27:37 +02:00
Bernd Bestel
ae590fa910 Also return Userfields for Userobjects (endpoint /objects/{entity}) (fixes #979) 2020-08-31 22:32:56 +02:00
Bernd Bestel
ad4f8a19af Removed the barcodes column from the products list as we don't have that field there anymore 2020-08-31 22:13:02 +02:00
Bernd Bestel
d4c5da2173 Applied PHP formatting rules 2020-08-31 20:40:31 +02:00
Bernd Bestel
33325d5560 Applied .blade.php formatting rules 2020-08-31 20:32:50 +02:00
Bernd Bestel
ea9ba0b2be Typo 2020-08-31 20:21:46 +02:00
Bernd Bestel
7e2574eb73 Added changelog for #977 2020-08-31 20:12:28 +02:00
fipwmaqzufheoxq92ebc
07beee93a9 Add user-field-type "file" (#977)
* Add user-field-type "file"

* Add userfield-type "picture"

* Also limit image height on userfieldsform

* Prevent empty userfields (cause warnings in tables after deleting a file)

* Show files in dialogs

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-08-31 20:07:46 +02:00
Bernd Bestel
318db53818 Typo 2020-08-31 19:22:08 +02:00
Bernd Bestel
a995ce0538 Added changelog for #976 2020-08-31 19:19:05 +02:00
fipwmaqzufheoxq92ebc
6f8ad9b76e Locales: use http-accept-language or cookie (#976)
* Locales: use http-accept-language or "language"-cookie

* Add user-setting "locale"

Rename CULTURE to DEFAULT_LOCALE

* Use LocaleMiddleware also in dev mode

* CORS: don't require authentication on OPTIONS

* Use a standard user-settings-control and start a new generic user settings page, not a separate page for the locale setting

* Fixed (broken by myself) link-return handling

* Clarify language settings

* Removed unneeded files

* Better user settings icon

* Added localization hints

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-08-31 19:11:51 +02:00
Bernd Bestel
4a030b7ffc Added editor.insertSpaces setting 2020-08-31 08:50:55 +02:00
Bernd Bestel
5c101e6750 Use phpfmt to format .php files 2020-08-30 22:52:35 +02:00
Bernd Bestel
2f00d673a7 Also format .blade.php files by default VSCode formatting rules 2020-08-30 22:08:17 +02:00
Bernd Bestel
9cea0c77cd Applied VSCode JS formatting settings 2020-08-30 12:18:16 +02:00
Bernd Bestel
e0e3212f13 Added VSCode JS formatting settings 2020-08-30 12:16:23 +02:00
Bernd Bestel
747660d909 Return API exceptions with proper content type 2020-08-29 19:29:24 +02:00
Bernd Bestel
e93f58916e Forgot some entries in permission_hierarchy... 2020-08-29 19:24:19 +02:00
fipwmaqzufheoxq92ebc
17094f56eb Run database-Migrations in right order (#973) 2020-08-29 19:15:02 +02:00
Bernd Bestel
0f499c69d9 Fixed .pot file syntax error 2020-08-29 18:34:05 +02:00
Bernd Bestel
86300b7025 Refined permissions by existing feature structure (closes #971, references #960) 2020-08-29 18:31:28 +02:00
Bernd Bestel
a8395cb748 Fixed undefined constants warning on the 404 error page 2020-08-29 17:12:31 +02:00
Bernd Bestel
22384aaa2e Error page style improvements 2020-08-29 16:58:06 +02:00
Bernd Bestel
3b0d29bed0 Applied EditorConfig settings to all files 2020-08-29 16:41:27 +02:00
Bernd Bestel
2c966c77fd Added an EditorConfig file 2020-08-29 16:10:05 +02:00
kriddles
22ca427ca9 Include location and shopping_location_id when opening products (#965) 2020-08-29 12:26:36 +02:00
Bernd Bestel
32cd928460 Added changelog for #960 2020-08-29 12:22:53 +02:00
fipwmaqzufheoxq92ebc
b7d1b21f1d [WIP] Implemented basic permissions (#960)
* Add permissions to Database & add "User"-classes

* Add UI & API for Permissions, protect "User"-(Api)-Controller with new permissions.

* Add some permissions.

* Add permission localization

* Add error handling.

* Error pages: only redirect on 404

* ExceptionController: return JSON-Response on api-routes

* Rename PRODUCT_ADD to PRODUCT_PURCHASE

* Move translation to new file

* Fix checkboxes stay selected on reload.

* Remove configurable User-implementation

* Remove MASTER_DATA_READ

* Disable buttons the user isn't allowed to use.

* Add default permissions for new users

* When migration to permissions, everyone starts as ADMIN

* Permission-Localization: add to transifex & LocalizationService

* Review

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-08-29 12:05:32 +02:00
Bernd Bestel
f28697e5b4 Added a "Clear filter" button on the stock overview page (closes #879) 2020-08-25 20:20:51 +02:00
Bernd Bestel
0417b73cb5 Show if a consume booking was spoiled on the stock journal page (closes #953) 2020-08-25 19:51:54 +02:00
Bernd Bestel
71a6cbef2d First try on stock overview page: Make filter row more compact 2020-08-25 19:45:54 +02:00
Bernd Bestel
471a8665d0 Remove the new help icons where not needed and translate help text 2020-08-25 19:28:44 +02:00
Bernd Bestel
4058925f40 Handle edited stock entries in GetProductPriceHistory (fixes #913) 2020-08-25 19:09:47 +02:00
Bernd Bestel
0b98504371 Don't hide the product row on the stock overview page if there are still child products in stock 2020-08-25 18:15:34 +02:00
Bernd Bestel
4db373b272 Fixed parent product amount aggregation (fixes #878) 2020-08-25 18:13:26 +02:00
Bernd Bestel
3b564294e3 Allow decimal amounts in general for the shopping list 2020-08-24 20:25:50 +02:00
Bernd Bestel
ece880ea44 Don't round up missing amounts and allow decimal numbers (fixes #758) 2020-08-24 20:16:21 +02:00
Bernd Bestel
9d04d81744 Use correct amount for the success popup on the consume page (fixes #766) 2020-08-24 19:06:33 +02:00
Bernd Bestel
5c62377ba6 Don't trigger row select event on first column (fixes #791) 2020-08-24 18:42:32 +02:00
Bernd Bestel
a569048a3a Validate form after changing the QU on the recipe ingredient edit page (fixes #907) 2020-08-24 18:32:50 +02:00
Bernd Bestel
95ca6f6354 Display "Track date only"-chores as all-day events on the calendar (fixes #941) 2020-08-24 18:27:40 +02:00
Bernd Bestel
c8c540970d Added missing localization string 2020-08-24 18:16:49 +02:00
Bernd Bestel
fa32258553 Only reload "Disable stock fulfillment checking for this ingredient" by the products default when creating a recipe ingredient (fixes #910) 2020-08-24 18:16:32 +02:00
Bernd Bestel
4d38614671 Reload recipe page after add/edit an ingredient (fixes #803) 2020-08-24 18:02:46 +02:00
Bernd Bestel
2c151fb4de Do an exact search for product group and location filters on the stock overview pages (fixes #778) 2020-08-24 17:57:43 +02:00
Bernd Bestel
e039db22f5 Don't prefill for empty prices when editing a stock entry (fixes #961) 2020-08-24 17:42:41 +02:00
Bernd Bestel
a6db08943c Streamline naming 2020-08-22 19:09:36 +02:00
Bernd Bestel
e3ff16c66a Downgrade animate.css, upgrade to v4 needs customizations 2020-08-22 18:25:59 +02:00
Bernd Bestel
fdb419fe55 Fixed errors while populating demo data 2020-08-22 17:59:42 +02:00
Bernd Bestel
0a3e85dab4 Make sure that the view products_last_purchased always returns a row per product, also for not in stock items (references #801)
Otherwise there are errors when getting product details for currently not in stock items...
2020-08-22 17:50:08 +02:00
Bernd Bestel
939b98e470 Make sure that the views products_average_price and products_oldest_stock_unit_price always returns a row per product, also for not in stock items (references #801)
Otherwise there are errors when getting product details for currently not in stock items...
2020-08-22 10:06:37 +02:00
Bernd Bestel
ffec1134a3 Added changelog for #959 2020-08-22 10:05:10 +02:00
fipwmaqzufheoxq92ebc
923e027a4b Some bug fixes. (#959)
* Fixes #956. Return 404 for missing objects in GenericEntityApiController.php

* Fixes #936 and #943. Include Products that expire today in /stock/volatile and "Expiring soon"-sum on stockoverview

* Fixes #881. Remove items of deleted shopping lists.

* Fixes #875. Prevent infinite nested recipes.

* Review

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-08-22 09:58:25 +02:00
Bernd Bestel
cf9bb87f6e Upgraded to Quagga2 (again) (closes #799, also references #844) 2020-08-19 20:04:17 +02:00
Bernd Bestel
04bbad2167 Added changelog for #844 2020-08-19 19:56:24 +02:00
Andre Monteiro
b8cd5cd0b5 Additional configuration options for Quagga2 (#844) 2020-08-19 19:52:04 +02:00
Bernd Bestel
2cd3779d82 Added changelog for #855 2020-08-19 19:49:32 +02:00
Michał Przybyś
f8c6e81dcb Fix grocy/grocy#834 (#855)
* Fix grocy/grocy#834

* stock_missing_products_including_opened didn't take the opened amount in HAVING clauses

* Resolved merge conflicts

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-08-19 19:46:25 +02:00
Bernd Bestel
31c412a28c Typo 2020-08-19 19:31:52 +02:00
Bernd Bestel
41359137dc Added changelog for #921 2020-08-19 19:29:39 +02:00
fipwmaqzufheoxq92ebc
d60d981fd1 Refactor Authentication and add proxy-authentication (#921)
* Refactor Authentication-Middlewares

* Add Proxy-Authentication

* Disable "Logout" & "Manage Users" when using ProxyAuth

* Review

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-08-19 19:23:13 +02:00
Bernd Bestel
5b475d9307 Added changelog for #876 2020-08-18 19:46:38 +02:00
Matthias B
88949dc3e4 Make product amount picker locale independent (#876)
Since the value of $('#amount') will be written to the database it should not be locale dependent. This code also limits the result to a maximum of 4 digits but always uses a dot as decimal separator.
2020-08-18 19:43:50 +02:00
Bernd Bestel
e4d0978f5d Merge branch 'master' of https://github.com/grocy/grocy 2020-08-18 19:37:10 +02:00
Bernd Bestel
f88401a44a Added changelog for #933 2020-08-18 19:36:45 +02:00
fipwmaqzufheoxq92ebc
e7af74f550 use last Chore-Log when determining the next assigned person (#933) 2020-08-18 19:34:19 +02:00
Bernd Bestel
295f360306 Added changelog for #927 2020-08-18 19:30:00 +02:00
fipwmaqzufheoxq92ebc
42dc55625a Improve Performance (#927)
* Stock-Overview: Reduce amount of database queries and FindObjectInArray()-calls

* Speed-up stock_current by improving products_resolved and creating indices.

* Review

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-08-18 19:23:37 +02:00
Bernd Bestel
7510c677f1 Added changelog for #880 2020-08-18 18:30:35 +02:00
duck
7e276289e0 WIP: Fix typo on "Consumed Amount" localization string (#880)
* Fix typo on localization string in strings.pot

Should be "Consumed Amount"

* Remove typo Consumed Amount string in locationcontentsheet template
2020-08-18 18:28:39 +02:00
Bernd Bestel
273811fdc1 Updated dependencies 2020-08-18 18:27:58 +02:00
Bernd Bestel
a93a3e1df1 Added changelog for #939 2020-08-18 18:15:50 +02:00
Stefan Haller
623fce6c08 Run multi instances by making GROCY_DATAPATH customizable (#939)
Previously the data directory was fixed to the GROCY_DATAPATH constant.

This commit allows overriding the default GROCY_DATAPATH location by the
FastCGI parameter `GROCY_DATAPATH`. Relative paths are modified and get
rooted at the top level grocy installation directory.

The previous behaviour is preserved in case the new parameter is absent.

The following example nginx config snippet shows how to run multiple
instances.

```nginx
server {
    location /instance1/ {
        alias /var/www/grocy/;
        set $instance instance1;
        try_files $uri @grocy;
    }

    location /instane2/ {
        alias /var/www/grocy/;
        set $instance instance2;
        try_files $uri @grocy;
    }

    location @grocy {
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME index.php;
        fastcgi_param GROCY_DATAPATH data/$instance;
    }
}
```
2020-08-18 18:10:26 +02:00
Bernd Bestel
68dcd02d00 Revert "Fix base path computation when running in subdirectory (#945)" (#954)
This reverts commit 6cd874f3ba.
2020-08-18 18:01:50 +02:00
Stefan Haller
6cd874f3ba Fix base path computation when running in subdirectory (#945) 2020-08-18 17:57:35 +02:00
Bernd Bestel
b6b6f903ab Added more changelog for #801 2020-08-18 11:49:25 +02:00
Bernd Bestel
144ca094e6 Typo 2020-08-17 22:13:53 +02:00
Bernd Bestel
da05cbffc0 Added changelog for #801 2020-08-17 22:12:39 +02:00
kriddles
e8845fe2e8 Qu factor purchase to stock & Product Barcode Details (#801)
* Puchase add qu_factor_to_stock

* qu_factor_purchase_to_stock for stock edit

* product barcodes with QU and Stores

* remove product barcode tags

* migrations/0103 add value and factor_puchase_amount to stock_current and stock_current_location_content

* Remove unused method

* StockService#GetProductDetails: include stock_value

* productcard: include stock_value

* Add Purchase Factor to Stock Overview

* update demo data with stock qu_factor_purchase_to_stock

* recipes_pos_resolved update

* avg_price and oldest_price in product details

* add average price to product card

* hint for recipe costs not included if not in stock

* Round value and factor_purchas_amount. Include currency for stock value

* Add factor_purchase_amount to product card stock amount

* Allow editing qu_factor_purchase_to_stock for stock entries

* fix update qu_factor_purchase_to_stock for Transfers

* Add barcode to existing product update to add to product_barcodes table

* Add barcode to new product workflow update to add to product_barcodes table

* *** Price now saved as 1 QU to stock in stock tables ***

* remove column product barcode and use product_barcodes

* Allow products to be deactivated instead of deleted

* Embedded barcode and qu-conversion with page reload on change

* Save current product barcode into new product_barcodes table

* Embedded popup for product group add/edit

* barcode scanner added to product barcodes input

* Edit product qu_stock is unavailable after first purchase

* StockOverview: Filters break when columns are reordered so for now just disable colReorder

* view stockoverview.blade: display product_group column

* Review

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-08-17 21:47:33 +02:00
Bernd Bestel
d1e395b45e Added the Korean translation (closes #903) 2020-08-17 18:22:42 +02:00
Bernd Bestel
7f461bfa51 Added the Greek translation (closes #952) 2020-08-17 18:07:05 +02:00
Bernd Bestel
cadf61d641 Pulled translations from Transifex 2020-08-17 17:57:40 +02:00
Bernd Bestel
f6852e82b2 Website link has changed (references grocy/grocy-website#15) 2020-07-28 20:15:42 +02:00
Bernd Bestel
98f214e9f1 Added changelog for #826 2020-05-03 20:28:04 +02:00
Germs2004
f25902214f Change ellipsis to dash (#826)
An ellipsis in software often implies that the element is clickable to get more information.  Changing that to a simple dash symbol makes it more clear that the value is simply undefined and is not a clickable element.
2020-05-03 20:25:27 +02:00
Bernd Bestel
1e07a2dc2e Added changelog for #806 2020-04-29 19:55:56 +02:00
Marc Ole Bulling
a9dc5deaaa Added SQLite check for #805 (#806)
* Added SQLite check

* Moved check behind Extensions check

* Changed to SqlitePDO
2020-04-29 19:54:05 +02:00
Shadow
86b7cfed29 Fixed (#802)
Reordered days for better readability.
2020-04-27 18:11:32 +02:00
Bernd Bestel
fc9e2927f9 Added changelog for #796 2020-04-26 17:30:21 +02:00
kriddles
45c14723b0 Fix Product Shopping Location Prefill for Edits (#796) 2020-04-26 17:28:02 +02:00
Bernd Bestel
d72fd565ca Changelog and little adjustments for #800 2020-04-26 17:26:32 +02:00
Shadow
6c3c2d5384 #570 Added fix for weekly chores with multiple days (#800) 2020-04-26 17:14:54 +02:00
Bernd Bestel
37054475c2 Little adjustments and changelog for #795 2020-04-24 18:06:57 +02:00
Bernd Bestel
9e824e1845 Little adjustments and changelog for #788 2020-04-24 17:51:48 +02:00
Zack Arnett
f076b0d0c6 Recipe updates (#795) 2020-04-24 17:41:57 +02:00
kriddles
385e7287fe Create Inverse QU Conversions (#788) 2020-04-24 17:41:50 +02:00
Bernd Bestel
60f321d9c2 Added changelog for #793 2020-04-23 20:51:34 +02:00
Marc Ole Bulling
49e5eda30f Make GetUriParam work with special characters (eg. "&") (#793) 2020-04-23 20:48:48 +02:00
Bernd Bestel
5833bb1e8f Added changelog for #784 2020-04-22 18:05:05 +02:00
Zack Arnett
29b4672346 Link to respective page on Calendar Event Click (#784)
* Link to Page on calendar event click

* Undo my Prettier Changes.. Oops
2020-04-22 18:03:05 +02:00
Bernd Bestel
fbb8999513 Fixes and changelog for #767 2020-04-22 18:00:25 +02:00
Bernd Bestel
1ea26cadcc Merge branch 'master' of https://github.com/grocy/grocy 2020-04-22 17:38:37 +02:00
kriddles
9a921cfc86 Purchase Price Hints (#767)
* productcard update last price with per qu purchase name

* Purchase price hints

* purchase set default to 2999-12-31 if not best before date tracking

* purchase- move amount above best buy date and focus amount after product selection
2020-04-22 17:38:24 +02:00
Bernd Bestel
16b9e2c30a Return Access-Control-Allow-Origin for all API (content) requests (references #681) 2020-04-22 17:36:20 +02:00
Bernd Bestel
5e6a9dd443 Return status code 204 for CORS OPTIONS requests (references #681) 2020-04-21 21:15:45 +02:00
Bernd Bestel
53a0a2f4e1 Also allow just all headers and request methods for CORS OPTIONS requests (references #681) 2020-04-21 21:09:49 +02:00
Bernd Bestel
98f2276e17 Send just * for Access-Control-Allow-Origin header in CORS OPTIONS requests (again closes #681) 2020-04-21 21:05:32 +02:00
Zack Arnett
7fb76df33a Recipe Pages UI updates (#776)
* Recipe updates

* Add help text icon
2020-04-21 08:18:09 +02:00
Bernd Bestel
f4b70e9ae3 Fixed product edit page barcodes field tab handling (fixes #764) 2020-04-19 15:01:58 +02:00
Bernd Bestel
8cbfd5fedb Added changelog for #763 2020-04-19 14:56:29 +02:00
tsia
eb190537e9 Fixed Timezone in CalendarApiController (#763)
`PHP Warning:  DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in /var/www/grocy/controllers/CalendarApiController.php on line 22`
2020-04-19 14:55:08 +02:00
Bernd Bestel
0e2a067e30 Added changelog for #753 2020-04-19 14:53:33 +02:00
Zack Arnett
4629df17b4 Cosmetic Update (#753)
* UI changes

* New (header) style was missing on some pages

* Added/changed new localization strings

* Unify page titles / apply .title class everywhere

* Reduce spacing below page title

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
2020-04-19 14:51:02 +02:00
457 changed files with 54437 additions and 13962 deletions

View File

@@ -10,7 +10,7 @@ for /f "tokens=*" %%a in ('jq .Version versiontemp.json --raw-output') do set ve
del versiontemp.json
del "%releasePath%\grocy_%version%.zip"
7za a -r "%releasePath%\grocy_%version%.zip" "%projectPath%\*" -xr!.* -xr!build.bat -xr!composer.json -xr!composer.lock -xr!package.json -xr!yarn.lock -xr!publication_assets
7za a -r "%releasePath%\grocy_%version%.zip" "%projectPath%\*" -xr!.* -xr!build.bat -xr!composer.json -xr!composer.lock -xr!package.json -xr!yarn.lock
7za a "%releasePath%\grocy_%version%.zip" "%projectPath%\public\.htaccess"
7za rn "%releasePath%\grocy_%version%.zip" .htaccess public\.htaccess
7za d "%releasePath%\grocy_%version%.zip" data\*.* data\storage data\viewcache\*

View File

@@ -1,9 +1,11 @@
pushd ..
tx pull --all --minimum-perc=80
tx pull --all --minimum-perc=70
tx pull --language en_GB
copy /Y localization\en\userfield_types.po localization\en_GB\userfield_types.po
copy /Y localization\en\stock_transaction_types.po localization\en_GB\stock_transaction_types.po
copy /Y localization\en\component_translations.po localization\en_GB\component_translations.po
copy /Y localization\en\chore_period_types.po localization\en_GB\chore_period_types.po
copy /Y localization\en\chore_assignment_types.po localization\en_GB\chore_assignment_types.po
copy /Y localization\en\permissions.po localization\en_GB\permissions.po
copy /Y localization\en\locales.po localization\en_GB\locales.po
popd

View File

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

8
.editorconfig Normal file
View File

@@ -0,0 +1,8 @@
root = true
[*]
indent_style = tab
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

10
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,10 @@
---
name: Bug report
about: If you've found something that does not work, please report it to help improve grocy
title: 'Bug: '
labels: bug, ui-bug
assignees: ''
---
Please describe the bug as detailed as possible, provide the steps how to reproduce it and maybe attach screenshots where useful.

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Question / Help
url: https://www.reddit.com/r/grocy
about: Please use the r/grocy subreddit for general questions / help

View File

@@ -0,0 +1,10 @@
---
name: Feature request
about: Ideas for improvements or new things which you would find useful are always welcome
title: 'Feature request: '
labels: enhancement
assignees: ''
---
Please describe what you would find useful and please also check (by searching open requests here) if that was maybe already requested.

BIN
.github/publication_assets/chores.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
.github/publication_assets/mealplan.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
.github/publication_assets/stock.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

97
.php_cs Normal file
View File

@@ -0,0 +1,97 @@
<?php
return PhpCsFixer\Config::create()
->setRules(array(
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => array('syntax' => 'short'),
'combine_consecutive_unsets' => true,
'method_separation' => true,
'no_multiline_whitespace_before_semicolons' => true,
'single_quote' => true,
'binary_operator_spaces' => array(
'align_double_arrow' => false,
'align_equals' => false,
),
// 'blank_line_after_opening_tag' => true,
// 'blank_line_before_return' => true,
'braces' => array(
'allow_single_line_closure' => true,
'position_after_anonymous_constructs' => 'same',
'position_after_control_structures' => 'next',
'position_after_functions_and_oop_constructs' => 'next',
),
// 'cast_spaces' => true,
// 'class_definition' => array('singleLine' => true),
'concat_space' => array('spacing' => 'one'),
'declare_equal_normalize' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'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_extra_consecutive_blank_lines' => array(
'extra',
'parenthesis_brace_block',
'square_brace_block',
'throw',
'use',
),
'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,
'ternary_operator_spaces' => true,
// 'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true,
))
->setIndent("\t")
->setLineEnding("\n")
;

View File

@@ -42,3 +42,15 @@ file_filter = localization/<lang>/userfield_types.po
source_file = localization/userfield_types.pot
source_lang = en
type = PO
[grocy.permissions]
file_filter = localization/<lang>/permissions.po
source_file = localization/permissions.pot
source_lang = en
type = PO
[grocy.locales]
file_filter = localization/<lang>/locales.po
source_file = localization/locales.pot
source_lang = en
type = PO

16
.vscode/settings.json vendored
View File

@@ -1,3 +1,17 @@
{
"phpserver.relativePath": "public"
"phpserver.relativePath": "public",
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.insertSpaces": false,
"javascript.format.placeOpenBraceOnNewLineForControlBlocks": true,
"javascript.format.placeOpenBraceOnNewLineForFunctions": true,
"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
"javascript.preferences.quoteStyle": "double",
"blade.format.enable": true,
"html.format.wrapAttributes": "force",
"html.format.wrapLineLength": 0,
"php-cs-fixer.formatHtml": true,
"php-cs-fixer.autoFixBySemicolon": true,
"php-cs-fixer.onsave": true,
}

View File

@@ -1,36 +1,47 @@
# grocy
ERP beyond your fridge
<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>
<h5> grocy is a web-based self-hosted groceries & household management solution for your home</h5>
</div>
-----
## Give it a try
- Public demo of the latest stable version (`release` branch) &rarr; [https://demo.grocy.info](https://demo.grocy.info)
- Public demo of the latest pre-release version (`master` branch) &rarr; [https://demo-prerelease.grocy.info](https://demo-prerelease.grocy.info)
- Public demo of the current development version (`master` branch) &rarr; [https://demo-prerelease.grocy.info](https://demo-prerelease.grocy.info)
## Questions / Help / Bug reporting / Feature requests
There is the [r/grocy subreddit](https://www.reddit.com/r/grocy) to connect with other grocy users and getting help.
If you've found something that does not work or if you have an idea for an improvement or new things which you would find useful, feel free to open an issue in the [issue tracker](https://github.com/grocy/grocy/issues) here.
If you've found something that does not work or if you have an idea for an improvement or new things which you would find useful, feel free to open a request on the [issue tracker](https://github.com/grocy/grocy/issues) here.
Please don't send me private messages regarding grocy help. I check the issue tracker and the subreddit pretty much daily, but don't provide grocy support beyond that.
## Community contributions
See the website for a list of community contributed Add-ons / Tools: [https://grocy.info/#addons](https://grocy.info/#addons)
See the website for a list of community contributed Add-ons / Tools: [https://grocy.info/addons](https://grocy.info/addons)
## 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 is a pain to use 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!
## How to install
> Checkout grocy-desktop, if you want to run grocy without 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 ("indows) desktop application.
>
> See https://github.com/grocy/grocy-desktop or directly download the [latest release](https://releases.grocy.info/latest-desktop) - the installation is nothing more than just clicking 2 times "next"...
> Directly download the [latest release](https://releases.grocy.info/latest-desktop) - the installation is nothing more than just clicking 2 times "next".
Just unpack the [latest release](https://releases.grocy.info/latest) on your PHP (SQLite (3.8.3 or higher) extension required, currently only tested with PHP 7.4) enabled webserver (webservers root should point to the `public` directory), copy `config-dist.php` to `data/config.php`, edit it to your needs, ensure that the `data` directory is writable and you're ready to go, (to make it writable, maybe use `chown -R www-data:www-data data/`). Default login is user `admin` with password `admin`, please change the password immediately (see user menu).
See [https://grocy.info/links](https://grocy.info/links) for some installation guides and troubleshooting help.
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
- The webserver root should point to the `public` directory
- 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`)
- SQLite 3.8.3 or higher is required and everything is currently only tested against PHP 7.4
- &rarr; Default login is user `admin` with password `admin`, please change the password immediately (user menu at the top right corner)
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.
If you use nginx as your webserver, please include `try_files $uri /index.php$is_args$query_string;` in your location block.
If, however, your webserver does not support URL rewriting, set `DISABLE_URL_REWRITING` in `data/config.php` (`Setting('DISABLE_URL_REWRITING', true);`).
See the website for further installation guides and troubleshooting help: https://grocy.info/links
## How to run using Docker
See [grocy/grocy-docker](https://github.com/grocy/grocy-docker) or [linuxserver/docker-grocy](https://github.com/linuxserver/docker-grocy) for instructions.
@@ -43,11 +54,13 @@ If you run grocy on Linux, there is also `update.sh` (remember to make the scrip
## Localization
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 at https://www.transifex.com/grocy/grocy, if your language is incomplete or not available yet.
(Language can be changed in `data/config.php`, e. g. `Setting('CULTURE', 'it');`)
(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).
The [pre-release demo](https://demo-prerelease.grocy.info) is available for any translation which is at least 80 % complete and will pull the translations from Transifex 10 minutes past every hour, so you can have a kind of instant preview of your contributed translations. Thank you!
The [pre-release demo](https://demo-prerelease.grocy.info) is available for any translation which is at least 70 % complete and will pull the translations from Transifex 10 minutes past every hour, so you can have a kind of instant preview of your contributed translations. Thank you!
Also any translation which reached a completion level of 80 % will be included in releases.
Also any translation which once reached a completion level of 70 % will be included in releases.
_RTL languages are unfortunately not yet supported._
## Things worth to know
@@ -57,9 +70,9 @@ See the integrated Swagger UI instance on [/api](https://demo.grocy.info/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 [QuaggaJS](https://github.com/serratus/quaggaJS), 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.
_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._
### Input shorthands for date fields
For (productivity) reasons all date (and time) input (and display) fields use the ISO-8601 format regardless of localization.
@@ -70,7 +83,7 @@ The following shorthands are available:
- Example: `20190417` will be converted to `2019-04-17`
- `YYYYMMe` or `YYYYMM+` gets expanded to the end of the given month in the given year in proper notation
- Example: `201807e` will be converted to `2018-07-31`
- `x` gets expanded to `2999-12-31` (which I use for products which never expire)
- `x` gets expanded to `2999-12-31` (which I use for products which are never overdue)
- Down/up arrow keys will increase/decrease the date by 1 day
- Right/left arrow keys will increase/decrease the date by 1 week
- Shift + down/up arrow keys will increase/decrease the date by 1 month
@@ -78,7 +91,7 @@ The following shorthands are available:
### Keyboard shorthands for buttons
Wherever a button contains a bold highlighted letter, this is a shortcut key.
Example: Button "Add as new **p**roduct" can be "pressed" by using the `P` key on your keyboard.
Example: Button "**P** Add as new product" can be "pressed" by using the `P` key on your keyboard.
### Barcode lookup via external services
Products can be directly added to the database via looking them up against external services by a barcode.
@@ -88,6 +101,8 @@ There is no plugin included for any service, see the reference implementation in
### 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._
### 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`)
@@ -109,17 +124,20 @@ Any help is more than appreciated. Feel free to pick any open unassigned issue a
See https://grocy.info/#say-thanks for more ideas if you just want to say thanks.
## Roadmap
There is none. grocy is only my hobby, one I like, but not the only one, and because of that, there are no release dates, no schedules for when anything is ready, it's done when it's done, maybe tomorrow, maybe tomorrow next year, everyone is invited to contribute - I appreciate all ideas and contributions. The progress of a specific bug/enhancement is always tracked in the corresponding issue, at least by commit comment references.
There is none. The progress of a specific bug/enhancement is always tracked in the corresponding issue, at least by commit comment references.
## Screenshots
#### Dashboard
![Dashboard](https://github.com/grocy/grocy/raw/master/publication_assets/dashboard.png "Dashboard")
#### Stock overview
![Stock overview](https://github.com/grocy/grocy/raw/master/.github/publication_assets/stock.png "Stock overview")
#### Purchase - with barcode scan
![Purchase - with barcode scan](https://github.com/grocy/grocy/raw/master/publication_assets/purchase-with-barcode.gif "purchase-with-barcode")
#### Shopping List
![Shopping List](https://github.com/grocy/grocy/raw/master/.github/publication_assets/shoppinglist.png "Shopping List")
#### Consume - with manual search
![Consume - with manual search](https://github.com/grocy/grocy/raw/master/publication_assets/consume.gif "consume")
#### Meal Plan
![Meal Plan](https://github.com/grocy/grocy/raw/master/.github/publication_assets/mealplan.png "Meal Plan")
#### Chores overview
![Chores overview](https://github.com/grocy/grocy/raw/master/.github/publication_assets/chores.png "Chores overview")
## License
The MIT License (MIT)

41
app.php
View File

@@ -1,13 +1,11 @@
<?php
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Grocy\Controllers\LoginController;
use Grocy\Helpers\UrlManager;
use Grocy\Middleware\CorsMiddleware;
use Psr\Container\ContainerInterface as Container;
use Slim\Factory\AppFactory;
use Grocy\Helpers\UrlManager;
use Grocy\Controllers\LoginController;
// Load composer dependencies
require_once __DIR__ . '/vendor/autoload.php';
@@ -19,6 +17,7 @@ require_once __DIR__ . '/config-dist.php'; // For not in own config defined valu
if ((GROCY_MODE === 'dev' || GROCY_MODE === 'demo' || GROCY_MODE === 'prerelease') && !defined('GROCY_USER_ID'))
{
define('GROCY_USER_ID', 1);
define('GROCY_SHOW_AUTH_VIEWS', true);
}
// Definitions for disabled authentication mode
@@ -28,6 +27,8 @@ if (GROCY_DISABLE_AUTH === true)
{
define('GROCY_USER_ID', 1);
}
define('GROCY_SHOW_AUTH_VIEWS', false);
}
// Setup base application
@@ -35,20 +36,13 @@ 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 Slim\Views\Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache');
});
$container->set('LoginControllerInstance', function(Container $container)
{
return new LoginController($container, 'grocy_session');
});
$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';
});
@@ -61,8 +55,23 @@ if (!empty(GROCY_BASE_PATH))
$app->setBasePath(GROCY_BASE_PATH);
}
if (GROCY_MODE === 'production' || GROCY_MODE === 'dev')
{
$app->add(new \Grocy\Middleware\LocaleMiddleware($container));
}
else
{
define('GROCY_LOCALE', GROCY_DEFAULT_LOCALE);
}
$authMiddlewareClass = GROCY_AUTH_CLASS;
$app->add(new $authMiddlewareClass($container, $app->getResponseFactory()));
// Add default middleware
$app->addRoutingMiddleware();
$app->addErrorMiddleware(true, false, false);
$errorMiddleware = $app->addErrorMiddleware(true, false, false);
$errorMiddleware->setDefaultErrorHandler(
new \Grocy\Controllers\ExceptionController($app, $container)
);
$app->add(new CorsMiddleware($app->getResponseFactory()));
$app->run();

View File

@@ -18,7 +18,7 @@
- To a recipe a product can be attached
- This products needs a "Default best before date"
- On using "Consume all ingredients needed by this recipe" and when it has a product attached, one unit of that product (per serving in purchase quantity unit) will be added to stock (with the proper price based on the recipe ingredients)
- (Thanks @kriddles for the intial work on this)
- (Thanks @kriddles for the initial work on this)
### New feature: Freeze/Thaw products
- New product options "Default best before days after freezing/thawing" to set how the best before date should be changed on freezing/thawing

View File

@@ -56,7 +56,7 @@
- Various display/CSS improvements (thanks @Mik-)
- Prerequisites (PHP extensions, critical files/folders) will now be checked and properly reported if there are problems (thanks @Forceu)
- Improved the the overview pages on mobile devices (main column was hidden) (thanks @Mik-)
- The general search field now searches accent insensitive
- The general search field now searches accent insensitive (and table sorting is also accent insensitive)
- Fixed that all number inputs are always prefilled in the browser locale number format
- Optimized the handling of settings provided by `data/settingoverrides` files (thanks @dacto)
- Optimized the update script (`update.sh`) to create the backup tar archive before writing to it (was a problem on Btrfs file systems) (thanks @shane-kerr)

View File

@@ -0,0 +1,271 @@
> ⚠️ The major version bump is due to breaking API changes, please see below if you use the API
### New feature: Use any product related quantity unit anywhere
- Finally it's possible to use any product related quantity unit on any page
- Products still have one quantity unit stock and one (default) quantity unit purchase, but any QU, which has a direct or indirect conversion for that product, can be used to pick an amount
- Because the stock quantity unit is now the base for everything, it cannot be changed after the product was once added to stock (for now, maybe there will be a possibilty to change it in a future release)
### New feature: Prefill purchase data by barcodes
- Imagine you buy for example eggs in different pack sizes and they have different barcodes
- Each product barcode can be assigned an amount, quantity unit and store (on the product edit page), which is then automatically prefilled on the purchase page
- Additionally, the last price per barcode will be tracked and prefilled as a "Total price" on purchase
- (Thanks @kriddles for the initial work on this)
### New feature: User permissions
- Users can now have permissions, can be configured per user on the "Manage users" page (lock icon)
- Default permissions for new users can be set via a new `config.php` setting `DEFAULT_PERMISSIONS` (defaults to `ADMIN`, so no changed behavior when not configured)
- All currently existing users will get all permissions (`ADMIN`) during the update/migration
- Creating API keys on the "Manage API keys"-page (top right corner settings menu) now requires the `ADMIN` permission
- Other users only see their API keys on that page
- (Thanks @fipwmaqzufheoxq92ebc for the initial work on this)
### New feature: External authentication support
- 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)
- 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)
- (Thanks @fipwmaqzufheoxq92ebc for the initial work on this)
### Stock improvements/fixes
- Changes about best before dates: It's now possible to distinguish between best before dates and expiration dates:
- New product option "Due date type" (defaults to "Best before date")
- Wording changes:
- All current places where "Best before date" was used now use "Due date"
- Products with `Due date type = Best before date` (so all existing products) are "due" or "overdue" (they don't "expire" or are "expired")
- Products with `Due date type = Expiration date` (new option) can "expire" or are "expired"
- Color changes:
- Products which are due soon or expire soon are (still) highlighted in yellow
- Products which are overdue are highlighted in grey (there is also a new filter button on the stock overview page for them)
- Products which are expired (new option) are highlighted in red
- When creating a quantity unit conversion it's now possible to automatically create the inverse conversion (thanks @kriddles)
- The product option "Allow partial units in stock" was removed, partial amounts are now possible by default for all products
- On purchase there is now a warning shown, when the due date of the purchased product is earlier than the next due date in stock (enabled by default, can be disabled by a new stock setting (top right corner settings menu))
- The amount to be used for the "quick consume/open buttons" on the stock overview page can now be configured per product (new product option "Quick consume amount", defaults to 1)
- This "Quick consume amount" can optionally also be used as the default on the consume page (new stock setting / top right corner settings menu)
- Products can now be duplicated (new dropdown menu item on the products list page, all fields will be preset from the copied product, except the name)
- Products can now be merged (new dropdown menu item on the products list page)
- Useful if you have two products which are basically the same and want to replace all occurrences of one with the other one
- When consuming or opening a parent product, which is currently not in stock, any in-stock sub product will now be consumed/opened (like already automatically done when consuming recipes)
- Opened stock entries get now consumed first by default when no specific stock entry is used/selected
- So the default consume rule is now "Opened first, then first due first, then first in first out"
- Optimized/clarified what the total/unit price on the purchase page is (thanks @kriddles)
- On the purchase page the amount field is now displayed above/before the due date for better `TAB` handling (thanks @kriddles)
- Changed that when `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING` is disabled, products now get internally a due date of "never overdue" (aka `2999-12-31`) instead of today (thanks @kriddles)
- Products can now be disabled to keep the history/journal, but hide it everywhere, without deleting it (new product option "Active", deleting a product now explicitly also deletes its journal and all other references) (thanks @kriddles for the initial work on this)
- Products can now be hidden from the stock overview page, even if they are in-stock (new product option "Never show on stock overview", disabled by default, so no changed behavior when not configured)
- That's maybe useful for parent products you only use as a kind of "container"
- The due date is now also prefilled on the inventory page based on the products "Default due days" (was only done on the purchase page before)
- On the stock journal page, it's now visible if a consume-booking was spoiled
- It's now tracked who made a stock change (currently logged in user, visible on the stock journal page) (thanks @fipwmaqzufheoxq92ebc)
- Product edit page improvements ("Save & continue" button, deleting and adding a product picuture is now possible in one go) (thanks @Ma27)
- For products with tare weight handling enabled, it's now optionally possible to consume a fixed/exact amount (just like for "normal" products) in case you don't want to weigh the whole container this time (new checkbox on the consume page) (thanks @fipwmaqzufheoxq92ebc)
- The stock overview page now also shows the value - new column and also the total value in the header (thanks @kriddles)
- It's now possible to set a custom purchased date on purchase (new field on the purchase and inventory page, hidden by default - enable it by a new stock setting (top right corner settings menu)) (thanks @kriddles)
- The decimal places for all amount and price inputs can now be configured (stock settings / top right corner settings menu, default for amounts is `4`, for prices `2`)
- When clicking the product name on the shopping list, the product card will now be displayed (like on the stock overview page) (thanks @kriddles)
- On the product card there is now also a button to jump directly to the stock entries of the corresponding product (thanks @kriddles)
- The product picker workflows can now also be started by `ENTER` (additionally to `TAB`)
- Added a "retry camera barcode scan" button (button with camera icon, shortcut `C`) to the product picker workflow dialog
- Added more filters on the stock journal page
- Added a grouped/summarized stock journal (new button "Journal summary" at the top of the stock journal page) (thanks @fipwmaqzufheoxq92ebc)
- Provides an overview of summarized transactions per product, transaction type and user + summarized amount
- The product option "Default due days after freezing" now also supports `-1` (like the option "Default due days") to set the product to "never due" on freezing
- Fixed that changing the products "Factor purchase to stock quantity unit" not longer messes up historical prices (which results for example in wrong recipe costs) (thanks @kriddles)
- Fixed that when adding products through a product picker workflow and when the created products contains special characters, the product was not preselected on the previous page (thanks @Forceu)
- Fixed that when editing a product the default store was not visible / always empty regardless if the product had one set (thanks @kriddles)
- Fixed that `FEATURE_SETTING_STOCK_COUNT_OPENED_PRODUCTS_AGAINST_MINIMUM_STOCK_AMOUNT` (option to configure if opened products should be considered for minimum stock amounts) was not handled correctly (thanks @teddybeermaniac)
- Fixed that the "Due soon" sum (yellow filter button) on the stock overview page didn't include products which are due today (thanks @fipwmaqzufheoxq92ebc)
- Fixed that the shopping cart icon on the stock overview page was also shown if the product was on an already deleted shopping list (if enabled) (thanks @fipwmaqzufheoxq92ebc)
- Fixed that when editing a stock entry without a price, the price field was prefilled with `1`
- Fixed that the location & product groups filter on the stock overview page used a contains search instead of an exact search
- Fixed that the amount on the success popup was wrong when consuming a product with "Tare weight handling" enabled
- Fixed that the aggregated amount of parent products was wrong on the stock overview page when the child products had not the same stock quantity units
- Fixed that edited stock entries were not considered for the price history chart on the product card
- Fixed that `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING` is set to `false`, the purchase page validation failed (thanks @fipwmaqzufheoxq92ebc)
- Fixed that consuming (and editing the amount of) products with enabled tare weight handling did not work on the stock entries page
- Fixed that the recipes dropdown on the consume page also displayed internal recipes (thanks @kriddles)
- Fixed that opening tare weight handling enabled products is prevented via the UI and the API (as this makes no sense)
- Fixed that undoing a consume transaction of an opened item added it back to stock unopened
- Fixed that a "Total price" on purchase was not handled correctly for tare weight handling enabled products (the total price was wrongly related to the amount including the tare weight)
### Shopping list improvements
- Added a button to add all currently in-stock but overdue and expired products to the shopping list (thanks @m-byte)
- Improved that when `FEATURE_FLAG_STOCK` is disabled, all product/stock related inputs and buttons are now hidden on the shopping list page (thanks @fipwmaqzufheoxq92ebc)
- Shopping list items can now have their own Userfields (entity `shopping_list`), on the shopping list table those fields are rendered additionally to the product Userfields
- The print view is now configurable (new dialog before printing - option to hide header, group products by their product group, alternative list layout)
- Fixed that "Add products that are below defined min. stock amount" always rounded up the missing amount to an integral number, this now allows decimal numbers
### Recipe improvements/fixes
- It's now possible to print recipes (button next to the recipe title) (thanks @zsarnett)
- Changed that recipe costs are now based on the costs of the products picked by the default consume rule ("Opened first, then first due first, then first in first out") (thanks @kriddles)
- Recipe costs were based on the last purchase price per product before, so this now better reflects the current real costs
- Improved the recipe add workflow (a recipe called "New recipe" is now not automatically created when starting to add a recipe) (thanks @zsarnett)
- On the recipe page, the calories and costs per ingredient are now shown to get a better overview of how much each ingredient contributed
- Fixed that images on the recipe gallery view were not scaled correctly on larger screens (thanks @zsarnett)
- Fixed that decimal ingredient amounts maybe resulted in wrong conversions or truncated decimal places if your locale does not use a dot as the decimal separator (thanks @m-byte)
- Fixed that a recipe cannot be included in itself (because this will cause an infinite loop) (thanks @fipwmaqzufheoxq92ebc)
- Fixed that when editing a recipe ingredient the checkbox "Disable stock fulfillment checking for this ingredient" was not initaliased with the saved value
- Fixed that the status filter ("Enough in stock", etc.) on the recipes page did not filter recipes on the gallery tab (thanks @fipwmaqzufheoxq92ebc)
- Fixed that consuming a recipe ingredient with tare weight handling enabled consumed a wrong amount (thanks @fipwmaqzufheoxq92ebc)
- Fixed that consuming a parent product recipe ingredient did not consider quantity unit conversion when effectively consuming a child product
### Meal plan fixes
- Fixed that for products the quantity unit purchase was displayed instead of the products quantity unit stock (thanks @BenoitAnastay)
### Chores improvements/fixes
- Chores can now be disabled to keep the history/journal, but hide it everywhere, without deleting it (new chore option "Active", deleting a chore now explicitly also deletes its journal and all other references)
- Changed that not assigned chores on the chores overview page display now just a dash instead of an ellipsis in the "Assigned to" column to make this more clear (thanks @Germs2004)
- The assignment type "Random" now don't prevents anymore that the last user will be assigned next
- Fixed (again) that weekly chores, where the next execution should be in the same week, were scheduled (not) always (but sometimes) for the next week only (thanks @shadow7412)
- Fixed that the assignment type "In alphabetic order" did not work correctly (the last person in the list was always assigned next once reached) (thanks @fipwmaqzufheoxq92ebc)
### Equipment improvements
- There is now a button to download the instruction manual (next to the "expand to fullscreen"-button)
### Calendar improvements/fixes
- Events are now links to the corresponding page (thanks @zsarnett)
- Fixed a PHP warning when using the "Share/Integrate calendar (iCal)" button (thanks @tsia)
- Fixed that "Track date only"-chores were always displayed at 12am (are now displayed as all-day events)
- Fixed that it was not possible to switch to an other view than the default one on mobile (thanks @PhyberApex)
### Tasks improvements
- Tasks don't need to unique anymore (name field)
### Batteries improvements
- Batteries can now be disabled to keep the history/journal, but hide it everywhere, without deleting it (new battery option "Active", deleting a battery now explicitly also deletes its journal and all other references)
### Userfield improvements/fixes
- New Userfield type "File" to attach any file, will be rendered as a link to the file in tables (if enabled) (thanks @fipwmaqzufheoxq92ebc)
- New Userfield type "Picture" to attach a picture, the picture will be rendered (small) in tables (if enabled) (thanks @fipwmaqzufheoxq92ebc)
- New Userfield type "Link (with title)" - a link with a title (two input fields), so that the title is rendered in tables (if enabled) instead of the link itself
- Userfields can now be reordered on the input form (new field "Sort number" per Userfield, fields will be ordered by that number, if any)
- Users can now also have Userfields
### General & other improvements/fixes
- UI refresh / style improvements (thanks @zsarnett for the idea and initial work on this)
- Improved mobile views (thanks @4lloyd for the idea and initial work on this)
- The buttons on the top of each page and the filter row is now collapsed (use the ellipsis/filter button to show them, this also superseded the shopping list compact view)
- Tables are horizontally scrollable (instead of collapsing columns which don't fit)
- All tables are now customizable (new little eye icon on the top left corner on each table)
- Table columns be shown/hidden
- There are also new columns on some pages, hidden by default
- Stock overview: Value, Product group, Calories, Last purchased, Last price, Min. stock amount
- Products list: Default store
- Shopping list: Last price (Unit), Last price (Total), Default store, Barcodes (as scannable code-image)
- Row grouping can be customized to use any available column (thanks @edenhaus)
- Table states (visible columns, sorting, column order and so on) are now saved server side (in user settings) means that this stays the same when using different browsers
- Dialogs are now used everywhere where appropriate instead of jumping between pages (for example when adding/editing shopping list items)
- Added a "Clear filter"-button on all pages (with filters) to quickly reset applied filters
- Users can now have a picture (will then be shown next to the current user name instead of the generic user icon)
- Prefilled number inputs now use sensible decimal places (max. the configured decimals while hiding trailing zeros where appropriate, means if you never use partial amounts for a product, you'll never see decimals for it)
- Improved / more precise validation messages for number inputs
- Optimized what's hidden when `GROCY_FEATURE_FLAG_STOCK` is disabled
- 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)
- 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)
- Additionally, the language is now also auto-guessed based on the browser locale (HTTP-Header `Accept-Language`)
- The `config.php` option `CULTURE` was renamed to `DEFAULT_LOCALE`
- So the used language is based on (in that order)
- The user setting
- If not set, then based on browser locale
- If no matching localizaton was found, `DEFAULT_LOCALE` from `config.php` is used
- Performance improvements (page loading time) of the stock overview page (thanks @fipwmaqzufheoxq92ebc)
- The prerequisites checker now also checks for the minimum required SQLite version (thanks @Forceu)
- Replaced (again, added before in v2.7.0, then reverted in v2.7.1 due to some problems) [QuaggaJS](https://github.com/serratus/quaggaJS) (seems to be unmaintained) by [Quagga2](https://github.com/ericblade/quagga2)
- More `config.php` settings (see the section `Component configuration for Quagga2`) to tweak Quagga2 (this is the component used for device camera for barcode scanning) (thanks @andrelam)
- Some localization string fixes (thanks @duckfullstop)
- Better error pages
- Fixed that numeric and date-time sorting of table columns did not work correctly
- Fixed that XSS / HTML injection was possible through some user input fields (low severity / not really a problem as this could not be abused unauthenticated)
- New translations: (thanks all the translators)
- Greek (demo available at https://el.demo.grocy.info)
- Korean (demo available at https://ko.demo.grocy.info)
- Chinese (China) (demo available at https://zh-cn.demo.grocy.info)
- Tamil (demo available at https://ta.demo.grocy.info)
- Finnish (demo available at https://fi.demo.grocy.info)
### API improvements/fixes
- ⚠️ **Breaking changes**:
- All prices are now related to the products stock quantity unit (instead of the products purchase QU)
- All (product) amounts are now related to the products stock quantity unit (was related to the products purchase QU for the shopping list before)
- The product object no longer has a field `barcodes` with a comma separated barcode list, instead barcodes are now stored in a separate table/entity `product_barcodes` (use the existing "Generic entity interactions" endpoints to access them)
- The endpoint `/objects/{entity}/search` was removed (use the existing `/objects/{entity}` endpoint with new new filter capabilities mentioned below)
- The output / field names of `ProductDetailsResponse` have slightly changed (endpoint `/stock/products/{productId}`)
- Endpoint `/stock/volatile`
- The query parameter `expring_days` was renamed to `due_soon_days`
- The field `expiring_products` was renamed to `due_products`
- The field `expired_products` now only contains expired products (so them with `Due date type = Expiration date`)
- The new field `overdue_products` contains only overdue products (so them with `Due date type = Best before date`)
- The following endpoints now return all bookings of the transaction (so the response is now an array, was before a single stock booking - and a random one if the transaction affected multiple stock entries)
- PUT `/stock/entry/{entryId}`
- POST `/stock/products/{productId}/add`
- POST `/stock/products/{productId}/consume`
- POST `/stock/products/{productId}/transfer`
- POST `/stock/products/{productId}/inventory`
- POST `/stock/products/{productId}/open`
- POST `/stock/products/by-barcode/{barcode}/add`
- POST `/stock/products/by-barcode/{barcode}/consume`
- POST `/stock/products/by-barcode/{barcode}/transfer`
- POST `/stock/products/by-barcode/{barcode}/inventory`
- POST `/stock/products/by-barcode/{barcode}/open`
- (The response is the same as if you would fetch the stock transaction via `/stock/transactions/{transactionId}`)
- For better integration (apps), it's now possible to show a QR-Code for API keys (thanks @fipwmaqzufheoxq92ebc)
- New QR-Code button on the "Manage API keys"-page (top right corner settings menu), the QR-Codes contains `<API-Url>|<API-Key>`
- And on the calendar page when using the button "Share/Integrate calendar (iCal)", there the QR-Codes contains the Share-URL (which is displayed in the textbox above)
- The output of the following endpoints can now be filtered (by any field), ordered and paginated (thanks for the initial work on this @fipwmaqzufheoxq92ebc)
- `/objects/{entity}`
- `/stock/products/{productId}/entries`
- `/stock/products/{productId}/locations`
- `/recipes/fulfillment`
- `/users`
- `/tasks`
- `/chores`
- `/batteries`
- There are 4 new (optional) query parameters to utilize that
- `order` The field to order by (use the separator `:` to specify the sort order - `asc` or `desc`, defaults to `asc` when omitted)
- `limit` The maximum number of objects to return
- `offset` The number of objects to skip
- `query[]` An array of conditions, each of them is a string in the form of `<field><condition><value>`, where
- `<field>` is a field name
- `<condition>` is a comparison operator, one of
- `=` equal
- `!=` not equal
- `~` LIKE
- `!~` not LIKE
- `<` less
- `>` greater
- `<=` less or equal
- `>=` greater or equal
- `§` regular expression
- `<value>` is the value to search for
- New endpoint `/stock/shoppinglist/add-overdue-products` to add all currently in-stock but overdue products to a shopping list (thanks @m-byte)
- New endpoint `/stock/shoppinglist/add-expired-products` to add all currently in-stock but expired products to a shopping list
- New endpoints GET/POST/PUT `/users/{userId}/permissions` for the new user permissions feature mentioned above
- New endpoint `/user` to get the currently authenticated user
- New endpoint DELETE `/user/settings/{settingKey}` to delete a user setting
- New endpoint POST `/stock/products/{productIdToKeep}/merge/{productIdToRemove}` for the new product merging feature mentioned above
- The following entities are now also available via the endpoint `/objects/{entity}` (only listing, no edit)
- `stock_log` (the stock journal)
- `stock` (the "raw" stock entries)
- `stock_current_locations` (info how much of each product is currently stored at which location)
- Performance improvements of the `/stock/products/*` endpoints (thanks @fipwmaqzufheoxq92ebc)
- The endpoint `/stock/products/{productId}/locations` now also has an optional query parameter `include_sub_products` to optionally also return locations of sub products of the given product
- The following endpoints now have an optional request body parameter `allow_subproduct_substitution` to consume/open any child product when the given product is a parent product and currently not in stock
- `/stock/products/{productId}/consume`
- `/stock/products/by-barcode/{barcode}/consume`
- `/stock/products/{productId}/open`
- `/stock/products/by-barcode/{barcode}/open`
- Fixed that the endpoint `/objects/{entity}/{objectId}` always returned successfully, even when the given object not exists (now returns `404` when the object is not found) (thanks @fipwmaqzufheoxq92ebc)
- Fixed that the endpoint `/stock/volatile` didn't include products which are due today (thanks @fipwmaqzufheoxq92ebc)
- Fixed that the endpoint `/objects/{entity}` did not include Userfields for Userentities (so the effective endpoint `/objects/userobjects`)
- Fixed that the endpoint `/stock/consume` returned the response code `200` and an empty response body when `stock_entry_id` was set (consuming a specific stock entry) but invalid (now returns the response code `400`) (thanks @fipwmaqzufheoxq92ebc)
- Fixed that the endpoint `/user/settings/{settingKey}` didn't return the default setting if it was not configured for the current user (same behavior as the endpoint `/user/settings` now)
- Endpoint `/calendar/ical`: Fixed that "Track date only"-chores were always set to happen at 12am (are treated as all-day events now)
- Fixed (again) that CORS was broken

View File

@@ -10,7 +10,8 @@
"gettext/gettext": "^4.8",
"eluceo/ical": "^0.16.0",
"erusev/parsedown": "^1.7",
"gumlet/php-image-resize": "^1.9"
"gumlet/php-image-resize": "^1.9",
"ezyang/htmlpurifier": "^4.13"
},
"autoload": {
"psr-4": {

825
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,140 +1,169 @@
<?php
# Settings can also be overwritten in two ways
#
# First priority
# A .txt file with the same name as the setting in /data/settingoverrides
# the content of the file is used as the setting value
#
# Second priority
# An environment variable with the same name as the setting and prefix "GROCY_"
# so for example "GROCY_BASE_URL"
#
# Third priority
# The settings defined here below
// Settings can also be overwritten in two ways
//
// First priority
// A .txt file with the same name as the setting in /data/settingoverrides
// the content of the file is used as the setting value
//
// Second priority
// An environment variable with the same name as the setting and prefix "GROCY_"
// so for example "GROCY_BASE_URL"
//
// Third priority
// 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
// Either "production", "dev", "demo" or "prerelease"
// When not "production", authentication will be disabled and
// demo data will be populated during database migrations
Setting('MODE', 'production');
# Either "en" or "de" or the directory name of
# one of the other available localization folders in the "/localization" directory
Setting('CULTURE', 'en');
// Either "en" or "de" or the directory name of
// one of the other available localization folders in the "/localization" directory
Setting('DEFAULT_LOCALE', 'en');
# This is used to define the first day of a week for calendar views in the frontend,
# leave empty to use the locale default
# Needs to be a number where Sunday = 0, Monday = 1 and so forth
// This is used to define the first day of a week for calendar views in the frontend,
// leave empty to use the locale default
// Needs to be a number where Sunday = 0, Monday = 1 and so forth
Setting('CALENDAR_FIRST_DAY_OF_WEEK', '');
# If calendars should show week numbers
// If calendars should show week numbers
Setting('CALENDAR_SHOW_WEEK_OF_YEAR', true);
# 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 should be the
# ISO 4217 code of the currency ("USD", "EUR", "GBP", etc.)
// 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 should 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
# Example:
# Webserver root directory = /var/www
# grocy directory = /var/www/grocy
# => BASE_PATH = /grocy
// 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:
// Root URL = https://example.com/grocy
// => BASE_PATH = /grocy
// Example without URL Rewriting support:
// Root URL = https://example.com/grocy/public/index.php/
// => BASE_PATH = /grocy/public/index.php
Setting('BASE_PATH', '');
# The base url of your installation,
# should be just "/" when running directly under the root of a (sub)domain
# or for example "https://example.com/grocy" when using a subdirectory
// The base URL of your installation,
// should be just "/" when running directly under the root of a (sub)domain
// or for example "https://example.com/grocy" when using a subdirectory
Setting('BASE_URL', '/');
# The plugin to use for external barcode lookups,
# must be the filename without .php extension and must be located in /data/plugins,
# see /data/plugins/DemoBarcodeLookupPlugin.php for an example implementation
// The plugin to use for external barcode lookups,
// must be the filename without .php extension and must be located in /data/plugins,
// see /data/plugins/DemoBarcodeLookupPlugin.php for an example implementation
Setting('STOCK_BARCODE_LOOKUP_PLUGIN', 'DemoBarcodeLookupPlugin');
# If, however, your webserver does not support URL rewriting, set this to true
// If, however, your webserver does not support URL rewriting, set this to true
Setting('DISABLE_URL_REWRITING', false);
# Specify an custom homepage if desired - by default the homepage will be set to the stock overview,
# this needs to be one of the following values:
# stock, shoppinglist, recipes, chores, tasks, batteries, equipment, calendar, mealplan
// Specify an custom homepage if desired - by default the homepage will be set to the stock overview page,
// this needs to be one of the following values:
// stock, shoppinglist, recipes, chores, tasks, batteries, equipment, calendar, mealplan
Setting('ENTRY_PAGE', 'stock');
# Set this to true if you want to disable authentication / the login screen,
# places where user context is needed will then use the default (first existing) user
// Set this to true if you want to disable authentication / the login screen,
// places where user context is needed will then use the default (first existing) user
Setting('DISABLE_AUTH', false);
# Set this to true if you want to disable the ability to scan a barcode via the device camera (Browser API)
// Either "Grocy\Middleware\DefaultAuthMiddleware", "Grocy\Middleware\ReverseProxyAuthMiddleware"
// or any class that implements Grocy\Middleware\AuthMiddleware
Setting('AUTH_CLASS', 'Grocy\Middleware\DefaultAuthMiddleware');
// When using ReverseProxyAuthMiddleware,
// the name of the HTTP header which your reverse proxy uses to pass the username (on successful authentication)
Setting('REVERSE_PROXY_AUTH_HEADER', 'REMOTE_USER');
// When using LdapAuthMiddleware
Setting('LDAP_DOMAIN', ''); // Example value "local"
Setting('LDAP_ADDRESS', ''); // Example value "ldap://vm-dc2019.local.berrnd.net"
Setting('LDAP_BASE_DN', ''); // Example value "OU=OU_Users,DC=local,DC=berrnd,DC=net"
// Set this to true if you want to disable the ability to scan a barcode via the device camera (Browser API)
Setting('DISABLE_BROWSER_BARCODE_CAMERA_SCANNING', false);
# 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
// 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
Setting('MEAL_PLAN_FIRST_DAY_OF_WEEK', '');
// Default permissions for new users
// the array needs to contain the technical/constant names
// see the file controllers/Users/User.php for possible values
Setting('DEFAULT_PERMISSIONS', ['ADMIN']);
# Default user settings
# These settings can be changed per user, here the defaults
# are defined which are used when the user has not changed the setting so far
// Default user settings
// These settings can be changed per user, here the defaults
// are defined which are used when the user has not changed the setting so far
# Night mode related
// Night mode related
DefaultUserSetting('night_mode_enabled', false); // If night mode is enabled always
DefaultUserSetting('auto_night_mode_enabled', false); // If night mode is enabled automatically when inside a given time range (see the two settings below)
DefaultUserSetting('auto_night_mode_time_range_from', "20:00"); // Format HH:mm
DefaultUserSetting('auto_night_mode_time_range_to', "07:00"); // Format HH:mm
DefaultUserSetting('auto_night_mode_time_range_from', '20:00'); // Format HH:mm
DefaultUserSetting('auto_night_mode_time_range_to', '07:00'); // Format HH:mm
DefaultUserSetting('auto_night_mode_time_range_goes_over_midnight', true); // If the time range above goes over midnight
DefaultUserSetting('currently_inside_night_mode_range', false); // If we're currently inside of night mode time range (this is not user configurable, but stored as a user setting because it's evaluated client side to be able to use the client time instead of the maybe different server time)
# Keep screen on settings
// Keep screen on settings
DefaultUserSetting('keep_screen_on', false); // Keep the screen always on
DefaultUserSetting('keep_screen_on_when_fullscreen_card', false); // Keep the screen on when a "fullscreen-card" is displayed
# Stock settings
// Stock settings
DefaultUserSetting('product_presets_location_id', -1); // Default location id for new products (-1 means no location is preset)
DefaultUserSetting('product_presets_product_group_id', -1); // Default product group id for new products (-1 means no product group is preset)
DefaultUserSetting('product_presets_qu_id', -1); // Default quantity unit id for new products (-1 means no quantity unit is preset)
DefaultUserSetting('stock_expring_soon_days', 5);
DefaultUserSetting('stock_decimal_places_amounts', 4); // Default decimal places allowed for amounts
DefaultUserSetting('stock_decimal_places_prices', 2); // Default decimal places allowed for prices
DefaultUserSetting('stock_due_soon_days', 5);
DefaultUserSetting('stock_default_purchase_amount', 0);
DefaultUserSetting('stock_default_consume_amount', 1);
DefaultUserSetting('stock_default_consume_amount_use_quick_consume_amount', false);
DefaultUserSetting('scan_mode_consume_enabled', false);
DefaultUserSetting('scan_mode_purchase_enabled', false);
DefaultUserSetting('show_icon_on_stock_overview_page_when_product_is_on_shopping_list', true);
DefaultUserSetting('show_purchased_date_on_purchase', false); // Wheter the purchased date should be editable on purchase (defaults to today otherwise)
DefaultUserSetting('show_warning_on_purchase_when_due_date_is_earlier_than_next', true); // Show a warning on purchase when the due date of the purchased product is earlier than the next due date in stock
# Shopping list settings
DefaultUserSetting('shopping_list_to_stock_workflow_auto_submit_when_prefilled', false); // Automatically do the booking using the last price and the amount of the shopping list item, if the product has "Default best before days" set
// Shopping list settings
DefaultUserSetting('shopping_list_to_stock_workflow_auto_submit_when_prefilled', false); // Automatically do the booking using the last price and the amount of the shopping list item, if the product has "Default due days" set
DefaultUserSetting('shopping_list_show_calendar', false);
DefaultUserSetting('shopping_list_disable_auto_compact_view_on_mobile', false);
# Recipe settings
// Recipe settings
DefaultUserSetting('recipe_ingredients_group_by_product_group', false); // Group recipe ingredients by their product group
# Chores settings
// Chores settings
DefaultUserSetting('chores_due_soon_days', 5);
# Batteries settings
// Batteries settings
DefaultUserSetting('batteries_due_soon_days', 5);
# Tasks settings
// Tasks settings
DefaultUserSetting('tasks_due_soon_days', 5);
# If the page should be automatically reloaded when there was
# an external change
// If the page should be automatically reloaded when there was
// an external change
DefaultUserSetting('auto_reload_on_db_change', true);
# Show a clock in the header next to the logo or not
// Show a clock in the header next to the logo or not
DefaultUserSetting('show_clock_in_header', false);
# Component configuration
// 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
DefaultUserSetting('quagga2_numofworkers', 4);
DefaultUserSetting('quagga2_halfsample', false);
DefaultUserSetting('quagga2_patchsize', 'medium');
DefaultUserSetting('quagga2_frequency', 10);
DefaultUserSetting('quagga2_debug', true);
# Feature flags
# grocy was initially about "stock management for your household", many other things
# came and still come by, because they are useful - here you can disable the parts
# which you don't need to have a less cluttered UI
# (set the setting to "false" to disable the corresponding part, which should be self explanatory)
// Feature flags
// grocy was initially about "stock management for your household", many other things
// came and still come by, because they are useful - here you can disable the parts
// which you don't need to have a less cluttered UI
// (set the setting to "false" to disable the corresponding part, which should be self explanatory)
Setting('FEATURE_FLAG_STOCK', true);
Setting('FEATURE_FLAG_SHOPPINGLIST', true);
Setting('FEATURE_FLAG_RECIPES', true);
@@ -144,18 +173,16 @@ Setting('FEATURE_FLAG_BATTERIES', true);
Setting('FEATURE_FLAG_EQUIPMENT', true);
Setting('FEATURE_FLAG_CALENDAR', true);
# Sub feature flags
// Sub feature flags
Setting('FEATURE_FLAG_STOCK_PRICE_TRACKING', true);
Setting('FEATURE_FLAG_STOCK_LOCATION_TRACKING', true);
Setting('FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING', true);
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 best-before-date fields on (supported) mobile browsers
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_CHORES_ASSIGNMENTS', true);
# Feature settings
Setting('FEATURE_SETTING_STOCK_COUNT_OPENED_PRODUCTS_AGAINST_MINIMUM_STOCK_AMOUNT', true); // When set to false, opened products will not be considered for minimum stock amounts
Setting('FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA', true); // Enables the torch automaticaly in every camera barcode scanner.
// Feature settings
Setting('FEATURE_SETTING_STOCK_COUNT_OPENED_PRODUCTS_AGAINST_MINIMUM_STOCK_AMOUNT', true); // When set to true, opened items will be counted as missing for calculating if a product is below its minimum stock amount
Setting('FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA', true); // Enables the torch automaticaly (if the device has one)

View File

@@ -2,25 +2,21 @@
namespace Grocy\Controllers;
use LessQL\Result;
class BaseApiController extends BaseController
{
protected $OpenApiSpec = null;
const PATTERN_FIELD = '[A-Za-z_][A-Za-z0-9_]+';
const PATTERN_OPERATOR = '!?(=|~|<|>|(>=)|(<=)|(§))';
const PATTERN_VALUE = '[A-Za-z_0-9.$#^|]+';
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
protected $OpenApiSpec = null;
protected function getOpenApispec()
{
if($this->OpenApiSpec == null)
{
$this->OpenApiSpec = json_decode(file_get_contents(__DIR__ . '/../grocy.openapi.json'));
}
return $this->OpenApiSpec;
}
protected function ApiResponse(\Psr\Http\Message\ResponseInterface $response, $data)
{
$response->getBody()->write(json_encode($data));
@@ -34,8 +30,117 @@ class BaseApiController extends BaseController
protected function GenericErrorResponse(\Psr\Http\Message\ResponseInterface $response, $errorMessage, $status = 400)
{
return $response->withStatus($status)->withJson(array(
return $response->withStatus($status)->withJson([
'error_message' => $errorMessage
));
]);
}
public function FilteredApiResponse(\Psr\Http\Message\ResponseInterface $response, Result $data, array $query)
{
$data = $this->queryData($data, $query);
return $this->ApiResponse($response, $data);
}
protected function queryData(Result $data, array $query)
{
if (isset($query['query']))
{
$data = $this->filter($data, $query['query']);
}
if (isset($query['limit']))
{
$data = $data->limit(intval($query['limit']), intval($query['offset'] ?? 0));
}
if (isset($query['order']))
{
$parts = explode(':', $query['order']);
if (count($parts) == 1)
{
$data = $data->orderBy($parts[0]);
}
else
{
if ($parts[1] != 'asc' && $parts[1] != 'desc')
{
throw new \Exception('Invalid sort order ' . $parts[1]);
}
$data = $data->orderBy($parts[0], $parts[1]);
}
}
return $data;
}
protected function filter(Result $data, array $query): Result
{
foreach ($query as $q)
{
$matches = [];
preg_match(
'/(?P<field>' . self::PATTERN_FIELD . ')'
. '(?P<op>' . self::PATTERN_OPERATOR . ')'
. '(?P<value>' . self::PATTERN_VALUE . ')/',
$q,
$matches
);
if (!array_key_exists('field', $matches) || !array_key_exists('op', $matches) || !array_key_exists('value', $matches))
{
throw new \Exception('Invalid query');
}
$sqlOrNull = '';
if (strtolower($matches['value']) == 'null')
{
$sqlOrNull = ' OR ' . $matches['field'] . ' IS NULL';
}
switch ($matches['op']) {
case '=':
$data = $data->where($matches['field'] . ' = ?' . $sqlOrNull, $matches['value']);
break;
case '!=':
$data = $data->where($matches['field'] . ' != ?' . $sqlOrNull, $matches['value']);
break;
case '~':
$data = $data->where($matches['field'] . ' LIKE ?', '%' . $matches['value'] . '%');
break;
case '!~':
$data = $data->where($matches['field'] . ' NOT LIKE ?', '%' . $matches['value'] . '%');
break;
case '<':
$data = $data->where($matches['field'] . ' < ?', $matches['value']);
break;
case '>':
$data = $data->where($matches['field'] . ' > ?', $matches['value']);
break;
case '>=':
$data = $data->where($matches['field'] . ' >= ?', $matches['value']);
break;
case '<=':
$data = $data->where($matches['field'] . ' <= ?', $matches['value']);
break;
case '§':
$data = $data->where($matches['field'] . ' REGEXP ?', $matches['value']);
break;
}
}
return $data;
}
protected function getOpenApispec()
{
if ($this->OpenApiSpec == null)
{
$this->OpenApiSpec = json_decode(file_get_contents(__DIR__ . '/../grocy.openapi.json'));
}
return $this->OpenApiSpec;
}
}

View File

@@ -2,29 +2,112 @@
namespace Grocy\Controllers;
use \Grocy\Services\DatabaseService;
use \Grocy\Services\ApplicationService;
use \Grocy\Services\LocalizationService;
use \Grocy\Services\StockService;
use \Grocy\Services\UsersService;
use \Grocy\Services\UserfieldsService;
use \Grocy\Services\BatteriesService;
use \Grocy\Services\CalendarService;
use \Grocy\Services\SessionService;
use \Grocy\Services\RecipesService;
use \Grocy\Services\TasksService;
use \Grocy\Services\FilesService;
use \Grocy\Services\ChoresService;
use \Grocy\Services\ApiKeyService;
use Grocy\Controllers\Users\User;
use Grocy\Services\ApiKeyService;
use Grocy\Services\ApplicationService;
use Grocy\Services\BatteriesService;
use Grocy\Services\CalendarService;
use Grocy\Services\ChoresService;
use Grocy\Services\DatabaseService;
use Grocy\Services\FilesService;
use Grocy\Services\LocalizationService;
use Grocy\Services\RecipesService;
use Grocy\Services\SessionService;
use Grocy\Services\StockService;
use Grocy\Services\TasksService;
use Grocy\Services\UserfieldsService;
use Grocy\Services\UsersService;
class BaseController
{
public function __construct(\DI\Container $container) {
protected $AppContainer;
public function __construct(\DI\Container $container)
{
$this->AppContainer = $container;
$this->View = $container->get('view');
}
protected function getApiKeyService()
{
return ApiKeyService::getInstance();
}
protected function getApplicationservice()
{
return ApplicationService::getInstance();
}
protected function getBatteriesService()
{
return BatteriesService::getInstance();
}
protected function getCalendarService()
{
return CalendarService::getInstance();
}
protected function getChoresService()
{
return ChoresService::getInstance();
}
protected function getDatabase()
{
return $this->getDatabaseService()->GetDbConnection();
}
protected function getDatabaseService()
{
return DatabaseService::getInstance();
}
protected function getFilesService()
{
return FilesService::getInstance();
}
protected function getLocalizationService()
{
if (!defined('GROCY_LOCALE'))
{
define('GROCY_LOCALE', GROCY_DEFAULT_LOCALE);
}
return LocalizationService::getInstance(GROCY_LOCALE);
}
protected function getRecipesService()
{
return RecipesService::getInstance();
}
protected function getSessionService()
{
return SessionService::getInstance();
}
protected function getStockService()
{
return StockService::getInstance();
}
protected function getTasksService()
{
return TasksService::getInstance();
}
protected function getUserfieldsService()
{
return UserfieldsService::getInstance();
}
protected function getUsersService()
{
return UsersService::getInstance();
}
protected function render($response, $page, $data = [])
{
$container = $this->AppContainer;
@@ -33,19 +116,24 @@ class BaseController
$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)
{
$localizationService = $this->getLocalizationService();
$this->View->set('__t', function (string $text, ...$placeholderValues) use ($localizationService) {
return $localizationService->__t($text, $placeholderValues);
});
$this->View->set('__n', function($number, $singularForm, $pluralForm) use($localizationService)
{
$this->View->set('__n', function ($number, $singularForm, $pluralForm) use ($localizationService) {
return $localizationService->__n($number, $singularForm, $pluralForm);
});
$this->View->set('GettextPo', $localizationService->GetPoAsJsonString());
$this->View->set('U', function($relativePath, $isResource = false) use($container)
// TODO: Better handle this generically based on the current language (header in .po file?)
$dir = 'ltr';
if (GROCY_LOCALE == 'he_IL')
{
$dir = 'rtl';
}
$this->View->set('dir', $dir);
$this->View->set('U', function ($relativePath, $isResource = false) use ($container) {
return $container->get('UrlManager')->ConstructUrl($relativePath, $isResource);
});
@@ -64,7 +152,12 @@ class BaseController
unset($constants[$constant]);
}
}
$this->View->set('featureFlags', $constants);
if (GROCY_AUTHENTICATED)
{
$this->View->set('permissions', User::PermissionList());
}
return $this->View->render($response, $page, $data);
}
@@ -75,6 +168,7 @@ class BaseController
try
{
$usersService = $this->getUsersService();
if (defined('GROCY_USER_ID'))
{
$this->View->set('userSettings', $usersService->GetUserSettings(GROCY_USER_ID));
@@ -92,80 +186,26 @@ class BaseController
return $this->render($response, $page, $data);
}
protected function getDatabaseService()
{
return DatabaseService::getInstance();
}
private static $htmlPurifierInstance = null;
protected function getDatabase()
protected function GetParsedAndFilteredRequestBody($request)
{
return $this->getDatabaseService()->GetDbConnection();
}
if (self::$htmlPurifierInstance == null)
{
self::$htmlPurifierInstance = new \HTMLPurifier(\HTMLPurifier_Config::createDefault());
}
protected function getLocalizationService()
{
return LocalizationService::getInstance(GROCY_CULTURE);
}
$requestBody = $request->getParsedBody();
foreach ($requestBody as $key => &$value)
{
// HTMLPurifier removes boolean values (true/false), so explicitly keep them
// Maybe also possible through HTMLPurifier config (http://htmlpurifier.org/live/configdoc/plain.html)
if (!is_bool($value))
{
$value = self::$htmlPurifierInstance->purify($value);
}
}
protected function getApplicationservice()
{
return ApplicationService::getInstance();
return $requestBody;
}
protected function getBatteriesService()
{
return BatteriesService::getInstance();
}
protected function getCalendarService()
{
return CalendarService::getInstance();
}
protected function getSessionService()
{
return SessionService::getInstance();
}
protected function getRecipesService()
{
return RecipesService::getInstance();
}
protected function getStockService()
{
return StockService::getInstance();
}
protected function getTasksService()
{
return TasksService::getInstance();
}
protected function getUsersService()
{
return UsersService::getInstance();
}
protected function getUserfieldsService()
{
return UserfieldsService::getInstance();
}
protected function getApiKeyService()
{
return ApiKeyService::getInstance();
}
protected function getChoresService()
{
return ChoresService::getInstance();
}
protected function getFilesService()
{
return FilesService::getInstance();
}
protected $AppContainer;
}

View File

@@ -2,34 +2,10 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
class BatteriesApiController extends BaseApiController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function TrackChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$requestBody = $request->getParsedBody();
try
{
$trackedTime = date('Y-m-d H:i:s');
if (array_key_exists('tracked_time', $requestBody) && IsIsoDateTime($requestBody['tracked_time']))
{
$trackedTime = $requestBody['tracked_time'];
}
$chargeCycleId = $this->getBatteriesService()->TrackChargeCycle($args['batteryId'], $trackedTime);
return $this->ApiResponse($response, $this->getDatabase()->battery_charge_cycles($chargeCycleId));
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function BatteryDetails(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
@@ -44,11 +20,37 @@ class BatteriesApiController extends BaseApiController
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->ApiResponse($response, $this->getBatteriesService()->GetCurrent());
return $this->FilteredApiResponse($response, $this->getBatteriesService()->GetCurrent(), $request->getQueryParams());
}
public function TrackChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
User::checkPermission($request, User::PERMISSION_BATTERIES_TRACK_CHARGE_CYCLE);
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
try
{
$trackedTime = date('Y-m-d H:i:s');
if (array_key_exists('tracked_time', $requestBody) && IsIsoDateTime($requestBody['tracked_time']))
{
$trackedTime = $requestBody['tracked_time'];
}
$chargeCycleId = $this->getBatteriesService()->TrackChargeCycle($args['batteryId'], $trackedTime);
return $this->ApiResponse($response, $this->getDatabase()->battery_charge_cycles($chargeCycleId));
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function UndoChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
User::checkPermission($request, User::PERMISSION_BATTERIES_UNDO_CHARGE_CYCLE);
try
{
$this->ApiResponse($response, $this->getBatteriesService()->UndoChargeCycle($args['chargeCycleId']));
@@ -59,4 +61,9 @@ class BatteriesApiController extends BaseApiController
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -4,41 +4,29 @@ namespace Grocy\Controllers;
class BatteriesController extends BaseController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$usersService = $this->getUsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['batteries_due_soon_days'];
return $this->renderPage($response, 'batteriesoverview', [
'batteries' => $this->getDatabase()->batteries()->orderBy('name'),
'current' => $this->getBatteriesService()->GetCurrent(),
'nextXDays' => $nextXDays,
'userfields' => $this->getUserfieldsService()->GetFields('batteries'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('batteries')
]);
}
public function TrackChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'batterytracking', [
'batteries' => $this->getDatabase()->batteries()->orderBy('name')
]);
}
public function BatteriesList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if (isset($request->getQueryParams()['include_disabled']))
{
$batteries = $this->getDatabase()->batteries()->orderBy('name', 'COLLATE NOCASE');
}
else
{
$batteries = $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
}
return $this->renderPage($response, 'batteries', [
'batteries' => $this->getDatabase()->batteries()->orderBy('name'),
'batteries' => $batteries,
'userfields' => $this->getUserfieldsService()->GetFields('batteries'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('batteries')
]);
}
public function BatteriesSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'batteriessettings');
}
public function BatteryEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($args['batteryId'] == 'new')
@@ -51,7 +39,7 @@ class BatteriesController extends BaseController
else
{
return $this->renderPage($response, 'batteryform', [
'battery' => $this->getDatabase()->batteries($args['batteryId']),
'battery' => $this->getDatabase()->batteries($args['batteryId']),
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('batteries')
]);
@@ -62,12 +50,33 @@ class BatteriesController extends BaseController
{
return $this->renderPage($response, 'batteriesjournal', [
'chargeCycles' => $this->getDatabase()->battery_charge_cycles()->orderBy('tracked_time', 'DESC'),
'batteries' => $this->getDatabase()->batteries()->orderBy('name')
'batteries' => $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE')
]);
}
public function BatteriesSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'batteriessettings');
$usersService = $this->getUsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['batteries_due_soon_days'];
return $this->renderPage($response, 'batteriesoverview', [
'batteries' => $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'current' => $this->getBatteriesService()->GetCurrent(),
'nextXDays' => $nextXDays,
'userfields' => $this->getUserfieldsService()->GetFields('batteries'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('batteries')
]);
}
public function TrackChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'batterytracking', [
'batteries' => $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE')
]);
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -4,11 +4,6 @@ namespace Grocy\Controllers;
class CalendarApiController extends BaseApiController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function Ical(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
@@ -16,22 +11,29 @@ class CalendarApiController extends BaseApiController
$vCalendar = new \Eluceo\iCal\Component\Calendar('grocy');
$events = $this->getCalendarService()->GetEvents();
foreach($events as $event)
foreach ($events as $event)
{
$date = new \DateTime($event['start']);
$date->setTimezone(date_default_timezone_get());
$date->setTimezone(new \DateTimeZone(date_default_timezone_get()));
if ($event['date_format'] === 'date')
{
$date->setTime(23, 59, 59);
}
$description = '';
if (isset($event['description']))
{
$description = $event['description'];
}
$vEvent = new \Eluceo\iCal\Component\Event();
$vEvent->setDtStart($date)
->setDtEnd($date)
->setSummary($event['title'])
->setDescription($event['description'])
->setNoTime($event['date_format'] === 'date')
->setDescription($description)
->setNoTime($event['date_format'] === 'date' || (isset($event['allDay']) && $event['allDay']))
->setUseTimezone(true);
$vCalendar->addComponent($vEvent);
@@ -51,13 +53,18 @@ class CalendarApiController extends BaseApiController
{
try
{
return $this->ApiResponse($response, array(
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))
));
]);
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -4,15 +4,15 @@ namespace Grocy\Controllers;
class CalendarController extends BaseController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'calendar', [
'fullcalendarEventSources' => $this->getCalendarService()->GetEvents()
]);
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -2,77 +2,18 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
class ChoresApiController extends BaseApiController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function TrackChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$requestBody = $request->getParsedBody();
try
{
$trackedTime = date('Y-m-d H:i:s');
if (array_key_exists('tracked_time', $requestBody) && (IsIsoDateTime($requestBody['tracked_time']) || IsIsoDate($requestBody['tracked_time'])))
{
$trackedTime = $requestBody['tracked_time'];
}
$doneBy = GROCY_USER_ID;
if (array_key_exists('done_by', $requestBody) && !empty($requestBody['done_by']))
{
$doneBy = $requestBody['done_by'];
}
$choreExecutionId = $this->getChoresService()->TrackChore($args['choreId'], $trackedTime, $doneBy);
return $this->ApiResponse($response, $this->getDatabase()->chores_log($choreExecutionId));
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function ChoreDetails(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
return $this->ApiResponse($response, $this->getChoresService()->GetChoreDetails($args['choreId']));
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->ApiResponse($response, $this->getChoresService()->GetCurrent());
}
public function UndoChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
$this->ApiResponse($response, $this->getChoresService()->UndoChoreExecution($args['executionId']));
return $this->EmptyApiResponse($response);
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function CalculateNextExecutionAssignments(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
$requestBody = $request->getParsedBody();
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
$choreId = null;
if (array_key_exists('chore_id', $requestBody) && !empty($requestBody['chore_id']) && is_numeric($requestBody['chore_id']))
{
$choreId = intval($requestBody['chore_id']);
@@ -98,4 +39,77 @@ class ChoresApiController extends BaseApiController
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function ChoreDetails(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
return $this->ApiResponse($response, $this->getChoresService()->GetChoreDetails($args['choreId']));
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $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)
{
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
try
{
User::checkPermission($request, User::PERMISSION_CHORE_TRACK_EXECUTION);
$trackedTime = date('Y-m-d H:i:s');
if (array_key_exists('tracked_time', $requestBody) && (IsIsoDateTime($requestBody['tracked_time']) || IsIsoDate($requestBody['tracked_time'])))
{
$trackedTime = $requestBody['tracked_time'];
}
$doneBy = GROCY_USER_ID;
if (array_key_exists('done_by', $requestBody) && !empty($requestBody['done_by']))
{
$doneBy = $requestBody['done_by'];
}
if ($doneBy != GROCY_USER_ID)
{
User::checkPermission($request, User::PERMISSION_CHORE_TRACK_EXECUTION_EXECUTION);
}
$choreExecutionId = $this->getChoresService()->TrackChore($args['choreId'], $trackedTime, $doneBy);
return $this->ApiResponse($response, $this->getDatabase()->chores_log($choreExecutionId));
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function UndoChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
User::checkPermission($request, User::PERMISSION_CHORE_UNDO_EXECUTION);
$this->ApiResponse($response, $this->getChoresService()->UndoChoreExecution($args['executionId']));
return $this->EmptyApiResponse($response);
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -4,52 +4,6 @@ namespace Grocy\Controllers;
class ChoresController extends BaseController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$usersService = $this->getUsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['chores_due_soon_days'];
return $this->renderPage($response, 'choresoverview', [
'chores' => $this->getDatabase()->chores()->orderBy('name'),
'currentChores' => $this->getChoresService()->GetCurrent(),
'nextXDays' => $nextXDays,
'userfields' => $this->getUserfieldsService()->GetFields('chores'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('chores'),
'users' => $usersService->GetUsersAsDto()
]);
}
public function TrackChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'choretracking', [
'chores' => $this->getDatabase()->chores()->orderBy('name'),
'users' => $this->getDatabase()->users()->orderBy('username')
]);
}
public function ChoresList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'chores', [
'chores' => $this->getDatabase()->chores()->orderBy('name'),
'userfields' => $this->getUserfieldsService()->GetFields('chores'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('chores')
]);
}
public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'choresjournal', [
'choresLog' => $this->getDatabase()->chores_log()->orderBy('tracked_time', 'DESC'),
'chores' => $this->getDatabase()->chores()->orderBy('name'),
'users' => $this->getDatabase()->users()->orderBy('username')
]);
}
public function ChoreEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$usersService = $this->getUsersService();
@@ -63,25 +17,80 @@ class ChoresController extends BaseController
'userfields' => $this->getUserfieldsService()->GetFields('chores'),
'assignmentTypes' => GetClassConstants('\Grocy\Services\ChoresService', 'CHORE_ASSIGNMENT_TYPE_'),
'users' => $users,
'products' => $this->getDatabase()->products()->orderBy('name')
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE')
]);
}
else
{
return $this->renderPage($response, 'choreform', [
'chore' => $this->getDatabase()->chores($args['choreId']),
'chore' => $this->getDatabase()->chores($args['choreId']),
'periodTypes' => GetClassConstants('\Grocy\Services\ChoresService', 'CHORE_PERIOD_TYPE_'),
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('chores'),
'assignmentTypes' => GetClassConstants('\Grocy\Services\ChoresService', 'CHORE_ASSIGNMENT_TYPE_'),
'users' => $users,
'products' => $this->getDatabase()->products()->orderBy('name')
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE')
]);
}
}
public function ChoresList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if (isset($request->getQueryParams()['include_disabled']))
{
$chores = $this->getDatabase()->chores()->orderBy('name', 'COLLATE NOCASE');
}
else
{
$chores = $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
}
return $this->renderPage($response, 'chores', [
'chores' => $chores,
'userfields' => $this->getUserfieldsService()->GetFields('chores'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('chores')
]);
}
public function ChoresSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'choressettings');
}
public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'choresjournal', [
'choresLog' => $this->getDatabase()->chores_log()->orderBy('tracked_time', 'DESC'),
'chores' => $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'users' => $this->getDatabase()->users()->orderBy('username')
]);
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$usersService = $this->getUsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['chores_due_soon_days'];
return $this->renderPage($response, 'choresoverview', [
'chores' => $this->getDatabase()->chores()->orderBy('name', 'COLLATE NOCASE'),
'currentChores' => $this->getChoresService()->GetCurrent(),
'nextXDays' => $nextXDays,
'userfields' => $this->getUserfieldsService()->GetFields('chores'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('chores'),
'users' => $usersService->GetUsersAsDto()
]);
}
public function TrackChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'choretracking', [
'chores' => $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'users' => $this->getDatabase()->users()->orderBy('username')
]);
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -4,22 +4,8 @@ namespace Grocy\Controllers;
class EquipmentController extends BaseController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
protected $UserfieldsService;
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'equipment', [
'equipment' => $this->getDatabase()->equipment()->orderBy('name'),
'userfields' => $this->getUserfieldsService()->GetFields('equipment'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('equipment')
]);
}
public function EditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($args['equipmentId'] == 'new')
@@ -32,10 +18,24 @@ class EquipmentController extends BaseController
else
{
return $this->renderPage($response, 'equipmentform', [
'equipment' => $this->getDatabase()->equipment($args['equipmentId']),
'equipment' => $this->getDatabase()->equipment($args['equipmentId']),
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('equipment')
]);
}
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'equipment', [
'equipment' => $this->getDatabase()->equipment()->orderBy('name', 'COLLATE NOCASE'),
'userfields' => $this->getUserfieldsService()->GetFields('equipment'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('equipment')
]);
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace Grocy\Controllers;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Log\LoggerInterface;
use Slim\Exception\HttpException;
use Slim\Exception\HttpForbiddenException;
use Slim\Exception\HttpNotFoundException;
use Throwable;
class ExceptionController extends BaseApiController
{
/**
* @var \Slim\App
*/
private $app;
public function __construct(\Slim\App $app, \DI\Container $container)
{
parent::__construct($container);
$this->app = $app;
}
public function __invoke(ServerRequestInterface $request, Throwable $exception, bool $displayErrorDetails, bool $logErrors, bool $logErrorDetails, ?LoggerInterface $logger = null)
{
$response = $this->app->getResponseFactory()->createResponse();
$isApiRoute = string_starts_with($request->getUri()->getPath(), '/api/');
if (!defined('GROCY_AUTHENTICATED'))
{
define('GROCY_AUTHENTICATED', false);
}
if ($isApiRoute)
{
$status = 500;
if ($exception instanceof HttpException)
{
$status = $exception->getCode();
}
$data = [
'error_message' => $exception->getMessage()
];
if ($displayErrorDetails)
{
$data['error_details'] = [
'stack_trace' => $exception->getTraceAsString(),
'file' => $exception->getFile(),
'line' => $exception->getLine()
];
}
return $this->ApiResponse($response->withStatus($status)->withHeader('Content-Type', 'application/json'), $data);
}
if ($exception instanceof HttpNotFoundException)
{
define('GROCY_AUTHENTICATED', false);
return $this->renderPage($response->withStatus(404), 'errors/404', [
'exception' => $exception
]);
}
if ($exception instanceof HttpForbiddenException)
{
return $this->renderPage($response->withStatus(403), 'errors/403', [
'exception' => $exception
]);
}
return $this->renderPage($response->withStatus(500), 'errors/500', [
'exception' => $exception
]);
}
}

View File

@@ -2,97 +2,11 @@
namespace Grocy\Controllers;
use \Grocy\Services\FilesService;
use Grocy\Services\FilesService;
use Slim\Exception\HttpNotFoundException;
class FilesApiController extends BaseApiController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function UploadFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
if (IsValidFileName(base64_decode($args['fileName'])))
{
$fileName = base64_decode($args['fileName']);
}
else
{
throw new \Exception('Invalid filename');
}
$data = $request->getBody()->getContents();
file_put_contents($this->getFilesService()->GetFilePath($args['group'], $fileName), $data);
return $this->EmptyApiResponse($response);
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function ServeFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
if (IsValidFileName(base64_decode($args['fileName'])))
{
$fileName = base64_decode($args['fileName']);
}
else
{
throw new \Exception('Invalid filename');
}
$forceServeAs = null;
if (isset($request->getQueryParams()['force_serve_as']) && !empty($request->getQueryParams()['force_serve_as']))
{
$forceServeAs = $request->getQueryParams()['force_serve_as'];
}
if ($forceServeAs == FilesService::FILE_SERVE_TYPE_PICTURE)
{
$bestFitHeight = null;
if (isset($request->getQueryParams()['best_fit_height']) && !empty($request->getQueryParams()['best_fit_height']) && is_numeric($request->getQueryParams()['best_fit_height']))
{
$bestFitHeight = $request->getQueryParams()['best_fit_height'];
}
$bestFitWidth = null;
if (isset($request->getQueryParams()['best_fit_width']) && !empty($request->getQueryParams()['best_fit_width']) && is_numeric($request->getQueryParams()['best_fit_width']))
{
$bestFitWidth = $request->getQueryParams()['best_fit_width'];
}
$filePath = $this->getFilesService()->DownscaleImage($args['group'], $fileName, $bestFitHeight, $bestFitWidth);
}
else
{
$filePath = $this->getFilesService()->GetFilePath($args['group'], $fileName);
}
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 . '"');
}
else
{
return $this->GenericErrorResponse($response, 'File not found', 404);
}
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function DeleteFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
@@ -107,6 +21,7 @@ class FilesApiController extends BaseApiController
}
$filePath = $this->getFilesService()->GetFilePath($args['group'], $fileName);
if (file_exists($filePath))
{
unlink($filePath);
@@ -119,4 +34,139 @@ class FilesApiController extends BaseApiController
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function ServeFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
$fileName = $this->checkFileName($args['fileName']);
$filePath = $this->getFilePath($args['group'], $fileName, $request->getQueryParams());
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 . '"');
}
else
{
throw new HttpNotFoundException($request, 'File not found');
}
}
catch (\Exception $ex)
{
throw new HttpNotFoundException($request, $ex->getMessage(), $ex);
}
}
public function ShowFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
$fileInfo = explode('_', $args['fileName']);
$fileName = $this->checkFileName($fileInfo[1]);
$filePath = $this->getFilePath($args['group'], base64_decode($fileInfo[0]), $request->getQueryParams());
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 . '"');
}
else
{
throw new HttpNotFoundException($request, 'File not found');
}
}
catch (\Exception $ex)
{
throw new HttpNotFoundException($request, $ex->getMessage(), $ex);
}
}
public function UploadFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
$fileName = $this->checkFileName($args['fileName']);
$data = $request->getBody()->getContents();
file_put_contents($this->getFilesService()->GetFilePath($args['group'], $fileName), $data);
return $this->EmptyApiResponse($response);
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
/**
* @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)))
{
$fileName = base64_decode($fileName);
}
else
{
throw new \Exception('Invalid filename');
}
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;
if (isset($queryParams['force_serve_as']) && !empty($queryParams['force_serve_as']))
{
$forceServeAs = $queryParams['force_serve_as'];
}
if ($forceServeAs == FilesService::FILE_SERVE_TYPE_PICTURE)
{
$bestFitHeight = null;
if (isset($queryParams['best_fit_height']) && !empty($queryParams['best_fit_height']) && is_numeric($queryParams['best_fit_height']))
{
$bestFitHeight = $queryParams['best_fit_height'];
}
$bestFitWidth = null;
if (isset($queryParams['best_fit_width']) && !empty($queryParams['best_fit_width']) && is_numeric($queryParams['best_fit_width']))
{
$bestFitWidth = $queryParams['best_fit_width'];
}
$filePath = $this->getFilesService()->DownscaleImage($group, $fileName, $bestFitHeight, $bestFitWidth);
}
else
{
$filePath = $this->getFilesService()->GetFilePath($group, $fileName);
}
return $filePath;
}
}

View File

@@ -2,69 +2,23 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
use Slim\Exception\HttpBadRequestException;
class GenericEntityApiController extends BaseApiController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function GetObjects(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$objects = $this->getDatabase()->{$args['entity']}();
$allUserfields = $this->getUserfieldsService()->GetAllValues($args['entity']);
foreach ($objects as $object)
{
$userfields = FindAllObjectsInArrayByPropertyValue($allUserfields, 'object_id', $object->id);
$userfieldKeyValuePairs = null;
if (count($userfields) > 0)
{
foreach ($userfields as $userfield)
{
$userfieldKeyValuePairs[$userfield->name] = $userfield->value;
}
}
$object->userfields = $userfieldKeyValuePairs;
}
if ($this->IsValidEntity($args['entity']) && !$this->IsEntityWithPreventedListing($args['entity']))
{
return $this->ApiResponse($response, $objects);
}
else
{
return $this->GenericErrorResponse($response, 'Entity does not exist or is not exposed');
}
}
public function GetObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($this->IsValidEntity($args['entity']) && !$this->IsEntityWithPreventedListing($args['entity']))
{
$userfields = $this->getUserfieldsService()->GetValues($args['entity'], $args['objectId']);
if (count($userfields) === 0)
{
$userfields = null;
}
$object = $this->getDatabase()->{$args['entity']}($args['objectId']);
$object['userfields'] = $userfields;
return $this->ApiResponse($response, $object);
}
else
{
return $this->GenericErrorResponse($response, 'Entity does not exist or is not exposed');
}
}
public function AddObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($this->IsValidEntity($args['entity']))
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoEdit($args['entity']))
{
$requestBody = $request->getParsedBody();
if ($this->IsEntityWithEditRequiresAdmin($args['entity']))
{
User::checkPermission($request, User::PERMISSION_ADMIN);
}
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
try
{
@@ -76,38 +30,10 @@ class GenericEntityApiController extends BaseApiController
$newRow = $this->getDatabase()->{$args['entity']}()->createRow($requestBody);
$newRow->save();
$success = $newRow->isClean();
return $this->ApiResponse($response, array(
return $this->ApiResponse($response, [
'created_object_id' => $this->getDatabase()->lastInsertId()
));
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
else
{
return $this->GenericErrorResponse($response, 'Entity does not exist or is not exposed');
}
}
public function EditObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($this->IsValidEntity($args['entity']))
{
$requestBody = $request->getParsedBody();
try
{
if ($requestBody === null)
{
throw new \Exception('Request body could not be parsed (probably invalid JSON format or missing/wrong Content-Type header)');
}
$row = $this->getDatabase()->{$args['entity']}($args['objectId']);
$row->update($requestBody);
$success = $row->isClean();
return $this->EmptyApiResponse($response);
]);
}
catch (\Exception $ex)
{
@@ -122,30 +48,56 @@ class GenericEntityApiController extends BaseApiController
public function DeleteObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($this->IsValidEntity($args['entity']))
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoDelete($args['entity']))
{
if ($this->IsEntityWithEditRequiresAdmin($args['entity']))
{
User::checkPermission($request, User::PERMISSION_ADMIN);
}
$row = $this->getDatabase()->{$args['entity']}($args['objectId']);
$row->delete();
$success = $row->isClean();
return $this->EmptyApiResponse($response);
}
else
{
return $this->GenericErrorResponse($response, $ex->getMessage());
return $this->GenericErrorResponse($response, 'Invalid entity');
}
}
public function SearchObjects(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function EditObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($this->IsValidEntity($args['entity']) && !$this->IsEntityWithPreventedListing($args['entity']))
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoEdit($args['entity']))
{
if ($this->IsEntityWithEditRequiresAdmin($args['entity']))
{
User::checkPermission($request, User::PERMISSION_ADMIN);
}
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
try
{
return $this->ApiResponse($response, $this->getDatabase()->{$args['entity']}()->where('name LIKE ?', '%' . $args['searchString'] . '%'));
if ($requestBody === null)
{
throw new \Exception('Request body could not be parsed (probably invalid JSON format or missing/wrong Content-Type header)');
}
$row = $this->getDatabase()->{$args['entity']}($args['objectId']);
$row->update($requestBody);
$success = $row->isClean();
return $this->EmptyApiResponse($response);
}
catch (\PDOException $ex)
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, 'The given entity has no field "name"');
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
else
@@ -154,6 +106,65 @@ class GenericEntityApiController extends BaseApiController
}
}
public function GetObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $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
{
return $this->GenericErrorResponse($response, 'Entity does not exist or is not exposed');
}
}
public function GetObjects(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$objects = $this->queryData($this->getDatabase()->{$args['entity']}(), $request->getQueryParams());
$allUserfields = $this->getUserfieldsService()->GetAllValues($args['entity']);
foreach ($objects as $object)
{
$userfields = FindAllObjectsInArrayByPropertyValue($allUserfields, 'object_id', $object->id);
$userfieldKeyValuePairs = null;
if (count($userfields) > 0)
{
foreach ($userfields as $userfield)
{
$userfieldKeyValuePairs[$userfield->name] = $userfield->value;
}
}
$object->userfields = $userfieldKeyValuePairs;
}
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoListing($args['entity']))
{
return $this->ApiResponse($response, $objects);
}
else
{
return $this->GenericErrorResponse($response, 'Entity does not exist or is not exposed');
}
}
public function GetUserfields(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
@@ -168,7 +179,9 @@ class GenericEntityApiController extends BaseApiController
public function SetUserfields(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$requestBody = $request->getParsedBody();
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
try
{
@@ -186,13 +199,33 @@ class GenericEntityApiController extends BaseApiController
}
}
private function IsValidEntity($entity)
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
private function IsEntityWithEditRequiresAdmin($entity)
{
return in_array($entity, $this->getOpenApiSpec()->components->internalSchemas->ExposedEntityEditRequiresAdmin->enum);
}
private function IsEntityWithNoListing($entity)
{
return in_array($entity, $this->getOpenApiSpec()->components->internalSchemas->ExposedEntityNoListing->enum);
}
private function IsEntityWithNoEdit($entity)
{
return in_array($entity, $this->getOpenApiSpec()->components->internalSchemas->ExposedEntityNoEdit->enum);
}
private function IsEntityWithNoDelete($entity)
{
return in_array($entity, $this->getOpenApiSpec()->components->internalSchemas->ExposedEntityNoDelete->enum);
}
private function IsValidExposedEntity($entity)
{
return in_array($entity, $this->getOpenApiSpec()->components->internalSchemas->ExposedEntity->enum);
}
private function IsEntityWithPreventedListing($entity)
{
return !in_array($entity, $this->getOpenApiSpec()->components->internalSchemas->ExposedEntityButNoListing->enum);
}
}

View File

@@ -4,36 +4,28 @@ namespace Grocy\Controllers;
class GenericEntityController extends BaseController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function UserfieldsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'userfields', [
'userfields' => $this->getUserfieldsService()->GetAllFields(),
'entities' => $this->getUserfieldsService()->GetEntities()
]);
}
public function UserentitiesList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'userentities', [
'userentities' => $this->getDatabase()->userentities()->orderBy('name')
'userentities' => $this->getDatabase()->userentities()->orderBy('name', 'COLLATE NOCASE')
]);
}
public function UserobjectsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UserentityEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$userentity = $this->getDatabase()->userentities()->where('name = :1', $args['userentityName'])->fetch();
return $this->renderPage($response, 'userobjects', [
'userentity' => $userentity,
'userobjects' => $this->getDatabase()->userobjects()->where('userentity_id = :1', $userentity->id),
'userfields' => $this->getUserfieldsService()->GetFields('userentity-' . $args['userentityName']),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('userentity-' . $args['userentityName'])
]);
if ($args['userentityId'] == 'new')
{
return $this->renderPage($response, 'userentityform', [
'mode' => 'create'
]);
}
else
{
return $this->renderPage($response, 'userentityform', [
'mode' => 'edit',
'userentity' => $this->getDatabase()->userentities($args['userentityId'])
]);
}
}
public function UserfieldEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
@@ -50,28 +42,19 @@ class GenericEntityController extends BaseController
{
return $this->renderPage($response, 'userfieldform', [
'mode' => 'edit',
'userfield' => $this->getUserfieldsService()->GetField($args['userfieldId']),
'userfield' => $this->getUserfieldsService()->GetField($args['userfieldId']),
'userfieldTypes' => $this->getUserfieldsService()->GetFieldTypes(),
'entities' => $this->getUserfieldsService()->GetEntities()
]);
}
}
public function UserentityEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function UserfieldsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($args['userentityId'] == 'new')
{
return $this->renderPage($response, 'userentityform', [
'mode' => 'create'
]);
}
else
{
return $this->renderPage($response, 'userentityform', [
'mode' => 'edit',
'userentity' => $this->getDatabase()->userentities($args['userentityId'])
]);
}
return $this->renderPage($response, 'userfields', [
'userfields' => $this->getUserfieldsService()->GetAllFields(),
'entities' => $this->getUserfieldsService()->GetEntities()
]);
}
public function UserobjectEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
@@ -91,9 +74,26 @@ class GenericEntityController extends BaseController
return $this->renderPage($response, 'userobjectform', [
'userentity' => $userentity,
'mode' => 'edit',
'userobject' => $this->getDatabase()->userobjects($args['userobjectId']),
'userobject' => $this->getDatabase()->userobjects($args['userobjectId']),
'userfields' => $this->getUserfieldsService()->GetFields('userentity-' . $args['userentityName'])
]);
}
}
public function UserobjectsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$userentity = $this->getDatabase()->userentities()->where('name = :1', $args['userentityName'])->fetch();
return $this->renderPage($response, 'userobjects', [
'userentity' => $userentity,
'userobjects' => $this->getDatabase()->userobjects()->where('userentity_id = :1', $userentity->id),
'userfields' => $this->getUserfieldsService()->GetFields('userentity-' . $args['userentityName']),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('userentity-' . $args['userentityName'])
]);
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -2,47 +2,13 @@
namespace Grocy\Controllers;
use Grocy\Services\SessionService;
class LoginController extends BaseController
{
public function __construct(\DI\Container $container, string $sessionCookieName)
public function __construct(\DI\Container $container)
{
parent::__construct($container);
$this->SessionCookieName = $sessionCookieName;
}
protected $SessionCookieName;
public function ProcessLogin(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$postParams = $request->getParsedBody();
if (isset($postParams['username']) && isset($postParams['password']))
{
$user = $this->getDatabase()->users()->where('username', $postParams['username'])->fetch();
$inputPassword = $postParams['password'];
$stayLoggedInPermanently = $postParams['stay_logged_in'] == 'on';
if ($user !== null && password_verify($inputPassword, $user->password))
{
$sessionKey = $this->getSessionService()->CreateSession($user->id, $stayLoggedInPermanently);
setcookie($this->SessionCookieName, $sessionKey, PHP_INT_SIZE == 4 ? PHP_INT_MAX : PHP_INT_MAX>>32); // Cookie expires never, but session validity is up to SessionService
if (password_needs_rehash($user->password, PASSWORD_DEFAULT))
{
$user->update(array(
'password' => password_hash($inputPassword, PASSWORD_DEFAULT)
));
}
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl('/'));
}
else
{
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl('/login?invalid=true'));
}
}
else
{
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl('/login?invalid=true'));
}
}
public function LoginPage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
@@ -52,12 +18,20 @@ class LoginController extends BaseController
public function Logout(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$this->getSessionService()->RemoveSession($_COOKIE[$this->SessionCookieName]);
$this->getSessionService()->RemoveSession($_COOKIE[SessionService::SESSION_COOKIE_NAME]);
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl('/'));
}
public function GetSessionCookieName()
public function ProcessLogin(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->SessionCookieName;
$authMiddlewareClass = GROCY_AUTH_CLASS;
if ($authMiddlewareClass::ProcessLogin($this->GetParsedAndFilteredRequestBody($request)))
{
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl('/'));
}
else
{
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl('/login?invalid=true'));
}
}
}

View File

@@ -2,34 +2,19 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
class OpenApiController extends BaseApiController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function DocumentationUi(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->render($response, 'openapiui');
}
public function DocumentationSpec(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$applicationService = $this->getApplicationService();
$versionInfo = $applicationService->GetInstalledVersion();
$this->getOpenApiSpec()->info->version = $versionInfo->Version;
$this->getOpenApiSpec()->info->description = str_replace('PlaceHolderManageApiKeysUrl', $this->AppContainer->get('UrlManager')->ConstructUrl('/manageapikeys'), $this->getOpenApiSpec()->info->description);
$this->getOpenApiSpec()->servers[0]->url = $this->AppContainer->get('UrlManager')->ConstructUrl('/api');
return $this->ApiResponse($response, $this->getOpenApiSpec());
}
public function ApiKeysList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$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' => $this->getDatabase()->api_keys(),
'apiKeys' => $apiKeys,
'users' => $this->getDatabase()->users()
]);
}
@@ -40,4 +25,54 @@ class OpenApiController extends BaseApiController
$newApiKeyId = $this->getApiKeyService()->GetApiKeyId($newApiKey);
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl("/manageapikeys?CreatedApiKeyId=$newApiKeyId"));
}
public function DocumentationSpec(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$spec = $this->getOpenApiSpec();
$applicationService = $this->getApplicationService();
$versionInfo = $applicationService->GetInstalledVersion();
$spec->info->version = $versionInfo->Version;
$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->internalSchemas->ExposedEntity_NotIncludingNotEditable = clone $spec->components->internalSchemas->StringEnumTemplate;
foreach ($spec->components->internalSchemas->ExposedEntity->enum as $value)
{
if (!in_array($value, $spec->components->internalSchemas->ExposedEntityNoEdit->enum))
{
array_push($spec->components->internalSchemas->ExposedEntity_NotIncludingNotEditable->enum, $value);
}
}
$spec->components->internalSchemas->ExposedEntity_NotIncludingNotDeletable = clone $spec->components->internalSchemas->StringEnumTemplate;
foreach ($spec->components->internalSchemas->ExposedEntity->enum as $value)
{
if (!in_array($value, $spec->components->internalSchemas->ExposedEntityNoDelete->enum))
{
array_push($spec->components->internalSchemas->ExposedEntity_NotIncludingNotDeletable->enum, $value);
}
}
$spec->components->internalSchemas->ExposedEntity_NotIncludingNotListable = clone $spec->components->internalSchemas->StringEnumTemplate;
foreach ($spec->components->internalSchemas->ExposedEntity->enum as $value)
{
if (!in_array($value, $spec->components->internalSchemas->ExposedEntityNoListing->enum))
{
array_push($spec->components->internalSchemas->ExposedEntity_NotIncludingNotListable->enum, $value);
}
}
return $this->ApiResponse($response, $spec);
}
public function DocumentationUi(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->render($response, 'openapiui');
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -2,16 +2,15 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
class RecipesApiController extends BaseApiController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function AddNotFulfilledProductsToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$requestBody = $request->getParsedBody();
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
$excludedProductIds = null;
if ($requestBody !== null && array_key_exists('excludedProductIds', $requestBody))
@@ -25,6 +24,8 @@ class RecipesApiController extends BaseApiController
public function ConsumeRecipe(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
User::checkPermission($request, User::PERMISSION_STOCK_CONSUME);
try
{
$this->getRecipesService()->ConsumeRecipe($args['recipeId']);
@@ -40,13 +41,14 @@ class RecipesApiController extends BaseApiController
{
try
{
if(!isset($args['recipeId']))
if (!isset($args['recipeId']))
{
return $this->ApiResponse($response, $this->getRecipesService()->GetRecipesResolved());
return $this->FilteredApiResponse($response, $this->getRecipesService()->GetRecipesResolved(), $request->getQueryParams());
}
$recipeResolved = FindObjectInArrayByPropertyValue($this->getRecipesService()->GetRecipesResolved(), 'recipe_id', $args['recipeId']);
if(!$recipeResolved)
if (!$recipeResolved)
{
throw new \Exception('Recipe does not exist');
}
@@ -60,4 +62,9 @@ class RecipesApiController extends BaseApiController
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -2,81 +2,123 @@
namespace Grocy\Controllers;
use \Grocy\Services\RecipesService;
use Grocy\Services\RecipesService;
class RecipesController extends BaseController
{
public function __construct(\DI\Container $container)
public function MealPlan(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
parent::__construct($container);
$recipes = $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->fetchAll();
$events = [];
foreach ($this->getDatabase()->meal_plan() as $mealPlanEntry)
{
$recipe = FindObjectInArrayByPropertyValue($recipes, 'id', $mealPlanEntry['recipe_id']);
$title = '';
if ($recipe !== null)
{
$title = $recipe->name;
}
$productDetails = null;
if ($mealPlanEntry['product_id'] !== null)
{
$productDetails = $this->getStockService()->GetProductDetails($mealPlanEntry['product_id']);
}
$events[] = [
'id' => $mealPlanEntry['id'],
'title' => $title,
'start' => $mealPlanEntry['day'],
'date_format' => 'date',
'recipe' => json_encode($recipe),
'mealPlanEntry' => json_encode($mealPlanEntry),
'type' => $mealPlanEntry['type'],
'productDetails' => json_encode($productDetails)
];
}
return $this->renderPage($response, 'mealplan', [
'fullcalendarEventSources' => $events,
'recipes' => $recipes,
'internalRecipes' => $this->getDatabase()->recipes()->whereNot('type', RecipesService::RECIPE_TYPE_NORMAL)->fetchAll(),
'recipesResolved' => $this->getRecipesService()->GetRecipesResolved(),
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
]);
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$recipes = $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name');
$recipes = $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name', 'COLLATE NOCASE');
$recipesResolved = $this->getRecipesService()->GetRecipesResolved();
$selectedRecipe = null;
$selectedRecipePositionsResolved = null;
if (isset($request->getQueryParams()['recipe']))
{
$selectedRecipe = $this->getDatabase()->recipes($request->getQueryParams()['recipe']);
$selectedRecipePositionsResolved = $this->getDatabase()->recipes_pos_resolved()->where('recipe_id = :1 AND is_nested_recipe_pos = 0', $request->getQueryParams()['recipe'])->orderBy('ingredient_group', 'ASC', 'product_group', 'ASC');
}
else
{
foreach ($recipes as $recipe)
{
$selectedRecipe = $recipe;
$selectedRecipePositionsResolved = $this->getDatabase()->recipes_pos_resolved()->where('recipe_id = :1 AND is_nested_recipe_pos = 0', $recipe->id)->orderBy('ingredient_group', 'ASC', 'product_group', 'ASC');
break;
}
}
$selectedRecipePositionsResolved = null;
$totalCosts = null;
$totalCalories = null;
if ($selectedRecipe)
{
$selectedRecipeSubRecipes = $this->getDatabase()->recipes()->where('id IN (SELECT includes_recipe_id FROM recipes_nestings_resolved WHERE recipe_id = :1 AND includes_recipe_id != :1)', $selectedRecipe->id)->orderBy('name')->fetchAll();
$selectedRecipeSubRecipesPositions = $this->getDatabase()->recipes_pos_resolved()->where('recipe_id = :1', $selectedRecipe->id)->orderBy('ingredient_group', 'ASC', 'product_group', 'ASC')->fetchAll();
$selectedRecipePositionsResolved = $this->getDatabase()->recipes_pos_resolved()->where('recipe_id = :1 AND is_nested_recipe_pos = 0', $selectedRecipe->id)->orderBy('ingredient_group', 'ASC', 'product_group', 'ASC');
$totalCosts = FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $selectedRecipe->id)->costs;
$totalCalories = FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $selectedRecipe->id)->calories;
}
$includedRecipeIdsAbsolute = array();
$renderArray = [
'recipes' => $recipes,
'recipesResolved' => $recipesResolved,
'recipePositionsResolved' => $this->getDatabase()->recipes_pos_resolved()->where('recipe_type', RecipesService::RECIPE_TYPE_NORMAL),
'selectedRecipe' => $selectedRecipe,
'selectedRecipePositionsResolved' => $selectedRecipePositionsResolved,
'products' => $this->getDatabase()->products(),
'quantityUnits' => $this->getDatabase()->quantity_units(),
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('recipes'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'selectedRecipeTotalCosts' => $totalCosts,
'selectedRecipeTotalCalories' => $totalCalories
];
if ($selectedRecipe)
{
$selectedRecipeSubRecipes = $this->getDatabase()->recipes()->where('id IN (SELECT includes_recipe_id FROM recipes_nestings_resolved WHERE recipe_id = :1 AND includes_recipe_id != :1)', $selectedRecipe->id)->orderBy('name', 'COLLATE NOCASE')->fetchAll();
$includedRecipeIdsAbsolute = [];
$includedRecipeIdsAbsolute[] = $selectedRecipe->id;
foreach($selectedRecipeSubRecipes as $subRecipe)
foreach ($selectedRecipeSubRecipes as $subRecipe)
{
$includedRecipeIdsAbsolute[] = $subRecipe->id;
}
$renderArray = [
'recipes' => $recipes,
'recipesResolved' => $recipesResolved,
'recipePositionsResolved' => $this->getDatabase()->recipes_pos_resolved()->where('recipe_type', RecipesService::RECIPE_TYPE_NORMAL),
'selectedRecipe' => $selectedRecipe,
'selectedRecipePositionsResolved' => $selectedRecipePositionsResolved,
'products' => $this->getDatabase()->products(),
'quantityUnits' => $this->getDatabase()->quantity_units(),
'selectedRecipeSubRecipes' => $selectedRecipeSubRecipes,
'selectedRecipeSubRecipesPositions' => $selectedRecipeSubRecipesPositions,
'includedRecipeIdsAbsolute' => $includedRecipeIdsAbsolute,
'selectedRecipeTotalCosts' => FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $selectedRecipe->id)->costs,
'selectedRecipeTotalCalories' => FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $selectedRecipe->id)->calories,
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('recipes'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
];
}
else
{
$renderArray = [
'recipes' => $recipes,
'recipesResolved' => $recipesResolved,
'recipePositionsResolved' => $this->getDatabase()->recipes_pos_resolved()->where('recipe_type', RecipesService::RECIPE_TYPE_NORMAL),
'selectedRecipe' => $selectedRecipe,
'selectedRecipePositionsResolved' => $selectedRecipePositionsResolved,
'products' => $this->getDatabase()->products(),
'quantityUnits' => $this->getDatabase()->quantity_units(),
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('recipes'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
];
$allRecipePositions = [];
foreach ($includedRecipeIdsAbsolute as $id)
{
$allRecipePositions[$id] = $this->getDatabase()->recipes_pos_resolved()->where('recipe_id = :1 AND is_nested_recipe_pos = 0', $id)->orderBy('ingredient_group', 'ASC', 'product_group', 'ASC');
}
$renderArray['selectedRecipeSubRecipes'] = $selectedRecipeSubRecipes;
$renderArray['includedRecipeIdsAbsolute'] = $includedRecipeIdsAbsolute;
$renderArray['allRecipePositions'] = $allRecipePositions;
}
return $this->renderPage($response, 'recipes', $renderArray);
@@ -85,26 +127,17 @@ class RecipesController extends BaseController
public function RecipeEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$recipeId = $args['recipeId'];
if ($recipeId == 'new')
{
$newRecipe = $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->createRow(array(
'name' => $this->getLocalizationService()->__t('New recipe')
));
$newRecipe->save();
$recipeId = $this->getDatabase()->lastInsertId();
}
return $this->renderPage($response, 'recipeform', [
'recipe' => $this->getDatabase()->recipes($recipeId),
'recipePositions' => $this->getDatabase()->recipes_pos()->where('recipe_id', $recipeId),
'mode' => 'edit',
'products' => $this->getDatabase()->products()->orderBy('name'),
'recipe' => $this->getDatabase()->recipes($recipeId),
'recipePositions' => $this->getDatabase()->recipes_pos()->where('recipe_id', $recipeId),
'mode' => $recipeId == 'new' ? 'create' : 'edit',
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
'quantityunits' => $this->getDatabase()->quantity_units(),
'recipePositionsResolved' => $this->getRecipesService()->GetRecipesPosResolved(),
'recipesResolved' => $this->getRecipesService()->GetRecipesResolved(),
'recipes' => $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name'),
'recipeNestings' => $this->getDatabase()->recipes_nestings()->where('recipe_id', $recipeId),
'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()
]);
@@ -118,8 +151,8 @@ class RecipesController extends BaseController
'mode' => 'create',
'recipe' => $this->getDatabase()->recipes($args['recipeId']),
'recipePos' => new \stdClass(),
'products' => $this->getDatabase()->products()->orderBy('name'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
]);
}
@@ -127,10 +160,10 @@ class RecipesController extends BaseController
{
return $this->renderPage($response, 'recipeposform', [
'mode' => 'edit',
'recipe' => $this->getDatabase()->recipes($args['recipeId']),
'recipe' => $this->getDatabase()->recipes($args['recipeId']),
'recipePos' => $this->getDatabase()->recipes_pos($args['recipePosId']),
'products' => $this->getDatabase()->products()->orderBy('name'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
]);
}
@@ -141,46 +174,8 @@ class RecipesController extends BaseController
return $this->renderPage($response, 'recipessettings');
}
public function MealPlan(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function __construct(\DI\Container $container)
{
$recipes = $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->fetchAll();
$events = array();
foreach($this->getDatabase()->meal_plan() as $mealPlanEntry)
{
$recipe = FindObjectInArrayByPropertyValue($recipes, 'id', $mealPlanEntry['recipe_id']);
$title = '';
if ($recipe !== null)
{
$title = $recipe->name;
}
$productDetails = null;
if ($mealPlanEntry['product_id'] !== null)
{
$productDetails = $this->getStockService()->GetProductDetails($mealPlanEntry['product_id']);
}
$events[] = array(
'id' => $mealPlanEntry['id'],
'title' => $title,
'start' => $mealPlanEntry['day'],
'date_format' => 'date',
'recipe' => json_encode($recipe),
'mealPlanEntry' => json_encode($mealPlanEntry),
'type' => $mealPlanEntry['type'],
'productDetails' => json_encode($productDetails)
);
}
return $this->renderPage($response, 'mealplan', [
'fullcalendarEventSources' => $events,
'recipes' => $recipes,
'internalRecipes' => $this->getDatabase()->recipes()->whereNot('type', RecipesService::RECIPE_TYPE_NORMAL)->fetchAll(),
'recipesResolved' => $this->getRecipesService()->GetRecipesResolved(),
'products' => $this->getDatabase()->products()->orderBy('name'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
]);
parent::__construct($container);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,211 +2,57 @@
namespace Grocy\Controllers;
use Grocy\Services\RecipesService;
class StockController extends BaseController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$usersService = $this->getUsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['stock_expring_soon_days'];
return $this->renderPage($response, 'stockoverview', [
'products' => $this->getDatabase()->products()->orderBy('name'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'locations' => $this->getDatabase()->locations()->orderBy('name'),
'currentStock' => $this->getStockService()->GetCurrentStock(true),
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
'missingProducts' => $this->getStockService()->GetMissingProducts(),
'nextXDays' => $nextXDays,
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name'),
'userfields' => $this->getUserfieldsService()->GetFields('products'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('products'),
'shoppingListItems' => $this->getDatabase()->shopping_list(),
]);
}
public function Stockentries(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$usersService = $this->getUsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['stock_expring_soon_days'];
return $this->renderPage($response, 'stockentries', [
'products' => $this->getDatabase()->products()->orderBy('name'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'locations' => $this->getDatabase()->locations()->orderBy('name'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name'),
'stockEntries' => $this->getDatabase()->stock()->orderBy('product_id'),
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
'nextXDays' => $nextXDays,
'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)
{
return $this->renderPage($response, 'purchase', [
'products' => $this->getDatabase()->products()->orderBy('name'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name'),
'locations' => $this->getDatabase()->locations()->orderBy('name')
]);
}
public function Consume(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'consume', [
'products' => $this->getDatabase()->products()->orderBy('name'),
'recipes' => $this->getDatabase()->recipes()->orderBy('name'),
'locations' => $this->getDatabase()->locations()->orderBy('name')
]);
}
public function Transfer(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'transfer', [
'products' => $this->getDatabase()->products()->orderBy('name'),
'recipes' => $this->getDatabase()->recipes()->orderBy('name'),
'locations' => $this->getDatabase()->locations()->orderBy('name')
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name'),
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
'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()
]);
}
public function Inventory(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'inventory', [
'products' => $this->getDatabase()->products()->orderBy('name'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name'),
'locations' => $this->getDatabase()->locations()->orderBy('name')
'products' => $this->getDatabase()->products()->where('active = 1')->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()
]);
}
public function StockEntryEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'stockentryform', [
'stockEntry' => $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch(),
'products' => $this->getDatabase()->products()->orderBy('name'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name'),
'locations' => $this->getDatabase()->locations()->orderBy('name')
$usersService = $this->getUsersService();
return $this->renderPage($response, 'stockjournal', [
'stockLog' => $this->getDatabase()->uihelper_stock_journal()->orderBy('row_created_timestamp', 'DESC'),
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'users' => $usersService->GetUsersAsDto(),
'transactionTypes' => GetClassConstants('\Grocy\Services\StockService', 'TRANSACTION_TYPE_'),
]);
}
public function ShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function LocationContentSheet(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$listId = 1;
if (isset($request->getQueryParams()['list']))
{
$listId = $request->getQueryParams()['list'];
}
return $this->renderPage($response, 'shoppinglist', [
'listItems' => $this->getDatabase()->shopping_list()->where('shopping_list_id = :1', $listId),
'products' => $this->getDatabase()->products()->orderBy('name'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'missingProducts' => $this->getStockService()->GetMissingProducts(),
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name'),
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name'),
'selectedShoppingListId' => $listId,
'userfields' => $this->getUserfieldsService()->GetFields('products'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('products')
return $this->renderPage($response, 'locationcontentsheet', [
'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'),
'currentStockLocationContent' => $this->getStockService()->GetCurrentStockLocationContent()
]);
}
public function ProductsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'products', [
'products' => $this->getDatabase()->products()->orderBy('name'),
'locations' => $this->getDatabase()->locations()->orderBy('name'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name'),
'userfields' => $this->getUserfieldsService()->GetFields('products'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('products')
]);
}
public function StockSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'stocksettings', [
'locations' => $this->getDatabase()->locations()->orderBy('name'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name')
]);
}
public function LocationsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'locations', [
'locations' => $this->getDatabase()->locations()->orderBy('name'),
'userfields' => $this->getUserfieldsService()->GetFields('locations'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('locations')
]);
}
public function ShoppingLocationsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'shoppinglocations', [
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name'),
'userfields' => $this->getUserfieldsService()->GetFields('shopping_locations'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('shopping_locations')
]);
}
public function ProductGroupsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'productgroups', [
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name'),
'products' => $this->getDatabase()->products()->orderBy('name'),
'userfields' => $this->getUserfieldsService()->GetFields('product_groups'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('product_groups')
]);
}
public function QuantityUnitsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'quantityunits', [
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'userfields' => $this->getUserfieldsService()->GetFields('quantity_units'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('quantity_units')
]);
}
public function ProductEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($args['productId'] == 'new')
{
return $this->renderPage($response, 'productform', [
'locations' => $this->getDatabase()->locations()->orderBy('name'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name'),
'productgroups' => $this->getDatabase()->product_groups()->orderBy('name'),
'userfields' => $this->getUserfieldsService()->GetFields('products'),
'products' => $this->getDatabase()->products()->where('parent_product_id IS NULL')->orderBy('name'),
'isSubProductOfOthers' => false,
'mode' => 'create'
]);
}
else
{
$product = $this->getDatabase()->products($args['productId']);
return $this->renderPage($response, 'productform', [
'product' => $product,
'locations' => $this->getDatabase()->locations()->orderBy('name'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name'),
'productgroups' => $this->getDatabase()->product_groups()->orderBy('name'),
'userfields' => $this->getUserfieldsService()->GetFields('products'),
'products' => $this->getDatabase()->products()->where('id != :1 AND parent_product_id IS NULL', $product->id)->orderBy('name'),
'isSubProductOfOthers' => $this->getDatabase()->products()->where('parent_product_id = :1', $product->id)->count() !== 0,
'mode' => 'edit',
'quConversions' => $this->getDatabase()->quantity_unit_conversions()
]);
}
}
public function LocationEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($args['locationId'] == 'new')
@@ -219,28 +65,107 @@ class StockController extends BaseController
else
{
return $this->renderPage($response, 'locationform', [
'location' => $this->getDatabase()->locations($args['locationId']),
'location' => $this->getDatabase()->locations($args['locationId']),
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('locations')
]);
}
}
public function ShoppingLocationEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function LocationsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($args['shoppingLocationId'] == 'new')
return $this->renderPage($response, 'locations', [
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'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)
{
$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'),
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
'nextXDays' => $nextXDays,
'productGroups' => $this->getDatabase()->product_groups()->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)
{
$product = null;
if (isset($request->getQueryParams()['product']))
{
return $this->renderPage($response, 'shoppinglocationform', [
$product = $this->getDatabase()->products($request->getQueryParams()['product']);
}
if ($args['productBarcodeId'] == 'new')
{
return $this->renderPage($response, 'productbarcodeform', [
'mode' => 'create',
'userfields' => $this->getUserfieldsService()->GetFields('shopping_locations')
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
'product' => $product,
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'userfields' => $this->getUserfieldsService()->GetFields('product_barcodes')
]);
}
else
{
return $this->renderPage($response, 'shoppinglocationform', [
'shoppinglocation' => $this->getDatabase()->shopping_locations($args['shoppingLocationId']),
return $this->renderPage($response, 'productbarcodeform', [
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('shopping_locations')
'barcode' => $this->getDatabase()->product_barcodes($args['productBarcodeId']),
'product' => $product,
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'quantityUnitConversionsResolved' => $this->getDatabase()->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)
{
if ($args['productId'] == 'new')
{
return $this->renderPage($response, 'productform', [
'locations' => $this->getDatabase()->locations()->orderBy('name'),
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
'quantityunits' => $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'),
'userfields' => $this->getUserfieldsService()->GetFields('products'),
'products' => $this->getDatabase()->products()->where('parent_product_id IS NULL and active = 1')->orderBy('name', 'COLLATE NOCASE'),
'isSubProductOfOthers' => false,
'mode' => 'create'
]);
}
else
{
$product = $this->getDatabase()->products($args['productId']);
return $this->renderPage($response, 'productform', [
'product' => $product,
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
'quantityunits' => $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'),
'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(),
'productBarcodeUserfields' => $this->getUserfieldsService()->GetFields('product_barcodes'),
'productBarcodeUserfieldValues' => $this->getUserfieldsService()->GetAllValues('product_barcodes')
]);
}
}
@@ -257,13 +182,96 @@ class StockController extends BaseController
else
{
return $this->renderPage($response, 'productgroupform', [
'group' => $this->getDatabase()->product_groups($args['productGroupId']),
'group' => $this->getDatabase()->product_groups($args['productGroupId']),
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('product_groups')
]);
}
}
public function ProductGroupsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'productgroups', [
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE'),
'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)
{
if (isset($request->getQueryParams()['include_disabled']))
{
$products = $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE');
}
else
{
$products = $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
}
return $this->renderPage($response, 'products', [
'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'),
'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)
{
return $this->renderPage($response, 'purchase', [
'products' => $this->getDatabase()->products()->where('active = 1')->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()
]);
}
public function QuantityUnitConversionEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$product = null;
if (isset($request->getQueryParams()['product']))
{
$product = $this->getDatabase()->products($request->getQueryParams()['product']);
}
$defaultQuUnit = null;
if (isset($request->getQueryParams()['qu-unit']))
{
$defaultQuUnit = $this->getDatabase()->quantity_units($request->getQueryParams()['qu-unit']);
}
if ($args['quConversionId'] == 'new')
{
return $this->renderPage($response, 'quantityunitconversionform', [
'mode' => 'create',
'userfields' => $this->getUserfieldsService()->GetFields('quantity_unit_conversions'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'product' => $product,
'defaultQuUnit' => $defaultQuUnit
]);
}
else
{
return $this->renderPage($response, 'quantityunitconversionform', [
'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'),
'product' => $product,
'defaultQuUnit' => $defaultQuUnit
]);
}
}
public function QuantityUnitEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($args['quantityunitId'] == 'new')
@@ -280,7 +288,7 @@ class StockController extends BaseController
$quantityUnit = $this->getDatabase()->quantity_units($args['quantityunitId']);
return $this->renderPage($response, 'quantityunitform', [
'quantityUnit' => $quantityUnit,
'quantityUnit' => $quantityUnit,
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('quantity_units'),
'pluralCount' => $this->getLocalizationService()->GetPluralCount(),
@@ -291,25 +299,44 @@ class StockController extends BaseController
}
}
public function ShoppingListItemEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function QuantityUnitPluralFormTesting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($args['itemId'] == 'new')
return $this->renderPage($response, 'quantityunitpluraltesting', [
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE')
]);
}
public function QuantityUnitsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'quantityunits', [
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
'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)
{
$listId = 1;
if (isset($request->getQueryParams()['list']))
{
return $this->renderPage($response, 'shoppinglistitemform', [
'products' => $this->getDatabase()->products()->orderBy('name'),
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name'),
'mode' => 'create'
]);
}
else
{
return $this->renderPage($response, 'shoppinglistitemform', [
'listItem' => $this->getDatabase()->shopping_list($args['itemId']),
'products' => $this->getDatabase()->products()->orderBy('name'),
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name'),
'mode' => 'edit'
]);
$listId = $request->getQueryParams()['list'];
}
return $this->renderPage($response, 'shoppinglist', [
'listItems' => $this->getDatabase()->uihelper_shopping_list()->where('shopping_list_id = :1', $listId),
'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'),
'selectedShoppingListId' => $listId,
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
'productUserfields' => $this->getUserfieldsService()->GetFields('products'),
'productUserfieldValues' => $this->getUserfieldsService()->GetAllValues('products'),
'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)
@@ -317,14 +344,43 @@ class StockController extends BaseController
if ($args['listId'] == 'new')
{
return $this->renderPage($response, 'shoppinglistform', [
'mode' => 'create'
'mode' => 'create',
'userfields' => $this->getUserfieldsService()->GetFields('shopping_lists')
]);
}
else
{
return $this->renderPage($response, 'shoppinglistform', [
'shoppingList' => $this->getDatabase()->shopping_lists($args['listId']),
'mode' => 'edit'
'shoppingList' => $this->getDatabase()->shopping_lists($args['listId']),
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('shopping_lists')
]);
}
}
public function ShoppingListItemEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($args['itemId'] == 'new')
{
return $this->renderPage($response, 'shoppinglistitemform', [
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'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(),
'userfields' => $this->getUserfieldsService()->GetFields('shopping_list')
]);
}
else
{
return $this->renderPage($response, 'shoppinglistitemform', [
'listItem' => $this->getDatabase()->shopping_list($args['itemId']),
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'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(),
'userfields' => $this->getUserfieldsService()->GetFields('shopping_list')
]);
}
}
@@ -334,67 +390,109 @@ class StockController extends BaseController
return $this->renderPage($response, 'shoppinglistsettings');
}
public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ShoppingLocationEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'stockjournal', [
'stockLog' => $this->getDatabase()->stock_log()->orderBy('row_created_timestamp', 'DESC'),
'locations' => $this->getDatabase()->locations()->orderBy('name'),
'products' => $this->getDatabase()->products()->orderBy('name'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name')
]);
}
public function LocationContentSheet(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'locationcontentsheet', [
'products' => $this->getDatabase()->products()->orderBy('name'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'locations' => $this->getDatabase()->locations()->orderBy('name'),
'currentStockLocationContent' => $this->getStockService()->GetCurrentStockLocationContent()
]);
}
public function QuantityUnitConversionEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$product = null;
if (isset($request->getQueryParams()['product']))
if ($args['shoppingLocationId'] == 'new')
{
$product = $this->getDatabase()->products($request->getQueryParams()['product']);
}
$defaultQuUnit = null;
if (isset($request->getQueryParams()['qu-unit']))
{
$defaultQuUnit = $this->getDatabase()->quantity_units($request->getQueryParams()['qu-unit']);
}
if ($args['quConversionId'] == 'new')
{
return $this->renderPage($response, 'quantityunitconversionform', [
return $this->renderPage($response, 'shoppinglocationform', [
'mode' => 'create',
'userfields' => $this->getUserfieldsService()->GetFields('quantity_unit_conversions'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'product' => $product,
'defaultQuUnit' => $defaultQuUnit
'userfields' => $this->getUserfieldsService()->GetFields('shopping_locations')
]);
}
else
{
return $this->renderPage($response, 'quantityunitconversionform', [
'quConversion' => $this->getDatabase()->quantity_unit_conversions($args['quConversionId']),
return $this->renderPage($response, 'shoppinglocationform', [
'shoppinglocation' => $this->getDatabase()->shopping_locations($args['shoppingLocationId']),
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('quantity_unit_conversions'),
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
'product' => $product,
'defaultQuUnit' => $defaultQuUnit
'userfields' => $this->getUserfieldsService()->GetFields('shopping_locations')
]);
}
}
public function QuantityUnitPluralFormTesting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function ShoppingLocationsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'quantityunitpluraltesting', [
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name')
return $this->renderPage($response, 'shoppinglocations', [
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
'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)
{
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')
]);
}
public function StockSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $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')
]);
}
public function Stockentries(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $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'),
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
'nextXDays' => $nextXDays,
'userfields' => $this->getUserfieldsService()->GetFields('products'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('products')
]);
}
public function Transfer(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'transfer', [
'products' => $this->getDatabase()->products()->where('active = 1')->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()
]);
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function JournalSummary(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$entries = $this->getDatabase()->uihelper_stock_journal_summary();
if (isset($request->getQueryParams()['product_id']))
{
$entries = $entries->where('product_id', $request->getQueryParams()['product_id']);
}
if (isset($request->getQueryParams()['user_id']))
{
$entries = $entries->where('user_id', $request->getQueryParams()['user_id']);
}
if (isset($request->getQueryParams()['transaction_type']))
{
$entries = $entries->where('transaction_type', $request->getQueryParams()['transaction_type']);
}
$usersService = $this->getUsersService();
return $this->renderPage($response, 'stockjournalsummary', [
'entries' => $entries,
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'users' => $usersService->GetUsersAsDto(),
'transactionTypes' => GetClassConstants('\Grocy\Services\StockService', 'TRANSACTION_TYPE_')
]);
}
}

View File

@@ -4,18 +4,6 @@ namespace Grocy\Controllers;
class SystemApiController extends BaseApiController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function GetDbChangedTime(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->ApiResponse($response, array(
'changed_time' => $this->getDatabaseService()->GetDbChangedTime()
));
}
public function GetConfig(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
@@ -23,12 +11,10 @@ class SystemApiController extends BaseApiController
$constants = get_defined_constants();
// Some GROCY_* constants are not really config settings and therefore should not be exposed
unset($constants['GROCY_AUTHENTICATED']);
unset($constants['GROCY_DATAPATH']);
unset($constants['GROCY_IS_EMBEDDED_INSTALL']);
unset($constants['GROCY_USER_ID']);
unset($constants['GROCY_AUTHENTICATED'], $constants['GROCY_DATAPATH'], $constants['GROCY_IS_EMBEDDED_INSTALL'], $constants['GROCY_USER_ID']);
$returnArray = [];
$returnArray = array();
foreach ($constants as $constant => $value)
{
if (substr($constant, 0, 6) === 'GROCY_')
@@ -45,13 +31,25 @@ class SystemApiController extends BaseApiController
}
}
public function GetDbChangedTime(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $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)
{
return $this->ApiResponse($response, $this->getApplicationService()->GetSystemInfo());
}
public function LogMissingLocalization(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if (GROCY_MODE === 'dev')
{
try
{
$requestBody = $request->getParsedBody();
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
$this->getLocalizationService()->CheckAndAddMissingTranslationToPot($requestBody['text']);
return $this->EmptyApiResponse($response);
@@ -63,8 +61,8 @@ class SystemApiController extends BaseApiController
}
}
public function GetSystemInfo(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function __construct(\DI\Container $container)
{
return $this->ApiResponse($response, $this->getApplicationService()->GetSystemInfo());
parent::__construct($container);
}
}

View File

@@ -2,15 +2,22 @@
namespace Grocy\Controllers;
use \Grocy\Services\DatabaseMigrationService;
use \Grocy\Services\DemoDataGeneratorService;
use Grocy\Services\DatabaseMigrationService;
use Grocy\Services\DemoDataGeneratorService;
class SystemController extends BaseController
{
public function __construct(\DI\Container $container)
public function About(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
parent::__construct($container);
return $this->renderPage($response, 'about', [
'system_info' => $this->getApplicationService()->GetSystemInfo(),
'changelog' => $this->getApplicationService()->GetChangelog()
]);
}
public function BarcodeScannerTesting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'barcodescannertesting');
}
public function Root(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
@@ -28,6 +35,11 @@ class SystemController extends BaseController
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl($this->GetEntryPageRelative()));
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
/**
* Get the entry page of the application based on the value of the entry page setting.
*
@@ -38,69 +50,68 @@ class SystemController extends BaseController
*/
private function GetEntryPageRelative()
{
if (defined('GROCY_ENTRY_PAGE')) {
if (defined('GROCY_ENTRY_PAGE'))
{
$entryPage = constant('GROCY_ENTRY_PAGE');
} else {
}
else
{
$entryPage = 'stock';
}
// Stock
if ($entryPage === 'stock' && constant('GROCY_FEATURE_FLAG_STOCK')) {
if ($entryPage === 'stock' && constant('GROCY_FEATURE_FLAG_STOCK'))
{
return '/stockoverview';
}
// Shoppinglist
if ($entryPage === 'shoppinglist' && constant('GROCY_FEATURE_FLAG_SHOPPINGLIST')) {
if ($entryPage === 'shoppinglist' && constant('GROCY_FEATURE_FLAG_SHOPPINGLIST'))
{
return '/shoppinglist';
}
// Recipes
if ($entryPage === 'recipes' && constant('GROCY_FEATURE_FLAG_RECIPES')) {
if ($entryPage === 'recipes' && constant('GROCY_FEATURE_FLAG_RECIPES'))
{
return '/recipes';
}
// Chores
if ($entryPage === 'chores' && constant('GROCY_FEATURE_FLAG_CHORES')) {
if ($entryPage === 'chores' && constant('GROCY_FEATURE_FLAG_CHORES'))
{
return '/choresoverview';
}
// Tasks
if ($entryPage === 'tasks' && constant('GROCY_FEATURE_FLAG_TASKS')) {
if ($entryPage === 'tasks' && constant('GROCY_FEATURE_FLAG_TASKS'))
{
return '/tasks';
}
// Batteries
if ($entryPage === 'batteries' && constant('GROCY_FEATURE_FLAG_BATTERIES')) {
if ($entryPage === 'batteries' && constant('GROCY_FEATURE_FLAG_BATTERIES'))
{
return '/batteriesoverview';
}
if ($entryPage === 'equipment' && constant('GROCY_FEATURE_FLAG_EQUIPMENT')) {
if ($entryPage === 'equipment' && constant('GROCY_FEATURE_FLAG_EQUIPMENT'))
{
return '/equipment';
}
// Calendar
if ($entryPage === 'calendar' && constant('GROCY_FEATURE_FLAG_CALENDAR')) {
if ($entryPage === 'calendar' && constant('GROCY_FEATURE_FLAG_CALENDAR'))
{
return '/calendar';
}
// Meal Plan
if ($entryPage === 'mealplan' && constant('GROCY_FEATURE_FLAG_RECIPES')) {
if ($entryPage === 'mealplan' && constant('GROCY_FEATURE_FLAG_RECIPES'))
{
return '/mealplan';
}
return '/about';
}
public function About(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'about', [
'system_info' => $this->getApplicationService()->GetSystemInfo(),
'changelog' => $this->getApplicationService()->GetChangelog()
]);
}
public function BarcodeScannerTesting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'barcodescannertesting');
}
}

View File

@@ -2,25 +2,25 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
class TasksApiController extends BaseApiController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->ApiResponse($response, $this->getTasksService()->GetCurrent());
return $this->FilteredApiResponse($response, $this->getTasksService()->GetCurrent(), $request->getQueryParams());
}
public function MarkTaskAsCompleted(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$requestBody = $request->getParsedBody();
User::checkPermission($request, User::PERMISSION_TASKS_MARK_COMPLETED);
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
try
{
$doneTime = date('Y-m-d H:i:s');
if (array_key_exists('done_time', $requestBody) && IsIsoDateTime($requestBody['done_time']))
{
$doneTime = $requestBody['done_time'];
@@ -37,6 +37,8 @@ class TasksApiController extends BaseApiController
public function UndoTask(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
User::checkPermission($request, User::PERMISSION_TASKS_UNDO_EXECUTION);
try
{
$this->getTasksService()->UndoTask($args['taskId']);
@@ -47,4 +49,9 @@ class TasksApiController extends BaseApiController
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -4,16 +4,11 @@ namespace Grocy\Controllers;
class TasksController extends BaseController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if (isset($request->getQueryParams()['include_done']))
{
$tasks = $this->getDatabase()->tasks()->orderBy('name');
$tasks = $this->getDatabase()->tasks()->orderBy('name', 'COLLATE NOCASE');
}
else
{
@@ -26,40 +21,17 @@ class TasksController extends BaseController
return $this->renderPage($response, 'tasks', [
'tasks' => $tasks,
'nextXDays' => $nextXDays,
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name'),
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE'),
'users' => $this->getDatabase()->users(),
'userfields' => $this->getUserfieldsService()->GetFields('tasks'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('tasks')
]);
}
public function TaskEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($args['taskId'] == 'new')
{
return $this->renderPage($response, 'taskform', [
'mode' => 'create',
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name'),
'users' => $this->getDatabase()->users()->orderBy('username'),
'userfields' => $this->getUserfieldsService()->GetFields('tasks')
]);
}
else
{
return $this->renderPage($response, 'taskform', [
'task' => $this->getDatabase()->tasks($args['taskId']),
'mode' => 'edit',
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name'),
'users' => $this->getDatabase()->users()->orderBy('username'),
'userfields' => $this->getUserfieldsService()->GetFields('tasks')
]);
}
}
public function TaskCategoriesList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'taskcategories', [
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name'),
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE'),
'userfields' => $this->getUserfieldsService()->GetFields('task_categories'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('task_categories')
]);
@@ -77,15 +49,43 @@ class TasksController extends BaseController
else
{
return $this->renderPage($response, 'taskcategoryform', [
'category' => $this->getDatabase()->task_categories($args['categoryId']),
'category' => $this->getDatabase()->task_categories($args['categoryId']),
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('task_categories')
]);
}
}
public function TaskEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if ($args['taskId'] == 'new')
{
return $this->renderPage($response, 'taskform', [
'mode' => 'create',
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE'),
'users' => $this->getDatabase()->users()->orderBy('username'),
'userfields' => $this->getUserfieldsService()->GetFields('tasks')
]);
}
else
{
return $this->renderPage($response, 'taskform', [
'task' => $this->getDatabase()->tasks($args['taskId']),
'mode' => 'edit',
'taskCategories' => $this->getDatabase()->task_categories()->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)
{
return $this->renderPage($response, 'taskssettings');
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace Grocy\Controllers\Users;
use Psr\Http\Message\ServerRequestInterface;
use Slim\Exception\HttpForbiddenException;
use Throwable;
class PermissionMissingException extends HttpForbiddenException
{
public function __construct(ServerRequestInterface $request, string $permission, ?Throwable $previous = null)
{
parent::__construct($request, 'Permission missing: ' . $permission, $previous);
}
}

109
controllers/Users/User.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
namespace Grocy\Controllers\Users;
use Grocy\Services\DatabaseService;
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';
/**
* @var \LessQL\Database|null
*/
protected $db;
public static function PermissionList()
{
$user = new self();
return $user->getPermissionList();
}
public function __construct()
{
$this->db = DatabaseService::getInstance()->GetDbConnection();
}
public static function checkPermission($request, string ...$permissions): void
{
$user = new self();
foreach ($permissions as $permission)
{
if (!$user->hasPermission($permission))
{
throw new PermissionMissingException($request, $permission);
}
}
}
public function getPermissionList()
{
return $this->db->uihelper_user_permissions()->where('user_id', GROCY_USER_ID);
}
public function hasPermission(string $permission): bool
{
return $this->getPermissions()->where('permission_name', $permission)->fetch() !== null;
}
public static function hasPermissions(string ...$permissions)
{
$user = new self();
foreach ($permissions as $permission)
{
if (!$user->hasPermission($permission))
{
return false;
}
}
return true;
}
protected function getPermissions(): Result
{
return $this->db->user_permissions_resolved()->where('user_id', GROCY_USER_ID);
}
}

View File

@@ -2,18 +2,26 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
class UsersApiController extends BaseApiController
{
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
public function GetUsers(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function AddPermission(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
return $this->ApiResponse($response, $this->getUsersService()->GetUsersAsDto());
User::checkPermission($request, User::PERMISSION_ADMIN);
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
$this->getDatabase()->user_permissions()->createRow([
'user_id' => $args['userId'],
'permission_id' => $requestBody['permission_id']
])->save();
return $this->EmptyApiResponse($response);
}
catch (\Slim\Exception\HttpSpecializedException $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage(), $ex->getCode());
}
catch (\Exception $ex)
{
@@ -23,7 +31,8 @@ class UsersApiController extends BaseApiController
public function CreateUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$requestBody = $request->getParsedBody();
User::checkPermission($request, User::PERMISSION_USERS_CREATE);
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
try
{
@@ -32,7 +41,7 @@ class UsersApiController extends BaseApiController
throw new \Exception('Request body could not be parsed (probably invalid JSON format or missing/wrong Content-Type header)');
}
$this->getUsersService()->CreateUser($requestBody['username'], $requestBody['first_name'], $requestBody['last_name'], $requestBody['password']);
$this->getUsersService()->CreateUser($requestBody['username'], $requestBody['first_name'], $requestBody['last_name'], $requestBody['password'], $requestBody['picture_file_name']);
return $this->EmptyApiResponse($response);
}
catch (\Exception $ex)
@@ -43,6 +52,7 @@ class UsersApiController extends BaseApiController
public function DeleteUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
User::checkPermission($request, User::PERMISSION_USERS_EDIT);
try
{
$this->getUsersService()->DeleteUser($args['userId']);
@@ -56,11 +66,20 @@ class UsersApiController extends BaseApiController
public function EditUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$requestBody = $request->getParsedBody();
if ($args['userId'] == GROCY_USER_ID)
{
User::checkPermission($request, User::PERMISSION_USERS_EDIT_SELF);
}
else
{
User::checkPermission($request, User::PERMISSION_USERS_EDIT);
}
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
try
{
$this->getUsersService()->EditUser($args['userId'], $requestBody['username'], $requestBody['first_name'], $requestBody['last_name'], $requestBody['password']);
$this->getUsersService()->EditUser($args['userId'], $requestBody['username'], $requestBody['first_name'], $requestBody['last_name'], $requestBody['password'], $requestBody['picture_file_name']);
return $this->EmptyApiResponse($response);
}
catch (\Exception $ex)
@@ -69,6 +88,19 @@ class UsersApiController extends BaseApiController
}
}
public function GetUserSetting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
$value = $this->getUsersService()->GetUserSetting(GROCY_USER_ID, $args['settingKey']);
return $this->ApiResponse($response, ['value' => $value]);
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function GetUserSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
@@ -81,12 +113,90 @@ class UsersApiController extends BaseApiController
}
}
public function GetUserSetting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function GetUsers(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
User::checkPermission($request, User::PERMISSION_USERS_READ);
try
{
return $this->FilteredApiResponse($response, $this->getUsersService()->GetUsersAsDto(), $request->getQueryParams());
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function CurrentUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
$value = $this->getUsersService()->GetUserSetting(GROCY_USER_ID, $args['settingKey']);
return $this->ApiResponse($response, array('value' => $value));
return $this->ApiResponse($response, $this->getUsersService()->GetUsersAsDto()->where('id', GROCY_USER_ID));
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function ListPermissions(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
User::checkPermission($request, User::PERMISSION_ADMIN);
return $this->ApiResponse(
$response,
$this->getDatabase()->user_permissions()->where('user_id', $args['userId'])
);
}
catch (\Slim\Exception\HttpSpecializedException $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage(), $ex->getCode());
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function SetPermissions(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
User::checkPermission($request, User::PERMISSION_ADMIN);
$requestBody = $request->getParsedBody();
$db = $this->getDatabase();
$db->user_permissions()
->where('user_id', $args['userId'])
->delete();
$perms = [];
if (GROCY_MODE === 'demo' || GROCY_MODE === 'prerelease')
{
// For demo mode always all users have and keep the ADMIN permission
$perms[] = [
'user_id' => $args['userId'],
'permission_id' => 1
];
}
else
{
foreach ($requestBody['permissions'] as $perm_id)
{
$perms[] = [
'user_id' => $args['userId'],
'permission_id' => $perm_id
];
}
}
$db->insert('user_permissions', $perms, 'batch');
return $this->EmptyApiResponse($response);
}
catch (\Slim\Exception\HttpSpecializedException $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage(), $ex->getCode());
}
catch (\Exception $ex)
{
@@ -98,7 +208,7 @@ class UsersApiController extends BaseApiController
{
try
{
$requestBody = $request->getParsedBody();
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
$value = $this->getUsersService()->SetUserSetting(GROCY_USER_ID, $args['settingKey'], $requestBody['value']);
return $this->EmptyApiResponse($response);
@@ -108,4 +218,22 @@ class UsersApiController extends BaseApiController
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function DeleteUserSetting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
$value = $this->getUsersService()->DeleteUserSetting(GROCY_USER_ID, $args['settingKey']);
return $this->EmptyApiResponse($response);
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function __construct(\DI\Container $container)
{
parent::__construct($container);
}
}

View File

@@ -2,12 +2,17 @@
namespace Grocy\Controllers;
use Grocy\Controllers\Users\User;
class UsersController extends BaseController
{
public function UsersList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
public function PermissionList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'users', [
'users' => $this->getDatabase()->users()->orderBy('username')
User::checkPermission($request, User::PERMISSION_USERS_READ);
return $this->renderPage($response, 'userpermissions', [
'user' => $this->getDatabase()->users($args['userId']),
'permissions' => $this->getDatabase()->uihelper_user_permissions()
->where('parent IS NULL')->where('user_id', $args['userId'])
]);
}
@@ -15,16 +20,53 @@ class UsersController extends BaseController
{
if ($args['userId'] == 'new')
{
User::checkPermission($request, User::PERMISSION_USERS_CREATE);
return $this->renderPage($response, 'userform', [
'mode' => 'create'
'mode' => 'create',
'userfields' => $this->getUserfieldsService()->GetFields('users')
]);
}
else
{
if ($args['userId'] == GROCY_USER_ID)
{
User::checkPermission($request, User::PERMISSION_USERS_EDIT_SELF);
}
else
{
User::checkPermission($request, User::PERMISSION_USERS_EDIT);
}
return $this->renderPage($response, 'userform', [
'user' => $this->getDatabase()->users($args['userId']),
'mode' => 'edit'
'user' => $this->getDatabase()->users($args['userId']),
'mode' => 'edit',
'userfields' => $this->getUserfieldsService()->GetFields('users'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('users')
]);
}
}
public function UserSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'usersettings', [
'languages' => array_filter(scandir(__DIR__ . '/../localization'), function ($item) {
if ($item == '.' || $item == '..')
{
return false;
}
return is_dir(__DIR__ . '/../localization/' . $item);
})
]);
}
public function UsersList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
User::checkPermission($request, User::PERMISSION_USERS_READ);
return $this->renderPage($response, 'users', [
'users' => $this->getDatabase()->users()->orderBy('username'),
'userfields' => $this->getUserfieldsService()->GetFields('users'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('users')
]);
}
}

View File

@@ -1,6 +1,6 @@
<?php
use \Grocy\Helpers\BaseBarcodeLookupPlugin;
use Grocy\Helpers\BaseBarcodeLookupPlugin;
/*
This class must extend BaseBarcodeLookupPlugin (in namespace \Grocy\Helpers)
@@ -55,24 +55,24 @@ class DemoBarcodeLookupPlugin extends BaseBarcodeLookupPlugin
*/
protected function ExecuteLookup($barcode)
{
if ($barcode === 'x') // Demonstration when nothing is found
{
if ($barcode === 'x')
{ // Demonstration when nothing is found
return null;
}
elseif ($barcode === 'e') // Demonstration when an error occurred
{
elseif ($barcode === 'e')
{ // Demonstration when an error occurred
throw new \Exception('This is the error message from the plugin...');
}
else
{
return array(
return [
'name' => 'LookedUpProduct_' . RandomString(5),
'location_id' => $this->Locations[0]->id,
'qu_id_purchase' => $this->QuantityUnits[0]->id,
'qu_id_stock' => $this->QuantityUnits[0]->id,
'qu_factor_purchase_to_stock' => 1,
'barcode' => $barcode
);
];
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,16 +4,9 @@ namespace Grocy\Helpers;
abstract class BaseBarcodeLookupPlugin
{
final public function __construct($locations, $quantityUnits)
{
$this->Locations = $locations;
$this->QuantityUnits = $quantityUnits;
}
protected $Locations;
protected $QuantityUnits;
abstract protected function ExecuteLookup($barcode);
protected $QuantityUnits;
final public function Lookup($barcode)
{
@@ -29,20 +22,22 @@ abstract class BaseBarcodeLookupPlugin
{
throw new \Exception('Plugin output must be an associative array');
}
if (!IsAssociativeArray($pluginOutput)) // $pluginOutput is at least an indexed array here
{
if (!IsAssociativeArray($pluginOutput))
{ // $pluginOutput is at least an indexed array here
throw new \Exception('Plugin output must be an associative array');
}
// Check for minimum needed properties
$minimunNeededProperties = array(
$minimunNeededProperties = [
'name',
'location_id',
'qu_id_purchase',
'qu_id_stock',
'qu_factor_purchase_to_stock',
'barcode'
);
];
foreach ($minimunNeededProperties as $prop)
{
if (!array_key_exists($prop, $pluginOutput))
@@ -55,21 +50,28 @@ abstract class BaseBarcodeLookupPlugin
// Check referenced entity ids are valid
$locationId = $pluginOutput['location_id'];
if (FindObjectInArrayByPropertyValue($this->Locations, 'id', $locationId) === null)
{
throw new \Exception("Location $locationId is not a valid location id");
}
$quIdPurchase = $pluginOutput['qu_id_purchase'];
if (FindObjectInArrayByPropertyValue($this->QuantityUnits, 'id', $quIdPurchase) === null)
{
throw new \Exception("Location $quIdPurchase is not a valid quantity unit id");
}
$quIdStock = $pluginOutput['qu_id_stock'];
if (FindObjectInArrayByPropertyValue($this->QuantityUnits, 'id', $quIdStock) === null)
{
throw new \Exception("Location $quIdStock is not a valid quantity unit id");
}
$quFactor = $pluginOutput['qu_factor_purchase_to_stock'];
if (empty($quFactor) || !is_numeric($quFactor))
{
throw new \Exception('Quantity unit factor is empty or not a number');
@@ -77,4 +79,12 @@ abstract class BaseBarcodeLookupPlugin
return $pluginOutput;
}
final public function __construct($locations, $quantityUnits)
{
$this->Locations = $locations;
$this->QuantityUnits = $quantityUnits;
}
abstract protected function ExecuteLookup($barcode);
}

View File

@@ -1,53 +1,73 @@
<?php
class ERequirementNotMet extends Exception { }
class ERequirementNotMet extends Exception
{
}
const REQUIRED_PHP_EXTENSIONS = array('fileinfo', 'pdo_sqlite', 'gd');
const REQUIRED_PHP_EXTENSIONS = ['fileinfo', 'pdo_sqlite', 'gd'];
const REQUIRED_SQLITE_VERSION = '3.8.3';
class PrerequisiteChecker
{
public function checkRequirements()
{
self::checkForConfigFile();
self::checkForConfigDistFile();
self::checkForComposer();
self::checkForPhpExtensions();
}
private function checkForConfigFile()
{
if (!file_exists(GROCY_DATAPATH . '/config.php'))
{
throw new ERequirementNotMet('config.php in data directory (' . GROCY_DATAPATH . ') not found. Have you copied config-dist.php to the data directory and renamed it to config.php?');
}
}
public function checkRequirements()
{
self::checkForConfigFile();
self::checkForConfigDistFile();
self::checkForComposer();
self::checkForPhpExtensions();
self::checkForSqliteVersion();
}
private function checkForConfigDistFile()
{
if (!file_exists(__DIR__ . '/../config-dist.php'))
{
throw new ERequirementNotMet('config-dist.php not found. Please do not remove this file.');
}
}
private function checkForComposer()
{
if (!file_exists(__DIR__ . '/../vendor/autoload.php'))
{
throw new ERequirementNotMet('/vendor/autoload.php not found. Have you run Composer?');
}
}
private function checkForComposer()
{
if (!file_exists(__DIR__ . '/../vendor/autoload.php'))
{
throw new ERequirementNotMet('/vendor/autoload.php not found. Have you run Composer?');
}
}
private function checkForConfigDistFile()
{
if (!file_exists(__DIR__ . '/../config-dist.php'))
{
throw new ERequirementNotMet('config-dist.php not found. Please do not remove this file.');
}
}
private function checkForPhpExtensions()
{
$loadedExtensions = get_loaded_extensions();
foreach (REQUIRED_PHP_EXTENSIONS as $extension)
{
if (!in_array($extension, $loadedExtensions))
{
throw new ERequirementNotMet("PHP module '{$extension}' not installed, but required.");
}
}
}
private function checkForConfigFile()
{
if (!file_exists(GROCY_DATAPATH . '/config.php'))
{
throw new ERequirementNotMet('config.php in data directory (' . GROCY_DATAPATH . ') not found. Have you copied config-dist.php to the data directory and renamed it to config.php?');
}
}
private function checkForPhpExtensions()
{
$loadedExtensions = get_loaded_extensions();
foreach (REQUIRED_PHP_EXTENSIONS as $extension)
{
if (!in_array($extension, $loadedExtensions))
{
throw new ERequirementNotMet("PHP module '{$extension}' not installed, but required.");
}
}
}
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 getSqlVersionAsString()
{
$dbh = new PDO('sqlite::memory:');
return $dbh->query('select sqlite_version()')->fetch()[0];
}
}

View File

@@ -4,6 +4,20 @@ namespace Grocy\Helpers;
class UrlManager
{
protected $BasePath;
public function ConstructUrl($relativePath, $isResource = false)
{
if (GROCY_DISABLE_URL_REWRITING === false || $isResource === true)
{
return rtrim($this->BasePath, '/') . $relativePath;
}
else
{ // Is not a resource and URL rewriting is disabled
return rtrim($this->BasePath, '/') . '/index.php' . $relativePath;
}
}
public function __construct(string $basePath)
{
if ($basePath === '/')
@@ -16,20 +30,6 @@ class UrlManager
}
}
protected $BasePath;
public function ConstructUrl($relativePath, $isResource = false)
{
if (GROCY_DISABLE_URL_REWRITING === false || $isResource === true)
{
return rtrim($this->BasePath, '/') . $relativePath;
}
else // Is not a resource and URL rewriting is disabled
{
return rtrim($this->BasePath, '/') . '/index.php' . $relativePath;
}
}
private function GetBaseUrl()
{
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
@@ -37,6 +37,6 @@ class UrlManager
$_SERVER['HTTPS'] = 'on';
}
return (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
return (isset($_SERVER['HTTPS']) ? 'https' : 'http') . "://$_SERVER[HTTP_HOST]";
}
}

View File

@@ -2,9 +2,10 @@
function FindObjectInArrayByPropertyValue($array, $propertyName, $propertyValue)
{
foreach($array as $object)
foreach ($array as $object)
{
if($object->{$propertyName} == $propertyValue)
if ($object->{$propertyName}
== $propertyValue)
{
return $object;
}
@@ -15,29 +16,38 @@ function FindObjectInArrayByPropertyValue($array, $propertyName, $propertyValue)
function FindAllObjectsInArrayByPropertyValue($array, $propertyName, $propertyValue, $operator = '==')
{
$returnArray = array();
$returnArray = [];
foreach($array as $object)
foreach ($array as $object)
{
switch($operator)
switch ($operator)
{
case '==':
if($object->{$propertyName} == $propertyValue)
if ($object->{$propertyName}
== $propertyValue)
{
$returnArray[] = $object;
}
break;
case '>':
if($object->{$propertyName} > $propertyValue)
if ($object->{$propertyName}
> $propertyValue)
{
$returnArray[] = $object;
}
break;
case '<':
if($object->{$propertyName} < $propertyValue)
if ($object->{$propertyName}
< $propertyValue)
{
$returnArray[] = $object;
}
break;
}
}
@@ -47,29 +57,35 @@ function FindAllObjectsInArrayByPropertyValue($array, $propertyName, $propertyVa
function FindAllItemsInArrayByValue($array, $value, $operator = '==')
{
$returnArray = array();
$returnArray = [];
foreach($array as $item)
foreach ($array as $item)
{
switch($operator)
switch ($operator)
{
case '==':
if($item == $value)
if ($item == $value)
{
$returnArray[] = $item;
}
break;
case '>':
if($item > $value)
if ($item > $value)
{
$returnArray[] = $item;
}
break;
case '<':
if($item < $value)
if ($item < $value)
{
$returnArray[] = $item;
}
break;
}
}
@@ -80,7 +96,8 @@ function FindAllItemsInArrayByValue($array, $value, $operator = '==')
function SumArrayValue($array, $propertyName)
{
$sum = 0;
foreach($array as $object)
foreach ($array as $object)
{
$sum += floatval($object->{$propertyName});
}
@@ -107,6 +124,7 @@ function GetClassConstants($className, $prefix = null)
function RandomString($length, $allowedChars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
{
$randomString = '';
for ($i = 0; $i < $length; $i++)
{
$randomString .= $allowedChars[rand(0, strlen($allowedChars) - 1)];
@@ -142,13 +160,16 @@ function ExternalSettingValue(string $value)
{
$tvalue = rtrim($value, "\r\n");
$lvalue = strtolower($tvalue);
if ($lvalue === "true"){
if ($lvalue === 'true')
{
return true;
}
elseif ($lvalue === "false")
elseif ($lvalue === 'false')
{
return false;
}
return $tvalue;
}
@@ -158,13 +179,14 @@ function Setting(string $name, $value)
{
// The content of a $name.txt file in /data/settingoverrides can overwrite the given setting (for embedded mode)
$settingOverrideFile = GROCY_DATAPATH . '/settingoverrides/' . $name . '.txt';
if (file_exists($settingOverrideFile))
{
define('GROCY_' . $name, ExternalSettingValue(file_get_contents($settingOverrideFile)));
}
elseif (getenv('GROCY_' . $name) !== false) // An environment variable with the same name and prefix GROCY_ overwrites the given setting
{
define('GROCY_' . $name, ExternalSettingValue(getenv('GROCY_'. $name)));
elseif (getenv('GROCY_' . $name) !== false)
{ // An environment variable with the same name and prefix GROCY_ overwrites the given setting
define('GROCY_' . $name, ExternalSettingValue(getenv('GROCY_' . $name)));
}
else
{
@@ -174,10 +196,11 @@ function Setting(string $name, $value)
}
global $GROCY_DEFAULT_USER_SETTINGS;
$GROCY_DEFAULT_USER_SETTINGS = array();
$GROCY_DEFAULT_USER_SETTINGS = [];
function DefaultUserSetting(string $name, $value)
{
global $GROCY_DEFAULT_USER_SETTINGS;
if (!array_key_exists($name, $GROCY_DEFAULT_USER_SETTINGS))
{
$GROCY_DEFAULT_USER_SETTINGS[$name] = $value;
@@ -210,7 +233,7 @@ function GetUserDisplayName($user)
function IsValidFileName($fileName)
{
if(preg_match('=^[^/?*;:{}\\\\]+\.[^/?*;:{}\\\\]+$=', $fileName))
if (preg_match('=^[^/?*;:{}\\\\]+\.[^/?*;:{}\\\\]+$=', $fileName))
{
return true;
}
@@ -232,6 +255,7 @@ function string_starts_with($haystack, $needle)
function string_ends_with($haystack, $needle)
{
$length = strlen($needle);
if ($length == 0)
{
return true;

View File

@@ -1,3 +1,4 @@
#
# Translators:
# Michal Petříček <michal@petricek.org>, 2019
# Ondřej Suk <ondra.suk.55@gmail.com>, 2020
@@ -75,8 +76,8 @@ msgid "Bunch"
msgid_plural "Bunches"
msgstr[0] "Svazek"
msgstr[1] "Svazky"
msgstr[2] "Svazky"
msgstr[3] "Svazky"
msgstr[2] "Svazků"
msgstr[3] "Svazků"
msgid "Gummy bears"
msgstr "Gumoví medvídci"
@@ -151,7 +152,7 @@ msgid "Salami"
msgstr "Salám"
msgid "Toast"
msgstr "Toast"
msgstr "Toust"
msgid "Minced meat"
msgstr "Mleté maso"
@@ -363,21 +364,39 @@ msgid "Slovak"
msgstr "Slovenština"
msgid "Czech"
msgstr ""
msgstr "Čeština"
msgid "Portuguese (Portugal)"
msgstr ""
msgstr "Portugalština (Portugalsko)"
# Use a in your country well known supermarket name
msgid "DemoSupermarket1"
msgstr ""
msgstr "UkazkovyObchod1"
# Use a in your country well known supermarket name
msgid "DemoSupermarket2"
msgstr ""
msgstr "UkazkovyObchod2"
msgid "Japanese"
msgstr ""
msgstr "Japonština"
msgid "Chinese (Taiwan)"
msgstr "Čínština (Tchaj-wan)"
msgid "Greek"
msgstr "Řečtina"
msgid "Korean"
msgstr "Korejština"
msgid "Chinese (China)"
msgstr ""
msgid "Hebrew (Israel)"
msgstr ""
msgid "Tamil"
msgstr ""
msgid "Finnish"
msgstr ""

122
localization/cs/locales.po Normal file
View File

@@ -0,0 +1,122 @@
#
# Translators:
# Radim Kabeláč <radim.ekk@gmail.com>, 2020
#
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"
"Last-Translator: Radim Kabeláč <radim.ekk@gmail.com>, 2020\n"
"Language-Team: Czech (https://www.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"
"Language: cs\n"
"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n"
"X-Domain: grocy/locales\n"
# Czech
msgid "cs"
msgstr "Čeština"
# Danish
msgid "da"
msgstr "Dánština"
# German
msgid "de"
msgstr "Němčina"
# Greek
msgid "el_GR"
msgstr "Řečtina"
# English
msgid "en"
msgstr "Angličtina"
# English (Great Britain)
msgid "en_GB"
msgstr "Angličtina (Britská)"
# Spanish
msgid "es"
msgstr "Španělština"
# French
msgid "fr"
msgstr "Francouzština"
# Hungarian
msgid "hu"
msgstr "Maďarština"
# Italian
msgid "it"
msgstr "Italština"
# Japanese
msgid "ja"
msgstr "Japonština"
# Korean
msgid "ko_KR"
msgstr "Korejština"
# Dutch
msgid "nl"
msgstr "Nizozemština"
# Norwegian
msgid "no"
msgstr "Norština"
# Polish
msgid "pl"
msgstr "Polština"
# Portuguese (Brazil)
msgid "pt_BR"
msgstr "Portugalština (Brazílie)"
# Portuguese (Portugal)
msgid "pt_PT"
msgstr "Portugalština (Portugalsko)"
# Russian
msgid "ru"
msgstr "Ruština"
# Slovak
msgid "sk_SK"
msgstr "Slovenština"
# Swedish
msgid "sv_SE"
msgstr "Švédština"
# Turkish
msgid "tr"
msgstr "Turečtina"
# Chinese (Taiwan)
msgid "zh_TW"
msgstr "Čínština (Tradiční)"
# Chinese (China)
msgid "zh_CN"
msgstr ""
# Hebrew (Israel)
msgid "he_IL"
msgstr ""
# Tamil
msgid "ta"
msgstr ""
# Finnish
msgid "fi"
msgstr ""

View File

@@ -0,0 +1,138 @@
#
# Translators:
# Radim Kabeláč <radim.ekk@gmail.com>, 2020
#
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-29 16:33+0000\n"
"Last-Translator: Radim Kabeláč <radim.ekk@gmail.com>, 2020\n"
"Language-Team: Czech (https://www.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"
"Language: cs\n"
"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n"
"X-Domain: grocy/permissions\n"
# All permissions
msgid "ADMIN"
msgstr "ADMINISTRATOR"
# Create users
msgid "USERS_CREATE"
msgstr "UZIVATELE_VYTVORIT"
# Edit users (including passwords)
msgid "USERS_EDIT"
msgstr "UZIVATELE_EDITACE"
# Show users
msgid "USERS_READ"
msgstr "UZIVATEL_CTENI"
# Edit own user data / change own password
msgid "USERS_EDIT_SELF"
msgstr "UZIVATELE_EDITOVAT_SEBE"
# Undo charge cycle
msgid "BATTERIES_UNDO_CHARGE_CYCLE"
msgstr "BATERIE_VRACENI_NABIJECI_CYKLUS"
# Track charge cycle
msgid "BATTERIES_TRACK_CHARGE_CYCLE"
msgstr ""
# Track execution
msgid "CHORE_TRACK_EXECUTION"
msgstr ""
# Undo execution
msgid "CHORE_UNDO_EXECUTION"
msgstr "POVINNOST_VYKONANI_VRACENI"
# Edit master data
msgid "MASTER_DATA_EDIT"
msgstr "ZAKLADNI_DATA_EDIT"
# Undo execution
msgid "TASKS_UNDO_EXECUTION"
msgstr "UKOL_VYKONANI_VRACENI"
# Mark completed
msgid "TASKS_MARK_COMPLETED"
msgstr "UKOLY_OZNACIT_HOTOVO"
# Edit stock entries
msgid "STOCK_EDIT"
msgstr "ZASOBY_EDITACE"
# Transfer
msgid "STOCK_TRANSFER"
msgstr "PREVOD_ZASOB"
# Inventory
msgid "STOCK_INVENTORY"
msgstr "ZASOBA_INVENTAR"
# Consume
msgid "STOCK_CONSUME"
msgstr "ZASOBY_SPOTREBOVAT"
# Open products
msgid "STOCK_OPEN"
msgstr "ZASOBY_OTEVRIT"
# Purchase
msgid "STOCK_PURCHASE"
msgstr "ZASOBA_NAKUP"
# Add items
msgid "SHOPPINGLIST_ITEMS_ADD"
msgstr "NAKUPNISEZNAM_POLOZKA_PRIDANO"
# Remove items
msgid "SHOPPINGLIST_ITEMS_DELETE"
msgstr "NAKUPNISEZNAM_POLOZKA_SMAZANO"
# User management
msgid "USERS"
msgstr "UZIVATEL"
# Stock
msgid "STOCK"
msgstr "ZASOBA"
# Shopping list
msgid "SHOPPINGLIST"
msgstr "NAKUPNISEZNAM"
# Chores
msgid "CHORES"
msgstr "POVINOSTI"
# Batteries
msgid "BATTERIES"
msgstr "BATERIE"
# Tasks
msgid "TASKS"
msgstr "UKOL"
# Recipes
msgid "RECIPES"
msgstr "RECEPTY"
# Equipment
msgid "EQUIPMENT"
msgstr "VYBAVENI"
# Calendar
msgid "CALENDAR"
msgstr "KALENDAR"
# Meal plan
msgid "RECIPES_MEALPLAN"
msgstr "RECEPTY_STRAVOVACIPLANY"

View File

@@ -0,0 +1,48 @@
#
# Translators:
# Tomas Reznicek <tomas.reznicek@gmail.com>, 2019
# Michal Franc, 2020
# Ondřej Suk <ondra.suk.55@gmail.com>, 2020
# Radim Kabeláč <radim.ekk@gmail.com>, 2020
#
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: 2019-05-01 17:42+0000\n"
"Last-Translator: Radim Kabeláč <radim.ekk@gmail.com>, 2020\n"
"Language-Team: Czech (https://www.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"
"Language: cs\n"
"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n"
"X-Domain: grocy/stock_transaction_types\n"
msgid "purchase"
msgstr "Nákup"
msgid "transfer_from"
msgstr "Převod z"
msgid "transfer_to"
msgstr "Převod do"
msgid "consume"
msgstr "Spotřeba"
msgid "inventory-correction"
msgstr "Úprava zásoby"
msgid "product-opened"
msgstr "Otevření balení"
msgid "stock-edit-old"
msgstr "zasoba-editace-stary"
msgid "stock-edit-new"
msgstr "zasoba-editace-novy"
msgid "self-production"
msgstr "vlastni-produkce"

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,8 @@
#
# Translators:
# Tomas Reznicek <tomas.reznicek@gmail.com>, 2019
# Michal Franc, 2020
# Radim Kabeláč <radim.ekk@gmail.com>, 2020
#
msgid ""
msgstr ""
@@ -8,7 +10,7 @@ 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: Michal Franc, 2020\n"
"Last-Translator: Radim Kabeláč <radim.ekk@gmail.com>, 2020\n"
"Language-Team: Czech (https://www.transifex.com/grocy/teams/93189/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -17,32 +19,54 @@ msgstr ""
"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n"
"X-Domain: grocy/userfield_types\n"
# Text (single line)
msgid "text-single-line"
msgstr "Text (jeden řádek)"
# Text (multi line)
msgid "text-multi-line"
msgstr "Text (více řádků)"
# Number (integral)
msgid "number-integral"
msgstr "Celé číslo"
# Number (decimal)
msgid "number-decimal"
msgstr "Číslo s desetinami"
# Date (without time)
msgid "date"
msgstr "Datum"
# Date & time
msgid "datetime"
msgstr "Datum a čas"
# Checkbox
msgid "checkbox"
msgstr "Zaškrtávací políčko"
# Select list (a single item can be selected)
msgid "preset-list"
msgstr "Seznam"
# Select list (multiple items can be selected)
msgid "preset-checklist"
msgstr "Zaškrtávací seznam"
# Link
msgid "link"
msgstr "Odkaz"
# Link (with title)
msgid "link-with-title"
msgstr ""
# File
msgid "file"
msgstr "soubor"
# Image
msgid "image"
msgstr "obrazek"

View File

@@ -1,8 +1,10 @@
#
# Translators:
# dark159123 <r.j.hansen@protonmail.com>, 2019
# Troels Siggaard <troels@siggaard.com>, 2019
# Rasmus Bojsen <rasmus@bojsen.cn>, 2019
# Brian Moos Lindberg <brian@blueeel.dk>, 2019
# Mihai Marinescu <mihai@marinescu.dk>, 2020
#
msgid ""
msgstr ""
@@ -10,7 +12,7 @@ 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: Brian Moos Lindberg <brian@blueeel.dk>, 2019\n"
"Last-Translator: Mihai Marinescu <mihai@marinescu.dk>, 2020\n"
"Language-Team: Danish (https://www.transifex.com/grocy/teams/93189/da/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -167,7 +169,7 @@ msgid "This is the note content of the recipe ingredient"
msgstr "Dette er indholdet af opskrift-ingrediensens notefeltet"
msgid "Demo User"
msgstr "Demobruger"
msgstr "Demo bruger"
msgid "Gram"
msgid_plural "Grams"
@@ -336,33 +338,51 @@ msgid "Portuguese (Brazil)"
msgstr "Portugisisk (Brasilien)"
msgid "This is a note"
msgstr ""
msgstr "Denne er en note"
msgid "Freezer"
msgstr ""
msgstr "Fryser"
msgid "Hungarian"
msgstr ""
msgstr "Ungarsk"
msgid "Slovak"
msgstr ""
msgstr "Slovakisk"
msgid "Czech"
msgstr ""
msgstr "Tjekkisk"
msgid "Portuguese (Portugal)"
msgstr ""
msgstr "Portugisisk (Portugal)"
# Use a in your country well known supermarket name
msgid "DemoSupermarket1"
msgstr ""
msgstr "Netto"
# Use a in your country well known supermarket name
msgid "DemoSupermarket2"
msgstr ""
msgstr "Fakta"
msgid "Japanese"
msgstr ""
msgstr "Japansk"
msgid "Chinese (Taiwan)"
msgstr "Kinesisk (Taiwan)"
msgid "Greek"
msgstr "Græsk"
msgid "Korean"
msgstr "Koreansk"
msgid "Chinese (China)"
msgstr ""
msgid "Hebrew (Israel)"
msgstr ""
msgid "Tamil"
msgstr ""
msgid "Finnish"
msgstr ""

View File

@@ -1,6 +1,8 @@
#
# Translators:
# Troels Siggaard <troels@siggaard.com>, 2019
# Brian Moos Lindberg <brian@blueeel.dk>, 2019
# Mihai Marinescu <mihai@marinescu.dk>, 2020
#
msgid ""
msgstr ""
@@ -8,7 +10,7 @@ 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: Brian Moos Lindberg <brian@blueeel.dk>, 2019\n"
"Last-Translator: Mihai Marinescu <mihai@marinescu.dk>, 2020\n"
"Language-Team: Danish (https://www.transifex.com/grocy/teams/93189/da/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -42,4 +44,4 @@ msgid "stock-edit-new"
msgstr "lager-redigering-ny"
msgid "self-production"
msgstr ""
msgstr "selvproduktion"

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,7 @@
#
# Translators:
# Brian Moos Lindberg <brian@blueeel.dk>, 2019
# Mihai Marinescu <mihai@marinescu.dk>, 2020
#
msgid ""
msgstr ""
@@ -7,7 +9,7 @@ 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: Brian Moos Lindberg <brian@blueeel.dk>, 2019\n"
"Last-Translator: Mihai Marinescu <mihai@marinescu.dk>, 2020\n"
"Language-Team: Danish (https://www.transifex.com/grocy/teams/93189/da/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -16,32 +18,54 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/userfield_types\n"
# Text (single line)
msgid "text-single-line"
msgstr "tekst-enkelt-linje"
# Text (multi line)
msgid "text-multi-line"
msgstr "tekst-flere-linjer"
# Number (integral)
msgid "number-integral"
msgstr "tal-heltal"
# Number (decimal)
msgid "number-decimal"
msgstr "tal-decimal"
# Date (without time)
msgid "date"
msgstr "dato"
# Date & time
msgid "datetime"
msgstr "datotid"
# Checkbox
msgid "checkbox"
msgstr "afkrydsningsfelt"
# Select list (a single item can be selected)
msgid "preset-list"
msgstr "forudindstillet-liste"
# Select list (multiple items can be selected)
msgid "preset-checklist"
msgstr "forudindstillet-tjekliste"
# Link
msgid "link"
msgstr "link"
# Link (with title)
msgid "link-with-title"
msgstr ""
# File
msgid "file"
msgstr "fil"
# Image
msgid "image"
msgstr "billede"

View File

@@ -1,3 +1,4 @@
#
# Translators:
# Bernd Bestel <bernd@berrnd.de>, 2020
#
@@ -363,3 +364,21 @@ msgstr "Japanisch"
msgid "Chinese (Taiwan)"
msgstr "Chinesisch (Taiwan)"
msgid "Greek"
msgstr "Griechisch"
msgid "Korean"
msgstr "Koreanisch"
msgid "Chinese (China)"
msgstr "Chinesisch (China)"
msgid "Hebrew (Israel)"
msgstr "Hebräisch (Israel)"
msgid "Tamil"
msgstr "Tamil"
msgid "Finnish"
msgstr "Finnisch"

122
localization/de/locales.po Normal file
View File

@@ -0,0 +1,122 @@
#
# Translators:
# Bernd Bestel <bernd@berrnd.de>, 2020
#
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"
"Last-Translator: Bernd Bestel <bernd@berrnd.de>, 2020\n"
"Language-Team: German (https://www.transifex.com/grocy/teams/93189/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/locales\n"
# Czech
msgid "cs"
msgstr "Tschechisch"
# Danish
msgid "da"
msgstr "Dänisch"
# German
msgid "de"
msgstr "de"
# Greek
msgid "el_GR"
msgstr "Griechisch"
# English
msgid "en"
msgstr "de"
# English (Great Britain)
msgid "en_GB"
msgstr "Englisch (Großbritannien)"
# Spanish
msgid "es"
msgstr "Spanisch"
# French
msgid "fr"
msgstr "Französisch"
# Hungarian
msgid "hu"
msgstr "Ungarisch "
# Italian
msgid "it"
msgstr "Italienisch"
# Japanese
msgid "ja"
msgstr "Japanisch"
# Korean
msgid "ko_KR"
msgstr "Koreanisch"
# Dutch
msgid "nl"
msgstr "Niederländisch"
# Norwegian
msgid "no"
msgstr "Norwegisch"
# Polish
msgid "pl"
msgstr "Polnisch"
# Portuguese (Brazil)
msgid "pt_BR"
msgstr "Portugiesisch (Brasilien)"
# Portuguese (Portugal)
msgid "pt_PT"
msgstr "Portugiesisch (Portugal)"
# Russian
msgid "ru"
msgstr "Russisch"
# Slovak
msgid "sk_SK"
msgstr "Slowakisch"
# Swedish
msgid "sv_SE"
msgstr "Schwedisch"
# Turkish
msgid "tr"
msgstr "Türkisch"
# Chinese (Taiwan)
msgid "zh_TW"
msgstr "Chinesisch (Taiwan)"
# Chinese (China)
msgid "zh_CN"
msgstr "Chinesisch (China)"
# Hebrew (Israel)
msgid "he_IL"
msgstr "Hebräisch (Israel)"
# Tamil
msgid "ta"
msgstr "Tamil"
# Finnish
msgid "fi"
msgstr "Finnisch"

View File

@@ -0,0 +1,138 @@
#
# Translators:
# Bernd Bestel <bernd@berrnd.de>, 2020
#
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-29 16:33+0000\n"
"Last-Translator: Bernd Bestel <bernd@berrnd.de>, 2020\n"
"Language-Team: German (https://www.transifex.com/grocy/teams/93189/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/permissions\n"
# All permissions
msgid "ADMIN"
msgstr "Alle Berechtigungen"
# Create users
msgid "USERS_CREATE"
msgstr "Benutzer erstellen"
# Edit users (including passwords)
msgid "USERS_EDIT"
msgstr "Benutzer bearbeiten (inklusive Passwörter)"
# Show users
msgid "USERS_READ"
msgstr "Benutzer anzeigen"
# Edit own user data / change own password
msgid "USERS_EDIT_SELF"
msgstr "Eigene Benutzerdaten bearbeiten / eigenes Passwort ändern"
# Undo charge cycle
msgid "BATTERIES_UNDO_CHARGE_CYCLE"
msgstr "Ladezyklus rückgängig machen"
# Track charge cycle
msgid "BATTERIES_TRACK_CHARGE_CYCLE"
msgstr "Ladezyklus erfassen"
# Track execution
msgid "CHORE_TRACK_EXECUTION"
msgstr "Ausführung erfassen"
# Undo execution
msgid "CHORE_UNDO_EXECUTION"
msgstr "Ausführung rückgängig machen"
# Edit master data
msgid "MASTER_DATA_EDIT"
msgstr "Stammdaten bearbeiten"
# Undo execution
msgid "TASKS_UNDO_EXECUTION"
msgstr "Ausführung rückgängig machen"
# Mark completed
msgid "TASKS_MARK_COMPLETED"
msgstr "Als erledigt markieren"
# Edit stock entries
msgid "STOCK_EDIT"
msgstr "Bestandseinträge bearbeiten"
# Transfer
msgid "STOCK_TRANSFER"
msgstr "Umlagern"
# Inventory
msgid "STOCK_INVENTORY"
msgstr "Inventur"
# Consume
msgid "STOCK_CONSUME"
msgstr "Verbrauch"
# Open products
msgid "STOCK_OPEN"
msgstr "Produkt als geöffnet markieren"
# Purchase
msgid "STOCK_PURCHASE"
msgstr "Einkauf"
# Add items
msgid "SHOPPINGLIST_ITEMS_ADD"
msgstr "Eintrag hinzufügen"
# Remove items
msgid "SHOPPINGLIST_ITEMS_DELETE"
msgstr "Eintrag entfernen"
# User management
msgid "USERS"
msgstr "Benutzerverwaltung"
# Stock
msgid "STOCK"
msgstr "Bestand"
# Shopping list
msgid "SHOPPINGLIST"
msgstr "Einkaufszettel"
# Chores
msgid "CHORES"
msgstr "Hausarbeiten"
# Batteries
msgid "BATTERIES"
msgstr "Batterien"
# Tasks
msgid "TASKS"
msgstr "Aufgaben"
# Recipes
msgid "RECIPES"
msgstr "Rezepte"
# Equipment
msgid "EQUIPMENT"
msgstr "Ausstattung"
# Calendar
msgid "CALENDAR"
msgstr "Kalender"
# Meal plan
msgid "RECIPES_MEALPLAN"
msgstr "Speiseplan"

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
#
# Translators:
# Bernd Bestel <bernd@berrnd.de>, 2019
# Bernd Bestel <bernd@berrnd.de>, 2020
#
msgid ""
msgstr ""
@@ -7,7 +8,7 @@ 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: Bernd Bestel <bernd@berrnd.de>, 2019\n"
"Last-Translator: Bernd Bestel <bernd@berrnd.de>, 2020\n"
"Language-Team: German (https://www.transifex.com/grocy/teams/93189/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -16,32 +17,54 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/userfield_types\n"
# Text (single line)
msgid "text-single-line"
msgstr "Text (einzeilig)"
# Text (multi line)
msgid "text-multi-line"
msgstr "Text (mehrzeilig)"
# Number (integral)
msgid "number-integral"
msgstr "Zahl (Ganzzahl)"
# Number (decimal)
msgid "number-decimal"
msgstr "Zahl (mit Dezimalstellen)"
# Date (without time)
msgid "date"
msgstr "Datum (ohne Zeitanteil)"
# Date & time
msgid "datetime"
msgstr "Datum & Zeit"
# Checkbox
msgid "checkbox"
msgstr "Kontrollkästchen"
# Select list (a single item can be selected)
msgid "preset-list"
msgstr "Auswahlliste (feste Werte, einzelner Wert kann ausgewählt werden)"
# Select list (multiple items can be selected)
msgid "preset-checklist"
msgstr "Auswahlliste (feste Werte, mehrere Werte können ausgewählt werden)"
# Link
msgid "link"
msgstr "Link"
# Link (with title)
msgid "link-with-title"
msgstr "Link (mit Titel)"
# File
msgid "file"
msgstr "Datei"
# Image
msgid "image"
msgstr "Bild"

View File

@@ -359,3 +359,21 @@ msgstr ""
msgid "Chinese (Taiwan)"
msgstr ""
msgid "Greek"
msgstr ""
msgid "Korean"
msgstr ""
msgid "Chinese (China)"
msgstr ""
msgid "Hebrew (Israel)"
msgstr ""
msgid "Tamil"
msgstr ""
msgid "Finnish"
msgstr ""

View File

@@ -0,0 +1,30 @@
#
# Translators:
# Dionysios Gkotsis <bloodsak4@yahoo.gr>, 2020
#
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: 2019-09-17 10:45+0000\n"
"Last-Translator: Dionysios Gkotsis <bloodsak4@yahoo.gr>, 2020\n"
"Language-Team: Greek (Greece) (https://www.transifex.com/grocy/teams/93189/el_GR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: el_GR\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/chore_assignment_types\n"
msgid "no-assignment"
msgstr "χωρίς ανάθεση"
msgid "who-least-did-first"
msgstr "όποιος το έκανε πρώτα"
msgid "random"
msgstr "τυχαία"
msgid "in-alphabetical-order"
msgstr "με αλφαβητική σειρά"

View File

@@ -0,0 +1,36 @@
#
# Translators:
# Anastasis Gryponisiotis <plant7@gmail.com>, 2019
#
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: 2019-05-01 17:42+0000\n"
"Last-Translator: Anastasis Gryponisiotis <plant7@gmail.com>, 2019\n"
"Language-Team: Greek (Greece) (https://www.transifex.com/grocy/teams/93189/el_GR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: el_GR\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/chore_types\n"
msgid "manually"
msgstr "χρειροκίνητα"
msgid "dynamic-regular"
msgstr "δυναμικό-κανονικό"
msgid "daily"
msgstr "ημερήσιο"
msgid "weekly"
msgstr "εβδομαδιαίο"
msgid "monthly"
msgstr "μηνιαίο"
msgid "yearly"
msgstr "ετήσιο"

View File

@@ -0,0 +1,50 @@
#
# Translators:
# Bernd Bestel <bernd@berrnd.de>, 2020
#
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: 2019-05-01 17:42+0000\n"
"Last-Translator: Bernd Bestel <bernd@berrnd.de>, 2020\n"
"Language-Team: Greek (Greece) (https://www.transifex.com/grocy/teams/93189/el_GR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: el_GR\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/component_translations\n"
msgid "timeago_locale"
msgstr "el"
msgid "timeago_nan"
msgstr "NaN χρόνια"
msgid "moment_locale"
msgstr "el"
msgid "datatables_localization"
msgstr ""
"{\"sDecimal\":\",\",\"sEmptyTable\":\"Δεν υπάρχουν δεδομένα στον "
"πίνακα\",\"sInfo\":\"Εμφανίζονται _START_ έως _END_ από _TOTAL_ "
"εγγραφές\",\"sInfoEmpty\":\"Εμφανίζονται 0 έως 0 από 0 "
"εγγραφές\",\"sInfoFiltered\":\"(φιλτραρισμένες από _MAX_ συνολικά "
"εγγραφές)\",\"sInfoPostFix\":\"\",\"sInfoThousands\":\".\",\"sLengthMenu\":\"Δείξε"
" _MENU_ "
"εγγραφές\",\"sLoadingRecords\":\"Φόρτωση...\",\"sProcessing\":\"Επεξεργασία...\",\"sSearch\":\"Αναζήτηση:\",\"sSearchPlaceholder\":\"Αναζήτηση\",\"sThousands\":\".\",\"sUrl\":\"\",\"sZeroRecords\":\"Δεν"
" βρέθηκαν εγγραφές που να "
"ταιριάζουν\",\"oPaginate\":{\"sFirst\":\"Πρώτη\",\"sPrevious\":\"Προηγούμενη\",\"sNext\":\"Επόμενη\",\"sLast\":\"Τελευταία\"},\"oAria\":{\"sSortAscending\":\":"
" ενεργοποιήστε για αύξουσα ταξινόμηση της στήλης\",\"sSortDescending\":\": "
"ενεργοποιήστε για φθίνουσα ταξινόμηση της στήλης\"}}"
msgid "summernote_locale"
msgstr "el-GR"
msgid "fullcalendar_locale"
msgstr "el"
msgid "bootstrap-select_locale"
msgstr "en_US"

View File

@@ -0,0 +1,386 @@
#
# Translators:
# datablitz7 <plant7@gmail.com>, 2019
# ByteGet, 2020
#
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: 2019-05-01 17:42+0000\n"
"Last-Translator: ByteGet, 2020\n"
"Language-Team: Greek (Greece) (https://www.transifex.com/grocy/teams/93189/el_GR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: el_GR\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/demo_data\n"
msgid "Cookies"
msgstr "Μπισκότα"
msgid "Chocolate"
msgstr "Σοκολάτα"
msgid "Pantry"
msgstr "Τροφοθήκη"
msgid "Candy cupboard"
msgstr "Ντουλάπι γλυκών"
msgid "Tinned food cupboard"
msgstr "Ντουλάπι κονσερβών"
msgid "Fridge"
msgstr "Ψυγείο"
msgid "Piece"
msgid_plural "Pieces"
msgstr[0] "Τεμάχιο"
msgstr[1] "Τεμάχια"
msgid "Pack"
msgid_plural "Packs"
msgstr[0] "Πακέτο"
msgstr[1] "Πακέτα"
msgid "Glass"
msgid_plural "Glasses"
msgstr[0] "Ποτήρι"
msgstr[1] "Ποτήρια"
msgid "Tin"
msgid_plural "Tins"
msgstr[0] "Κουτάκι"
msgstr[1] "Κουτάκια"
msgid "Can"
msgid_plural "Cans"
msgstr[0] "Κουτάκι"
msgstr[1] "Κουτάκια"
msgid "Bunch"
msgid_plural "Bunches"
msgstr[0] "Ματσάκι"
msgstr[1] "Ματσάκια"
msgid "Gummy bears"
msgstr "Gummy bears"
msgid "Crisps"
msgstr "Πατατάκια"
msgid "Eggs"
msgstr "Αυγά"
msgid "Noodles"
msgstr "Νούντλς"
msgid "Pickles"
msgstr "Πίκλες"
msgid "Gulash soup"
msgstr "Σούπα Γκούλας"
msgid "Yogurt"
msgstr "Γιαούρτι"
msgid "Cheese"
msgstr "Τυρί"
msgid "Cold cuts"
msgstr "Αλλαντικά"
msgid "Paprika"
msgstr "Πάπρικα"
msgid "Cucumber"
msgstr "Αγγούρι"
msgid "Radish"
msgstr "Ραδίκι"
msgid "Tomato"
msgstr "Τομάτα"
msgid "Changed towels in the bathroom"
msgstr "Άλλαγμα πετσετών στο μπάνιο"
msgid "Cleaned the kitchen floor"
msgstr "Καθάρισμα πατώματος κουζίνας"
msgid "Warranty ends"
msgstr "Λήξη εγγύησης"
msgid "TV remote control"
msgstr "Τηλεκοντρόλ τηλεόρασης"
msgid "Alarm clock"
msgstr "Ξυπνητήρι"
msgid "Heat remote control"
msgstr "Τηλεκοντρόλ θέρμανσης"
msgid "Lawn mowed in the garden"
msgstr "Κούρεμα γρασιδιού στον κήπο"
msgid "Some good snacks"
msgstr "Μερικά καλά σνακ"
msgid "Pizza dough"
msgstr "Ζυμάρι πίτσας"
msgid "Sieved tomatoes"
msgstr "Πασάτα"
msgid "Salami"
msgstr "Σαλάμι"
msgid "Toast"
msgstr "Τοστ"
msgid "Minced meat"
msgstr "Κιμάς"
msgid "Pizza"
msgstr "Πίτσα"
msgid "Spaghetti bolognese"
msgstr "Μακαρόνια Μπολονέζ"
msgid "Sandwiches"
msgstr "Σάντουιτς"
msgid "English"
msgstr "Αγγλικά"
msgid "German"
msgstr "Γερμανικά"
msgid "Italian"
msgstr "Ιταλικά"
msgid "This is the note content of the recipe ingredient"
msgstr "Αυτό είναι το περιεχόμενο της σημείωσης του υλικού της συνταγής"
msgid "Demo User"
msgstr "Δοκιμαστικός Χρήστης"
msgid "Gram"
msgid_plural "Grams"
msgstr[0] "Γραμμάριο"
msgstr[1] "Γραμμάρια"
msgid "Flour"
msgstr "Αλεύρι"
msgid "Pancakes"
msgstr "Τηγανήτες"
msgid "Sugar"
msgstr "Ζάχαρη"
msgid "Home"
msgstr "Σπίτι"
msgid "Life"
msgstr "Ζωή"
msgid "Projects"
msgstr "Σχέδιο"
msgid "Repair the garage door"
msgstr "Επισκευάστε την πόρτα του γκαράζ"
msgid "Fork and improve grocy"
msgstr "Fork και Βελτιώστε το grocy"
msgid "Find a solution for what to do when I forget the door keys"
msgstr ""
"Βρείτε μια λύση για το τι πρέπει να κάνω όταν ξεχάσω τα κλειδιά της πόρτας"
msgid "Sweets"
msgstr "Γλυκά"
msgid "Bakery products"
msgstr "Προϊόντα αρτοποιίας"
msgid "Tinned food"
msgstr "Κονσερβοποιημένα τρόφιμα"
msgid "Butchery products"
msgstr "Προϊόντα κρεοπωλείου"
msgid "Vegetables/Fruits"
msgstr "Λαχανικά / Φρούτα"
msgid "Refrigerated products"
msgstr "Προϊόντα Ψυγείου "
msgid "Coffee machine"
msgstr "Μηχανή καφέ"
msgid "Dishwasher"
msgstr "Πλυντήριο πιάτων"
msgid "Liter"
msgstr "Λίτρο"
msgid "Liters"
msgstr "Λίτρα"
msgid "Bottle"
msgstr "Μπουκάλι"
msgid "Bottles"
msgstr "Μπουκάλια"
msgid "Milk"
msgstr "Γάλα"
msgid "Chocolate sauce"
msgstr "Σάλτσα σοκολάτας"
msgid "Milliliters"
msgstr "Χιλιοστόλιτρα"
msgid "Milliliter"
msgstr "Χιλιοστόλιτρο"
msgid "Bottom"
msgstr "Κάτω μέρος"
msgid "Topping"
msgstr "Επικάλυψη"
msgid "French"
msgstr "Γαλλικά"
msgid "Turkish"
msgstr "Turkish"
msgid "Spanish"
msgstr "Ισπανικά"
msgid "Russian"
msgstr "Ρώσικα"
msgid "The thing which happens on the 5th of every month"
msgstr "Το πράγμα που συμβαίνει στις 5 κάθε μήνα"
msgid "The thing which happens daily"
msgstr "Το πράγμα που συμβαίνει καθημερινά"
msgid "The thing which happens on Mondays and Wednesdays"
msgstr "Αυτό που συμβαίνει Δευτέρα και Τετάρτη"
msgid "Swedish"
msgstr "Σουηδικά"
msgid "Polish"
msgstr "Πολωνικά"
msgid "Milk Chocolate"
msgstr "Σοκολάτα γάλακτος"
msgid "Dark Chocolate"
msgstr "Μαύρη σοκολάτα"
msgid "Slice"
msgid_plural "Slices"
msgstr[0] "Φέτα"
msgstr[1] "Φέτες"
msgid "Example userentity"
msgstr "Παράδειγμα χρήστη"
msgid "This is an example user entity..."
msgstr "Αυτό είναι ένα παράδειγμα οντότητας χρήστη ..."
msgid "Custom field"
msgstr "Προσαρμοσμένο πεδίο"
msgid "Example field value..."
msgstr "Παράδειγμα τιμής πεδίου ..."
msgid "Waffle rolls"
msgstr "Βάφλες"
msgid "Danish"
msgstr "Δανέζικα"
msgid "Dutch"
msgstr "Ολλανδικά"
msgid "Norwegian"
msgstr "Νορβηγικά"
msgid "Demo"
msgstr "Δοκιμή "
msgid "Stable version"
msgstr "Σταθερή έκδοση"
msgid "Preview version"
msgstr "Έκδοση προεπισκόπησης"
msgid "current release"
msgstr "τρέχουσα κυκλοφορία"
msgid "not yet released"
msgstr "δεν έχει κυκλοφορήσει ακόμη"
msgid "Portuguese (Brazil)"
msgstr "Πορτογαλικά (Βραζιλία)"
msgid "This is a note"
msgstr "Αυτή είναι μια σημείωση"
msgid "Freezer"
msgstr "Καταψύκτης"
msgid "Hungarian"
msgstr "Ουγγρικά"
msgid "Slovak"
msgstr "Σλοβάκος"
msgid "Czech"
msgstr "Τσέχικα"
msgid "Portuguese (Portugal)"
msgstr "Πορτογαλικά (Πορτογαλία)"
# Use a in your country well known supermarket name
msgid "DemoSupermarket1"
msgstr "Επίδειξη σούπερ μάρκετ1"
# Use a in your country well known supermarket name
msgid "DemoSupermarket2"
msgstr "Επίδειξη σούπερ μάρκετ2"
msgid "Japanese"
msgstr "Ιαπωνικά"
msgid "Chinese (Taiwan)"
msgstr "Κινέζικα (Ταϊβάν)"
msgid "Greek"
msgstr "Ελληνικά"
msgid "Korean"
msgstr "Κορεάτικα"
msgid "Chinese (China)"
msgstr ""
msgid "Hebrew (Israel)"
msgstr ""
msgid "Tamil"
msgstr ""
msgid "Finnish"
msgstr ""

View File

@@ -0,0 +1,122 @@
#
# Translators:
# ByteGet, 2020
#
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"
"Last-Translator: ByteGet, 2020\n"
"Language-Team: Greek (Greece) (https://www.transifex.com/grocy/teams/93189/el_GR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: el_GR\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/locales\n"
# Czech
msgid "cs"
msgstr "cs"
# Danish
msgid "da"
msgstr "da"
# German
msgid "de"
msgstr "de"
# Greek
msgid "el_GR"
msgstr "el_GR"
# English
msgid "en"
msgstr "en"
# English (Great Britain)
msgid "en_GB"
msgstr "en_GB"
# Spanish
msgid "es"
msgstr "es"
# French
msgid "fr"
msgstr "fr"
# Hungarian
msgid "hu"
msgstr "hu"
# Italian
msgid "it"
msgstr "it"
# Japanese
msgid "ja"
msgstr "ja"
# Korean
msgid "ko_KR"
msgstr "ko_KR"
# Dutch
msgid "nl"
msgstr "nl"
# Norwegian
msgid "no"
msgstr "no"
# Polish
msgid "pl"
msgstr "pl"
# Portuguese (Brazil)
msgid "pt_BR"
msgstr "pt_BR"
# Portuguese (Portugal)
msgid "pt_PT"
msgstr "pt_PT"
# Russian
msgid "ru"
msgstr "ru"
# Slovak
msgid "sk_SK"
msgstr "sk_SK"
# Swedish
msgid "sv_SE"
msgstr "sv_SE"
# Turkish
msgid "tr"
msgstr "tr"
# Chinese (Taiwan)
msgid "zh_TW"
msgstr "zh_TW"
# Chinese (China)
msgid "zh_CN"
msgstr ""
# Hebrew (Israel)
msgid "he_IL"
msgstr ""
# Tamil
msgid "ta"
msgstr ""
# Finnish
msgid "fi"
msgstr ""

View File

@@ -0,0 +1,139 @@
#
# Translators:
# datablitz7 <plant7@gmail.com>, 2020
# ByteGet, 2020
#
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-29 16:33+0000\n"
"Last-Translator: ByteGet, 2020\n"
"Language-Team: Greek (Greece) (https://www.transifex.com/grocy/teams/93189/el_GR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: el_GR\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/permissions\n"
# All permissions
msgid "ADMIN"
msgstr "ΔΙΑΧΕΙΡΙΣΤΗΣ"
# Create users
msgid "USERS_CREATE"
msgstr "ΔΗΜΙΟΥΡΓΙΑ_ΧΡΗΣΤΩΝ"
# Edit users (including passwords)
msgid "USERS_EDIT"
msgstr "ΕΠΕΞΕΡΓΑΣΙΑ_ΧΡΗΣΤΩΝ"
# Show users
msgid "USERS_READ"
msgstr "ΠΡΟΒΟΛΗ_ΧΡΗΣΤΩΝ"
# Edit own user data / change own password
msgid "USERS_EDIT_SELF"
msgstr "ΕΠΕΞΕΡΓΑΣΙΑ_ΙΔΙΟΥ_ΧΡΗΣΤΗ"
# Undo charge cycle
msgid "BATTERIES_UNDO_CHARGE_CYCLE"
msgstr "ΔΙΑΧΕΙΡΙΣΤΗΣ"
# Track charge cycle
msgid "BATTERIES_TRACK_CHARGE_CYCLE"
msgstr "USERS_CREATE"
# Track execution
msgid "CHORE_TRACK_EXECUTION"
msgstr "ΧΡΗΣΤΕΣ_EDIT"
# Undo execution
msgid "CHORE_UNDO_EXECUTION"
msgstr "USERS_READ"
# Edit master data
msgid "MASTER_DATA_EDIT"
msgstr "USERS_EDIT_SELF"
# Undo execution
msgid "TASKS_UNDO_EXECUTION"
msgstr "ΜΠΑΤΑΡΙΕΣ_UNDO_CHARGE_CYCLE"
# Mark completed
msgid "TASKS_MARK_COMPLETED"
msgstr "ΜΠΑΤΑΡΙΑ_TRACK_CHARGE_CYCLE"
# Edit stock entries
msgid "STOCK_EDIT"
msgstr "CHORE_TRACK_EXECUTION"
# Transfer
msgid "STOCK_TRANSFER"
msgstr "CHORE_UNDO_EXECUTION"
# Inventory
msgid "STOCK_INVENTORY"
msgstr "MASTER_DATA_EDIT"
# Consume
msgid "STOCK_CONSUME"
msgstr "ΚΑΘΗΚΟΝΤΑ_UNDO_EXECUTION"
# Open products
msgid "STOCK_OPEN"
msgstr "ΚΑΘΗΚΟΝΤΑ_MARK_COMPLETED"
# Purchase
msgid "STOCK_PURCHASE"
msgstr "STOCK_EDIT"
# Add items
msgid "SHOPPINGLIST_ITEMS_ADD"
msgstr "STOCK_TRANSFER"
# Remove items
msgid "SHOPPINGLIST_ITEMS_DELETE"
msgstr "STOCK_INVENTORY"
# User management
msgid "USERS"
msgstr "STOCK_CONSUME"
# Stock
msgid "STOCK"
msgstr "STOCK_OPEN"
# Shopping list
msgid "SHOPPINGLIST"
msgstr "STOCK_PURCHASE"
# Chores
msgid "CHORES"
msgstr "ΑΓΟΡΑ ΛΙΣΤΑ_ITEMS_ADD"
# Batteries
msgid "BATTERIES"
msgstr "ΑΓΟΡΑ ΛΙΣΤΑ_ITEMS_DELETE"
# Tasks
msgid "TASKS"
msgstr "ΧΡΗΣΤΕΣ"
# Recipes
msgid "RECIPES"
msgstr "ΣΤΟΚ"
# Equipment
msgid "EQUIPMENT"
msgstr "ΛΙΣΤΑ ΜΕ ΤΑ ΨΩΝΙΑ"
# Calendar
msgid "CALENDAR"
msgstr "ΜΙΚΡΟΔΟΥΛΕΙΕΣ"
# Meal plan
msgid "RECIPES_MEALPLAN"
msgstr "ΜΠΑΤΑΡΙΕΣ"

View File

@@ -0,0 +1,46 @@
#
# Translators:
# Dionysios Gkotsis <bloodsak4@yahoo.gr>, 2020
# ByteGet, 2020
#
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: 2019-05-01 17:42+0000\n"
"Last-Translator: ByteGet, 2020\n"
"Language-Team: Greek (Greece) (https://www.transifex.com/grocy/teams/93189/el_GR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: el_GR\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/stock_transaction_types\n"
msgid "purchase"
msgstr "Αγορά"
msgid "transfer_from"
msgstr "μεταφορά απο"
msgid "transfer_to"
msgstr "μεταφορά στο"
msgid "consume"
msgstr "καταναλώνω"
msgid "inventory-correction"
msgstr "διόρθωση αποθέματος"
msgid "product-opened"
msgstr "το προϊόν είναι ανοιχτό"
msgid "stock-edit-old"
msgstr "απόθεμα-επεξεργασία-παλιά"
msgid "stock-edit-new"
msgstr "απόθεμα-επεξεργασία-νέο"
msgid "self-production"
msgstr "αυτοπαραγωγή"

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,71 @@
#
# Translators:
# Dionysios Gkotsis <bloodsak4@yahoo.gr>, 2020
# ByteGet, 2020
#
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: 2019-05-01 17:43+0000\n"
"Last-Translator: ByteGet, 2020\n"
"Language-Team: Greek (Greece) (https://www.transifex.com/grocy/teams/93189/el_GR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: el_GR\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/userfield_types\n"
# Text (single line)
msgid "text-single-line"
msgstr "κείμενο-μονή γραμμή"
# Text (multi line)
msgid "text-multi-line"
msgstr "κείμενο-πολλαπλών γραμμών"
# Number (integral)
msgid "number-integral"
msgstr "αριθμός-ακέραιο"
# Number (decimal)
msgid "number-decimal"
msgstr "αριθμός-δεκαδικός"
# Date (without time)
msgid "date"
msgstr "ημερομηνία"
# Date & time
msgid "datetime"
msgstr "ημερομηνία ώρα"
# Checkbox
msgid "checkbox"
msgstr "πλαίσιο ελέγχου"
# Select list (a single item can be selected)
msgid "preset-list"
msgstr "προκαθορισμένη λίστα"
# Select list (multiple items can be selected)
msgid "preset-checklist"
msgstr "προκαθορισμένη λίστα ελέγχου"
# Link
msgid "link"
msgstr "σύνδεσμος"
# Link (with title)
msgid "link-with-title"
msgstr ""
# File
msgid "file"
msgstr ""
# Image
msgid "image"
msgstr ""

View File

@@ -0,0 +1,91 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: http://www.transifex.com/grocy/grocy/language/en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-05-01T17:59:17+00:00\n"
"Language: en\n"
"X-Domain: grocy/locales\n"
msgid "cs"
msgstr "Czech"
msgid "da"
msgstr "Danish"
msgid "de"
msgstr "German"
msgid "el_GR"
msgstr "Greek"
msgid "en"
msgstr "English"
msgid "en_GB"
msgstr "English (Great Britain)"
msgid "es"
msgstr "Spanish"
msgid "fr"
msgstr "French"
msgid "hu"
msgstr "Hungarian"
msgid "it"
msgstr "Italian"
msgid "ja"
msgstr "Japanese"
msgid "ko_KR"
msgstr "Korean"
msgid "nl"
msgstr "Dutch"
msgid "no"
msgstr "Norwegian"
msgid "pl"
msgstr "Polish"
msgid "pt_BR"
msgstr "Portuguese (Brazil)"
msgid "pt_PT"
msgstr "Portuguese (Portugal)"
msgid "ru"
msgstr "Russian"
msgid "sk_SK"
msgstr "Slovak"
msgid "sv_SE"
msgstr "Swedish"
msgid "tr"
msgstr "Turkish"
msgid "zh_TW"
msgstr "Chinese (Taiwan)"
msgid "zh_CN"
msgstr "Chinese (China)"
msgid "he_IL"
msgstr "Hebrew (Israel)"
msgid "ta"
msgstr "Tamil"
msgid "fi"
msgstr "Finnish"

View File

@@ -0,0 +1,103 @@
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: 2019-05-01T17:59:17+00:00\n"
"Last-Translator: \n"
"Language-Team: http://www.transifex.com/grocy/grocy/language/en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en\n"
"X-Domain: grocy/permissions\n"
msgid "ADMIN"
msgstr "All permissions"
msgid "USERS_CREATE"
msgstr "Create users"
msgid "USERS_EDIT"
msgstr "Edit users (including passwords)"
msgid "USERS_READ"
msgstr "Show users"
msgid "USERS_EDIT_SELF"
msgstr "Edit own user data / change own password"
msgid "BATTERIES_UNDO_CHARGE_CYCLE"
msgstr "Undo charge cycle"
msgid "BATTERIES_TRACK_CHARGE_CYCLE"
msgstr "Track charge cycle"
msgid "CHORE_TRACK_EXECUTION"
msgstr "Track execution"
msgid "CHORE_UNDO_EXECUTION"
msgstr "Undo execution"
msgid "MASTER_DATA_EDIT"
msgstr "Edit master data"
msgid "TASKS_UNDO_EXECUTION"
msgstr "Undo execution"
msgid "TASKS_MARK_COMPLETED"
msgstr "Mark completed"
msgid "STOCK_EDIT"
msgstr "Edit stock entries"
msgid "STOCK_TRANSFER"
msgstr "Transfer"
msgid "STOCK_INVENTORY"
msgstr "Inventory"
msgid "STOCK_CONSUME"
msgstr "Consume"
msgid "STOCK_OPEN"
msgstr "Open products"
msgid "STOCK_PURCHASE"
msgstr "Purchase"
msgid "SHOPPINGLIST_ITEMS_ADD"
msgstr "Add items"
msgid "SHOPPINGLIST_ITEMS_DELETE"
msgstr "Remove items"
msgid "USERS"
msgstr "User management"
msgid "STOCK"
msgstr "Stock"
msgid "SHOPPINGLIST"
msgstr "Shopping list"
msgid "CHORES"
msgstr "Chores"
msgid "BATTERIES"
msgstr "Batteries"
msgid "TASKS"
msgstr "Tasks"
msgid "RECIPES"
msgstr "Recipes"
msgid "EQUIPMENT"
msgstr "Equipment"
msgid "CALENDAR"
msgstr "Calendar"
msgid "RECIPES_MEALPLAN"
msgstr "Meal plan"

View File

@@ -41,3 +41,12 @@ msgstr "Select list (multiple items can be selected)"
msgid "link"
msgstr "Link"
msgid "link-with-title"
msgstr "Link (with title)"
msgid "file"
msgstr "File"
msgid "image"
msgstr "Image"

View File

@@ -1,5 +1,8 @@
#
# Translators:
# Jonathan Adams <jonathan@connockadams.uk>, 2020
# duck. <me@duck.me.uk>, 2020
# John Coles <john@johncoles.com>, 2020
#
msgid ""
msgstr ""
@@ -7,7 +10,7 @@ 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: Jonathan Adams <jonathan@connockadams.uk>, 2020\n"
"Last-Translator: John Coles <john@johncoles.com>, 2020\n"
"Language-Team: English (United Kingdom) (https://www.transifex.com/grocy/teams/93189/en_GB/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -26,7 +29,7 @@ msgid "Pantry"
msgstr "Pantry"
msgid "Candy cupboard"
msgstr "Candy cupboard"
msgstr "Sweets cupboard"
msgid "Tinned food cupboard"
msgstr "Tinned food cupboard"
@@ -223,10 +226,10 @@ msgid "Dishwasher"
msgstr "Dishwasher"
msgid "Liter"
msgstr "Liter"
msgstr "Litre"
msgid "Liters"
msgstr "Liters"
msgstr "Litres"
msgid "Bottle"
msgstr "Bottle"
@@ -241,10 +244,10 @@ msgid "Chocolate sauce"
msgstr "Chocolate sauce"
msgid "Milliliters"
msgstr "Milliliters"
msgstr "Millilitres"
msgid "Milliliter"
msgstr "Milliliter"
msgstr "Millilitre"
msgid "Bottom"
msgstr "Bottom"
@@ -333,33 +336,51 @@ msgid "Portuguese (Brazil)"
msgstr "Portuguese (Brazil)"
msgid "This is a note"
msgstr ""
msgstr "This is a note"
msgid "Freezer"
msgstr ""
msgstr "Freezer"
msgid "Hungarian"
msgstr ""
msgstr "Hungarian"
msgid "Slovak"
msgstr ""
msgstr "Slovak"
msgid "Czech"
msgstr ""
msgstr "Czech"
msgid "Portuguese (Portugal)"
msgstr ""
msgstr "Portuguese (Portugal)"
# Use a in your country well known supermarket name
msgid "DemoSupermarket1"
msgstr ""
msgstr "DemoSupermarket1"
# Use a in your country well known supermarket name
msgid "DemoSupermarket2"
msgstr ""
msgstr "DemoSupermarket2"
msgid "Japanese"
msgstr ""
msgstr "Japanese"
msgid "Chinese (Taiwan)"
msgstr "Chinese (Taiwan)"
msgid "Greek"
msgstr "Greek"
msgid "Korean"
msgstr "Korean"
msgid "Chinese (China)"
msgstr ""
msgid "Hebrew (Israel)"
msgstr ""
msgid "Tamil"
msgstr ""
msgid "Finnish"
msgstr ""

View File

@@ -0,0 +1,91 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: http://www.transifex.com/grocy/grocy/language/en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-05-01T17:59:17+00:00\n"
"PO-Revision-Date: 2019-05-01T17:59:17+00:00\n"
"Language: en\n"
"X-Domain: grocy/locales\n"
msgid "cs"
msgstr "Czech"
msgid "da"
msgstr "Danish"
msgid "de"
msgstr "German"
msgid "el_GR"
msgstr "Greek"
msgid "en"
msgstr "English"
msgid "en_GB"
msgstr "English (Great Britain)"
msgid "es"
msgstr "Spanish"
msgid "fr"
msgstr "French"
msgid "hu"
msgstr "Hungarian"
msgid "it"
msgstr "Italian"
msgid "ja"
msgstr "Japanese"
msgid "ko_KR"
msgstr "Korean"
msgid "nl"
msgstr "Dutch"
msgid "no"
msgstr "Norwegian"
msgid "pl"
msgstr "Polish"
msgid "pt_BR"
msgstr "Portuguese (Brazil)"
msgid "pt_PT"
msgstr "Portuguese (Portugal)"
msgid "ru"
msgstr "Russian"
msgid "sk_SK"
msgstr "Slovak"
msgid "sv_SE"
msgstr "Swedish"
msgid "tr"
msgstr "Turkish"
msgid "zh_TW"
msgstr "Chinese (Taiwan)"
msgid "zh_CN"
msgstr "Chinese (China)"
msgid "he_IL"
msgstr "Hebrew (Israel)"
msgid "ta"
msgstr "Tamil"
msgid "fi"
msgstr "Finnish"

View File

@@ -0,0 +1,103 @@
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: 2019-05-01T17:59:17+00:00\n"
"Last-Translator: \n"
"Language-Team: http://www.transifex.com/grocy/grocy/language/en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en\n"
"X-Domain: grocy/permissions\n"
msgid "ADMIN"
msgstr "All permissions"
msgid "USERS_CREATE"
msgstr "Create users"
msgid "USERS_EDIT"
msgstr "Edit users (including passwords)"
msgid "USERS_READ"
msgstr "Show users"
msgid "USERS_EDIT_SELF"
msgstr "Edit own user data / change own password"
msgid "BATTERIES_UNDO_CHARGE_CYCLE"
msgstr "Undo charge cycle"
msgid "BATTERIES_TRACK_CHARGE_CYCLE"
msgstr "Track charge cycle"
msgid "CHORE_TRACK_EXECUTION"
msgstr "Track execution"
msgid "CHORE_UNDO_EXECUTION"
msgstr "Undo execution"
msgid "MASTER_DATA_EDIT"
msgstr "Edit master data"
msgid "TASKS_UNDO_EXECUTION"
msgstr "Undo execution"
msgid "TASKS_MARK_COMPLETED"
msgstr "Mark completed"
msgid "STOCK_EDIT"
msgstr "Edit stock entries"
msgid "STOCK_TRANSFER"
msgstr "Transfer"
msgid "STOCK_INVENTORY"
msgstr "Inventory"
msgid "STOCK_CONSUME"
msgstr "Consume"
msgid "STOCK_OPEN"
msgstr "Open products"
msgid "STOCK_PURCHASE"
msgstr "Purchase"
msgid "SHOPPINGLIST_ITEMS_ADD"
msgstr "Add items"
msgid "SHOPPINGLIST_ITEMS_DELETE"
msgstr "Remove items"
msgid "USERS"
msgstr "User management"
msgid "STOCK"
msgstr "Stock"
msgid "SHOPPINGLIST"
msgstr "Shopping list"
msgid "CHORES"
msgstr "Chores"
msgid "BATTERIES"
msgstr "Batteries"
msgid "TASKS"
msgstr "Tasks"
msgid "RECIPES"
msgstr "Recipes"
msgid "EQUIPMENT"
msgstr "Equipment"
msgid "CALENDAR"
msgstr "Calendar"
msgid "RECIPES_MEALPLAN"
msgstr "Meal plan"

File diff suppressed because it is too large Load Diff

View File

@@ -41,3 +41,12 @@ msgstr "Select list (multiple items can be selected)"
msgid "link"
msgstr "Link"
msgid "link-with-title"
msgstr "Link (with title)"
msgid "file"
msgstr "File"
msgid "image"
msgstr "Image"

View File

@@ -1,8 +1,10 @@
#
# Translators:
# Ankue <ankue.spam@gmail.com>, 2019
# Fernando Sánchez <fernando.l.sanchez@gmail.com>, 2019
# Igor Perez <igordiablo@hotmail.com>, 2020
# Jose Rugel <joserugel@gmail.com>, 2020
# Alan Pucheta <apucheta@protonmail.com>, 2020
#
msgid ""
msgstr ""
@@ -10,7 +12,7 @@ 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: Jose Rugel <joserugel@gmail.com>, 2020\n"
"Last-Translator: Alan Pucheta <apucheta@protonmail.com>, 2020\n"
"Language-Team: Spanish (https://www.transifex.com/grocy/teams/93189/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -366,3 +368,21 @@ msgstr "Japonés"
msgid "Chinese (Taiwan)"
msgstr "Chino (Taiwan)"
msgid "Greek"
msgstr "Griego"
msgid "Korean"
msgstr "Coreano"
msgid "Chinese (China)"
msgstr ""
msgid "Hebrew (Israel)"
msgstr ""
msgid "Tamil"
msgstr ""
msgid "Finnish"
msgstr ""

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,4 @@
#
# Translators:
# Fernando Sánchez <fernando.l.sanchez@gmail.com>, 2019
# Jose Rugel <joserugel@gmail.com>, 2020
@@ -17,32 +18,54 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/userfield_types\n"
# Text (single line)
msgid "text-single-line"
msgstr "texto-unica-linea"
# Text (multi line)
msgid "text-multi-line"
msgstr "texto-multi-linea"
# Number (integral)
msgid "number-integral"
msgstr "numero-entero"
# Number (decimal)
msgid "number-decimal"
msgstr "numero-decimal"
# Date (without time)
msgid "date"
msgstr "fecha"
# Date & time
msgid "datetime"
msgstr "fecha-hora"
# Checkbox
msgid "checkbox"
msgstr "casilla-verificacion"
# Select list (a single item can be selected)
msgid "preset-list"
msgstr "lista-predefinida"
# Select list (multiple items can be selected)
msgid "preset-checklist"
msgstr "casillas-predefinidas"
# Link
msgid "link"
msgstr "enlace"
# Link (with title)
msgid "link-with-title"
msgstr ""
# File
msgid "file"
msgstr ""
# Image
msgid "image"
msgstr ""

View File

@@ -0,0 +1,32 @@
#
# Translators:
# Niko G <niko9911@ironlions.fi>, 2019
# Termitebug <rogueshadow@keemail.me>, 2020
# jarkko hämäläinen <zeik@iki.fi>, 2020
#
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: 2019-09-17 10:45+0000\n"
"Last-Translator: jarkko hämäläinen <zeik@iki.fi>, 2020\n"
"Language-Team: Finnish (https://www.transifex.com/grocy/teams/93189/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/chore_assignment_types\n"
msgid "no-assignment"
msgstr "ei-asetusta"
msgid "who-least-did-first"
msgstr "vähiten tehnyt"
msgid "random"
msgstr "satunnainen"
msgid "in-alphabetical-order"
msgstr "aakkosjärjestyksessä"

View File

@@ -0,0 +1,37 @@
#
# Translators:
# Termitebug <rogueshadow@keemail.me>, 2020
# jarkko hämäläinen <zeik@iki.fi>, 2020
#
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: 2019-05-01 17:42+0000\n"
"Last-Translator: jarkko hämäläinen <zeik@iki.fi>, 2020\n"
"Language-Team: Finnish (https://www.transifex.com/grocy/teams/93189/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/chore_types\n"
msgid "manually"
msgstr "käsin"
msgid "dynamic-regular"
msgstr "toistuu säännöllisesti"
msgid "daily"
msgstr "päivittäin"
msgid "weekly"
msgstr "viikoittain"
msgid "monthly"
msgstr "kuukausittain"
msgid "yearly"
msgstr "vuosittain"

View File

@@ -0,0 +1,55 @@
#
# Translators:
# Bernd Bestel <bernd@berrnd.de>, 2020
#
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: 2019-05-01 17:42+0000\n"
"Last-Translator: Bernd Bestel <bernd@berrnd.de>, 2020\n"
"Language-Team: Finnish (https://www.transifex.com/grocy/teams/93189/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/component_translations\n"
msgid "timeago_locale"
msgstr "fi"
msgid "timeago_nan"
msgstr "NaN vuotta"
msgid "moment_locale"
msgstr "fi"
msgid "datatables_localization"
msgstr ""
"{\"sEmptyTable\":\"Ei näytettäviä tuloksia.\",\"sInfo\":\"Näytetään rivit "
"_START_ - _END_ (yhteensä _TOTAL_ )\",\"sInfoEmpty\":\"Näytetään 0 - 0 "
"(yhteensä 0)\",\"sInfoFiltered\":\"(suodatettu _MAX_ tuloksen "
"joukosta)\",\"sInfoThousands\":\",\",\"sLengthMenu\":\"Näytä kerralla _MENU_"
" "
"riviä\",\"sLoadingRecords\":\"Ladataan...\",\"sProcessing\":\"Hetkinen...\",\"sSearch\":\"Etsi:\",\"sZeroRecords\":\"Tietoja"
" ei "
"löytynyt\",\"oPaginate\":{\"sFirst\":\"Ensimmäinen\",\"sLast\":\"Viimeinen\",\"sNext\":\"Seuraava\",\"sPrevious\":\"Edellinen\"},\"oAria\":{\"sSortAscending\":\":"
" lajittele sarake nousevasti\",\"sSortDescending\":\": lajittele sarake "
"laskevasti\"},\"select\":{\"rows\":{\"0\":\"Klikkaa riviä valitaksesi "
"sen\",\"1\":\"Valittuna vain yksi rivi\",\"_\":\"Valittuna %d "
"riviä\"}},\"buttons\":{\"copy\":\"Kopioi\",\"copySuccess\":{\"1\":\"Yksi "
"rivi kopioitu leikepöydälle\",\"_\":\"%d riviä kopioitu "
"leikepöydälle\"},\"copyTitle\":\"Kopioi leikepöydälle\",\"copyKeys\":\"Paina"
" <i>ctrl</i> tai <i>⌘</i> + <i>C</i> kopioidaksesi taulukon arvot<br> "
"leikepöydälle. <br><br>Peruuttaaksesi klikkaa tähän tai Esc.\"}}"
msgid "summernote_locale"
msgstr "fi-FI"
msgid "fullcalendar_locale"
msgstr "fi"
msgid "bootstrap-select_locale"
msgstr "fi_FI"

View File

@@ -0,0 +1,387 @@
#
# Translators:
# Termitebug <rogueshadow@keemail.me>, 2020
# jarkko hämäläinen <zeik@iki.fi>, 2020
# Jukka-Pekka Kokkonen <jukkapekka.kokkonen@gmail.com>, 2020
# Matti Koskimies <matti@apulanta.fi>, 2020
#
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: 2019-05-01 17:42+0000\n"
"Last-Translator: Matti Koskimies <matti@apulanta.fi>, 2020\n"
"Language-Team: Finnish (https://www.transifex.com/grocy/teams/93189/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/demo_data\n"
msgid "Cookies"
msgstr "Keksit"
msgid "Chocolate"
msgstr "Suklaa"
msgid "Pantry"
msgstr "Ruokakomero"
msgid "Candy cupboard"
msgstr "Karkkikaappi"
msgid "Tinned food cupboard"
msgstr "Säilykekaappi"
msgid "Fridge"
msgstr "Jääkaappi"
msgid "Piece"
msgid_plural "Pieces"
msgstr[0] "Kappale"
msgstr[1] "Kappaletta"
msgid "Pack"
msgid_plural "Packs"
msgstr[0] "Paketti"
msgstr[1] "Pakettia"
msgid "Glass"
msgid_plural "Glasses"
msgstr[0] "Lasi"
msgstr[1] "Lasia"
msgid "Tin"
msgid_plural "Tins"
msgstr[0] "Purkki"
msgstr[1] "Purkkia"
msgid "Can"
msgid_plural "Cans"
msgstr[0] "Tölkki"
msgstr[1] "Tölkkiä"
msgid "Bunch"
msgid_plural "Bunches"
msgstr[0] "Nippu"
msgstr[1] "Nippua"
msgid "Gummy bears"
msgstr "Nallekarkkeja"
msgid "Crisps"
msgstr "Sipsejä"
msgid "Eggs"
msgstr "Munia"
msgid "Noodles"
msgstr "Nuudeleita"
msgid "Pickles"
msgstr "Suolakurkkuja"
msgid "Gulash soup"
msgstr "Gulassikeitto"
msgid "Yogurt"
msgstr "Jugurtti"
msgid "Cheese"
msgstr "Juusto"
msgid "Cold cuts"
msgstr "Leikkele"
msgid "Paprika"
msgstr "Paprika"
msgid "Cucumber"
msgstr "Kurkku"
msgid "Radish"
msgstr "Retiisi"
msgid "Tomato"
msgstr "Tomaatti"
msgid "Changed towels in the bathroom"
msgstr "Vaihdettu käsipyyhkeet"
msgid "Cleaned the kitchen floor"
msgstr "Pesty keittiön lattia"
msgid "Warranty ends"
msgstr "Takuu päättyy"
msgid "TV remote control"
msgstr "TV kaukosäädin"
msgid "Alarm clock"
msgstr "Herätyskello"
msgid "Heat remote control"
msgstr "Lämpökaukosäädin"
msgid "Lawn mowed in the garden"
msgstr "Ruoho leikattu puutarhassa"
msgid "Some good snacks"
msgstr "Hyviä välipaloja"
msgid "Pizza dough"
msgstr "Pizzataikina"
msgid "Sieved tomatoes"
msgstr "Tomaattimurska"
msgid "Salami"
msgstr "Salami"
msgid "Toast"
msgstr "Paahtoleipä"
msgid "Minced meat"
msgstr "Jauheliha"
msgid "Pizza"
msgstr "Pizza"
msgid "Spaghetti bolognese"
msgstr "Spagetti bolognese"
msgid "Sandwiches"
msgstr "Voileipiä"
msgid "English"
msgstr "Englanti"
msgid "German"
msgstr "Saksa"
msgid "Italian"
msgstr "Italia"
msgid "This is the note content of the recipe ingredient"
msgstr "Tämä on reseptin ainesosan muistiinpanojen sisältö"
msgid "Demo User"
msgstr "Testikäyttäjä"
msgid "Gram"
msgid_plural "Grams"
msgstr[0] "Grammaa"
msgstr[1] "Grammaa"
msgid "Flour"
msgstr "Jauhot"
msgid "Pancakes"
msgstr "Lettuja"
msgid "Sugar"
msgstr "Sokeri"
msgid "Home"
msgstr "Koti"
msgid "Life"
msgstr "Elämä"
msgid "Projects"
msgstr "Projektit"
msgid "Repair the garage door"
msgstr "Korjaa autotallin ovi"
msgid "Fork and improve grocy"
msgstr "Forkkaa grocy ja paranna sitä"
msgid "Find a solution for what to do when I forget the door keys"
msgstr "Mitä tehdä, kun avaimet jääneet kotiin"
msgid "Sweets"
msgstr "Makeiset"
msgid "Bakery products"
msgstr "Leipomotuotteet"
msgid "Tinned food"
msgstr "Säilykepurkit"
msgid "Butchery products"
msgstr "Lihatuotteet"
msgid "Vegetables/Fruits"
msgstr "Vihannekset/Hedelmät"
msgid "Refrigerated products"
msgstr "Jääkaappituotteet"
msgid "Coffee machine"
msgstr "Kahviautomaatti"
msgid "Dishwasher"
msgstr "Tiskikone"
msgid "Liter"
msgstr "Litra"
msgid "Liters"
msgstr "Litrat"
msgid "Bottle"
msgstr "Pullo"
msgid "Bottles"
msgstr "Pullot"
msgid "Milk"
msgstr "Maito"
msgid "Chocolate sauce"
msgstr "Suklaakastike"
msgid "Milliliters"
msgstr "Millilitrat"
msgid "Milliliter"
msgstr "Millilitra"
msgid "Bottom"
msgstr "Pohja"
msgid "Topping"
msgstr "Kuorrute"
msgid "French"
msgstr "Ranska"
msgid "Turkish"
msgstr "Turkki"
msgid "Spanish"
msgstr "Espanja"
msgid "Russian"
msgstr "Venäjä"
msgid "The thing which happens on the 5th of every month"
msgstr "Asia, joka tapahtuu joka kuukauden 5. päivänä"
msgid "The thing which happens daily"
msgstr "Päivittäiset askareet"
msgid "The thing which happens on Mondays and Wednesdays"
msgstr "Asiat/Tehtävät, jotka tehdään maanantaisin ja keskiviikkoisin"
msgid "Swedish"
msgstr "Ruotsi"
msgid "Polish"
msgstr "Puola"
msgid "Milk Chocolate"
msgstr "Maitokaakao"
msgid "Dark Chocolate"
msgstr "Tumma kaakao"
msgid "Slice"
msgid_plural "Slices"
msgstr[0] "Viipale"
msgstr[1] "Viipaletta"
msgid "Example userentity"
msgstr "Esimerkki omasta oliosta"
msgid "This is an example user entity..."
msgstr "Tämä on esimerkki omasta oliosta..."
msgid "Custom field"
msgstr "Mukautettu kenttä"
msgid "Example field value..."
msgstr "Esimerkkiarvo..."
msgid "Waffle rolls"
msgstr "Vohvelirullat"
msgid "Danish"
msgstr "Tanska"
msgid "Dutch"
msgstr "Hollanti"
msgid "Norwegian"
msgstr "Norja"
msgid "Demo"
msgstr "Demo"
msgid "Stable version"
msgstr "Vakaa versio"
msgid "Preview version"
msgstr "Esijulkaisu versio"
msgid "current release"
msgstr "nykyinen julkaisu"
msgid "not yet released"
msgstr "ei vielä julkaistu"
msgid "Portuguese (Brazil)"
msgstr "Portugali (Brasilia)"
msgid "This is a note"
msgstr "Muistiinpanot"
msgid "Freezer"
msgstr "Pakastin"
msgid "Hungarian"
msgstr "Unkari"
msgid "Slovak"
msgstr "Slovakia"
msgid "Czech"
msgstr "Tsekki"
msgid "Portuguese (Portugal)"
msgstr "Portugali (Portugali)"
# Use a in your country well known supermarket name
msgid "DemoSupermarket1"
msgstr "Demo kauppa1"
# Use a in your country well known supermarket name
msgid "DemoSupermarket2"
msgstr "Demo kauppa2"
msgid "Japanese"
msgstr "Japani"
msgid "Chinese (Taiwan)"
msgstr "Kiina (Taiwan)"
msgid "Greek"
msgstr "Kreikka"
msgid "Korean"
msgstr "Korea"
msgid "Chinese (China)"
msgstr ""
msgid "Hebrew (Israel)"
msgstr ""
msgid "Tamil"
msgstr ""
msgid "Finnish"
msgstr ""

123
localization/fi/locales.po Normal file
View File

@@ -0,0 +1,123 @@
#
# Translators:
# James Jesse <jt.inkinen@gmail.com>, 2020
# Matti Koskimies <matti@apulanta.fi>, 2020
#
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"
"Last-Translator: Matti Koskimies <matti@apulanta.fi>, 2020\n"
"Language-Team: Finnish (https://www.transifex.com/grocy/teams/93189/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/locales\n"
# Czech
msgid "cs"
msgstr "cs"
# Danish
msgid "da"
msgstr "da"
# German
msgid "de"
msgstr "de"
# Greek
msgid "el_GR"
msgstr "el_GR"
# English
msgid "en"
msgstr "en"
# English (Great Britain)
msgid "en_GB"
msgstr "en_GB"
# Spanish
msgid "es"
msgstr "es"
# French
msgid "fr"
msgstr "fr"
# Hungarian
msgid "hu"
msgstr "hu"
# Italian
msgid "it"
msgstr "it"
# Japanese
msgid "ja"
msgstr "ja"
# Korean
msgid "ko_KR"
msgstr "ko_KR"
# Dutch
msgid "nl"
msgstr "nl"
# Norwegian
msgid "no"
msgstr "no"
# Polish
msgid "pl"
msgstr "pl"
# Portuguese (Brazil)
msgid "pt_BR"
msgstr "pt_BR"
# Portuguese (Portugal)
msgid "pt_PT"
msgstr "pt_PT"
# Russian
msgid "ru"
msgstr "ru"
# Slovak
msgid "sk_SK"
msgstr "sk_SK"
# Swedish
msgid "sv_SE"
msgstr "sv_SE"
# Turkish
msgid "tr"
msgstr "tr"
# Chinese (Taiwan)
msgid "zh_TW"
msgstr "zh_TW"
# Chinese (China)
msgid "zh_CN"
msgstr "zh_CN"
# Hebrew (Israel)
msgid "he_IL"
msgstr "he_IL"
# Tamil
msgid "ta"
msgstr ""
# Finnish
msgid "fi"
msgstr ""

View File

@@ -0,0 +1,138 @@
#
# Translators:
# James Jesse <jt.inkinen@gmail.com>, 2020
#
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-29 16:33+0000\n"
"Last-Translator: James Jesse <jt.inkinen@gmail.com>, 2020\n"
"Language-Team: Finnish (https://www.transifex.com/grocy/teams/93189/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/permissions\n"
# All permissions
msgid "ADMIN"
msgstr "PÄÄKÄYTTÄJÄ"
# Create users
msgid "USERS_CREATE"
msgstr "KÄYTTÄJÄT_LUOVAT"
# Edit users (including passwords)
msgid "USERS_EDIT"
msgstr "KÄYTTÄJÄT_MUOKKAAVAT"
# Show users
msgid "USERS_READ"
msgstr "KÄYTTÄJÄT_LUKEVAT"
# Edit own user data / change own password
msgid "USERS_EDIT_SELF"
msgstr "KÄYTTÄJÄT_MUOKKAAVAT_ITSE"
# Undo charge cycle
msgid "BATTERIES_UNDO_CHARGE_CYCLE"
msgstr "PARISTOT_PERUUTA_LATAUS_SYKLI"
# Track charge cycle
msgid "BATTERIES_TRACK_CHARGE_CYCLE"
msgstr "PARISTOT_SEURAA_LATAUS_SYKLI"
# Track execution
msgid "CHORE_TRACK_EXECUTION"
msgstr "TYÖ_SEURAA_VALMISTUS"
# Undo execution
msgid "CHORE_UNDO_EXECUTION"
msgstr "TYÖ_PERUUTA_TOTEUTUS"
# Edit master data
msgid "MASTER_DATA_EDIT"
msgstr "MASTER_DATA_MUOKKAA"
# Undo execution
msgid "TASKS_UNDO_EXECUTION"
msgstr "TEHTÄVÄT_PERUUTA_TOTEUTUS"
# Mark completed
msgid "TASKS_MARK_COMPLETED"
msgstr "TEHTÄVÄT_MERKITSE_SUORITETTU"
# Edit stock entries
msgid "STOCK_EDIT"
msgstr "VARASTO_MUOKKAA"
# Transfer
msgid "STOCK_TRANSFER"
msgstr "VARASTO_SIIRRÄ"
# Inventory
msgid "STOCK_INVENTORY"
msgstr "VARASTO_LUETTELO"
# Consume
msgid "STOCK_CONSUME"
msgstr "VARASTO_KÄYTÄ"
# Open products
msgid "STOCK_OPEN"
msgstr "VARASTO_AVAA"
# Purchase
msgid "STOCK_PURCHASE"
msgstr "VARASTO_OSTO"
# Add items
msgid "SHOPPINGLIST_ITEMS_ADD"
msgstr "KAUPPALISTA_TUOTTEET_LISÄÄ"
# Remove items
msgid "SHOPPINGLIST_ITEMS_DELETE"
msgstr "KAUPPALISTA_TUOTTEET_POISTA"
# User management
msgid "USERS"
msgstr "KÄYTTÄJÄT"
# Stock
msgid "STOCK"
msgstr "VARASTO"
# Shopping list
msgid "SHOPPINGLIST"
msgstr "KAUPPALISTA"
# Chores
msgid "CHORES"
msgstr "TYÖ"
# Batteries
msgid "BATTERIES"
msgstr "PARISTOT"
# Tasks
msgid "TASKS"
msgstr "TEHTÄVÄT"
# Recipes
msgid "RECIPES"
msgstr "RESEPTIT"
# Equipment
msgid "EQUIPMENT"
msgstr "TARVIKKEET"
# Calendar
msgid "CALENDAR"
msgstr "KALENTERI"
# Meal plan
msgid "RECIPES_MEALPLAN"
msgstr "RESEPTIT_PÄIVÄLLISSUUNNITELMA"

View File

@@ -0,0 +1,48 @@
#
# Translators:
# Termitebug <rogueshadow@keemail.me>, 2020
# James Jesse <jt.inkinen@gmail.com>, 2020
# jarkko hämäläinen <zeik@iki.fi>, 2020
# Jukka-Pekka Kokkonen <jukkapekka.kokkonen@gmail.com>, 2020
#
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: 2019-05-01 17:42+0000\n"
"Last-Translator: Jukka-Pekka Kokkonen <jukkapekka.kokkonen@gmail.com>, 2020\n"
"Language-Team: Finnish (https://www.transifex.com/grocy/teams/93189/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/stock_transaction_types\n"
msgid "purchase"
msgstr "osta"
msgid "transfer_from"
msgstr "siirrä täältä"
msgid "transfer_to"
msgstr "siirrä tähän"
msgid "consume"
msgstr "kuluta"
msgid "inventory-correction"
msgstr "varaston korjaus"
msgid "product-opened"
msgstr "Tuote avattu"
msgid "stock-edit-old"
msgstr "vanha varaston muutos"
msgid "stock-edit-new"
msgstr "uusi varaston muutos"
msgid "self-production"
msgstr "itse tehty"

2260
localization/fi/strings.po Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,72 @@
#
# Translators:
# oskari uusitalo <osku78@gmail.com>, 2019
# Niko G <niko9911@ironlions.fi>, 2019
# Jukka-Pekka Kokkonen <jukkapekka.kokkonen@gmail.com>, 2020
#
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: 2019-05-01 17:43+0000\n"
"Last-Translator: Jukka-Pekka Kokkonen <jukkapekka.kokkonen@gmail.com>, 2020\n"
"Language-Team: Finnish (https://www.transifex.com/grocy/teams/93189/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Domain: grocy/userfield_types\n"
# Text (single line)
msgid "text-single-line"
msgstr "teksti-yksi-rivi"
# Text (multi line)
msgid "text-multi-line"
msgstr "teksti-monta-riviä"
# Number (integral)
msgid "number-integral"
msgstr "numero-kokonaisluku"
# Number (decimal)
msgid "number-decimal"
msgstr "numero-desimaali"
# Date (without time)
msgid "date"
msgstr "päivämäärä"
# Date & time
msgid "datetime"
msgstr "päivämäärä ja aika"
# Checkbox
msgid "checkbox"
msgstr "valintaruutu"
# Select list (a single item can be selected)
msgid "preset-list"
msgstr "esiasetettu luettelo"
# Select list (multiple items can be selected)
msgid "preset-checklist"
msgstr "esiasetettu valintalista"
# Link
msgid "link"
msgstr "linkki"
# Link (with title)
msgid "link-with-title"
msgstr ""
# File
msgid "file"
msgstr "tiedosto"
# Image
msgid "image"
msgstr "kuva"

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