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/admin/views/giglog_admin_page.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/admin/views/giglog_admin_page.php')
-rw-r--r-- | includes/admin/views/giglog_admin_page.php | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index 92d97dd..b48fa77 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -329,17 +329,20 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { //header("Refresh: 1; URL=$url2"); //reload page } - if(isset($_POST['newconcert'])) - { - IF (empty($_POST['cname']) || empty($_POST['selectvenueadmin']) || empty($_POST['cdate']) || empty($_POST['ticket']) || empty($_POST['eventurl'])) + if(isset($_POST['newconcert'])) { + if (empty($_POST['cname']) || empty($_POST['selectvenueadmin']) || empty($_POST['cdate']) || empty($_POST['ticket']) || empty($_POST['eventurl'])) { echo '<script language="javascript">alert("You are missing a value, concert was not created"); </script>'; - else - { - $ret = GiglogAdmin_Concert::create($_POST['cname'], $_POST['selectvenueadmin'], $_POST['cdate'], $_POST['ticket'], $_POST['eventurl']); - if ($ret!='dup') echo '<script language="javascript">alert("Yey, concert created"); </script>'; - else echo '<script language="javascript">alert("Nay, concert was duplicated"); </script>'; + } + else { + if (GiglogAdmin_Concert::create($_POST['cname'], $_POST['selectvenueadmin'], $_POST['cdate'], $_POST['ticket'], $_POST['eventurl'])) { + echo '<script language="javascript">alert("Yey, concert created"); </script>'; + } + else { + echo '<script language="javascript">alert("Nay, concert was duplicated"); </script>'; + } } } + if(isset($_POST['editconcert'])) { IF (empty($_POST['cname']) || empty($_POST['selectvenueadmin']) || empty($_POST['cdate']) || empty($_POST['ticket']) || empty($_POST['eventurl'])) |