File tree Expand file tree Collapse file tree 5 files changed +11209
-21233
lines changed
Expand file tree Collapse file tree 5 files changed +11209
-21233
lines changed Original file line number Diff line number Diff line change @@ -319,6 +319,7 @@ private function searchRequestToFilter(Request $request): PartSearchFilter
319319
320320 //As an unchecked checkbox is not set in the query, the default value for all bools have to be false (which is the default argument value)!
321321 $ filter ->setName ($ request ->query ->getBoolean ('name ' ));
322+ $ filter ->setDbId ($ request ->query ->getBoolean ('dbid ' ));
322323 $ filter ->setCategory ($ request ->query ->getBoolean ('category ' ));
323324 $ filter ->setDescription ($ request ->query ->getBoolean ('description ' ));
324325 $ filter ->setMpn ($ request ->query ->getBoolean ('mpn ' ));
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ class PartSearchFilter implements FilterInterface
3333 /** @var bool Use name field for searching */
3434 protected bool $ name = true ;
3535
36+ /** @var bool Use id field for searching */
37+ protected bool $ dbId = true ;
38+
3639 /** @var bool Use category name for searching */
3740 protected bool $ category = true ;
3841
@@ -80,6 +83,9 @@ protected function getFieldsToSearch(): array
8083 if ($ this ->name ) {
8184 $ fields_to_search [] = 'part.name ' ;
8285 }
86+ if ($ this ->dbId ) {
87+ $ fields_to_search [] = 'part.id ' ;
88+ }
8389 if ($ this ->category ) {
8490 $ fields_to_search [] = '_category.name ' ;
8591 }
@@ -183,6 +189,17 @@ public function setName(bool $name): PartSearchFilter
183189 return $ this ;
184190 }
185191
192+ public function isDbId (): bool
193+ {
194+ return $ this ->dbId ;
195+ }
196+
197+ public function setDbId (bool $ dbId ): PartSearchFilter
198+ {
199+ $ this ->dbId = $ dbId ;
200+ return $ this ;
201+ }
202+
186203 public function isCategory (): bool
187204 {
188205 return $ this ->category ;
Original file line number Diff line number Diff line change 1111 <input type =" checkbox" class =" form-check-input" id =" search_name" name =" name" value =" 1" checked {{ stimulus_controller(' elements/localStorage_checkbox' ) }}>
1212 <label for =" search_name" class =" form-check-label justify-content-start" >{% trans %}name.label{% endtrans %}</label >
1313 </div >
14+ <div class =" form-check" >
15+ <input type =" checkbox" class =" form-check-input" id =" search_dbid" name =" dbid" value =" 1" checked {{ stimulus_controller(' elements/localStorage_checkbox' ) }}>
16+ <label for =" search_dbid" class =" form-check-label justify-content-start" >{% trans %}id.label{% endtrans %}</label >
17+ </div >
1418 <div class =" form-check" >
1519 <input type =" checkbox" class =" form-check-input" id =" search_category" name =" category" value =" 1" checked {{ stimulus_controller(' elements/localStorage_checkbox' ) }}>
1620 <label for =" search_category" class =" form-check-label justify-content-start" >{% trans %}category.label{% endtrans %}</label >
You can’t perform that action at this time.
0 commit comments