Plugin Directory

Changeset 3227477


Ignore:
Timestamp:
01/23/2025 01:27:44 PM (14 months ago)
Author:
inspireui
Message:

version 4.16.9

Location:
mstore-api
Files:
491 added
8 edited

Legend:

Unmodified
Added
Removed
  • mstore-api/trunk/controllers/flutter-auction.php

    r3190678 r3227477  
    9595        $bid_value = sanitize_text_field($params['bid_value']);
    9696       
     97        WC()->session->set( 'wc_notices', null );
    9798        $bid = new WC_Bid();
    9899        $result = $bid->placebid($product_id, $bid_value);
     
    107108            }
    108109            if($lastNotice != null){
    109                 return parent::sendError("invalid_bid", $lastNotice['notice'] ?? 'Error bid' , 400);
     110                return parent::sendError("invalid_bid", htmlspecialchars_decode($lastNotice['notice'] ?? 'Error bid') , 400);
    110111            }
    111112        }
  • mstore-api/trunk/controllers/flutter-home.php

    r3211961 r3227477  
    171171            $results = [];
    172172            foreach ($tabBar as $tabBarItem) {
    173                 $layout = $tabBarItem->layout;
    174                 $configs = $tabBarItem->configs;
    175                
    176                 if($layout == 'dynamic' && isset($configs) && is_array($configs)){
     173                $layout = isset($tabBarItem->layout) ? $tabBarItem->layout : null;
     174                $configs = isset($tabBarItem->configs) && is_array($tabBarItem->configs) ? $tabBarItem->configs : null;
     175
     176                if ($layout === 'dynamic' && !empty($configs)) {
    177177                    $horizonLayout = $configs->HorizonLayout;
    178178
    179                     if(isset($horizonLayout) && is_array($horizonLayout)){
     179                    if (isset($horizonLayout) && is_array($horizonLayout)) {
    180180                        $horizonLayoutWithProducts = $this->getProductsForHorizonLayout($horizonLayout, $api, $request);
    181181                        $tabBarItem->configs->HorizonLayout = json_decode(json_encode($horizonLayoutWithProducts));
  • mstore-api/trunk/controllers/flutter-points-offline-store.php

    r3212859 r3227477  
    6363
    6464        if($event_type == 'offline-store'){
    65             return $event->data['desc'] ?? 'Offline store';
     65            return !$event->data['desc'] ? 'Offline store' : $event->data['desc'];
    6666        }
    6767       
  • mstore-api/trunk/controllers/flutter-user.php

    r3205338 r3227477  
    580580            $is_driver_available = in_array('administrator',$user->roles) || in_array('wcfm_delivery_boy',$user->roles);
    581581        }
     582
     583        // Check order status change capability
     584        $order_status_change = false;
     585
     586        // Check for Dokan
     587        if (is_plugin_active('dokan-lite/dokan.php') || is_plugin_active('dokan-pro/dokan-pro.php')) {
     588            $dokan_settings = get_option('dokan_selling');
     589            $order_status_change = isset($dokan_settings['order_status_change']) ?
     590                filter_var($dokan_settings['order_status_change'], FILTER_VALIDATE_BOOLEAN) : false;
     591        }
     592
     593        // Check for WCFM
     594        if (is_plugin_active('wc-frontend-manager/wc_frontend_manager.php') && class_exists('WCFMmp')) {
     595            global $WCFM;
     596            $order_status_change = $WCFM->wcfm_vendor_support->wcfm_vendor_has_capability($user->ID, 'order_status_update');
     597        }
     598       
     599        // If user is admin, always allow order status change
     600        if (in_array('administrator', $user->roles)) {
     601            $order_status_change = true;
     602        }
     603
    582604        return array(
    583605            "id" => $user->ID,
     
    598620            "avatar" => $avatar,
    599621            "is_driver_available" => $is_driver_available,
    600             "dokan_enable_selling" => $user->dokan_enable_selling
     622            "dokan_enable_selling" => $user->dokan_enable_selling,
     623            "order_status_change" => (bool)$order_status_change
    601624        );
    602625    }
     
    13511374        $mobuser = getUserFromPhone($mob);
    13521375        if ($mobuser == null) {
    1353             return parent::sendError("existed_mobile", 'Phone number is not registered!', 400);
     1376            return parent::sendError("not_existed_mobile", 'Phone number is not registered!', 400);
    13541377        }
    13551378
  • mstore-api/trunk/controllers/listing-rest-api/class.api.fields.php

    r3166875 r3227477  
    803803        $services = isset($data->services) ? $data->services : false;
    804804        $comment_services = false;
     805        $coupon = isset($data->coupon) ? $data->coupon : null;
    805806        $message = '';
    806807        if (!empty($services))
     
    893894                    'comment' => json_encode($comment) ,
    894895                    'type' => 'reservation',
    895                     'price' => Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, $tickets, $services, '') ,
     896                    'price' => Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, $tickets, $services, $coupon) ,
    896897                ));
    897898
     
    919920                        $multiply = 1;
    920921                        if (isset($adults)) $multiply = $adults;
    921                         $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, $multiply, $services, '');
     922                        $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, $multiply, $services, $coupon);
    922923                    }
    923924                    else
    924925                    {
    925                         $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, 1, $services, '');
     926                        $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, 1, $services, $coupon);
    926927                    }
    927928
     
    974975                        $multiply = 1;
    975976                        if (isset($adults)) $multiply = $adults;
    976                         $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, $multiply, $services, '');
     977                        $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, $multiply, $services, $coupon);
    977978                    }
    978979                    else
    979980                    {
    980                         $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, 1, $services, '');
     981                        $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, 1, $services, $coupon);
    981982                    }
    982983                    $hour_end = (isset($_hour_end) && !empty($_hour_end)) ? $_hour_end : $_hour;
     
    10231024                            $multiply = 1;
    10241025                            if (isset($adults)) $multiply = $adults;
    1025                             $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, $multiply, $services, '');
     1026                            $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, $multiply, $services, $coupon);
    10261027                        }
    10271028                        else
    10281029                        {
    1029                             $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, 1, $services, '');
     1030                            $price = Listeo_Core_Bookings_Calendar::calculate_price($listing_id, $date_start, $date_end, 1, $services, $coupon);
    10301031                        }
    10311032
     
    13601361        public function get_post_gallery_images_listingPro($object)
    13611362        {
    1362 
     1363            $results = [];
    13631364            $gallery = get_post_meta($object['id'], 'gallery_image_ids', true);
    13641365
     
    21132114            }
    21142115
    2115             $isChild = strstr(strtolower(wp_get_theme()) , "child");
    2116             if ($isChild == 'child')
    2117             {
     2116            $isChild = strstr(strtolower(wp_get_theme()), "child");
     2117            if ($isChild == 'child') {
    21182118                $string = explode(" ", wp_get_theme());
    2119                 $this->_template = strtolower($string[0] . ' ' . $string[1]);
    2120             }
    2121             else
    2122             {
     2119                if (count($string) > 1) {
     2120                    $this->_template = strtolower($string[0] . ' ' . $string[1]);
     2121                } else {
     2122                    $this->_template = strtolower($string[0]);
     2123                }
     2124            } else {
    21232125                $this->_template = strtolower(wp_get_theme());
    21242126            }
  • mstore-api/trunk/functions/index.php

    r3212859 r3227477  
    337337}
    338338
    339 function parseMetaDataForBookingProduct($product)
    340 {
    341     if (is_plugin_active('woocommerce-appointments/woocommerce-appointments.php')) {
     339function parseMetaDataForBookingProduct($cart_item)
     340{
     341    if (is_plugin_active('woocommerce-appointments/woocommerce-appointments.php') && isset($cart_item['meta_data'])) {
    342342        //add meta_data to $_POST to use for booking product
    343343        $meta_data = [];
    344         foreach ($product["meta_data"] as $key => $value) {
     344        foreach ($cart_item["meta_data"] as $key => $value) {
    345345            if ($value["key"] == "staff_ids" && isset($value["value"])) {
    346346                $staffs = is_array($value["value"]) ? $value["value"] : json_decode($value["value"], true);
     
    10171017}
    10181018
    1019 function buildCartItemData($products, $callback){
    1020     foreach ($products as $product) {
    1021                 $productId = absint($product['product_id']);
    1022 
    1023                 $quantity = $product['quantity'];
    1024                 $variationId = isset($product['variation_id']) ? $product['variation_id'] : "";
     1019function buildCartItemData($line_items, $callback){
     1020    foreach ($line_items as $item) {
     1021                $productId = absint($item['product_id']);
     1022
     1023                $quantity = $item['quantity'];
     1024                $variationId = isset($item['variation_id']) ? $item['variation_id'] : "";
    10251025
    10261026                $attributes = [];
    1027                 if (isset($product["meta_data"])) {
    1028                     foreach ($product["meta_data"] as $item) {
     1027                if (isset($item["meta_data"])) {
     1028                    foreach ($item["meta_data"] as $item) {
    10291029                        if($item["value"] != null){
    10301030                            $attributes[strtolower($item["key"])] = $item["value"];
     
    10331033                }
    10341034
    1035                 if (isset($product['addons'])) {
     1035                if (isset($item['addons'])) {
    10361036                    $addons = array();
    1037                     foreach ($product['addons'] as $key => $value) {
     1037                    foreach ($item['addons'] as $key => $value) {
    10381038                        if(is_array($value)){
    10391039                            $addons[$key] = array_map(function($val){
     
    10601060                    }
    10611061                } else {
    1062                     parseMetaDataForBookingProduct($product);
     1062                    parseMetaDataForBookingProduct($item);
    10631063                    $cart_item_data = array();
    10641064                    if (is_plugin_active('woo-wallet/woo-wallet.php')) {
    10651065                        $wallet_product = get_wallet_rechargeable_product();
    10661066                        if ($wallet_product->get_id() == $productId) {
    1067                             $cart_item_data['recharge_amount'] = $product['total'];
     1067                            $cart_item_data['recharge_amount'] = $item['total'];
    10681068                        }
    10691069                    }
    1070                     if(isset($product['ywgc_amount'])){
    1071                         $cart_item_data['ywgc_amount'] = $product['ywgc_amount'];
     1070                    if(isset($item['ywgc_amount'])){
     1071                        $cart_item_data['ywgc_amount'] = $item['ywgc_amount'];
    10721072                        $cart_item_data['ywgc_product_id'] = $productId;
    10731073                    }
  • mstore-api/trunk/mstore-api.php

    r3212859 r3227477  
    44 * Plugin URI: https://github.com/inspireui/mstore-api
    55 * Description: The MStore API Plugin which is used for the FluxBuilder and FluxStore Mobile App
    6  * Version: 4.16.8
     6 * Version: 4.16.9
    77 * Author: FluxBuilder
    88 * Author URI: https://fluxbuilder.com
     
    6161class MstoreCheckOut
    6262{
    63     public $version = '4.16.8';
     63    public $version = '4.16.9';
    6464
    6565    public function __construct()
     
    10821082        }
    10831083
    1084         $vendor_staffs = dokan_get_vendor_staff( $vendor->get_id() );
    1085         if ( ! in_array( $vendor->get_id(), $vendor_staffs, true ) ) {
    1086             return;
    1087         }
    1088         $query->set( 'author__in', $vendor_staffs );
     1084        if ( function_exists( 'dokan_get_vendor_staff' ) ) {
     1085            $vendor_staffs = dokan_get_vendor_staff( $vendor->get_id() );
     1086            if ( ! in_array( $vendor->get_id(), $vendor_staffs, true ) ) {
     1087                return;
     1088            }
     1089            $query->set( 'author__in', $vendor_staffs );
     1090        }
    10891091    }
    10901092}
  • mstore-api/trunk/readme.txt

    r3212859 r3227477  
    44Requires at least: 4.4
    55Tested up to:      6.5.3
    6 Stable tag:        4.16.8
     6Stable tag:        4.16.9
    77License:           GPL-2.0
    88License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    4949
    5050== Changelog ==
     51= 4.16.9 =
     52  * Fix warning for listings api
     53
    5154= 4.16.8 =
    5255  * Fix to check version to call wallet_partial_payment method
Note: See TracChangeset for help on using the changeset viewer.