Example #1
0
 public static function em_bookings_table_rows_col_coupon($val, $EM_Booking)
 {
     //if in MB mode, change $EM_Booking with the main booking to grab coupon info, given that we don't support per-event coupons in MB mode atm
     if (get_option('dbem_multiple_bookings')) {
         $EM_Multiple_Booking = EM_Multiple_Bookings::get_main_booking($EM_Booking);
         if ($EM_Multiple_Booking !== false) {
             $EM_Booking = $EM_Multiple_Booking;
         }
     }
     //check if coupon code exists for this booking, if so, get it and replace $val with coupon code
     if (self::booking_has_coupons($EM_Booking)) {
         $vals = array();
         $coupons = self::booking_get_coupons($EM_Booking);
         foreach ($coupons as $EM_Coupon) {
             $vals[] = $EM_Coupon->coupon_code;
         }
         $val = implode(' ', $vals);
     }
     return $val;
 }
 function em_bookings_table_rows_col($value, $col, $EM_Booking, $EM_Bookings_Table, $csv)
 {
     global $EM_Event;
     if ($col == 'gateway_txn_id') {
         //check if this isn't a multiple booking, otherwise look for info from main booking
         if (get_option('dbem_multiple_bookings')) {
             $EM_Multiple_Booking = EM_Multiple_Bookings::get_main_booking($EM_Booking);
             if ($EM_Multiple_Booking !== false) {
                 $EM_Booking = $EM_Multiple_Booking;
             }
         }
         //get latest transaction with an ID
         $old_limit = $this->limit;
         $old_orderby = $this->orderby;
         $old_page = $this->page;
         $this->limit = $this->page = 1;
         $this->orderby = 'booking_date';
         $transactions = $this->get_transactions($EM_Booking);
         if (count($transactions) > 0) {
             $value = $transactions[0]->transaction_gateway_id;
         }
         $this->limit = $old_limit;
         $this->orderby = $old_orderby;
         $this->page = $old_page;
     }
     return $value;
 }