| 1 |
<?php |
| 2 |
/** |
| 3 |
* WP Ultimate Exporter plugin file. |
| 4 |
* |
| 5 |
* Copyright (C) 2010-2020, Smackcoders Inc - info@smackcoders.com |
| 6 |
*/ |
| 7 |
namespace Smackcoders\SMEXP; |
| 8 |
|
| 9 |
use Smackcoders\WCSV\WC_Coupon; |
| 10 |
|
| 11 |
if (! defined('ABSPATH')) |
| 12 |
exit; // Exit if accessed directly |
| 13 |
|
| 14 |
/** |
| 15 |
* Class JetBookingExport |
| 16 |
* @package Smackcoders\WCSV |
| 17 |
*/ |
| 18 |
class JetBookingExport |
| 19 |
{ |
| 20 |
protected static $instance = null, $mapping_instance, $export_handler, $export_instance, $post_export; |
| 21 |
public $totalRowCount; |
| 22 |
public $plugin; |
| 23 |
|
| 24 |
public static function getInstance() |
| 25 |
{ |
| 26 |
if (null == self::$instance) { |
| 27 |
self::$instance = new self; |
| 28 |
JetBookingExport::$export_instance = ExportExtension::getInstance(); |
| 29 |
JetBookingExport::$post_export = PostExport::getInstance(); |
| 30 |
} |
| 31 |
return self::$instance; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* JetBookingExport constructor. |
| 36 |
*/ |
| 37 |
public function __construct() |
| 38 |
{ |
| 39 |
$this->plugin = Plugin::getInstance(); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Export woocommerce orders |
| 44 |
* @param $id |
| 45 |
* @param $type |
| 46 |
* @param $optional |
| 47 |
*/ |
| 48 |
public function getJetBookingData($id, $type = null, $optional = null) |
| 49 |
{ |
| 50 |
global $wpdb; |
| 51 |
$booking = jet_abaf_get_booking( $id ); |
| 52 |
if(!empty($booking)){ |
| 53 |
$booking_id = $booking->get_id(); |
| 54 |
$status = $booking->get_status(); |
| 55 |
$apartment_id = $booking->get_apartment_id(); |
| 56 |
$apartment_unit = $booking->get_apartment_unit(); |
| 57 |
$check_in_date = date( 'Y-m-d', $booking->get_check_in_date()); |
| 58 |
$check_out_date = date( 'Y-m-d', $booking->get_check_out_date() ); |
| 59 |
$order_id = $booking->get_order_id(); |
| 60 |
$user_id = $booking->get_user_id(); |
| 61 |
$import_id = $booking->get_import_id(); |
| 62 |
// $attributes = $booking->attributes(); |
| 63 |
$guests = $booking->get_guests(); |
| 64 |
$orderStatus = !empty($order_id) ? get_post_status($order_id) : ''; |
| 65 |
|
| 66 |
JetBookingExport::$export_instance->data[$booking_id]['booking_id'] = $booking_id ?? ''; |
| 67 |
JetBookingExport::$export_instance->data[$booking_id]['status'] = $status ?? ''; |
| 68 |
JetBookingExport::$export_instance->data[$booking_id]['apartment_id'] = $apartment_id ?? ''; |
| 69 |
JetBookingExport::$export_instance->data[$booking_id]['apartment_unit'] = $apartment_unit ?? ''; |
| 70 |
JetBookingExport::$export_instance->data[$booking_id]['check_in_date'] = $check_in_date ?? ''; |
| 71 |
JetBookingExport::$export_instance->data[$booking_id]['check_out_date'] = $check_out_date ?? ''; |
| 72 |
JetBookingExport::$export_instance->data[$booking_id]['order_id'] = $order_id ?? ''; |
| 73 |
JetBookingExport::$export_instance->data[$booking_id]['user_id'] = $user_id ?? ''; |
| 74 |
JetBookingExport::$export_instance->data[$booking_id]['import_id'] = $import_id ?? ''; |
| 75 |
JetBookingExport::$export_instance->data[$booking_id]['guests'] = $guests ?? ''; |
| 76 |
JetBookingExport::$export_instance->data[$booking_id]['orderStatus'] = $orderStatus ?? ''; |
| 77 |
} |
| 78 |
} |
| 79 |
} |
| 80 |
|