diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-04-22 23:15:22 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-04-22 23:15:22 +0200 |
commit | a5ea57f20c1beb80f327fea5233605400462156c (patch) | |
tree | bd6281b9519f3fb1bd729327ad6d41649555a0d1 /includes/concert.php | |
parent | 6076d8ae50cc43b7722fcc63e6eba38117f91206 (diff) | |
download | gigologadmin-a5ea57f20c1beb80f327fea5233605400462156c.tar.gz gigologadmin-a5ea57f20c1beb80f327fea5233605400462156c.tar.bz2 gigologadmin-a5ea57f20c1beb80f327fea5233605400462156c.zip |
Concert::create return NULL if concert already exist.
We probably need some better error handling here. There's a myriad of
reasons why this call could fail, and we might need to communicate the
failure reason somewhere.
Diffstat (limited to 'includes/concert.php')
-rw-r--r-- | includes/concert.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/includes/concert.php b/includes/concert.php index 37e8fe3..22fc13d 100644 --- a/includes/concert.php +++ b/includes/concert.php @@ -51,7 +51,7 @@ if ( !class_exists('GiglogAdmin_Concert') ) { } } - static function check_duplicate($cname, $venue, $cdate, $ticketlink, $eventlink) + private static function check_duplicate($cname, $venue, $cdate, $ticketlink, $eventlink) { global $wpdb; @@ -62,8 +62,10 @@ if ( !class_exists('GiglogAdmin_Concert') ) { return ('new'); } + public static function create($cname, $venue, $cdate, $ticketlink, $eventlink) - { $c = GiglogAdmin_Concert::check_duplicate($cname, $venue, $cdate, $ticketlink, $eventlink); + { + $c = GiglogAdmin_Concert::check_duplicate($cname, $venue, $cdate, $ticketlink, $eventlink); if ($c=='new') { $attrs = new stdClass(); @@ -102,7 +104,7 @@ if ( !class_exists('GiglogAdmin_Concert') ) { . ' CONCERT NAME ' . $cname . ', VENUE ID ' . $venue . ', CONCERTDATE ' . $cdate); - return('dup'); + return NULL; } } |