summaryrefslogtreecommitdiffstats
path: root/includes/venue.php
diff options
context:
space:
mode:
authorAndreaChirulescu <andrea.chirulescu@gmail.com>2021-04-23 21:38:53 +0200
committerAndreaChirulescu <andrea.chirulescu@gmail.com>2021-04-23 21:38:53 +0200
commited163a66fd56ce82efb2c04eba8cde0c4dc7412a (patch)
tree09e0a65729865d7679453e2d7328214ad80d55dc /includes/venue.php
parent283e01a784e566b1c6e44456202699cb127ab9a8 (diff)
downloadgigologadmin-ed163a66fd56ce82efb2c04eba8cde0c4dc7412a.tar.gz
gigologadmin-ed163a66fd56ce82efb2c04eba8cde0c4dc7412a.tar.bz2
gigologadmin-ed163a66fd56ce82efb2c04eba8cde0c4dc7412a.zip
Added an uppercase in sql for venue and concert duplicate check
Added test to create duplicate concert with varied cases in string
Diffstat (limited to 'includes/venue.php')
-rw-r--r--includes/venue.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/includes/venue.php b/includes/venue.php
index 07dec0e..f6f46b2 100644
--- a/includes/venue.php
+++ b/includes/venue.php
@@ -35,6 +35,10 @@ if ( !class_exists('GiglogAdmin_Venue') ) {
'wpgvenue_city' => $city,
]);
$venue->save();
+ error_log( 'NEW VENUE ADDED: '
+ . ' ID: ' . $venue -> id()
+ . ' VENUE NAME ' . $name
+ . ', VENUE CITY ' . $city);
return $venue;
}
@@ -42,10 +46,14 @@ if ( !class_exists('GiglogAdmin_Venue') ) {
static function find_or_create($name, $city = 'Oslo')
{
global $wpdb;
- $venuesql = 'SELECT * FROM wpg_venues WHERE upper(wpgvenue_name)="' . $name . '"';
+ $venuesql = 'SELECT * FROM wpg_venues WHERE upper(wpgvenue_name)=upper("' . $name . '")'.' and wpgvenue_city="'.$city.'"';
$results = $wpdb->get_results($venuesql);
if ($results) {
+ error_log( 'DUPLICATE VENUE: '
+ . ' ID: ' . $results[0]->id
+ . ' VENUE NAME ' . $name
+ . ', VENUE CITY ' . $city);
return new GiglogAdmin_Venue($results[0]);
}
else {