Skip to content

Commit

Permalink
[IM] - Stripe % from search
Browse files Browse the repository at this point in the history
  • Loading branch information
yannrobin committed Jul 20, 2021
1 parent 92deecf commit 13b4450
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/Http/Controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function do( Request $r ): RedirectResponse|View
$type = '';
$results = $interfaces = [];

if( $search = trim( htmlspecialchars( $r->search ) ) ) {
if( $search = trim( htmlspecialchars( str_replace( '%', '', $r->search ) ) ) ) {
// what kind of search are we doing?
if( preg_match( '/^PPP\-(\d+)$/', $search, $matches ) ) {
// patch panel port search
Expand Down Expand Up @@ -152,9 +152,8 @@ public function do( Request $r ): RedirectResponse|View
else {
// wild card search
$type = 'cust_wild';
$search = '%' . $search . '%';
$results = Customer::leftJoin( 'company_registration_detail AS r', 'r.id', 'cust.company_registered_detail_id' )
->where( 'cust.name', 'LIKE' , $search )->orWhere( 'cust.shortname', 'LIKE' , $search )
->where( 'cust.name', 'LIKE' , '%' . $search . '%' )->orWhere( 'cust.shortname', 'LIKE' , $search )
->orWhere( 'cust.abbreviatedName', 'LIKE' , $search )->orWhere( 'r.registeredName', 'LIKE' , $search )
->orderBy( 'cust.name' )->get();
}
Expand Down

0 comments on commit 13b4450

Please sign in to comment.