diff --git a/core/lib/Thelia/Core/Template/Loop/Category.php b/core/lib/Thelia/Core/Template/Loop/Category.php index 9dbb3ea2a..90b54e3fd 100644 --- a/core/lib/Thelia/Core/Template/Loop/Category.php +++ b/core/lib/Thelia/Core/Template/Loop/Category.php @@ -18,6 +18,7 @@ use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Element\PropelSearchLoopInterface; +use Thelia\Core\Template\Element\SearchLoopInterface; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; @@ -51,7 +52,7 @@ use Thelia\Model\ProductQuery; * @author Manuel Raynaud * @author Etienne Roudeix */ -class Category extends BaseI18nLoop implements PropelSearchLoopInterface +class Category extends BaseI18nLoop implements PropelSearchLoopInterface, SearchLoopInterface { protected $timestampable = true; protected $versionable = true; @@ -83,6 +84,23 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface ); } + /** + * @return array of available field to search in + */ + public function getSearchIn() + { + return [ + "title" + ]; + } + + public function doSearch(&$search, $searchTerm, $searchIn, $searchCriteria) + { + $search->_and(); + + $search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".$searchCriteria." ?", $searchTerm, \PDO::PARAM_STR); + } + public function buildModelCriteria() { $search = CategoryQuery::create(); diff --git a/core/lib/Thelia/Core/Template/Loop/Content.php b/core/lib/Thelia/Core/Template/Loop/Content.php index df0f18aff..5bae9f739 100644 --- a/core/lib/Thelia/Core/Template/Loop/Content.php +++ b/core/lib/Thelia/Core/Template/Loop/Content.php @@ -18,6 +18,7 @@ use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Element\PropelSearchLoopInterface; +use Thelia\Core\Template\Element\SearchLoopInterface; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; @@ -37,7 +38,7 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Content extends BaseI18nLoop implements PropelSearchLoopInterface +class Content extends BaseI18nLoop implements PropelSearchLoopInterface, SearchLoopInterface { protected $timestampable = true; protected $versionable = true; @@ -60,7 +61,20 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface new Argument( 'order', new TypeCollection( - new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual_reverse', 'random', 'given_id', 'created', 'created_reverse', 'updated', 'updated_reverse')) + new Type\EnumListType( + array( + 'alpha', + 'alpha-reverse', + 'manual', + 'manual_reverse', + 'random', + 'given_id', + 'created', + 'created_reverse', + 'updated', + 'updated_reverse' + ) + ) ), 'alpha' ), @@ -69,6 +83,23 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface ); } + /** + * @return array of available field to search in + */ + public function getSearchIn() + { + return [ + "title" + ]; + } + + public function doSearch(&$search, $searchTerm, $searchIn, $searchCriteria) + { + $search->_and(); + + $search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".$searchCriteria." ?", $searchTerm, \PDO::PARAM_STR); + } + public function buildModelCriteria() { diff --git a/core/lib/Thelia/Core/Template/Loop/Folder.php b/core/lib/Thelia/Core/Template/Loop/Folder.php index 7b6906e32..618c411e3 100644 --- a/core/lib/Thelia/Core/Template/Loop/Folder.php +++ b/core/lib/Thelia/Core/Template/Loop/Folder.php @@ -18,6 +18,7 @@ use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Element\PropelSearchLoopInterface; +use Thelia\Core\Template\Element\SearchLoopInterface; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; @@ -33,7 +34,7 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Folder extends BaseI18nLoop implements PropelSearchLoopInterface +class Folder extends BaseI18nLoop implements PropelSearchLoopInterface, SearchLoopInterface { protected $timestampable = true; protected $versionable = true; @@ -62,6 +63,23 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface ); } + /** + * @return array of available field to search in + */ + public function getSearchIn() + { + return [ + "title" + ]; + } + + public function doSearch(&$search, $searchTerm, $searchIn, $searchCriteria) + { + $search->_and(); + + $search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".$searchCriteria." ?", $searchTerm, \PDO::PARAM_STR); + } + public function buildModelCriteria() { $search = FolderQuery::create(); diff --git a/core/lib/Thelia/Core/Template/TemplateHelper.php b/core/lib/Thelia/Core/Template/TemplateHelper.php index ef6737890..c7c7c1163 100644 --- a/core/lib/Thelia/Core/Template/TemplateHelper.php +++ b/core/lib/Thelia/Core/Template/TemplateHelper.php @@ -60,13 +60,13 @@ class TemplateHelper $tplVar = 'active-front-template'; break; case TemplateDefinition::BACK_OFFICE: - $tplVar = 'active-front-template'; + $tplVar = 'active-admin-template'; break; case TemplateDefinition::PDF: - $tplVar = 'active-front-template'; + $tplVar = 'active-pdf-template'; break; case TemplateDefinition::EMAIL: - $tplVar = 'active-front-template'; + $tplVar = 'active-mail-template'; break; } diff --git a/core/lib/Thelia/Form/OrderDelivery.php b/core/lib/Thelia/Form/OrderDelivery.php index 74ad75f33..47d8bdfa8 100644 --- a/core/lib/Thelia/Form/OrderDelivery.php +++ b/core/lib/Thelia/Form/OrderDelivery.php @@ -66,19 +66,15 @@ class OrderDelivery extends BaseForm public function verifyDeliveryModule($value, ExecutionContextInterface $context) { $module = ModuleQuery::create() - ->filterByType(BaseModule::DELIVERY_MODULE_TYPE) - ->filterByActivate(1) - ->filterById($value) + ->filterActivatedByTypeAndId(BaseModule::DELIVERY_MODULE_TYPE, $value) ->findOne(); if (null === $module) { $context->addViolation(Translator::getInstance()->trans("Delivery module ID not found")); - } else { - if (! $module->isDeliveryModule()) { - $context->addViolation( - sprintf(Translator::getInstance()->trans("delivery module %s is not a Thelia\Module\DeliveryModuleInterface"), $module->getCode()) - ); - } + } elseif (! $module->isDeliveryModule()) { + $context->addViolation( + sprintf(Translator::getInstance()->trans("delivery module %s is not a Thelia\Module\DeliveryModuleInterface"), $module->getCode()) + ); } } diff --git a/core/lib/Thelia/Form/OrderPayment.php b/core/lib/Thelia/Form/OrderPayment.php index 9353eee37..6d1182a4a 100644 --- a/core/lib/Thelia/Form/OrderPayment.php +++ b/core/lib/Thelia/Form/OrderPayment.php @@ -66,16 +66,12 @@ class OrderPayment extends BaseForm public function verifyPaymentModule($value, ExecutionContextInterface $context) { $module = ModuleQuery::create() - ->filterByType(BaseModule::PAYMENT_MODULE_TYPE) - ->filterByActivate(1) - ->filterById($value) + ->filterActivatedByTypeAndId(BaseModule::PAYMENT_MODULE_TYPE, $value) ->findOne(); if (null === $module) { $context->addViolation("Payment module ID not found"); - } - - if (! $module->isPayementModule()) { + } elseif (! $module->isPayementModule()) { $context->addViolation( sprintf(Translator::getInstance()->trans("payment module %s is not a Thelia\Module\PaymentModuleInterface"), $module->getCode()) ); diff --git a/core/lib/Thelia/Model/ModuleQuery.php b/core/lib/Thelia/Model/ModuleQuery.php index c1f9394dd..fe08693af 100644 --- a/core/lib/Thelia/Model/ModuleQuery.php +++ b/core/lib/Thelia/Model/ModuleQuery.php @@ -3,6 +3,7 @@ namespace Thelia\Model; use Thelia\Model\Base\ModuleQuery as BaseModuleQuery; +use Thelia\Module\BaseModule; /** * Skeleton subclass for performing query and update operations on the 'module' table. @@ -24,7 +25,7 @@ class ModuleQuery extends BaseModuleQuery { if (null === self::$activated) { self::$activated = self::create() - ->filterByActivate(1) + ->filterByActivate(BaseModule::IS_ACTIVATED) ->orderByPosition() ->find(); } @@ -37,4 +38,17 @@ class ModuleQuery extends BaseModuleQuery self::$activated = null; } + /** + * @param int $moduleType the module type : classic, payment or delivery. Use BaseModule constant here. + * @param int $id the module id + * @return ModuleQuery + */ + public function filterActivatedByTypeAndId($moduleType, $id) + { + return $this + ->filterByType($moduleType) + ->filterByActivate(BaseModule::IS_ACTIVATED) + ->filterById($id); + } + } // ModuleQuery diff --git a/templates/backOffice/default/I18n/fr_FR.php b/templates/backOffice/default/I18n/fr_FR.php index 9b2f12be9..97b8e40ef 100755 --- a/templates/backOffice/default/I18n/fr_FR.php +++ b/templates/backOffice/default/I18n/fr_FR.php @@ -94,6 +94,7 @@ return array( 'Catalog' => 'Catalogue', 'Categories' => 'Rubriques', 'Categories in %cat' => 'Rubrique dans %cat', + 'Category' => 'Rubrique', 'Category created on %date_create. Last modification: %date_change' => 'Rubrique créée le %date_create. Dernière modification le %date_change', 'Category title' => 'Titre de la rubrique', 'Cellular phone' => 'Téléphone portable', @@ -140,6 +141,7 @@ return array( 'Confirm' => 'Confirmer', 'Confirm changes' => 'Valider les modifications', 'Confirmation' => 'Confirmation', + 'Content' => 'Contenu', 'Content title' => 'Titre du contenu', 'Contents in %fold' => 'Contenus dans %fold', 'Copy source text in input field' => 'Copier la source dans le champs de traduction', @@ -283,6 +285,7 @@ return array( 'Details' => 'Détails', 'Disabled' => 'Désactivé', 'Discount' => 'Remise', + 'Discount amount' => 'Montant de réduction', 'Do not use a product template' => 'Ne pas utiliser de gabarit', 'Do you really want to add this attribute to all product templates ?' => 'Voulez-vous vraiment ajouter cette déclinaison de tous les gabarits de produit ?', 'Do you really want to add this feature to all product templates ?' => 'Voulez-vous vraiment ajouter cette caractéristique à tous les gabarits de produit ?', @@ -488,6 +491,7 @@ return array( 'Flush the Thelia internal cache' => 'Vider le cache interne de Thelia', 'Flush the assets cache directory' => 'Vider le cache des assets web', 'Flush the images and documents cache' => 'Vider le caches des images et documents', + 'Folder' => 'Dossier', 'Folder created on %date_create. Last modification: %date_change' => 'Dossier créé le %date_create. Dernière modification le %date_change', 'Folder title' => 'Titre du dossier', 'Folders' => 'Dossiers', diff --git a/templates/backOffice/default/ajax/product-related-tab.html b/templates/backOffice/default/ajax/product-related-tab.html index 89b7b554d..ca5ae392e 100644 --- a/templates/backOffice/default/ajax/product-related-tab.html +++ b/templates/backOffice/default/ajax/product-related-tab.html @@ -94,7 +94,7 @@ {admin_position_block resource="admin.product" - access="update" + access="UPDATE" path={url path='/admin/product/update-content-position' product_id=$product_id current_tab="related"} url_parameter="content_id" in_place_edit_class="contentPositionChange" @@ -215,7 +215,7 @@ {admin_position_block resource="admin.product" - access="update" + access="UPDATE" path={url path='/admin/product/update-accessory-position' product_id=$product_id current_tab="related"} url_parameter="accessory_id" in_place_edit_class="accessoryPositionChange" diff --git a/templates/backOffice/default/ajax/template-attribute-list.html b/templates/backOffice/default/ajax/template-attribute-list.html index f9ee7737e..6b15d8790 100644 --- a/templates/backOffice/default/ajax/template-attribute-list.html +++ b/templates/backOffice/default/ajax/template-attribute-list.html @@ -54,7 +54,7 @@ {admin_position_block resource="admin.configuration.template" - access="update" + access="UPDATE" path={url path="admin/template/update-attribute-position" template_id=$template_id} url_parameter="attribute_id" in_place_edit_class="attributePositionChange" diff --git a/templates/backOffice/default/ajax/template-feature-list.html b/templates/backOffice/default/ajax/template-feature-list.html index 8c7cd04f8..a29893579 100644 --- a/templates/backOffice/default/ajax/template-feature-list.html +++ b/templates/backOffice/default/ajax/template-feature-list.html @@ -56,7 +56,7 @@ {admin_position_block resource="admin.configuration.template" - access="update" + access="UPDATE" path={url path="/admin/template/update-feature-position" template_id=$template_id} url_parameter="feature_id" in_place_edit_class="featurePositionChange" diff --git a/templates/backOffice/default/attribute-edit.html b/templates/backOffice/default/attribute-edit.html index 3af39c275..c9bfe3273 100644 --- a/templates/backOffice/default/attribute-edit.html +++ b/templates/backOffice/default/attribute-edit.html @@ -139,7 +139,7 @@ {admin_position_block resource="admin.configuration.attribute" - access="update" + access="UPDATE" path={url path='/admin/configuration/attributes-av/update-position' attribute_id=$attribute_id} url_parameter="attributeav_id" in_place_edit_class="positionChange" diff --git a/templates/backOffice/default/attributes.html b/templates/backOffice/default/attributes.html index 74c4d88aa..dd8fdb3eb 100644 --- a/templates/backOffice/default/attributes.html +++ b/templates/backOffice/default/attributes.html @@ -92,7 +92,7 @@ {admin_position_block resource="admin.configuration.attribute" - access="update" + access="UPDATE" path="/admin/configuration/attributes/update-position" url_parameter="attribute_id" in_place_edit_class="positionChange" diff --git a/templates/backOffice/default/categories.html b/templates/backOffice/default/categories.html index af5f4897f..2cd4e0309 100644 --- a/templates/backOffice/default/categories.html +++ b/templates/backOffice/default/categories.html @@ -133,7 +133,7 @@ {admin_position_block resource="admin.category" - access="update" + access="UPDATE" path={url path='admin/categories/update-position' category_id=$ID} url_parameter="category_id" in_place_edit_class="categoryPositionChange" @@ -304,7 +304,7 @@ {admin_position_block resource="admin.product" - access="update" + access="UPDATE" path={url path='/admin/products/update-position' product_id=$ID} url_parameter="product_id" in_place_edit_class="productPositionChange" diff --git a/templates/backOffice/default/currencies.html b/templates/backOffice/default/currencies.html index 344ead588..c0fbc9fd5 100644 --- a/templates/backOffice/default/currencies.html +++ b/templates/backOffice/default/currencies.html @@ -143,7 +143,7 @@ {admin_position_block resource="admin.configuration.currency" - access="update" + access="UPDATE" path="/admin/configuration/currencies/update-position" url_parameter="currency_id" in_place_edit_class="currencyPositionChange" diff --git a/templates/backOffice/default/feature-edit.html b/templates/backOffice/default/feature-edit.html index 3585c4756..179500fb9 100644 --- a/templates/backOffice/default/feature-edit.html +++ b/templates/backOffice/default/feature-edit.html @@ -139,7 +139,7 @@ {admin_position_block resource="admin.configuration.feature" - access="update" + access="UPDATE" path={url path='/admin/configuration/features-av/update-position' feature_id=$feature_id} url_parameter="featureav_id" in_place_edit_class="positionChange" diff --git a/templates/backOffice/default/features.html b/templates/backOffice/default/features.html index a2d59a047..93ebe2a3b 100644 --- a/templates/backOffice/default/features.html +++ b/templates/backOffice/default/features.html @@ -92,7 +92,7 @@ {admin_position_block resource="admin.configuration.feature" - access="update" + access="UPDATE" path="/admin/configuration/features/update-position" url_parameter="feature_id" in_place_edit_class="positionChange" diff --git a/templates/backOffice/default/folders.html b/templates/backOffice/default/folders.html index 7a078356c..908596293 100644 --- a/templates/backOffice/default/folders.html +++ b/templates/backOffice/default/folders.html @@ -133,7 +133,7 @@ {admin_position_block resource="admin.folder" - access="update" + access="UPDATE" path={url path='admin/folders/update-position' folder_id=$ID} url_parameter="folder_id" in_place_edit_class="folderPositionChange" @@ -291,7 +291,7 @@ {admin_position_block resource="admin.content" - access="update" + access="UPDATE" path={url path='/admin/content/update-position' content_id=$ID} url_parameter="content_id" in_place_edit_class="contentPositionChange" diff --git a/templates/backOffice/default/search.html b/templates/backOffice/default/search.html index b20e303d2..0455df987 100644 --- a/templates/backOffice/default/search.html +++ b/templates/backOffice/default/search.html @@ -170,6 +170,44 @@ {* end order search *} + {* category search *} +
+
+ + + + + + + + + + + + + + {loop type="category" name="category-search" visible="*" search_mode="sentence" search_term=trim($smarty.get.search_term) search_in="title"} + + + + + + + {/loop} + +
+ {intl l='Category'} +
{intl l="ID"}{intl l="Category title"}{intl l="Actions"}
{$ID}{$TITLE} +
+ {loop type="auth" name="can_change" role="ADMIN" resource="admin.category" access="UPDATE"} + + {/loop} +
+
+
+
+ {* end category search *} + {* product search *}
@@ -222,6 +260,92 @@
{* end product search *} + {* folder search *} +
+
+ + + + + + + + + + + + + + {loop type="folder" name="folder-search" visible="*" search_mode="sentence" search_term=trim($smarty.get.search_term) search_in="title"} + + + + + + + + + + + + {/loop} + +
+ {intl l='Folder'} +
{intl l="ID"}{intl l="Folder title"}{intl l="Actions"}
{$ID}{$TITLE} +
+ {loop type="auth" name="can_change" role="ADMIN" resource="admin.folder" access="UPDATE"} + + {/loop} +
+
+
+
+ {* end folder search *} + + {* content search *} +
+
+ + + + + + + + + + + + + + {loop type="content" name="content-search" visible="*" search_mode="sentence" search_term=trim($smarty.get.search_term) search_in="title"} + + + + + + + + + + + + {/loop} + +
+ {intl l='Content'} +
{intl l="ID"}{intl l="Content title"}{intl l="Actions"}
{$ID}{$TITLE} +
+ {loop type="auth" name="can_change" role="ADMIN" resource="admin.content" access="UPDATE"} + + {/loop} +
+
+
+
+ {* end content search *} +
diff --git a/templates/frontOffice/default/product.html b/templates/frontOffice/default/product.html index a3c57a371..cded40e73 100644 --- a/templates/frontOffice/default/product.html +++ b/templates/frontOffice/default/product.html @@ -111,15 +111,11 @@ {loop name="combi_meta" type="attribute_combination" product_sale_elements="$ID"} {if $LOOP_COUNT == 0} {if $QUANTITY == 0} - {assign var="current_stock_class" value = "out-of-stock"} {assign var="current_stock_href" value = "http://schema.org/OutOfStock"} - - {else} - - {assign var="current_stock_class" value = "out-of-stock"} - {assign var="current_stock_href" value = "http://schema.org/OutOfStock"} - + {else} + {assign var="current_stock_class" value = "in-stock"} + {assign var="current_stock_href" value = "http://schema.org/InStock"} {/if} {/if} {/loop}