Plugin Directory

Changeset 2314038


Ignore:
Timestamp:
05/28/2020 09:28:43 PM (6 years ago)
Author:
pcis
Message:

Better error handling; minor text changes

Location:
zsquared-connector-for-zoho-crm
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • zsquared-connector-for-zoho-crm/tags/1.0/README.txt

    r2303034 r2314038  
    1616Features include:
    1717
    18 * Populate WooCommerce store with items from Zoho CRM Inventory
    19 * Synchronize Inventory and Woocommerce products and available quantities
     18* Populate WooCommerce store with items from Zoho CRM
     19* Synchronize CRM and Woocommerce products and available quantities
    2020* Field Mapping of taxation to Zoho CRM defined taxation product (see manual)
    2121* Send store transaction alerts to your Slack Channel
  • zsquared-connector-for-zoho-crm/tags/1.0/include/ZsqConnectorOptions.php

    r2310375 r2314038  
    4848            $check = zsq_crm_sync_order($order_number, '', $this->hook_trigger);
    4949            if(false === $check) {
    50                 echo "<div class=\"notice notice-error is-dismissible\"><p>Order replay failed. Please see Slack output for details.</p></div>";
     50                echo "<div class=\"notice notice-error is-dismissible\"><p>Order replay failed. Please see Slack output or error output for details.</p></div>";
    5151            }
    5252            else if(true === $check) {
    53                 echo "<div class=\"notice notice-success is-dismissible\"><p>Order replay succeeded.</p></div>";
     53                echo "<div class=\"notice notice-success is-dismissible\"><p>Order replay accepted. ZSquared will now attempt to transfer the order into Zoho CRM again. Please check your email for any error reports.</p></div>";
    5454            }
    5555            else if(is_null($check)) {
     
    240240            array('sslverify' => FALSE));
    241241        if(is_a($response, WP_Error::class)) {
    242             echo "ERROR: " . $response->get_error_message();
    243             die;
     242            ZsqSlackNotifications::send('Error on taxes API call: '.$response->get_error_message());
     243            return [];
    244244        }
    245245        $output = json_decode($response['body'], true);
    246         if (isset($output['data']['taxes']) && !empty($output['data']['taxes'])) {
     246        if (isset($output['data']['taxes']) && is_array($output['data']['taxes'])) {
    247247            return $output['data']['taxes'];
    248248        }
  • zsquared-connector-for-zoho-crm/tags/1.0/templates/options.php

    r2305894 r2314038  
    5757        </form>
    5858        <div class="zspl-sync-settings">
    59             <h2>Add/change Inventory Items (Optional)</h2>
    60             <p>Use the button below to add/update all products from zoho inventory to woocommerce.</p>
     59            <h2>Add/change CRM Items (Optional)</h2>
     60            <p>Use the button below to add/update all products from Zoho CRM to woocommerce.</p>
    6161            <p><strong>
    6262                    Note: Products will be created if their SKU is not already assigned to an existing Woocommerce Product;
     
    7777            <h2>Replay order submission</h2>
    7878            <p>Sometimes an order may not make it into Zoho for a variety of reasons. When this happens, you can replay the order submission to try again.</p>
    79             <p>Enter the woocommerce sales order number to attempt to send it again to zoho inventory, regardless of status.</p>
     79            <p>Enter the woocommerce sales order number to attempt to send it again to Zoho CRM</p>
    8080            <form method="post" action="options-general.php?page=zsq_crm.php&replay=1&show=replay">
    8181                <table class="form-table">
     
    102102            <h2>Tax Information Mapping</h2>
    103103            <?php if(empty($woo_taxes)) : ?>
    104                 <p>No Woocommerce taxes found; sales orders will be transferred to Zoho CRM without any tax information applied.</p>
     104                <p>No Woocommerce or Zoho tax settings found; sales orders will be transferred to Zoho CRM without any tax information applied.</p>
    105105            <?php elseif(!empty($woo_taxes) && empty($ex_taxes)) : ?>
    106106                <p>Woocommerce tax settings detected but no Zoho CRM taxes detected. Please check your tax settings in Zoho CRM, and confirm that your ZSquared API key has been added here. If you have set your taxes in Woocommerce and Zoho CRM and you still see this message, please contact the ZSquared team.</p>
  • zsquared-connector-for-zoho-crm/tags/1.0/templates/scripts.php

    r2305894 r2314038  
    2222                        }, 10000);
    2323                    }
     24                },
     25                error: function(error) {
     26                    $("#zsq_crm_manual_sync_message").text("ERROR: "+error);
    2427                }
    2528            });
  • zsquared-connector-for-zoho-crm/tags/1.0/zsq-connector-crm.php

    r2305894 r2314038  
    5656    }
    5757    $order = wc_get_order($order_id);
     58    if($order == false) {
     59        return "Order $order_id not found";
     60    }
    5861    $obj = new \PCIS\ZSquared\CRM\ZsqOrderSync($order);
    5962    if(!$obj->getState()) {
  • zsquared-connector-for-zoho-crm/trunk/README.txt

    r2303034 r2314038  
    1616Features include:
    1717
    18 * Populate WooCommerce store with items from Zoho CRM Inventory
    19 * Synchronize Inventory and Woocommerce products and available quantities
     18* Populate WooCommerce store with items from Zoho CRM
     19* Synchronize CRM and Woocommerce products and available quantities
    2020* Field Mapping of taxation to Zoho CRM defined taxation product (see manual)
    2121* Send store transaction alerts to your Slack Channel
  • zsquared-connector-for-zoho-crm/trunk/include/ZsqConnectorOptions.php

    r2310375 r2314038  
    4848            $check = zsq_crm_sync_order($order_number, '', $this->hook_trigger);
    4949            if(false === $check) {
    50                 echo "<div class=\"notice notice-error is-dismissible\"><p>Order replay failed. Please see Slack output for details.</p></div>";
     50                echo "<div class=\"notice notice-error is-dismissible\"><p>Order replay failed. Please see Slack output or error output for details.</p></div>";
    5151            }
    5252            else if(true === $check) {
    53                 echo "<div class=\"notice notice-success is-dismissible\"><p>Order replay succeeded.</p></div>";
     53                echo "<div class=\"notice notice-success is-dismissible\"><p>Order replay accepted. ZSquared will now attempt to transfer the order into Zoho CRM again. Please check your email for any error reports.</p></div>";
    5454            }
    5555            else if(is_null($check)) {
     
    240240            array('sslverify' => FALSE));
    241241        if(is_a($response, WP_Error::class)) {
    242             echo "ERROR: " . $response->get_error_message();
    243             die;
     242            ZsqSlackNotifications::send('Error on taxes API call: '.$response->get_error_message());
     243            return [];
    244244        }
    245245        $output = json_decode($response['body'], true);
    246         if (isset($output['data']['taxes']) && !empty($output['data']['taxes'])) {
     246        if (isset($output['data']['taxes']) && is_array($output['data']['taxes'])) {
    247247            return $output['data']['taxes'];
    248248        }
  • zsquared-connector-for-zoho-crm/trunk/templates/options.php

    r2305894 r2314038  
    5757        </form>
    5858        <div class="zspl-sync-settings">
    59             <h2>Add/change Inventory Items (Optional)</h2>
    60             <p>Use the button below to add/update all products from zoho inventory to woocommerce.</p>
     59            <h2>Add/change CRM Items (Optional)</h2>
     60            <p>Use the button below to add/update all products from Zoho CRM to woocommerce.</p>
    6161            <p><strong>
    6262                    Note: Products will be created if their SKU is not already assigned to an existing Woocommerce Product;
     
    7777            <h2>Replay order submission</h2>
    7878            <p>Sometimes an order may not make it into Zoho for a variety of reasons. When this happens, you can replay the order submission to try again.</p>
    79             <p>Enter the woocommerce sales order number to attempt to send it again to zoho inventory, regardless of status.</p>
     79            <p>Enter the woocommerce sales order number to attempt to send it again to Zoho CRM</p>
    8080            <form method="post" action="options-general.php?page=zsq_crm.php&replay=1&show=replay">
    8181                <table class="form-table">
     
    102102            <h2>Tax Information Mapping</h2>
    103103            <?php if(empty($woo_taxes)) : ?>
    104                 <p>No Woocommerce taxes found; sales orders will be transferred to Zoho CRM without any tax information applied.</p>
     104                <p>No Woocommerce or Zoho tax settings found; sales orders will be transferred to Zoho CRM without any tax information applied.</p>
    105105            <?php elseif(!empty($woo_taxes) && empty($ex_taxes)) : ?>
    106106                <p>Woocommerce tax settings detected but no Zoho CRM taxes detected. Please check your tax settings in Zoho CRM, and confirm that your ZSquared API key has been added here. If you have set your taxes in Woocommerce and Zoho CRM and you still see this message, please contact the ZSquared team.</p>
  • zsquared-connector-for-zoho-crm/trunk/templates/scripts.php

    r2305894 r2314038  
    2222                        }, 10000);
    2323                    }
     24                },
     25                error: function(error) {
     26                    $("#zsq_crm_manual_sync_message").text("ERROR: "+error);
    2427                }
    2528            });
  • zsquared-connector-for-zoho-crm/trunk/zsq-connector-crm.php

    r2305894 r2314038  
    5656    }
    5757    $order = wc_get_order($order_id);
     58    if($order == false) {
     59        return "Order $order_id not found";
     60    }
    5861    $obj = new \PCIS\ZSquared\CRM\ZsqOrderSync($order);
    5962    if(!$obj->getState()) {
Note: See TracChangeset for help on using the changeset viewer.