Merge branch 'master' of https://github.com/thelia/thelia into french_translation

# By Franck Allimant (6) and stephaniepinet (1)
# Via Franck Allimant (2) and Manuel Raynaud (1)
* 'master' of https://github.com/thelia/thelia:
  Fixed issue 118
  Changed direct accesses to verifyStok by calls to checkAvailableStock
  Fixed exception when log file could not be renamed
  Added checkAvailableStock(), changed getPassedUrlView() to getObsoleteRewrittenUrlView()
  Fixed button wrapping when in tight spaces (e.g, tables)
  Added config variable titles
  Update CHANGELOG.txt
This commit is contained in:
gmorel
2013-12-05 17:26:19 +01:00
15 changed files with 101 additions and 40 deletions

View File

@@ -5,7 +5,7 @@
allow to create a customer in admin panel
translation is implemented :
- I18n directory in template or module.
- multiple extensions are available. We choose to used php but you can use other.
- multiple extensions are available. We choose to use php but you can use other.
- You can translate your template or module from the admin.
Admin hook exists. With this hooks, a module can insert code in admin pages
Admin hooks exist. With this hooks, a module can insert code in admin pages

View File

@@ -282,8 +282,12 @@ class Product extends BaseAction implements EventSubscriberInterface
$product->setTemplateId($template_id)->save($con);
// Create a new default product sale element
$product->createProductSaleElement($con, 0, 0, 0, $event->getCurrencyId(), true);
// Store all the stuff !
$con->commit();
} catch (\Exception $ex) {
$con->rollback();

View File

@@ -67,7 +67,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
if ($salesElement == null) {
// Create a new default product sale element
$salesElement = $event->getProduct()->createDefaultProductSaleElement($con, 0, 0, 0, $event->getCurrencyId(), true);
$salesElement = $event->getProduct()->createProductSaleElement($con, 0, 0, 0, $event->getCurrencyId(), true);
} else {
// This (new) one is the default
$salesElement->setIsDefault(true)->save($con);

View File

@@ -652,7 +652,7 @@ class ProductController extends AbstractCrudController
$this->dispatch(
TheliaEvents::PRODUCT_SET_TEMPLATE,
new ProductSetTemplateEvent($product, $template_id)
new ProductSetTemplateEvent($product, $template_id, $this->getCurrentEditionCurrency()->getId())
);
}

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

@@ -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)) {
@@ -175,6 +181,7 @@ class Attribute extends BaseI18nLoop implements PropelSearchLoopInterface
break;
}
}
echo "s=".$search->toString();
return $search;

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

@@ -141,7 +141,7 @@ class CartAdd extends BaseForm
->filterByProductId($data["product"])
->findOne();
if ($productSaleElements->getQuantity() < $value && ConfigQuery::read("verifyStock", 1) == 1) {
if ($productSaleElements->getQuantity() < $value && ConfigQuery::checkAvailableStock()) {
$context->addViolation("quantity value is not valid");
}
}

View File

@@ -78,10 +78,10 @@ class TlogDestinationFile extends AbstractTlogDestination
} while (file_exists($file_path_bk));
rename($file_path, $file_path_bk);
@rename($file_path, $file_path_bk);
touch($file_path);
chmod($file_path, 0666);
@touch($file_path);
@chmod($file_path, 0666);
}
$this->fh = fopen($file_path, $mode);

View File

@@ -36,7 +36,7 @@ class Cart extends BaseCart
if ($product &&
$productSaleElements &&
$product->getVisible() == 1 &&
($productSaleElements->getQuantity() > $cartItem->getQuantity() || ! ConfigQuery::read("verifyStock", 1)))
($productSaleElements->getQuantity() > $cartItem->getQuantity() || ! ConfigQuery::checkAvailableStock()))
{
$item = new CartItem();

View File

@@ -51,7 +51,7 @@ class CartItem extends BaseCartItem
$value = $currentQuantity;
}
if(ConfigQuery::read("verifyStock", 1) == 1)
if(ConfigQuery::checkAvailableStock())
{
$productSaleElements = $this->getProductSaleElements();
@@ -75,7 +75,7 @@ class CartItem extends BaseCartItem
$value = $currentQuantity;
}
if(ConfigQuery::read("verifyStock", 1) == 1)
if(ConfigQuery::checkAvailableStock())
{
$productSaleElements = $this->getProductSaleElements();

View File

@@ -77,9 +77,9 @@ class ConfigQuery extends BaseConfigQuery {
return self::read("page_not_found_view", '404.html');
}
public static function getPassedUrlView()
public static function getObsoleteRewrittenUrlView()
{
return self::read('passed_url_view', 'passed-url');
return self::read('obsolete_rewriten_url_view', 'obsolete-rewritten-url');
}
public static function useTaxFreeAmounts()
@@ -87,6 +87,11 @@ class ConfigQuery extends BaseConfigQuery {
return self::read('use_tax_free_amounts', 'default') == 1;
}
public static function checkAvailableStock()
{
return self::read('check-available-stock', 1) != 0;
}
/* smtp config */
public static function isSmtpEnable()
{

View File

@@ -202,7 +202,7 @@ class Product extends BaseProduct
->save($con)
;
// Create an empty product price in the default currency
// Create an empty product price in the provided currency
$product_price = new ProductPrice();
$product_price
@@ -267,7 +267,7 @@ class Product extends BaseProduct
->filterByView($this->getRewrittenUrlViewName())
->filterByViewId($this->getId())
->update(array(
"View" => ConfigQuery::getPassedUrlView()
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
));
$this->dispatchEvent(TheliaEvents::AFTER_DELETEPRODUCT, new ProductEvent($this));
}

View File

@@ -5,13 +5,12 @@ INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`date_format`,`time_format
(4, 'Italiano', 'it', 'it_IT', '', 'd/m/Y', 'H:i:s', 'd/m/y H:i:s', ',', ' ', '2', '0', NOW(), NOW());
INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updated_at`) VALUES
('session_config.default', '1', 1, 1, NOW(), NOW()),
('verifyStock', '1', 0, 0, NOW(), NOW()),
('session_config.handlers', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler', 0, 0, NOW(), NOW()),
('check-available-stock', '1', 0, 0, NOW(), NOW()),
('active-front-template', 'default', 0, 0, NOW(), NOW()),
('active-admin-template', 'default', 0, 0, NOW(), NOW()),
('active-pdf-template', 'default', 0, 0, NOW(), NOW()),
('active-mail-template', 'default', 0, 0, NOW(), NOW()),
('default_lang_without_translation', '1', 1, 1, NOW(), NOW()),
('rewriting_enable', '0', 0, 0, NOW(), NOW()),
('imagine_graphic_driver', 'gd', 0, 0, NOW(), NOW()),
('default_images_quality_percent', '75', 0, 0, NOW(), NOW()),
@@ -23,27 +22,55 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
('document_cache_dir_from_web_root', 'cache/documents', 0, 0, NOW(), NOW()),
('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW()),
('page_not_found_view', '404.html', 0, 0, NOW(), NOW()),
('passed_url_view', 'passed-url', 0, 0, NOW(), NOW()),
('obsolete_rewriten_url_view', 'obsolete-rewritten-url', 0, 0, NOW(), NOW()),
('use_tax_free_amounts', 0, 0, 0, NOW(), NOW()),
('process_assets', '1', 0, 0, NOW(), NOW()),
('thelia_admin_remember_me_cookie_name', 'tarmcn', 0, 0, NOW(), NOW()),
('thelia_admin_remember_me_cookie_expiration', 2592000, 0, 0, NOW(), NOW()),
('thelia_customer_remember_me_cookie_name', 'tcrmcn', 0, 0, NOW(), NOW()),
('thelia_customer_remember_me_cookie_expiration', 31536000, 0, 0, NOW(), NOW()),
('session_config.handlers', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler', 0, 0, NOW(), NOW()),
('store_name','', 0, 1, NOW(), NOW()),
('store_email','', 0, 1, NOW(), NOW()),
('url_site','', 0, 0, NOW(), NOW()),
('one_domain_foreach_lang','0', 1, 1, NOW(), NOW()),
('pdf_invoice_file', 'invoice', 0, 0, NOW(), NOW()),
('pdf_delivery_file', 'delivery', 0, 0, NOW(), NOW()),
('session_config.default', '1', 1, 1, NOW(), NOW()),
('default_lang_without_translation', '1', 1, 1, NOW(), NOW()),
('store_name','', 0, 1, NOW(), NOW()),
('store_email','', 0, 1, NOW(), NOW()),
('one_domain_foreach_lang','0', 1, 1, NOW(), NOW()),
('thelia_version','2.0.0-beta1', 1, 1, NOW(), NOW()),
('thelia_major_version','2', 1, 1, NOW(), NOW()),
('thelia_minus_version','0', 1, 1, NOW(), NOW()),
('thelia_release_version','0', 1, 1, NOW(), NOW()),
('thelia_extra_version','beta1', 1, 1, NOW(), NOW())
;
('thelia_extra_version','beta1', 1, 1, NOW(), NOW());
INSERT INTO `config_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
(1, 'en_US', 'Class name of the session handler', NULL, NULL, NULL),
(2, 'en_US', 'Check available product stock (1) or ignore it (0) when displaying and changing ordered quantity', NULL, NULL, NULL),
(3, 'en_US', 'Name of the active front-office template', NULL, NULL, NULL),
(4, 'en_US', 'Name of the active back-office template', NULL, NULL, NULL),
(5, 'en_US', 'Name of the active PDF template', NULL, NULL, NULL),
(6, 'en_US', 'Name of the active mailing template', NULL, NULL, NULL),
(7, 'en_US', 'Enable (1) or disable (0) URL rewriting', NULL, NULL, NULL),
(8, 'en_US', 'Name of the graphic driver used by the Imagine library (see https://imagine.readthedocs.org)', NULL, NULL, NULL),
(9, 'en_US', 'The default quality (in %) of the generated images', NULL, NULL, NULL),
(10, 'en_US', 'How original (full resolution) images are delivered in the web space (symlink or copy)', NULL, NULL, NULL),
(11, 'en_US', 'How document files are delivered in the web space (symlink or copy)', NULL, NULL, NULL),
(12, 'en_US', 'Path to the directory where images are stored', NULL, NULL, NULL),
(13, 'en_US', 'Path to the directory where documents are stored', NULL, NULL, NULL),
(14, 'en_US', 'The path to the image cache directory in the web space', NULL, NULL, NULL),
(15, 'en_US', 'The path to the document cache directory in the web space', NULL, NULL, NULL),
(16, 'en_US', 'The URL to update exchange rates', NULL, NULL, NULL),
(17, 'en_US', 'File name of the 404 (not found) view in the current template (with extension, e.g. 404.html)', NULL, NULL, NULL),
(18, 'en_US', 'Name of the template view returned when an obsolete (or inactive) product URL is invoked', NULL, NULL, NULL),
(19, 'en_US', 'Display and process prices with (0) or without (1) taxes.', NULL, NULL, NULL),
(20, 'en_US', 'Compile templates assets automatically upon asset source change (1 = yes, 0 = no)', NULL, NULL, NULL),
(21, 'en_US', '"Remember me" cookie name for administration users', NULL, NULL, NULL),
(22, 'en_US', '"Remember me" cookie expiration time, in seconds, for administration users', NULL, NULL, NULL),
(23, 'en_US', '"Remember me" cookie name for customer users', NULL, NULL, NULL),
(24, 'en_US', '"Remember me" cookie expiration time, in seconds, for customer users', NULL, NULL, NULL),
(25, 'en_US', 'Base URL of the shop (e.g. http://www.yourshopdomain.com)', NULL, NULL, NULL),
(26, 'en_US', 'Name of the invoice view in the current PDF template (without extension)', NULL, NULL, NULL),
(27, 'en_US', 'Name of the delivery view in the current PDF template (without extension)', NULL, NULL, NULL);
INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES
(1, 'TheliaDebugBar', 1, 1, 1, 'TheliaDebugBar\\TheliaDebugBar', NOW(), NOW()),

View File

@@ -138,17 +138,6 @@
}
}
.Blocmoncompte {
float: right;
margin: 0px;
padding: 0px;
margin-top: 35px;
color: white;
font-size: 13px;
text-shadow: 0px 1px 0px rgba(0,0,0,0.8);
}
dt {
float: left;
margin-right: 15px;
@@ -172,6 +161,16 @@
width: 100%;
}
.btn-group {
white-space: nowrap; // prevent buttons from wrapping when in tight spaces (e.g., the table on the tests page)
> .btn {
float: inherit;
}
> .btn + .btn {
margin-left: -4px;
}
}
// -- Login form --------------------------------------------------------------
.form-signin {