Skip to content

Commit

Permalink
Merge pull request #78 from JBZoo-CCK/develop
Browse files Browse the repository at this point in the history
Develop to master 4.11
  • Loading branch information
CB9TOIIIA authored Jul 12, 2020
2 parents 746e75e + f8af152 commit 7e04018
Show file tree
Hide file tree
Showing 106 changed files with 12,779 additions and 12,120 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
language: php

php:
- 7.2
- 7.3

matrix:
fast_finish: true
include:
- php: 7.2
- php: 7.3

script:
- make dev
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* JBZoo Application
*
* This file is part of the JBZoo CCK package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Application
* @license GPL-2.0
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @link https://github.com/JBZoo/JBZoo
* @author Denis Smetannikov <[email protected]>
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

echo $order->track;
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* JBZoo Application
*
* This file is part of the JBZoo CCK package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Application
* @license GPL-2.0
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @link https://github.com/JBZoo/JBZoo
* @author Denis Smetannikov <[email protected]>
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

/**
* Class JBCartElementEmailOrderID
*/
class JBCartElementEmailTrack extends JBCartElementEmail
{
/**
* @param array $params
* @return bool
*/
public function hasValue($params = array())
{
return $this->getOrder()->track;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
JBZoo Application
This file is part of the JBZoo CCK package.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
@package Application
@license GPL-2.0
@copyright Copyright (C) JBZoo.com, All rights reserved.
@link https://github.com/JBZoo/JBZoo
-->
<element type="element" group="Core" hidden="false">
<name>JBZOO_ELEMENT_EMAIL_TRACK_NAME</name>
<author>JBZoo.com</author>
<creationDate>2014</creationDate>
<copyright>Copyright (C) JBZoo.com</copyright>
<authorEmail>[email protected]</authorEmail>
<authorUrl>http://jbzoo.com</authorUrl>
<version>1.0</version>
<description>JBZOO_ELEMENT_EMAIL_TRACK_DESC</description>

</element>
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@
<authorUrl>http://jbzoo.com</authorUrl>
<version>1.0</version>
<description>JBZOO_ELEMENT_ORDER_CHECKBOX_DESC</description>

<params>

<param name="access" type="zooaccesslevel" default="" label="JBZOO_ELEMENT_ACCESS"
description="JBZOO_ELEMENT_ACCESS_DESC"/>

</params>

</element>
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@
<authorUrl>http://jbzoo.com</authorUrl>
<version>1.0</version>
<description>JBZOO_ELEMENT_ORDER_RADIO_DESC</description>

<params>

<param name="access" type="zooaccesslevel" default="" label="JBZOO_ELEMENT_ACCESS"
description="JBZOO_ELEMENT_ACCESS_DESC"/>

</params>

</element>
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
'value' => isset($userFields[$userField]) ? $userFields[$userField] : null,
);

echo '<textarea ' . $this->app->jbhtml->buildAttrs($attrs) . '>' . $value . '</textarea>';
echo '<textarea rows="5" cols="100" ' . $this->app->jbhtml->buildAttrs($attrs) . '>' . $value . $userFields[$userField] . '</textarea>';
Original file line number Diff line number Diff line change
Expand Up @@ -47,40 +47,18 @@
<field name="file_name" type="text" default="yml" label="JBZOO_CONFIG_YML_FILE_NAME"
description="JBZOO_CONFIG_YML_FILE_NAME_DESC"/>

<field name="spacer_item_listimtes3" type="jbspacer" default="JBZOO_CONFIG_MY_ITEMS_HACKS_ON"/>
<field name="spacer_rules" type="jbspacer" default="JBZOO_CONFIG_YML_CUSTOM_RULES_SEPARATOR"/>

<field name="my_items_edit" type="jbbool" default="0" label="JBZOO_CONFIG_YML_ONLY_MY_LISTIMTES_CUSTOM_RULES_MODE"
description="JBZOO_CONFIG_YML_ONLY_MY_PHP_CUSTOM_RULES_MODE_DESC"/>
<field name="enable_rules" type="jbbool" default="0" label="JBZOO_CONFIG_YML_CUSTOM_RULES"
description="JBZOO_CONFIG_YML_CUSTOM_RULES_DESC"/>

<field name="spacer_item_listimtes" type="jbspacer" default="JBZOO_CONFIG_MY_ITEMS_HACKS_LIST"/>
<field name="include" type="textarea" default="" label="JBZOO_CONFIG_YML_CUSTOM_ITEMS"
description="JBZOO_CONFIG_YML_CUSTOM_ITEMS_DESC"/>

<field name="my_items_mode_listimtes" type="jbbool" default="0" label="JBZOO_CONFIG_YML_ONLY_MY_LISTIMTES_CUSTOM_RULES_MODE_CUSTOM"
description="JBZOO_CONFIG_YML_ONLY_MY_PHP_CUSTOM_RULES_MODE_DESC"/>

<field name="only_my_listitems_rules" type="textarea" default="" label="JBZOO_CONFIG_YML_ONLY_MY_LISTITEMS_RULES"
description="JBZOO_CONFIG_YML_ONLY_MY_LISTITEMS_RULES_DESC"/>

<field name="spacer_item" type="jbspacer" default="JBZOO_CONFIG_MY_ITEMS_HACKS_EL"/>

<field name="my_items_mode_listimtes_el" type="jbbool" default="0" label="JBZOO_CONFIG_YML_ONLY_MY_LISTIMTES_CUSTOM_RULES_MODE_CUSTOM"
description="JBZOO_CONFIG_YML_ONLY_MY_PHP_CUSTOM_RULES_MODE_DESC"/>


<field name="my_items_mode_or" type="list" default="0" label="JBZOO_EL_MODE"
description="JBZOO_EL_MODE_DESC">
<option value="no">Не содержит в поле данное значение</option>
<option value="and">Только items с данным значением</option>
</field>

<field name="only_my_items_elements" type="text" default="" label="JBZOO_CONFIG_YML_ONLY_MY_ITEMS"
description="JBZOO_CONFIG_YML_ONLY_MY_ITEMS_DESC"/>

<field name="only_my_items_customrules" type="text" default="option.0" label="JBZOO_CONFIG_YML_ONLY_MY_ITEMS_VALUE_CUSTOMRULES"
description="JBZOO_CONFIG_YML_ONLY_MY_ITEMS_VALUE_CUSTOMRULES_DESC"/>

<field name="only_my_items_value" type="text" default="yes" label="JBZOO_CONFIG_YML_ONLY_MY_ITEMS_VALUE"
description="JBZOO_CONFIG_YML_ONLY_MY_ITEMS_VALUE_DESC"/>
<field name="condition" type="subform"
formsource="/media/zoo/applications/jbuniversal/config/forms/subforms/yandexyml.xml" multiple="true" layout="joomla.form.field.subform.repeatable"
label="JBZOO_CONFIG_YML_CUSTOM_CONDITIONS" description="JBZOO_CONFIG_YML_CUSTOM_CONDITIONS_DESC" />

</fieldset>
</fields>
</form>
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
JBZoo Application
This file is part of the JBZoo CCK package.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
@package Application
@license GPL-2.0
@copyright Copyright (C) JBZoo.com, All rights reserved.
@link https://github.com/JBZoo/JBZoo
-->
<form>
<fields>
<fieldset name="configyml" label="" addfieldpath="/media/zoo/applications/jbuniversal/joomla/fields">

<field name="element" type="jbelements" default="" label="JBZOO_CONFIG_YML_CUSTOM_CONDITIONS_ELEMENTS"
description="JBZOO_CONFIG_YML_CUSTOM_CONDITIONS_ELEMENTS_DESC"/>

<field name="mode" type="list" default="0" label="JBZOO_CONFIG_YML_CUSTOM_CONDITIONS_MODE"
description="JBZOO_CONFIG_YML_CUSTOM_CONDITIONS_MODE_DESC">
<option value="equal">JBZOO_CONFIG_YML_CUSTOM_CONDITIONS_MODE_EQUAL</option>
<option value="no-equal">JBZOO_CONFIG_YML_CUSTOM_CONDITIONS_MODE_NOT_EQUAL</option>
</field>

<field name="value" type="text" default="yes" label="JBZOO_CONFIG_YML_CUSTOM_CONDITIONS_VALUE"
description="JBZOO_CONFIG_YML_CUSTOM_CONDITIONS_VALUE_DESC"/>
</fieldset>
</fields>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ class JBCartOrder
*/
public $comment;

/**
* @var string
*/
public $track;

/**
* @var ParameterData
*/
Expand Down Expand Up @@ -1099,6 +1104,7 @@ public function setData($data)
$this->modified = $data->get('modified');
$this->created_by = $data->get('created_by');
$this->comment = $data->get('comment');
$this->track = $data->get('track');
$this->params = $this->app->data->create($data->get('params'));

$this->setStatus($data->get('status'));
Expand Down Expand Up @@ -1253,8 +1259,10 @@ public function updateData($data)
}
}

$this->comment = $data->get('comment');
$this->comment = $data->get('comment');

$this->setStatus($data->get('status'), JBCart::STATUS_ORDER);
$this->setTrack($data->get('track'));
}

/**
Expand Down Expand Up @@ -1318,6 +1326,33 @@ public function setStatusList(array $statList)

}

/**
* Set the Order track
* @param string $track The new Order track
* @return $this
*/
public function setTrack($track)
{
$newTrack = JString::trim($track);
$oldTrack = $this->track;

$this->track = $newTrack;

if (empty($oldTrack) && !empty($newTrack)) {
$this->app->jbevent->fire($this, 'basket:addTrack', array(
'track' => (string) $newTrack,
));
}

if (!empty($track) && (string)$oldTrack != (string)$newTrack) {
$this->app->jbevent->fire($this, 'basket:changeTrack', array(
'track' => (string) $newTrack,
));
}

return $this;
}

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public function __construct($params, $module)

$this->app = App::getInstance('zoo');

// register helper path
$template = $this->app->zoo->getApplication()->getTemplate()->name;
$this->app->jbtemplate->regHelpersByTpl($template);

// vars
$this->_params = $params;
$this->_module = $module;
Expand Down Expand Up @@ -262,4 +266,4 @@ public function partial($layout = null, $vars = [])

return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,20 @@ public static function recount($event)
self::app()->jbevent->fireElements($event);
}

/**
* @param AppEvent $event
*/
public static function addTrack($event)
{
self::app()->jbevent->fireElements($event);
}

/**
* @param AppEvent $event
*/
public static function changeTrack($event)
{
self::app()->jbevent->fireElements($event);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ class JBEventHelper extends AppHelper
'name' => 'order_removeitems',
),

// order track
'basket:addtrack' => array(
'name' => 'order_addtrack',
),
'basket:changetrack' => array(
'name' => 'order_changetrack',
),
);

/**
Expand Down Expand Up @@ -186,7 +193,7 @@ public function fireElements(AppEvent $event)
* @param array $params
*/
protected function _execElements($event, $elements, $order, $params)
{
{
$elements = (array)$elements;
if (empty($elements)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ protected function _getHash($mainPath)
protected function _getProcessor($addPath = array())
{
if (!class_exists('Less_Parser')) {
require_once JPATH_ROOT . '/media/zoo/applications/jbuniversal/framework/libs/less.gpeasy.php';
require_once JPATH_ROOT . '/media/zoo/applications/jbuniversal/framework/libs/lessphp/lib/Less/Autoloader.php';

Less_Autoloader::register();
}

$options = array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class JBOrderMacrosHelper extends AppHelper
'order_shipping_name',
'order_shipping_elem',
'order_shipping_stat',
'order_track',

'user_id',
'user_name',
Expand Down Expand Up @@ -236,6 +237,8 @@ private function _replaceMacros($text, $macros, JBCartOrder $order = null)
}
}

} else if ($macros == 'order_track') {
$replace = $order->track;
} else {
throw new Exception('Undefined email macros: "{' . $macros . '}"');
}
Expand Down
Loading

0 comments on commit 7e04018

Please sign in to comment.