summaryrefslogtreecommitdiffstats
path: root/includes/concert.php
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2021-09-03 19:32:28 +0200
committerHarald Eilertsen <haraldei@anduin.net>2021-09-03 19:32:28 +0200
commit74d39366640683914ab44db039ab48959c7dc91b (patch)
tree497a0304d40b4b7d03096b344ddffbffc94d4df8 /includes/concert.php
parentc9d80308ccb63a74f7dab723dd4e73a67b7fb597 (diff)
downloadgigologadmin-74d39366640683914ab44db039ab48959c7dc91b.tar.gz
gigologadmin-74d39366640683914ab44db039ab48959c7dc91b.tar.bz2
gigologadmin-74d39366640683914ab44db039ab48959c7dc91b.zip
Editing concerts now work again.
Diffstat (limited to 'includes/concert.php')
-rw-r--r--includes/concert.php55
1 files changed, 39 insertions, 16 deletions
diff --git a/includes/concert.php b/includes/concert.php
index d6fe7c4..f0c69c8 100644
--- a/includes/concert.php
+++ b/includes/concert.php
@@ -123,27 +123,50 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
}
- public static function update_concert($id, $cname, $venue, $cdate, $ticketlink, $eventlink)
+ public function update(object $attrs) : bool
{
- global $wpdb;
+ $need_update = false;
- $res = $wpdb->update('wpg_concerts', array(
- 'wpgconcert_name' => $cname,
- 'venue' => $venue,
- 'wpgconcert_date' => $cdate,
- 'wpgconcert_tickets' => $ticketlink,
- 'wpgconcert_event' => $eventlink
- ),
- array('id' => $id)
- );
+ if (isset($attrs->wpgconcert_name) && $attrs->wpgconcert_name != $this->cname) {
+ $this->cname = $attrs->wpgconcert_name;
+ $need_update = true;
+ }
- if ( $res === false ) {
- // exit( var_dump( $wpdb->last_query ) ); //for onscreen debugging when needed
- error_log( __CLASS__ . '::' . __FUNCTION__ . ": {$wpdb->last_error}");
- die;
+ if (isset($attrs->wpgconcert_date) && $attrs->wpgconcert_date != $this->cdate) {
+ $this->cdate = $attrs->wpgconcert_date;
+ $need_update = true;
+ }
+
+ if (isset($attrs->wpgconcert_tickets) && $attrs->wpgconcert_tickets != $this->tickets) {
+ $this->tickets = $attrs->wpgconcert_tickets;
+ $need_update = true;
+ }
+
+ if (isset($attrs->wpgconcert_event) && $attrs->wpgconcert_event != $this->eventlink) {
+ $this->eventling = $attrs->wpgconcert_eventlink;
+ $need_update = true;
+ }
+
+ if (isset($attrs->wpgconcert_status) && $attrs->wpgconcert_status != $this->status) {
+ $this->status = $attrs->wpgconcert_status;
+ $need_update = true;
+ }
+
+ if (isset($attrs->wpgconcert_roles) && $attrs->wpgconcert_roles != $this->roles) {
+ $this->roles = $attrs->wpgconcert_roles;
+ $need_update = true;
+ }
+
+ if (isset($attrs->venue) && $attrs->venue != $this->venue()->id()) {
+ $this->venue = GiglogAdmin_Venue::get($attrs->venue);
+ $need_update = true;
+ }
+
+ if ($need_update) {
+ $this->save();
}
- return ($wpdb->last_error);
+ return $need_update;
}
public static function find($cname, $venue, $date)