1
0
mirror of synced 2025-01-18 08:51:41 +03:00

Update transferring the order number

This commit is contained in:
Dima Uryvskiy 2021-03-11 17:40:45 +03:00 committed by GitHub
parent c48f50195a
commit 4ab7311435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 31 deletions

View File

@ -25,8 +25,8 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
*/ */
public function __construct() { public function __construct() {
$this->id = 'integration-retailcrm'; $this->id = 'integration-retailcrm';
$this->method_title = __('retailCRM', 'retailcrm'); $this->method_title = __('RetailCRM', 'retailcrm');
$this->method_description = __('Integration with retailCRM management system.', 'retailcrm'); $this->method_description = __('Integration with RetailCRM management system.', 'retailcrm');
static::$option_key = $this->get_option_key(); static::$option_key = $this->get_option_key();
@ -116,7 +116,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
'api_key' => array( 'api_key' => array(
'title' => __( 'API key', 'retailcrm' ), 'title' => __( 'API key', 'retailcrm' ),
'type' => 'text', 'type' => 'text',
'description' => __( 'Enter your API key. You can find it in the administration section of retailCRM', 'retailcrm' ), 'description' => __( 'Enter your API key. You can find it in the administration section of RetailCRM', 'retailcrm' ),
'desc_tip' => true, 'desc_tip' => true,
'default' => '' 'default' => ''
) )
@ -198,10 +198,10 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
$this->form_fields['client_roles'] = array( $this->form_fields['client_roles'] = array(
'label' => ' ', 'label' => ' ',
'title' => __('Client roles available for uploading to retailCRM', 'retailcrm'), 'title' => __('Client roles available for uploading to RetailCRM', 'retailcrm'),
'class' => '', 'class' => '',
'type' => 'multiselect', 'type' => 'multiselect',
'description' => __('Select client roles which will be uploaded from website to retailCRM', 'retailcrm'), 'description' => __('Select client roles which will be uploaded from website to RetailCRM', 'retailcrm'),
'options' => $client_roles_option, 'options' => $client_roles_option,
'css' => 'min-height:100px;', 'css' => 'min-height:100px;',
'select_buttons' => true 'select_buttons' => true
@ -232,10 +232,10 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
$this->form_fields['order_methods'] = array( $this->form_fields['order_methods'] = array(
'label' => ' ', 'label' => ' ',
'title' => __('Order methods available for uploading from retailCRM', 'retailcrm'), 'title' => __('Order methods available for uploading from RetailCRM', 'retailcrm'),
'class' => '', 'class' => '',
'type' => 'multiselect', 'type' => 'multiselect',
'description' => __('Select order methods which will be uploaded from retailCRM to the website', 'retailcrm'), 'description' => __('Select order methods which will be uploaded from RetailCRM to the website', 'retailcrm'),
'options' => $order_methods_option, 'options' => $order_methods_option,
'css' => 'min-height:100px;', 'css' => 'min-height:100px;',
'select_buttons' => true 'select_buttons' => true
@ -358,7 +358,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
'title' => __('Stock balance', 'retailcrm'), 'title' => __('Stock balance', 'retailcrm'),
'class' => 'checkbox', 'class' => 'checkbox',
'type' => 'checkbox', 'type' => 'checkbox',
'description' => __('Enable this setting if you would like to get information on leftover stocks from retailCRM to the website.', 'retailcrm') 'description' => __('Enable this setting if you would like to get information on leftover stocks from RetailCRM to the website.', 'retailcrm')
); );
/** /**
@ -432,7 +432,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
'label' => __('Upload', 'retailcrm'), 'label' => __('Upload', 'retailcrm'),
'title' => __('Uploading all customers and orders', 'retailcrm' ), 'title' => __('Uploading all customers and orders', 'retailcrm' ),
'type' => 'button', 'type' => 'button',
'description' => __('Uploading the existing customers and orders to retailCRM', 'retailcrm' ), 'description' => __('Uploading the existing customers and orders to RetailCRM', 'retailcrm' ),
'desc_tip' => true, 'desc_tip' => true,
'id' => 'uploads-retailcrm' 'id' => 'uploads-retailcrm'
); );
@ -452,7 +452,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
'label' => __('Generate now', 'retailcrm'), 'label' => __('Generate now', 'retailcrm'),
'title' => __('Generating ICML', 'retailcrm'), 'title' => __('Generating ICML', 'retailcrm'),
'type' => 'button', 'type' => 'button',
'description' => __('This functionality allows to generate ICML products catalog for uploading to retailCRM.', 'retailcrm'), 'description' => __('This functionality allows to generate ICML products catalog for uploading to RetailCRM.', 'retailcrm'),
'desc_tip' => true, 'desc_tip' => true,
'id' => 'icml-retailcrm' 'id' => 'icml-retailcrm'
); );
@ -493,14 +493,14 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
$this->form_fields['history'] = array( $this->form_fields['history'] = array(
'label' => __('Activate history uploads', 'retailcrm'), 'label' => __('Activate history uploads', 'retailcrm'),
'title' => __('Upload data from retailCRM', 'retailcrm'), 'title' => __('Upload data from RetailCRM', 'retailcrm'),
'class' => 'checkbox', 'class' => 'checkbox',
'type' => 'checkbox' 'type' => 'checkbox'
); );
$this->form_fields['deactivate_update_order'] = array( $this->form_fields['deactivate_update_order'] = array(
'label' => __('Disable data editing in retailCRM', 'retailcrm'), 'label' => __('Disable data editing in RetailCRM', 'retailcrm'),
'title' => __('Data updating in retailCRM', 'retailcrm'), 'title' => __('Data updating in RetailCRM', 'retailcrm'),
'class' => 'checkbox', 'class' => 'checkbox',
'type' => 'checkbox' 'type' => 'checkbox'
); );
@ -513,7 +513,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
); );
$this->form_fields['update_number'] = array( $this->form_fields['update_number'] = array(
'label' => __('Enable transferring the number to retailCRM', 'retailcrm'), 'label' => __('Enable transferring the number to RetailCRM', 'retailcrm'),
'title' => __('Transferring the order number', 'retailcrm'), 'title' => __('Transferring the order number', 'retailcrm'),
'class' => 'checkbox', 'class' => 'checkbox',
'type' => 'checkbox' 'type' => 'checkbox'
@ -707,7 +707,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
$wp_admin_bar->add_menu( $wp_admin_bar->add_menu(
array( array(
'id' => 'retailcrm_top_menu', 'id' => 'retailcrm_top_menu',
'title' => __('retailCRM', 'retailcrm') 'title' => __('RetailCRM', 'retailcrm')
) )
); );
$wp_admin_bar->add_menu( $wp_admin_bar->add_menu(

View File

@ -105,22 +105,14 @@ class WC_Retailcrm_Order extends WC_Retailcrm_Abstracts_Data
/** /**
* @param WC_Order $order * @param WC_Order $order
*/ */
protected function set_number($order) protected function set_number($order)
{ {
if ($this->is_new) { if (isset($this->settings['update_number']) && $this->settings['update_number'] == WC_Retailcrm_Base::YES ) {
$this->set_data_field('number', $order->get_order_number()); $this->set_data_field('number', $order->get_order_number());
} } else {
unset($this->data['number']);
if (isset($this->settings['update_number']) }
&& $this->settings['update_number'] == WC_Retailcrm_Base::YES }
) {
if (!$this->is_new) {
$this->set_data_field('number', $order->get_order_number());
}
} elseif (!$this->is_new) {
unset($this->data['number']);
}
}
public function reset_data() public function reset_data()
{ {