diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-05-09 17:24:12 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-05-09 17:24:12 +0200 |
commit | 142ff436282844677b8b4e7d8ececd44440ec96d (patch) | |
tree | 0407ae0db94f1a4da3e2aa4405d480f3b5cc613f /includes/admin | |
parent | 8045b78bc2032f772e35d1bf484541332336c7e0 (diff) | |
download | gigologadmin-142ff436282844677b8b4e7d8ececd44440ec96d.tar.gz gigologadmin-142ff436282844677b8b4e7d8ececd44440ec96d.tar.bz2 gigologadmin-142ff436282844677b8b4e7d8ececd44440ec96d.zip |
Fix importing gigs after changes to the concert class.
Diffstat (limited to 'includes/admin')
-rw-r--r-- | includes/admin/views/giglog_import_gigs.php | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/includes/admin/views/giglog_import_gigs.php b/includes/admin/views/giglog_import_gigs.php index 0e7406f..a8daa3f 100644 --- a/includes/admin/views/giglog_import_gigs.php +++ b/includes/admin/views/giglog_import_gigs.php @@ -42,7 +42,7 @@ if ( !class_exists( 'GiglogAdmin_ImportGigsPage' ) ) { * tab character: * * 1. Concertname - * 2. Venuename + * 2. Venuename or numeric venue id * 3. Concert date * 4. Ticket link * 5. Event info link @@ -65,31 +65,21 @@ if ( !class_exists( 'GiglogAdmin_ImportGigsPage' ) ) { } $resultArray = explode("\t", $line); - $cname = trim($resultArray[0]); + $cname = trim($resultArray[0]); $venue = trim($resultArray[1]); - $condate = date('Y-m-d', strtotime($resultArray[2])); - $ticketlink = trim($resultArray[3]); - $eventlink = trim($resultArray[4]); - //first item in the row should be concert name $resultArray[0]; second should be venue $resultArray[1]; third should be concert date $resultArray[2]; - //fourth item is ticketlink $resultArray[3]; fifth item is eventlink $resultArray[4]; - - - if (is_numeric($venue)) - $newconcert[1] = $venue; + if (is_numeric($venue)) { + $venue = GiglogAdmin_Venue::get($venue); + } else { - $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(); + $venue = GiglogAdmin_Venue::find_or_create($venue,'Oslo'); } - //not sure how to check dates, hopefully manual verification of files will take care of it + $condate = date('Y-m-d', strtotime($resultArray[2])); + $ticketlink = trim($resultArray[3]); + $eventlink = trim($resultArray[4]); - GiglogAdmin_Concert::create( - $cname, - $newconcert[1], - $condate, - $ticketlink, - $eventlink); + GiglogAdmin_Concert::create($cname, $venue->id(), $condate, $ticketlink, $eventlink); } } } |