From 512511df29423fc943b566bc20d997cd20ee9e03 Mon Sep 17 00:00:00 2001 From: AndreaChirulescu Date: Mon, 12 Apr 2021 23:34:32 +0200 Subject: Moved a lot of concert related logic from import/admin into the GiglogAdmin_Concert --- includes/admin/views/giglog_import_gigs.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'includes/admin/views/giglog_import_gigs.php') diff --git a/includes/admin/views/giglog_import_gigs.php b/includes/admin/views/giglog_import_gigs.php index 04b2351..d0520e7 100644 --- a/includes/admin/views/giglog_import_gigs.php +++ b/includes/admin/views/giglog_import_gigs.php @@ -85,7 +85,7 @@ if ( !class_exists( 'GiglogAdmin_ImportGigsPage' ) ) { if (is_numeric($venue)) $newconcert[1] = $venue; else { - $v = GiglogAdmin_Venue::find_or_create($venue,'Oslo'); + $v = GiglogAdmin_Venue::find_or_create($venue,'Oslo'); //phase 666 of the project should maybe consider both city and band country when creating concerts/importing files $newconcert[1] = $v->id(); } @@ -98,22 +98,34 @@ if ( !class_exists( 'GiglogAdmin_ImportGigsPage' ) ) { . ', VENUE ' . $venue . ' with venue ID ' . $newconcert[1] . ', CONCERTDATE ' . $condate); } else { - $id = GiglogAdmin_Concert::create( + $id = GiglogAdmin_Concert::find_or_create( + '', $newconcert[0], $newconcert[1], $condate, $ticketlink, - $eventlink); - + $eventlink); + error_log( 'NEW CONCERT ADDED: ' - . ' ID: ' . $id + . ' ID: ' . $id->id() . ' BAND ' . $band . ' with band ID ' . $newconcert[0] . ', VENUE ' . $venue . ' with venue ID ' . $newconcert[1] . ', CONCERTDATE ' . $condate . ', Ticket LINK ' . $ticketlink . ', Event LINK ' . $eventlink); - GiglogAdmin_Concertlogs::add($id); + GiglogAdmin_Concertlogs::add($id->id()); + + /*the last line can be replaced by a trigger + CREATE TRIGGER `insertIntoPhotoLogs` AFTER INSERT ON `wpg_concerts` + FOR EACH ROW INSERT INTO wpg_concertlogs ( + wpg_concertlogs.id, + wpg_concertlogs.wpgcl_concertid, + wpg_concertlogs.wpgcl_status) + + VALUES + (null, new.id, 1) + */ } } } -- cgit v1.2.3