Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap

Conflicts:
	admin-dev/themes/default/template/controllers/modules/configure.tpl
This commit is contained in:
Kevin Granger
2013-11-18 10:23:23 +01:00
140 changed files with 3166 additions and 1338 deletions
+5
View File
@@ -1067,4 +1067,9 @@ class ValidateCore
{
return (preg_match('/^[0-1]\.[0-9]{1,2}(\.[0-9]{1,2}){0,2}$/', $version) && ip2long($version));
}
public static function isOrderInvoiceNumber($id)
{
return (preg_match('/^['.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).']*([0-9]+)?/i', $id));
}
}
+4 -2
View File
@@ -144,7 +144,7 @@ class HelperFormCore extends Helper
$uploader->setFiles(array(
0 => array(
'type' => HelperUploader::TYPE_IMAGE,
'image' => isset($params['thumb'])?'<img src="'.$params['thumb'].'" alt="'.$params['title'].'" title="'.$params['title'].'" />':null,
'image' => isset($params['thumb'])?'<img src="'.$params['thumb'].'" alt="'.(isset($params['title']) ? $params['title'] : '').'" title="'.(isset($params['title']) ? $params['title'] : '').'" />':null,
)));
$uploader->setTitle(isset($params['title'])?$params['title']:null);
@@ -245,7 +245,7 @@ class HelperFormCore extends Helper
*
* @return string
*/
public function renderAssoShop($params, $disable_shared = false)
public function renderAssoShop($disable_shared = false, $template_directory = null)
{
if (!Shop::isFeatureActive())
return;
@@ -288,6 +288,8 @@ class HelperFormCore extends Helper
}*/
$tree = new HelperTreeShops('shop-tree', 'Shops');
if (isset($template_directory))
$tree->setTemplateDirectory($template_directory);
$tree->setSelectedShops($assos);
$tree->setAttribute('table', $this->table);
return $tree->render();
+1 -1
View File
@@ -526,7 +526,7 @@ class HelperListCore extends Helper
if (Tools::getIsset($this->table.'Orderby'))
$order = '&'.$this->table.'Orderby='.urlencode($this->orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->orderWay));
$action = $this->currentIndex.$identifier.'&token='.$token.'#'.$this->table;
$action = $this->currentIndex.$identifier.'&token='.$token.'#'.$this->list_id;
/* Determine current page number */
$page = (int)Tools::getValue('submitFilter'.$this->list_id);
+16 -15
View File
@@ -212,36 +212,37 @@ class HelperTreeCategoriesCore extends TreeCore
$this->setAttribute('use_search', $this->useSearch());
}
$this->addAction(new TreeToolbarLink(
$collapse_all = new TreeToolbarLink(
'Collapse All',
'#',
'$(\'#'.$this->getId().'\').tree(\'collapseAll\')',
'icon-collapse-alt')
);
$this->addAction(new TreeToolbarLink(
'$(\'#'.$this->getId().'\').tree(\'collapseAll\');$(\'#collapse-all-'.$this->getId().'\').hide();$(\'#expand-all-'.$this->getId().'\').show();',
'icon-collapse-alt');
$collapse_all->setAttribute('id', 'collapse-all-'.$this->getId());
$expand_all = new TreeToolbarLink(
'Expand All',
'#',
'$(\'#'.$this->getId().'\').tree(\'expandAll\')',
'icon-expand-alt')
);
'$(\'#'.$this->getId().'\').tree(\'expandAll\');$(\'#collapse-all-'.$this->getId().'\').show();$(\'#expand-all-'.$this->getId().'\').hide();',
'icon-expand-alt');
$expand_all->setAttribute('id', 'expand-all-'.$this->getId());
$this->addAction($collapse_all);
$this->addAction($expand_all);
if ($this->useCheckBox())
{
$checkAll = new TreeToolbarLink(
$check_all = new TreeToolbarLink(
'Check All',
'#',
'checkAllAssociatedCategories($(\'#'.$this->getId().'\'));',
'icon-check-sign');
$checkAll->setAttribute('id', 'check-all-'.$this->getId());
$unCheckAll = new TreeToolbarLink(
$check_all->setAttribute('id', 'check-all-'.$this->getId());
$uncheck_all = new TreeToolbarLink(
'Uncheck All',
'#',
'uncheckAllAssociatedCategories($(\'#'.$this->getId().'\'));',
'icon-check-empty');
$unCheckAll->setAttribute('id', 'uncheck-all-'.$this->getId());
$this->addAction($checkAll);
$this->addAction($unCheckAll);
$uncheck_all->setAttribute('id', 'uncheck-all-'.$this->getId());
$this->addAction($check_all);
$this->addAction($uncheck_all);
$this->setNodeFolderTemplate('tree_node_folder_checkbox.tpl');
$this->setNodeItemTemplate('tree_node_item_checkbox.tpl');
$this->setAttribute('use_checkbox', $this->useCheckBox());
+22
View File
@@ -123,6 +123,28 @@ class OrderInvoiceCore extends ObjectModel
AND od.`id_order_invoice` = '.(int)$this->id);
}
public static function getInvoiceByNumber($id_invoice)
{
if (is_numeric($id_invoice))
$id_invoice = (int)($id_invoice);
elseif (is_string($id_invoice))
{
$matches = array();
if (preg_match('/^['.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).']*([0-9]+)?/i', $id_invoice, $matches) !== FALSE)
$id_invoice = $matches[1];
}
else
return false;
$id_order_invoice = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `id_order_invoice`
FROM `'._DB_PREFIX_.'order_invoice`
WHERE number = '.$id_invoice
);
return ($id_order_invoice ? new OrderInvoice($id_order_invoice) : false);
}
/**
* Get order products
*
+3 -3
View File
@@ -61,7 +61,7 @@ class TreeCore
if (!isset($this->_toolbar))
$this->setToolbar(new TreeToolbarCore());
$this->getToolbar()->setActions($value);
$this->getToolbar()->setTemplateDirectory($this->getTemplateDirectory())->setActions($value);
return $this;
}
@@ -70,7 +70,7 @@ class TreeCore
if (!isset($this->_toolbar))
$this->setToolbar(new TreeToolbarCore());
return $this->getToolbar()->getActions();
return $this->getToolbar()->setTemplateDirectory($this->getTemplateDirectory())->getActions();
}
public function setAttribute($name, $value)
@@ -293,7 +293,7 @@ class TreeCore
if (!isset($this->_toolbar))
$this->setToolbar(new TreeToolbarCore());
$this->getToolbar()->addAction($action);
$this->getToolbar()->setTemplateDirectory($this->getTemplateDirectory())->addAction($action);
return $this;
}
+7 -3
View File
@@ -40,12 +40,13 @@ class TreeToolbarCore implements ITreeToolbarCore
return $this->render();
}
public function setActions($value)
public function setActions($actions)
{
if (!is_array($value) && !$value instanceof Traversable)
if (!is_array($actions) && !$actions instanceof Traversable)
throw new PrestaShopException('Action value must be an traversable array');
$this->_actions = $value;
foreach($actions as $action)
$this->addAction($action);
}
public function getActions()
@@ -165,6 +166,9 @@ class TreeToolbarCore implements ITreeToolbarCore
if (!isset($this->_actions))
$this->_actions = array();
if (isset($this->_template_directory))
$action->setTemplateDirectory($this->getTemplateDirectory());
$this->_actions[] = $action;
return $this;
}
+40 -4
View File
@@ -155,13 +155,49 @@ abstract class TreeToolbarButtonCore
public function getTemplateDirectory()
{
if (!isset($this->_template_directory))
$this->_template_directory = $this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(0)
.self::DEFAULT_TEMPLATE_DIRECTORY);
$this->_template_directory = $this->_normalizeDirectory(self::DEFAULT_TEMPLATE_DIRECTORY);
return $this->_template_directory;
}
public function getTemplateFile($template)
{
if (preg_match_all('/((?:^|[A-Z])[a-z]+)/', get_class($this->getContext()->controller), $matches) !== FALSE)
$controllerName = strtolower($matches[0][1]);
if ($this->getContext()->controller instanceof ModuleAdminController)
return $this->_normalizeDirectory(
$this->getContext()->controller->getTemplatePath())
.$this->getTemplateDirectory().$template;
else if ($this->getContext()->controller instanceof AdminController
&& isset($controllerName) && file_exists($this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(0)).'controllers'
.DIRECTORY_SEPARATOR
.$controllerName
.DIRECTORY_SEPARATOR
.$this->getTemplateDirectory().$template))
return $this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(0)).'controllers'
.DIRECTORY_SEPARATOR
.$controllerName
.DIRECTORY_SEPARATOR
.$this->getTemplateDirectory().$template;
else if (file_exists($this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(1))
.$this->getTemplateDirectory().$template))
return $this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(1))
.$this->getTemplateDirectory().$template;
else if (file_exists($this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(0))
.$this->getTemplateDirectory().$template))
return $this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(0))
.$this->getTemplateDirectory().$template;
else
return $this->getTemplateDirectory().$template;
}
public function hasAttribute($name)
{
return (isset($this->_attributes)
@@ -171,7 +207,7 @@ abstract class TreeToolbarButtonCore
public function render()
{
return $this->getContext()->smarty->createTemplate(
$this->getTemplateDirectory().$this->getTemplate(),
$this->getTemplateFile($this->getTemplate()),
$this->getContext()->smarty
)->assign($this->getAttributes())->fetch();
}