Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/2.7.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Jones committed Feb 6, 2019
2 parents 2ae7c19 + 101abb4 commit 2923de0
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function getDefaultOperatorInputByType()
{
if (null === $this->_defaultOperatorInputByType) {
$this->_defaultOperatorInputByType = array(
'string' => array('==', '!=', '{}', '!{}', '^', '$', '!^', '!$', '()', '!()', '//'),
'string' => array('==', '!=', '{}', '!{}', '^', '$', '!^', '!$', '()', '!()', '^()', '!^()', '//'),
'numeric' => array('==', '!=', '>=', '>', '<=', '<', '..', '!..', '()', '!()'),
'numeric_b26' => array('==', '!=', '>=:b26', '>:b26', '<=:b26', '<:b26', '..:b26', '!..:b26', '()', '!()'),
'numeric_b36' => array('==', '!=', '>=:b36', '>:b36', '<=:b36', '<:b36', '..:b36', '!..:b36', '()', '!()'),
Expand Down Expand Up @@ -70,6 +70,8 @@ public function getDefaultOperatorOptions()
'$' => Mage::helper('meanship')->__('ends with'),
'!^' => Mage::helper('meanship')->__('does not begin with'),
'!$' => Mage::helper('meanship')->__('does not end with'),
'^()' => Mage::helper('rule')->__('begins with one of'),
'!^()' => Mage::helper('rule')->__('does not begin with one of'),
'//' => Mage::helper('meanship')->__('matches regex'),
);
}
Expand All @@ -86,7 +88,7 @@ public function getDefaultOperatorOptions()
*/
public function isArrayOperatorType() {
$op = $this->getOperator();
return $op === '()' || $op === '!()' || in_array($this->getInputType(), $this->_arrayInputTypes);
return $op === '()' || $op === '!()' || $op === '^()' || $op === '!^()' || in_array($this->getInputType(), $this->_arrayInputTypes);
}

/**
Expand Down Expand Up @@ -350,14 +352,30 @@ public function validateAttribute($validatedValue)
$result = (substr($validatedValue, -$length) === $value);
}
break;

case '^()': case '!^()':
if (!is_string($validatedValue)) {
return false;
} else {
$value = (array)$value;
foreach ($value as $item) {
$length = strlen($item);
if (substr($validatedValue, 0, $length) === $item) {
$result = true;
break;
}
}
}
break;

case '//':
if (Mage::helper('meanship')->isValidRegex($value)) {
$result = (bool)preg_match($value, $validatedValue);
}
break;
}

if (in_array($op, array('!=', '>', '<', '>:b26', '<:b26', '>:b36', '<:b36', '!..', '!..:b26', '!..:b36', '!{}', '!()', '!^', '!$'))) {
if (in_array($op, array('!=', '>', '<', '>:b26', '<:b26', '>:b36', '<:b36', '!..', '!..:b26', '!..:b36', '!{}', '!()', '!^', '!$', '!^()'))) {
$result = !$result;
}

Expand Down
3 changes: 2 additions & 1 deletion app/code/community/Meanbee/Shippingrules/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Meanbee_Shippingrules>
<version>2.7.4</version>
<version>2.7.6</version>
</Meanbee_Shippingrules>
</modules>
<global>
Expand Down Expand Up @@ -93,6 +93,7 @@
<condense_countries_on_grid>flag</condense_countries_on_grid>
<colapse_conditions_on_subcondition_on_grid>1</colapse_conditions_on_subcondition_on_grid>
<use_emoji_one>1</use_emoji_one>
<sallowspecific>0</sallowspecific>
</meanship>
</carriers>
</default>
Expand Down
20 changes: 20 additions & 0 deletions app/code/community/Meanbee/Shippingrules/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,26 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</collapse_conditions_on_subcondition_on_grid>
<sallowspecific translate="label">
<label>Ship to Applicable Countries</label>
<frontend_type>select</frontend_type>
<sort_order>100</sort_order>
<frontend_class>shipping-applicable-country</frontend_class>
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</sallowspecific>
<specificcountry translate="label">
<label>Ship to Specific Countries</label>
<frontend_type>multiselect</frontend_type>
<sort_order>101</sort_order>
<source_model>adminhtml/system_config_source_country</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<can_be_empty>1</can_be_empty>
</specificcountry>
</fields>
</meanship>
</groups>
Expand Down
15 changes: 15 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "meanbee/magento-shipping-rules",
"description": "Magento 1 extension that uses the power of the promotion rules system to create flat rate shipping methods based on conditions",
"homepage": "https://www.meanbee.com/magento-extensions/meanbee-shipping-rules.html",
"type": "magento-module",
"authors": [
{
"name": "Meanbee",
"email": "[email protected]"
}
],
"require": {
"magento-hackathon/magento-composer-installer": "^3.0.0"
}
}

0 comments on commit 2923de0

Please sign in to comment.