-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OBPIH-5455 Add filter for GL account #3866
Changes from 7 commits
38c55b8
66b6289
087dcde
65ef712
00c5525
593b914
a7c2a6f
63a7aa0
0520272
c7ab214
4bcfe1d
84f09c9
3c2f7b3
d890d5d
4cdc4e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,7 +273,7 @@ class ProductService { | |
* @return | ||
*/ | ||
List<Product> getProducts(Category category, List<Tag> tags, boolean includeInactive, Map params) { | ||
return getProducts([category], [], tags, includeInactive, params) | ||
return getProducts([category], [], tags, [], includeInactive, params) | ||
} | ||
|
||
/** | ||
|
@@ -282,10 +282,11 @@ class ProductService { | |
* @param category | ||
* @param catalogs | ||
* @param tags | ||
* @param glAccounts | ||
* @param params | ||
* @return | ||
*/ | ||
List<Product> getProducts(List<Category> categories, List<ProductCatalog> catalogsInput, List<Tag> tagsInput, boolean includeInactive, Map params) { | ||
List<Product> getProducts(List<Category> categories, List<ProductCatalog> catalogsInput, List<Tag> tagsInput, List<GlAccount> glAccounts, boolean includeInactive, Map params) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am starting to dislike these parameters more with each new one. I think we could think about refactoring this one. |
||
int max = params.max ? params.int("max") : 10 | ||
int offset = params.offset ? params.int("offset") : 0 | ||
String sortColumn = params.sort ?: "name" | ||
|
@@ -323,6 +324,11 @@ class ProductService { | |
} | ||
} | ||
|
||
if (glAccounts) { | ||
glAccount { | ||
'in'("id", glAccounts.collect { it.id }) | ||
} | ||
} | ||
|
||
if (tagsInput) { | ||
tags { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,3 +218,8 @@ export const fetchProductsTags = async () => { | |
const response = await apiClient.get('/openboxes/api/tagOptions'); | ||
return response.data.data; | ||
}; | ||
|
||
export const fetchProductsGlAccounts = async () => { | ||
const response = await apiClient.get('/openboxes/api/glAccountOptions'); | ||
return response.data.data; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe we could follow, since you've refactored some of our api calls to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm adding one additional comment, which should be rather answered by @awalkowiak - I'm wondering if we should wrap it inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be in the
GlAccountController
, not in theProductApiController
and would be good to add this fetching stuff to the service and here leave: