Fix search to user uppercase saerch in database
This commit is contained in:
parent
85444b1c70
commit
1b55fbeeca
1 changed files with 6 additions and 5 deletions
|
@ -341,26 +341,27 @@ sub post_search {
|
||||||
|
|
||||||
my @validatedOrgs = ();
|
my @validatedOrgs = ();
|
||||||
{
|
{
|
||||||
my $statementValidated = $self->db->prepare("SELECT OrganisationalId, Name, FullAddress, PostCode FROM Organisations WHERE Name LIKE ?");
|
my $statementValidated = $self->db->prepare("SELECT OrganisationalId, Name, FullAddress, PostCode FROM Organisations WHERE UPPER( Name ) LIKE ?");
|
||||||
$statementValidated->execute('%'.$searchName.'%');
|
$statementValidated->execute('%'. uc $searchName.'%');
|
||||||
|
|
||||||
while (my ($id, $name, $address, $postcode) = $statementValidated->fetchrow_array()) {
|
while (my ($id, $name, $address, $postcode) = $statementValidated->fetchrow_array()) {
|
||||||
push(@validatedOrgs, $self->create_hash($id,$name,$address,$postcode));
|
push(@validatedOrgs, $self->create_hash($id,$name,$address,$postcode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#$self->app->log->debug( "Orgs: " . Dumper @validatedOrgs );
|
$self->app->log->debug( "Orgs: " . Dumper @validatedOrgs );
|
||||||
|
|
||||||
my @unvalidatedOrgs = ();
|
my @unvalidatedOrgs = ();
|
||||||
{
|
{
|
||||||
my $statementUnvalidated = $self->db->prepare("SELECT PendingOrganisationId, Name, FullAddress, Postcode FROM PendingOrganisations WHERE Name LIKE ? AND UserSubmitted_FK = ?");
|
my $statementUnvalidated = $self->db->prepare("SELECT PendingOrganisationId, Name, FullAddress, Postcode FROM PendingOrganisations WHERE UPPER( Name ) LIKE ? AND UserSubmitted_FK = ?");
|
||||||
$statementUnvalidated->execute('%'.$searchName.'%', $userId);
|
$statementUnvalidated->execute('%'. uc $searchName.'%', $userId);
|
||||||
|
|
||||||
while (my ($id, $name, $fullAddress, $postcode) = $statementUnvalidated->fetchrow_array()) {
|
while (my ($id, $name, $fullAddress, $postcode) = $statementUnvalidated->fetchrow_array()) {
|
||||||
push(@unvalidatedOrgs, $self->create_hash($id, $name, $fullAddress, $postcode));
|
push(@unvalidatedOrgs, $self->create_hash($id, $name, $fullAddress, $postcode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$self->app->log->debug( "Non Validated Orgs: " . Dumper @unvalidatedOrgs );
|
||||||
$self->app->log->debug('Path Success: file:' . __FILE__ . ', line: ' . __LINE__);
|
$self->app->log->debug('Path Success: file:' . __FILE__ . ', line: ' . __LINE__);
|
||||||
return $self->render( json => {
|
return $self->render( json => {
|
||||||
success => Mojo::JSON->true,
|
success => Mojo::JSON->true,
|
||||||
|
|
Reference in a new issue