Compare commits
533 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
dedbee3181 | ||
|
16f686deb8 | ||
|
973e4226b6 | ||
|
6e22d3b100 | ||
|
9b119da8e0 | ||
|
03f9ba45ea | ||
|
a965d01fb9 | ||
|
a123535b0a | ||
|
3a2929c016 | ||
|
106f25cc6b | ||
|
d6cc87ac86 | ||
|
a47bccab3f | ||
|
393a312186 | ||
|
7f21e2de34 | ||
|
82ac996b3a | ||
|
827134c972 | ||
|
787d5f11e0 | ||
|
2d2039f988 | ||
|
268f0d8a50 | ||
|
9dde46d419 | ||
|
162ba267a1 | ||
|
4691b45510 | ||
|
e2ebc037f2 | ||
|
550aa5565b | ||
|
c105ebc979 | ||
|
7ef744a995 | ||
|
ee4a082c74 | ||
|
1d7f7b2992 | ||
|
7689356a57 | ||
|
1401ed5c00 | ||
|
bae4a7f04c | ||
|
a44d746176 | ||
|
3afb9643c4 | ||
|
61a3a4329b | ||
|
491ad8c791 | ||
|
339a1ebffc | ||
|
1c35fecc85 | ||
|
d006436d49 | ||
|
6c4cc00fd5 | ||
|
847337443d | ||
|
b74fbddd94 | ||
|
8b444a03e5 | ||
|
e946ec79d5 | ||
|
ca740e8cee | ||
|
5d48b02b37 | ||
|
73ad9d39ab | ||
|
fd7e24b7d1 | ||
|
57ccb8645e | ||
|
e8d6d455f4 | ||
|
f7c22ec384 | ||
|
98768bd846 | ||
|
e52b1c5f60 | ||
|
c263aba6a5 | ||
|
edca302b71 | ||
|
f6d6e933e3 | ||
|
78e4e918c6 | ||
|
fa35d933e0 | ||
|
9ae7c72e87 | ||
|
c415e2f8da | ||
|
297cc57244 | ||
|
1496a58673 | ||
|
d05038e311 | ||
|
de4c6e8b60 | ||
|
70bb014c9f | ||
|
8c033ff6c8 | ||
|
8c79cc4f8e | ||
|
89c6d6683a | ||
|
d0e0102752 | ||
|
bc5051351a | ||
|
08c1efa0ad | ||
|
2633d3d1a5 | ||
|
aec71bd408 | ||
|
10661706b9 | ||
|
2c0a71078f | ||
|
02fe3f2119 | ||
|
55adc140b2 | ||
|
04f362b723 | ||
|
979c67b44c | ||
|
825321593b | ||
|
99db10a490 | ||
|
2cba3ce7e9 | ||
|
b53cdd4c42 | ||
|
cd7139c6cf | ||
|
c3dd1c4187 | ||
|
89761ac141 | ||
|
f427849e89 | ||
|
d16d976d0b | ||
|
ddf0ff0aef | ||
|
fb57d9ef13 | ||
|
c43fe24e47 | ||
|
6ab5bc3a29 | ||
|
ecb9f53bb4 | ||
|
6e3182884a | ||
|
ceb50774dc | ||
|
5f65f2abd0 | ||
|
49daed6c2b | ||
|
628e779902 | ||
|
99546815f9 | ||
|
7ceba3c0c1 | ||
|
d03175f75a | ||
|
f4639c9bb2 | ||
|
f6d77ac8d7 | ||
|
d43f59d9a9 | ||
|
631f03e62c | ||
|
778cf847d3 | ||
|
02a71a5edb | ||
|
629333e1ab | ||
|
dd5bd3852a | ||
|
491412807c | ||
|
9cdb0908d6 | ||
|
b5d3e68d68 | ||
|
48564b5286 | ||
|
8bdb74a8e0 | ||
|
5ab31f726a | ||
|
7ee79ec56c | ||
|
df4907f5d4 | ||
|
a4992ff602 | ||
|
f4874ed8d0 | ||
|
84bd74a1bc | ||
|
16011b91c6 | ||
|
2bce428339 | ||
|
a56de30268 | ||
|
71d44edb8c | ||
|
cc6b01de08 | ||
|
340832c361 | ||
|
98469248eb | ||
|
3d01854fa1 | ||
|
756133a9eb | ||
|
1090f070c9 | ||
|
6857796ef0 | ||
|
792c710bdc | ||
|
7336693ca2 | ||
|
91700e7dae | ||
|
c9c0baefeb | ||
|
b18bd2ff87 | ||
|
d9667b4534 | ||
|
d8d3c3ef0b | ||
|
b64d726c42 | ||
|
0bd698c968 | ||
|
9ef5045c9b | ||
|
902cb20710 | ||
|
1e9a4d9590 | ||
|
5d7efebd40 | ||
|
b9c58423a9 | ||
|
efc7b999bb | ||
|
995df64054 | ||
|
a5788511e3 | ||
|
4e56dee6f0 | ||
|
3b160659f3 | ||
|
83fa02d8ad | ||
|
daf5ad33c7 | ||
|
597abe236d | ||
|
0c8e8cab97 | ||
|
f057ae7e06 | ||
|
c0fbc4adaf | ||
|
efae0b193d | ||
|
c934bfb7b3 | ||
|
76500c57bd | ||
|
3f2ad17460 | ||
|
c60a1783da | ||
|
0585e80c70 | ||
|
39d1f49431 | ||
|
2d62f8ddeb | ||
|
b76abf54ab | ||
|
337cbb73ee | ||
|
79590cd5ac | ||
|
383ac49919 | ||
|
15f7ac3da0 | ||
|
46c4cdb81a | ||
|
639ef0da5b | ||
|
0229d187ae | ||
|
dea6f3f820 | ||
|
dd409b4bf9 | ||
|
407344e86a | ||
|
f6e0ff11f1 | ||
|
2ebb9b2cd9 | ||
|
38a4ad8ec4 | ||
|
84e3707f4f | ||
|
fce6458df6 | ||
|
018449c648 | ||
|
8175b1bcfe | ||
|
c1dea5c254 | ||
|
50fac692ad | ||
|
d889e9d3ad | ||
|
4be447fc60 | ||
|
daa0a59c5f | ||
|
df39f94fca | ||
|
46313e2c75 | ||
|
541c0be6be | ||
|
3b3212d101 | ||
|
f03bb5eeee | ||
|
6affa01f81 | ||
|
605ceb1b19 | ||
|
7d4a9602ab | ||
|
eb370dad1e | ||
|
8676b86575 | ||
|
6036786153 | ||
|
88950f00d5 | ||
|
f90ced5a39 | ||
|
2b2dd0568b | ||
|
3f60a2b5fa | ||
|
3070448555 | ||
|
80a873da3e | ||
|
e8f76e5694 | ||
|
fa49b449dd | ||
|
121050960c | ||
|
bb0cc50ffc | ||
|
e1967bd603 | ||
|
a5c2157320 | ||
|
ff056f8d81 | ||
|
af4715e17f | ||
|
68aad90a59 | ||
|
24c9247663 | ||
|
7e2f30396f | ||
|
e8dc334758 | ||
|
f1bc2cc40f | ||
|
c0d0b8fc90 | ||
|
d883474f03 | ||
|
c396c2a84c | ||
|
52e2c6d480 | ||
|
2fbd559105 | ||
|
58c6b72d77 | ||
|
dfe9868a48 | ||
|
06968ac289 | ||
|
9b52168b94 | ||
|
54d91b8b76 | ||
|
312dd8a200 | ||
|
57d70851c8 | ||
|
5b53175ed6 | ||
|
721a0ce417 | ||
|
0b532f7624 | ||
|
e64df711e2 | ||
|
8cb9157c73 | ||
|
b57ba59243 | ||
|
a85af22d6a | ||
|
9b2c96c085 | ||
|
a80e048c2d | ||
|
bef261d869 | ||
|
dbf660f953 | ||
|
2de87eb446 | ||
|
9498dd9c67 | ||
|
7cb19f2c66 | ||
|
8faa76e965 | ||
|
264ed3887a | ||
|
fe92caaed4 | ||
|
48e9467a99 | ||
|
27582611c1 | ||
|
337ca7d4ba | ||
|
1ef64025c5 | ||
|
cd41c27ee1 | ||
|
fd7a4e02be | ||
|
3d3e4bac75 | ||
|
3b8944d61b | ||
|
6da637ab66 | ||
|
e757cab0da | ||
|
aeae1b0db3 | ||
|
dd966fd198 | ||
|
dfdf45fa56 | ||
|
af7de61c43 | ||
|
5406448be0 | ||
|
e21875bf2a | ||
|
a5e3442602 | ||
|
9c1fd176c0 | ||
|
8ab511361a | ||
|
845e69fb96 | ||
|
c4388a6f8f | ||
|
6ad761e067 | ||
|
900a49a36a | ||
|
44c6865ba1 | ||
|
5e30e89737 | ||
|
0152f1c69d | ||
|
00ac935367 | ||
|
d4bd6b2fb3 | ||
|
f7eb8cc127 | ||
|
c0a727fcfc | ||
|
e9421e9102 | ||
|
04d6496c05 | ||
|
893cfe13cd | ||
|
150cfba455 | ||
|
632db0d8d1 | ||
|
e0c72c05c2 | ||
|
01a43f59ca | ||
|
e1928a7265 | ||
|
73e539604f | ||
|
35474f2466 | ||
|
ca77ba6d19 | ||
|
6ecf94073d | ||
|
cefc1b7b9c | ||
|
cab34df2d6 | ||
|
e91fa02974 | ||
|
59277c898a | ||
|
36b8309943 | ||
|
76d6342156 | ||
|
4da546fc80 | ||
|
af4dd446ab | ||
|
5df81a74c6 | ||
|
03bba4b9e5 | ||
|
adaa54ba8b | ||
|
4d4ae9812b | ||
|
59cd071512 | ||
|
a676e06c65 | ||
|
bbaaf4c17d | ||
|
efbb0ebf6a | ||
|
6f5eb42f2a | ||
|
cca35a302c | ||
|
e336f24225 | ||
|
d871fe7aa8 | ||
|
b6d7ef403c | ||
|
7ddfe83ffa | ||
|
70f5e616c1 | ||
|
61ed756dd0 | ||
|
e69e7a9a9a | ||
|
5c6f84a68e | ||
|
3091a06194 | ||
|
49a2b8232f | ||
|
d4eb5f07db | ||
|
97626b4a59 | ||
|
3efecb8bed | ||
|
a5294262e6 | ||
|
34859ada02 | ||
|
35ed7299af | ||
|
2042db29ee | ||
|
3e4f2eaf5d | ||
|
6a50f74a14 | ||
|
7ad979cba9 | ||
|
a5ff947936 | ||
|
05485b3a4c | ||
|
8c1deefebf | ||
|
ba289d6e6a | ||
|
f7c33a4579 | ||
|
ebfc55064e | ||
|
ccc59dfc8b | ||
|
b53d1a076f | ||
|
cd60c239af | ||
|
fbb84277bf | ||
|
77d75d16df | ||
|
62fcc89ddc | ||
|
d3a39270de | ||
|
2983687f34 | ||
|
8e68477a78 | ||
|
91b984d52d | ||
|
acebed5aae | ||
|
f41a219760 | ||
|
fa07b861ad | ||
|
d65734c896 | ||
|
033cd306c1 | ||
|
585ec1212d | ||
|
7c3e7daa56 | ||
|
81b54182de | ||
|
6aae97de73 | ||
|
f0db2a7709 | ||
|
9db66048d1 | ||
|
5dc745f301 | ||
|
00466972e2 | ||
|
bda230537a | ||
|
dce14b8999 | ||
|
23f285c3fb | ||
|
790368cdf4 | ||
|
e2c1d2e226 | ||
|
a4b1a80cdc | ||
|
0ba1a82e01 | ||
|
7ea9984fd3 | ||
|
7532626123 | ||
|
632a542236 | ||
|
1a82d0599c | ||
|
620f938065 | ||
|
54a8c331c2 | ||
|
45d1c87975 | ||
|
cc2a137783 | ||
|
bab0e1d5fb | ||
|
a027077211 | ||
|
5bfdddd52b | ||
|
777fcbae77 | ||
|
8abb55b058 | ||
|
823088b9cd | ||
|
1aa7db9c2a | ||
|
e220b3e9f3 | ||
|
01c7d4e49a | ||
|
486a58909d | ||
|
db43a4bf3a | ||
|
424bfa9313 | ||
|
926b7d8aea | ||
|
e9a7b10730 | ||
|
8338421912 | ||
|
21d5952950 | ||
|
c5b47badad | ||
|
66bd3f0d59 | ||
|
2457c2c2fd | ||
|
d38a5efb3d | ||
|
6aa3dcc44a | ||
|
37744822d8 | ||
|
1344e84534 | ||
|
8e3a9d6c04 | ||
|
9b2a551ee4 | ||
|
f52b8e11bb | ||
|
79b2dc3ed8 | ||
|
222c518a5f | ||
|
51fdefaede | ||
|
a5a53d1d1e | ||
|
8e033d035a | ||
|
88452a187c | ||
|
cfaf2838d4 | ||
|
107f51f4ae | ||
|
c304578443 | ||
|
84476ad093 | ||
|
0f7d57d0a0 | ||
|
b2b04c843d | ||
|
296897d91a | ||
|
a7cc867cf0 | ||
|
69a7ea6057 | ||
|
091a93ff4e | ||
|
f88bad4bde | ||
|
7d4c9fefa9 | ||
|
10d7d44825 | ||
|
c9a2041fae | ||
|
0d1f2ad09d | ||
|
aaf248c1b3 | ||
|
ce74062a9f | ||
|
61a1b1428a | ||
|
411dbabc90 | ||
|
66cf7e4ffa | ||
|
4279bf6445 | ||
|
dd36301460 | ||
|
d1d52aea44 | ||
|
12e5377c40 | ||
|
28f7700dac | ||
|
9eb46df517 | ||
|
e6a6d7ae42 | ||
|
da54b945da | ||
|
7e6efb4a14 | ||
|
fa3e705673 | ||
|
cf52e5ec96 | ||
|
04a3069294 | ||
|
8f7f88c8ad | ||
|
aef646e9df | ||
|
dfd6262f4a | ||
|
49f44d241b | ||
|
f6c750a1ea | ||
|
1950e4b513 | ||
|
c190002ebb | ||
|
3b3f079754 | ||
|
dfc274643f | ||
|
e3808c71b9 | ||
|
187654d8b3 | ||
|
8ec0d9319b | ||
|
ec75779bf3 | ||
|
894568d2ee | ||
|
c1952e98bc | ||
|
789e6a5291 | ||
|
ae5fad290f | ||
|
003a416b74 | ||
|
3a6f04f770 | ||
|
0b36d02aa1 | ||
|
5f8299cf4a | ||
|
ad0dbdfc22 | ||
|
8455b5a64a | ||
|
a711bbd8f6 | ||
|
3e20c2cc3d | ||
|
1e8a1d7ffb | ||
|
c8c63bea5d | ||
|
4ea20ce076 | ||
|
b2eec2b111 | ||
|
8876c6cf95 | ||
|
98bf36dbc8 | ||
|
b83e4f53b1 | ||
|
33ca6070f4 | ||
|
c2b675eb06 | ||
|
e552f4b730 | ||
|
12f6296c75 | ||
|
3842f05ce9 | ||
|
4d21668265 | ||
|
693dcc1020 | ||
|
f5562602f0 | ||
|
86aa8f19f7 | ||
|
43ba3b4920 | ||
|
6070507b04 | ||
|
fc413a05d1 | ||
|
89b87156de | ||
|
a7f3f64d89 | ||
|
10bd5ce900 | ||
|
a6ffe8480a | ||
|
2a2335c8f4 | ||
|
4338ccc132 | ||
|
f2bef554a4 | ||
|
ab53a157e4 | ||
|
beae32ef23 | ||
|
787c885ccf | ||
|
286351b6d2 | ||
|
29371163ad | ||
|
3f88b8dfa2 | ||
|
1c161b2b29 | ||
|
5ea8ec2dda | ||
|
eb8c9848eb | ||
|
2b97ac7c1c | ||
|
3c656ba618 | ||
|
edddfe234c | ||
|
8105dea17f | ||
|
dc1954cb05 | ||
|
ea63246a12 | ||
|
196bdbe246 | ||
|
01ddeb4dfd | ||
|
282168f92c | ||
|
3c74d92eb0 | ||
|
fe622cacb2 | ||
|
5ddb438134 | ||
|
35469c3d98 | ||
|
b32a26cf7e | ||
|
bed7965989 | ||
|
19ff782c00 | ||
|
cebb368a28 | ||
|
038917b030 | ||
|
04d826943c | ||
|
e0735ce2e4 | ||
|
849c281912 | ||
|
c06bb7784a | ||
|
b9fff4954a | ||
|
7aa9e5748e | ||
|
6175afa6be | ||
|
5563e7ed4c | ||
|
305f846dbf | ||
|
3f850c540b | ||
|
2c3af45f5c | ||
|
230901a28a | ||
|
30e1a5c9b0 | ||
|
616e1dd5d7 | ||
|
a323bca9ec | ||
|
14bb04d285 | ||
|
edd372f8c4 | ||
|
b4a7642af5 | ||
|
580f49e69f | ||
|
22db124624 | ||
|
e88294eb40 | ||
|
ae3bacf8fe |
@@ -13,6 +13,6 @@ 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!docs
|
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!docs
|
||||||
7za a "%releasePath%\grocy_%version%.zip" "%projectPath%\public\.htaccess"
|
7za a "%releasePath%\grocy_%version%.zip" "%projectPath%\public\.htaccess"
|
||||||
7za rn "%releasePath%\grocy_%version%.zip" .htaccess public\.htaccess
|
7za rn "%releasePath%\grocy_%version%.zip" .htaccess public\.htaccess
|
||||||
7za d "%releasePath%\grocy_%version%.zip" data\*.* data\storage data\viewcache\*
|
7za d "%releasePath%\grocy_%version%.zip" data\*.* data\storage data\viewcache\* changelog\__TEMPLATE.md
|
||||||
7za a "%releasePath%\grocy_%version%.zip" "%projectPath%\data\.htaccess"
|
7za a "%releasePath%\grocy_%version%.zip" "%projectPath%\data\.htaccess"
|
||||||
7za rn "%releasePath%\grocy_%version%.zip" .htaccess data\.htaccess
|
7za rn "%releasePath%\grocy_%version%.zip" .htaccess data\.htaccess
|
||||||
|
27
.devtools/data_generation_scripts/9999_big_stock.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// This is executed inside DatabaseMigrationService class/context
|
||||||
|
|
||||||
|
use Grocy\Services\StockService;
|
||||||
|
|
||||||
|
$PRODUCTS = [3, 4, 5, 6, 7, 8];
|
||||||
|
|
||||||
|
$i = 1;
|
||||||
|
$days = -1;
|
||||||
|
while ($i <= 500)
|
||||||
|
{
|
||||||
|
$productId = $PRODUCTS[array_rand($PRODUCTS)];
|
||||||
|
$transactionId1 = $this->getStockService()->AddProduct($productId, 1, date('Y-m-d', strtotime('+180 days')), StockService::TRANSACTION_TYPE_PURCHASE, date('Y-m-d', strtotime("$days days")), XRandomPrice());
|
||||||
|
$transactionId2 = $this->getStockService()->ConsumeProduct($productId, 1, false, StockService::TRANSACTION_TYPE_CONSUME);
|
||||||
|
|
||||||
|
$this->getDatabaseService()->ExecuteDbStatement("UPDATE stock_log SET row_created_timestamp = DATETIME(row_created_timestamp, '$days days') WHERE transaction_id = '$transactionId1'");
|
||||||
|
$this->getDatabaseService()->ExecuteDbStatement("UPDATE stock_log SET row_created_timestamp = DATETIME(row_created_timestamp, '$days days') WHERE transaction_id = '$transactionId2'");
|
||||||
|
|
||||||
|
$days--;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
function XRandomPrice()
|
||||||
|
{
|
||||||
|
return mt_rand(2 * 100, 25 * 100) / 100 / 4;
|
||||||
|
}
|
16
.devtools/data_generation_scripts/9999_lots_recipes.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// This is executed inside DatabaseMigrationService class/context
|
||||||
|
|
||||||
|
use Grocy\Services\RecipesService;
|
||||||
|
|
||||||
|
$recipesService = RecipesService::getInstance();
|
||||||
|
|
||||||
|
for ($i = 1; $i <= 87; $i++)
|
||||||
|
{
|
||||||
|
$recipesService->CopyRecipe(1);
|
||||||
|
$recipesService->CopyRecipe(2);
|
||||||
|
$recipesService->CopyRecipe(3);
|
||||||
|
$recipesService->CopyRecipe(4);
|
||||||
|
$recipesService->CopyRecipe(5);
|
||||||
|
}
|
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// This is executed inside DatabaseMigrationService class/context
|
||||||
|
|
||||||
|
$db = $this->getDatabaseService()->GetDbConnection();
|
||||||
|
|
||||||
|
// Reset the password of the user "admin" to "admin"
|
||||||
|
$adminUserRow = $db->users()->where('username', 'admin')->fetch();
|
||||||
|
|
||||||
|
if ($adminUserRow == null)
|
||||||
|
{
|
||||||
|
$adminUserRow = $db->users()->createRow([
|
||||||
|
'username' => 'admin'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$adminUserRow->update([
|
||||||
|
'password' => password_hash('admin', PASSWORD_DEFAULT)
|
||||||
|
]);
|
BIN
.devtools/data_generation_scripts/big_meal_plan.xlsx
Normal file
@@ -1,4 +1,4 @@
|
|||||||
pushd ..
|
pushd ..
|
||||||
call composer install
|
call composer install
|
||||||
yarn install
|
call yarn install
|
||||||
popd
|
popd
|
||||||
|
3
.devtools/transifex_check_for_new_languages.bat
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
pushd ..
|
||||||
|
tx pull --all --resources grocy.strings --minimum-perc=70
|
||||||
|
popd
|
@@ -1,6 +1,9 @@
|
|||||||
pushd ..
|
pushd ..
|
||||||
tx pull --all --minimum-perc=70 --force
|
for /d %%d in (localization\*) do (
|
||||||
tx pull --language en_GB --force
|
if %%~nxd neq en (
|
||||||
|
tx pull --languages %%~nxd --force
|
||||||
|
)
|
||||||
|
)
|
||||||
copy /Y localization\en\userfield_types.po localization\en_GB\userfield_types.po
|
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\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\component_translations.po localization\en_GB\component_translations.po
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
pushd ..
|
pushd ..
|
||||||
call composer update
|
call composer update
|
||||||
yarn upgrade
|
call yarn upgrade
|
||||||
popd
|
popd
|
||||||
|
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
custom: ["https://grocy.info/#say-thanks"]
|
22
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: Bug Report
|
||||||
|
about: If you've found something that does not work, please report it to help improve
|
||||||
|
Grocy
|
||||||
|
title: 'Bug: '
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Please make sure to:
|
||||||
|
|
||||||
|
- Describe the bug as detailed as possible by providing the exact steps how to reproduce it
|
||||||
|
- Attach screenshots where useful
|
||||||
|
- Check if the problem was maybe already reported or fixed by searching open and closed issues here
|
||||||
|
- Keep it to one topic per issue
|
||||||
|
|
||||||
|
Please also try to reproduce the problem on the pre-release demo: => https://demo-prerelease.grocy.info
|
||||||
|
- Use a private demo instance to make your example persistent
|
||||||
|
- If the problem is not reproducible there, it's most likely not a bug - please use the r/grocy subreddit for general questions / help: => https://www.reddit.com/r/grocy
|
||||||
|
-->
|
13
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: If you've found something that does not work, please report it to help improve
|
|
||||||
grocy
|
|
||||||
title: 'Bug: '
|
|
||||||
labels: bug
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Please describe the bug as detailed as possible, provide the steps how to reproduce it and maybe attach screenshots where useful.
|
|
||||||
|
|
||||||
Please also check if your bug was maybe already fixed by searching closed issues here or by trying to reproduce your problem on the [pre-release demo](https://demo-prerelease.grocy.info/) (use a *private demo instance* if you want to make your example persistent).
|
|
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,5 +1,5 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: Question / Help
|
- name: Questions / Help
|
||||||
url: https://www.reddit.com/r/grocy
|
url: https://www.reddit.com/r/grocy
|
||||||
about: Please use the r/grocy subreddit for general questions / help
|
about: Please use the r/grocy subreddit for general questions / help
|
||||||
|
17
.github/ISSUE_TEMPLATE/feature-request.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
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 make sure to:
|
||||||
|
|
||||||
|
- Describe what you would find useful
|
||||||
|
- Check if your idea was maybe already requested by searching open requests here
|
||||||
|
- Keep it to one topic per request
|
||||||
|
-->
|
11
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
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.
|
|
5
.github/SECURITY.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Grocy is not an enterprise application and neither one you (should) host publicly (means without authentication) on the internet.
|
||||||
|
|
||||||
|
So unless something really bad can be abused _unauthenticated_, please just open a regular issue on the [Issue Tracker](https://github.com/grocy/grocy/issues/new/choose).
|
||||||
|
|
||||||
|
You can also contact me directly, please see [berrnd.de](https://berrnd.de) for any contact information.
|
BIN
.github/publication_assets/chores.png
vendored
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 87 KiB |
BIN
.github/publication_assets/mealplan.png
vendored
Before Width: | Height: | Size: 496 KiB After Width: | Height: | Size: 476 KiB |
BIN
.github/publication_assets/shoppinglist.png
vendored
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 50 KiB |
BIN
.github/publication_assets/stock.png
vendored
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 170 KiB |
7
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
/public/node_modules
|
embedded.txt
|
||||||
/vendor
|
.DS_Store
|
||||||
/.release
|
/.release
|
||||||
embedded.txt
|
/packages
|
||||||
|
/public/packages
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$finder = PhpCsFixer\Finder::create()
|
$finder = PhpCsFixer\Finder::create()
|
||||||
->exclude(['vendor'])
|
->exclude(['packages'])
|
||||||
->ignoreVCSIgnored(true)
|
->ignoreVCSIgnored(true)
|
||||||
->files()->name('*.php')
|
->files()->name('*.php')
|
||||||
->in(__DIR__)
|
->in(__DIR__);
|
||||||
;
|
|
||||||
|
|
||||||
$cfg = new PhpCsFixer\Config();
|
$cfg = new PhpCsFixer\Config();
|
||||||
return $cfg
|
return $cfg
|
||||||
@@ -15,81 +14,41 @@ return $cfg
|
|||||||
'array_syntax' => ['syntax' => 'short'],
|
'array_syntax' => ['syntax' => 'short'],
|
||||||
'combine_consecutive_unsets' => true,
|
'combine_consecutive_unsets' => true,
|
||||||
'class_attributes_separation' => true,
|
'class_attributes_separation' => true,
|
||||||
|
'class_attributes_separation' => ['elements' => ['const' => 'none', 'property' => 'none']],
|
||||||
'multiline_whitespace_before_semicolons' => false,
|
'multiline_whitespace_before_semicolons' => false,
|
||||||
'single_quote' => true,
|
'single_quote' => true,
|
||||||
// 'blank_line_after_opening_tag' => true,
|
'blank_line_after_opening_tag' => true,
|
||||||
// 'blank_line_before_return' => true,
|
'curly_braces_position' => [
|
||||||
'braces' => [
|
'control_structures_opening_brace' => 'next_line_unless_newline_at_signature_end',
|
||||||
'allow_single_line_closure' => true,
|
'anonymous_functions_opening_brace' => 'next_line_unless_newline_at_signature_end'
|
||||||
'position_after_anonymous_constructs' => 'same',
|
],
|
||||||
'position_after_control_structures' => 'next',
|
'control_structure_continuation_position' => [
|
||||||
'position_after_functions_and_oop_constructs' => 'next',
|
'position' => 'next_line'
|
||||||
|
],
|
||||||
|
'cast_spaces' => [
|
||||||
|
'space' => 'none'
|
||||||
],
|
],
|
||||||
// 'cast_spaces' => true,
|
|
||||||
// 'class_definition' => array('singleLine' => true),
|
|
||||||
'concat_space' => ['spacing' => 'one'],
|
'concat_space' => ['spacing' => 'one'],
|
||||||
'declare_equal_normalize' => true,
|
'declare_equal_normalize' => true,
|
||||||
'function_typehint_space' => true,
|
'type_declaration_spaces' => true,
|
||||||
'single_line_comment_style' => ['comment_types' => ['hash']],
|
'single_line_comment_style' => ['comment_types' => ['hash']],
|
||||||
'include' => true,
|
'include' => true,
|
||||||
'lowercase_cast' => true,
|
'lowercase_cast' => true,
|
||||||
// 'native_function_casing' => true,
|
|
||||||
// 'new_with_braces' => true,
|
|
||||||
// 'no_blank_lines_after_class_opening' => true,
|
|
||||||
// 'no_blank_lines_after_phpdoc' => true,
|
|
||||||
// 'no_empty_comment' => true,
|
|
||||||
// 'no_empty_phpdoc' => true,
|
|
||||||
// 'no_empty_statement' => true,
|
|
||||||
'no_leading_import_slash' => true,
|
'no_leading_import_slash' => true,
|
||||||
'no_leading_namespace_whitespace' => true,
|
'no_leading_namespace_whitespace' => true,
|
||||||
// 'no_mixed_echo_print' => array('use' => 'echo'),
|
|
||||||
'no_multiline_whitespace_around_double_arrow' => true,
|
'no_multiline_whitespace_around_double_arrow' => true,
|
||||||
// 'no_short_bool_cast' => true,
|
|
||||||
// 'no_singleline_whitespace_before_semicolons' => true,
|
|
||||||
'no_spaces_around_offset' => 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_before_comma_in_array' => true,
|
||||||
'no_whitespace_in_blank_line' => true,
|
'no_whitespace_in_blank_line' => true,
|
||||||
// 'normalize_index_brace' => true,
|
|
||||||
'object_operator_without_whitespace' => true,
|
'object_operator_without_whitespace' => true,
|
||||||
// 'php_unit_fqcn_annotation' => true,
|
'blank_lines_before_namespace' => 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,
|
'ternary_operator_spaces' => true,
|
||||||
// 'trailing_comma_in_multiline_array' => true,
|
|
||||||
'trim_array_spaces' => true,
|
'trim_array_spaces' => true,
|
||||||
'unary_operator_spaces' => true,
|
'unary_operator_spaces' => true,
|
||||||
'whitespace_after_comma_in_array' => true,
|
'whitespace_after_comma_in_array' => true,
|
||||||
|
'no_trailing_comma_in_singleline' => true
|
||||||
])
|
])
|
||||||
->setIndent("\t")
|
->setIndent("\t")
|
||||||
->setLineEnding("\n")
|
->setLineEnding("\n")
|
||||||
->setUsingCache(false)
|
->setUsingCache(false)
|
||||||
->setFinder($finder)
|
->setFinder($finder);
|
||||||
;
|
|
||||||
|
76
.tx/config
@@ -1,56 +1,56 @@
|
|||||||
[main]
|
[main]
|
||||||
host = https://www.transifex.com
|
host = https://www.transifex.com
|
||||||
|
|
||||||
[grocy.chore_period_types]
|
[o:grocy:p:grocy:r:chore_assignment_types]
|
||||||
file_filter = localization/<lang>/chore_period_types.po
|
|
||||||
source_file = localization/chore_period_types.pot
|
|
||||||
source_lang = en
|
|
||||||
type = PO
|
|
||||||
|
|
||||||
[grocy.chore_assignment_types]
|
|
||||||
file_filter = localization/<lang>/chore_assignment_types.po
|
file_filter = localization/<lang>/chore_assignment_types.po
|
||||||
source_file = localization/chore_assignment_types.pot
|
source_file = localization/chore_assignment_types.pot
|
||||||
source_lang = en
|
source_lang = en
|
||||||
type = PO
|
type = PO
|
||||||
|
|
||||||
[grocy.component_translations]
|
[o:grocy:p:grocy:r:chore_period_types]
|
||||||
|
file_filter = localization/<lang>/chore_period_types.po
|
||||||
|
source_file = localization/chore_period_types.pot
|
||||||
|
source_lang = en
|
||||||
|
type = PO
|
||||||
|
|
||||||
|
[o:grocy:p:grocy:r:component_translations]
|
||||||
file_filter = localization/<lang>/component_translations.po
|
file_filter = localization/<lang>/component_translations.po
|
||||||
source_file = localization/component_translations.pot
|
source_file = localization/component_translations.pot
|
||||||
source_lang = en
|
source_lang = en
|
||||||
type = PO
|
type = PO
|
||||||
|
|
||||||
[grocy.demo_data]
|
[o:grocy:p:grocy:r:demo_data]
|
||||||
file_filter = localization/<lang>/demo_data.po
|
file_filter = localization/<lang>/demo_data.po
|
||||||
source_file = localization/demo_data.pot
|
source_file = localization/demo_data.pot
|
||||||
source_lang = en
|
source_lang = en
|
||||||
type = PO
|
type = PO
|
||||||
|
|
||||||
[grocy.stock_transaction_types]
|
[o:grocy:p:grocy:r:locales]
|
||||||
file_filter = localization/<lang>/stock_transaction_types.po
|
|
||||||
source_file = localization/stock_transaction_types.pot
|
|
||||||
source_lang = en
|
|
||||||
type = PO
|
|
||||||
|
|
||||||
[grocy.strings]
|
|
||||||
file_filter = localization/<lang>/strings.po
|
|
||||||
source_file = localization/strings.pot
|
|
||||||
source_lang = en
|
|
||||||
type = PO
|
|
||||||
|
|
||||||
[grocy.userfield_types]
|
|
||||||
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
|
file_filter = localization/<lang>/locales.po
|
||||||
source_file = localization/locales.pot
|
source_file = localization/locales.pot
|
||||||
source_lang = en
|
source_lang = en
|
||||||
type = PO
|
type = PO
|
||||||
|
|
||||||
|
[o:grocy:p:grocy:r:permissions]
|
||||||
|
file_filter = localization/<lang>/permissions.po
|
||||||
|
source_file = localization/permissions.pot
|
||||||
|
source_lang = en
|
||||||
|
type = PO
|
||||||
|
|
||||||
|
[o:grocy:p:grocy:r:stock_transaction_types]
|
||||||
|
file_filter = localization/<lang>/stock_transaction_types.po
|
||||||
|
source_file = localization/stock_transaction_types.pot
|
||||||
|
source_lang = en
|
||||||
|
type = PO
|
||||||
|
|
||||||
|
[o:grocy:p:grocy:r:strings]
|
||||||
|
file_filter = localization/<lang>/strings.po
|
||||||
|
source_file = localization/strings.pot
|
||||||
|
source_lang = en
|
||||||
|
type = PO
|
||||||
|
|
||||||
|
[o:grocy:p:grocy:r:userfield_types]
|
||||||
|
file_filter = localization/<lang>/userfield_types.po
|
||||||
|
source_file = localization/userfield_types.pot
|
||||||
|
source_lang = en
|
||||||
|
type = PO
|
||||||
|
5
.vscode/settings.json
vendored
@@ -12,6 +12,5 @@
|
|||||||
"html.format.wrapAttributes": "force",
|
"html.format.wrapAttributes": "force",
|
||||||
"html.format.wrapLineLength": 0,
|
"html.format.wrapLineLength": 0,
|
||||||
"php-cs-fixer.formatHtml": true,
|
"php-cs-fixer.formatHtml": true,
|
||||||
"php-cs-fixer.autoFixBySemicolon": true,
|
"php-cs-fixer.autoFixBySemicolon": true
|
||||||
"php-cs-fixer.onsave": true,
|
}
|
||||||
}
|
|
||||||
|
2
.yarnrc
@@ -1,4 +1,4 @@
|
|||||||
--modules-folder public/node_modules
|
--modules-folder public/packages
|
||||||
--install.production true
|
--install.production true
|
||||||
--install.ignore-scripts true
|
--install.ignore-scripts true
|
||||||
--install.ignore-optional true
|
--install.ignore-optional true
|
||||||
|
95
README.md
@@ -1,64 +1,75 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
<img alt="Logo" height="50" src="https://raw.githubusercontent.com/grocy/grocy/master/public/img/grocy_logo.svg?sanitize=true" />
|
<img alt="Logo" height="60" src="https://raw.githubusercontent.com/grocy/grocy/master/public/img/logo.svg?sanitize=true" />
|
||||||
<h3>ERP beyond your fridge</h3>
|
<h3>ERP beyond your fridge</h3>
|
||||||
<h4>grocy is a web-based self-hosted groceries & household management solution for your home<br>Created by <a href="https://github.com/berrnd">@berrnd</a></h4>
|
<h4>Grocy is a web-based self-hosted groceries & household management solution for your home<br>Created by <a href="https://github.com/berrnd">@berrnd</a></h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
## Give it a try
|
## Give it a try
|
||||||
|
|
||||||
- Public demo of the latest stable version (`release` branch) → [https://demo.grocy.info](https://demo.grocy.info)
|
- Public demo of the latest stable version (`release` branch) → [https://demo.grocy.info](https://demo.grocy.info)
|
||||||
- Public demo of the current development version (`master` branch) → [https://demo-prerelease.grocy.info](https://demo-prerelease.grocy.info)
|
- Public demo of the current development version (`master` branch) → [https://demo-prerelease.grocy.info](https://demo-prerelease.grocy.info)
|
||||||
|
|
||||||
## Questions / Help / Bug reporting / Feature requests
|
## Features
|
||||||
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 a request on the [issue tracker](https://github.com/grocy/grocy/issues/new/choose) here.
|
See the website → <https://grocy.info>
|
||||||
|
|
||||||
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.
|
## Questions / Help / Bug Reports / Feature Requests
|
||||||
|
|
||||||
|
- General help and usage questions → [r/grocy subreddit](https://www.reddit.com/r/grocy)
|
||||||
|
- Bug Reports and Feature Requests → [Issue Tracker](https://github.com/grocy/grocy/issues/new/choose)
|
||||||
|
|
||||||
|
_Please don't send me private messages or call me regarding Grocy help. I check the issue tracker and the subreddit pretty much daily, but don't provide any support beyond that._
|
||||||
|
|
||||||
## Community contributions
|
## Community contributions
|
||||||
See the website for a list of community contributed Add-ons / Tools: [https://grocy.info/addons](https://grocy.info/addons)
|
|
||||||
|
|
||||||
## Motivation
|
See the website for a list of community contributed Add-ons / Tools. → [https://grocy.info/addons](https://grocy.info/addons)
|
||||||
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
|
## How to install
|
||||||
> Checkout [grocy-desktop](https://github.com/grocy/grocy-desktop), if you want to run grocy without having to manage a webserver just like a normal (Windows) desktop application.
|
|
||||||
|
> Checkout [Grocy Desktop](https://github.com/grocy/grocy-desktop), if you want to run Grocy without having to manage a webserver just like a normal (Windows) desktop application.
|
||||||
>
|
>
|
||||||
> Directly download the [latest release](https://releases.grocy.info/latest-desktop) - the installation is nothing more than just clicking 2 times "next".
|
> Directly download the [latest release](https://releases.grocy.info/latest-desktop) - the installation is nothing more than just clicking 2 times "next".
|
||||||
|
|
||||||
See [https://grocy.info/links](https://grocy.info/links) for some installation guides and troubleshooting help.
|
See the website for some installation guides and troubleshooting help. → [https://grocy.info/links](https://grocy.info/links)
|
||||||
|
|
||||||
grocy is technically a pretty simple PHP application, so the basic notes to get it running are:
|
Grocy is technically a pretty simple PHP application, so the basic notes to get it running are:
|
||||||
- Unpack the [latest release](https://releases.grocy.info/latest)
|
- Unpack the [latest release](https://releases.grocy.info/latest)
|
||||||
- Copy `config-dist.php` to `data/config.php` + edit to your needs
|
- Copy `config-dist.php` to `data/config.php` + edit to your needs
|
||||||
- Ensure that the `data` directory is writable
|
- Ensure that the `data` directory is writable
|
||||||
- The webserver root should point to the `public` directory
|
- 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
|
- 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`)
|
- Or disable URL rewriting (see the option `DISABLE_URL_REWRITING` in `data/config.php`)
|
||||||
- Based on user reports, the minmimum required/working runtime is PHP 7.2 with SQLite 3.9.0
|
|
||||||
- However, I don't really care about supporting old runtime stuff, currently everything is only tested against (means 100 % works with) PHP 8.0 with SQLite 3.27.2
|
|
||||||
- → Default login is user `admin` with password `admin`, please change the password immediately (user menu at the top right corner)
|
- → 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.
|
Alternatively clone this repository (the `release` branch always references the latest released version) and install Composer and Yarn dependencies manually.
|
||||||
|
|
||||||
|
### Platform support
|
||||||
|
|
||||||
|
- PHP 8.1 or 8.2 (with SQLite 3.34.0+)
|
||||||
|
- Required PHP extensions: `fileinfo`, `pdo_sqlite`, `gd`, `ctype`, `json`, `intl`, `zlib`, `mbstring`
|
||||||
|
- _Recommendation: Benchmark tests showed that e.g. unit conversion handling is up to 5 times faster when using a more recent (3.39.4+) SQLite version._
|
||||||
|
- Recent Firefox, Chrome or Edge
|
||||||
|
|
||||||
## How to run using Docker
|
## 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.
|
See [grocy/grocy-docker](https://github.com/grocy/grocy-docker) or [linuxserver/docker-grocy](https://github.com/linuxserver/docker-grocy) for instructions.
|
||||||
|
|
||||||
## How to update
|
## How to update
|
||||||
|
|
||||||
- Overwrite everything with the [latest release](https://releases.grocy.info/latest) while keeping the `data` directory
|
- Overwrite everything with the [latest release](https://releases.grocy.info/latest) while keeping the `data` directory
|
||||||
- Check `config-dist.php` for new configuration options and add them to your `data/config.php` where appropriate (the default values from `config-dist.php` will be used for not in `data/config.php` defined settings)
|
- Check `config-dist.php` for new configuration options and add them to your `data/config.php` where appropriate (the default values from `config-dist.php` will be used for not in `data/config.php` defined settings)
|
||||||
- Empty the `data/viewcache` directory
|
- Empty the `data/viewcache` directory
|
||||||
- Visit the main route once to apply database migrations ([see below](https://github.com/grocy/grocy#database-migrations))
|
- Visit the main route once to apply database migrations ([see below](https://github.com/grocy/grocy#database-migrations))
|
||||||
|
|
||||||
If you run grocy on Linux, there is also `update.sh` (remember to make the script executable (`chmod +x update.sh`) and ensure that you have `unzip` installed) which does exactly this and additionally creates a backup (`.tgz` archive) of the current installation in `data/backups` (backups older than 60 days will be deleted during the update).
|
If you run Grocy on Linux, there is also `update.sh` (remember to make the script executable (`chmod +x update.sh`) and ensure that you have `unzip` installed) which does exactly this and additionally creates a backup (`.tgz` archive) of the current installation in `data/backups` (backups older than 60 days will be deleted during the update).
|
||||||
|
|
||||||
## Localization
|
## 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 on [Transfifex](https://www.transifex.com/grocy/grocy/dashboard/) if your language is incomplete or not available yet.
|
Grocy is fully localizable - the default language is English (integrated into code), a German localization is always maintained by me.
|
||||||
|
|
||||||
|
You can easily help translating Grocy on [Transifex](https://www.transifex.com/grocy/grocy/dashboard/) if your language is incomplete or not available yet.
|
||||||
|
|
||||||
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 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.
|
||||||
|
|
||||||
@@ -68,19 +79,26 @@ Also any translation which once reached a completion level of 70 % ([`strings` r
|
|||||||
|
|
||||||
_RTL languages are unfortunately not yet supported._
|
_RTL languages are unfortunately not yet supported._
|
||||||
|
|
||||||
|
## Motivation
|
||||||
|
|
||||||
|
A household needs to be managed. I did this so far (almost 10 years) with my first self written software (a C# Windows forms application) and with a bunch of Excel sheets. The software was a pain to use at the end and Excel is Excel. So I searched for and tried different things for a (very) long time, nothing 100 % fitted, so this is my aim for a "complete household management"-thing. ERP your fridge!
|
||||||
|
|
||||||
## Things worth to know
|
## Things worth to know
|
||||||
|
|
||||||
### REST API
|
### REST API
|
||||||
|
|
||||||
See the integrated Swagger UI instance on [/api](https://demo.grocy.info/api).
|
See the integrated Swagger UI instance on [/api](https://demo.grocy.info/api).
|
||||||
|
|
||||||
### Barcode readers & camera scanning
|
### 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.
|
Some fields (with a barcode icon above) also allow to select a value by scanning a barcode. It works best when your barcode reader prefixes every barcode with a letter which is normally not part of a item name (I use a `$`) and sends a `TAB` after a scan.
|
||||||
|
|
||||||
Additionally it's also possible to use your device camera to scan a barcode by using the camera button on the right side of the corresponding field (powered by [Quagga2](https://github.com/ericblade/quagga2), totally offline / client-side camera stream processing, please note due to browser security restrictions, this only works when serving grocy via a secure connection (`https://`)). Quick video demo: https://www.youtube.com/watch?v=Y5YH6IJFnfc
|
Additionally it's also possible to use your device camera to scan a barcode by using the camera button on the right side of the corresponding field (powered by [Quagga2](https://github.com/ericblade/quagga2), totally offline / client-side camera stream processing, please note due to browser security restrictions, this only works when serving Grocy via a secure connection (`https://`)). Quick video demo: <https://www.youtube.com/watch?v=Y5YH6IJFnfc>
|
||||||
|
|
||||||
_My personal recommendation: Use a USB barcode laser scanner. They are cheap and work 1000 % better, faster, under any lighting condition and from any angle._
|
_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
|
### Input shorthands for date fields
|
||||||
|
|
||||||
For (productivity) reasons all date (and time) input (and display) fields use the ISO-8601 format regardless of localization.
|
For (productivity) reasons all date (and time) input (and display) fields use the ISO-8601 format regardless of localization.
|
||||||
The following shorthands are available:
|
The following shorthands are available:
|
||||||
- `MMDD` gets expanded to the given day on the current year, if > today, or to the given day next year, if < today, in proper notation
|
- `MMDD` gets expanded to the given day on the current year, if > today, or to the given day next year, if < today, in proper notation
|
||||||
@@ -89,6 +107,8 @@ The following shorthands are available:
|
|||||||
- Example: `20210417` will be converted to `2021-04-17`
|
- Example: `20210417` will be converted to `2021-04-17`
|
||||||
- `YYYYMMe` or `YYYYMM+` gets expanded to the end of the given month in the given year in proper notation
|
- `YYYYMMe` or `YYYYMM+` gets expanded to the end of the given month in the given year in proper notation
|
||||||
- Example: `202107e` will be converted to `2021-07-31`
|
- Example: `202107e` will be converted to `2021-07-31`
|
||||||
|
- `[+/-]n[d/m/y]` gets expanded to a date relative to today, while adding (**+**) or subtracting (**-**) the **n**umber of**d**ays/**m**onths/**y**ears, in proper notation
|
||||||
|
- Example: `+1m` will be converted to the same day next month
|
||||||
- `x` gets expanded to `2999-12-31` (which is an alias for "never overdue")
|
- `x` gets expanded to `2999-12-31` (which is an alias for "never overdue")
|
||||||
- Down/up arrow keys will increase/decrease the date by 1 day
|
- Down/up arrow keys will increase/decrease the date by 1 day
|
||||||
- Right/left arrow keys will increase/decrease the date by 1 week
|
- Right/left arrow keys will increase/decrease the date by 1 week
|
||||||
@@ -96,54 +116,69 @@ The following shorthands are available:
|
|||||||
- Shift + right/left arrow keys will increase/decrease the date by 1 year
|
- Shift + right/left arrow keys will increase/decrease the date by 1 year
|
||||||
|
|
||||||
### Keyboard shorthands for buttons
|
### Keyboard shorthands for buttons
|
||||||
|
|
||||||
Wherever a button contains a bold highlighted letter, this is a shortcut key.
|
Wherever a button contains a bold highlighted letter, this is a shortcut key.
|
||||||
Example: Button "**P** Add as new product" 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
|
### Barcode lookup via external services
|
||||||
|
|
||||||
Products can be directly added to the database via looking them up against external services by a barcode.
|
Products can be directly added to the database via looking them up against external services by a barcode.
|
||||||
This is currently only possible through the REST API.
|
This is currently only possible through the REST API.
|
||||||
There is no plugin included for any service, see the reference implementation in `data/plugins/DemoBarcodeLookupPlugin.php`.
|
There is no plugin included for any service, see the reference implementation in `data/plugins/DemoBarcodeLookupPlugin.php`.
|
||||||
|
|
||||||
### Database migrations
|
### Database migrations
|
||||||
|
|
||||||
Database schema migration is automatically done when visiting the root (`/`) route (click on the logo in the left upper edge).
|
Database schema migration is automatically done when visiting the root (`/`) route (click on the logo in the left upper edge).
|
||||||
|
|
||||||
_Please note: Database migrations are supposed to work between releases, not between every commit. If you want to run the current `master` branch (which is the development version), however, you need to handle that (and maybe more) yourself._
|
_Please note: Database migrations are supposed to work between releases, not between every commit. If you want to run the current `master` branch (which is the development version), you need to handle that (and maybe more) yourself._
|
||||||
|
|
||||||
### Disable certain features
|
### Disable certain features
|
||||||
If you don't use certain feature sets of grocy (for example if you don't need "Chores"), there are feature flags per major feature set to hide/disable the related UI elements (see `config-dist.php`).
|
|
||||||
|
If you don't use certain feature sets of Grocy (for example if you don't need "Chores"), there are feature flags per major feature set to hide/disable the related UI elements (see `config-dist.php`).
|
||||||
|
|
||||||
### Adding your own CSS or JS without to have to modify the application itself
|
### Adding your own CSS or JS without to have to modify the application itself
|
||||||
|
|
||||||
- When the file `data/custom_js.html` exists, the contents of the file will be added just before `</body>` (end of body) on every page
|
- When the file `data/custom_js.html` exists, the contents of the file will be added just before `</body>` (end of body) on every page
|
||||||
- When the file `data/custom_css.html` exists, the contents of the file will be added just before `</head>` (end of head) on every page
|
- When the file `data/custom_css.html` exists, the contents of the file will be added just before `</head>` (end of head) on every page
|
||||||
|
|
||||||
### Demo mode
|
### Demo mode
|
||||||
When the `MODE` setting is set to `dev`, `demo` or `prerelease`, the application will work in a demo mode which means authentication is disabled and some demo data will be generated during the database schema migration.
|
|
||||||
|
When the `MODE` setting is set to `dev`, `demo` or `prerelease`, the application will work in a demo mode which means authentication is disabled and some demo data will be generated during the database schema migration (pass the query parameter `nodemodata`, e.g. `https://grocy.example.com/?nodemodata` to skip that).
|
||||||
|
|
||||||
### Embedded mode
|
### Embedded mode
|
||||||
When the file `embedded.txt` exists, it must contain a valid and writable path which will be used as the data directory instead of `data` and authentication will be disabled (used in [grocy-desktop](https://github.com/grocy/grocy-desktop)).
|
|
||||||
|
When the file `embedded.txt` exists, it must contain a valid and writable path which will be used as the data directory instead of `data` and authentication will be disabled (used in [Grocy Desktop](https://github.com/grocy/grocy-desktop)).
|
||||||
|
|
||||||
In embedded mode, settings can be overridden by text files in `data/settingoverrides`, the file name must be `<SettingName>.txt` (e. g. `BASE_URL.txt`) and the content must be the setting value (normally one single line).
|
In embedded mode, settings can be overridden by text files in `data/settingoverrides`, the file name must be `<SettingName>.txt` (e. g. `BASE_URL.txt`) and the content must be the setting value (normally one single line).
|
||||||
|
|
||||||
## Contributing / Say thanks
|
## Contributing / Say Thanks
|
||||||
Any help is more than appreciated. Feel free to pick any open unassigned issue and submit a pull request, but please leave a short comment or assign the issue yourself, to avoid working on the same thing.
|
|
||||||
|
|
||||||
See https://grocy.info/#say-thanks for more ideas if you just want to say thanks.
|
Any help is welcome, feel free to contribute anything which comes to your mind or see <https://grocy.info/#say-thanks> if you just want to say thanks.
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
There is none. 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.
|
||||||
|
|
||||||
|
[Milestones](https://github.com/grocy/grocy/milestones) are used to indicate in which version the corresponding request was done (`vNEXT` means it's currently planned to do that for the next release).
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
#### Stock overview
|
|
||||||
|
### Stock overview
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### Shopping List
|
### Shopping List
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### Meal Plan
|
### Meal Plan
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### Chores overview
|
### Chores overview
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
20
app.php
@@ -1,14 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Grocy\Controllers\LoginController;
|
use Grocy\Controllers\ExceptionController;
|
||||||
use Grocy\Helpers\UrlManager;
|
use Grocy\Helpers\UrlManager;
|
||||||
|
use Grocy\Middleware\LocaleMiddleware;
|
||||||
use Grocy\Middleware\CorsMiddleware;
|
use Grocy\Middleware\CorsMiddleware;
|
||||||
use Psr\Container\ContainerInterface as Container;
|
use Psr\Container\ContainerInterface as Container;
|
||||||
use Slim\Factory\AppFactory;
|
use Slim\Factory\AppFactory;
|
||||||
use Slim\Views\Blade;
|
use Slim\Views\Blade;
|
||||||
|
|
||||||
// Load composer dependencies
|
// Load composer dependencies
|
||||||
require_once __DIR__ . '/vendor/autoload.php';
|
require_once __DIR__ . '/packages/autoload.php';
|
||||||
|
|
||||||
// Load config files
|
// Load config files
|
||||||
require_once GROCY_DATAPATH . '/config.php';
|
require_once GROCY_DATAPATH . '/config.php';
|
||||||
@@ -61,15 +62,18 @@ AppFactory::setContainer(new DI\Container());
|
|||||||
$app = AppFactory::create();
|
$app = AppFactory::create();
|
||||||
|
|
||||||
$container = $app->getContainer();
|
$container = $app->getContainer();
|
||||||
$container->set('view', function (Container $container) {
|
$container->set('view', function (Container $container)
|
||||||
|
{
|
||||||
return new Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache');
|
return new Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache');
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->set('UrlManager', function (Container $container) {
|
$container->set('UrlManager', function (Container $container)
|
||||||
|
{
|
||||||
return new UrlManager(GROCY_BASE_URL);
|
return new UrlManager(GROCY_BASE_URL);
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->set('ApiKeyHeaderName', function (Container $container) {
|
$container->set('ApiKeyHeaderName', function (Container $container)
|
||||||
|
{
|
||||||
return 'GROCY-API-KEY';
|
return 'GROCY-API-KEY';
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -84,7 +88,7 @@ if (!empty(GROCY_BASE_PATH))
|
|||||||
|
|
||||||
if (GROCY_MODE === 'production' || GROCY_MODE === 'dev')
|
if (GROCY_MODE === 'production' || GROCY_MODE === 'dev')
|
||||||
{
|
{
|
||||||
$app->add(new \Grocy\Middleware\LocaleMiddleware($container));
|
$app->add(new LocaleMiddleware($container));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -97,10 +101,12 @@ $app->add(new $authMiddlewareClass($container, $app->getResponseFactory()));
|
|||||||
$app->addRoutingMiddleware();
|
$app->addRoutingMiddleware();
|
||||||
$errorMiddleware = $app->addErrorMiddleware(true, false, false);
|
$errorMiddleware = $app->addErrorMiddleware(true, false, false);
|
||||||
$errorMiddleware->setDefaultErrorHandler(
|
$errorMiddleware->setDefaultErrorHandler(
|
||||||
new \Grocy\Controllers\ExceptionController($app, $container)
|
new ExceptionController($app, $container)
|
||||||
);
|
);
|
||||||
|
|
||||||
$app->add(new CorsMiddleware($app->getResponseFactory()));
|
$app->add(new CorsMiddleware($app->getResponseFactory()));
|
||||||
|
|
||||||
|
$app->getRouteCollector()->setCacheFile(GROCY_DATAPATH . '/viewcache/route_cache.php');
|
||||||
|
|
||||||
ob_clean(); // No response output before here
|
ob_clean(); // No response output before here
|
||||||
$app->run();
|
$app->run();
|
||||||
|
@@ -1 +1 @@
|
|||||||
- grocy is now fully localizable and ships by default with English and German translations
|
- Grocy is now fully localizable and ships by default with English and German translations
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
- Upgraded Bootstrap and some other dependencies (grocy now looks even better!)
|
- Upgraded Bootstrap and some other dependencies (Grocy now looks even better!)
|
||||||
- Added Italian translation (thanks @davidoskky)
|
- Added Italian translation (thanks @davidoskky)
|
||||||
- => Demo for this language available at: https://it.demo.grocy.info
|
- => Demo for this language available at: https://it.demo.grocy.info
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
This was released shortly after the last release to fix a small regression bug, original changes from Version 1.13.0:
|
This was released shortly after the last release to fix a small regression bug, original changes from Version 1.13.0:
|
||||||
|
|
||||||
- Upgraded Bootstrap and some other dependencies (grocy now looks even better!)
|
- Upgraded Bootstrap and some other dependencies (Grocy now looks even better!)
|
||||||
- Added Italian translation (thanks @davidoskky)
|
- Added Italian translation (thanks @davidoskky)
|
||||||
- => Demo for this language available at: https://it.demo.grocy.info
|
- => Demo for this language available at: https://it.demo.grocy.info
|
||||||
|
@@ -10,4 +10,4 @@
|
|||||||
- Sidebar collapse state is now remembered
|
- Sidebar collapse state is now remembered
|
||||||
- Fixed datetimepicker border
|
- Fixed datetimepicker border
|
||||||
- Keep the parent sidebar menu item expanded if the active page is a sub menu item
|
- Keep the parent sidebar menu item expanded if the active page is a sub menu item
|
||||||
- Custom JS/CSS file names have changed [see README](https://github.com/berrnd/grocy#adding-your-own-css-or-js-without-to-have-to-modify-the-application-itself)
|
- Custom JS/CSS file names have changed [see README](https://github.com/grocy/grocy#adding-your-own-css-or-js-without-to-have-to-modify-the-application-itself)
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
- New related project: **grocy-desktop**
|
- New related project: **grocy-desktop**
|
||||||
- => https://github.com/berrnd/grocy-desktop
|
- => https://github.com/grocy/grocy-desktop
|
||||||
- Run grocy without a webserver just like a normal (windows) desktop application
|
- Run Grocy without a webserver just like a normal (Windows) desktop application
|
||||||
- New "embedded mode" for grocy to help running in "desktop application mode" [see README](https://github.com/berrnd/grocy#embedded-mode)
|
- New "embedded mode" for Grocy to help running in "desktop application mode" [see README](https://github.com/grocy/grocy#embedded-mode)
|
||||||
- New datepicker shorthands and improvements
|
- New datepicker shorthands and improvements
|
||||||
- `YYYYMMe` or `YYYYMM+` gets expanded to the end of the given month in the given year in proper notation
|
- `YYYYMMe` or `YYYYMM+` gets expanded to the end of the given month in the given year in proper notation
|
||||||
- Changed: `MMDD` will be expanded to the given day next year if > today
|
- Changed: `MMDD` will be expanded to the given day next year if > today
|
||||||
- [see README](https://github.com/berrnd/grocy#input-shorthands-for-date-fields)
|
- [see README](https://github.com/grocy/grocy#input-shorthands-for-date-fields)
|
||||||
- Some other small bug fixes
|
- Some other small bug fixes
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
- The currently defined user will automatically be migrated, please remove `HTTP_USER` and `HTTP_PASSWORD` from your config file afterwards
|
- The currently defined user will automatically be migrated, please remove `HTTP_USER` and `HTTP_PASSWORD` from your config file afterwards
|
||||||
- For this it was necessary to delete all sessions and API keys during the migration
|
- For this it was necessary to delete all sessions and API keys during the migration
|
||||||
- Added an update script (`/update.sh`) to make updates (on Linux machines) easier
|
- Added an update script (`/update.sh`) to make updates (on Linux machines) easier
|
||||||
- See also ["How to update" in README](https://github.com/berrnd/grocy#how-to-update)
|
- See also ["How to update" in README](https://github.com/grocy/grocy#how-to-update)
|
||||||
- Added the possibility to track who did a habit
|
- Added the possibility to track who did a habit
|
||||||
- Added a rudimentary habit analysis possibility
|
- Added a rudimentary habit analysis possibility
|
||||||
- Different small UI, code and translation improvements
|
- Different small UI, code and translation improvements
|
||||||
|
@@ -2,5 +2,5 @@
|
|||||||
- Manage all your household equipment/devices in one place and have the information/instruction manual at hand when needed
|
- Manage all your household equipment/devices in one place and have the information/instruction manual at hand when needed
|
||||||
- New feature: Products can now have pictures
|
- New feature: Products can now have pictures
|
||||||
- Add them in the product edit page
|
- Add them in the product edit page
|
||||||
- Will be shown in the productcard (purchase/consume/etc. pages) and when you click the product name on the stock overview page (a little image icon next to the product name indicates if the product has an image)
|
- Will be shown in the product card (purchase/consume/etc. pages) and when you click the product name on the stock overview page (a little image icon next to the product name indicates if the product has an image)
|
||||||
- Recipes and the new equipment edit page now have a little editor with text formatting capabilities
|
- Recipes and the new equipment edit page now have a little editor with text formatting capabilities
|
||||||
|
@@ -19,5 +19,5 @@
|
|||||||
- Other improvements
|
- Other improvements
|
||||||
- The calendar can now be shared/integrated in iCal format (button in the header on the calendar page)
|
- The calendar can now be shared/integrated in iCal format (button in the header on the calendar page)
|
||||||
- Added feature flags to hide/disable certain parts of grocy when you don't use them (for example hide "Chores" and all related UI elements, when you don't use it, see `config-dist.php`)
|
- Added feature flags to hide/disable certain parts of grocy when you don't use them (for example hide "Chores" and all related UI elements, when you don't use it, see `config-dist.php`)
|
||||||
- Added a "Apple Touch Icon" and a "Web App Manifest" which should improve grocy on mobile devices and also enables "Add to Home screen" on major mobile browsers
|
- Added a "Apple Touch Icon" and a "Web App Manifest" which should improve Grocy on mobile devices and also enables "Add to Home screen" on major mobile browsers
|
||||||
- A lot of other minor small and bigger UI improvements
|
- A lot of other minor small and bigger UI improvements
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
- Fixed a problem that the user settings were not properly initialized for the frontend JS part when not logged only (so potentially affected only the login page)
|
- Fixed a problem that the user settings were not properly initialized for the frontend JS part when not logged only (so potentially affected only the login page)
|
||||||
- Fixed an issue that the shopping list did not load when a plural translation for a quantity unit was missing
|
- Fixed an issue that the shopping list did not load when a plural translation for a quantity unit was missing
|
||||||
- Fixed that tooltips were visible forever when consuming all products on the stock overview page
|
- Fixed that tooltips were visible forever when consuming all products on the stock overview page
|
||||||
- Fixed that login did not work when "Stay logged in permanently" was set and grocy runs on a 32-bit system (thanks @matejdro)
|
- Fixed that login did not work when "Stay logged in permanently" was set and Grocy runs on a 32-bit system (thanks @matejdro)
|
||||||
- Fixed page reloads when "Auto reload on external changes" is enabled and there is unsaved form data (the detection did not work for forms in modal dialogs, e. g. when adding a entry to the meal plan)
|
- Fixed page reloads when "Auto reload on external changes" is enabled and there is unsaved form data (the detection did not work for forms in modal dialogs, e. g. when adding a entry to the meal plan)
|
||||||
- Fixed (again) that the product picker did not work properly when the product name contains single quotes
|
- Fixed (again) that the product picker did not work properly when the product name contains single quotes
|
||||||
- Fixed that a entered barcode on the product edit page was only saved when "adding" it to the barcodes list by pressing `TAB` (is now automatically added to the list also when just leaving the field)
|
- Fixed that a entered barcode on the product edit page was only saved when "adding" it to the barcodes list by pressing `TAB` (is now automatically added to the list also when just leaving the field)
|
||||||
|
@@ -1,12 +1,13 @@
|
|||||||
### New feature: Custom entities / objects / lists
|
### New feature: Custom entities / objects / lists
|
||||||
- Custom entities are based on Userfields and can be used to add any custom lists you want to have in grocy
|
|
||||||
|
- Custom entities are based on Userfields and can be used to add any custom lists you want to have in Grocy
|
||||||
- They can have an own menu entry in the sidebar
|
- They can have an own menu entry in the sidebar
|
||||||
- => See "Manage master data" -> "Userentities" or try it on the demo: https://demo.grocy.info/userobjects/exampleuserentity
|
- => See "Manage master data" -> "Userentities" or try it on the demo: https://demo.grocy.info/userobjects/exampleuserentity
|
||||||
|
|
||||||
### New feature: Use the device camera for barcode scanning
|
### New feature: Use the device camera for barcode scanning
|
||||||
- Available on any barcode-enabled field (so currently only for picking products) - a new camera button at the right of side the text field
|
- Available on any barcode-enabled field (so currently only for picking products) - a new camera button at the right of side the text field
|
||||||
- Implemented using [QuaggaJS](https://github.com/serratus/quaggaJS) - camera stream processing happens totally offline / client-side
|
- Implemented using [QuaggaJS](https://github.com/serratus/quaggaJS) - camera stream processing happens totally offline / client-side
|
||||||
- Please note due to browser security restrictions, this only works when serving grocy via a secure connection (`https://`)
|
- Please note due to browser security restrictions, this only works when serving Grocy via a secure connection (`https://`)
|
||||||
- There is also a `config.php` setting `DISABLE_BROWSER_BARCODE_CAMERA_SCANNING` to disable this, if you don't need it at all (defaults to `false`)
|
- There is also a `config.php` setting `DISABLE_BROWSER_BARCODE_CAMERA_SCANNING` to disable this, if you don't need it at all (defaults to `false`)
|
||||||
- I you have problems that barcodes are not recognized properly, there is a little "barcode scanner testing page" at [/barcodescannertesting](https://demo.grocy.info/barcodescannertesting)
|
- I you have problems that barcodes are not recognized properly, there is a little "barcode scanner testing page" at [/barcodescannertesting](https://demo.grocy.info/barcodescannertesting)
|
||||||
- => Quick video demo: https://www.youtube.com/watch?v=Y5YH6IJFnfc
|
- => Quick video demo: https://www.youtube.com/watch?v=Y5YH6IJFnfc
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
- Quantity units can now be linked (related measurements / unit conversion)
|
- Quantity units can now be linked (related measurements / unit conversion)
|
||||||
- On the quantity unit edit page default conversion can be defined for each unit
|
- On the quantity unit edit page default conversion can be defined for each unit
|
||||||
- Products "inherit" the default conversion and additionally can have their own / override the default ones
|
- Products "inherit" the default conversion and additionally can have their own / override the default ones
|
||||||
- It's now possible to print a "Location Content Sheet" with the current stock per location - new button at the top of the stock overview page (thought to hang it at the location, note used amounts on paper and track it in grocy later)
|
- It's now possible to print a "Location Content Sheet" with the current stock per location - new button at the top of the stock overview page (thought to hang it at the location, note used amounts on paper and track it in Grocy later)
|
||||||
- Stock overview page improvements
|
- Stock overview page improvements
|
||||||
- Options in the more/context-menu to directly open the purchase/consume/inventory pages prefilled with the current product in a popup/dialog
|
- Options in the more/context-menu to directly open the purchase/consume/inventory pages prefilled with the current product in a popup/dialog
|
||||||
- Option in the more/context-menu to add the current product directly to a shopping list
|
- Option in the more/context-menu to add the current product directly to a shopping list
|
||||||
@@ -104,4 +105,4 @@
|
|||||||
- It's now also possible to provide the API key via a query parameter (same name as the header, so `GROCY-API-KEY`)
|
- It's now also possible to provide the API key via a query parameter (same name as the header, so `GROCY-API-KEY`)
|
||||||
|
|
||||||
#### Say thanks
|
#### Say thanks
|
||||||
Because there were some questions about that in the past: If grocy is useful for you, [say thanks](https://grocy.info/#say-thanks)!
|
Because there were some questions about that in the past: If Grocy is useful for you, [say thanks](https://grocy.info/#say-thanks)!
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
- Fixed that the "X products are already expired" count on the stock overview page was wrong
|
- Fixed that the "X products are already expired" count on the stock overview page was wrong
|
||||||
- Fixed that after product actions (consume/purchase/etc.) on the stock overview page the highlighting of the row was maybe wrong
|
- Fixed that after product actions (consume/purchase/etc.) on the stock overview page the highlighting of the row was maybe wrong
|
||||||
- After product actions (consume/purchase/etc.) on the stock overview page on a sub product, now also the parent product (row) is refreshed
|
- After product actions (consume/purchase/etc.) on the stock overview page on a sub product, now also the parent product (row) is refreshed
|
||||||
- It's now possible to accumulate min. stock amounts on parent product level (new option per product, means the sub product will never be "missing" then, only the parent product)
|
- It's now possible to accumulate min. stock amounts on parent product level (new option per product, means the sub product will never be missing then, only the parent product)
|
||||||
- On the purchase page there is now an option to select that the price is the total price (for the whole amount) - below the price field, defaults to "Unit price" (as it was until now), when set to "Total price", the entered price will be divided by the amount before posting
|
- On the purchase page there is now an option to select that the price is the total price (for the whole amount) - below the price field, defaults to "Unit price" (as it was until now), when set to "Total price", the entered price will be divided by the amount before posting
|
||||||
- "Average shelf life" on the product card now displays just "Unlimited" when the resulting value would be > 200 years (for products which never expire, as they have a best before date of 2999-12-31)
|
- "Average shelf life" on the product card now displays just "Unlimited" when the resulting value would be > 200 years (for products which never expire, as they have a best before date of 2999-12-31)
|
||||||
|
|
||||||
|
@@ -27,12 +27,12 @@
|
|||||||
- There is also a new sub feature flag `FEATURE_FLAG_STOCK_PRODUCT_FREEZING` to disable this if you don't need it (defaults to `true`)
|
- There is also a new sub feature flag `FEATURE_FLAG_STOCK_PRODUCT_FREEZING` to disable this if you don't need it (defaults to `true`)
|
||||||
|
|
||||||
### Stock improvements/fixes
|
### Stock improvements/fixes
|
||||||
- The productcard gets now also refreshed after a transaction was posted (purchase/consume/etc.) (thanks @kriddles)
|
- The product card gets now also refreshed after a transaction was posted (purchase/consume/etc.) (thanks @kriddles)
|
||||||
- The product field calories (kcal) now also allows decimal numbers
|
- The product field calories (kcal) now also allows decimal numbers
|
||||||
- On the inventory page, "New amount" is now prefilled with the current stock amount of the selected product
|
- On the inventory page, "New amount" is now prefilled with the current stock amount of the selected product
|
||||||
- Fixed that entering partial amounts was not possible on the inventory page (only applies if the product option "Allow partial units in stock" is enabled)
|
- Fixed that entering partial amounts was not possible on the inventory page (only applies if the product option "Allow partial units in stock" is enabled)
|
||||||
- Fixed that on purchase a wrong minimum amount was enforced for products with enabled tare weight handling in combination with different purchase/stock quantity units
|
- Fixed that on purchase a wrong minimum amount was enforced for products with enabled tare weight handling in combination with different purchase/stock quantity units
|
||||||
- Fixed that the productcard did not load correctly when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was set to `false` (thanks @kriddles)
|
- Fixed that the product card did not load correctly when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was set to `false` (thanks @kriddles)
|
||||||
- Fixed that the "Add as barcode to existing product" workflow did not work twice when not switching the page inbetween
|
- Fixed that the "Add as barcode to existing product" workflow did not work twice when not switching the page inbetween
|
||||||
|
|
||||||
### Shopping list improvements/fixes
|
### Shopping list improvements/fixes
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
## !! Important notice
|
## !! Important notice
|
||||||
If you run grocy in a subdirectory, you need to set a new `config.php` setting (`BASE_PATH`, see `config-dist.php`)
|
If you run Grocy in a subdirectory, you need to set a new `config.php` setting (`BASE_PATH`, see `config-dist.php`)
|
||||||
|
|
||||||
### Stock fixes
|
### Stock fixes
|
||||||
- Fixed purchase/consume/inventory problems when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was set to `false`
|
- Fixed purchase/consume/inventory problems when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was set to `false`
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
>
|
>
|
||||||
> [Here](https://github.com/grocy/grocy/issues/1209#issuecomment-749760765) is a workaround if you still run a SQLite version >= 3.8.3 < 3.9.0
|
> [Here](https://github.com/grocy/grocy/issues/1209#issuecomment-749760765) is a workaround if you still run a SQLite version >= 3.8.3 < 3.9.0
|
||||||
>
|
>
|
||||||
> _PHP 7.2 with SQLite 3.8.3 was the formerly in [README mentioned](https://github.com/grocy/grocy#how-to-install) minimum runtime requirement, any future release will only be tested against a reasonable recent runtime (currently PHP 7.4 with SQLite 3.27.2) - supporting those (very) old runtime stuff is too time consuming..._
|
> _PHP 7.2 (with SQLite 3.8.3+) was the formerly minimum runtime requirement, any future release will only support PHP 7.4 (with SQLite 3.27.2+) - supporting those (very) old runtime stuff is too time consuming..._
|
||||||
|
|
||||||
> ❗ If some pages/tables doesn't load at all, please check that your `/data/config.php` setting `CURRENCY` is a valid ISO 4217 currency code - that's most probably the issue then.
|
> ❗ If some pages/tables doesn't load at all, please check that your `/data/config.php` setting `CURRENCY` is a valid ISO 4217 currency code - that's most probably the issue then.
|
||||||
|
|
||||||
@@ -31,10 +31,10 @@
|
|||||||
- New `config.php` setting `AUTH_CLASS` to change the used authentication provider
|
- New `config.php` setting `AUTH_CLASS` to change the used authentication provider
|
||||||
- Via LDAP
|
- Via LDAP
|
||||||
- New `config.php` settings `LDAP_DOMAIN`, `LDAP_ADDRESS` and `LDAP_BASE_DN`
|
- New `config.php` settings `LDAP_DOMAIN`, `LDAP_ADDRESS` and `LDAP_BASE_DN`
|
||||||
- If you set `AUTH_CLASS` to `Grocy\Middleware\LdapAuthMiddleware`, users will be authenticated against your directory (and will also be created (in grocy), if not already present)
|
- If you set `AUTH_CLASS` to `Grocy\Middleware\LdapAuthMiddleware`, users will be authenticated against your directory (and will also be created (in Grocy), if not already present)
|
||||||
- Via a reverse proxy
|
- Via a reverse proxy
|
||||||
- New `config.php` setting `REVERSE_PROXY_AUTH_HEADER`
|
- New `config.php` setting `REVERSE_PROXY_AUTH_HEADER`
|
||||||
- If you set `AUTH_CLASS` to `Grocy\Middleware\ReverseProxyAuthMiddleware` and your reverse proxy sends a username in the HTTP header `REMOTE_USER` (header name can be changed by the setting `REVERSE_PROXY_AUTH_HEADER`), the user is automatically authenticated (and will also be created (in grocy), if not already present)
|
- If you set `AUTH_CLASS` to `Grocy\Middleware\ReverseProxyAuthMiddleware` and your reverse proxy sends a username in the HTTP header `REMOTE_USER` (header name can be changed by the setting `REVERSE_PROXY_AUTH_HEADER`), the user is automatically authenticated (and will also be created (in Grocy), if not already present)
|
||||||
- (Thanks @fipwmaqzufheoxq92ebc for the initial work on this)
|
- (Thanks @fipwmaqzufheoxq92ebc for the initial work on this)
|
||||||
|
|
||||||
### Stock improvements/fixes
|
### Stock improvements/fixes
|
||||||
@@ -174,7 +174,7 @@
|
|||||||
- Products, quantity units and product groups are possible to use now
|
- 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
|
- 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
|
- Ordering now happens case-insensitive
|
||||||
- The data path (previously fixed to the `data` folder) is now configurable, making it possible to run multiple grocy instances from the same directory (with different `config.php` files / different database, etc.) (thanks @fgrsnau)
|
- The data path (previously fixed to the `data` folder) is now configurable, making it possible to run multiple Grocy instances from the same directory (with different `config.php` files / different database, etc.) (thanks @fgrsnau)
|
||||||
- Via an environment variable `GROCY_DATAPATH` (higher priority)
|
- Via an environment variable `GROCY_DATAPATH` (higher priority)
|
||||||
- Via an FastCGI parameter `GROCY_DATAPATH` (lower 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)
|
- The language can now be set per user (see the new user settings page / top right corner settings menu) (thanks @fipwmaqzufheoxq92ebc)
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
>
|
>
|
||||||
> [Here](https://github.com/grocy/grocy/issues/1209#issuecomment-749760765) is a workaround if you still run a SQLite version >= 3.8.3 < 3.9.0
|
> [Here](https://github.com/grocy/grocy/issues/1209#issuecomment-749760765) is a workaround if you still run a SQLite version >= 3.8.3 < 3.9.0
|
||||||
>
|
>
|
||||||
> _PHP 7.2 with SQLite 3.8.3 was the formerly in [README mentioned](https://github.com/grocy/grocy#how-to-install) minimum runtime requirement, any future release will only be tested against a reasonable recent runtime (currently PHP 7.4 with SQLite 3.27.2) - supporting those (very) old runtime stuff is too time consuming..._
|
> _PHP 7.2 (with SQLite 3.8.3+) was the formerly minimum runtime requirement, any future release will only support PHP 7.4 (with SQLite 3.27.2+) - supporting those (very) old runtime stuff is too time consuming..._
|
||||||
|
|
||||||
- Improved the prerequisites checker (added missing required PHP extension `ctype`) (thanks @Forceu)
|
- Improved the prerequisites checker (added missing required PHP extension `ctype`) (thanks @Forceu)
|
||||||
- Added validation checks for most `data/config.php` settings to prevent using invalid ones (thanks @Forceu)
|
- Added validation checks for most `data/config.php` settings to prevent using invalid ones (thanks @Forceu)
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
> ⚠️ The following PHP extensions are now additionally required: `json`, `intl`, `zlib`
|
> ⚠️ The following PHP extensions are now additionally required: `json`, `intl`, `zlib`
|
||||||
|
|
||||||
> ⚠️ PHP 8 is now supported and from now on the only tested runtime version (although currently PHP 7.2 should still work).
|
> ⚠️ PHP 8.0 (with SQLite 3.27.2+) is from now on the only supported runtime version.
|
||||||
|
|
||||||
|
### New feature: Grocycode / label printer support
|
||||||
|
|
||||||
### New feature: grocycode / label printer support
|
|
||||||
#### (Own) Product/stock entry/chores/batteries labels/barcodes
|
#### (Own) Product/stock entry/chores/batteries labels/barcodes
|
||||||
- Print own labels/barcodes for products/stock entries/chores/batteries and then scan that code on every place a product/stock entry/chore/battery can be selected
|
- Print own labels/barcodes for products/stock entries/chores/batteries and then scan that code on every place a product/stock entry/chore/battery can be selected
|
||||||
- Can be printed (or downloaded) via
|
- Can be printed (or downloaded) via
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
|
|
||||||
### New feature: Shopping list thermal printer support
|
### New feature: Shopping list thermal printer support
|
||||||
- The shopping list can now be printed on a thermal printer
|
- The shopping list can now be printed on a thermal printer
|
||||||
- The printer must be compatible to the `ESC/POS` protocol and needs to be locally attached or network reachable to/by the machine hosting grocy (so the server)
|
- The printer must be compatible to the `ESC/POS` protocol and needs to be locally attached or network reachable to/by the machine hosting Grocy (so the server)
|
||||||
- See the new `TPRINTER*` `config.php` options to configure the printer connection and other options
|
- See the new `TPRINTER*` `config.php` options to configure the printer connection and other options
|
||||||
- => New button on the shopping list print dialog
|
- => New button on the shopping list print dialog
|
||||||
- Can be enabled via the new feature flag `FEATURE_FLAG_THERMAL_PRINTER` (defaults to disabled)
|
- Can be enabled via the new feature flag `FEATURE_FLAG_THERMAL_PRINTER` (defaults to disabled)
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
- Product barcodes are now enforced to be unique across products
|
- Product barcodes are now enforced to be unique across products
|
||||||
- On the stock overview page it's now also possible to search/filter by product barcodes (via the general search field)
|
- On the stock overview page it's now also possible to search/filter by product barcodes (via the general search field)
|
||||||
- The product picker on the consume and transfer page now only shows products which are currently in stock
|
- The product picker on the consume and transfer page now only shows products which are currently in stock
|
||||||
- Added a filter option to only show in-stock products on the stock overview and products list (master data) page
|
- Added a filter option to only show currently in-stock products on the stock overview and products list (master data) page
|
||||||
- Added new columns on the stock overview page (hidden by default): Product description, product default location, parent product, product picture
|
- Added new columns on the stock overview page (hidden by default): Product description, product default location, parent product, product picture
|
||||||
- Added a new product option "Should not be frozen" (defaults to disabled and only visible when `FEATURE_FLAG_STOCK_PRODUCT_FREEZING` is enabled)
|
- Added a new product option "Should not be frozen" (defaults to disabled and only visible when `FEATURE_FLAG_STOCK_PRODUCT_FREEZING` is enabled)
|
||||||
- When enabled, on moving the product to a freezer location (so when freezing it), a corresponding warning will be shown
|
- When enabled, on moving the product to a freezer location (so when freezing it), a corresponding warning will be shown
|
||||||
@@ -113,7 +114,7 @@
|
|||||||
- Fixed that the "Manage users" and "Manage API keys" menu was not shown when using reverse proxy authentication
|
- Fixed that the "Manage users" and "Manage API keys" menu was not shown when using reverse proxy authentication
|
||||||
|
|
||||||
### API improvements/fixes
|
### API improvements/fixes
|
||||||
> ❗ Numbers are now returned as numbers (so technically without quotes around them, were strings for nearly all endpoints before - should practically be no real difference)
|
> ~~❗ Numbers are now returned as numbers (so technically without quotes around them, were strings for nearly all endpoints before - should practically be no real difference)~~
|
||||||
>
|
>
|
||||||
> => ❗❗❗ This has been reverted after this (v3.1.0) release since it had unintended side effects
|
> => ❗❗❗ This has been reverted after this (v3.1.0) release since it had unintended side effects
|
||||||
- Added a new endpoint `/system/localization-strings` to get the localization strings (gettext JSON representation; in the by the user desired language)
|
- Added a new endpoint `/system/localization-strings` to get the localization strings (gettext JSON representation; in the by the user desired language)
|
||||||
|
@@ -3,14 +3,14 @@
|
|||||||
- More information on this: Only 1 level is currently supported; creating > 1 level nestings was _never_ possible via the UI/frontend, but not checked/enforced by the backend before `v3.0.0` - so it was potentially possible via the API (or any third party app/tool which utilizes it) to create such a nesting which then made this upgrade to fail
|
- More information on this: Only 1 level is currently supported; creating > 1 level nestings was _never_ possible via the UI/frontend, but not checked/enforced by the backend before `v3.0.0` - so it was potentially possible via the API (or any third party app/tool which utilizes it) to create such a nesting which then made this upgrade to fail
|
||||||
- Fixed that it was not possible to select a chore/battery on the corresponding tracking pages by mouse/touch
|
- Fixed that it was not possible to select a chore/battery on the corresponding tracking pages by mouse/touch
|
||||||
- Fixed that grouping by columns in tables may caused duplicate groups
|
- Fixed that grouping by columns in tables may caused duplicate groups
|
||||||
- Fixed that grocycode camera barcode scanning didn't recognize the scanned code for chore/battery tracking
|
- Fixed that Grocycode camera barcode scanning didn't recognize the scanned code for chore/battery tracking
|
||||||
- Fixed that when having any "Track date only" chore on the calendar, the iCal export was broken
|
- Fixed that when having any "Track date only" chore on the calendar, the iCal export was broken
|
||||||
- Optimized the meal plan page to be properly printable (thanks @MrKrisKrisu)
|
- Optimized the meal plan page to be properly printable (thanks @MrKrisKrisu)
|
||||||
|
|
||||||
### API
|
### API
|
||||||
> ❗ The release before (v3.1.0) introduced that "numbers are now returned as numbers": **This was reverted** since it had unintended side effects (so all fields are technically strings now again, just like before - sorry for that)
|
> ❗ The release before (v3.1.0) introduced that "numbers are now returned as numbers": **This was reverted** since it had unintended side effects (so all fields are technically strings now again, just like before - sorry for that)
|
||||||
- Fixed that `missing_products` of the `/stock/volatile` endpoint also contained incactive products
|
- Fixed that `missing_products` of the `/stock/volatile` endpoint also contained inactive products
|
||||||
- Fixed that when having multiple Userfields for an entity, the `/objects/{entity}` endpoint returned wrong Userfield values
|
- Fixed that when having multiple Userfields for an entity, the `/objects/{entity}` endpoint returned wrong Userfield values
|
||||||
- Fixed that the `/stock/products/by-barcode/{barcode}/consume` and `/stock/products/by-barcode/{barcode}/transfer` endpoint haven't used the stock entry given by a stock entry grocycode (thanks @lowlee for the initial work on this)
|
- Fixed that the `/stock/products/by-barcode/{barcode}/consume` and `/stock/products/by-barcode/{barcode}/transfer` endpoints haven't used the stock entry given by a stock entry Grocycode (thanks @lowlee for the initial work on this)
|
||||||
- Fixed that the "Stock by-barcode" API routes were broken for normal barcodes (only grocycodes were accepted) (thanks @larsverp)
|
- Fixed that the "Stock by-barcode" API routes were broken for normal barcodes (only grocycodes were accepted) (thanks @larsverp)
|
||||||
- Fixed that the "Stock by-barcode" API routes also accepted chore or battery grocycodes (thanks @lowlee)
|
- Fixed that the "Stock by-barcode" API routes also accepted chore or battery grocycodes (thanks @lowlee)
|
||||||
|
12
changelog/64_3.1.2_2021-09-27.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
- Fixed that the "Add all list items to stock" shopping list workflow did not work for more than ~6 items (thanks @tjhowse)
|
||||||
|
- Fixed that plural form handling (e.g. for quantity units) was wrong for negative numbers
|
||||||
|
- Fixed that the context menu entries `Consume` and `Transfer` on the stock overview page were disabled when the amount in stock was < 1
|
||||||
|
- Fixed that on consuming a product from not the products default location, the products default location was recorded in the stock journal
|
||||||
|
- Fixed that when undoing a stock consume transaction from not the products default location, the corresponding amount was always added back to to the products defaullt location
|
||||||
|
- Fixed that when having multiple quantity unit conversions for a products default QU purchase, on purchase was potentially a wrong conversion factor picked
|
||||||
|
- Fixed that when there was any chore with a schedule, but without a "next estimated tracking" date/time, the iCal export was broken
|
||||||
|
- The product and chore edit pages now have bottom-sticky save buttons
|
||||||
|
- A product picture can now be added when creating a product (was currently only possible when editing a product)
|
||||||
|
|
||||||
|
### API
|
||||||
|
- Fixed that international characters and spaces were not allowed in API query filters
|
19
changelog/65_3.1.3_2021-11-14.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
- The "Below min. stock amount" filter on the stock overview page now also includes due-soon, overdue or already expired products
|
||||||
|
- The default shopping list (named "Shopping list"; localized) can now be renamed
|
||||||
|
- Added the products average price as a (hidden by default) column on the stock overview page
|
||||||
|
- Added a new "Presets for new products" stock setting for the "Default due days" option of new products
|
||||||
|
- When adding (purchase) a product with "Default due days after freezing" set directly to a freezer location, the due date is now prefilled by that (instead of the normal "Default due days") (thanks @grahamc for the initial work on this)
|
||||||
|
- Chores can now be merged (new item in the context-/more-menu on the chores list page)
|
||||||
|
- Fixed that "Label per unit" stock entry labels (on purchase) weren't unique per unit
|
||||||
|
- Fixed that the "Add as new product" productpicker workflow, started from the shopping list item form, always selected the default shopping list after finishing the flow
|
||||||
|
- Fixed that when undoing a product opened transaction and when the product has "Default due days after opened" set, the original due date wasn't restored
|
||||||
|
- Fixed that "Track date only"-chores were shown as overdue on the due day on the chores overview page
|
||||||
|
- Fixed that dropdown filters for tables maybe did not work after reordering columns
|
||||||
|
- Fixed that auto night mode over midnight did not always work
|
||||||
|
- Fixed that the labels of context-/more-menu items were not readable in Night Mode (thanks @corbolais)
|
||||||
|
- Fixed that the "Stay logged in permanently" checkbox on the login page had no effect (thanks @0)
|
||||||
|
|
||||||
|
### API
|
||||||
|
- New endpoint `/chores/{choreIdToKeep}/merge/{choreIdToRemove}` for merging chores
|
||||||
|
- Endpoint `/stock/products/{productId}/add` API endpoint: The (optional) request body parameter `print_stock_label` was renamed to `stock_label_type`
|
||||||
|
- Fixed that backslashes were not allowed in API query filters
|
79
changelog/66_3.2.0_2022-02-11.md
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
### Stock
|
||||||
|
|
||||||
|
- The `config.php` option `FEATURE_SETTING_STOCK_COUNT_OPENED_PRODUCTS_AGAINST_MINIMUM_STOCK_AMOUNT` was removed and is now a new product option `Treat opened as out of stock`, means, if opened stock entries will be counted as missing for calculating if a product is below its minimum stock amount, can now be configured per product
|
||||||
|
- The existing option will be migrated to all existing products, so no changed behavior after the update
|
||||||
|
- There is also a new stock setting (section "Presets for new products") which can be used to configure the default when adding products (also that will be set based on the old setting on migration)
|
||||||
|
- When using/scanning a stock entry Grocycode on the consume page, the amount is now prefilled by the stock entry amount (making it essentially possible to consume the corresponding stock entry in one go)
|
||||||
|
- Stock entry labels get now also printed on inventory (only when adding products, same option "Stock entry label" like on the purchase page)
|
||||||
|
- Fixed that stock entry labels on purchase were printed, even when "No label" was selected (was only a problem when running label printer WebHooks server side)
|
||||||
|
- Fixed that formatted (HTML) text for the (hidden by default) product description column on the stock overview page was not correctly displayed
|
||||||
|
- Fixed that numeric and date-time sorting of table columns on the stock entries page did not work correctly (thanks @MasterofJOKers)
|
||||||
|
- Fixed that the consume page/dialog wasn't properly initialized when opening it from the stock entries page
|
||||||
|
- Fixed that entries for not existing users were missing on the stock journal
|
||||||
|
|
||||||
|
### Recipes
|
||||||
|
|
||||||
|
- Optimized recipe costs calculation to better reflect the current real costs: Out of stock ingredients now use the last price
|
||||||
|
- Background: Before v3.0.0 recipe costs were only based on the last price per product and since v3.0.0 the "real costs" (based on the default consume rule "Opened first, then first due first, then first in first out") are used, means out of stock items have no price - so using the last price for out of stock items should reflect the current real costs better
|
||||||
|
- Added a new recipes setting (top right corner settings menu) "Show the recipe list and the recipe side by side" (defaults to enabled, so no changed behaviour when not configured)
|
||||||
|
- When disabled, on the recipes page, the recipe list is displayed full-width and the recipe will be shown in a popup instead of on the right side
|
||||||
|
- Recipes are now also Grocycode enabled (works like any other Grocycode; download/print it via the recipes edit page or the more/context menu on the recipes page; use/scan it at any place a recipe can be selected)
|
||||||
|
- Performance improvements (page loading time) of the recipes page
|
||||||
|
- Fixed that when adding missing recipe ingredients, with the option "Only check if any amount is in stock" enabled, to the shopping list, unit conversions (if any) weren't considered
|
||||||
|
- Fixed that the recipe stock fulfillment information about shopping list amounts was not correct when the ingredient had a decimal amount
|
||||||
|
|
||||||
|
### Meal plan
|
||||||
|
|
||||||
|
- Meal plan sections can now (optionally) define a time, which will then be displayed on the meal plan section header and used for the corresponding calendar events
|
||||||
|
- Additionally the correspnding calendar event now also mentions the meal plan section name
|
||||||
|
- The day/week view can now be toggled
|
||||||
|
- New button on top right corner of the meal plan (only visible on bigger screens)
|
||||||
|
- On smaller screen the day view is still the default (no change)
|
||||||
|
- Fixed that the meal plan showed the total calories per recipe (instead of per serving as stated by the suffix)
|
||||||
|
|
||||||
|
### Chores
|
||||||
|
|
||||||
|
- Chore schedules can now be skipped
|
||||||
|
- New button on the chores overview and chore tracking page
|
||||||
|
- Skipped schedules will be highlighted accordingly on the chore journal
|
||||||
|
- Added a new chore option "Start date" which is used as a schedule starting point when the chore was never tracked
|
||||||
|
- Until now, the schedule starting point was the first tracked execution
|
||||||
|
- For all existing chores, the start date will be set to the first tracked execution time (or today, for chores which were never tracked) on migration
|
||||||
|
- The `Yearly` period type has been changed to be schedule the chore on the _same day_ each year
|
||||||
|
- This period type scheduled chores 1 year _after the last execution_ before, which is also possible by using the `Daily` period type and a period interval of 365 days; all existing `Yearly` schedules will be converted to that on migration
|
||||||
|
- Added a new `Hourly` period type (to schedule chores every `x` hours)
|
||||||
|
- Added a new `Adaptive` period type (to schedule chores dynamically based on the past average execution frequency)
|
||||||
|
- Removed the period type `Dynamic regular`, since it's the same as `Daily`
|
||||||
|
- All existing `Dynamic regular` schedules will be converted to that on migration
|
||||||
|
- The chorecard now also shows the average execution frequency (how often the chore was executed in the past on average)
|
||||||
|
|
||||||
|
### Calendar
|
||||||
|
|
||||||
|
- Fixed that when having a task without a due date, the iCal export was broken
|
||||||
|
|
||||||
|
### Tasks
|
||||||
|
|
||||||
|
- Added a "Save & add another task"-button on the add task dialog to quickly create multiple tasks without having to close/reopen the dialog
|
||||||
|
- Fixed that when editing a task without a due date, `1970-01-01` was shown
|
||||||
|
|
||||||
|
### General
|
||||||
|
|
||||||
|
- Added a separate status filter and table row highlighting (blue) on the chores, tasks and batteries overview pages for items due today
|
||||||
|
- Additionally, the "due soon" days of chores/tasks/batteries (top right corner settings menu) can be set to `0` to disable that filter/highlighting
|
||||||
|
- Optimized relative time display (also fixed a phrasing problem for some languages, e.g. Hungarian) (thanks @Tallyrald)
|
||||||
|
- New input shorthand `[+/-]n[d/m/y]` for date fields to quickly input a date relative to today (adding (**+**) or subtracting (**-**) the **n**umber of **d**ays/**m**onths/**y**ears, see the full list of available shorthands [here](https://github.com/grocy/grocy#input-shorthands-for-date-fields))
|
||||||
|
- When using LDAP authentication, the configured `LDAP_UID_ATTR` is now used to compare if the user already exists instead of the username entered on the login page (that prevents creating multiple users if you enter the username in different notations) (thanks @FloSet)
|
||||||
|
- When using reverse proxy authentication (`ReverseProxyAuthMiddleware`), it's now also possible to pass the username in an environment variable instead of an HTTP header (new `config.php` option `REVERSE_PROXY_AUTH_USE_ENV`) (thanks @Forceu)
|
||||||
|
- The `config.php` option `DISABLE_BROWSER_BARCODE_CAMERA_SCANNING` has been renamed to `FEATURE_FLAG_DISABLE_BROWSER_BARCODE_CAMERA_SCANNING`
|
||||||
|
- Fixed that when having a quantity unit matching any application string, the translation of that string was used to display that unit
|
||||||
|
- Fixed that the logout button/menu was missing when using external authentication (e.g. LDAP)
|
||||||
|
- New translations: (thanks all the translators)
|
||||||
|
- Catalan (demo available at https://ca.demo.grocy.info)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
- The API endpoint `/stock/shoppinglist/clear` has now a new optional request body parameter `done_only` (to only remove done items from the given shopping list, defaults to `false`)
|
||||||
|
- The API endpoint `/chores/{choreId}/execute` has now a new optional request body parameter `skipped` (to skip the next chore schedule, defaults to `false`)
|
||||||
|
- The API endpoint `/chores/{choreId}` has new response field/property `average_execution_frequency_hours` (contains the average past execution frequency in hours or `null`, when the chore was never executed before)
|
||||||
|
- New API endpoint `/recipes/{recipeId}/printlabel` (to print recipe grocycodes on the configured label printer)
|
||||||
|
- Fixed that the barcode lookup for the "Stock by-barcode" API endpoints was case sensitive
|
121
changelog/67_3.3.0_2022-04-08.md
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
### New feature: Notes and Userfields for stock entries
|
||||||
|
|
||||||
|
- Stock entries can now have notes
|
||||||
|
- For example to distinguish between same, yet different products (e.g. having only a generic product "Chocolate" and note in that field what special one it is exactly this time - as an alternative to have sub products)
|
||||||
|
- Or for example to track ownership of stock items when sharing the fridge with your flatmates
|
||||||
|
- => New field on the purchase and inventory (and stock entry edit) page
|
||||||
|
- => New column on the stock entries and stock journal page
|
||||||
|
- => Visible also in the "Use a specific stock item" dropdown on the consume and transfer page
|
||||||
|
- Additionally it's also possible to add arbitrary own fields by using Userfields
|
||||||
|
- => Configure the desired Userfields for the entity `stock`
|
||||||
|
- => Those Userfields are then visible on the same places as mentioned above for the built-in "Note" field
|
||||||
|
|
||||||
|
### New feature: Recipes "Due score"
|
||||||
|
|
||||||
|
- A number (new column on the recipes page) which represents a score which is higher the more ingredients, of the corresponding recipe, currently in stock are due soon, overdue or already expired
|
||||||
|
- Or in other words: A score to see which recipes to cook to not waste already overdue/expired or due soon products
|
||||||
|
- The score is in detail based on:
|
||||||
|
- 1 point for each due soon ingredient (based on the stock setting "Due soon days")
|
||||||
|
- 10 points per overdue ingredient
|
||||||
|
- 20 points per expired ingredient
|
||||||
|
- (or else 0)
|
||||||
|
- The corresponding ingredient is also highlighted in red/yellow/grey (same colors as on the stock overview page)
|
||||||
|
|
||||||
|
### Stock
|
||||||
|
|
||||||
|
- It's now possible to change a products stock QU, even after it was once added to stock
|
||||||
|
- When the product was once added to stock, there needs to exist a corresponding unit conversion for the new QU
|
||||||
|
- Product card, stock overiew and stock entries page optimizations regarding displaying prices:
|
||||||
|
- Prices are now shown per default purchase quantity unit, instead of per stock QU and when clicking/hovering, a tooltip shows the price per stock QU
|
||||||
|
- The price history chart is now based on the value per purchase QU, instead of per stock QU
|
||||||
|
- New product option "Default consume location" (not mandatory, defaults to not set / empty)
|
||||||
|
- When set, stock entries at that location will be consumed first
|
||||||
|
- => This will be automatically taken into account when consuming from the stock overview page and all other places where no specific location can be selected
|
||||||
|
- => On the consume page the location is preselected in the following order:
|
||||||
|
1. The new default consume location, if the product currently has any stock there, otherwise
|
||||||
|
2. The products default location, if the product currently has any stock there, otherwise
|
||||||
|
3. The first location where the product currently has any stock
|
||||||
|
- Optimized quantity unit conversion handling:
|
||||||
|
- The option "Create inverse QU conversion" was removed when creating a QU conversion
|
||||||
|
- => Instead the corresponding inverse conversion is now always created/updated/deleted automatically
|
||||||
|
- New product option "Disable own stock" (defaults to disabled)
|
||||||
|
- When enabled, the corresponding product can't have own stock, means it will not be selectable on purchase (useful for parent products which are just used as a summary/total view of the sub products)
|
||||||
|
- The location content sheet can now optionally list also out of stock products (at the products default location, new checkbox "Show only in-stock products" at the top of the page, defaults to enabled)
|
||||||
|
- Added a location filter to the stock entries page
|
||||||
|
- Added the product Grocycode as a (hidden by default) column to the products list (master data)
|
||||||
|
- The price entered on the inventory page is now related to the selected quantity unit (like on the purchase page, was always related to the products stock QU before)
|
||||||
|
- Fixed that consuming via the consume page was not possible when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was disabled
|
||||||
|
|
||||||
|
### Shopping list
|
||||||
|
|
||||||
|
- Added a new shopping list setting (top right corner settings menu) to automatically add products, that are below their defined min. stock amount, to the shopping list (defaults to disabled)
|
||||||
|
- Fixed that when using "Add products that are below defined min. stock amount", the calculated missing amount was wrong for products which had the new product option `Treat opened as out of stock` set and when having at least one opened stock entry
|
||||||
|
|
||||||
|
### Recipes
|
||||||
|
|
||||||
|
- When a parent product is used as an ingredient, which is currently not in stock itself, the substituted product (so the one which was already taken into account when consuming the recipe) is now displayed below the ingredient and the costs (and calories) are taken from that one, to reflect the current real costs even better
|
||||||
|
- Added a new recipes setting (top right corner settings menu) "Show a little checkbox next to each ingredient to mark it as done" (defaults to disabled)
|
||||||
|
- When enabled, next to each ingredient a little checkbox will be shown
|
||||||
|
- When clicked, the ingredient is crossed out
|
||||||
|
- This status is not saved, means reset when the page is reloaded
|
||||||
|
- Fixed that consuming recipes was possible when not all ingredients were in stock (and this potentially consumed some of the in stock ingredients; not matching the message "nothing removed")
|
||||||
|
- Fixed that the price of the "Produces product"-product, which is added to stock on consuming a recipe, was wrong (was the recipe total costs multiplied by the serving amount instead of only the recipe total costs)
|
||||||
|
- Fixed that calories of recipe ingredients were displayed with an indefinite number of decimal places
|
||||||
|
- Fixed that ingredient amounts were wrong for multi-nested (> 2 levels) recipes, when the included recipe used an serving amount other than 1
|
||||||
|
- Fixed that searching/filtering the recipe gallery view did not work correctly
|
||||||
|
- Fixed that searching/filtering recipes by products did not work (e.g. via the context-/more menu option "Search for recipes containing this product" on the stock overview page)
|
||||||
|
|
||||||
|
### Meal plan
|
||||||
|
|
||||||
|
- The day is now editable on the edit dialog of any meal plan entry, which makes it possible to move entries to a different day
|
||||||
|
- Fixed that it was not possible to print the meal plan (and other pages) in landscape (thanks @miguelangel-nubla)
|
||||||
|
|
||||||
|
### Chores
|
||||||
|
|
||||||
|
- The `Daily` period type has been changed to schedule the chore at the _same time_ (based on the start date) each `n` days
|
||||||
|
- This period type scheduled chores `n` days _after the last execution_ before, which is also possible by using the `Hourly` period type and a corresponding period interval; all existing `Daily` schedules will be converted to that on migration
|
||||||
|
- It's now possible to manually reschedule / assign chores
|
||||||
|
- New entry "Reschedule next execution" in the context/more menu on the chores overview page
|
||||||
|
- If you have rescheduled a chore and want to continue the normal schedule/assignment instead, use the "Clear" button in the same dialog
|
||||||
|
- Rescheduled/reassigned chores will be highlighted with an corresponding icon next to the "Next estimated tracking date" / "Assigned to"
|
||||||
|
- Optimized that when skipping chores via the chore tracking page, the given time is used as the "skipped time", not the scheduled next estimated tracking time of the corresponding chore (making it essentially possible to skip more then one schedule at once)
|
||||||
|
- Fixed that when consuming a parent product on chore execution (chore option "Consume product on chore execution"), no child products were used if the parent product itself is not in stock
|
||||||
|
- Fixed that the upgrade to v3.2.0 failed when having any former "Dynamic Regular" chore with a "Period interval" of `0` (which makes absolutely no sense in reality)
|
||||||
|
|
||||||
|
### Tasks
|
||||||
|
|
||||||
|
- Fixed that tasks without a due date were highlighted in red (like overdue tasks)
|
||||||
|
|
||||||
|
### Batteries
|
||||||
|
|
||||||
|
- Fixed that the batteries overview page was broken when there was any battery Userfield with enabled "Show as column in tables" option
|
||||||
|
- Fixed that Grocycode label printer printing didn't work from the battery edit page (master data) (thanks @andreheuer)
|
||||||
|
- Fixed that undoing a battery charge cycle had no effect on "Last charged" and "Next planned charge cycle" of the corresponding battery
|
||||||
|
|
||||||
|
### Equipment
|
||||||
|
|
||||||
|
- It's now possible to add multiple files (PDFs / manuals) to each equipment
|
||||||
|
- Define as many Userfields for the entity `equipment` and use the type `File`
|
||||||
|
- => Each of those File-Userfields will be shown as a separate tab on the equipment page
|
||||||
|
|
||||||
|
### Userfields
|
||||||
|
|
||||||
|
- Userfields of type "Date & time" and "Date (without time)" have now the option to default to now / today for new objects (new Userfield option "Default value")
|
||||||
|
|
||||||
|
### General
|
||||||
|
|
||||||
|
- Optimized form validation: Save / submit buttons are now not disabled when the form is invalid, the invalid / missing fields are instead highlighted when trying to submit / save the form (making it more obvious which fields are invalid / missing exactly)
|
||||||
|
- Night mode can now use / follow the system preferred color scheme
|
||||||
|
- The view/user setting "Enable night mode" has been removed and replaced by "Night mode" which now defaults to "Use system setting" (which uses the system preferred color scheme, "On" and "Off" are other possible options to always enable/disable night mode)
|
||||||
|
- Some night mode style refinements
|
||||||
|
- Fixed an server error (on every page) when not having any quantity unit
|
||||||
|
- New translations: (thanks all the translators)
|
||||||
|
- Slovenian (demo available at <https://sl.demo.grocy.info>)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
- Added a new endpoint `GET /stock/locations/{locationId}/entries` to get all stock entries of a given location (similar to the already existing endpoint `GET /stock/products/{productId}/entries`)
|
||||||
|
- Endpoint `/recipes/{recipeId}/consume`: Fixed that consuming partially fulfilled recipes was possible, although an error was already returned in that case (and potentially some of the in stock ingredients were consumed in fact)
|
||||||
|
- Endpoint `/stock/products/{productId}`:
|
||||||
|
- New field/property `current_price` which returns the current price of the corresponding product, based on the stock entry to use next (defined by the default consume rule "Opened first, then first due first, then first in first out") or on the last price if the product is currently not in stock
|
||||||
|
- The field/property `oldest_price` is deprecated and will be removed in a future version (this had no real sense, currently returns the same as `current_price`)
|
33
changelog/68_3.3.1_2022-06-10.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
### Stock
|
||||||
|
|
||||||
|
- New product option "Move on open" (defaults to disabled)
|
||||||
|
- When enabled, on marking the product as opened, the corresponding amount will be moved to the products default consume location
|
||||||
|
- (Thanks @RosemaryOrchard)
|
||||||
|
- The stock setting "Decimal places allowed for prices" has been split into separate settings for input and displaying prices (the existing setting will be set for both new options on migration, so no changed behavior when not configured)
|
||||||
|
- Optimized that when the plural form(s) of a quantity unit is/are not provided, the singular form is used to display plural amounts
|
||||||
|
- Fixed that "Automatically add products that are below their defined min. stock amount to the shopping list" (stock setting) was only done when consuming products, not when opening them
|
||||||
|
- Fixed that the price history chart (product card) showed the price on a wrong date when having multiple purchases on the same date from different stores
|
||||||
|
|
||||||
|
### Recipes
|
||||||
|
|
||||||
|
- Fixed that when a substituted product is used to display costs and calories (so when a parent product ingredient is currently not in stock itself), no unit conversions were considered for costs/calories calculation
|
||||||
|
- Fixed that the displayed "already on the shopping list"-amount (for missing ingredients) was wrong when the products "Factor purchase to stock quantity unit" wasn't 1
|
||||||
|
|
||||||
|
### Chores
|
||||||
|
|
||||||
|
- Fixed that rescheduling of "Track date only"-chores for today was not possible
|
||||||
|
|
||||||
|
### Calendar
|
||||||
|
|
||||||
|
- Fixed that clicking on meal plan product and notes calendar entries redirected to an invalid page
|
||||||
|
|
||||||
|
### General
|
||||||
|
|
||||||
|
- LDAP authentication: Optimized that it's not required that LDAP accounts need to have a first-/lastname
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
- Endpoint `/stock/products/{productId}`: New field/property `default_consume_location` (contains the products default consume location object)
|
||||||
|
- Endpoint `/stock/products/{productId}/add`: Fixed that the request body parameter `transaction_type` was ignored / always set to `purchase`
|
||||||
|
- Fixed that the endpoint `/stock/products/by-barcode/{barcode}/open` didn't handle stock entries provided by a Grocycode (thanks @jtommi)
|
||||||
|
- Fixed that less or equal (`<=`) and greater or equal (`>=`) filter comparisons didn't work (optional `query[]` request query parameter on most endpoints)
|
42
changelog/69_3.3.2_2022-11-12.md
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
### Stock
|
||||||
|
|
||||||
|
- Improved that when editing a unit conversion, the "Quantity unit from" and "Quantity unit to" of the corresponding inverse conversion is now also updated accordingly if changed (until now only the factor was updated automatically)
|
||||||
|
- Changed that the "Move on open" product option can now always be used/set, even when the "Default location" and "Default consume location" are the same
|
||||||
|
- Fixed that stock entry notes were lost when consuming/opening/transferring a partial amount of the corresponding stock entry (thanks @akoshpinter)
|
||||||
|
- Fixed that the average shelf life of a product (on the product card) was wrong when the corresponding stock entry was edited
|
||||||
|
- Fixed that when the stock setting "Decimal places allowed for amounts" was set to `0`, unit conversion (if any) failed when adding the corresponding product to stock
|
||||||
|
- Fixed that consuming a parent product which is not in stock itself (so essentially using any of the child products) may failed when unit conversions were involved (the current stock amount check was wrong in that case)
|
||||||
|
- Fixed that the status button counters on the stock overview page ("X products are overdue" and so on) included products which have the option `Never show on stock overview` enabled
|
||||||
|
- Fixed that adding Userfields to existing stock entries was not possible (only editing existing Userfield values, e.g. added during purchase or inventory, was possible)
|
||||||
|
- Fixed that it was not possible to change a products stock QU, when the needed unit conversion (old QU => new QU) was only defined globally (means on QU level) or by the products "Factor purchase to stock quantity unit"
|
||||||
|
- Fixed that when changing a products stock QU, the products "Quick consume mount", "Energy (kcal)" and "Tare weight" wasn't updated according to the corresponding unit conversion factor
|
||||||
|
- Fixed that when changing a products stock QU, the product barcode amounts were also changed based on the corresponding unit conversion factor
|
||||||
|
|
||||||
|
### Shopping list
|
||||||
|
|
||||||
|
- Fixed that products could not be added to the shopping list via barcode scanning
|
||||||
|
|
||||||
|
### Recipes
|
||||||
|
|
||||||
|
- Fixed that headlines in the recipe description (preparation text) were removed on saving
|
||||||
|
- Fixed that the default consume rule was not always applied correctly when a recipe consumed a substituted ingredient (so when having a parent product in the recipe which is currently not in stock itself)
|
||||||
|
|
||||||
|
### Userfields
|
||||||
|
|
||||||
|
- Fixed that edit forms were broken when editing an object with `null` Userfields (so when the field for that object was not set before / on the initial object creation)
|
||||||
|
|
||||||
|
### General
|
||||||
|
|
||||||
|
- It's now possible to edit a user without necessarily updating the users password
|
||||||
|
- Fixed that column reordering didn't work on the stock overview, stock entries and shopping list page when showing columns which are not shown by default
|
||||||
|
- Fixed that when running label printer WebHooks client side (so when `LABEL_PRINTER_RUN_SERVER` = `false`), the setting `LABEL_PRINTER_HOOK_JSON` was ignored (the WebHook data was always sent as form data)
|
||||||
|
- Fixed that granular user permissions (like "Shopping list / Add items" or "Equipment") didn't allow to add/edit the corresponding items without also having the "Edit master data" permission
|
||||||
|
- New translations: (thanks all the translators)
|
||||||
|
- Lithuanian (demo available at <https://lt.demo.grocy.info>)
|
||||||
|
- Ukrainian (demo available at <https://uk.demo.grocy.info>)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
- Endpoint `/stock/volatile`
|
||||||
|
- The field/property `missing_products` now also contains the `product` object
|
||||||
|
- Endpoint `/recipes/{recipeId}/consume`: Fixed (again) that consuming partially fulfilled recipes was possible, although an error was already returned in that case (and potentially some of the in stock ingredients were consumed in fact)
|
118
changelog/70_4.0.0_2023-07-29.md
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
> ⚠️ PHP 8.1 (with SQLite 3.34.0+) is from now on the only supported runtime version.
|
||||||
|
|
||||||
|
> ❗ The major version bump is due to breaking API changes, please see below if you use the API.
|
||||||
|
|
||||||
|
> _Recommendation: Benchmark tests showed that e.g. unit conversion handling is up to 5 times faster when using a more recent (3.39.4+) SQLite version._
|
||||||
|
|
||||||
|
### New feature: Indirect quantity unit conversions with unlimited levels
|
||||||
|
|
||||||
|
- Quantity unit conversions now support indirect conversions with unlimited levels (thanks a lot @esclear)
|
||||||
|
- _Explained by a practical example: When a conversion between Teaspoons and Milliliters and another one between Milliliters and Liters exists (and so forth; unlimited levels), Grocy can now calculate Teaspoons to Liters (before a direct conversion definition between Teaspoons and Liters was required)_
|
||||||
|
- **Heads up:** If you have such "each to each absolute conversion definitions" currently (for the example above the conversion between Teaspoons and Liters), you should clean them up, since they are no longer needed
|
||||||
|
- The product option "Factor purchase to stock quantity unit" was removed
|
||||||
|
- => Use normal product specific QU conversions instead, if needed
|
||||||
|
- An existing "Factor purchase to stock quantity unit" was automatically migrated to a product specific QU conversion
|
||||||
|
|
||||||
|
### New feature: Stock reports
|
||||||
|
|
||||||
|
- New button "Reports" on the stock overview page
|
||||||
|
- The first report (more to come) "Spendings" makes it possible to explore (pie chart and table data) the total value spend by product or product group in any time range
|
||||||
|
- (Thanks for the initial work on this @raupie)
|
||||||
|
|
||||||
|
### Stock
|
||||||
|
|
||||||
|
- New product option "Default quantity unit consume"
|
||||||
|
- Will be used/selected as the default quantity unit on the consume page
|
||||||
|
- The product's "Quick consume amount" is now displayed related to this quantity unit ("quick consume/open buttons" on the stock overview page)
|
||||||
|
- Defaults to the product's "Quantity unit stock" (so no changed behavior when not configured)
|
||||||
|
- New product option "Quantity unit for prices"
|
||||||
|
- Prices are now shown related to this quantity unit (instead of per "Default quantity unit purchase") on the product card, price history chart, stock overiew and stock entries page
|
||||||
|
- Defaults to the product's "Default quantity unit purchase" (so no changed behavior when not configured)
|
||||||
|
- Changed that when the ingredient option "Only check if any amount is in stock" is enabled, costs and calories are now based on the original entered amount instead of an "virtual" fixed amount of `1`
|
||||||
|
- When using the "Add as barcode to existing product" workflow on a purchase transaction, the selected quantity unit and the entered amount and note are now also added to the new barcode
|
||||||
|
- New product option "Auto reprint stock entry label"
|
||||||
|
- When enabled, auto-changing the due date of a stock entry (by opening/freezing/thawing and having corresponding default due days set) will reprint its label (only server side label printer WebHooks are supported)
|
||||||
|
- Defaults to disabled, so no changed behavior when not configured
|
||||||
|
- Added a new option "Reprint stock entry label" on the stock entry edit page (will print the correspondind stock entry label on save)
|
||||||
|
- This option will be automatically set on changing the entry's due date
|
||||||
|
- The product option "Quick consume amount" (the amount used for the "quick consume/open buttons" on the stock overview page) has been split into another option "Quick open amount", to be able to set different amounts for consume and open (defaults to the "Quick consume amount" per product, so no changed behavior when not configured)
|
||||||
|
- Changed that for the product's average and last price (and for the price history chart) stock transactions with an empty or `0` price are ignored
|
||||||
|
- Added a filter option to only show currently out-of-stock products on the products list (master data) page
|
||||||
|
- When clicking a product name on the products list (master data) or on the stock journal page, the product card will now be displayed (like on the stock overview page)
|
||||||
|
- When using/scanning a product barcode and the purchase or inventory page, the barcode's note will now also be prefilled (if any)
|
||||||
|
- Each row on the stock journal now also has a context-/more menu for quick access to product related actions (the same as on the stock overview page)
|
||||||
|
- The amount of "Label per unit" stock entry labels (on purchase and inventory) is now displayed, to help prevent printing a lot of labels where this maybe is not intended
|
||||||
|
- Fixed that hiding the "Purchased date" column (table options) on the stock entries page didn't work
|
||||||
|
- Fixed that sorting by the "Value" and "Min. stock amount" columns on the stock overview page didn't work
|
||||||
|
- Fixed that the consumed amount was wrong, when consuming multiple substituted subproducts at once and when multiple/different conversion factors were involved
|
||||||
|
- Fixed that for a product's average price, only currently in-stock items were considered, not already consumed ones
|
||||||
|
- Fixed that when copying a product, some fields (like "Default consume location" or "Disable own stock) weren't copied along
|
||||||
|
- Fixed that the total product count on the stock overview page also included products with "Never show on stock overview" enabled
|
||||||
|
|
||||||
|
### Shopping list
|
||||||
|
|
||||||
|
- Added a new button "Clear done items" (to clear all done items with one click)
|
||||||
|
|
||||||
|
### Recipes
|
||||||
|
|
||||||
|
- Added a new entry "Add to meal plan" in the context/more menu per recipe to directly add a recipe to the meal plan from the recipes page
|
||||||
|
- Changed that when a ingredient has a "Variable amount" set, the text entered there now also replaces the unit when displaying the recipe (not only the amount as before)
|
||||||
|
- When displaying a recipe in fullscreen mode, the ingredients and preparation is now shown side by side (or below each other on small screens) instead of in tabs
|
||||||
|
- When consuming a recipe which has a "Produces product" set and when the product's "Default stock entry label" is configured accordingly, the corresponding label will now be printed on that action (only server side label printer WebHooks are supported)
|
||||||
|
- Fixed that hiding the "Requirements fulfilled" column (table options) on the recipes page didn't work
|
||||||
|
- Fixed that ingredient costs and calories were wrong when product substitution and unit conversions were involved at the same time
|
||||||
|
|
||||||
|
### Meal plan
|
||||||
|
|
||||||
|
- Added a new sub feature flag `FEATURE_FLAG_RECIPES_MEALPLAN` (in `config.php`) to only disable the meal plan if not needed (thanks @webysther)
|
||||||
|
- The `config.php` setting `MEAL_PLAN_FIRST_DAY_OF_WEEK` can now be set to `-1` to dynamically start the meal plan week on _today_
|
||||||
|
- Fixed that consuming a recipe from the meal plan didn't add its "Produces product"-product to stock (if any)
|
||||||
|
- Fixed that the "Put missing products on shopping list"-button in the header (to put all missing products on the shopping list for a whole week) was missing under certain circumstances (related to locale week numbers and turn of the year)
|
||||||
|
|
||||||
|
### Chores
|
||||||
|
|
||||||
|
- Changed the handling of the tracking buttons on the chores overview page
|
||||||
|
- The green button now tracks an execution of the corresponding chore on the next scheduled time, rather than for now/today
|
||||||
|
- New context-/more menu option "Track chore execution now" to track an execution for now/today (so the same what the green button did before)
|
||||||
|
- Removed the limitation on the chore tracking page that the tracked time couldn't be in the future
|
||||||
|
- Fixed that "assidgned to" was not recalculated when undoing chores
|
||||||
|
|
||||||
|
### Calendar
|
||||||
|
|
||||||
|
- Added a button to jump to today (between the prev/next buttons, top right corner)
|
||||||
|
|
||||||
|
### Tasks
|
||||||
|
|
||||||
|
- Fixed that hiding the "Category" column (table options) on the tasks page didn't work
|
||||||
|
|
||||||
|
### Userfields
|
||||||
|
|
||||||
|
- Product group Userfields are now also rendered on the shopping list
|
||||||
|
- Fixed that when having e.g. a Userfield for the `stock` entity and using the "Never overdue" shortcut checkbox for the due date on purchase, this Userfield would also be set to the corresponding "never overdue date"
|
||||||
|
|
||||||
|
### General
|
||||||
|
|
||||||
|
- Like already possible for products/chores/batteries, locations, stores, quantity units, product groups and task categories can now be disabled to keep them for existing references without deleting them, but to hide them everywhere for selections and so on (new option "Active")
|
||||||
|
- Added a new `config.php` setting `ENERGY_UNIT` to customize the label to display energy values (was fixed `kcal` before and defaults to that, so no changed behavior when not configured)
|
||||||
|
- New logo and "Grocy" is now officially spelled with a capital initial letter (before everything was lowercase)
|
||||||
|
- Various frontend performance enhancements
|
||||||
|
- Fixed that users were unable to delete their own API keys (when not having the `All permissions` permission)
|
||||||
|
- Fixed that button tooltips on some places didn't disappear after clicking the corresponding button
|
||||||
|
- New translations: (thanks all the translators)
|
||||||
|
- Estonian (demo available at <https://et.demo.grocy.info>)
|
||||||
|
- Romanian (demo available at <https://ro.demo.grocy.info>)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
- ⚠️ **Breaking changes**:
|
||||||
|
- The product property `qu_factor_purchase_to_stock` was removed (existing factors were migrated to normal product specific QU conversions, see above)
|
||||||
|
- Numbers are now returned as numbers (so technically without quotes around them, were strings for nearly all endpoints before)
|
||||||
|
- Endpoint `/stock/products/{productId}`:
|
||||||
|
- Added a new field/property `qu_conversion_factor_purchase_to_stock` for convenience (contains the conversion factor of the corresponding QU conversion from the product's `qu_id_purchase` to `qu_id_stock`)
|
||||||
|
- Added a new field/property `qu_conversion_factor_price_to_stock` for convenience (contains the conversion factor of the corresponding QU conversion from the product's `qu_id_price` to `qu_id_stock`)
|
||||||
|
- Added a new field/property `default_quantity_unit_consume` (contains the quantity unit object of the product's "Default quantity unit consume")
|
||||||
|
- The following entities are now also available via the endpoint `/objects/{entity}` (only listing, no edit)
|
||||||
|
- `quantity_unit_conversions_resolved` (returns all final/resolved conversion factors per product and any directly or indirectly related quantity units)
|
||||||
|
- `recipes_pos_resolved` (returns stock fulfilment information for all recipe ingredients)
|
||||||
|
- The endpoint `/batteries` now also returns the corresponding battery object (as field/property `battery`)
|
||||||
|
- API keys can now have a description (to e.g. track where the corresponding key is used)
|
19
changelog/71_4.0.1_2023-08-06.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
> 💡 PHP 8.2 is from now on (additionally to PHP 8.1) supported.
|
||||||
|
|
||||||
|
### Stock
|
||||||
|
|
||||||
|
- Fixed performance issues affecting all places where quantity unit conversions / prices are involved
|
||||||
|
- Fixed that the upgrade failed when having improperly defined product specific quantity unit conversions
|
||||||
|
- Fixed that edited stock entries were not considered in some cases (affecting the product's last price, average price, the price history and the stock reports)
|
||||||
|
|
||||||
|
### Shopping list
|
||||||
|
|
||||||
|
- Changed that unit prices on the shopping list (table column "Last price (Unit)") are now related to the there selected quantity unit (instead of to the product's QU stock as before)
|
||||||
|
|
||||||
|
### Meal plan
|
||||||
|
|
||||||
|
- Fixed that the meal plan did initially not display the current week when the settings `MEAL_PLAN_FIRST_DAY_OF_WEEK` and `CALENDAR_FIRST_DAY_OF_WEEK` were set to different values
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
- Fixed performance issues on the endpoint `/stock/products/{productId}`
|
13
changelog/72_4.0.2_2023-08-19.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
### Stock
|
||||||
|
|
||||||
|
- The stock report "Spendings" now also supports grouping by stores
|
||||||
|
- Fixed that the upgrade failed when having (a lot of) redundant ("each to each") default quantity unit conversion definitions (thanks a lot @alkuzman and @esclear)
|
||||||
|
- More on that by a practical example: When a conversion between Teaspoons and Milliliters and another one between Milliliters and Liters exists (and so forth; unlimited levels), Grocy can now (since v4.0.0) calculate the derived factor to convert Teaspoons to Liters on its own (before a direct conversion definition between Teaspoons and Liters was required)
|
||||||
|
- So you might have a lot of such "each to each absolute conversion definitions" currently, when you were affected by failed upgrades (timeout problems due to that resolving indirect conversion factors took very long)
|
||||||
|
- **Heads up:** This is now fixed, but you should clean up those redundant "each to each" definitions (in the example above the conversion between Teaspoons and Liters), since they are no longer needed
|
||||||
|
- Fixed that the "Mark this stock entry as open"-button on the stock entries page opened always one unit instead of the whole stock entry
|
||||||
|
- Fixed that edited stock entries were not considered in some cases (affecting the product's average price and the stock reports)
|
||||||
|
|
||||||
|
### Recipes
|
||||||
|
|
||||||
|
- Fixed that ingredient cost/energy values were wrong when unit conversions but _no_ product substitutions were involved
|
57
changelog/__TEMPLATE.md
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
> ⚠️ xxxBREAKING CHANGESxxx
|
||||||
|
|
||||||
|
> ❗ xxxImportant upgrade informationXXX
|
||||||
|
|
||||||
|
> 💡 xxxMinor upgrade informationXXX
|
||||||
|
|
||||||
|
### New feature: xxxx
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Stock
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Shopping list
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Recipes
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Meal plan
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Chores
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Calendar
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Tasks
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Batteries
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Equipment
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### Userfields
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### General
|
||||||
|
|
||||||
|
- xxx
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
- xxx
|
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.0",
|
"php": ">=8.1",
|
||||||
"slim/slim": "^4.0",
|
"slim/slim": "^4.0",
|
||||||
"slim/psr7": "^1.0",
|
"slim/psr7": "^1.0",
|
||||||
"slim/http": "^1.0",
|
"slim/http": "^1.0",
|
||||||
"php-di/php-di": "^6.0",
|
"php-di/php-di": "^7.0.3",
|
||||||
"berrnd/slim-blade-view": "^1.0.0",
|
"berrnd/slim-blade-view": "^1.0.0",
|
||||||
"morris/lessql": "^1.0",
|
"morris/lessql": "dev-php82",
|
||||||
"gettext/gettext": "^4.8",
|
"gettext/gettext": "^4.8.10",
|
||||||
"eluceo/ical": "^2.2.0",
|
"eluceo/ical": "^2.2.0",
|
||||||
"erusev/parsedown": "^1.7",
|
"erusev/parsedown": "^1.7",
|
||||||
"gumlet/php-image-resize": "^2.0",
|
"gumlet/php-image-resize": "^2.0",
|
||||||
@@ -16,6 +16,12 @@
|
|||||||
"guzzlehttp/guzzle": "^7.0",
|
"guzzlehttp/guzzle": "^7.0",
|
||||||
"mike42/escpos-php": "^3.0"
|
"mike42/escpos-php": "^3.0"
|
||||||
},
|
},
|
||||||
|
"repositories": [
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://github.com/berrnd/lessql"
|
||||||
|
}
|
||||||
|
],
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Grocy\\Services\\": "services/",
|
"Grocy\\Services\\": "services/",
|
||||||
@@ -28,6 +34,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"platform-check": false
|
"vendor-dir": "packages",
|
||||||
|
"platform-check": false,
|
||||||
|
"optimize-autoloader": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1716
composer.lock
generated
223
config-dist.php
@@ -1,28 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Settings can also be overwritten in two ways
|
// Settings can also be overwritten in two ways:
|
||||||
//
|
//
|
||||||
// First priority
|
// First priority:
|
||||||
// A .txt file with the same name as the setting in /data/settingoverrides
|
// A .txt file with the same name as the setting in /data/settingoverrides
|
||||||
// the content of the file is used as the setting value
|
// the content of the file is used as the setting value
|
||||||
//
|
//
|
||||||
// Second priority
|
// Second priority:
|
||||||
// An environment variable with the same name as the setting and prefix "GROCY_"
|
// An environment variable with the same name as the setting and prefix "GROCY_"
|
||||||
// so for example "GROCY_BASE_URL"
|
// so for example "GROCY_BASE_URL"
|
||||||
//
|
//
|
||||||
// Third priority
|
// Third priority:
|
||||||
// The settings defined here below
|
// The settings defined here below
|
||||||
|
|
||||||
// Either "production", "dev", "demo" or "prerelease"
|
// Either "production", "dev", "demo" or "prerelease"
|
||||||
// When not "production", authentication will be disabled and
|
// When not "production", the application will work in a demo mode which means
|
||||||
// demo data will be populated during database migrations
|
// authentication is disabled and some demo data will be generated during the database schema migration
|
||||||
|
// (pass the query parameter "nodemodata", e.g. https://grocy.example.com/?nodemodata to skip that)
|
||||||
Setting('MODE', 'production');
|
Setting('MODE', 'production');
|
||||||
|
|
||||||
// Either "en" or "de" or the directory name of
|
// The directory name of one of the available localization folders
|
||||||
// one of the other available localization folders in the "/localization" directory
|
// in the "/localization" directory (e.g. "en" or "de")
|
||||||
Setting('DEFAULT_LOCALE', 'en');
|
Setting('DEFAULT_LOCALE', 'en');
|
||||||
|
|
||||||
// This is used to define the first day of a week for calendar views in the frontend,
|
// This is used to define the first day of a week for calendar views,
|
||||||
// leave empty to use the locale default
|
// leave empty to use the locale default
|
||||||
// Needs to be a number where Sunday = 0, Monday = 1 and so forth
|
// Needs to be a number where Sunday = 0, Monday = 1 and so forth
|
||||||
Setting('CALENDAR_FIRST_DAY_OF_WEEK', '');
|
Setting('CALENDAR_FIRST_DAY_OF_WEEK', '');
|
||||||
@@ -30,14 +31,24 @@ 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);
|
Setting('CALENDAR_SHOW_WEEK_OF_YEAR', true);
|
||||||
|
|
||||||
// To keep it simple: grocy does not handle any currency conversions,
|
// Set this if you want to have a different start day for the weekly meal plan view,
|
||||||
|
// leave empty to use CALENDAR_FIRST_DAY_OF_WEEK (see above)
|
||||||
|
// Needs to be a number where Sunday = 0, Monday = 1 and so forth
|
||||||
|
// Can also be set to -1 to dynamically start the meal plan week on "today"
|
||||||
|
Setting('MEAL_PLAN_FIRST_DAY_OF_WEEK', '');
|
||||||
|
|
||||||
|
// To keep it simple: Grocy does not handle any currency conversions,
|
||||||
// this here is used to format all money values,
|
// this here is used to format all money values,
|
||||||
// so doesn't really matter, but should be the
|
// so doesn't really matter, but needs to be the
|
||||||
// ISO 4217 code of the currency ("USD", "EUR", "GBP", etc.)
|
// ISO 4217 code of the currency ("USD", "EUR", "GBP", etc.)
|
||||||
Setting('CURRENCY', 'USD');
|
Setting('CURRENCY', 'USD');
|
||||||
|
|
||||||
// When running grocy in a subdirectory, this should be set to the relative path, otherwise empty
|
// Your preferred unit for energy
|
||||||
// It needs to be set to the part (of the URL) after the document root,
|
// E.g. "kcal" or "kJ" or something else (doesn't really matter, it's only used to display energy values)
|
||||||
|
Setting('ENERGY_UNIT', 'kcal');
|
||||||
|
|
||||||
|
// When running Grocy in a subdirectory, this should be set to the relative path, otherwise empty
|
||||||
|
// It needs to be set to the part (of the URL) AFTER the document root,
|
||||||
// if URL rewriting is disabled, including index.php
|
// if URL rewriting is disabled, including index.php
|
||||||
// Example with URL Rewriting support:
|
// Example with URL Rewriting support:
|
||||||
// Root URL = https://example.com/grocy
|
// Root URL = https://example.com/grocy
|
||||||
@@ -53,15 +64,15 @@ Setting('BASE_PATH', '');
|
|||||||
Setting('BASE_URL', '/');
|
Setting('BASE_URL', '/');
|
||||||
|
|
||||||
// The plugin to use for external barcode lookups,
|
// The plugin to use for external barcode lookups,
|
||||||
// must be the filename without .php extension and must be located in /data/plugins,
|
// must be the filename (folder /data/plugins) without the .php extension,
|
||||||
// see /data/plugins/DemoBarcodeLookupPlugin.php for an example implementation
|
// see /data/plugins/DemoBarcodeLookupPlugin.php for an example implementation
|
||||||
Setting('STOCK_BARCODE_LOOKUP_PLUGIN', 'DemoBarcodeLookupPlugin');
|
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);
|
Setting('DISABLE_URL_REWRITING', false);
|
||||||
|
|
||||||
// Specify an custom homepage if desired - by default the homepage will be set to the stock overview page,
|
// 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:
|
// This needs to be one of the following values:
|
||||||
// stock, shoppinglist, recipes, chores, tasks, batteries, equipment, calendar, mealplan
|
// stock, shoppinglist, recipes, chores, tasks, batteries, equipment, calendar, mealplan
|
||||||
Setting('ENTRY_PAGE', 'stock');
|
Setting('ENTRY_PAGE', 'stock');
|
||||||
|
|
||||||
@@ -73,11 +84,11 @@ Setting('DISABLE_AUTH', false);
|
|||||||
// or any class that implements Grocy\Middleware\AuthMiddleware
|
// or any class that implements Grocy\Middleware\AuthMiddleware
|
||||||
Setting('AUTH_CLASS', 'Grocy\Middleware\DefaultAuthMiddleware');
|
Setting('AUTH_CLASS', 'Grocy\Middleware\DefaultAuthMiddleware');
|
||||||
|
|
||||||
// When using ReverseProxyAuthMiddleware,
|
// Options 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'); // 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');
|
Setting('REVERSE_PROXY_AUTH_USE_ENV', false); // Set to true if the username is passed as environment variable
|
||||||
|
|
||||||
// LDAP options when using LdapAuthMiddleware
|
// Options when using LdapAuthMiddleware
|
||||||
Setting('LDAP_ADDRESS', ''); // Example value "ldap://vm-dc2019.local.berrnd.net"
|
Setting('LDAP_ADDRESS', ''); // Example value "ldap://vm-dc2019.local.berrnd.net"
|
||||||
Setting('LDAP_BASE_DN', ''); // Example value "DC=local,DC=berrnd,DC=net"
|
Setting('LDAP_BASE_DN', ''); // Example value "DC=local,DC=berrnd,DC=net"
|
||||||
Setting('LDAP_BIND_DN', ''); // Example value "CN=grocy_bind_account,OU=service_accounts,DC=local,DC=berrnd,DC=net"
|
Setting('LDAP_BIND_DN', ''); // Example value "CN=grocy_bind_account,OU=service_accounts,DC=local,DC=berrnd,DC=net"
|
||||||
@@ -85,116 +96,37 @@ Setting('LDAP_BIND_PW', ''); // Password for the above account
|
|||||||
Setting('LDAP_USER_FILTER', ''); // Example value "(OU=grocy_users)"
|
Setting('LDAP_USER_FILTER', ''); // Example value "(OU=grocy_users)"
|
||||||
Setting('LDAP_UID_ATTR', ''); // Windows AD: "sAMAccountName", OpenLDAP: "uid", GLAuth: "cn"
|
Setting('LDAP_UID_ATTR', ''); // Windows AD: "sAMAccountName", OpenLDAP: "uid", GLAuth: "cn"
|
||||||
|
|
||||||
// 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
|
|
||||||
Setting('MEAL_PLAN_FIRST_DAY_OF_WEEK', '');
|
|
||||||
|
|
||||||
// Default permissions for new users
|
// Default permissions for new users
|
||||||
// the array needs to contain the technical/constant names
|
// the array needs to contain the technical/constant names
|
||||||
// see the file controllers/Users/User.php for possible values
|
// See the file controllers/Users/User.php for possible values
|
||||||
Setting('DEFAULT_PERMISSIONS', ['ADMIN']);
|
Setting('DEFAULT_PERMISSIONS', ['ADMIN']);
|
||||||
|
|
||||||
// 1D (=> Code128) or 2D (=> DataMatrix)
|
// "1D" (=> Code128) or "2D" (=> DataMatrix)
|
||||||
Setting('GROCYCODE_TYPE', '1D');
|
Setting('GROCYCODE_TYPE', '1D');
|
||||||
|
|
||||||
|
|
||||||
// Label printer settings
|
// Label printer settings
|
||||||
// This is the URI that grocy will POST to when asked to print a label
|
Setting('LABEL_PRINTER_WEBHOOK', ''); // The URI that Grocy will POST to when asked to print a label
|
||||||
Setting('LABEL_PRINTER_WEBHOOK', '');
|
Setting('LABEL_PRINTER_RUN_SERVER', true); // Whether the webhook will be called server- or client-side
|
||||||
// This setting decides whether the webhook will be called server- or clientside
|
Setting('LABEL_PRINTER_PARAMS', ['font_family' => 'Source Sans Pro (Regular)']); // Additional parameters supplied to the webhook
|
||||||
// If the machine grocy runs on has a network connection to the host the webhook receiver is on, this is probably a good idea
|
Setting('LABEL_PRINTER_HOOK_JSON', false); // TRUE to use JSON or FALSE to use normal POST request variables
|
||||||
// If, for example, grocy runs in the cloud and your printer daemon runs locally to you, set this to false to let your browser call the webhook instead
|
|
||||||
Setting('LABEL_PRINTER_RUN_SERVER', true);
|
|
||||||
// Additional parameters supplied to the webhook
|
|
||||||
Setting('LABEL_PRINTER_PARAMS', ['font_family' => 'Source Sans Pro (Regular)']);
|
|
||||||
// TRUE to use JSON or FALSE to use normal POST request variables
|
|
||||||
Setting('LABEL_PRINTER_HOOK_JSON', false);
|
|
||||||
|
|
||||||
// Thermal printer options
|
// Thermal printer options
|
||||||
// Thermal printers are receipt printers, not regular printers,
|
// Thermal printers are receipt printers, not regular printers,
|
||||||
// the printer must support the ESC/POS protocol, see https://github.com/mike42/escpos-php
|
// the printer must support the ESC/POS protocol, see https://github.com/mike42/escpos-php
|
||||||
Setting('TPRINTER_IS_NETWORK_PRINTER', false); // Set to true if it's' a network printer
|
Setting('TPRINTER_IS_NETWORK_PRINTER', false); // Set to true if it's a network printer
|
||||||
Setting('TPRINTER_PRINT_QUANTITY_NAME', true); // Set to false if you do not want to print the quantity names (related to the shopping list)
|
Setting('TPRINTER_PRINT_QUANTITY_NAME', true); // Set to false if you do not want to print the quantity names (related to the shopping list)
|
||||||
Setting('TPRINTER_PRINT_NOTES', true); // Set to false if you do not want to print notes (related to the shopping list)
|
Setting('TPRINTER_PRINT_NOTES', true); // Set to false if you do not want to print notes (related to the shopping list)
|
||||||
Setting('TPRINTER_IP', '127.0.0.1'); // IP of the network printer (does only matter if it's a network printer)
|
Setting('TPRINTER_IP', '127.0.0.1'); // IP of the network printer (does only matter if it's a network printer)
|
||||||
Setting('TPRINTER_PORT', 9100); // Port of the network printer
|
Setting('TPRINTER_PORT', 9100); // Port of the network printer (does only matter if it's a network printer)
|
||||||
Setting('TPRINTER_CONNECTOR', '/dev/usb/lp0'); // Printer device (does only matter if you use a locally attached printer)
|
Setting('TPRINTER_CONNECTOR', '/dev/usb/lp0'); // Printer device (does only matter if you use a locally attached printer)
|
||||||
// For USB on Linux this is often '/dev/usb/lp0', for serial printers it could be similar to '/dev/ttyS0'
|
// For USB on Linux this is often '/dev/usb/lp0', for serial printers it could be similar to '/dev/ttyS0'
|
||||||
// Make sure that the user that runs the webserver has permissions to write to the printer - on Linux add your webserver user to the LP group with usermod -a -G lp www-data
|
// Make sure that the user that runs the webserver has permissions to write to the printer - on Linux add your webserver user to the LP group with usermod -a -G lp www-data
|
||||||
|
|
||||||
|
|
||||||
// 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
|
|
||||||
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_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
|
|
||||||
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
|
|
||||||
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_decimal_places_amounts', 4); // Default decimal places allowed for amounts
|
|
||||||
DefaultUserSetting('stock_decimal_places_prices', 2); // Default decimal places allowed for prices
|
|
||||||
DefaultUserSetting('stock_auto_decimal_separator_prices', false);
|
|
||||||
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); // Whether 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 due days" set
|
|
||||||
DefaultUserSetting('shopping_list_show_calendar', false);
|
|
||||||
|
|
||||||
// Recipe settings
|
|
||||||
DefaultUserSetting('recipe_ingredients_group_by_product_group', false); // Group recipe ingredients by their product group
|
|
||||||
|
|
||||||
// Chores settings
|
|
||||||
DefaultUserSetting('chores_due_soon_days', 5);
|
|
||||||
|
|
||||||
// Batteries settings
|
|
||||||
DefaultUserSetting('batteries_due_soon_days', 5);
|
|
||||||
|
|
||||||
// Tasks settings
|
|
||||||
DefaultUserSetting('tasks_due_soon_days', 5);
|
|
||||||
|
|
||||||
// If the page should be automatically reloaded when there was an external change
|
|
||||||
DefaultUserSetting('auto_reload_on_db_change', false);
|
|
||||||
|
|
||||||
// Show a clock in the header next to the logo or not
|
|
||||||
DefaultUserSetting('show_clock_in_header', false);
|
|
||||||
|
|
||||||
// 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
|
// Feature flags
|
||||||
// grocy was initially about "stock management for your household", many other things
|
// Here you can disable the parts which you don't need to have a less cluttered UI
|
||||||
// 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)
|
// (set the setting to "false" to disable the corresponding part, which should be self explanatory)
|
||||||
Setting('FEATURE_FLAG_STOCK', true);
|
Setting('FEATURE_FLAG_STOCK', true);
|
||||||
Setting('FEATURE_FLAG_SHOPPINGLIST', true);
|
Setting('FEATURE_FLAG_SHOPPINGLIST', true);
|
||||||
@@ -214,9 +146,78 @@ Setting('FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING', true);
|
|||||||
Setting('FEATURE_FLAG_STOCK_PRODUCT_FREEZING', true);
|
Setting('FEATURE_FLAG_STOCK_PRODUCT_FREEZING', true);
|
||||||
Setting('FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD', true); // Activate the number pad in due date fields on (supported) mobile browsers
|
Setting('FEATURE_FLAG_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_SHOPPINGLIST_MULTIPLE_LISTS', true);
|
||||||
|
Setting('FEATURE_FLAG_RECIPES_MEALPLAN', true);
|
||||||
Setting('FEATURE_FLAG_CHORES_ASSIGNMENTS', true);
|
Setting('FEATURE_FLAG_CHORES_ASSIGNMENTS', true);
|
||||||
Setting('FEATURE_FLAG_THERMAL_PRINTER', false);
|
Setting('FEATURE_FLAG_THERMAL_PRINTER', false);
|
||||||
|
|
||||||
// Feature settings
|
// 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_DISABLE_BROWSER_BARCODE_CAMERA_SCANNING', false); // Set this to true if you want to disable the ability to scan a barcode via the device camera (Browser API)
|
||||||
Setting('FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA', true); // Enables the torch automatically (if the device has one)
|
Setting('FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA', true); // Enables the torch automatically (if the device has one)
|
||||||
|
|
||||||
|
|
||||||
|
// Default user settings
|
||||||
|
// These settings can be changed per user and via the UI,
|
||||||
|
// below are the defaults which are used when the user has not changed the setting so far
|
||||||
|
|
||||||
|
// Night mode related
|
||||||
|
DefaultUserSetting('night_mode', 'follow-system'); // "on" = Night mode is always on ; "off" = Night mode is always off / "follow-system" = System preferred color schema is used
|
||||||
|
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_goes_over_midnight', true); // If the time range above goes over midnight
|
||||||
|
DefaultUserSetting('night_mode_enabled_internal', false); // Internal setting if night mode is actually enabled (based on the other settings)
|
||||||
|
|
||||||
|
// Generic settings
|
||||||
|
DefaultUserSetting('auto_reload_on_db_change', false); // If the page should be automatically reloaded when there was an external change
|
||||||
|
DefaultUserSetting('show_clock_in_header', false); // Show a clock in the header next to the logo or not
|
||||||
|
DefaultUserSetting('keep_screen_on', false); // If the screen should always be kept on
|
||||||
|
DefaultUserSetting('keep_screen_on_when_fullscreen_card', false); // If the screen should be kept on when a "fullscreen-card" is displayed
|
||||||
|
|
||||||
|
// 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('product_presets_default_due_days', 0); // Default due days for new products (-1 means that the product will be never overdue)
|
||||||
|
DefaultUserSetting('product_presets_treat_opened_as_out_of_stock', true); // Default "Treat opened as out of stock" option for new products
|
||||||
|
DefaultUserSetting('stock_decimal_places_amounts', 4); // Default decimal places allowed for amounts
|
||||||
|
DefaultUserSetting('stock_decimal_places_prices_input', 2); // Default decimal places allowed for prices (input)
|
||||||
|
DefaultUserSetting('stock_decimal_places_prices_display', 2); // Default decimal places allowed for prices (display)
|
||||||
|
DefaultUserSetting('stock_auto_decimal_separator_prices', false); // If the decimal separator should be set automatically for amount inputs
|
||||||
|
DefaultUserSetting('stock_due_soon_days', 5); // The "expiring soon" days
|
||||||
|
DefaultUserSetting('stock_default_purchase_amount', 0); // The default amount prefilled on the purchase page
|
||||||
|
DefaultUserSetting('stock_default_consume_amount', 1); // The default amount prefilled on the consume page
|
||||||
|
DefaultUserSetting('stock_default_consume_amount_use_quick_consume_amount', false); // If the products quick consume amount should be prefilled on the consume page
|
||||||
|
DefaultUserSetting('scan_mode_consume_enabled', false); // If scan mode on the consume page is enabled
|
||||||
|
DefaultUserSetting('scan_mode_purchase_enabled', false); // If scan mode on the purchase page is enabled
|
||||||
|
DefaultUserSetting('show_icon_on_stock_overview_page_when_product_is_on_shopping_list', true); // When enabled, an icon is shown on the stock overview page (next to the product name) when the prodcut is currently on a shopping list
|
||||||
|
DefaultUserSetting('show_purchased_date_on_purchase', false); // Whether 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 due days" set
|
||||||
|
DefaultUserSetting('shopping_list_show_calendar', false); // When enabled, a small (month view) calendar will be shown on the shopping list page
|
||||||
|
DefaultUserSetting('shopping_list_auto_add_below_min_stock_amount', false); // If products should be automatically added to the shopping list when they are below their min. stock amount
|
||||||
|
DefaultUserSetting('shopping_list_auto_add_below_min_stock_amount_list_id', 1); // When the above setting is enabled, the id of the shopping list to which the products will be added
|
||||||
|
|
||||||
|
// Recipe settings
|
||||||
|
DefaultUserSetting('recipe_ingredients_group_by_product_group', false); // Group recipe ingredients by their product group
|
||||||
|
DefaultUserSetting('recipes_show_list_side_by_side', true); // If the recipe should be displayed next to recipe list on the recipes page
|
||||||
|
DefaultUserSetting('recipes_show_ingredient_checkbox', false); // When enabled, a little checkbox will be shown next to each ingredient to mark it as done
|
||||||
|
|
||||||
|
// Chores settings
|
||||||
|
DefaultUserSetting('chores_due_soon_days', 5); // The "due soon" days
|
||||||
|
|
||||||
|
// Batteries settings
|
||||||
|
DefaultUserSetting('batteries_due_soon_days', 5); // The "due soon" days
|
||||||
|
|
||||||
|
// Tasks settings
|
||||||
|
DefaultUserSetting('tasks_due_soon_days', 5); // The "due soon" days
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
@@ -3,18 +3,17 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use LessQL\Result;
|
use LessQL\Result;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
|
||||||
class BaseApiController extends BaseController
|
class BaseApiController extends BaseController
|
||||||
{
|
{
|
||||||
const PATTERN_FIELD = '[A-Za-z_][A-Za-z0-9_]+';
|
const PATTERN_FIELD = '[A-Za-z_][A-Za-z0-9_]+';
|
||||||
|
const PATTERN_OPERATOR = '!?((>=)|(<=)|=|~|<|>|(§))';
|
||||||
const PATTERN_OPERATOR = '!?(=|~|<|>|(>=)|(<=)|(§))';
|
const PATTERN_VALUE = '[A-Za-z\p{L}\p{M}0-9*_.$#^| -\\\]+';
|
||||||
|
|
||||||
const PATTERN_VALUE = '[A-Za-z\x{0400}-\x{04FF}_0-9.$#^|-]+';
|
|
||||||
|
|
||||||
protected $OpenApiSpec = null;
|
protected $OpenApiSpec = null;
|
||||||
|
|
||||||
protected function ApiResponse(\Psr\Http\Message\ResponseInterface $response, $data, $cache = false)
|
protected function ApiResponse(Response $response, $data, $cache = false)
|
||||||
{
|
{
|
||||||
if ($cache)
|
if ($cache)
|
||||||
{
|
{
|
||||||
@@ -25,19 +24,19 @@ class BaseApiController extends BaseController
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function EmptyApiResponse(\Psr\Http\Message\ResponseInterface $response, $status = 204)
|
protected function EmptyApiResponse(Response $response, $status = 204)
|
||||||
{
|
{
|
||||||
return $response->withStatus($status);
|
return $response->withStatus($status);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function GenericErrorResponse(\Psr\Http\Message\ResponseInterface $response, $errorMessage, $status = 400)
|
protected function GenericErrorResponse(Response $response, $errorMessage, $status = 400)
|
||||||
{
|
{
|
||||||
return $response->withStatus($status)->withJson([
|
return $response->withStatus($status)->withJson([
|
||||||
'error_message' => $errorMessage
|
'error_message' => $errorMessage
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function FilteredApiResponse(\Psr\Http\Message\ResponseInterface $response, Result $data, array $query)
|
public function FilteredApiResponse(Response $response, Result $data, array $query)
|
||||||
{
|
{
|
||||||
$data = $this->queryData($data, $query);
|
$data = $this->queryData($data, $query);
|
||||||
return $this->ApiResponse($response, $data);
|
return $this->ApiResponse($response, $data);
|
||||||
@@ -50,8 +49,13 @@ class BaseApiController extends BaseController
|
|||||||
$data = $this->filter($data, $query['query']);
|
$data = $this->filter($data, $query['query']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($query['limit']))
|
if (isset($query['limit']) || isset($query['offset']))
|
||||||
{
|
{
|
||||||
|
if (!isset($query['limit']))
|
||||||
|
{
|
||||||
|
$query['limit'] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
$data = $data->limit(intval($query['limit']), intval($query['offset'] ?? 0));
|
$data = $data->limit(intval($query['limit']), intval($query['offset'] ?? 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +105,8 @@ class BaseApiController extends BaseController
|
|||||||
$sqlOrNull = ' OR ' . $matches['field'] . ' IS NULL';
|
$sqlOrNull = ' OR ' . $matches['field'] . ' IS NULL';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($matches['op']) {
|
switch ($matches['op'])
|
||||||
|
{
|
||||||
case '=':
|
case '=':
|
||||||
$data = $data->where($matches['field'] . ' = ?' . $sqlOrNull, $matches['value']);
|
$data = $data->where($matches['field'] . ' = ?' . $sqlOrNull, $matches['value']);
|
||||||
break;
|
break;
|
||||||
@@ -129,7 +134,6 @@ class BaseApiController extends BaseController
|
|||||||
case '§':
|
case '§':
|
||||||
$data = $data->where($matches['field'] . ' REGEXP ?', $matches['value']);
|
$data = $data->where($matches['field'] . ' REGEXP ?', $matches['value']);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,16 +18,18 @@ use Grocy\Services\StockService;
|
|||||||
use Grocy\Services\TasksService;
|
use Grocy\Services\TasksService;
|
||||||
use Grocy\Services\UserfieldsService;
|
use Grocy\Services\UserfieldsService;
|
||||||
use Grocy\Services\UsersService;
|
use Grocy\Services\UsersService;
|
||||||
|
use DI\Container;
|
||||||
|
|
||||||
class BaseController
|
class BaseController
|
||||||
{
|
{
|
||||||
public function __construct(\DI\Container $container)
|
public function __construct(Container $container)
|
||||||
{
|
{
|
||||||
$this->AppContainer = $container;
|
$this->AppContainer = $container;
|
||||||
$this->View = $container->get('view');
|
$this->View = $container->get('view');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected $AppContainer;
|
protected $AppContainer;
|
||||||
|
private $View;
|
||||||
|
|
||||||
protected function getApiKeyService()
|
protected function getApiKeyService()
|
||||||
{
|
{
|
||||||
@@ -114,22 +116,24 @@ class BaseController
|
|||||||
return UsersService::getInstance();
|
return UsersService::getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function render($response, $page, $data = [])
|
protected function render($response, $viewName, $data = [])
|
||||||
{
|
{
|
||||||
$container = $this->AppContainer;
|
$container = $this->AppContainer;
|
||||||
|
|
||||||
$versionInfo = $this->getApplicationService()->GetInstalledVersion();
|
$versionInfo = $this->getApplicationService()->GetInstalledVersion();
|
||||||
$this->View->set('version', $versionInfo->Version);
|
$this->View->set('version', $versionInfo->Version);
|
||||||
$this->View->set('releaseDate', $versionInfo->ReleaseDate);
|
|
||||||
|
|
||||||
$localizationService = $this->getLocalizationService();
|
$localizationService = $this->getLocalizationService();
|
||||||
$this->View->set('__t', function (string $text, ...$placeholderValues) use ($localizationService) {
|
$this->View->set('__t', function (string $text, ...$placeholderValues) use ($localizationService)
|
||||||
|
{
|
||||||
return $localizationService->__t($text, $placeholderValues);
|
return $localizationService->__t($text, $placeholderValues);
|
||||||
});
|
});
|
||||||
$this->View->set('__n', function ($number, $singularForm, $pluralForm) use ($localizationService) {
|
$this->View->set('__n', function ($number, $singularForm, $pluralForm, $isQu = false) use ($localizationService)
|
||||||
return $localizationService->__n($number, $singularForm, $pluralForm);
|
{
|
||||||
|
return $localizationService->__n($number, $singularForm, $pluralForm, $isQu);
|
||||||
});
|
});
|
||||||
$this->View->set('LocalizationStrings', $localizationService->GetPoAsJsonString());
|
$this->View->set('LocalizationStrings', $localizationService->GetPoAsJsonString());
|
||||||
|
$this->View->set('LocalizationStringsQu', $localizationService->GetPoAsJsonStringQu());
|
||||||
|
|
||||||
// TODO: Better handle this generically based on the current language (header in .po file?)
|
// TODO: Better handle this generically based on the current language (header in .po file?)
|
||||||
$dir = 'ltr';
|
$dir = 'ltr';
|
||||||
@@ -139,7 +143,8 @@ class BaseController
|
|||||||
}
|
}
|
||||||
$this->View->set('dir', $dir);
|
$this->View->set('dir', $dir);
|
||||||
|
|
||||||
$this->View->set('U', function ($relativePath, $isResource = false) use ($container) {
|
$this->View->set('U', function ($relativePath, $isResource = false) use ($container)
|
||||||
|
{
|
||||||
return $container->get('UrlManager')->ConstructUrl($relativePath, $isResource);
|
return $container->get('UrlManager')->ConstructUrl($relativePath, $isResource);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -158,13 +163,13 @@ class BaseController
|
|||||||
unset($constants[$constant]);
|
unset($constants[$constant]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->View->set('featureFlags', $constants);
|
$this->View->set('featureFlags', $constants);
|
||||||
|
|
||||||
if (GROCY_AUTHENTICATED)
|
if (GROCY_AUTHENTICATED)
|
||||||
{
|
{
|
||||||
$this->View->set('permissions', User::PermissionList());
|
$this->View->set('permissions', User::PermissionList());
|
||||||
|
|
||||||
$decimalPlacesAmounts = intval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_decimal_places_amounts'));
|
$decimalPlacesAmounts = $this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_decimal_places_amounts');
|
||||||
if ($decimalPlacesAmounts <= 0)
|
if ($decimalPlacesAmounts <= 0)
|
||||||
{
|
{
|
||||||
$defaultMinAmount = 1;
|
$defaultMinAmount = 1;
|
||||||
@@ -176,10 +181,12 @@ class BaseController
|
|||||||
$this->View->set('DEFAULT_MIN_AMOUNT', $defaultMinAmount);
|
$this->View->set('DEFAULT_MIN_AMOUNT', $defaultMinAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->View->render($response, $page, $data);
|
$this->View->set('viewName', $viewName);
|
||||||
|
|
||||||
|
return $this->View->render($response, $viewName, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderPage($response, $page, $data = [])
|
protected function renderPage($response, $viewName, $data = [])
|
||||||
{
|
{
|
||||||
$this->View->set('userentitiesForSidebar', $this->getDatabase()->userentities()->where('show_in_sidebar_menu = 1')->orderBy('name'));
|
$this->View->set('userentitiesForSidebar', $this->getDatabase()->userentities()->where('show_in_sidebar_menu = 1')->orderBy('name'));
|
||||||
try
|
try
|
||||||
@@ -199,7 +206,7 @@ class BaseController
|
|||||||
// Happens when database is not initialised or migrated...
|
// Happens when database is not initialised or migrated...
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render($response, $page, $data);
|
return $this->render($response, $viewName, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static $htmlPurifierInstance = null;
|
private static $htmlPurifierInstance = null;
|
||||||
@@ -210,12 +217,13 @@ class BaseController
|
|||||||
{
|
{
|
||||||
$htmlPurifierConfig = \HTMLPurifier_Config::createDefault();
|
$htmlPurifierConfig = \HTMLPurifier_Config::createDefault();
|
||||||
$htmlPurifierConfig->set('Cache.SerializerPath', GROCY_DATAPATH . '/viewcache');
|
$htmlPurifierConfig->set('Cache.SerializerPath', GROCY_DATAPATH . '/viewcache');
|
||||||
$htmlPurifierConfig->set('HTML.Allowed', 'div,b,strong,i,em,u,a[href|title|target],iframe[src|width|height|frameborder],ul,ol,li,p[style],br,span[style],img[width|height|alt|src],table[border|width|style],tbody,tr,td,th,blockquote,*[style|class|id]');
|
$htmlPurifierConfig->set('HTML.Allowed', 'div,b,strong,i,em,u,a[href|title|target],iframe[src|width|height|frameborder],ul,ol,li,p[style],br,span[style],img[style|width|height|alt|src],table[border|width|style],tbody,tr,td,th,blockquote,*[style|class|id],h1,h2,h3,h4,h5,h6');
|
||||||
$htmlPurifierConfig->set('Attr.EnableID', true);
|
$htmlPurifierConfig->set('Attr.EnableID', true);
|
||||||
$htmlPurifierConfig->set('HTML.SafeIframe', true);
|
$htmlPurifierConfig->set('HTML.SafeIframe', true);
|
||||||
$htmlPurifierConfig->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align');
|
$htmlPurifierConfig->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align,width,height');
|
||||||
$htmlPurifierConfig->set('URI.AllowedSchemes', ['data' => true, 'http' => true, 'https' => true]);
|
$htmlPurifierConfig->set('URI.AllowedSchemes', ['data' => true, 'http' => true, 'https' => true]);
|
||||||
$htmlPurifierConfig->set('URI.SafeIframeRegexp', '%^.*%'); // Allow any iframe source
|
$htmlPurifierConfig->set('URI.SafeIframeRegexp', '%^.*%'); // Allow any iframe source
|
||||||
|
$htmlPurifierConfig->set('CSS.MaxImgLength', null);
|
||||||
|
|
||||||
self::$htmlPurifierInstance = new \HTMLPurifier($htmlPurifierConfig);
|
self::$htmlPurifierInstance = new \HTMLPurifier($htmlPurifierConfig);
|
||||||
}
|
}
|
||||||
@@ -228,12 +236,12 @@ class BaseController
|
|||||||
if (!is_bool($value) && !is_array($value))
|
if (!is_bool($value) && !is_array($value))
|
||||||
{
|
{
|
||||||
$value = self::$htmlPurifierInstance->purify($value);
|
$value = self::$htmlPurifierInstance->purify($value);
|
||||||
}
|
|
||||||
|
|
||||||
// Allow some special chars
|
// Allow some special chars
|
||||||
if (!is_array($value))
|
// Maybe also possible through HTMLPurifier config (http://htmlpurifier.org/live/configdoc/plain.html)
|
||||||
{
|
|
||||||
$value = str_replace('&', '&', $value);
|
$value = str_replace('&', '&', $value);
|
||||||
|
$value = str_replace('>', '>', $value);
|
||||||
|
$value = str_replace('<', '<', $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,10 +5,12 @@ namespace Grocy\Controllers;
|
|||||||
use Grocy\Controllers\Users\User;
|
use Grocy\Controllers\Users\User;
|
||||||
use Grocy\Helpers\WebhookRunner;
|
use Grocy\Helpers\WebhookRunner;
|
||||||
use Grocy\Helpers\Grocycode;
|
use Grocy\Helpers\Grocycode;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class BatteriesApiController extends BaseApiController
|
class BatteriesApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function BatteryDetails(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function BatteryDetails(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -20,12 +22,12 @@ class BatteriesApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Current(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->FilteredApiResponse($response, $this->getBatteriesService()->GetCurrent(), $request->getQueryParams());
|
return $this->FilteredApiResponse($response, $this->getBatteriesService()->GetCurrent(), $request->getQueryParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TrackChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function TrackChargeCycle(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_BATTERIES_TRACK_CHARGE_CYCLE);
|
User::checkPermission($request, User::PERMISSION_BATTERIES_TRACK_CHARGE_CYCLE);
|
||||||
|
|
||||||
@@ -48,7 +50,7 @@ class BatteriesApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UndoChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UndoChargeCycle(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_BATTERIES_UNDO_CHARGE_CYCLE);
|
User::checkPermission($request, User::PERMISSION_BATTERIES_UNDO_CHARGE_CYCLE);
|
||||||
|
|
||||||
@@ -63,7 +65,7 @@ class BatteriesApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function BatteryPrintLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function BatteryPrintLabel(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -3,12 +3,14 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Helpers\Grocycode;
|
use Grocy\Helpers\Grocycode;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class BatteriesController extends BaseController
|
class BatteriesController extends BaseController
|
||||||
{
|
{
|
||||||
use GrocycodeTrait;
|
use GrocycodeTrait;
|
||||||
|
|
||||||
public function BatteriesList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function BatteriesList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if (isset($request->getQueryParams()['include_disabled']))
|
if (isset($request->getQueryParams()['include_disabled']))
|
||||||
{
|
{
|
||||||
@@ -26,12 +28,12 @@ class BatteriesController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function BatteriesSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function BatteriesSettings(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'batteriessettings');
|
return $this->renderPage($response, 'batteriessettings');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function BatteryEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function BatteryEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['batteryId'] == 'new')
|
if ($args['batteryId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -50,7 +52,7 @@ class BatteriesController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Journal(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if (isset($request->getQueryParams()['months']) && filter_var($request->getQueryParams()['months'], FILTER_VALIDATE_INT) !== false)
|
if (isset($request->getQueryParams()['months']) && filter_var($request->getQueryParams()['months'], FILTER_VALIDATE_INT) !== false)
|
||||||
{
|
{
|
||||||
@@ -75,28 +77,49 @@ class BatteriesController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Overview(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$usersService = $this->getUsersService();
|
$usersService = $this->getUsersService();
|
||||||
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['batteries_due_soon_days'];
|
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['batteries_due_soon_days'];
|
||||||
|
|
||||||
|
$batteries = $this->getDatabase()->batteries()->where('active = 1');
|
||||||
|
$currentBatteries = $this->getBatteriesService()->GetCurrent();
|
||||||
|
foreach ($currentBatteries as $currentBattery)
|
||||||
|
{
|
||||||
|
if (FindObjectInArrayByPropertyValue($batteries, 'id', $currentBattery->battery_id)->charge_interval_days > 0)
|
||||||
|
{
|
||||||
|
if ($currentBattery->next_estimated_charge_time < date('Y-m-d H:i:s'))
|
||||||
|
{
|
||||||
|
$currentBattery->due_type = 'overdue';
|
||||||
|
}
|
||||||
|
elseif ($currentBattery->next_estimated_charge_time <= date('Y-m-d 23:59:59'))
|
||||||
|
{
|
||||||
|
$currentBattery->due_type = 'duetoday';
|
||||||
|
}
|
||||||
|
elseif ($nextXDays > 0 && $currentBattery->next_estimated_charge_time <= date('Y-m-d H:i:s', strtotime('+' . $nextXDays . ' days')))
|
||||||
|
{
|
||||||
|
$currentBattery->due_type = 'duesoon';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->renderPage($response, 'batteriesoverview', [
|
return $this->renderPage($response, 'batteriesoverview', [
|
||||||
'batteries' => $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'batteries' => $batteries,
|
||||||
'current' => $this->getBatteriesService()->GetCurrent(),
|
'current' => $currentBatteries,
|
||||||
'nextXDays' => $nextXDays,
|
'nextXDays' => $nextXDays,
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('batteries'),
|
'userfields' => $this->getUserfieldsService()->GetFields('batteries'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('batteries')
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('batteries')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TrackChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function TrackChargeCycle(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'batterytracking', [
|
return $this->renderPage($response, 'batterytracking', [
|
||||||
'batteries' => $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE')
|
'batteries' => $this->getDatabase()->batteries()->where('active = 1')->orderBy('name', 'COLLATE NOCASE')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function BatteryGrocycodeImage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function BatteryGrocycodeImage(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$gc = new Grocycode(Grocycode::BATTERY, $args['batteryId']);
|
$gc = new Grocycode(Grocycode::BATTERY, $args['batteryId']);
|
||||||
return $this->ServeGrocycodeImage($request, $response, $gc);
|
return $this->ServeGrocycodeImage($request, $response, $gc);
|
||||||
|
@@ -2,25 +2,38 @@
|
|||||||
|
|
||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
|
use Grocy\Services\ApiKeyService;
|
||||||
use Eluceo\iCal\Domain\Entity\Calendar;
|
use Eluceo\iCal\Domain\Entity\Calendar;
|
||||||
use Eluceo\iCal\Domain\Entity\Event;
|
use Eluceo\iCal\Domain\Entity\Event;
|
||||||
|
use Eluceo\iCal\Domain\Entity\TimeZone;
|
||||||
use Eluceo\iCal\Domain\ValueObject\Date;
|
use Eluceo\iCal\Domain\ValueObject\Date;
|
||||||
use Eluceo\iCal\Domain\ValueObject\DateTime;
|
use Eluceo\iCal\Domain\ValueObject\DateTime;
|
||||||
use Eluceo\iCal\Domain\ValueObject\SingleDay;
|
use Eluceo\iCal\Domain\ValueObject\SingleDay;
|
||||||
use Eluceo\iCal\Domain\ValueObject\TimeSpan;
|
use Eluceo\iCal\Domain\ValueObject\TimeSpan;
|
||||||
use Eluceo\iCal\Presentation\Factory\CalendarFactory;
|
use Eluceo\iCal\Presentation\Factory\CalendarFactory;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class CalendarApiController extends BaseApiController
|
class CalendarApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function Ical(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Ical(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$events = $this->getCalendarService()->GetEvents();
|
$events = $this->getCalendarService()->GetEvents();
|
||||||
|
$minDate = null;
|
||||||
|
$maxDate = null;
|
||||||
|
|
||||||
$vCalendar = new Calendar();
|
$vCalendar = new Calendar();
|
||||||
|
$vCalendar->setProductIdentifier('Grocy');
|
||||||
|
|
||||||
foreach ($events as $event)
|
foreach ($events as $event)
|
||||||
{
|
{
|
||||||
|
if (!isset($event['start']) || empty($event['start']))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$description = '';
|
$description = '';
|
||||||
if (isset($event['description']))
|
if (isset($event['description']))
|
||||||
{
|
{
|
||||||
@@ -32,13 +45,17 @@ class CalendarApiController extends BaseApiController
|
|||||||
// All-day event
|
// All-day event
|
||||||
$date = new Date(\DateTimeImmutable::createFromFormat('Y-m-d', substr($event['start'], 0, 10)));
|
$date = new Date(\DateTimeImmutable::createFromFormat('Y-m-d', substr($event['start'], 0, 10)));
|
||||||
$vEventOccurrence = new SingleDay($date);
|
$vEventOccurrence = new SingleDay($date);
|
||||||
|
|
||||||
|
$compareDate = \DateTimeImmutable::createFromFormat('Y-m-d', substr($event['start'], 0, 10));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Time-point event
|
// Time-point event
|
||||||
$start = new DateTime(\DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $event['start']), false);
|
$start = new DateTime(\DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $event['start']), true);
|
||||||
$end = new DateTime(\DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $event['start']), false);
|
$end = new DateTime(\DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $event['start']), true);
|
||||||
$vEventOccurrence = new TimeSpan($start, $end);
|
$vEventOccurrence = new TimeSpan($start, $end);
|
||||||
|
|
||||||
|
$compareDate = \DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $event['start']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$vEvent = new Event();
|
$vEvent = new Event();
|
||||||
@@ -47,11 +64,25 @@ class CalendarApiController extends BaseApiController
|
|||||||
->setDescription($description);
|
->setDescription($description);
|
||||||
|
|
||||||
$vCalendar->addEvent($vEvent);
|
$vCalendar->addEvent($vEvent);
|
||||||
|
|
||||||
|
if ($minDate == null || $compareDate < $minDate)
|
||||||
|
{
|
||||||
|
$minDate = $compareDate;
|
||||||
|
}
|
||||||
|
if ($maxDate == null || $compareDate > $maxDate)
|
||||||
|
{
|
||||||
|
$maxDate = $compareDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($minDate != null && $maxDate != null)
|
||||||
|
{
|
||||||
|
$vCalendar->addTimeZone(TimeZone::createFromPhpDateTimeZone(new \DateTimeZone(date_default_timezone_get()), $minDate, $maxDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
$response->write((new CalendarFactory())->createCalendar($vCalendar));
|
$response->write((new CalendarFactory())->createCalendar($vCalendar));
|
||||||
$response = $response->withHeader('Content-Type', 'text/calendar; charset=utf-8');
|
$response = $response->withHeader('Content-Type', 'text/calendar; charset=utf-8');
|
||||||
return $response->withHeader('Content-Disposition', 'attachment; filename="grocy.ics"');
|
return $response->withHeader('Content-Disposition', 'attachment; filename="Grocy.ics"');
|
||||||
}
|
}
|
||||||
catch (\Exception $ex)
|
catch (\Exception $ex)
|
||||||
{
|
{
|
||||||
@@ -59,12 +90,12 @@ class CalendarApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function IcalSharingLink(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function IcalSharingLink(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return $this->ApiResponse($response, [
|
return $this->ApiResponse($response, [
|
||||||
'url' => $this->AppContainer->get('UrlManager')->ConstructUrl('/api/calendar/ical?secret=' . $this->getApiKeyService()->GetOrCreateApiKey(\Grocy\Services\ApiKeyService::API_KEY_TYPE_SPECIAL_PURPOSE_CALENDAR_ICAL))
|
'url' => $this->AppContainer->get('UrlManager')->ConstructUrl('/api/calendar/ical?secret=' . $this->getApiKeyService()->GetOrCreateApiKey(ApiKeyService::API_KEY_TYPE_SPECIAL_PURPOSE_CALENDAR_ICAL))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
catch (\Exception $ex)
|
catch (\Exception $ex)
|
||||||
|
@@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class CalendarController extends BaseController
|
class CalendarController extends BaseController
|
||||||
{
|
{
|
||||||
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Overview(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'calendar', [
|
return $this->renderPage($response, 'calendar', [
|
||||||
'fullcalendarEventSources' => $this->getCalendarService()->GetEvents()
|
'fullcalendarEventSources' => $this->getCalendarService()->GetEvents()
|
||||||
|
@@ -5,10 +5,12 @@ namespace Grocy\Controllers;
|
|||||||
use Grocy\Controllers\Users\User;
|
use Grocy\Controllers\Users\User;
|
||||||
use Grocy\Helpers\WebhookRunner;
|
use Grocy\Helpers\WebhookRunner;
|
||||||
use Grocy\Helpers\Grocycode;
|
use Grocy\Helpers\Grocycode;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class ChoresApiController extends BaseApiController
|
class ChoresApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function CalculateNextExecutionAssignments(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function CalculateNextExecutionAssignments(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -42,7 +44,7 @@ class ChoresApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ChoreDetails(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ChoreDetails(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -54,12 +56,12 @@ class ChoresApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Current(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->FilteredApiResponse($response, $this->getChoresService()->GetCurrent(), $request->getQueryParams());
|
return $this->FilteredApiResponse($response, $this->getChoresService()->GetCurrent(), $request->getQueryParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TrackChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function TrackChoreExecution(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
|
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
|
||||||
|
|
||||||
@@ -73,6 +75,12 @@ class ChoresApiController extends BaseApiController
|
|||||||
$trackedTime = $requestBody['tracked_time'];
|
$trackedTime = $requestBody['tracked_time'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$skipped = false;
|
||||||
|
if (array_key_exists('skipped', $requestBody) && filter_var($requestBody['skipped'], FILTER_VALIDATE_BOOLEAN) !== false)
|
||||||
|
{
|
||||||
|
$skipped = $requestBody['skipped'];
|
||||||
|
}
|
||||||
|
|
||||||
$doneBy = GROCY_USER_ID;
|
$doneBy = GROCY_USER_ID;
|
||||||
if (array_key_exists('done_by', $requestBody) && !empty($requestBody['done_by']))
|
if (array_key_exists('done_by', $requestBody) && !empty($requestBody['done_by']))
|
||||||
{
|
{
|
||||||
@@ -84,7 +92,7 @@ class ChoresApiController extends BaseApiController
|
|||||||
User::checkPermission($request, User::PERMISSION_CHORE_TRACK_EXECUTION);
|
User::checkPermission($request, User::PERMISSION_CHORE_TRACK_EXECUTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
$choreExecutionId = $this->getChoresService()->TrackChore($args['choreId'], $trackedTime, $doneBy);
|
$choreExecutionId = $this->getChoresService()->TrackChore($args['choreId'], $trackedTime, $doneBy, $skipped);
|
||||||
return $this->ApiResponse($response, $this->getDatabase()->chores_log($choreExecutionId));
|
return $this->ApiResponse($response, $this->getDatabase()->chores_log($choreExecutionId));
|
||||||
}
|
}
|
||||||
catch (\Exception $ex)
|
catch (\Exception $ex)
|
||||||
@@ -93,7 +101,7 @@ class ChoresApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UndoChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UndoChoreExecution(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -108,7 +116,7 @@ class ChoresApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ChorePrintLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ChorePrintLabel(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -131,4 +139,24 @@ class ChoresApiController extends BaseApiController
|
|||||||
return $this->GenericErrorResponse($response, $ex->getMessage());
|
return $this->GenericErrorResponse($response, $ex->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function MergeChores(Request $request, Response $response, array $args)
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (filter_var($args['choreIdToKeep'], FILTER_VALIDATE_INT) === false || filter_var($args['choreIdToRemove'], FILTER_VALIDATE_INT) === false)
|
||||||
|
{
|
||||||
|
throw new \Exception('Provided {choreIdToKeep} or {choreIdToRemove} is not a valid integer');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->ApiResponse($response, $this->getChoresService()->MergeChores($args['choreIdToKeep'], $args['choreIdToRemove']));
|
||||||
|
return $this->EmptyApiResponse($response);
|
||||||
|
}
|
||||||
|
catch (\Exception $ex)
|
||||||
|
{
|
||||||
|
return $this->GenericErrorResponse($response, $ex->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,12 +3,14 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Helpers\Grocycode;
|
use Grocy\Helpers\Grocycode;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class ChoresController extends BaseController
|
class ChoresController extends BaseController
|
||||||
{
|
{
|
||||||
use GrocycodeTrait;
|
use GrocycodeTrait;
|
||||||
|
|
||||||
public function ChoreEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ChoreEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$usersService = $this->getUsersService();
|
$usersService = $this->getUsersService();
|
||||||
$users = $usersService->GetUsersAsDto();
|
$users = $usersService->GetUsersAsDto();
|
||||||
@@ -38,7 +40,7 @@ class ChoresController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ChoresList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ChoresList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if (isset($request->getQueryParams()['include_disabled']))
|
if (isset($request->getQueryParams()['include_disabled']))
|
||||||
{
|
{
|
||||||
@@ -56,12 +58,12 @@ class ChoresController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ChoresSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ChoresSettings(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'choressettings');
|
return $this->renderPage($response, 'choressettings');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Journal(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if (isset($request->getQueryParams()['months']) && filter_var($request->getQueryParams()['months'], FILTER_VALIDATE_INT) !== false)
|
if (isset($request->getQueryParams()['months']) && filter_var($request->getQueryParams()['months'], FILTER_VALIDATE_INT) !== false)
|
||||||
{
|
{
|
||||||
@@ -89,14 +91,35 @@ class ChoresController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Overview(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$usersService = $this->getUsersService();
|
$usersService = $this->getUsersService();
|
||||||
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['chores_due_soon_days'];
|
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['chores_due_soon_days'];
|
||||||
|
|
||||||
|
$chores = $this->getDatabase()->chores()->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
$currentChores = $this->getChoresService()->GetCurrent();
|
||||||
|
foreach ($currentChores as $currentChore)
|
||||||
|
{
|
||||||
|
if (!empty($currentChore->next_estimated_execution_time))
|
||||||
|
{
|
||||||
|
if ($currentChore->next_estimated_execution_time < date('Y-m-d H:i:s'))
|
||||||
|
{
|
||||||
|
$currentChore->due_type = 'overdue';
|
||||||
|
}
|
||||||
|
elseif ($currentChore->next_estimated_execution_time <= date('Y-m-d 23:59:59'))
|
||||||
|
{
|
||||||
|
$currentChore->due_type = 'duetoday';
|
||||||
|
}
|
||||||
|
elseif ($nextXDays > 0 && $currentChore->next_estimated_execution_time <= date('Y-m-d H:i:s', strtotime('+' . $nextXDays . ' days')))
|
||||||
|
{
|
||||||
|
$currentChore->due_type = 'duesoon';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->renderPage($response, 'choresoverview', [
|
return $this->renderPage($response, 'choresoverview', [
|
||||||
'chores' => $this->getDatabase()->chores()->orderBy('name', 'COLLATE NOCASE'),
|
'chores' => $chores,
|
||||||
'currentChores' => $this->getChoresService()->GetCurrent(),
|
'currentChores' => $currentChores,
|
||||||
'nextXDays' => $nextXDays,
|
'nextXDays' => $nextXDays,
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('chores'),
|
'userfields' => $this->getUserfieldsService()->GetFields('chores'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('chores'),
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('chores'),
|
||||||
@@ -104,7 +127,7 @@ class ChoresController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TrackChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function TrackChoreExecution(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'choretracking', [
|
return $this->renderPage($response, 'choretracking', [
|
||||||
'chores' => $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'chores' => $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
@@ -113,7 +136,7 @@ class ChoresController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ChoreGrocycodeImage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ChoreGrocycodeImage(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$gc = new Grocycode(Grocycode::CHORE, $args['choreId']);
|
$gc = new Grocycode(Grocycode::CHORE, $args['choreId']);
|
||||||
return $this->ServeGrocycodeImage($request, $response, $gc);
|
return $this->ServeGrocycodeImage($request, $response, $gc);
|
||||||
|
@@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class EquipmentController extends BaseController
|
class EquipmentController extends BaseController
|
||||||
{
|
{
|
||||||
protected $UserfieldsService;
|
protected $UserfieldsService;
|
||||||
|
|
||||||
public function EditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function EditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['equipmentId'] == 'new')
|
if ($args['equipmentId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -25,7 +28,7 @@ class EquipmentController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Overview(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'equipment', [
|
return $this->renderPage($response, 'equipment', [
|
||||||
'equipment' => $this->getDatabase()->equipment()->orderBy('name', 'COLLATE NOCASE'),
|
'equipment' => $this->getDatabase()->equipment()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
|
use DI\Container;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Slim\Exception\HttpException;
|
use Slim\Exception\HttpException;
|
||||||
@@ -11,15 +12,12 @@ use Throwable;
|
|||||||
|
|
||||||
class ExceptionController extends BaseApiController
|
class ExceptionController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function __construct(\Slim\App $app, \DI\Container $container)
|
public function __construct(\Slim\App $app, Container $container)
|
||||||
{
|
{
|
||||||
parent::__construct($container);
|
parent::__construct($container);
|
||||||
$this->app = $app;
|
$this->app = $app;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \Slim\App
|
|
||||||
*/
|
|
||||||
private $app;
|
private $app;
|
||||||
|
|
||||||
public function __invoke(ServerRequestInterface $request, Throwable $exception, bool $displayErrorDetails, bool $logErrors, bool $logErrorDetails, ?LoggerInterface $logger = null)
|
public function __invoke(ServerRequestInterface $request, Throwable $exception, bool $displayErrorDetails, bool $logErrors, bool $logErrorDetails, ?LoggerInterface $logger = null)
|
||||||
@@ -77,7 +75,8 @@ class ExceptionController extends BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->renderPage($response->withStatus(500), 'errors/500', [
|
return $this->renderPage($response->withStatus(500), 'errors/500', [
|
||||||
'exception' => $exception
|
'exception' => $exception,
|
||||||
|
'systemInfo' => $this->getApplicationService()->GetSystemInfo()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,11 +3,14 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Services\FilesService;
|
use Grocy\Services\FilesService;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
use Slim\Exception\HttpNotFoundException;
|
use Slim\Exception\HttpNotFoundException;
|
||||||
|
use Slim\Psr7\Stream;
|
||||||
|
|
||||||
class FilesApiController extends BaseApiController
|
class FilesApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function DeleteFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function DeleteFile(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -35,7 +38,7 @@ class FilesApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ServeFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ServeFile(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -49,10 +52,10 @@ class FilesApiController extends BaseApiController
|
|||||||
|
|
||||||
if (file_exists($filePath))
|
if (file_exists($filePath))
|
||||||
{
|
{
|
||||||
$response->write(file_get_contents($filePath));
|
|
||||||
$response = $response->withHeader('Cache-Control', 'max-age=2592000');
|
$response = $response->withHeader('Cache-Control', 'max-age=2592000');
|
||||||
$response = $response->withHeader('Content-Type', mime_content_type($filePath));
|
$response = $response->withHeader('Content-Type', mime_content_type($filePath));
|
||||||
return $response->withHeader('Content-Disposition', 'inline; filename="' . $fileName . '"');
|
$response = $response->withHeader('Content-Disposition', 'inline; filename="' . $fileName . '"');
|
||||||
|
return $response->withBody(new Stream(fopen($filePath, 'rb')));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -65,7 +68,7 @@ class FilesApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ShowFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ShowFile(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -80,10 +83,10 @@ class FilesApiController extends BaseApiController
|
|||||||
|
|
||||||
if (file_exists($filePath))
|
if (file_exists($filePath))
|
||||||
{
|
{
|
||||||
$response->write(file_get_contents($filePath));
|
|
||||||
$response = $response->withHeader('Cache-Control', 'max-age=2592000');
|
$response = $response->withHeader('Cache-Control', 'max-age=2592000');
|
||||||
$response = $response->withHeader('Content-Type', mime_content_type($filePath));
|
$response = $response->withHeader('Content-Type', mime_content_type($filePath));
|
||||||
return $response->withHeader('Content-Disposition', 'inline; filename="' . $fileName . '"');
|
$response = $response->withHeader('Content-Disposition', 'inline; filename="' . $fileName . '"');
|
||||||
|
return $response->withBody(new Stream(fopen($filePath, 'rb')));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -96,7 +99,7 @@ class FilesApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UploadFile(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UploadFile(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -118,11 +121,6 @@ class FilesApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $fileName base64-encoded file-name
|
|
||||||
* @return false|string the decoded file-name
|
|
||||||
* @throws \Exception if the file-name is invalid.
|
|
||||||
*/
|
|
||||||
protected function checkFileName(string $fileName)
|
protected function checkFileName(string $fileName)
|
||||||
{
|
{
|
||||||
if (IsValidFileName(base64_decode($fileName)))
|
if (IsValidFileName(base64_decode($fileName)))
|
||||||
@@ -137,12 +135,6 @@ class FilesApiController extends BaseApiController
|
|||||||
return $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 = [])
|
protected function getFilePath(string $group, string $fileName, array $queryParams = [])
|
||||||
{
|
{
|
||||||
$forceServeAs = null;
|
$forceServeAs = null;
|
||||||
|
@@ -3,13 +3,33 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Controllers\Users\User;
|
use Grocy\Controllers\Users\User;
|
||||||
use Slim\Exception\HttpBadRequestException;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class GenericEntityApiController extends BaseApiController
|
class GenericEntityApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function AddObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function AddObject(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
if ($args['entity'] == 'shopping_list' || $args['entity'] == 'shopping_lists')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
||||||
|
}
|
||||||
|
elseif ($args['entity'] == 'recipes' || $args['entity'] == 'recipes_pos' || $args['entity'] == 'recipes_nestings')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_RECIPES);
|
||||||
|
}
|
||||||
|
elseif ($args['entity'] == 'meal_plan')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_RECIPES_MEALPLAN);
|
||||||
|
}
|
||||||
|
elseif ($args['entity'] == 'equipment')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_EQUIPMENT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoEdit($args['entity']))
|
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoEdit($args['entity']))
|
||||||
{
|
{
|
||||||
@@ -29,10 +49,16 @@ class GenericEntityApiController extends BaseApiController
|
|||||||
|
|
||||||
$newRow = $this->getDatabase()->{$args['entity']}()->createRow($requestBody);
|
$newRow = $this->getDatabase()->{$args['entity']}()->createRow($requestBody);
|
||||||
$newRow->save();
|
$newRow->save();
|
||||||
$success = $newRow->isClean();
|
$newObjectId = $this->getDatabase()->lastInsertId();
|
||||||
|
|
||||||
|
// TODO: This should be better done somehow in StockService
|
||||||
|
if ($args['entity'] == 'products' && boolval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'shopping_list_auto_add_below_min_stock_amount')))
|
||||||
|
{
|
||||||
|
$this->getStockService()->AddMissingProductsToShoppingList($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'shopping_list_auto_add_below_min_stock_amount_list_id'));
|
||||||
|
}
|
||||||
|
|
||||||
return $this->ApiResponse($response, [
|
return $this->ApiResponse($response, [
|
||||||
'created_object_id' => $this->getDatabase()->lastInsertId()
|
'created_object_id' => $newObjectId
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
catch (\Exception $ex)
|
catch (\Exception $ex)
|
||||||
@@ -46,9 +72,32 @@ class GenericEntityApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DeleteObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function DeleteObject(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
if ($args['entity'] == 'shopping_list' || $args['entity'] == 'shopping_lists')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_DELETE);
|
||||||
|
}
|
||||||
|
elseif ($args['entity'] == 'recipes' || $args['entity'] == 'recipes_pos' || $args['entity'] == 'recipes_nestings')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_RECIPES);
|
||||||
|
}
|
||||||
|
elseif ($args['entity'] == 'meal_plan')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_RECIPES_MEALPLAN);
|
||||||
|
}
|
||||||
|
elseif ($args['entity'] == 'equipment')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_EQUIPMENT);
|
||||||
|
}
|
||||||
|
elseif ($args['entity'] == 'api_keys')
|
||||||
|
{
|
||||||
|
// Always allowed
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoDelete($args['entity']))
|
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoDelete($args['entity']))
|
||||||
{
|
{
|
||||||
@@ -64,7 +113,6 @@ class GenericEntityApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$row->delete();
|
$row->delete();
|
||||||
$success = $row->isClean();
|
|
||||||
|
|
||||||
return $this->EmptyApiResponse($response);
|
return $this->EmptyApiResponse($response);
|
||||||
}
|
}
|
||||||
@@ -74,9 +122,28 @@ class GenericEntityApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function EditObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function EditObject(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
if ($args['entity'] == 'shopping_list' || $args['entity'] == 'shopping_lists')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
||||||
|
}
|
||||||
|
elseif ($args['entity'] == 'recipes' || $args['entity'] == 'recipes_pos' || $args['entity'] == 'recipes_nestings')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_RECIPES);
|
||||||
|
}
|
||||||
|
elseif ($args['entity'] == 'meal_plan')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_RECIPES_MEALPLAN);
|
||||||
|
}
|
||||||
|
elseif ($args['entity'] == 'equipment')
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_EQUIPMENT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoEdit($args['entity']))
|
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoEdit($args['entity']))
|
||||||
{
|
{
|
||||||
@@ -101,7 +168,12 @@ class GenericEntityApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$row->update($requestBody);
|
$row->update($requestBody);
|
||||||
$success = $row->isClean();
|
|
||||||
|
// TODO: This should be better done somehow in StockService
|
||||||
|
if ($args['entity'] == 'products' && boolval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'shopping_list_auto_add_below_min_stock_amount')))
|
||||||
|
{
|
||||||
|
$this->getStockService()->AddMissingProductsToShoppingList($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'shopping_list_auto_add_below_min_stock_amount_list_id'));
|
||||||
|
}
|
||||||
|
|
||||||
return $this->EmptyApiResponse($response);
|
return $this->EmptyApiResponse($response);
|
||||||
}
|
}
|
||||||
@@ -116,7 +188,7 @@ class GenericEntityApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetObject(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetObject(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoListing($args['entity']))
|
if ($this->IsValidExposedEntity($args['entity']) && !$this->IsEntityWithNoListing($args['entity']))
|
||||||
{
|
{
|
||||||
@@ -142,7 +214,7 @@ class GenericEntityApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetObjects(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetObjects(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if (!$this->IsValidExposedEntity($args['entity']) || $this->IsEntityWithNoListing($args['entity']))
|
if (!$this->IsValidExposedEntity($args['entity']) || $this->IsEntityWithNoListing($args['entity']))
|
||||||
{
|
{
|
||||||
@@ -179,7 +251,7 @@ class GenericEntityApiController extends BaseApiController
|
|||||||
return $this->ApiResponse($response, $objects);
|
return $this->ApiResponse($response, $objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetUserfields(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetUserfields(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -191,7 +263,7 @@ class GenericEntityApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetUserfields(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function SetUserfields(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
||||||
|
|
||||||
|
@@ -2,16 +2,19 @@
|
|||||||
|
|
||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class GenericEntityController extends BaseController
|
class GenericEntityController extends BaseController
|
||||||
{
|
{
|
||||||
public function UserentitiesList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UserentitiesList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'userentities', [
|
return $this->renderPage($response, 'userentities', [
|
||||||
'userentities' => $this->getDatabase()->userentities()->orderBy('name', 'COLLATE NOCASE')
|
'userentities' => $this->getDatabase()->userentities()->orderBy('name', 'COLLATE NOCASE')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UserentityEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UserentityEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['userentityId'] == 'new')
|
if ($args['userentityId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -28,7 +31,7 @@ class GenericEntityController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UserfieldEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UserfieldEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['userfieldId'] == 'new')
|
if ($args['userfieldId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -49,7 +52,7 @@ class GenericEntityController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UserfieldsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UserfieldsList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'userfields', [
|
return $this->renderPage($response, 'userfields', [
|
||||||
'userfields' => $this->getUserfieldsService()->GetAllFields(),
|
'userfields' => $this->getUserfieldsService()->GetAllFields(),
|
||||||
@@ -57,7 +60,7 @@ class GenericEntityController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UserobjectEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UserobjectEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$userentity = $this->getDatabase()->userentities()->where('name = :1', $args['userentityName'])->fetch();
|
$userentity = $this->getDatabase()->userentities()->where('name = :1', $args['userentityName'])->fetch();
|
||||||
|
|
||||||
@@ -80,7 +83,7 @@ class GenericEntityController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UserobjectsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UserobjectsList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$userentity = $this->getDatabase()->userentities()->where('name = :1', $args['userentityName'])->fetch();
|
$userentity = $this->getDatabase()->userentities()->where('name = :1', $args['userentityName'])->fetch();
|
||||||
|
|
||||||
|
@@ -3,31 +3,31 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Helpers\Grocycode;
|
use Grocy\Helpers\Grocycode;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
|
||||||
use jucksearm\barcode\lib\BarcodeFactory;
|
use jucksearm\barcode\lib\BarcodeFactory;
|
||||||
use jucksearm\barcode\lib\DatamatrixFactory;
|
use jucksearm\barcode\lib\DatamatrixFactory;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
trait GrocycodeTrait
|
trait GrocycodeTrait
|
||||||
{
|
{
|
||||||
public function ServeGrocycodeImage(ServerRequestInterface $request, ResponseInterface $response, Grocycode $grocycode)
|
public function ServeGrocycodeImage(Request $request, Response $response, Grocycode $grocycode)
|
||||||
{
|
{
|
||||||
$size = $request->getQueryParam('size', null);
|
$size = $request->getQueryParam('size', null);
|
||||||
|
|
||||||
if (GROCY_GROCYCODE_TYPE == '2D')
|
if (GROCY_GROCYCODE_TYPE == '2D')
|
||||||
{
|
{
|
||||||
$png = (new DatamatrixFactory())->setCode((string) $grocycode)->setSize($size)->getDatamatrixPngData();
|
$png = (new DatamatrixFactory())->setCode((string)$grocycode)->setSize($size)->getDatamatrixPngData();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$png = (new BarcodeFactory())->setType('C128')->setCode((string) $grocycode)->setHeight($size)->getBarcodePngData();
|
$png = (new BarcodeFactory())->setType('C128')->setCode((string)$grocycode)->setHeight($size)->getBarcodePngData();
|
||||||
}
|
}
|
||||||
|
|
||||||
$isDownload = $request->getQueryParam('download', false);
|
$isDownload = $request->getQueryParam('download', false);
|
||||||
if ($isDownload)
|
if ($isDownload)
|
||||||
{
|
{
|
||||||
$response = $response->withHeader('Content-Type', 'application/octet-stream')
|
$response = $response->withHeader('Content-Type', 'application/octet-stream')
|
||||||
->withHeader('Content-Disposition', 'attachment; filename=grocycode.png')
|
->withHeader('Content-Disposition', 'attachment; filename=Grocycode.png')
|
||||||
->withHeader('Content-Length', strlen($png))
|
->withHeader('Content-Length', strlen($png))
|
||||||
->withHeader('Cache-Control', 'no-cache')
|
->withHeader('Cache-Control', 'no-cache')
|
||||||
->withHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT');
|
->withHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT');
|
||||||
|
@@ -3,21 +3,23 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Services\SessionService;
|
use Grocy\Services\SessionService;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class LoginController extends BaseController
|
class LoginController extends BaseController
|
||||||
{
|
{
|
||||||
public function LoginPage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function LoginPage(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'login');
|
return $this->renderPage($response, 'login');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Logout(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Logout(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$this->getSessionService()->RemoveSession($_COOKIE[SessionService::SESSION_COOKIE_NAME]);
|
$this->getSessionService()->RemoveSession($_COOKIE[SessionService::SESSION_COOKIE_NAME]);
|
||||||
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl('/'));
|
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl('/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProcessLogin(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProcessLogin(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$authMiddlewareClass = GROCY_AUTH_CLASS;
|
$authMiddlewareClass = GROCY_AUTH_CLASS;
|
||||||
if ($authMiddlewareClass::ProcessLogin($this->GetParsedAndFilteredRequestBody($request)))
|
if ($authMiddlewareClass::ProcessLogin($this->GetParsedAndFilteredRequestBody($request)))
|
||||||
|
@@ -3,30 +3,47 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Controllers\Users\User;
|
use Grocy\Controllers\Users\User;
|
||||||
|
use Grocy\Services\ApiKeyService;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class OpenApiController extends BaseApiController
|
class OpenApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function ApiKeysList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ApiKeysList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
|
$selectedKeyId = -1;
|
||||||
|
if (isset($request->getQueryParams()['key']) && filter_var($request->getQueryParams()['key'], FILTER_VALIDATE_INT))
|
||||||
|
{
|
||||||
|
$selectedKeyId = $request->getQueryParams()['key'];
|
||||||
|
}
|
||||||
|
|
||||||
$apiKeys = $this->getDatabase()->api_keys();
|
$apiKeys = $this->getDatabase()->api_keys();
|
||||||
if (!User::hasPermissions(User::PERMISSION_ADMIN))
|
if (!User::hasPermissions(User::PERMISSION_ADMIN))
|
||||||
{
|
{
|
||||||
$apiKeys = $apiKeys->where('user_id', GROCY_USER_ID);
|
$apiKeys = $apiKeys->where('user_id', GROCY_USER_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->renderPage($response, 'manageapikeys', [
|
return $this->renderPage($response, 'manageapikeys', [
|
||||||
'apiKeys' => $apiKeys,
|
'apiKeys' => $apiKeys,
|
||||||
'users' => $this->getDatabase()->users()
|
'users' => $this->getDatabase()->users(),
|
||||||
|
'selectedKeyId' => $selectedKeyId
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CreateNewApiKey(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function CreateNewApiKey(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$newApiKey = $this->getApiKeyService()->CreateApiKey();
|
$description = null;
|
||||||
|
if (isset($request->getQueryParams()['description']))
|
||||||
|
{
|
||||||
|
$description = $request->getQueryParams()['description'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$newApiKey = $this->getApiKeyService()->CreateApiKey(ApiKeyService::API_KEY_TYPE_DEFAULT, $description);
|
||||||
$newApiKeyId = $this->getApiKeyService()->GetApiKeyId($newApiKey);
|
$newApiKeyId = $this->getApiKeyService()->GetApiKeyId($newApiKey);
|
||||||
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl("/manageapikeys?CreatedApiKeyId=$newApiKeyId"));
|
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl("/manageapikeys?key=$newApiKeyId"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DocumentationSpec(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function DocumentationSpec(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$spec = $this->getOpenApiSpec();
|
$spec = $this->getOpenApiSpec();
|
||||||
|
|
||||||
@@ -36,11 +53,13 @@ class OpenApiController extends BaseApiController
|
|||||||
$spec->info->description = str_replace('PlaceHolderManageApiKeysUrl', $this->AppContainer->get('UrlManager')->ConstructUrl('/manageapikeys'), $spec->info->description);
|
$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->servers[0]->url = $this->AppContainer->get('UrlManager')->ConstructUrl('/api');
|
||||||
|
|
||||||
$spec->components->schemas->ExposedEntity_IncludingUserEntities = clone $spec->components->schemas->ExposedEntity;
|
$spec->components->schemas->ExposedEntity_IncludingUserEntities = clone $spec->components->schemas->StringEnumTemplate;
|
||||||
|
;
|
||||||
foreach ($this->getUserfieldsService()->GetEntities() as $userEntity)
|
foreach ($this->getUserfieldsService()->GetEntities() as $userEntity)
|
||||||
{
|
{
|
||||||
array_push($spec->components->schemas->ExposedEntity_IncludingUserEntities->enum, $userEntity);
|
array_push($spec->components->schemas->ExposedEntity_IncludingUserEntities->enum, $userEntity);
|
||||||
}
|
}
|
||||||
|
sort($spec->components->schemas->ExposedEntity_IncludingUserEntities->enum);
|
||||||
|
|
||||||
$spec->components->schemas->ExposedEntity_NotIncludingNotEditable = clone $spec->components->schemas->StringEnumTemplate;
|
$spec->components->schemas->ExposedEntity_NotIncludingNotEditable = clone $spec->components->schemas->StringEnumTemplate;
|
||||||
foreach ($spec->components->schemas->ExposedEntity->enum as $value)
|
foreach ($spec->components->schemas->ExposedEntity->enum as $value)
|
||||||
@@ -50,6 +69,7 @@ class OpenApiController extends BaseApiController
|
|||||||
array_push($spec->components->schemas->ExposedEntity_NotIncludingNotEditable->enum, $value);
|
array_push($spec->components->schemas->ExposedEntity_NotIncludingNotEditable->enum, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sort($spec->components->schemas->ExposedEntity_NotIncludingNotEditable->enum);
|
||||||
|
|
||||||
$spec->components->schemas->ExposedEntity_IncludingUserEntities_NotIncludingNotEditable = clone $spec->components->schemas->StringEnumTemplate;
|
$spec->components->schemas->ExposedEntity_IncludingUserEntities_NotIncludingNotEditable = clone $spec->components->schemas->StringEnumTemplate;
|
||||||
foreach ($spec->components->schemas->ExposedEntity_IncludingUserEntities->enum as $value)
|
foreach ($spec->components->schemas->ExposedEntity_IncludingUserEntities->enum as $value)
|
||||||
@@ -59,6 +79,8 @@ class OpenApiController extends BaseApiController
|
|||||||
array_push($spec->components->schemas->ExposedEntity_IncludingUserEntities_NotIncludingNotEditable->enum, $value);
|
array_push($spec->components->schemas->ExposedEntity_IncludingUserEntities_NotIncludingNotEditable->enum, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
array_push($spec->components->schemas->ExposedEntity_IncludingUserEntities_NotIncludingNotEditable->enum, 'stock'); // TODO: Don't hardcode this here - stock entries are normally not editable, but the corresponding Userfields are
|
||||||
|
sort($spec->components->schemas->ExposedEntity_IncludingUserEntities_NotIncludingNotEditable->enum);
|
||||||
|
|
||||||
$spec->components->schemas->ExposedEntity_NotIncludingNotDeletable = clone $spec->components->schemas->StringEnumTemplate;
|
$spec->components->schemas->ExposedEntity_NotIncludingNotDeletable = clone $spec->components->schemas->StringEnumTemplate;
|
||||||
foreach ($spec->components->schemas->ExposedEntity->enum as $value)
|
foreach ($spec->components->schemas->ExposedEntity->enum as $value)
|
||||||
@@ -68,6 +90,7 @@ class OpenApiController extends BaseApiController
|
|||||||
array_push($spec->components->schemas->ExposedEntity_NotIncludingNotDeletable->enum, $value);
|
array_push($spec->components->schemas->ExposedEntity_NotIncludingNotDeletable->enum, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sort($spec->components->schemas->ExposedEntity_NotIncludingNotDeletable->enum);
|
||||||
|
|
||||||
$spec->components->schemas->ExposedEntity_NotIncludingNotListable = clone $spec->components->schemas->StringEnumTemplate;
|
$spec->components->schemas->ExposedEntity_NotIncludingNotListable = clone $spec->components->schemas->StringEnumTemplate;
|
||||||
foreach ($spec->components->schemas->ExposedEntity->enum as $value)
|
foreach ($spec->components->schemas->ExposedEntity->enum as $value)
|
||||||
@@ -77,11 +100,12 @@ class OpenApiController extends BaseApiController
|
|||||||
array_push($spec->components->schemas->ExposedEntity_NotIncludingNotListable->enum, $value);
|
array_push($spec->components->schemas->ExposedEntity_NotIncludingNotListable->enum, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sort($spec->components->schemas->ExposedEntity_NotIncludingNotListable->enum);
|
||||||
|
|
||||||
return $this->ApiResponse($response, $spec);
|
return $this->ApiResponse($response, $spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DocumentationUi(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function DocumentationUi(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->render($response, 'openapiui');
|
return $this->render($response, 'openapiui');
|
||||||
}
|
}
|
||||||
|
@@ -3,11 +3,12 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Controllers\Users\User;
|
use Grocy\Controllers\Users\User;
|
||||||
use Grocy\Services\StockService;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class PrintApiController extends BaseApiController
|
class PrintApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function PrintShoppingListThermal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function PrintShoppingListThermal(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -3,10 +3,14 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Controllers\Users\User;
|
use Grocy\Controllers\Users\User;
|
||||||
|
use Grocy\Helpers\WebhookRunner;
|
||||||
|
use Grocy\Helpers\Grocycode;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class RecipesApiController extends BaseApiController
|
class RecipesApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function AddNotFulfilledProductsToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function AddNotFulfilledProductsToShoppingList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
||||||
|
|
||||||
@@ -22,7 +26,7 @@ class RecipesApiController extends BaseApiController
|
|||||||
return $this->EmptyApiResponse($response);
|
return $this->EmptyApiResponse($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ConsumeRecipe(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ConsumeRecipe(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_STOCK_CONSUME);
|
User::checkPermission($request, User::PERMISSION_STOCK_CONSUME);
|
||||||
|
|
||||||
@@ -37,7 +41,7 @@ class RecipesApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetRecipeFulfillment(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetRecipeFulfillment(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -63,7 +67,7 @@ class RecipesApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CopyRecipe(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function CopyRecipe(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -76,4 +80,28 @@ class RecipesApiController extends BaseApiController
|
|||||||
return $this->GenericErrorResponse($response, $ex->getMessage());
|
return $this->GenericErrorResponse($response, $ex->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function RecipePrintLabel(Request $request, Response $response, array $args)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$recipe = $this->getDatabase()->recipes()->where('id', $args['recipeId'])->fetch();
|
||||||
|
|
||||||
|
$webhookData = array_merge([
|
||||||
|
'recipe' => $recipe->name,
|
||||||
|
'grocycode' => (string)(new Grocycode(Grocycode::RECIPE, $args['recipeId'])),
|
||||||
|
], GROCY_LABEL_PRINTER_PARAMS);
|
||||||
|
|
||||||
|
if (GROCY_LABEL_PRINTER_RUN_SERVER)
|
||||||
|
{
|
||||||
|
(new WebhookRunner())->run(GROCY_LABEL_PRINTER_WEBHOOK, $webhookData, GROCY_LABEL_PRINTER_HOOK_JSON);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->ApiResponse($response, $webhookData);
|
||||||
|
}
|
||||||
|
catch (\Exception $ex)
|
||||||
|
{
|
||||||
|
return $this->GenericErrorResponse($response, $ex->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,10 +3,15 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Services\RecipesService;
|
use Grocy\Services\RecipesService;
|
||||||
|
use Grocy\Helpers\Grocycode;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class RecipesController extends BaseController
|
class RecipesController extends BaseController
|
||||||
{
|
{
|
||||||
public function MealPlan(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
use GrocycodeTrait;
|
||||||
|
|
||||||
|
public function MealPlan(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$start = date('Y-m-d');
|
$start = date('Y-m-d');
|
||||||
if (isset($request->getQueryParams()['start']) && IsIsoDate($request->getQueryParams()['start']))
|
if (isset($request->getQueryParams()['start']) && IsIsoDate($request->getQueryParams()['start']))
|
||||||
@@ -20,7 +25,7 @@ class RecipesController extends BaseController
|
|||||||
$days = $request->getQueryParams()['days'];
|
$days = $request->getQueryParams()['days'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$mealPlanWhereTimespan = "day BETWEEN DATE('$start') AND DATE('$start', '+$days days')";
|
$mealPlanWhereTimespan = "day BETWEEN DATE('$start', '-$days days') AND DATE('$start', '+$days days')";
|
||||||
|
|
||||||
$recipes = $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->fetchAll();
|
$recipes = $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->fetchAll();
|
||||||
$events = [];
|
$events = [];
|
||||||
@@ -56,22 +61,22 @@ class RecipesController extends BaseController
|
|||||||
'fullcalendarEventSources' => $events,
|
'fullcalendarEventSources' => $events,
|
||||||
'recipes' => $recipes,
|
'recipes' => $recipes,
|
||||||
'internalRecipes' => $this->getDatabase()->recipes()->where("id IN (SELECT recipe_id FROM meal_plan_internal_recipe_relation WHERE $mealPlanWhereTimespan)")->fetchAll(),
|
'internalRecipes' => $this->getDatabase()->recipes()->where("id IN (SELECT recipe_id FROM meal_plan_internal_recipe_relation WHERE $mealPlanWhereTimespan)")->fetchAll(),
|
||||||
'recipesResolved' => $this->getRecipesService()->GetRecipesResolved2("recipe_id IN (SELECT recipe_id FROM meal_plan_internal_recipe_relation WHERE $mealPlanWhereTimespan)"),
|
'recipesResolved' => $this->getRecipesService()->GetRecipesResolved("recipe_id IN (SELECT recipe_id FROM meal_plan_internal_recipe_relation WHERE $mealPlanWhereTimespan)"),
|
||||||
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
|
||||||
'mealplanSections' => $this->getDatabase()->meal_plan_sections()->orderBy('sort_number'),
|
'mealplanSections' => $this->getDatabase()->meal_plan_sections()->orderBy('sort_number'),
|
||||||
'usedMealplanSections' => $this->getDatabase()->meal_plan_sections()->where("id IN (SELECT section_id FROM meal_plan WHERE $mealPlanWhereTimespan)")->orderBy('sort_number')
|
'usedMealplanSections' => $this->getDatabase()->meal_plan_sections()->where("id IN (SELECT section_id FROM meal_plan WHERE $mealPlanWhereTimespan)")->orderBy('sort_number'),
|
||||||
|
'weekRecipe' => $this->getDatabase()->recipes()->where("type = 'mealplan-week' AND name = LTRIM(STRFTIME('%Y-%W', DATE('$start')), '0')")->fetch()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Overview(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$recipes = $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name', 'COLLATE NOCASE');
|
$recipes = $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name', 'COLLATE NOCASE');
|
||||||
$recipesResolved = $this->getRecipesService()->GetRecipesResolved('recipe_id > 0');
|
$recipesResolved = $this->getRecipesService()->GetRecipesResolved('recipe_id > 0');
|
||||||
|
|
||||||
$selectedRecipe = null;
|
$selectedRecipe = null;
|
||||||
|
|
||||||
if (isset($request->getQueryParams()['recipe']))
|
if (isset($request->getQueryParams()['recipe']))
|
||||||
{
|
{
|
||||||
$selectedRecipe = $this->getDatabase()->recipes($request->getQueryParams()['recipe']);
|
$selectedRecipe = $this->getDatabase()->recipes($request->getQueryParams()['recipe']);
|
||||||
@@ -93,18 +98,19 @@ class RecipesController extends BaseController
|
|||||||
$totalCalories = FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $selectedRecipe->id)->calories;
|
$totalCalories = FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $selectedRecipe->id)->calories;
|
||||||
}
|
}
|
||||||
|
|
||||||
$renderArray = [
|
$viewData = [
|
||||||
'recipes' => $recipes,
|
'recipes' => $recipes,
|
||||||
'recipesResolved' => $recipesResolved,
|
'recipesResolved' => $recipesResolved,
|
||||||
'recipePositionsResolved' => $this->getDatabase()->recipes_pos_resolved()->where('recipe_type', RecipesService::RECIPE_TYPE_NORMAL),
|
'recipePositionsResolved' => $this->getDatabase()->recipes_pos_resolved()->where('recipe_id', $selectedRecipe->id),
|
||||||
'selectedRecipe' => $selectedRecipe,
|
'selectedRecipe' => $selectedRecipe,
|
||||||
'products' => $this->getDatabase()->products(),
|
'products' => $this->getDatabase()->products(),
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units(),
|
'quantityUnits' => $this->getDatabase()->quantity_units(),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
|
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('recipes'),
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('recipes'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
|
||||||
'selectedRecipeTotalCosts' => $totalCosts,
|
'selectedRecipeTotalCosts' => $totalCosts,
|
||||||
'selectedRecipeTotalCalories' => $totalCalories
|
'selectedRecipeTotalCalories' => $totalCalories,
|
||||||
|
'mealplanSections' => $this->getDatabase()->meal_plan_sections()->orderBy('sort_number')
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($selectedRecipe)
|
if ($selectedRecipe)
|
||||||
@@ -135,15 +141,15 @@ class RecipesController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$renderArray['selectedRecipeSubRecipes'] = $selectedRecipeSubRecipes;
|
$viewData['selectedRecipeSubRecipes'] = $selectedRecipeSubRecipes;
|
||||||
$renderArray['includedRecipeIdsAbsolute'] = $includedRecipeIdsAbsolute;
|
$viewData['includedRecipeIdsAbsolute'] = $includedRecipeIdsAbsolute;
|
||||||
$renderArray['allRecipePositions'] = $allRecipePositions;
|
$viewData['allRecipePositions'] = $allRecipePositions;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->renderPage($response, 'recipes', $renderArray);
|
return $this->renderPage($response, 'recipes', $viewData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function RecipeEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function RecipeEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$recipeId = $args['recipeId'];
|
$recipeId = $args['recipeId'];
|
||||||
|
|
||||||
@@ -153,16 +159,14 @@ class RecipesController extends BaseController
|
|||||||
'mode' => $recipeId == 'new' ? 'create' : 'edit',
|
'mode' => $recipeId == 'new' ? 'create' : 'edit',
|
||||||
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityunits' => $this->getDatabase()->quantity_units(),
|
'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', 'COLLATE NOCASE'),
|
'recipes' => $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'recipeNestings' => $this->getDatabase()->recipes_nestings()->where('recipe_id', $recipeId),
|
'recipeNestings' => $this->getDatabase()->recipes_nestings()->where('recipe_id', $recipeId),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
|
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function RecipePosEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function RecipePosEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['recipePosId'] == 'new')
|
if ($args['recipePosId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -172,7 +176,7 @@ class RecipesController extends BaseController
|
|||||||
'recipePos' => new \stdClass(),
|
'recipePos' => new \stdClass(),
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -183,17 +187,17 @@ class RecipesController extends BaseController
|
|||||||
'recipePos' => $this->getDatabase()->recipes_pos($args['recipePosId']),
|
'recipePos' => $this->getDatabase()->recipes_pos($args['recipePosId']),
|
||||||
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function RecipesSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function RecipesSettings(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'recipessettings');
|
return $this->renderPage($response, 'recipessettings');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function MealPlanSectionEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function MealPlanSectionEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['sectionId'] == 'new')
|
if ($args['sectionId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -210,10 +214,16 @@ class RecipesController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function MealPlanSectionsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function MealPlanSectionsList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'mealplansections', [
|
return $this->renderPage($response, 'mealplansections', [
|
||||||
'mealplanSections' => $this->getDatabase()->meal_plan_sections()->where('id > 0')->orderBy('sort_number')
|
'mealplanSections' => $this->getDatabase()->meal_plan_sections()->where('id > 0')->orderBy('sort_number')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function RecipeGrocycodeImage(Request $request, Response $response, array $args)
|
||||||
|
{
|
||||||
|
$gc = new Grocycode(Grocycode::RECIPE, $args['recipeId']);
|
||||||
|
return $this->ServeGrocycodeImage($request, $response, $gc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,10 +6,12 @@ use Grocy\Controllers\Users\User;
|
|||||||
use Grocy\Services\StockService;
|
use Grocy\Services\StockService;
|
||||||
use Grocy\Helpers\WebhookRunner;
|
use Grocy\Helpers\WebhookRunner;
|
||||||
use Grocy\Helpers\Grocycode;
|
use Grocy\Helpers\Grocycode;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class StockApiController extends BaseApiController
|
class StockApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function AddMissingProductsToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function AddMissingProductsToShoppingList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
||||||
|
|
||||||
@@ -33,7 +35,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function AddOverdueProductsToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function AddOverdueProductsToShoppingList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
||||||
|
|
||||||
@@ -57,7 +59,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function AddExpiredProductsToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function AddExpiredProductsToShoppingList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
||||||
|
|
||||||
@@ -81,7 +83,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function AddProduct(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function AddProduct(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_STOCK_PURCHASE);
|
User::checkPermission($request, User::PERMISSION_STOCK_PURCHASE);
|
||||||
|
|
||||||
@@ -100,53 +102,54 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$bestBeforeDate = null;
|
$bestBeforeDate = null;
|
||||||
|
|
||||||
if (array_key_exists('best_before_date', $requestBody) && IsIsoDate($requestBody['best_before_date']))
|
if (array_key_exists('best_before_date', $requestBody) && IsIsoDate($requestBody['best_before_date']))
|
||||||
{
|
{
|
||||||
$bestBeforeDate = $requestBody['best_before_date'];
|
$bestBeforeDate = $requestBody['best_before_date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$purchasedDate = date('Y-m-d');
|
$purchasedDate = date('Y-m-d');
|
||||||
|
|
||||||
if (array_key_exists('purchased_date', $requestBody) && IsIsoDate($requestBody['purchased_date']))
|
if (array_key_exists('purchased_date', $requestBody) && IsIsoDate($requestBody['purchased_date']))
|
||||||
{
|
{
|
||||||
$purchasedDate = $requestBody['purchased_date'];
|
$purchasedDate = $requestBody['purchased_date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$price = null;
|
$price = null;
|
||||||
|
|
||||||
if (array_key_exists('price', $requestBody) && is_numeric($requestBody['price']))
|
if (array_key_exists('price', $requestBody) && is_numeric($requestBody['price']))
|
||||||
{
|
{
|
||||||
$price = $requestBody['price'];
|
$price = $requestBody['price'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$locationId = null;
|
$locationId = null;
|
||||||
|
|
||||||
if (array_key_exists('location_id', $requestBody) && is_numeric($requestBody['location_id']))
|
if (array_key_exists('location_id', $requestBody) && is_numeric($requestBody['location_id']))
|
||||||
{
|
{
|
||||||
$locationId = $requestBody['location_id'];
|
$locationId = $requestBody['location_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$shoppingLocationId = null;
|
$shoppingLocationId = null;
|
||||||
|
|
||||||
if (array_key_exists('shopping_location_id', $requestBody) && is_numeric($requestBody['shopping_location_id']))
|
if (array_key_exists('shopping_location_id', $requestBody) && is_numeric($requestBody['shopping_location_id']))
|
||||||
{
|
{
|
||||||
$shoppingLocationId = $requestBody['shopping_location_id'];
|
$shoppingLocationId = $requestBody['shopping_location_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$transactionType = StockService::TRANSACTION_TYPE_PURCHASE;
|
$transactionType = StockService::TRANSACTION_TYPE_PURCHASE;
|
||||||
|
if (array_key_exists('transaction_type', $requestBody) && !empty($requestBody['transaction_type']))
|
||||||
if (array_key_exists('transaction_type', $requestBody) && !empty($requestBody['transactiontype']))
|
|
||||||
{
|
{
|
||||||
$transactionType = $requestBody['transactiontype'];
|
$transactionType = $requestBody['transaction_type'];
|
||||||
}
|
|
||||||
$runPrinterWebhook = false;
|
|
||||||
if (array_key_exists('print_stock_label', $requestBody) && intval($requestBody['print_stock_label']))
|
|
||||||
{
|
|
||||||
$runPrinterWebhook = intval($requestBody['print_stock_label']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$transactionId = $this->getStockService()->AddProduct($args['productId'], $requestBody['amount'], $bestBeforeDate, $transactionType, $purchasedDate, $price, $locationId, $shoppingLocationId, $unusedTransactionId, $runPrinterWebhook);
|
$stockLabelType = 0;
|
||||||
|
if (array_key_exists('stock_label_type', $requestBody) && is_numeric($requestBody['stock_label_type']))
|
||||||
|
{
|
||||||
|
$stockLabelType = intval($requestBody['stock_label_type']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$note = null;
|
||||||
|
if (array_key_exists('note', $requestBody))
|
||||||
|
{
|
||||||
|
$note = $requestBody['note'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$transactionId = $this->getStockService()->AddProduct($args['productId'], $requestBody['amount'], $bestBeforeDate, $transactionType, $purchasedDate, $price, $locationId, $shoppingLocationId, $unusedTransactionId, $stockLabelType, false, $note);
|
||||||
|
|
||||||
$args['transactionId'] = $transactionId;
|
$args['transactionId'] = $transactionId;
|
||||||
return $this->StockTransactions($request, $response, $args);
|
return $this->StockTransactions($request, $response, $args);
|
||||||
@@ -157,7 +160,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function AddProductByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function AddProductByBarcode(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -170,7 +173,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function AddProductToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function AddProductToShoppingList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
||||||
|
|
||||||
@@ -223,7 +226,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ClearShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ClearShoppingList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_DELETE);
|
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_DELETE);
|
||||||
|
|
||||||
@@ -232,13 +235,18 @@ class StockApiController extends BaseApiController
|
|||||||
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
|
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
|
||||||
|
|
||||||
$listId = 1;
|
$listId = 1;
|
||||||
|
|
||||||
if (array_key_exists('list_id', $requestBody) && !empty($requestBody['list_id']) && is_numeric($requestBody['list_id']))
|
if (array_key_exists('list_id', $requestBody) && !empty($requestBody['list_id']) && is_numeric($requestBody['list_id']))
|
||||||
{
|
{
|
||||||
$listId = intval($requestBody['list_id']);
|
$listId = intval($requestBody['list_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getStockService()->ClearShoppingList($listId);
|
$doneOnly = false;
|
||||||
|
if (array_key_exists('done_only', $requestBody) && filter_var($requestBody['done_only'], FILTER_VALIDATE_BOOLEAN) !== false)
|
||||||
|
{
|
||||||
|
$doneOnly = boolval($requestBody['done_only']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->getStockService()->ClearShoppingList($listId, $doneOnly);
|
||||||
return $this->EmptyApiResponse($response);
|
return $this->EmptyApiResponse($response);
|
||||||
}
|
}
|
||||||
catch (\Exception $ex)
|
catch (\Exception $ex)
|
||||||
@@ -247,7 +255,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ConsumeProduct(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ConsumeProduct(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_STOCK_CONSUME);
|
User::checkPermission($request, User::PERMISSION_STOCK_CONSUME);
|
||||||
|
|
||||||
@@ -318,7 +326,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ConsumeProductByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ConsumeProductByBarcode(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -343,12 +351,12 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CurrentStock(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function CurrentStock(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->ApiResponse($response, $this->getStockService()->GetCurrentStock());
|
return $this->ApiResponse($response, $this->getStockService()->GetCurrentStock());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CurrentVolatileStock(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function CurrentVolatileStock(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$nextXDays = 5;
|
$nextXDays = 5;
|
||||||
|
|
||||||
@@ -369,7 +377,7 @@ class StockApiController extends BaseApiController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function EditStockEntry(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function EditStockEntry(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);
|
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);
|
||||||
|
|
||||||
@@ -388,34 +396,36 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$bestBeforeDate = null;
|
$bestBeforeDate = null;
|
||||||
|
|
||||||
if (array_key_exists('best_before_date', $requestBody) && IsIsoDate($requestBody['best_before_date']))
|
if (array_key_exists('best_before_date', $requestBody) && IsIsoDate($requestBody['best_before_date']))
|
||||||
{
|
{
|
||||||
$bestBeforeDate = $requestBody['best_before_date'];
|
$bestBeforeDate = $requestBody['best_before_date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$price = null;
|
$price = null;
|
||||||
|
|
||||||
if (array_key_exists('price', $requestBody) && is_numeric($requestBody['price']))
|
if (array_key_exists('price', $requestBody) && is_numeric($requestBody['price']))
|
||||||
{
|
{
|
||||||
$price = $requestBody['price'];
|
$price = $requestBody['price'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$locationId = null;
|
$locationId = null;
|
||||||
|
|
||||||
if (array_key_exists('location_id', $requestBody) && is_numeric($requestBody['location_id']))
|
if (array_key_exists('location_id', $requestBody) && is_numeric($requestBody['location_id']))
|
||||||
{
|
{
|
||||||
$locationId = $requestBody['location_id'];
|
$locationId = $requestBody['location_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$shoppingLocationId = null;
|
$shoppingLocationId = null;
|
||||||
|
|
||||||
if (array_key_exists('shopping_location_id', $requestBody) && is_numeric($requestBody['shopping_location_id']))
|
if (array_key_exists('shopping_location_id', $requestBody) && is_numeric($requestBody['shopping_location_id']))
|
||||||
{
|
{
|
||||||
$shoppingLocationId = $requestBody['shopping_location_id'];
|
$shoppingLocationId = $requestBody['shopping_location_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$transactionId = $this->getStockService()->EditStockEntry($args['entryId'], $requestBody['amount'], $bestBeforeDate, $locationId, $shoppingLocationId, $price, $requestBody['open'], $requestBody['purchased_date']);
|
$note = null;
|
||||||
|
if (array_key_exists('note', $requestBody))
|
||||||
|
{
|
||||||
|
$note = $requestBody['note'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$transactionId = $this->getStockService()->EditStockEntry($args['entryId'], $requestBody['amount'], $bestBeforeDate, $locationId, $shoppingLocationId, $price, $requestBody['open'], $requestBody['purchased_date'], $note);
|
||||||
$args['transactionId'] = $transactionId;
|
$args['transactionId'] = $transactionId;
|
||||||
return $this->StockTransactions($request, $response, $args);
|
return $this->StockTransactions($request, $response, $args);
|
||||||
}
|
}
|
||||||
@@ -425,7 +435,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ExternalBarcodeLookup(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ExternalBarcodeLookup(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
User::checkPermission($request, User::PERMISSION_MASTER_DATA_EDIT);
|
||||||
|
|
||||||
@@ -446,7 +456,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function InventoryProduct(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function InventoryProduct(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_STOCK_INVENTORY);
|
User::checkPermission($request, User::PERMISSION_STOCK_INVENTORY);
|
||||||
|
|
||||||
@@ -494,7 +504,19 @@ class StockApiController extends BaseApiController
|
|||||||
$shoppingLocationId = $requestBody['shopping_location_id'];
|
$shoppingLocationId = $requestBody['shopping_location_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$transactionId = $this->getStockService()->InventoryProduct($args['productId'], $requestBody['new_amount'], $bestBeforeDate, $locationId, $price, $shoppingLocationId, $purchasedDate);
|
$stockLabelType = 0;
|
||||||
|
if (array_key_exists('stock_label_type', $requestBody) && is_numeric($requestBody['stock_label_type']))
|
||||||
|
{
|
||||||
|
$stockLabelType = intval($requestBody['stock_label_type']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$note = null;
|
||||||
|
if (array_key_exists('note', $requestBody))
|
||||||
|
{
|
||||||
|
$note = $requestBody['note'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$transactionId = $this->getStockService()->InventoryProduct($args['productId'], $requestBody['new_amount'], $bestBeforeDate, $locationId, $price, $shoppingLocationId, $purchasedDate, $stockLabelType, $note);
|
||||||
$args['transactionId'] = $transactionId;
|
$args['transactionId'] = $transactionId;
|
||||||
return $this->StockTransactions($request, $response, $args);
|
return $this->StockTransactions($request, $response, $args);
|
||||||
}
|
}
|
||||||
@@ -504,7 +526,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function InventoryProductByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function InventoryProductByBarcode(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -517,7 +539,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function OpenProduct(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function OpenProduct(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_STOCK_OPEN);
|
User::checkPermission($request, User::PERMISSION_STOCK_OPEN);
|
||||||
|
|
||||||
@@ -558,11 +580,23 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function OpenProductByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function OpenProductByBarcode(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$args['productId'] = $this->getStockService()->GetProductIdFromBarcode($args['barcode']);
|
$args['productId'] = $this->getStockService()->GetProductIdFromBarcode($args['barcode']);
|
||||||
|
|
||||||
|
if (Grocycode::Validate($args['barcode']))
|
||||||
|
{
|
||||||
|
$gc = new Grocycode($args['barcode']);
|
||||||
|
if ($gc->GetExtraData())
|
||||||
|
{
|
||||||
|
$requestBody = $request->getParsedBody();
|
||||||
|
$requestBody['stock_entry_id'] = $gc->GetExtraData()[0];
|
||||||
|
$request = $request->withParsedBody($requestBody);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->OpenProduct($request, $response, $args);
|
return $this->OpenProduct($request, $response, $args);
|
||||||
}
|
}
|
||||||
catch (\Exception $ex)
|
catch (\Exception $ex)
|
||||||
@@ -571,7 +605,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductDetails(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProductDetails(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -583,7 +617,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductDetailsByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProductDetailsByBarcode(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -596,7 +630,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductPriceHistory(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProductPriceHistory(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -608,7 +642,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductStockEntries(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProductStockEntries(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$allowSubproductSubstitution = false;
|
$allowSubproductSubstitution = false;
|
||||||
if (isset($request->getQueryParams()['include_sub_products']) && filter_var($request->getQueryParams()['include_sub_products'], FILTER_VALIDATE_BOOLEAN) !== false)
|
if (isset($request->getQueryParams()['include_sub_products']) && filter_var($request->getQueryParams()['include_sub_products'], FILTER_VALIDATE_BOOLEAN) !== false)
|
||||||
@@ -616,10 +650,15 @@ class StockApiController extends BaseApiController
|
|||||||
$allowSubproductSubstitution = true;
|
$allowSubproductSubstitution = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->FilteredApiResponse($response, $this->getStockService()->GetProductStockEntries($args['productId'], false, $allowSubproductSubstitution, true), $request->getQueryParams());
|
return $this->FilteredApiResponse($response, $this->getStockService()->GetProductStockEntries($args['productId'], false, $allowSubproductSubstitution), $request->getQueryParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductStockLocations(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function LocationStockEntries(Request $request, Response $response, array $args)
|
||||||
|
{
|
||||||
|
return $this->FilteredApiResponse($response, $this->getStockService()->GetLocationStockEntries($args['locationId']), $request->getQueryParams());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ProductStockLocations(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$allowSubproductSubstitution = false;
|
$allowSubproductSubstitution = false;
|
||||||
if (isset($request->getQueryParams()['include_sub_products']) && filter_var($request->getQueryParams()['include_sub_products'], FILTER_VALIDATE_BOOLEAN) !== false)
|
if (isset($request->getQueryParams()['include_sub_products']) && filter_var($request->getQueryParams()['include_sub_products'], FILTER_VALIDATE_BOOLEAN) !== false)
|
||||||
@@ -630,7 +669,7 @@ class StockApiController extends BaseApiController
|
|||||||
return $this->FilteredApiResponse($response, $this->getStockService()->GetProductStockLocations($args['productId'], $allowSubproductSubstitution), $request->getQueryParams());
|
return $this->FilteredApiResponse($response, $this->getStockService()->GetProductStockLocations($args['productId'], $allowSubproductSubstitution), $request->getQueryParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductPrintLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProductPrintLabel(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -654,7 +693,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function StockEntryPrintLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function StockEntryPrintLabel(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -684,7 +723,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function RemoveProductFromShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function RemoveProductFromShoppingList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_DELETE);
|
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_DELETE);
|
||||||
|
|
||||||
@@ -725,7 +764,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function StockBooking(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function StockBooking(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -744,12 +783,12 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function StockEntry(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function StockEntry(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->ApiResponse($response, $this->getStockService()->GetStockEntry($args['entryId']));
|
return $this->ApiResponse($response, $this->getStockService()->GetStockEntry($args['entryId']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function StockTransactions(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function StockTransactions(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -767,7 +806,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TransferProduct(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function TransferProduct(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_STOCK_TRANSFER);
|
User::checkPermission($request, User::PERMISSION_STOCK_TRANSFER);
|
||||||
|
|
||||||
@@ -812,7 +851,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TransferProductByBarcode(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function TransferProductByBarcode(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -837,7 +876,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UndoBooking(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UndoBooking(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);
|
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);
|
||||||
|
|
||||||
@@ -852,7 +891,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UndoTransaction(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UndoTransaction(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);
|
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);
|
||||||
|
|
||||||
@@ -867,7 +906,7 @@ class StockApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function MergeProducts(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function MergeProducts(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);
|
User::checkPermission($request, User::PERMISSION_STOCK_EDIT);
|
||||||
|
|
||||||
|
@@ -4,12 +4,14 @@ namespace Grocy\Controllers;
|
|||||||
|
|
||||||
use Grocy\Helpers\Grocycode;
|
use Grocy\Helpers\Grocycode;
|
||||||
use Grocy\Services\RecipesService;
|
use Grocy\Services\RecipesService;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class StockController extends BaseController
|
class StockController extends BaseController
|
||||||
{
|
{
|
||||||
use GrocycodeTrait;
|
use GrocycodeTrait;
|
||||||
|
|
||||||
public function Consume(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Consume(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'consume', [
|
return $this->renderPage($response, 'consume', [
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->where('id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)')->orderBy('name'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->where('id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)')->orderBy('name'),
|
||||||
@@ -17,23 +19,24 @@ class StockController extends BaseController
|
|||||||
'recipes' => $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name', 'COLLATE NOCASE'),
|
'recipes' => $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Inventory(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Inventory(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'inventory', [
|
return $this->renderPage($response, 'inventory', [
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('active = 1 AND no_own_stock = 0')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
|
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
|
||||||
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
|
||||||
|
'userfields' => $this->getUserfieldsService()->GetFields('stock')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Journal(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if (isset($request->getQueryParams()['months']) && filter_var($request->getQueryParams()['months'], FILTER_VALIDATE_INT) !== false)
|
if (isset($request->getQueryParams()['months']) && filter_var($request->getQueryParams()['months'], FILTER_VALIDATE_INT) !== false)
|
||||||
{
|
{
|
||||||
@@ -59,21 +62,23 @@ class StockController extends BaseController
|
|||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'users' => $usersService->GetUsersAsDto(),
|
'users' => $usersService->GetUsersAsDto(),
|
||||||
'transactionTypes' => GetClassConstants('\Grocy\Services\StockService', 'TRANSACTION_TYPE_')
|
'transactionTypes' => GetClassConstants('\Grocy\Services\StockService', 'TRANSACTION_TYPE_'),
|
||||||
|
'userfieldsStock' => $this->getUserfieldsService()->GetFields('stock'),
|
||||||
|
'userfieldValuesStock' => $this->getUserfieldsService()->GetAllValues('stock')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function LocationContentSheet(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function LocationContentSheet(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'locationcontentsheet', [
|
return $this->renderPage($response, 'locationcontentsheet', [
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'currentStockLocationContent' => $this->getStockService()->GetCurrentStockLocationContent()
|
'currentStockLocationContent' => $this->getStockService()->GetCurrentStockLocationContent(isset($request->getQueryParams()['include_out_of_stock']))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function LocationEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function LocationEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['locationId'] == 'new')
|
if ($args['locationId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -92,35 +97,43 @@ class StockController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function LocationsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function LocationsList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
|
if (isset($request->getQueryParams()['include_disabled']))
|
||||||
|
{
|
||||||
|
$locations = $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$locations = $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
}
|
||||||
|
|
||||||
return $this->renderPage($response, 'locations', [
|
return $this->renderPage($response, 'locations', [
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $locations,
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('locations'),
|
'userfields' => $this->getUserfieldsService()->GetFields('locations'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('locations')
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('locations')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Overview(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$usersService = $this->getUsersService();
|
$usersService = $this->getUsersService();
|
||||||
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['stock_due_soon_days'];
|
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['stock_due_soon_days'];
|
||||||
|
|
||||||
return $this->renderPage($response, 'stockoverview', [
|
return $this->renderPage($response, 'stockoverview', [
|
||||||
'currentStock' => $this->getStockService()->GetCurrentStockOverview(),
|
'currentStock' => $this->getStockService()->GetCurrentStockOverview(),
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
|
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
|
||||||
'nextXDays' => $nextXDays,
|
'nextXDays' => $nextXDays,
|
||||||
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE'),
|
'productGroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('products'),
|
'userfields' => $this->getUserfieldsService()->GetFields('products'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('products')
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('products')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductBarcodesEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProductBarcodesEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$product = null;
|
$product = null;
|
||||||
|
|
||||||
if (isset($request->getQueryParams()['product']))
|
if (isset($request->getQueryParams()['product']))
|
||||||
{
|
{
|
||||||
$product = $this->getDatabase()->products($request->getQueryParams()['product']);
|
$product = $this->getDatabase()->products($request->getQueryParams()['product']);
|
||||||
@@ -132,9 +145,9 @@ class StockController extends BaseController
|
|||||||
'mode' => 'create',
|
'mode' => 'create',
|
||||||
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
|
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('product_barcodes')
|
'userfields' => $this->getUserfieldsService()->GetFields('product_barcodes')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -144,24 +157,26 @@ class StockController extends BaseController
|
|||||||
'mode' => 'edit',
|
'mode' => 'edit',
|
||||||
'barcode' => $this->getDatabase()->product_barcodes($args['productBarcodeId']),
|
'barcode' => $this->getDatabase()->product_barcodes($args['productBarcodeId']),
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('product_barcodes')
|
'userfields' => $this->getUserfieldsService()->GetFields('product_barcodes')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProductEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['productId'] == 'new')
|
if ($args['productId'] == 'new')
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'productform', [
|
return $this->renderPage($response, 'productform', [
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name'),
|
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name'),
|
||||||
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
|
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
|
||||||
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityunitsStock' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'productgroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE'),
|
'referencedQuantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
|
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
|
'productgroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('products'),
|
'userfields' => $this->getUserfieldsService()->GetFields('products'),
|
||||||
'products' => $this->getDatabase()->products()->where('parent_product_id IS NULL and active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('parent_product_id IS NULL and active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'isSubProductOfOthers' => false,
|
'isSubProductOfOthers' => false,
|
||||||
@@ -174,29 +189,31 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
return $this->renderPage($response, 'productform', [
|
return $this->renderPage($response, 'productform', [
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
|
'barcodes' => $this->getDatabase()->product_barcodes()->orderBy('barcode'),
|
||||||
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityunitsStock' => $this->getDatabase()->quantity_units()->where('id IN (SELECT to_qu_id FROM cache__quantity_unit_conversions_resolved WHERE product_id = :1) OR NOT EXISTS(SELECT 1 FROM stock_log WHERE product_id = :1)', $product->id)->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'productgroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE'),
|
'referencedQuantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->where('id IN (SELECT to_qu_id FROM cache__quantity_unit_conversions_resolved WHERE product_id = :1)', $product->id)->orderBy('name', 'COLLATE NOCASE'),
|
||||||
|
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
|
'productgroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('products'),
|
'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'),
|
'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,
|
'isSubProductOfOthers' => $this->getDatabase()->products()->where('parent_product_id = :1', $product->id)->count() !== 0,
|
||||||
'mode' => 'edit',
|
'mode' => 'edit',
|
||||||
'quConversions' => $this->getDatabase()->quantity_unit_conversions(),
|
'quConversions' => $this->getDatabase()->quantity_unit_conversions()->where('product_id', $product->id),
|
||||||
'productBarcodeUserfields' => $this->getUserfieldsService()->GetFields('product_barcodes'),
|
'productBarcodeUserfields' => $this->getUserfieldsService()->GetFields('product_barcodes'),
|
||||||
'productBarcodeUserfieldValues' => $this->getUserfieldsService()->GetAllValues('product_barcodes')
|
'productBarcodeUserfieldValues' => $this->getUserfieldsService()->GetAllValues('product_barcodes')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductGrocycodeImage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProductGrocycodeImage(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$gc = new Grocycode(Grocycode::PRODUCT, $args['productId']);
|
$gc = new Grocycode(Grocycode::PRODUCT, $args['productId']);
|
||||||
return $this->ServeGrocycodeImage($request, $response, $gc);
|
return $this->ServeGrocycodeImage($request, $response, $gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductGroupEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProductGroupEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['productGroupId'] == 'new')
|
if ($args['productGroupId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -215,17 +232,26 @@ class StockController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductGroupsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProductGroupsList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
|
if (isset($request->getQueryParams()['include_disabled']))
|
||||||
|
{
|
||||||
|
$productGroups = $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$productGroups = $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
}
|
||||||
|
|
||||||
return $this->renderPage($response, 'productgroups', [
|
return $this->renderPage($response, 'productgroups', [
|
||||||
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE'),
|
'productGroups' => $productGroups,
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('product_groups'),
|
'userfields' => $this->getUserfieldsService()->GetFields('product_groups'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('product_groups')
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('product_groups')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ProductsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ProductsList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$products = $this->getDatabase()->products();
|
$products = $this->getDatabase()->products();
|
||||||
if (!isset($request->getQueryParams()['include_disabled']))
|
if (!isset($request->getQueryParams()['include_disabled']))
|
||||||
@@ -237,6 +263,10 @@ class StockController extends BaseController
|
|||||||
{
|
{
|
||||||
$products = $products->where('id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)');
|
$products = $products->where('id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)');
|
||||||
}
|
}
|
||||||
|
if (isset($request->getQueryParams()['only_out_of_stock']))
|
||||||
|
{
|
||||||
|
$products = $products->where('id NOT IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)');
|
||||||
|
}
|
||||||
|
|
||||||
$products = $products->orderBy('name', 'COLLATE NOCASE');
|
$products = $products->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
|
||||||
@@ -244,29 +274,29 @@ class StockController extends BaseController
|
|||||||
'products' => $products,
|
'products' => $products,
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE'),
|
'productGroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'shoppingLocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
'shoppingLocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('products'),
|
'userfields' => $this->getUserfieldsService()->GetFields('products'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('products')
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('products')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Purchase(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Purchase(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'purchase', [
|
return $this->renderPage($response, 'purchase', [
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('active = 1 AND no_own_stock = 0')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
|
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
|
||||||
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
|
||||||
|
'userfields' => $this->getUserfieldsService()->GetFields('stock')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function QuantityUnitConversionEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function QuantityUnitConversionEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$product = null;
|
$product = null;
|
||||||
|
|
||||||
if (isset($request->getQueryParams()['product']))
|
if (isset($request->getQueryParams()['product']))
|
||||||
{
|
{
|
||||||
$product = $this->getDatabase()->products($request->getQueryParams()['product']);
|
$product = $this->getDatabase()->products($request->getQueryParams()['product']);
|
||||||
@@ -284,7 +314,7 @@ class StockController extends BaseController
|
|||||||
return $this->renderPage($response, 'quantityunitconversionform', [
|
return $this->renderPage($response, 'quantityunitconversionform', [
|
||||||
'mode' => 'create',
|
'mode' => 'create',
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('quantity_unit_conversions'),
|
'userfields' => $this->getUserfieldsService()->GetFields('quantity_unit_conversions'),
|
||||||
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'defaultQuUnit' => $defaultQuUnit
|
'defaultQuUnit' => $defaultQuUnit
|
||||||
]);
|
]);
|
||||||
@@ -295,14 +325,14 @@ class StockController extends BaseController
|
|||||||
'quConversion' => $this->getDatabase()->quantity_unit_conversions($args['quConversionId']),
|
'quConversion' => $this->getDatabase()->quantity_unit_conversions($args['quConversionId']),
|
||||||
'mode' => 'edit',
|
'mode' => 'edit',
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('quantity_unit_conversions'),
|
'userfields' => $this->getUserfieldsService()->GetFields('quantity_unit_conversions'),
|
||||||
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'defaultQuUnit' => $defaultQuUnit
|
'defaultQuUnit' => $defaultQuUnit
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function QuantityUnitEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function QuantityUnitEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['quantityunitId'] == 'new')
|
if ($args['quantityunitId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -329,26 +359,34 @@ class StockController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function QuantityUnitPluralFormTesting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function QuantityUnitPluralFormTesting(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'quantityunitpluraltesting', [
|
return $this->renderPage($response, 'quantityunitpluraltesting', [
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE')
|
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function QuantityUnitsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function QuantityUnitsList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
|
if (isset($request->getQueryParams()['include_disabled']))
|
||||||
|
{
|
||||||
|
$quantityUnits = $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$quantityUnits = $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
}
|
||||||
|
|
||||||
return $this->renderPage($response, 'quantityunits', [
|
return $this->renderPage($response, 'quantityunits', [
|
||||||
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityunits' => $quantityUnits,
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('quantity_units'),
|
'userfields' => $this->getUserfieldsService()->GetFields('quantity_units'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('quantity_units')
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('quantity_units')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ShoppingList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$listId = 1;
|
$listId = 1;
|
||||||
|
|
||||||
if (isset($request->getQueryParams()['list']))
|
if (isset($request->getQueryParams()['list']))
|
||||||
{
|
{
|
||||||
$listId = $request->getQueryParams()['list'];
|
$listId = $request->getQueryParams()['list'];
|
||||||
@@ -361,15 +399,17 @@ class StockController extends BaseController
|
|||||||
'missingProducts' => $this->getStockService()->GetMissingProducts(),
|
'missingProducts' => $this->getStockService()->GetMissingProducts(),
|
||||||
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
|
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'selectedShoppingListId' => $listId,
|
'selectedShoppingListId' => $listId,
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
|
||||||
'productUserfields' => $this->getUserfieldsService()->GetFields('products'),
|
'productUserfields' => $this->getUserfieldsService()->GetFields('products'),
|
||||||
'productUserfieldValues' => $this->getUserfieldsService()->GetAllValues('products'),
|
'productUserfieldValues' => $this->getUserfieldsService()->GetAllValues('products'),
|
||||||
|
'productGroupUserfields' => $this->getUserfieldsService()->GetFields('product_groups'),
|
||||||
|
'productGroupUserfieldValues' => $this->getUserfieldsService()->GetAllValues('product_groups'),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('shopping_list'),
|
'userfields' => $this->getUserfieldsService()->GetFields('shopping_list'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('shopping_list')
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('shopping_list')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ShoppingListEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ShoppingListEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['listId'] == 'new')
|
if ($args['listId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -388,16 +428,17 @@ class StockController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ShoppingListItemEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ShoppingListItemEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['itemId'] == 'new')
|
if ($args['itemId'] == 'new')
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'shoppinglistitemform', [
|
return $this->renderPage($response, 'shoppinglistitemform', [
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
|
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
|
||||||
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
|
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'mode' => 'create',
|
'mode' => 'create',
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('shopping_list')
|
'userfields' => $this->getUserfieldsService()->GetFields('shopping_list')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -406,21 +447,24 @@ class StockController extends BaseController
|
|||||||
return $this->renderPage($response, 'shoppinglistitemform', [
|
return $this->renderPage($response, 'shoppinglistitemform', [
|
||||||
'listItem' => $this->getDatabase()->shopping_list($args['itemId']),
|
'listItem' => $this->getDatabase()->shopping_list($args['itemId']),
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
|
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
|
||||||
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
|
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'mode' => 'edit',
|
'mode' => 'edit',
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('shopping_list')
|
'userfields' => $this->getUserfieldsService()->GetFields('shopping_list')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ShoppingListSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ShoppingListSettings(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'shoppinglistsettings');
|
return $this->renderPage($response, 'shoppinglistsettings', [
|
||||||
|
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE')
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ShoppingLocationEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ShoppingLocationEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['shoppingLocationId'] == 'new')
|
if ($args['shoppingLocationId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -432,40 +476,50 @@ class StockController extends BaseController
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'shoppinglocationform', [
|
return $this->renderPage($response, 'shoppinglocationform', [
|
||||||
'shoppinglocation' => $this->getDatabase()->shopping_locations($args['shoppingLocationId']),
|
'shoppingLocation' => $this->getDatabase()->shopping_locations($args['shoppingLocationId']),
|
||||||
'mode' => 'edit',
|
'mode' => 'edit',
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('shopping_locations')
|
'userfields' => $this->getUserfieldsService()->GetFields('shopping_locations')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ShoppingLocationsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ShoppingLocationsList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
|
if (isset($request->getQueryParams()['include_disabled']))
|
||||||
|
{
|
||||||
|
$shoppingLocations = $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$shoppingLocations = $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
}
|
||||||
|
|
||||||
return $this->renderPage($response, 'shoppinglocations', [
|
return $this->renderPage($response, 'shoppinglocations', [
|
||||||
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
'shoppinglocations' => $shoppingLocations,
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('shopping_locations'),
|
'userfields' => $this->getUserfieldsService()->GetFields('shopping_locations'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('shopping_locations')
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('shopping_locations')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function StockEntryEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function StockEntryEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'stockentryform', [
|
return $this->renderPage($response, 'stockentryform', [
|
||||||
'stockEntry' => $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch(),
|
'stockEntry' => $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch(),
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE')
|
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
|
'userfields' => $this->getUserfieldsService()->GetFields('stock')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function StockEntryGrocycodeImage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function StockEntryGrocycodeImage(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$stockEntry = $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch();
|
$stockEntry = $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch();
|
||||||
$gc = new Grocycode(Grocycode::PRODUCT, $stockEntry->product_id, [$stockEntry->stock_id]);
|
$gc = new Grocycode(Grocycode::PRODUCT, $stockEntry->product_id, [$stockEntry->stock_id]);
|
||||||
return $this->ServeGrocycodeImage($request, $response, $gc);
|
return $this->ServeGrocycodeImage($request, $response, $gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function StockEntryGrocycodeLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function StockEntryGrocycodeLabel(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$stockEntry = $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch();
|
$stockEntry = $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch();
|
||||||
return $this->renderPage($response, 'stockentrylabel', [
|
return $this->renderPage($response, 'stockentrylabel', [
|
||||||
@@ -474,45 +528,47 @@ class StockController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function StockSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function StockSettings(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'stocksettings', [
|
return $this->renderPage($response, 'stocksettings', [
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'productGroups' => $this->getDatabase()->product_groups()->orderBy('name', 'COLLATE NOCASE')
|
'productGroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Stockentries(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Stockentries(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$usersService = $this->getUsersService();
|
$usersService = $this->getUsersService();
|
||||||
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['stock_due_soon_days'];
|
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['stock_due_soon_days'];
|
||||||
|
|
||||||
return $this->renderPage($response, 'stockentries', [
|
return $this->renderPage($response, 'stockentries', [
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityunits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
'shoppinglocations' => $this->getDatabase()->shopping_locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'stockEntries' => $this->getDatabase()->stock()->orderBy('product_id'),
|
'stockEntries' => $this->getDatabase()->uihelper_stock_entries()->orderBy('product_id'),
|
||||||
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
|
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
|
||||||
'nextXDays' => $nextXDays,
|
'nextXDays' => $nextXDays,
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('products'),
|
'userfieldsProducts' => $this->getUserfieldsService()->GetFields('products'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('products')
|
'userfieldValuesProducts' => $this->getUserfieldsService()->GetAllValues('products'),
|
||||||
|
'userfieldsStock' => $this->getUserfieldsService()->GetFields('stock'),
|
||||||
|
'userfieldValuesStock' => $this->getUserfieldsService()->GetAllValues('stock')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Transfer(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Transfer(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'transfer', [
|
return $this->renderPage($response, 'transfer', [
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->where('id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)')->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->where('no_own_stock = 0 AND id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
|
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function JournalSummary(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function JournalSummary(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
$entries = $this->getDatabase()->uihelper_stock_journal_summary();
|
$entries = $this->getDatabase()->uihelper_stock_journal_summary();
|
||||||
if (isset($request->getQueryParams()['product_id']))
|
if (isset($request->getQueryParams()['product_id']))
|
||||||
@@ -536,4 +592,24 @@ class StockController extends BaseController
|
|||||||
'transactionTypes' => GetClassConstants('\Grocy\Services\StockService', 'TRANSACTION_TYPE_')
|
'transactionTypes' => GetClassConstants('\Grocy\Services\StockService', 'TRANSACTION_TYPE_')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function QuantityUnitConversionsResolved(Request $request, Response $response, array $args)
|
||||||
|
{
|
||||||
|
$product = null;
|
||||||
|
if (isset($request->getQueryParams()['product']))
|
||||||
|
{
|
||||||
|
$product = $this->getDatabase()->products($request->getQueryParams()['product']);
|
||||||
|
$quantityUnitConversionsResolved = $this->getDatabase()->cache__quantity_unit_conversions_resolved()->where('product_id', $product->id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$quantityUnitConversionsResolved = $this->getDatabase()->cache__quantity_unit_conversions_resolved()->where('product_id IS NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->renderPage($response, 'quantityunitconversionsresolved', [
|
||||||
|
'product' => $product,
|
||||||
|
'quantityUnits' => $this->getDatabase()->quantity_units()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
|
'quantityUnitConversionsResolved' => $quantityUnitConversionsResolved
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
96
controllers/StockReportsController.php
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
|
class StockReportsController extends BaseController
|
||||||
|
{
|
||||||
|
public function Spendings(Request $request, Response $response, array $args)
|
||||||
|
{
|
||||||
|
if (isset($request->getQueryParams()['start_date']) && isset($request->getQueryParams()['end_date']) && IsIsoDate($request->getQueryParams()['start_date']) && IsIsoDate($request->getQueryParams()['end_date']))
|
||||||
|
{
|
||||||
|
$startDate = $request->getQueryParams()['start_date'];
|
||||||
|
$endDate = $request->getQueryParams()['end_date'];
|
||||||
|
$where = "pph.purchased_date BETWEEN '$startDate' AND '$endDate'";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Default to this month
|
||||||
|
$where = "pph.purchased_date >= DATE(DATE('now', 'localtime'), 'start of month')";
|
||||||
|
}
|
||||||
|
|
||||||
|
$groupBy = 'product';
|
||||||
|
if (isset($request->getQueryParams()['group-by']) && in_array($request->getQueryParams()['group-by'], ['product', 'productgroup', 'store']))
|
||||||
|
{
|
||||||
|
$groupBy = $request->getQueryParams()['group-by'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($groupBy == 'product')
|
||||||
|
{
|
||||||
|
if (isset($request->getQueryParams()['product-group']) and $request->getQueryParams()['product-group'] != 'all')
|
||||||
|
{
|
||||||
|
$where .= ' AND pg.id = ' . $request->getQueryParams()['product-group'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
p.id AS id,
|
||||||
|
p.name AS name,
|
||||||
|
pg.id AS group_id,
|
||||||
|
pg.name AS group_name,
|
||||||
|
SUM(pph.amount * pph.price) AS total
|
||||||
|
FROM products_price_history pph
|
||||||
|
JOIN products p
|
||||||
|
ON pph.product_id = p.id
|
||||||
|
JOIN product_groups pg
|
||||||
|
ON p.product_group_id = pg.id
|
||||||
|
WHERE $where
|
||||||
|
GROUP BY p.id, p.name, pg.id, pg.name
|
||||||
|
ORDER BY p.name COLLATE NOCASE
|
||||||
|
";
|
||||||
|
}
|
||||||
|
elseif ($groupBy == 'productgroup')
|
||||||
|
{
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
pg.id AS id,
|
||||||
|
pg.name AS name,
|
||||||
|
SUM(pph.amount * pph.price) AS total
|
||||||
|
FROM products_price_history pph
|
||||||
|
JOIN products p
|
||||||
|
ON pph.product_id = p.id
|
||||||
|
JOIN product_groups pg
|
||||||
|
ON p.product_group_id = pg.id
|
||||||
|
WHERE $where
|
||||||
|
GROUP BY pg.id, pg.name
|
||||||
|
ORDER BY pg.name COLLATE NOCASE
|
||||||
|
";
|
||||||
|
}
|
||||||
|
elseif ($groupBy == 'store')
|
||||||
|
{
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
sl.id AS id,
|
||||||
|
sl.name AS name,
|
||||||
|
SUM(pph.amount * pph.price) AS total
|
||||||
|
FROM products_price_history pph
|
||||||
|
JOIN products p
|
||||||
|
ON pph.product_id = p.id
|
||||||
|
LEFT JOIN shopping_locations sl
|
||||||
|
ON pph.shopping_location_id = sl.id
|
||||||
|
WHERE $where
|
||||||
|
GROUP BY sl.id, sl.name
|
||||||
|
ORDER BY sl.NAME COLLATE NOCASE
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->renderPage($response, 'stockreportspendings', [
|
||||||
|
'metrics' => $this->getDatabaseService()->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ),
|
||||||
|
'productGroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
|
'selectedGroup' => isset($request->getQueryParams()['product-group']) ? $request->getQueryParams()['product-group'] : null,
|
||||||
|
'groupBy' => $groupBy
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class SystemApiController extends BaseApiController
|
class SystemApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function GetConfig(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetConfig(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -31,19 +34,19 @@ class SystemApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetDbChangedTime(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetDbChangedTime(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->ApiResponse($response, [
|
return $this->ApiResponse($response, [
|
||||||
'changed_time' => $this->getDatabaseService()->GetDbChangedTime()
|
'changed_time' => $this->getDatabaseService()->GetDbChangedTime()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetSystemInfo(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetSystemInfo(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->ApiResponse($response, $this->getApplicationService()->GetSystemInfo());
|
return $this->ApiResponse($response, $this->getApplicationService()->GetSystemInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetSystemTime(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetSystemTime(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -67,7 +70,7 @@ class SystemApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function LogMissingLocalization(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function LogMissingLocalization(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if (GROCY_MODE === 'dev')
|
if (GROCY_MODE === 'dev')
|
||||||
{
|
{
|
||||||
@@ -85,7 +88,7 @@ class SystemApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetLocalizationStrings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetLocalizationStrings(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->ApiResponse($response, json_decode($this->getLocalizationService()->GetPoAsJsonString()), true);
|
return $this->ApiResponse($response, json_decode($this->getLocalizationService()->GetPoAsJsonString()), true);
|
||||||
}
|
}
|
||||||
|
@@ -4,23 +4,26 @@ namespace Grocy\Controllers;
|
|||||||
|
|
||||||
use Grocy\Services\DatabaseMigrationService;
|
use Grocy\Services\DatabaseMigrationService;
|
||||||
use Grocy\Services\DemoDataGeneratorService;
|
use Grocy\Services\DemoDataGeneratorService;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class SystemController extends BaseController
|
class SystemController extends BaseController
|
||||||
{
|
{
|
||||||
public function About(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function About(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'about', [
|
return $this->renderPage($response, 'about', [
|
||||||
'system_info' => $this->getApplicationService()->GetSystemInfo(),
|
'systemInfo' => $this->getApplicationService()->GetSystemInfo(),
|
||||||
|
'versionInfo' => $this->getApplicationService()->GetInstalledVersion(),
|
||||||
'changelog' => $this->getApplicationService()->GetChangelog()
|
'changelog' => $this->getApplicationService()->GetChangelog()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function BarcodeScannerTesting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function BarcodeScannerTesting(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'barcodescannertesting');
|
return $this->renderPage($response, 'barcodescannertesting');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Root(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Root(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
// Schema migration is done here
|
// Schema migration is done here
|
||||||
$databaseMigrationService = DatabaseMigrationService::getInstance();
|
$databaseMigrationService = DatabaseMigrationService::getInstance();
|
||||||
@@ -29,20 +32,34 @@ class SystemController extends BaseController
|
|||||||
if (GROCY_MODE === 'dev' || GROCY_MODE === 'demo' || GROCY_MODE === 'prerelease')
|
if (GROCY_MODE === 'dev' || GROCY_MODE === 'demo' || GROCY_MODE === 'prerelease')
|
||||||
{
|
{
|
||||||
$demoDataGeneratorService = DemoDataGeneratorService::getInstance();
|
$demoDataGeneratorService = DemoDataGeneratorService::getInstance();
|
||||||
$demoDataGeneratorService->PopulateDemoData();
|
$demoDataGeneratorService->PopulateDemoData(isset($request->getQueryParams()['nodemodata']));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl($this->GetEntryPageRelative()));
|
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl($this->GetEntryPageRelative()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function Manifest(Request $request, Response $response, array $args)
|
||||||
* Get the entry page of the application based on the value of the entry page setting.
|
{
|
||||||
*
|
$data = explode('#', base64_decode($request->getQueryParams()['data']));
|
||||||
* We fallback to the about page when no entry page is specified or
|
|
||||||
* when the specified entry page has been disabled.
|
$manifest = [
|
||||||
*
|
'name' => 'Grocy ' . $data[0],
|
||||||
* @return string
|
'short_name' => 'Grocy ' . $data[0],
|
||||||
*/
|
'icons' => [[
|
||||||
|
'src' => './img/icon-1024.png',
|
||||||
|
'sizes'=> '1024x1024',
|
||||||
|
'type' => 'image/png'
|
||||||
|
]],
|
||||||
|
'start_url' => $data[1],
|
||||||
|
'background_color' => '#333131',
|
||||||
|
'theme_color' => '#333131',
|
||||||
|
'display' => 'standalone'
|
||||||
|
];
|
||||||
|
|
||||||
|
$response->getBody()->write(json_encode($manifest));
|
||||||
|
return $response->withHeader('Content-Type', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
private function GetEntryPageRelative()
|
private function GetEntryPageRelative()
|
||||||
{
|
{
|
||||||
if (defined('GROCY_ENTRY_PAGE'))
|
if (defined('GROCY_ENTRY_PAGE'))
|
||||||
@@ -102,7 +119,7 @@ class SystemController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Meal Plan
|
// Meal Plan
|
||||||
if ($entryPage === 'mealplan' && constant('GROCY_FEATURE_FLAG_RECIPES'))
|
if ($entryPage === 'mealplan' && constant('GROCY_FEATURE_FLAG_RECIPES_MEALPLAN'))
|
||||||
{
|
{
|
||||||
return '/mealplan';
|
return '/mealplan';
|
||||||
}
|
}
|
||||||
|
@@ -3,15 +3,17 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Controllers\Users\User;
|
use Grocy\Controllers\Users\User;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class TasksApiController extends BaseApiController
|
class TasksApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Current(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->FilteredApiResponse($response, $this->getTasksService()->GetCurrent(), $request->getQueryParams());
|
return $this->FilteredApiResponse($response, $this->getTasksService()->GetCurrent(), $request->getQueryParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function MarkTaskAsCompleted(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function MarkTaskAsCompleted(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_TASKS_MARK_COMPLETED);
|
User::checkPermission($request, User::PERMISSION_TASKS_MARK_COMPLETED);
|
||||||
|
|
||||||
@@ -35,7 +37,7 @@ class TasksApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UndoTask(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UndoTask(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_TASKS_UNDO_EXECUTION);
|
User::checkPermission($request, User::PERMISSION_TASKS_UNDO_EXECUTION);
|
||||||
|
|
||||||
|
@@ -2,10 +2,16 @@
|
|||||||
|
|
||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class TasksController extends BaseController
|
class TasksController extends BaseController
|
||||||
{
|
{
|
||||||
public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Overview(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
|
$usersService = $this->getUsersService();
|
||||||
|
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['tasks_due_soon_days'];
|
||||||
|
|
||||||
if (isset($request->getQueryParams()['include_done']))
|
if (isset($request->getQueryParams()['include_done']))
|
||||||
{
|
{
|
||||||
$tasks = $this->getDatabase()->tasks()->orderBy('name', 'COLLATE NOCASE');
|
$tasks = $this->getDatabase()->tasks()->orderBy('name', 'COLLATE NOCASE');
|
||||||
@@ -15,29 +21,55 @@ class TasksController extends BaseController
|
|||||||
$tasks = $this->getTasksService()->GetCurrent();
|
$tasks = $this->getTasksService()->GetCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
$usersService = $this->getUsersService();
|
foreach ($tasks as $task)
|
||||||
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['tasks_due_soon_days'];
|
{
|
||||||
|
if (empty($task->due_date))
|
||||||
|
{
|
||||||
|
$task->due_type = '';
|
||||||
|
}
|
||||||
|
elseif ($task->due_date < date('Y-m-d 23:59:59', strtotime('-1 days')))
|
||||||
|
{
|
||||||
|
$task->due_type = 'overdue';
|
||||||
|
}
|
||||||
|
elseif ($task->due_date <= date('Y-m-d 23:59:59'))
|
||||||
|
{
|
||||||
|
$task->due_type = 'duetoday';
|
||||||
|
}
|
||||||
|
elseif ($nextXDays > 0 && $task->due_date <= date('Y-m-d 23:59:59', strtotime('+' . $nextXDays . ' days')))
|
||||||
|
{
|
||||||
|
$task->due_type = 'duesoon';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->renderPage($response, 'tasks', [
|
return $this->renderPage($response, 'tasks', [
|
||||||
'tasks' => $tasks,
|
'tasks' => $tasks,
|
||||||
'nextXDays' => $nextXDays,
|
'nextXDays' => $nextXDays,
|
||||||
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE'),
|
'taskCategories' => $this->getDatabase()->task_categories()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'users' => $this->getDatabase()->users(),
|
'users' => $this->getDatabase()->users(),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('tasks'),
|
'userfields' => $this->getUserfieldsService()->GetFields('tasks'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('tasks')
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('tasks')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TaskCategoriesList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function TaskCategoriesList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
|
if (isset($request->getQueryParams()['include_disabled']))
|
||||||
|
{
|
||||||
|
$categories = $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$categories = $this->getDatabase()->task_categories()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
|
||||||
|
}
|
||||||
|
|
||||||
return $this->renderPage($response, 'taskcategories', [
|
return $this->renderPage($response, 'taskcategories', [
|
||||||
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE'),
|
'taskCategories' => $categories,
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('task_categories'),
|
'userfields' => $this->getUserfieldsService()->GetFields('task_categories'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('task_categories')
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('task_categories')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TaskCategoryEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function TaskCategoryEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['categoryId'] == 'new')
|
if ($args['categoryId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -56,13 +88,13 @@ class TasksController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TaskEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function TaskEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['taskId'] == 'new')
|
if ($args['taskId'] == 'new')
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'taskform', [
|
return $this->renderPage($response, 'taskform', [
|
||||||
'mode' => 'create',
|
'mode' => 'create',
|
||||||
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE'),
|
'taskCategories' => $this->getDatabase()->task_categories()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'users' => $this->getDatabase()->users()->orderBy('username'),
|
'users' => $this->getDatabase()->users()->orderBy('username'),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('tasks')
|
'userfields' => $this->getUserfieldsService()->GetFields('tasks')
|
||||||
]);
|
]);
|
||||||
@@ -72,14 +104,14 @@ class TasksController extends BaseController
|
|||||||
return $this->renderPage($response, 'taskform', [
|
return $this->renderPage($response, 'taskform', [
|
||||||
'task' => $this->getDatabase()->tasks($args['taskId']),
|
'task' => $this->getDatabase()->tasks($args['taskId']),
|
||||||
'mode' => 'edit',
|
'mode' => 'edit',
|
||||||
'taskCategories' => $this->getDatabase()->task_categories()->orderBy('name', 'COLLATE NOCASE'),
|
'taskCategories' => $this->getDatabase()->task_categories()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'users' => $this->getDatabase()->users()->orderBy('username'),
|
'users' => $this->getDatabase()->users()->orderBy('username'),
|
||||||
'userfields' => $this->getUserfieldsService()->GetFields('tasks')
|
'userfields' => $this->getUserfieldsService()->GetFields('tasks')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TasksSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function TasksSettings(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'taskssettings');
|
return $this->renderPage($response, 'taskssettings');
|
||||||
}
|
}
|
||||||
|
@@ -8,63 +8,34 @@ use LessQL\Result;
|
|||||||
class User
|
class User
|
||||||
{
|
{
|
||||||
const PERMISSION_ADMIN = 'ADMIN';
|
const PERMISSION_ADMIN = 'ADMIN';
|
||||||
|
|
||||||
const PERMISSION_BATTERIES = 'BATTERIES';
|
const PERMISSION_BATTERIES = 'BATTERIES';
|
||||||
|
|
||||||
const PERMISSION_BATTERIES_TRACK_CHARGE_CYCLE = 'BATTERIES_TRACK_CHARGE_CYCLE';
|
const PERMISSION_BATTERIES_TRACK_CHARGE_CYCLE = 'BATTERIES_TRACK_CHARGE_CYCLE';
|
||||||
|
|
||||||
const PERMISSION_BATTERIES_UNDO_CHARGE_CYCLE = 'BATTERIES_UNDO_CHARGE_CYCLE';
|
const PERMISSION_BATTERIES_UNDO_CHARGE_CYCLE = 'BATTERIES_UNDO_CHARGE_CYCLE';
|
||||||
|
|
||||||
const PERMISSION_CALENDAR = 'CALENDAR';
|
const PERMISSION_CALENDAR = 'CALENDAR';
|
||||||
|
|
||||||
const PERMISSION_CHORES = 'CHORES';
|
const PERMISSION_CHORES = 'CHORES';
|
||||||
|
|
||||||
const PERMISSION_CHORE_TRACK_EXECUTION = 'CHORE_TRACK_EXECUTION';
|
const PERMISSION_CHORE_TRACK_EXECUTION = 'CHORE_TRACK_EXECUTION';
|
||||||
|
|
||||||
const PERMISSION_CHORE_UNDO_EXECUTION = 'CHORE_UNDO_EXECUTION';
|
const PERMISSION_CHORE_UNDO_EXECUTION = 'CHORE_UNDO_EXECUTION';
|
||||||
|
|
||||||
const PERMISSION_EQUIPMENT = 'EQUIPMENT';
|
const PERMISSION_EQUIPMENT = 'EQUIPMENT';
|
||||||
|
|
||||||
const PERMISSION_MASTER_DATA_EDIT = 'MASTER_DATA_EDIT';
|
const PERMISSION_MASTER_DATA_EDIT = 'MASTER_DATA_EDIT';
|
||||||
|
|
||||||
const PERMISSION_RECIPES = 'RECIPES';
|
const PERMISSION_RECIPES = 'RECIPES';
|
||||||
|
|
||||||
const PERMISSION_RECIPES_MEALPLAN = 'RECIPES_MEALPLAN';
|
const PERMISSION_RECIPES_MEALPLAN = 'RECIPES_MEALPLAN';
|
||||||
|
|
||||||
const PERMISSION_SHOPPINGLIST = 'SHOPPINGLIST';
|
const PERMISSION_SHOPPINGLIST = 'SHOPPINGLIST';
|
||||||
|
|
||||||
const PERMISSION_SHOPPINGLIST_ITEMS_ADD = 'SHOPPINGLIST_ITEMS_ADD';
|
const PERMISSION_SHOPPINGLIST_ITEMS_ADD = 'SHOPPINGLIST_ITEMS_ADD';
|
||||||
|
|
||||||
const PERMISSION_SHOPPINGLIST_ITEMS_DELETE = 'SHOPPINGLIST_ITEMS_DELETE';
|
const PERMISSION_SHOPPINGLIST_ITEMS_DELETE = 'SHOPPINGLIST_ITEMS_DELETE';
|
||||||
|
|
||||||
const PERMISSION_STOCK = 'STOCK';
|
const PERMISSION_STOCK = 'STOCK';
|
||||||
|
|
||||||
const PERMISSION_STOCK_CONSUME = 'STOCK_CONSUME';
|
const PERMISSION_STOCK_CONSUME = 'STOCK_CONSUME';
|
||||||
|
|
||||||
const PERMISSION_STOCK_EDIT = 'STOCK_EDIT';
|
const PERMISSION_STOCK_EDIT = 'STOCK_EDIT';
|
||||||
|
|
||||||
const PERMISSION_STOCK_INVENTORY = 'STOCK_INVENTORY';
|
const PERMISSION_STOCK_INVENTORY = 'STOCK_INVENTORY';
|
||||||
|
|
||||||
const PERMISSION_STOCK_OPEN = 'STOCK_OPEN';
|
const PERMISSION_STOCK_OPEN = 'STOCK_OPEN';
|
||||||
|
|
||||||
const PERMISSION_STOCK_PURCHASE = 'STOCK_PURCHASE';
|
const PERMISSION_STOCK_PURCHASE = 'STOCK_PURCHASE';
|
||||||
|
|
||||||
const PERMISSION_STOCK_TRANSFER = 'STOCK_TRANSFER';
|
const PERMISSION_STOCK_TRANSFER = 'STOCK_TRANSFER';
|
||||||
|
|
||||||
const PERMISSION_TASKS = 'TASKS';
|
const PERMISSION_TASKS = 'TASKS';
|
||||||
|
|
||||||
const PERMISSION_TASKS_MARK_COMPLETED = 'TASKS_MARK_COMPLETED';
|
const PERMISSION_TASKS_MARK_COMPLETED = 'TASKS_MARK_COMPLETED';
|
||||||
|
|
||||||
const PERMISSION_TASKS_UNDO_EXECUTION = 'TASKS_UNDO_EXECUTION';
|
const PERMISSION_TASKS_UNDO_EXECUTION = 'TASKS_UNDO_EXECUTION';
|
||||||
|
|
||||||
const PERMISSION_USERS = 'USERS';
|
const PERMISSION_USERS = 'USERS';
|
||||||
|
|
||||||
const PERMISSION_USERS_CREATE = 'USERS_CREATE';
|
const PERMISSION_USERS_CREATE = 'USERS_CREATE';
|
||||||
|
|
||||||
const PERMISSION_USERS_EDIT = 'USERS_EDIT';
|
const PERMISSION_USERS_EDIT = 'USERS_EDIT';
|
||||||
|
|
||||||
const PERMISSION_USERS_EDIT_SELF = 'USERS_EDIT_SELF';
|
const PERMISSION_USERS_EDIT_SELF = 'USERS_EDIT_SELF';
|
||||||
|
|
||||||
const PERMISSION_USERS_READ = 'USERS_READ';
|
const PERMISSION_USERS_READ = 'USERS_READ';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -72,9 +43,6 @@ class User
|
|||||||
$this->db = DatabaseService::getInstance()->GetDbConnection();
|
$this->db = DatabaseService::getInstance()->GetDbConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \LessQL\Database|null
|
|
||||||
*/
|
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
public static function PermissionList()
|
public static function PermissionList()
|
||||||
@@ -83,16 +51,12 @@ class User
|
|||||||
return $user->getPermissionList();
|
return $user->getPermissionList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function checkPermission($request, string ...$permissions): void
|
public static function checkPermission($request, string $permission): void
|
||||||
{
|
{
|
||||||
$user = new self();
|
$user = new self();
|
||||||
|
if (!$user->hasPermission($permission))
|
||||||
foreach ($permissions as $permission)
|
|
||||||
{
|
{
|
||||||
if (!$user->hasPermission($permission))
|
throw new PermissionMissingException($request, $permission);
|
||||||
{
|
|
||||||
throw new PermissionMissingException($request, $permission);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,10 +3,12 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Controllers\Users\User;
|
use Grocy\Controllers\Users\User;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class UsersApiController extends BaseApiController
|
class UsersApiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public function AddPermission(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function AddPermission(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -29,7 +31,7 @@ class UsersApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CreateUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function CreateUser(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_USERS_CREATE);
|
User::checkPermission($request, User::PERMISSION_USERS_CREATE);
|
||||||
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
|
$requestBody = $this->GetParsedAndFilteredRequestBody($request);
|
||||||
@@ -50,7 +52,7 @@ class UsersApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DeleteUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function DeleteUser(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_USERS_EDIT);
|
User::checkPermission($request, User::PERMISSION_USERS_EDIT);
|
||||||
try
|
try
|
||||||
@@ -64,7 +66,7 @@ class UsersApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function EditUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function EditUser(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['userId'] == GROCY_USER_ID)
|
if ($args['userId'] == GROCY_USER_ID)
|
||||||
{
|
{
|
||||||
@@ -88,7 +90,7 @@ class UsersApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetUserSetting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetUserSetting(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -101,7 +103,7 @@ class UsersApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetUserSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetUserSettings(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -113,7 +115,7 @@ class UsersApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetUsers(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function GetUsers(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_USERS_READ);
|
User::checkPermission($request, User::PERMISSION_USERS_READ);
|
||||||
try
|
try
|
||||||
@@ -126,7 +128,7 @@ class UsersApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CurrentUser(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function CurrentUser(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -138,7 +140,7 @@ class UsersApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ListPermissions(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function ListPermissions(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -159,7 +161,7 @@ class UsersApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetPermissions(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function SetPermissions(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -204,7 +206,7 @@ class UsersApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetUserSetting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function SetUserSetting(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -219,7 +221,7 @@ class UsersApiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DeleteUserSetting(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function DeleteUserSetting(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -3,10 +3,12 @@
|
|||||||
namespace Grocy\Controllers;
|
namespace Grocy\Controllers;
|
||||||
|
|
||||||
use Grocy\Controllers\Users\User;
|
use Grocy\Controllers\Users\User;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class UsersController extends BaseController
|
class UsersController extends BaseController
|
||||||
{
|
{
|
||||||
public function PermissionList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function PermissionList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_USERS_READ);
|
User::checkPermission($request, User::PERMISSION_USERS_READ);
|
||||||
return $this->renderPage($response, 'userpermissions', [
|
return $this->renderPage($response, 'userpermissions', [
|
||||||
@@ -16,7 +18,7 @@ class UsersController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UserEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UserEditForm(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
if ($args['userId'] == 'new')
|
if ($args['userId'] == 'new')
|
||||||
{
|
{
|
||||||
@@ -46,10 +48,11 @@ class UsersController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UserSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UserSettings(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'usersettings', [
|
return $this->renderPage($response, 'usersettings', [
|
||||||
'languages' => array_filter(scandir(__DIR__ . '/../localization'), function ($item) {
|
'languages' => array_filter(scandir(__DIR__ . '/../localization'), function ($item)
|
||||||
|
{
|
||||||
if ($item == '.' || $item == '..')
|
if ($item == '.' || $item == '..')
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -60,7 +63,7 @@ class UsersController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UsersList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function UsersList(Request $request, Response $response, array $args)
|
||||||
{
|
{
|
||||||
User::checkPermission($request, User::PERMISSION_USERS_READ);
|
User::checkPermission($request, User::PERMISSION_USERS_READ);
|
||||||
return $this->renderPage($response, 'users', [
|
return $this->renderPage($response, 'users', [
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
grocycode
|
Grocycode
|
||||||
==========
|
==========
|
||||||
|
|
||||||
grocycode is, in essence, a simple way to reference to arbitrary grocy entities.
|
Grocycode is, in essence, a simple way to reference to arbitrary Grocy entities.
|
||||||
Each grocycode includes a magic, an entitiy identifier, an id and an ordered set of extra data.
|
Each Grocycode includes a magic, an entitiy identifier, an id and an ordered set of extra data.
|
||||||
It is supported to be entered anywhere grocy expects one to read a barcode, but can also reference
|
It is supported to be entered anywhere Grocy expects one to read a barcode, but can also reference
|
||||||
grocy-internal properties like specific stock entries, or specific batteries.
|
Grocy-internal properties like specific stock entries, or specific batteries.
|
||||||
|
|
||||||
Serialization
|
Serialization
|
||||||
----
|
----
|
||||||
|
|
||||||
There are three mandatory parts in a grocycode:
|
There are three mandatory parts in a Grocycode:
|
||||||
|
|
||||||
1. The magic `grcy`
|
1. The magic `grcy`
|
||||||
2. An entity identifer matching the regular expression `[a-z]+` (that is, lowercase english alphabet without any fancy accents, minimum length 1 character).
|
2. An entity identifer matching the regular expression `[a-z]+` (that is, lowercase english alphabet without any fancy accents, minimum length 1 character).
|
||||||
|
@@ -6,21 +6,21 @@ To enable label printing, set `FEATURE_FLAG_LABEL_PRINTER` to `true`in your `con
|
|||||||
Why webhook?
|
Why webhook?
|
||||||
---
|
---
|
||||||
|
|
||||||
Label printers come in all shapes and forms, and your particular one is probably not the one used by the author of this feature. Also, grocy may does not have a
|
Label printers come in all shapes and forms, and your particular one is probably not the one used by the author of this feature. Also, Grocy may does not have a
|
||||||
direct connection to a local label printer (e.g. grocy is hosted in a cloud vps). Thus, a lightweight implementation is provided by grocy: whenever something
|
direct connection to a local label printer (e.g. Grocy is hosted in a cloud vps). Thus, a lightweight implementation is provided by Grocy: whenever something
|
||||||
should print, a POST request to a configured URL is made. The target then is responsible for label printing.
|
should print, a POST request to a configured URL is made. The target then is responsible for label printing.
|
||||||
|
|
||||||
Reference implementation
|
Reference implementation
|
||||||
---
|
---
|
||||||
|
|
||||||
The webhook was developed and tested against a Brother QL-600 label printer, using endless 62mm label paper. The webhook provider implementation was
|
The webhook was developed and tested against a Brother QL-600 label printer, using Brother DK-2205 endless 62mm label paper. The webhook provider implementation was
|
||||||
implemented into [a fork of brother_ql_web](https://github.com/mistressofjellyfish/brother_ql_web).
|
implemented into [a fork of brother_ql_web](https://github.com/mistressofjellyfish/brother_ql_web).
|
||||||
|
|
||||||
Webhook request
|
Webhook request
|
||||||
---
|
---
|
||||||
|
|
||||||
Requests can be configured to be sent server-side (that is, from the machine hosting grocy through GuzzleHttp) or by an AJAX request directly from the browser.
|
Requests can be configured to be sent server-side (that is, from the machine hosting Grocy through GuzzleHttp) or by an AJAX request directly from the browser.
|
||||||
The latter is neccesary for situations where the grocy hosting machine cannot reach your label printer, however server-side requests are a bit faster and
|
The latter is neccesary for situations where the Grocy hosting machine cannot reach your label printer, however server-side requests are a bit faster and
|
||||||
tend to be more stable.
|
tend to be more stable.
|
||||||
|
|
||||||
Both methods fire this request upon printing:
|
Both methods fire this request upon printing:
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"openapi": "3.0.0",
|
"openapi": "3.1.0",
|
||||||
"info": {
|
"info": {
|
||||||
"title": "grocy REST API",
|
"title": "Grocy REST API",
|
||||||
"description": "Authentication is done via API keys (header *GROCY-API-KEY* or same named query parameter), which you can manage [here](PlaceHolderManageApiKeysUrl).<br>Additionally requests from within the frontend are also valid (via session cookie).",
|
"description": "Authentication is done via API keys (header *GROCY-API-KEY* or same named query parameter), which you can manage [here](PlaceHolderManageApiKeysUrl).<br>Additionally requests from within the frontend are also valid (via session cookie).",
|
||||||
"version": "xxx",
|
"version": "xxx",
|
||||||
"license": {
|
"license": {
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"/system/info": {
|
"/system/info": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Returns information about the installed grocy, PHP and SQLite version",
|
"summary": "Returns information about the installed Grocy version, PHP runtime and OS",
|
||||||
"tags": [
|
"tags": [
|
||||||
"System"
|
"System"
|
||||||
],
|
],
|
||||||
@@ -391,8 +391,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"created_object_id": {
|
"created_object_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "The id of the created object"
|
"description": "The id of the created object"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -639,7 +638,7 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"description": "A valid object id of the given entity",
|
"description": "A valid object id of the given entity",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "integer"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -688,7 +687,7 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"description": "A valid object id of the given entity",
|
"description": "A valid object id of the given entity",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "integer"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -764,7 +763,7 @@
|
|||||||
"required": false,
|
"required": false,
|
||||||
"description": "Only when using `force_serve_as` = `picture`: Downscale the picture to the given height while maintaining the aspect ratio",
|
"description": "Only when using `force_serve_as` = `picture`: Downscale the picture to the given height while maintaining the aspect ratio",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "integer"
|
"type": "number"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -773,7 +772,7 @@
|
|||||||
"required": false,
|
"required": false,
|
||||||
"description": "Only when using `force_serve_as` = `picture`: Downscale the picture to the given width while maintaining the aspect ratio",
|
"description": "Only when using `force_serve_as` = `picture`: Downscale the picture to the given width while maintaining the aspect ratio",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "integer"
|
"type": "number"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1480,7 +1479,6 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"amount": {
|
"amount": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "number",
|
|
||||||
"description": "The amount to add - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
"description": "The amount to add - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
||||||
},
|
},
|
||||||
"best_before_date": {
|
"best_before_date": {
|
||||||
@@ -1490,7 +1488,6 @@
|
|||||||
},
|
},
|
||||||
"price": {
|
"price": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "number",
|
|
||||||
"description": "The price per stock quantity unit in configured currency"
|
"description": "The price per stock quantity unit in configured currency"
|
||||||
},
|
},
|
||||||
"open": {
|
"open": {
|
||||||
@@ -1498,13 +1495,11 @@
|
|||||||
"description": "If the stock entry was already opened or not"
|
"description": "If the stock entry was already opened or not"
|
||||||
},
|
},
|
||||||
"location_id": {
|
"location_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "If omitted, the default location of the product is used"
|
"description": "If omitted, the default location of the product is used"
|
||||||
},
|
},
|
||||||
"shopping_location_id": {
|
"shopping_location_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "If omitted, no store will be affected"
|
"description": "If omitted, no store will be affected"
|
||||||
},
|
},
|
||||||
"purchased_date": {
|
"purchased_date": {
|
||||||
@@ -1555,7 +1550,7 @@
|
|||||||
},
|
},
|
||||||
"/stock/entry/{entryId}/printlabel": {
|
"/stock/entry/{entryId}/printlabel": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Prints the grocycode / stock entry label of the given entry on the configured label printer",
|
"summary": "Prints the Grocycode / stock entry label of the given entry on the configured label printer",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Stock"
|
"Stock"
|
||||||
],
|
],
|
||||||
@@ -1891,7 +1886,6 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"amount": {
|
"amount": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "number",
|
|
||||||
"description": "The amount to add - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
"description": "The amount to add - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
||||||
},
|
},
|
||||||
"best_before_date": {
|
"best_before_date": {
|
||||||
@@ -1904,22 +1898,23 @@
|
|||||||
},
|
},
|
||||||
"price": {
|
"price": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "number",
|
|
||||||
"description": "The price per stock quantity unit in configured currency"
|
"description": "The price per stock quantity unit in configured currency"
|
||||||
},
|
},
|
||||||
"location_id": {
|
"location_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "If omitted, the default location of the product is used"
|
"description": "If omitted, the default location of the product is used"
|
||||||
},
|
},
|
||||||
"shopping_location_id": {
|
"shopping_location_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "If omitted, no store will be affected"
|
"description": "If omitted, no store will be affected"
|
||||||
},
|
},
|
||||||
"print_stock_label": {
|
"stock_label_type": {
|
||||||
"type": "boolean",
|
"type": "integer",
|
||||||
"description": "True when the stock entry label should be printed"
|
"description": "`1` = No label, `2` = Single label, `3` = Label per unit"
|
||||||
|
},
|
||||||
|
"note": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "An optional note for the corresponding stock entry"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
@@ -1999,13 +1994,11 @@
|
|||||||
"description": "A specific stock entry id to consume, if used, the amount has to be 1"
|
"description": "A specific stock entry id to consume, if used, the amount has to be 1"
|
||||||
},
|
},
|
||||||
"recipe_id": {
|
"recipe_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "A valid recipe id for which this product was used (for statistical purposes only)"
|
"description": "A valid recipe id for which this product was used (for statistical purposes only)"
|
||||||
},
|
},
|
||||||
"location_id": {
|
"location_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "A valid location id (if supplied, only stock at the given location is considered, if ommitted, stock of any location is considered)"
|
"description": "A valid location id (if supplied, only stock at the given location is considered, if ommitted, stock of any location is considered)"
|
||||||
},
|
},
|
||||||
"exact_amount": {
|
"exact_amount": {
|
||||||
@@ -2014,7 +2007,7 @@
|
|||||||
},
|
},
|
||||||
"allow_subproduct_substitution": {
|
"allow_subproduct_substitution": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "`True` when any in-stock sub product should be used when the given product is a parent product and currently not in-stock"
|
"description": "`true` when any in-stock sub product should be used when the given product is a parent product and currently not in-stock"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
@@ -2082,13 +2075,11 @@
|
|||||||
"description": "The amount to transfer - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
"description": "The amount to transfer - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
||||||
},
|
},
|
||||||
"location_id_from": {
|
"location_id_from": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "A valid location id, the location from where the product should be transfered"
|
"description": "A valid location id, the location from where the product should be transfered"
|
||||||
},
|
},
|
||||||
"location_id_to": {
|
"location_id_to": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "A valid location id, the location to where the product should be transfered"
|
"description": "A valid location id, the location to where the product should be transfered"
|
||||||
},
|
},
|
||||||
"stock_entry_id": {
|
"stock_entry_id": {
|
||||||
@@ -2157,7 +2148,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"new_amount": {
|
"new_amount": {
|
||||||
"type": "integer",
|
"type": "number",
|
||||||
"description": "The new current amount for the given product - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
"description": "The new current amount for the given product - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
||||||
},
|
},
|
||||||
"best_before_date": {
|
"best_before_date": {
|
||||||
@@ -2166,19 +2157,24 @@
|
|||||||
"description": "The due date which applies to added products"
|
"description": "The due date which applies to added products"
|
||||||
},
|
},
|
||||||
"shopping_location_id": {
|
"shopping_location_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "If omitted, no store will be affected"
|
"description": "If omitted, no store will be affected"
|
||||||
},
|
},
|
||||||
"location_id": {
|
"location_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "If omitted, the default location of the product is used (only applies to added products)"
|
"description": "If omitted, the default location of the product is used (only applies to added products)"
|
||||||
},
|
},
|
||||||
"price": {
|
"price": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "number",
|
|
||||||
"description": "If omitted, the last price of the product is used (only applies to added products)"
|
"description": "If omitted, the last price of the product is used (only applies to added products)"
|
||||||
|
},
|
||||||
|
"stock_label_type": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "`1` = No label, `2` = Single label, `3` = Label per unit (only applies to added products)"
|
||||||
|
},
|
||||||
|
"note": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "An optional note for the corresponding stock entry (only applies to added products)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2246,7 +2242,7 @@
|
|||||||
},
|
},
|
||||||
"allow_subproduct_substitution": {
|
"allow_subproduct_substitution": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "`True` when any in-stock sub product should be used when the given product is a parent product and currently not in-stock"
|
"description": "`true` when any in-stock sub product should be used when the given product is a parent product and currently not in-stock"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
@@ -2285,7 +2281,7 @@
|
|||||||
},
|
},
|
||||||
"/stock/products/{productId}/printlabel": {
|
"/stock/products/{productId}/printlabel": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Prints the grocycode label of the given product on the configured label printer",
|
"summary": "Prints the Grocycode label of the given product on the configured label printer",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Stock"
|
"Stock"
|
||||||
],
|
],
|
||||||
@@ -2435,7 +2431,6 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"amount": {
|
"amount": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "number",
|
|
||||||
"description": "The amount to add - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
"description": "The amount to add - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
||||||
},
|
},
|
||||||
"best_before_date": {
|
"best_before_date": {
|
||||||
@@ -2448,12 +2443,10 @@
|
|||||||
},
|
},
|
||||||
"price": {
|
"price": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "number",
|
|
||||||
"description": "The price per stock quantity unit in configured currency"
|
"description": "The price per stock quantity unit in configured currency"
|
||||||
},
|
},
|
||||||
"location_id": {
|
"location_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "If omitted, the default location of the product is used"
|
"description": "If omitted, the default location of the product is used"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -2534,13 +2527,11 @@
|
|||||||
"description": "A specific stock entry id to consume, if used, the amount has to be 1"
|
"description": "A specific stock entry id to consume, if used, the amount has to be 1"
|
||||||
},
|
},
|
||||||
"recipe_id": {
|
"recipe_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "A valid recipe id for which this product was used (for statistical purposes only)"
|
"description": "A valid recipe id for which this product was used (for statistical purposes only)"
|
||||||
},
|
},
|
||||||
"location_id": {
|
"location_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "A valid location id (if supplied, only stock at the given location is considered, if ommitted, stock of any location is considered)"
|
"description": "A valid location id (if supplied, only stock at the given location is considered, if ommitted, stock of any location is considered)"
|
||||||
},
|
},
|
||||||
"exact_amount": {
|
"exact_amount": {
|
||||||
@@ -2549,7 +2540,7 @@
|
|||||||
},
|
},
|
||||||
"allow_subproduct_substitution": {
|
"allow_subproduct_substitution": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "`True` when any in-stock sub product should be used when the given product is a parent product and currently not in-stock"
|
"description": "`rue` when any in-stock sub product should be used when the given product is a parent product and currently not in-stock"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
@@ -2617,13 +2608,11 @@
|
|||||||
"description": "The amount to transfer - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
"description": "The amount to transfer - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
||||||
},
|
},
|
||||||
"location_id_from": {
|
"location_id_from": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "A valid location id, the location from where the product should be transfered"
|
"description": "A valid location id, the location from where the product should be transfered"
|
||||||
},
|
},
|
||||||
"location_id_to": {
|
"location_id_to": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "A valid location id, the location to where the product should be transfered"
|
"description": "A valid location id, the location to where the product should be transfered"
|
||||||
},
|
},
|
||||||
"stock_entry_id": {
|
"stock_entry_id": {
|
||||||
@@ -2692,7 +2681,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"new_amount": {
|
"new_amount": {
|
||||||
"type": "integer",
|
"type": "number",
|
||||||
"description": "The new current amount for the given product - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
"description": "The new current amount for the given product - please note that when tare weight handling for the product is enabled, this needs to be the amount including the container weight (gross), the amount to be posted will be automatically calculated based on what is in stock and the defined tare weight"
|
||||||
},
|
},
|
||||||
"best_before_date": {
|
"best_before_date": {
|
||||||
@@ -2701,13 +2690,11 @@
|
|||||||
"description": "The due date which applies to added products"
|
"description": "The due date which applies to added products"
|
||||||
},
|
},
|
||||||
"location_id": {
|
"location_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "If omitted, the default location of the product is used (only applies to added products)"
|
"description": "If omitted, the default location of the product is used (only applies to added products)"
|
||||||
},
|
},
|
||||||
"price": {
|
"price": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "number",
|
|
||||||
"description": "If omitted, the last price of the product is used (only applies to added products)"
|
"description": "If omitted, the last price of the product is used (only applies to added products)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2776,7 +2763,7 @@
|
|||||||
},
|
},
|
||||||
"allow_subproduct_substitution": {
|
"allow_subproduct_substitution": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "`True` when any in-stock sub product should be used when the given product is a parent product and currently not in-stock"
|
"description": "`rue` when any in-stock sub product should be used when the given product is a parent product and currently not in-stock"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
@@ -2813,6 +2800,72 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/stock/locations/{locationId}/entries": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Returns all stock entries of the given location",
|
||||||
|
"tags": [
|
||||||
|
"Stock"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "locationId",
|
||||||
|
"required": true,
|
||||||
|
"description": "A valid location id",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/parameters/query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/parameters/order"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/parameters/limit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/parameters/offset"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "An array of StockEntry objects",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/StockEntry"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "The operation was not successful (possible errors are: Not existing location)",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Error400"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "The operation was not successful (possible errors are invalid field names or conditions in filter parameters provided)",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Error500"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/stock/shoppinglist/add-missing-products": {
|
"/stock/shoppinglist/add-missing-products": {
|
||||||
"post": {
|
"post": {
|
||||||
"summary": "Adds currently missing products (below defined min. stock amount) to the given shopping list",
|
"summary": "Adds currently missing products (below defined min. stock amount) to the given shopping list",
|
||||||
@@ -2955,10 +3008,15 @@
|
|||||||
"list_id": {
|
"list_id": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "The shopping list id to clear, when omitted, the default shopping list (with id 1) is used"
|
"description": "The shopping list id to clear, when omitted, the default shopping list (with id 1) is used"
|
||||||
|
},
|
||||||
|
"done_only": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "When `true`, only done items will be removed (defaults to `false` when ommited)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
"list_id": 2
|
"list_id": 2,
|
||||||
|
"done_only": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2997,15 +3055,19 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"product_id": {
|
"product_id": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "A valid product id of the item on the shopping list"
|
"description": "A valid product id of the product to be added"
|
||||||
|
},
|
||||||
|
"qu_id": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "A valid quantity unit id (used only for display; the amount needs to be related to the products stock QU), when omitted, the products stock QU is used"
|
||||||
},
|
},
|
||||||
"list_id": {
|
"list_id": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "A valid shopping list id, when omitted, the default shopping list (with id 1) is used"
|
"description": "A valid shopping list id, when omitted, the default shopping list (with id 1) is used"
|
||||||
},
|
},
|
||||||
"product_amount": {
|
"product_amount": {
|
||||||
"type": "integer",
|
"type": "number",
|
||||||
"description": "The amount of product units to add, when omitted, the default amount of 1 is used"
|
"description": "The amount (related to the products stock QU) to add, when omitted, the default amount of 1 is used"
|
||||||
},
|
},
|
||||||
"note": {
|
"note": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -3062,7 +3124,7 @@
|
|||||||
"description": "A valid shopping list id, when omitted, the default shopping list (with id 1) is used"
|
"description": "A valid shopping list id, when omitted, the default shopping list (with id 1) is used"
|
||||||
},
|
},
|
||||||
"product_amount": {
|
"product_amount": {
|
||||||
"type": "integer",
|
"type": "number",
|
||||||
"description": "The amount of product units to remove, when omitted, the default amount of 1 is used"
|
"description": "The amount of product units to remove, when omitted, the default amount of 1 is used"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3323,8 +3385,7 @@
|
|||||||
"excludedProductIds": {
|
"excludedProductIds": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "number",
|
"type": "integer"
|
||||||
"format": "integer"
|
|
||||||
},
|
},
|
||||||
"description": "An optional array of product ids to exclude them from being put on the shopping list"
|
"description": "An optional array of product ids to exclude them from being put on the shopping list"
|
||||||
}
|
}
|
||||||
@@ -3401,6 +3462,16 @@
|
|||||||
"responses": {
|
"responses": {
|
||||||
"204": {
|
"204": {
|
||||||
"description": "The operation was successful"
|
"description": "The operation was successful"
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "The operation was not successful (possible errors are: Invalid recipe id, recipe need is not fulfilled)",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Error400"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3488,8 +3559,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"created_object_id": {
|
"created_object_id": {
|
||||||
"type": "number",
|
"type": "integer",
|
||||||
"format": "integer",
|
|
||||||
"description": "The id of the created recipe"
|
"description": "The id of the created recipe"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3510,6 +3580,48 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/recipes/{recipeId}/printlabel": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Prints the Grocycode label of the given recipe on the configured label printer",
|
||||||
|
"tags": [
|
||||||
|
"Recipes"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "recipeId",
|
||||||
|
"required": true,
|
||||||
|
"description": "A valid recipe id",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The operation was successful",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "WebHook data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "The operation was not successful (possible errors are: Not existing recipe, error on WebHook execution)",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Error400"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/chores": {
|
"/chores": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Returns all chores incl. the next estimated execution time per chore",
|
"summary": "Returns all chores incl. the next estimated execution time per chore",
|
||||||
@@ -3630,6 +3742,11 @@
|
|||||||
"done_by": {
|
"done_by": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "A valid user id of who executed this chore, when omitted, the currently authenticated user will be used"
|
"description": "A valid user id of who executed this chore, when omitted, the currently authenticated user will be used"
|
||||||
|
},
|
||||||
|
"skipped": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "`true` when the execution should be tracked as skipped, defaults to `false` when omitted"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3738,7 +3855,7 @@
|
|||||||
},
|
},
|
||||||
"/chores/{choreId}/printlabel": {
|
"/chores/{choreId}/printlabel": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Prints the grocycode label of the given chore on the configured label printer",
|
"summary": "Prints the Grocycode label of the given chore on the configured label printer",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Chores"
|
"Chores"
|
||||||
],
|
],
|
||||||
@@ -3778,6 +3895,49 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/chores/{choreIdToKeep}/merge/{choreIdToRemove}": {
|
||||||
|
"post": {
|
||||||
|
"summary": "Merges two chores into one",
|
||||||
|
"tags": [
|
||||||
|
"Chores"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "choreIdToKeep",
|
||||||
|
"required": true,
|
||||||
|
"description": "A valid chore id of the chore to keep",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "choreIdToRemove",
|
||||||
|
"required": true,
|
||||||
|
"description": "A valid chore id of the chore to remove",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "The operation was successful"
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "The operation was not successful (possible errors are: Invalid chore id)",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Error400"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/batteries": {
|
"/batteries": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Returns all batteries incl. the next estimated charge time per battery",
|
"summary": "Returns all batteries incl. the next estimated charge time per battery",
|
||||||
@@ -3960,7 +4120,7 @@
|
|||||||
},
|
},
|
||||||
"/batteries/{batteryId}/printlabel": {
|
"/batteries/{batteryId}/printlabel": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Prints the grocycode label of the given battery on the configured label printer",
|
"summary": "Prints the Grocycode label of the given battery on the configured label printer",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Batteries"
|
"Batteries"
|
||||||
],
|
],
|
||||||
@@ -4208,7 +4368,7 @@
|
|||||||
"in": "query",
|
"in": "query",
|
||||||
"name": "printHeader",
|
"name": "printHeader",
|
||||||
"required": false,
|
"required": false,
|
||||||
"description": "Prints grocy logo if true",
|
"description": "Prints Grocy logo if true",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
@@ -4277,20 +4437,11 @@
|
|||||||
"product_group_id": {
|
"product_group_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"qu_factor_purchase_to_stock": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "number"
|
|
||||||
},
|
|
||||||
"tare_weight": {
|
"tare_weight": {
|
||||||
"type": "number",
|
"type": "number"
|
||||||
"format": "number"
|
|
||||||
},
|
|
||||||
"barcode": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Can contain multiple barcodes separated by comma"
|
|
||||||
},
|
},
|
||||||
"min_stock_amount": {
|
"min_stock_amount": {
|
||||||
"type": "integer",
|
"type": "number",
|
||||||
"minimum": 0,
|
"minimum": 0,
|
||||||
"default": 0
|
"default": 0
|
||||||
},
|
},
|
||||||
@@ -4314,9 +4465,27 @@
|
|||||||
"shopping_location_id": {
|
"shopping_location_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"treat_opened_as_out_of_stock": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"auto_reprint_stock_label": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"no_own_stock": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
"userfields": {
|
"userfields": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"description": "Key/value pairs of userfields"
|
"description": "Key/value pairs of userfields"
|
||||||
|
},
|
||||||
|
"should_not_be_frozen": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"default_consume_location_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"move_on_open": {
|
||||||
|
"type": "integer"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
@@ -4326,8 +4495,6 @@
|
|||||||
"location_id": "4",
|
"location_id": "4",
|
||||||
"qu_id_purchase": "3",
|
"qu_id_purchase": "3",
|
||||||
"qu_id_stock": "3",
|
"qu_id_stock": "3",
|
||||||
"qu_factor_purchase_to_stock": "1.0",
|
|
||||||
"barcode": "cok1",
|
|
||||||
"min_stock_amount": "8",
|
"min_stock_amount": "8",
|
||||||
"default_best_before_days": "0",
|
"default_best_before_days": "0",
|
||||||
"row_created_timestamp": "2019-05-02 20:12:26",
|
"row_created_timestamp": "2019-05-02 20:12:26",
|
||||||
@@ -4338,7 +4505,10 @@
|
|||||||
"tare_weight": "0.0",
|
"tare_weight": "0.0",
|
||||||
"not_check_stock_fulfillment_for_recipes": "0",
|
"not_check_stock_fulfillment_for_recipes": "0",
|
||||||
"shopping_location_id": null,
|
"shopping_location_id": null,
|
||||||
"userfields": null
|
"userfields": null,
|
||||||
|
"should_not_be_frozen": "1",
|
||||||
|
"default_consume_location_id": "5",
|
||||||
|
"move_on_open": "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"QuantityUnit": {
|
"QuantityUnit": {
|
||||||
@@ -4446,7 +4616,7 @@
|
|||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"amount": {
|
"amount": {
|
||||||
"type": "integer"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"location_id": {
|
"location_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@@ -4506,6 +4676,9 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date"
|
"format": "date"
|
||||||
},
|
},
|
||||||
|
"note": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"row_created_timestamp": {
|
"row_created_timestamp": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
@@ -4542,8 +4715,7 @@
|
|||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"costs": {
|
"costs": {
|
||||||
"type": "number",
|
"type": "number"
|
||||||
"format": "number"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
@@ -4563,10 +4735,16 @@
|
|||||||
"product_barcodes": {
|
"product_barcodes": {
|
||||||
"$ref": "#/components/schemas/ProductBarcode"
|
"$ref": "#/components/schemas/ProductBarcode"
|
||||||
},
|
},
|
||||||
|
"quantity_unit_stock": {
|
||||||
|
"$ref": "#/components/schemas/QuantityUnit"
|
||||||
|
},
|
||||||
"default_quantity_unit_purchase": {
|
"default_quantity_unit_purchase": {
|
||||||
"$ref": "#/components/schemas/QuantityUnit"
|
"$ref": "#/components/schemas/QuantityUnit"
|
||||||
},
|
},
|
||||||
"quantity_unit_stock": {
|
"default_quantity_unit_consume": {
|
||||||
|
"$ref": "#/components/schemas/QuantityUnit"
|
||||||
|
},
|
||||||
|
"quantity_unit_price": {
|
||||||
"$ref": "#/components/schemas/QuantityUnit"
|
"$ref": "#/components/schemas/QuantityUnit"
|
||||||
},
|
},
|
||||||
"last_purchased": {
|
"last_purchased": {
|
||||||
@@ -4578,10 +4756,10 @@
|
|||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"stock_amount": {
|
"stock_amount": {
|
||||||
"type": "integer"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"stock_amount_opened": {
|
"stock_amount_opened": {
|
||||||
"type": "integer"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"next_due_date": {
|
"next_due_date": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -4589,15 +4767,20 @@
|
|||||||
},
|
},
|
||||||
"last_price": {
|
"last_price": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "number"
|
"description": "The price of the last purchase of the corresponding product"
|
||||||
},
|
},
|
||||||
"avg_price": {
|
"avg_price": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "number"
|
"description": "The average price af all stock entries currently in stock of the corresponding product"
|
||||||
|
},
|
||||||
|
"current_price": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "The current price of the corresponding product, based on the stock entry to use next (defined by the default consume rule \"Opened first, then first due first, then first in first out\") or on the last price if the product is currently not in stock"
|
||||||
},
|
},
|
||||||
"oldest_price": {
|
"oldest_price": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "number"
|
"description": "This field is deprecated and will be removed in a future version (currently returns the same as `current_price`)",
|
||||||
|
"deprecated": true
|
||||||
},
|
},
|
||||||
"last_shopping_location_id": {
|
"last_shopping_location_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@@ -4606,16 +4789,25 @@
|
|||||||
"$ref": "#/components/schemas/Location"
|
"$ref": "#/components/schemas/Location"
|
||||||
},
|
},
|
||||||
"average_shelf_life_days": {
|
"average_shelf_life_days": {
|
||||||
"type": "number",
|
"type": "number"
|
||||||
"format": "integer"
|
|
||||||
},
|
},
|
||||||
"spoil_rate_percent": {
|
"spoil_rate_percent": {
|
||||||
"type": "number",
|
"type": "number"
|
||||||
"format": "number"
|
|
||||||
},
|
},
|
||||||
"has_childs": {
|
"has_childs": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "True when the product is a parent products of others"
|
"description": "True when the product is a parent product of others"
|
||||||
|
},
|
||||||
|
"default_location": {
|
||||||
|
"$ref": "#/components/schemas/Location"
|
||||||
|
},
|
||||||
|
"qu_conversion_factor_purchase_to_stock": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "The conversion factor of the corresponding QU conversion from the product's qu_id_purchase to qu_id_stock"
|
||||||
|
},
|
||||||
|
"qu_conversion_factor_price_to_stock": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "The conversion factor of the corresponding QU conversion from the product's qu_id_price to qu_id_stock"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
@@ -4626,8 +4818,6 @@
|
|||||||
"location_id": "4",
|
"location_id": "4",
|
||||||
"qu_id_purchase": "3",
|
"qu_id_purchase": "3",
|
||||||
"qu_id_stock": "3",
|
"qu_id_stock": "3",
|
||||||
"qu_factor_purchase_to_stock": "1.0",
|
|
||||||
"barcode": "cok1",
|
|
||||||
"min_stock_amount": "8",
|
"min_stock_amount": "8",
|
||||||
"default_best_before_days": "0",
|
"default_best_before_days": "0",
|
||||||
"row_created_timestamp": "2019-05-02 20:12:26",
|
"row_created_timestamp": "2019-05-02 20:12:26",
|
||||||
@@ -4669,9 +4859,17 @@
|
|||||||
"name_plural": "Packs",
|
"name_plural": "Packs",
|
||||||
"plural_forms": null
|
"plural_forms": null
|
||||||
},
|
},
|
||||||
|
"quantity_unit_price": {
|
||||||
|
"id": "3",
|
||||||
|
"name": "Pack",
|
||||||
|
"description": null,
|
||||||
|
"row_created_timestamp": "2019-05-02 20:12:25",
|
||||||
|
"name_plural": "Packs",
|
||||||
|
"plural_forms": null
|
||||||
|
},
|
||||||
"last_price": null,
|
"last_price": null,
|
||||||
"avg_price": null,
|
"avg_price": null,
|
||||||
"oldest_price": null,
|
"current_price": null,
|
||||||
"last_shopping_location_id": null,
|
"last_shopping_location_id": null,
|
||||||
"next_due_date": "2019-07-07",
|
"next_due_date": "2019-07-07",
|
||||||
"location": {
|
"location": {
|
||||||
@@ -4681,7 +4879,8 @@
|
|||||||
"row_created_timestamp": "2019-05-02 20:12:25"
|
"row_created_timestamp": "2019-05-02 20:12:25"
|
||||||
},
|
},
|
||||||
"average_shelf_life_days": -1,
|
"average_shelf_life_days": -1,
|
||||||
"spoil_rate_percent": 0
|
"spoil_rate_percent": 0,
|
||||||
|
"default_consume_location": null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ProductPriceHistory": {
|
"ProductPriceHistory": {
|
||||||
@@ -4692,8 +4891,7 @@
|
|||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"price": {
|
"price": {
|
||||||
"type": "number",
|
"type": "number"
|
||||||
"format": "float"
|
|
||||||
},
|
},
|
||||||
"shopping_location": {
|
"shopping_location": {
|
||||||
"$ref": "#/components/schemas/ShoppingLocation"
|
"$ref": "#/components/schemas/ShoppingLocation"
|
||||||
@@ -4716,12 +4914,10 @@
|
|||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"amount": {
|
"amount": {
|
||||||
"type": "number",
|
"type": "number"
|
||||||
"format": "number"
|
|
||||||
},
|
},
|
||||||
"last_price": {
|
"last_price": {
|
||||||
"type": "number",
|
"type": "number"
|
||||||
"format": "float"
|
|
||||||
},
|
},
|
||||||
"note": {
|
"note": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@@ -4744,8 +4940,7 @@
|
|||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"qu_factor_purchase_to_stock": {
|
"qu_factor_purchase_to_stock": {
|
||||||
"type": "number",
|
"type": "number"
|
||||||
"format": "number"
|
|
||||||
},
|
},
|
||||||
"barcode": {
|
"barcode": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -4781,6 +4976,10 @@
|
|||||||
},
|
},
|
||||||
"next_execution_assigned_user": {
|
"next_execution_assigned_user": {
|
||||||
"$ref": "#/components/schemas/UserDto"
|
"$ref": "#/components/schemas/UserDto"
|
||||||
|
},
|
||||||
|
"average_execution_frequency_hours": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Contains the average past execution frequency in hours or `null`, when the chore was never executed before"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
@@ -5036,7 +5235,7 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
"manually",
|
"manually",
|
||||||
"dynamic-regular",
|
"hourly",
|
||||||
"daily",
|
"daily",
|
||||||
"weekly",
|
"weekly",
|
||||||
"monthly"
|
"monthly"
|
||||||
@@ -5069,6 +5268,17 @@
|
|||||||
"next_execution_assigned_to_user_id": {
|
"next_execution_assigned_to_user_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"start_date": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
},
|
||||||
|
"rescheduled_date": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
},
|
||||||
|
"rescheduled_next_execution_assigned_to_user_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
"row_created_timestamp": {
|
"row_created_timestamp": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
@@ -5120,7 +5330,7 @@
|
|||||||
},
|
},
|
||||||
"used_date": {
|
"used_date": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date"
|
||||||
},
|
},
|
||||||
"spoiled": {
|
"spoiled": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
@@ -5135,6 +5345,9 @@
|
|||||||
"transaction_type": {
|
"transaction_type": {
|
||||||
"$ref": "#/components/schemas/StockTransactionType"
|
"$ref": "#/components/schemas/StockTransactionType"
|
||||||
},
|
},
|
||||||
|
"note": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"row_created_timestamp": {
|
"row_created_timestamp": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
@@ -5155,8 +5368,7 @@
|
|||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"amount": {
|
"amount": {
|
||||||
"type": "number",
|
"type": "number"
|
||||||
"format": "float"
|
|
||||||
},
|
},
|
||||||
"location_id": {
|
"location_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@@ -5209,8 +5421,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"amount": {
|
"amount": {
|
||||||
"type": "number",
|
"type": "number"
|
||||||
"format": "float"
|
|
||||||
},
|
},
|
||||||
"user_id": {
|
"user_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@@ -5338,6 +5549,12 @@
|
|||||||
"next_execution_assigned_to_user_id": {
|
"next_execution_assigned_to_user_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"is_rescheduled": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"is_reassigned": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"next_execution_assigned_user": {
|
"next_execution_assigned_user": {
|
||||||
"$ref": "#/components/schemas/UserDto"
|
"$ref": "#/components/schemas/UserDto"
|
||||||
}
|
}
|
||||||
@@ -5580,7 +5797,11 @@
|
|||||||
"stock",
|
"stock",
|
||||||
"stock_current_locations",
|
"stock_current_locations",
|
||||||
"chores_log",
|
"chores_log",
|
||||||
"meal_plan_sections"
|
"meal_plan_sections",
|
||||||
|
"products_last_purchased",
|
||||||
|
"products_average_price",
|
||||||
|
"quantity_unit_conversions_resolved",
|
||||||
|
"recipes_pos_resolved"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ExposedEntityNoListing": {
|
"ExposedEntityNoListing": {
|
||||||
@@ -5596,7 +5817,11 @@
|
|||||||
"api_keys",
|
"api_keys",
|
||||||
"stock",
|
"stock",
|
||||||
"stock_current_locations",
|
"stock_current_locations",
|
||||||
"chores_log"
|
"chores_log",
|
||||||
|
"products_last_purchased",
|
||||||
|
"products_average_price",
|
||||||
|
"quantity_unit_conversions_resolved",
|
||||||
|
"recipes_pos_resolved"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ExposedEntityNoDelete": {
|
"ExposedEntityNoDelete": {
|
||||||
@@ -5605,14 +5830,16 @@
|
|||||||
"stock_log",
|
"stock_log",
|
||||||
"stock",
|
"stock",
|
||||||
"stock_current_locations",
|
"stock_current_locations",
|
||||||
"chores_log"
|
"chores_log",
|
||||||
|
"products_last_purchased",
|
||||||
|
"products_average_price",
|
||||||
|
"quantity_unit_conversions_resolved",
|
||||||
|
"recipes_pos_resolved"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ExposedEntityEditRequiresAdmin": {
|
"ExposedEntityEditRequiresAdmin": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": []
|
||||||
"api_keys"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"StockTransactionType": {
|
"StockTransactionType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@@ -11,7 +11,6 @@ abstract class BaseBarcodeLookupPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected $Locations;
|
protected $Locations;
|
||||||
|
|
||||||
protected $QuantityUnits;
|
protected $QuantityUnits;
|
||||||
|
|
||||||
final public function Lookup($barcode)
|
final public function Lookup($barcode)
|
||||||
|
@@ -63,7 +63,7 @@ class ConfigurationValidator
|
|||||||
private function checkMealplanFirstDayOfWeek()
|
private function checkMealplanFirstDayOfWeek()
|
||||||
{
|
{
|
||||||
if (!(GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK == '' ||
|
if (!(GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK == '' ||
|
||||||
(is_numeric(GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK) && GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK >= 0 && GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK <= 6)))
|
(is_numeric(GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK) && GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK >= -1 && GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK <= 6)))
|
||||||
{
|
{
|
||||||
throw new EInvalidConfig('Invalid value for MEAL_PLAN_FIRST_DAY_OF_WEEK');
|
throw new EInvalidConfig('Invalid value for MEAL_PLAN_FIRST_DAY_OF_WEEK');
|
||||||
}
|
}
|
||||||
|
@@ -3,10 +3,10 @@
|
|||||||
namespace Grocy\Helpers;
|
namespace Grocy\Helpers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that abstracts grocycode.
|
* A class that abstracts Grocycode.
|
||||||
*
|
*
|
||||||
* grocycode is a simple, easily serializable format to reference
|
* Grocycode is a simple, easily serializable format to reference
|
||||||
* stuff within grocy. It consists of n (n ≥ 3) double-colon seperated parts:
|
* stuff within Grocy. It consists of n (n ≥ 3) double-colon seperated parts:
|
||||||
*
|
*
|
||||||
* 1. The magic `grcy`
|
* 1. The magic `grcy`
|
||||||
* 2. A type identifer, must match `[a-z]+` (i.e. only lowercase ascii, minimum length 1 character)
|
* 2. A type identifer, must match `[a-z]+` (i.e. only lowercase ascii, minimum length 1 character)
|
||||||
@@ -18,19 +18,11 @@ namespace Grocy\Helpers;
|
|||||||
class Grocycode
|
class Grocycode
|
||||||
{
|
{
|
||||||
public const PRODUCT = 'p';
|
public const PRODUCT = 'p';
|
||||||
|
|
||||||
public const BATTERY = 'b';
|
public const BATTERY = 'b';
|
||||||
|
|
||||||
public const CHORE = 'c';
|
public const CHORE = 'c';
|
||||||
|
public const RECIPE = 'r';
|
||||||
public const MAGIC = 'grcy';
|
public const MAGIC = 'grcy';
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new instance of the Grocycode class.
|
|
||||||
*
|
|
||||||
* Because php doesn't support overloading, this is a proxy
|
|
||||||
* to either setFromCode($code) or setFromData($type, $id, $extra_data = []).
|
|
||||||
*/
|
|
||||||
public function __construct(...$args)
|
public function __construct(...$args)
|
||||||
{
|
{
|
||||||
$argc = count($args);
|
$argc = count($args);
|
||||||
@@ -52,24 +44,11 @@ class Grocycode
|
|||||||
throw new \Exception('No suitable overload found.');
|
throw new \Exception('No suitable overload found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static $Items = [self::PRODUCT, self::BATTERY, self::CHORE, self::RECIPE];
|
||||||
* An array that registers all valid grocycode types. Register yours here by appending to this array.
|
|
||||||
*/
|
|
||||||
public static $Items = [self::PRODUCT, self::BATTERY, self::CHORE];
|
|
||||||
|
|
||||||
private $type;
|
private $type;
|
||||||
|
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
private $extra_data = [];
|
private $extra_data = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates a grocycode.
|
|
||||||
*
|
|
||||||
* Returns true, if a supplied $code is a valid grocycode, false otherwise.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public static function Validate(string $code)
|
public static function Validate(string $code)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -105,29 +84,23 @@ class Grocycode
|
|||||||
return implode(':', $arr);
|
return implode(':', $arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses a grocycode.
|
|
||||||
*/
|
|
||||||
private function setFromCode($code)
|
private function setFromCode($code)
|
||||||
{
|
{
|
||||||
$parts = array_reverse(explode(':', $code));
|
$parts = array_reverse(explode(':', $code));
|
||||||
if (array_pop($parts) != self::MAGIC)
|
if (array_pop($parts) != self::MAGIC)
|
||||||
{
|
{
|
||||||
throw new \Exception('Not a grocycode');
|
throw new \Exception('Not a Grocycode');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($this->type = array_pop($parts), self::$Items))
|
if (!in_array($this->type = array_pop($parts), self::$Items))
|
||||||
{
|
{
|
||||||
throw new \Exception('Unknown grocycode type');
|
throw new \Exception('Unknown Grocycode type');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->id = array_pop($parts);
|
$this->id = array_pop($parts);
|
||||||
$this->extra_data = array_reverse($parts);
|
$this->extra_data = array_reverse($parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a grocycode from data.
|
|
||||||
*/
|
|
||||||
private function setFromData($type, $id, $extra_data = [])
|
private function setFromData($type, $id, $extra_data = [])
|
||||||
{
|
{
|
||||||
if (!is_array($extra_data))
|
if (!is_array($extra_data))
|
||||||
@@ -136,7 +109,7 @@ class Grocycode
|
|||||||
}
|
}
|
||||||
if (!in_array($type, self::$Items))
|
if (!in_array($type, self::$Items))
|
||||||
{
|
{
|
||||||
throw new \Exception('Unknown grocycode type');
|
throw new \Exception('Unknown Grocycode type');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
|
@@ -4,17 +4,19 @@ class ERequirementNotMet extends Exception
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const REQUIRED_PHP_EXTENSIONS = ['fileinfo', 'pdo_sqlite', 'gd', 'ctype', 'json', 'intl', 'zlib',
|
const REQUIRED_PHP_EXTENSIONS = ['fileinfo', 'pdo_sqlite', 'gd', 'ctype', 'json', 'intl', 'zlib', 'mbstring',
|
||||||
// These are core extensions, so normally can't be missing, but seems to be the case, however, on FreeBSD
|
// These are core extensions, so normally can't be missing, but seems to be the case, however, on FreeBSD
|
||||||
'filter', 'iconv', 'tokenizer'
|
'filter', 'iconv', 'tokenizer'
|
||||||
];
|
];
|
||||||
|
|
||||||
const REQUIRED_SQLITE_VERSION = '3.9.0';
|
const REQUIRED_PHP_VERSION = '8.1.0';
|
||||||
|
const REQUIRED_SQLITE_VERSION = '3.34.0';
|
||||||
|
|
||||||
class PrerequisiteChecker
|
class PrerequisiteChecker
|
||||||
{
|
{
|
||||||
public function checkRequirements()
|
public function checkRequirements()
|
||||||
{
|
{
|
||||||
|
self::checkForPhpVersion();
|
||||||
self::checkForConfigFile();
|
self::checkForConfigFile();
|
||||||
self::checkForConfigDistFile();
|
self::checkForConfigDistFile();
|
||||||
self::checkForComposer();
|
self::checkForComposer();
|
||||||
@@ -24,9 +26,9 @@ class PrerequisiteChecker
|
|||||||
|
|
||||||
private function checkForComposer()
|
private function checkForComposer()
|
||||||
{
|
{
|
||||||
if (!file_exists(__DIR__ . '/../vendor/autoload.php'))
|
if (!file_exists(__DIR__ . '/../packages/autoload.php'))
|
||||||
{
|
{
|
||||||
throw new ERequirementNotMet('/vendor/autoload.php not found. Have you run Composer?');
|
throw new ERequirementNotMet('/packages/autoload.php not found. Have you run Composer?');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +51,6 @@ class PrerequisiteChecker
|
|||||||
private function checkForPhpExtensions()
|
private function checkForPhpExtensions()
|
||||||
{
|
{
|
||||||
$loadedExtensions = get_loaded_extensions();
|
$loadedExtensions = get_loaded_extensions();
|
||||||
|
|
||||||
foreach (REQUIRED_PHP_EXTENSIONS as $extension)
|
foreach (REQUIRED_PHP_EXTENSIONS as $extension)
|
||||||
{
|
{
|
||||||
if (!in_array($extension, $loadedExtensions))
|
if (!in_array($extension, $loadedExtensions))
|
||||||
@@ -62,13 +63,21 @@ class PrerequisiteChecker
|
|||||||
private function checkForSqliteVersion()
|
private function checkForSqliteVersion()
|
||||||
{
|
{
|
||||||
$sqliteVersion = self::getSqlVersionAsString();
|
$sqliteVersion = self::getSqlVersionAsString();
|
||||||
|
|
||||||
if (version_compare($sqliteVersion, REQUIRED_SQLITE_VERSION, '<'))
|
if (version_compare($sqliteVersion, REQUIRED_SQLITE_VERSION, '<'))
|
||||||
{
|
{
|
||||||
throw new ERequirementNotMet('SQLite ' . REQUIRED_SQLITE_VERSION . ' is required, however you are running ' . $sqliteVersion);
|
throw new ERequirementNotMet('SQLite ' . REQUIRED_SQLITE_VERSION . ' is required, however you are running ' . $sqliteVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function checkForPhpVersion()
|
||||||
|
{
|
||||||
|
$phpVersion = phpversion();
|
||||||
|
if (version_compare($phpVersion, REQUIRED_PHP_VERSION, '<'))
|
||||||
|
{
|
||||||
|
throw new ERequirementNotMet('PHP ' . REQUIRED_PHP_VERSION . ' is required, however you are running ' . $phpVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function getSqlVersionAsString()
|
private function getSqlVersionAsString()
|
||||||
{
|
{
|
||||||
$dbh = new PDO('sqlite::memory:');
|
$dbh = new PDO('sqlite::memory:');
|
||||||
|
@@ -253,3 +253,12 @@ function string_ends_with($haystack, $needle)
|
|||||||
|
|
||||||
return (substr($haystack, -$length) === $needle);
|
return (substr($haystack, -$length) === $needle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global $GROCY_REQUIRED_FRONTEND_PACKAGES;
|
||||||
|
$GROCY_REQUIRED_FRONTEND_PACKAGES = [];
|
||||||
|
function require_frontend_packages(array $packages)
|
||||||
|
{
|
||||||
|
global $GROCY_REQUIRED_FRONTEND_PACKAGES;
|
||||||
|
|
||||||
|
$GROCY_REQUIRED_FRONTEND_PACKAGES = array_unique(array_merge($GROCY_REQUIRED_FRONTEND_PACKAGES, $packages));
|
||||||
|
}
|
||||||
|
31
localization/ca/chore_assignment_types.po
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
# gimy16 <gimy16@hotmail.com>, 2021
|
||||||
|
# Carles Riera <blauigris@gmail.com>, 2022
|
||||||
|
#
|
||||||
|
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: Carles Riera <blauigris@gmail.com>, 2022\n"
|
||||||
|
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: ca\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Domain: grocy/chore_assignment_types\n"
|
||||||
|
|
||||||
|
msgid "no-assignment"
|
||||||
|
msgstr "sense actius"
|
||||||
|
|
||||||
|
msgid "who-least-did-first"
|
||||||
|
msgstr "qui menys ha fet primer"
|
||||||
|
|
||||||
|
msgid "random"
|
||||||
|
msgstr "aleatori"
|
||||||
|
|
||||||
|
msgid "in-alphabetical-order"
|
||||||
|
msgstr "en ordre alfabètic"
|
41
localization/ca/chore_period_types.po
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
# Joan Rodas <joanrc93@gmail.com>, 2020
|
||||||
|
# gimy16 <gimy16@hotmail.com>, 2021
|
||||||
|
# Martí Gombau, 2023
|
||||||
|
#
|
||||||
|
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: Martí Gombau, 2023\n"
|
||||||
|
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: ca\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Domain: grocy/chore_types\n"
|
||||||
|
|
||||||
|
msgid "manually"
|
||||||
|
msgstr "manualment"
|
||||||
|
|
||||||
|
msgid "daily"
|
||||||
|
msgstr "diari"
|
||||||
|
|
||||||
|
msgid "weekly"
|
||||||
|
msgstr "setmanalment"
|
||||||
|
|
||||||
|
msgid "monthly"
|
||||||
|
msgstr "mensual"
|
||||||
|
|
||||||
|
msgid "yearly"
|
||||||
|
msgstr "anual"
|
||||||
|
|
||||||
|
msgid "hourly"
|
||||||
|
msgstr "cada hora"
|
||||||
|
|
||||||
|
msgid "adaptive"
|
||||||
|
msgstr "adaptable"
|
99
localization/ca/component_translations.po
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
# Bernd Bestel <bernd@berrnd.de>, 2022
|
||||||
|
#
|
||||||
|
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>, 2022\n"
|
||||||
|
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: ca\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Domain: grocy/component_translations\n"
|
||||||
|
|
||||||
|
msgid "moment_locale"
|
||||||
|
msgstr "ca"
|
||||||
|
|
||||||
|
msgid "datatables_localization"
|
||||||
|
msgstr ""
|
||||||
|
"{\"processing\":\"Processant...\",\"lengthMenu\":\"Mostra _MENU_ "
|
||||||
|
"registres\",\"zeroRecords\":\"No s'han trobat "
|
||||||
|
"registres\",\"emptyTable\":\"No hi ha registres disponible en aquesta "
|
||||||
|
"taula\",\"info\":\"Mostrant del _START_ al _END_ d'un total de _TOTAL_ "
|
||||||
|
"registres\",\"infoEmpty\":\"No hi ha registres "
|
||||||
|
"disponibles\",\"infoFiltered\":\"(filtrat de _MAX_ "
|
||||||
|
"registres)\",\"search\":\"Cerca:\",\"infoThousands\":\".\",\"decimal\":\",\",\"loadingRecords\":\"Carregant...\",\"paginate\":{\"first\":\"Primer\",\"previous\":\"Anterior\",\"next\":\"Següent\",\"last\":\"Últim\"},\"aria\":{\"sortAscending\":\":"
|
||||||
|
" Activa per ordenar la columna de manera ascendent\",\"sortDescending\":\": "
|
||||||
|
"Activa per ordenar la columna de manera "
|
||||||
|
"descendent\"},\"buttons\":{\"print\":\"Imprimeix\",\"copy\":\"Copia\",\"colvis\":\"Columnes\",\"copyTitle\":\"Copia"
|
||||||
|
" al portapapers\",\"copySuccess\":{\"1\":\"1 fila copiada\",\"_\":\"%d files"
|
||||||
|
" copiades\"},\"pageLength\":{\"-1\":\"Mostra totes les "
|
||||||
|
"files\",\"_\":\"Mostra %d "
|
||||||
|
"files\"},\"pdf\":\"PDF\",\"collection\":\"Col·lecció\",\"colvisRestore\":\"Restaurar"
|
||||||
|
" visibilitat\",\"copyKeys\":\"Pressiona ctrl o poma + C per copiar les dades"
|
||||||
|
" de la tabla al teu "
|
||||||
|
"portapaper\",\"csv\":\"CSV\",\"excel\":\"Excel\",\"renameState\":\"Cambiar "
|
||||||
|
"nom\"},\"select\":{\"rows\":{\"1\":\"1 fila seleccionada\",\"_\":\"%d files "
|
||||||
|
"seleccionades\"},\"cells\":{\"1\":\"1 fila seleccionada\",\"_\":\"%d files "
|
||||||
|
"seleccionades\"},\"columns\":{\"1\":\"1 columna seleccionada\",\"_\":\"%d "
|
||||||
|
"columnes "
|
||||||
|
"seleccionades\"}},\"autoFill\":{\"cancel\":\"Cancel·lar\",\"fillHorizontal\":\"Omple"
|
||||||
|
" les cel·les horitzontalment\",\"fillVertical\":\"Omple les cel·les "
|
||||||
|
"verticalment\",\"fill\":\"Omple totes les cel·les amb "
|
||||||
|
"<i>%d</i>\"},\"thousands\":\".\",\"datetime\":{\"hours\":\"Hora\",\"minutes\":\"Minut\",\"seconds\":\"Segons\",\"unknown\":\"Desconegut\",\"amPm\":[\"am\",\"pm\"],\"previous\":\"Anterior\",\"next\":\"Següent\",\"months\":{\"0\":\"Gener\",\"1\":\"Febrer\",\"2\":\"Març\",\"3\":\"Abril\",\"4\":\"Maig\",\"5\":\"Juny\",\"6\":\"Julio\",\"7\":\"Agost\",\"8\":\"Septembre\",\"9\":\"Octubre\",\"10\":\"Novembre\",\"11\":\"Desembre\"}},\"editor\":{\"close\":\"Tancar\",\"create\":{\"button\":\"Nou\",\"title\":\"Crear"
|
||||||
|
" nova "
|
||||||
|
"entrada\",\"submit\":\"Crear\"},\"edit\":{\"button\":\"Editar\",\"title\":\"Editar"
|
||||||
|
" "
|
||||||
|
"entrada\",\"submit\":\"Actualitzar\"},\"remove\":{\"button\":\"Eliminar\",\"title\":\"Eliminar\",\"submit\":\"Eliminar\",\"confirm\":{\"1\":\"Està"
|
||||||
|
" segir de voler elmiminar 1 fila?\",\"_\":\"Està segur de voler eliminar %d "
|
||||||
|
"files?\"}},\"error\":{\"system\":\"Ha ocurregut un error de sistema (Més "
|
||||||
|
"informació)\"},\"multi\":{\"title\":\"Múltiples valors\",\"info\":\"El ítems"
|
||||||
|
" seleccionts contenen diferent valors per aquesta entrada. Per editar i "
|
||||||
|
"configurar tots els ítems per a aquesta entrada al mateix valor, prem o "
|
||||||
|
"clica tabular aquí, d'altra vanda, mantindrán els seus valors "
|
||||||
|
"individuals\",\"restore\":\"Desfés el canvi\",\"noMulti\":\"Aquest camp pot "
|
||||||
|
"ser editat indifidualment; però no com a part d'un "
|
||||||
|
"grup\"}},\"searchBuilder\":{\"add\":\"Afegir "
|
||||||
|
"condició\",\"clearAll\":\"Eliminar "
|
||||||
|
"tot\",\"condition\":\"Condició\",\"conditions\":{\"date\":{\"after\":\"Després\",\"before\":\"Abans\",\"between\":\"Entre\",\"empty\":\"Buit\",\"equals\":\"Iguals\",\"not\":\"No\",\"notBetween\":\"No"
|
||||||
|
" entre\",\"notEmpty\":\"No "
|
||||||
|
"buit\"},\"number\":{\"between\":\"Entre\",\"empty\":\"Buit\",\"equals\":\"Iguals\",\"gt\":\"Major"
|
||||||
|
" que\",\"gte\":\"Mejor o igual a\",\"lt\":\"Menor que\",\"lte\":\"Menor o "
|
||||||
|
"igual a\",\"not\":\"No\",\"notBetween\":\"No entre\",\"notEmpty\":\"No "
|
||||||
|
"buit\"},\"string\":{\"contains\":\"Conté\",\"empty\":\"Buit\",\"endsWith\":\"Finalitza"
|
||||||
|
" amb\",\"equals\":\"Iguals\",\"not\":\"No\",\"notEmpty\":\"No "
|
||||||
|
"buit\",\"startsWith\":\"Comença amb\",\"notEnds\":\"No acaba "
|
||||||
|
"amb\",\"notStarts\":\"No comença amb\",\"notContains\":\"No "
|
||||||
|
"inclou\"},\"array\":{\"equals\":\"Iguals\",\"empty\":\"Buit\",\"contains\":\"Conté\",\"not\":\"No\",\"notEmpty\":\"No"
|
||||||
|
" buit\",\"without\":\"Sense\"}},\"data\":\"Data\",\"deleteTitle\":\"Esborrar"
|
||||||
|
" regla de filtrat\",\"leftTitle\":\"Criteri de "
|
||||||
|
"desindentació\",\"logicAnd\":\"I\",\"logicOr\":\"O\",\"rightTitle\":\"Criteri"
|
||||||
|
" d'indentació\",\"value\":\"Valor\",\"title\":{\"0\":\"Constructor de "
|
||||||
|
"cerca\",\"_\":\"Constructor de cerca (%d)\"},\"button\":{\"0\":\"Constructor"
|
||||||
|
" de cerca\",\"_\":\"Constructor de cerca "
|
||||||
|
"(%d)\"}},\"searchPanes\":{\"clearMessage\":\"Eborrar "
|
||||||
|
"tot\",\"collapse\":{\"0\":\"Panells de cerca\",\"_\":\"Panells de cerca "
|
||||||
|
"(%d)\"},\"count\":\"{total}\",\"countFiltered\":\"{monstrat} "
|
||||||
|
"({total})\",\"emptyPanes\":\"No panells de "
|
||||||
|
"cerca\",\"loadMessage\":\"Carregant panells de cerca\",\"title\":\"Filtes "
|
||||||
|
"actius - %d\",\"collapseMessage\":\"Colapsar Tot\",\"showMessage\":\"Mostrar"
|
||||||
|
" tot\"},\"stateRestore\":{\"renameLabel\":\"Nuevo nomm perpara "
|
||||||
|
"%s\",\"renameButton\":\"Cambiar "
|
||||||
|
"nom\",\"removeSubmit\":\"Eliminar\",\"removeJoiner\":\"i\",\"removeError\":\"Error"
|
||||||
|
" eliminant el registre\",\"removeConfirm\":\"¿Segur que vol eliminar aquest "
|
||||||
|
"%s?\",\"emptyError\":\"El nom no pot estar buit\"}}"
|
||||||
|
|
||||||
|
msgid "summernote_locale"
|
||||||
|
msgstr "ca-ES"
|
||||||
|
|
||||||
|
msgid "fullcalendar_locale"
|
||||||
|
msgstr "ca"
|
||||||
|
|
||||||
|
msgid "bootstrap-select_locale"
|
||||||
|
msgstr "en_US"
|
415
localization/ca/demo_data.po
Normal file
@@ -0,0 +1,415 @@
|
|||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
# Joan Rodas <joanrc93@gmail.com>, 2020
|
||||||
|
# gimy16 <gimy16@hotmail.com>, 2021
|
||||||
|
# Martí Gombau, 2023
|
||||||
|
#
|
||||||
|
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: Martí Gombau, 2023\n"
|
||||||
|
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: ca\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Domain: grocy/demo_data\n"
|
||||||
|
|
||||||
|
msgid "Cookies"
|
||||||
|
msgstr "Galetes"
|
||||||
|
|
||||||
|
msgid "Chocolate"
|
||||||
|
msgstr "Xocolata"
|
||||||
|
|
||||||
|
msgid "Pantry"
|
||||||
|
msgstr "rebost"
|
||||||
|
|
||||||
|
msgid "Candy cupboard"
|
||||||
|
msgstr "Armari de les llaminadures"
|
||||||
|
|
||||||
|
msgid "Tinned food cupboard"
|
||||||
|
msgstr "Armari de les conserves"
|
||||||
|
|
||||||
|
msgid "Fridge"
|
||||||
|
msgstr "Nevera"
|
||||||
|
|
||||||
|
msgid "Piece"
|
||||||
|
msgid_plural "Pieces"
|
||||||
|
msgstr[0] "Peces"
|
||||||
|
msgstr[1] "Trossos"
|
||||||
|
|
||||||
|
msgid "Pack"
|
||||||
|
msgid_plural "Packs"
|
||||||
|
msgstr[0] "Paquet"
|
||||||
|
msgstr[1] "Paquets"
|
||||||
|
|
||||||
|
msgid "Glass"
|
||||||
|
msgid_plural "Glasses"
|
||||||
|
msgstr[0] "Got"
|
||||||
|
msgstr[1] "Gots"
|
||||||
|
|
||||||
|
msgid "Tin"
|
||||||
|
msgid_plural "Tins"
|
||||||
|
msgstr[0] "Pot"
|
||||||
|
msgstr[1] "Pots"
|
||||||
|
|
||||||
|
msgid "Can"
|
||||||
|
msgid_plural "Cans"
|
||||||
|
msgstr[0] "Llauna"
|
||||||
|
msgstr[1] "Llaunes"
|
||||||
|
|
||||||
|
msgid "Bunch"
|
||||||
|
msgid_plural "Bunches"
|
||||||
|
msgstr[0] "Ram"
|
||||||
|
msgstr[1] "Rams"
|
||||||
|
|
||||||
|
msgid "Gummy bears"
|
||||||
|
msgstr "Ossets de gominoles"
|
||||||
|
|
||||||
|
msgid "Crisps"
|
||||||
|
msgstr "Xips"
|
||||||
|
|
||||||
|
msgid "Eggs"
|
||||||
|
msgstr "Ous"
|
||||||
|
|
||||||
|
msgid "Noodles"
|
||||||
|
msgstr "Fideus"
|
||||||
|
|
||||||
|
msgid "Pickles"
|
||||||
|
msgstr "Encurtits"
|
||||||
|
|
||||||
|
msgid "Gulash soup"
|
||||||
|
msgstr "Gulash"
|
||||||
|
|
||||||
|
msgid "Yogurt"
|
||||||
|
msgstr "iogurt"
|
||||||
|
|
||||||
|
msgid "Cheese"
|
||||||
|
msgstr "Formatge"
|
||||||
|
|
||||||
|
msgid "Cold cuts"
|
||||||
|
msgstr "Embotits"
|
||||||
|
|
||||||
|
msgid "Paprika"
|
||||||
|
msgstr "Pebrot"
|
||||||
|
|
||||||
|
msgid "Cucumber"
|
||||||
|
msgstr "Cogombre"
|
||||||
|
|
||||||
|
msgid "Radish"
|
||||||
|
msgstr "Rave"
|
||||||
|
|
||||||
|
msgid "Tomato"
|
||||||
|
msgstr "Tomàquet"
|
||||||
|
|
||||||
|
msgid "Change towels in the bathroom"
|
||||||
|
msgstr "Cambiar tovalloles del bany"
|
||||||
|
|
||||||
|
msgid "Mop the kitchen floor"
|
||||||
|
msgstr "Fregar el terra de la cuina"
|
||||||
|
|
||||||
|
msgid "Warranty ends"
|
||||||
|
msgstr "S'acaba la garantia"
|
||||||
|
|
||||||
|
msgid "TV remote control"
|
||||||
|
msgstr "Comandament a distància"
|
||||||
|
|
||||||
|
msgid "Alarm clock"
|
||||||
|
msgstr "Alarma"
|
||||||
|
|
||||||
|
msgid "Heat remote control"
|
||||||
|
msgstr "Control remot de la calefacció"
|
||||||
|
|
||||||
|
msgid "Take out the trash"
|
||||||
|
msgstr "Llençar les escombraries"
|
||||||
|
|
||||||
|
msgid "Some good snacks"
|
||||||
|
msgstr "Uns bons aperitius"
|
||||||
|
|
||||||
|
msgid "Pizza dough"
|
||||||
|
msgstr "Massa de pizza"
|
||||||
|
|
||||||
|
msgid "Sieved tomatoes"
|
||||||
|
msgstr "Tomàquets tamisats"
|
||||||
|
|
||||||
|
msgid "Salami"
|
||||||
|
msgstr "Salami"
|
||||||
|
|
||||||
|
msgid "Toast"
|
||||||
|
msgstr "Torrada"
|
||||||
|
|
||||||
|
msgid "Minced meat"
|
||||||
|
msgstr "Carn picada"
|
||||||
|
|
||||||
|
msgid "Pizza"
|
||||||
|
msgstr "Pizza"
|
||||||
|
|
||||||
|
msgid "Spaghetti bolognese"
|
||||||
|
msgstr "Espaguetis a la bolonyesa"
|
||||||
|
|
||||||
|
msgid "Sandwiches"
|
||||||
|
msgstr "Entrepans"
|
||||||
|
|
||||||
|
msgid "English"
|
||||||
|
msgstr "Anglès"
|
||||||
|
|
||||||
|
msgid "German"
|
||||||
|
msgstr "Alemany"
|
||||||
|
|
||||||
|
msgid "Italian"
|
||||||
|
msgstr "Italià"
|
||||||
|
|
||||||
|
msgid "This is the note content of the recipe ingredient"
|
||||||
|
msgstr "Aquest és el contingut de la nota de l'ingredient de la recepta"
|
||||||
|
|
||||||
|
msgid "Demo User"
|
||||||
|
msgstr "Usuari de prova"
|
||||||
|
|
||||||
|
msgid "Gram"
|
||||||
|
msgid_plural "Grams"
|
||||||
|
msgstr[0] "Gram"
|
||||||
|
msgstr[1] "Grams"
|
||||||
|
|
||||||
|
msgid "Flour"
|
||||||
|
msgstr "Farina"
|
||||||
|
|
||||||
|
msgid "Pancakes"
|
||||||
|
msgstr "Panqueques"
|
||||||
|
|
||||||
|
msgid "Sugar"
|
||||||
|
msgstr "Sucre"
|
||||||
|
|
||||||
|
msgid "Sweets"
|
||||||
|
msgstr "Llaminadures"
|
||||||
|
|
||||||
|
msgid "Bakery products"
|
||||||
|
msgstr "Productes de fleca"
|
||||||
|
|
||||||
|
msgid "Tinned food"
|
||||||
|
msgstr "Menjar en conserva"
|
||||||
|
|
||||||
|
msgid "Butchery products"
|
||||||
|
msgstr "Productes de carnisseria"
|
||||||
|
|
||||||
|
msgid "Vegetables/Fruits"
|
||||||
|
msgstr "Verdures / Fruites"
|
||||||
|
|
||||||
|
msgid "Refrigerated products"
|
||||||
|
msgstr "Productes refrigerats"
|
||||||
|
|
||||||
|
msgid "Coffee machine"
|
||||||
|
msgstr "Màquina de cafè"
|
||||||
|
|
||||||
|
msgid "Dishwasher"
|
||||||
|
msgstr "Rentaplats"
|
||||||
|
|
||||||
|
msgid "Liter"
|
||||||
|
msgstr "Litre"
|
||||||
|
|
||||||
|
msgid "Liters"
|
||||||
|
msgstr "Litres"
|
||||||
|
|
||||||
|
msgid "Bottle"
|
||||||
|
msgstr "Ampolla"
|
||||||
|
|
||||||
|
msgid "Bottles"
|
||||||
|
msgstr "Ampolles"
|
||||||
|
|
||||||
|
msgid "Milk"
|
||||||
|
msgstr "Llet"
|
||||||
|
|
||||||
|
msgid "Chocolate sauce"
|
||||||
|
msgstr "Salsa de xocolata"
|
||||||
|
|
||||||
|
msgid "Milliliters"
|
||||||
|
msgstr "Mil·lilitres"
|
||||||
|
|
||||||
|
msgid "Milliliter"
|
||||||
|
msgstr "Mil·lilitre"
|
||||||
|
|
||||||
|
msgid "Bottom"
|
||||||
|
msgstr "Fons"
|
||||||
|
|
||||||
|
msgid "Topping"
|
||||||
|
msgstr "Cobertura"
|
||||||
|
|
||||||
|
msgid "French"
|
||||||
|
msgstr "Francès"
|
||||||
|
|
||||||
|
msgid "Turkish"
|
||||||
|
msgstr "Turc"
|
||||||
|
|
||||||
|
msgid "Spanish"
|
||||||
|
msgstr "Espanyol"
|
||||||
|
|
||||||
|
msgid "Russian"
|
||||||
|
msgstr "Rus"
|
||||||
|
|
||||||
|
msgid "Vacuum the living room floor"
|
||||||
|
msgstr "Passar l'aspirador al terra del menjador"
|
||||||
|
|
||||||
|
msgid "Clean the litter box"
|
||||||
|
msgstr "Netejar el cubell de la brossa"
|
||||||
|
|
||||||
|
msgid "Change the bed sheets"
|
||||||
|
msgstr "Canviar els llençols"
|
||||||
|
|
||||||
|
msgid "Swedish"
|
||||||
|
msgstr "Suec"
|
||||||
|
|
||||||
|
msgid "Polish"
|
||||||
|
msgstr "Polonès"
|
||||||
|
|
||||||
|
msgid "Milk Chocolate"
|
||||||
|
msgstr "Xocolata amb llet"
|
||||||
|
|
||||||
|
msgid "Dark Chocolate"
|
||||||
|
msgstr "Xocolata negra"
|
||||||
|
|
||||||
|
msgid "Slice"
|
||||||
|
msgid_plural "Slices"
|
||||||
|
msgstr[0] "Tall"
|
||||||
|
msgstr[1] "Talls"
|
||||||
|
|
||||||
|
msgid "Example userentity"
|
||||||
|
msgstr "Identitat d'usuari d'exemple"
|
||||||
|
|
||||||
|
msgid "This is an example user entity..."
|
||||||
|
msgstr "Aquest és una identitat d'usuari d'exemple"
|
||||||
|
|
||||||
|
msgid "Custom field"
|
||||||
|
msgstr "Camp personalitzat"
|
||||||
|
|
||||||
|
msgid "Example field value..."
|
||||||
|
msgstr "Exemple de valor de camp"
|
||||||
|
|
||||||
|
msgid "Waffle rolls"
|
||||||
|
msgstr "Gofres"
|
||||||
|
|
||||||
|
msgid "Danish"
|
||||||
|
msgstr "Danès"
|
||||||
|
|
||||||
|
msgid "Dutch"
|
||||||
|
msgstr "Holandès"
|
||||||
|
|
||||||
|
msgid "Norwegian"
|
||||||
|
msgstr "Noruec"
|
||||||
|
|
||||||
|
msgid "Demo"
|
||||||
|
msgstr "Demostració"
|
||||||
|
|
||||||
|
msgid "Stable version"
|
||||||
|
msgstr "Versió estable"
|
||||||
|
|
||||||
|
msgid "Preview version"
|
||||||
|
msgstr "Versió prèvia"
|
||||||
|
|
||||||
|
msgid "current release"
|
||||||
|
msgstr "Versió actual"
|
||||||
|
|
||||||
|
msgid "not yet released"
|
||||||
|
msgstr "Encara no publicat"
|
||||||
|
|
||||||
|
msgid "Portuguese (Brazil)"
|
||||||
|
msgstr "Portuguès (Brasil)"
|
||||||
|
|
||||||
|
msgid "This is a note"
|
||||||
|
msgstr "Això és una nota"
|
||||||
|
|
||||||
|
msgid "Freezer"
|
||||||
|
msgstr "Congelador"
|
||||||
|
|
||||||
|
msgid "Hungarian"
|
||||||
|
msgstr "Hongarès"
|
||||||
|
|
||||||
|
msgid "Slovak"
|
||||||
|
msgstr "Eslovac"
|
||||||
|
|
||||||
|
msgid "Czech"
|
||||||
|
msgstr "Txec"
|
||||||
|
|
||||||
|
msgid "Portuguese (Portugal)"
|
||||||
|
msgstr "Portuguès (Portugal)"
|
||||||
|
|
||||||
|
# Use a in your country well known supermarket name
|
||||||
|
msgid "DemoSupermarket1"
|
||||||
|
msgstr "Supermercat de prova 1"
|
||||||
|
|
||||||
|
# Use a in your country well known supermarket name
|
||||||
|
msgid "DemoSupermarket2"
|
||||||
|
msgstr "Supermercat de prova 2"
|
||||||
|
|
||||||
|
msgid "Japanese"
|
||||||
|
msgstr "Japonès"
|
||||||
|
|
||||||
|
msgid "Chinese (Taiwan)"
|
||||||
|
msgstr "Xinès (Taiwan)"
|
||||||
|
|
||||||
|
msgid "Greek"
|
||||||
|
msgstr "Grec"
|
||||||
|
|
||||||
|
msgid "Korean"
|
||||||
|
msgstr "Coreà"
|
||||||
|
|
||||||
|
msgid "Chinese (China)"
|
||||||
|
msgstr "Xinès (Xina)"
|
||||||
|
|
||||||
|
msgid "Hebrew (Israel)"
|
||||||
|
msgstr "Hebreu (Israel)"
|
||||||
|
|
||||||
|
msgid "Tamil"
|
||||||
|
msgstr "Tàmil"
|
||||||
|
|
||||||
|
msgid "Finnish"
|
||||||
|
msgstr "Finès"
|
||||||
|
|
||||||
|
msgid "Breakfast"
|
||||||
|
msgstr "Esmorzar"
|
||||||
|
|
||||||
|
msgid "Lunch"
|
||||||
|
msgstr "Dinar"
|
||||||
|
|
||||||
|
msgid "Dinner"
|
||||||
|
msgstr "Sopar"
|
||||||
|
|
||||||
|
msgid "Catalan"
|
||||||
|
msgstr "Català "
|
||||||
|
|
||||||
|
msgid "Slovenian"
|
||||||
|
msgstr "Eslovè "
|
||||||
|
|
||||||
|
msgid "Lithuanian"
|
||||||
|
msgstr "Lituà "
|
||||||
|
|
||||||
|
msgid "Ukrainian"
|
||||||
|
msgstr "Ucrania"
|
||||||
|
|
||||||
|
msgid "Kilogram"
|
||||||
|
msgid_plural "Kilograms"
|
||||||
|
msgstr[0] "Kilogram"
|
||||||
|
msgstr[1] "Kilograms"
|
||||||
|
|
||||||
|
msgid "Romanian"
|
||||||
|
msgstr "Romanès "
|
||||||
|
|
||||||
|
msgid "Pint"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Beverages"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Ice Cream"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Soda"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Beer"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Estonian"
|
||||||
|
msgstr ""
|
146
localization/ca/locales.po
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
# Martí Gombau, 2023
|
||||||
|
#
|
||||||
|
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: Martí Gombau, 2023\n"
|
||||||
|
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: ca\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 "lt"
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
# Slovenian
|
||||||
|
msgid "sl"
|
||||||
|
msgstr "sl"
|
||||||
|
|
||||||
|
# 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 "ta"
|
||||||
|
|
||||||
|
# Finnish
|
||||||
|
msgid "fi"
|
||||||
|
msgstr "fl"
|
||||||
|
|
||||||
|
# Catalan
|
||||||
|
msgid "ca"
|
||||||
|
msgstr "ca"
|
||||||
|
|
||||||
|
# Lithuanian
|
||||||
|
msgid "lt"
|
||||||
|
msgstr "it"
|
||||||
|
|
||||||
|
# Ukrainian
|
||||||
|
msgid "uk"
|
||||||
|
msgstr "uk"
|
||||||
|
|
||||||
|
# Romanian
|
||||||
|
msgid "ro_RO"
|
||||||
|
msgstr "ro_RO"
|
||||||
|
|
||||||
|
# Estonian
|
||||||
|
msgid "et_EE"
|
||||||
|
msgstr ""
|
139
localization/ca/permissions.po
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
# gimy16 <gimy16@hotmail.com>, 2021
|
||||||
|
# Martí Gombau, 2023
|
||||||
|
#
|
||||||
|
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: Martí Gombau, 2023\n"
|
||||||
|
"Language-Team: Catalan (https://app.transifex.com/grocy/teams/93189/ca/)\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: ca\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Domain: grocy/permissions\n"
|
||||||
|
|
||||||
|
# All permissions
|
||||||
|
msgid "ADMIN"
|
||||||
|
msgstr "ADMIN"
|
||||||
|
|
||||||
|
# Create users
|
||||||
|
msgid "USERS_CREATE"
|
||||||
|
msgstr "USUARIS_CREACIÓ"
|
||||||
|
|
||||||
|
# Edit users (including passwords)
|
||||||
|
msgid "USERS_EDIT"
|
||||||
|
msgstr "USUARIS_EDICIÓ"
|
||||||
|
|
||||||
|
# Show users
|
||||||
|
msgid "USERS_READ"
|
||||||
|
msgstr "USUARIS_LECTURA"
|
||||||
|
|
||||||
|
# Edit own user data / change own password
|
||||||
|
msgid "USERS_EDIT_SELF"
|
||||||
|
msgstr "USUARIS_EDICIÓ_PRÒPIA"
|
||||||
|
|
||||||
|
# Undo charge cycle
|
||||||
|
msgid "BATTERIES_UNDO_CHARGE_CYCLE"
|
||||||
|
msgstr "PILES-SENSE-CICLE-DE-CÀRREGA"
|
||||||
|
|
||||||
|
# Track charge cycle
|
||||||
|
msgid "BATTERIES_TRACK_CHARGE_CYCLE"
|
||||||
|
msgstr "CICLE DE CÀRREGA DE PILES"
|
||||||
|
|
||||||
|
# Track execution
|
||||||
|
msgid "CHORE_TRACK_EXECUTION"
|
||||||
|
msgstr "SEGUIMENT-D'EXECUCIÓ-DE-LA-FEINA"
|
||||||
|
|
||||||
|
# Undo execution
|
||||||
|
msgid "CHORE_UNDO_EXECUTION"
|
||||||
|
msgstr "EXECUCIÓ-NO-REALITZADA-DE-LA-FEINA"
|
||||||
|
|
||||||
|
# Edit master data
|
||||||
|
msgid "MASTER_DATA_EDIT"
|
||||||
|
msgstr "EDICIO_DADES_MESTRES"
|
||||||
|
|
||||||
|
# Undo execution
|
||||||
|
msgid "TASKS_UNDO_EXECUTION"
|
||||||
|
msgstr "EXECUCIÓ-NO-REALITZADA-DE-LES-TASQUES"
|
||||||
|
|
||||||
|
# Mark completed
|
||||||
|
msgid "TASKS_MARK_COMPLETED"
|
||||||
|
msgstr "TASQUES_COMPLETADES"
|
||||||
|
|
||||||
|
# Edit stock entries
|
||||||
|
msgid "STOCK_EDIT"
|
||||||
|
msgstr "EDITAR_ESTOC"
|
||||||
|
|
||||||
|
# Transfer
|
||||||
|
msgid "STOCK_TRANSFER"
|
||||||
|
msgstr "TRANSFERÈNCIA_D'ESTOC"
|
||||||
|
|
||||||
|
# Inventory
|
||||||
|
msgid "STOCK_INVENTORY"
|
||||||
|
msgstr "ESTOC_A_L'INVENTARI"
|
||||||
|
|
||||||
|
# Consume
|
||||||
|
msgid "STOCK_CONSUME"
|
||||||
|
msgstr "ESTOC_CONSUMIT"
|
||||||
|
|
||||||
|
# Open products
|
||||||
|
msgid "STOCK_OPEN"
|
||||||
|
msgstr "ESTOC_OBERT"
|
||||||
|
|
||||||
|
# Purchase
|
||||||
|
msgid "STOCK_PURCHASE"
|
||||||
|
msgstr "COMPRA_ESTOCS"
|
||||||
|
|
||||||
|
# Add items
|
||||||
|
msgid "SHOPPINGLIST_ITEMS_ADD"
|
||||||
|
msgstr "ELEMENTS_AFEGITS_DE_LA_LLISTA_DE_LA_COMPRA"
|
||||||
|
|
||||||
|
# Remove items
|
||||||
|
msgid "SHOPPINGLIST_ITEMS_DELETE"
|
||||||
|
msgstr "ELIMINAR_ELEMENTS_LLISTA_DE_LA_COMPRA"
|
||||||
|
|
||||||
|
# User management
|
||||||
|
msgid "USERS"
|
||||||
|
msgstr "USUARIS"
|
||||||
|
|
||||||
|
# Stock
|
||||||
|
msgid "STOCK"
|
||||||
|
msgstr "ESTOC"
|
||||||
|
|
||||||
|
# Shopping list
|
||||||
|
msgid "SHOPPINGLIST"
|
||||||
|
msgstr "LLISTA DE LA COMPRA"
|
||||||
|
|
||||||
|
# Chores
|
||||||
|
msgid "CHORES"
|
||||||
|
msgstr "FEINES"
|
||||||
|
|
||||||
|
# Batteries
|
||||||
|
msgid "BATTERIES"
|
||||||
|
msgstr "PILES"
|
||||||
|
|
||||||
|
# Tasks
|
||||||
|
msgid "TASKS"
|
||||||
|
msgstr "TASQUES"
|
||||||
|
|
||||||
|
# Recipes
|
||||||
|
msgid "RECIPES"
|
||||||
|
msgstr "RECEPTES"
|
||||||
|
|
||||||
|
# Equipment
|
||||||
|
msgid "EQUIPMENT"
|
||||||
|
msgstr "EQUIP"
|
||||||
|
|
||||||
|
# Calendar
|
||||||
|
msgid "CALENDAR"
|
||||||
|
msgstr "CALENDARI"
|
||||||
|
|
||||||
|
# Meal plan
|
||||||
|
msgid "RECIPES_MEALPLAN"
|
||||||
|
msgstr "RECEPTES_MENÚ"
|