Merge branch 'master' into modules

This commit is contained in:
Franck Allimant
2013-12-06 17:16:14 +01:00
316 changed files with 4064 additions and 1708 deletions

View File

@@ -23,7 +23,7 @@
namespace Thelia\Core\Event\Coupon;
use Thelia\Core\Event\ActionEvent;
use Thelia\Coupon\ConditionCollection;
use Thelia\Condition\ConditionCollection;
use Thelia\Model\Coupon;
/**
@@ -39,7 +39,7 @@ use Thelia\Model\Coupon;
*/
class CouponCreateOrUpdateEvent extends ActionEvent
{
/** @var ConditionCollection Array of ConditionManagerInterface */
/** @var ConditionCollection Array of ConditionInterface */
protected $conditions = null;
/** @var string Coupon code (ex: XMAS) */
@@ -280,7 +280,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
/**
* Get Conditions
*
* @return null|ConditionCollection Array of ConditionManagerInterface
* @return null|ConditionCollection Array of ConditionInterface
*/
public function getConditions()
{
@@ -290,7 +290,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
/**
* Set Conditions
*
* @param ConditionCollection $conditions Array of ConditionManagerInterface
* @param ConditionCollection $conditions Array of ConditionInterface
*
* @return $this
*/

View File

@@ -22,18 +22,19 @@
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
use Thelia\Model\Product;
class ProductSetTemplateEvent extends ProductEvent
{
public $template_id = null;
protected $template_id = null;
protected $currency_id = 0;
public function __construct(Product $product = null, $template_id)
public function __construct(Product $product = null, $template_id, $currency_id)
{
parent::__construct($product);
$this->template_id = $template_id;
$this->currency_id = $currency_id;
}
public function getTemplateId()
@@ -48,4 +49,15 @@ class ProductSetTemplateEvent extends ProductEvent
return $this;
}
}
public function getCurrencyId()
{
return $this->currency_id;
}
public function setCurrencyId($currency_id)
{
$this->currency_id = $currency_id;
return $this;
}
}

View File

@@ -38,20 +38,6 @@ final class TheliaEvents
*/
const BOOT = "thelia.boot";
/**
* ACTION event
*
* Sent if no action are already present in Thelia action process ( see Thelia\Routing\Matcher\ActionMatcher)
*/
const ACTION = "thelia.action";
/**
* INCLUDE event
*
* Sent before starting thelia inclusion
*/
const INCLUSION = "thelia.include";
/**
* Sent before the logout of the customer.
*/
@@ -681,7 +667,7 @@ final class TheliaEvents
const MAILTRANSPORTER_CONFIG = 'action.mailertransporter.config';
/**
* sent when Thelia try to generate a rewriten url
* sent when Thelia try to generate a rewritten url
*/
const GENERATE_REWRITTENURL = 'action.generate_rewritenurl';

View File

@@ -120,6 +120,12 @@ class Attribute extends BaseI18nLoop implements PropelSearchLoopInterface
if (! is_null($tpl_id)) $template[] = $tpl_id;
}
}
// franck@cqfdev.fr - 05/12/2013 : if the given product has no template
// or if the product cannot be found, do not return anything.
if (empty($template)) {
return null;
}
}
if (! empty($template)) {
@@ -177,7 +183,6 @@ class Attribute extends BaseI18nLoop implements PropelSearchLoopInterface
}
return $search;
}
public function parseResults(LoopResult $loopResult)

View File

@@ -26,7 +26,7 @@ namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Util\PropelModelPager;
use Thelia\Condition\ConditionFactory;
use Thelia\Condition\ConditionManagerInterface;
use Thelia\Condition\Implementation\ConditionInterface;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
@@ -106,7 +106,7 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
/** @var CouponInterface $couponManager */
$couponManager = $this->container->get($coupon->getType());
$couponManager->set(
$this->container->get('thelia.adapter'),
$this->container->get('thelia.facade'),
$coupon->getCode(),
$coupon->getTitle(),
$coupon->getShortDescription(),
@@ -125,7 +125,7 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
$daysLeftBeforeExpiration = floor($datediff/(60*60*24));
$cleanedConditions = array();
/** @var ConditionManagerInterface $condition */
/** @var ConditionInterface $condition */
foreach ($conditions->getConditions() as $condition) {
$cleanedConditions[] = $condition->getToolTip();
}

View File

@@ -110,6 +110,7 @@ class Feature extends BaseI18nLoop implements PropelSearchLoopInterface
$this->useFeaturePosition = true;
if (null !== $product) {
// Find all template assigned to the products.
$products = ProductQuery::create()->findById($product);
@@ -125,6 +126,12 @@ class Feature extends BaseI18nLoop implements PropelSearchLoopInterface
if (! is_null($tpl_id)) $template[] = $tpl_id;
}
}
// franck@cqfdev.fr - 05/12/2013 : if the given product has no template
// or if the product cannot be found, do not return anything.
if (empty($template)) {
return null;
}
}
if (! empty($template)) {

View File

@@ -64,7 +64,8 @@ class Template extends BaseLoop implements ArraySearchLoopInterface
new Type\EnumListType(array(
'front-office',
'back-office',
'pdf'
'pdf',
'email'
))
)
)
@@ -80,6 +81,8 @@ class Template extends BaseLoop implements ArraySearchLoopInterface
$templateType = TemplateDefinition::BACK_OFFICE;
else if ($type == 'pdf')
$templateType = TemplateDefinition::PDF;
else if ($type == 'email')
$templateType = TemplateDefinition::EMAIL;
return TemplateHelper::getInstance()->getList($templateType);
}

View File

@@ -131,19 +131,19 @@ class TemplateHelper
}
/**
* Récursively examine files in a directory tree, and extract translatable strings.
* Recursively examine files in a directory tree, and extract translatable strings.
*
* Returns an array of translatable strings, each item having with the following structure:
* 'files' an arfray of file names in which the string appears,
* 'files' an array of file names in which the string appears,
* 'text' the translatable text
* 'translation' => the text translation, or an empty string if none available.
* 'dollar' => true if the translatable text contains a $
*
* @param string $directory the path to the directory to examine
* @param string $walkMode type of file scanning: WALK_MODE_PHP or WALK_MODE_TEMPLATE
* @param Thelia\Core\Translation\Translator $translator the current translator
* @param \Thelia\Core\Translation\Translator $translator the current translator
* @param string $currentLocale the current locale
* @param array $strings the liste of strings
* @param array $strings the list of strings
* @throws \InvalidArgumentException if $walkMode contains an invalid value
* @return number the total number of translatable texts
*/
@@ -258,15 +258,15 @@ class TemplateHelper
fwrite($fp, ");\n");
@fclose($fh);
@fclose($fp);
}
else
{
throw new \RuntimeException(
$this->getTranslator()->trans(
"Failed to open translation file %file. Please be sure that this file is writable by your Web server",
array('%file' => $file)
)
Translator::getInstance()->trans(
'Failed to open translation file %file. Please be sure that this file is writable by your Web server',
array('%file' => $file)
)
);
}
}