// revert commit 9463

This commit is contained in:
lLefevre
2011-10-19 14:47:37 +00:00
parent 99aa249393
commit 1a93019ee3
4 changed files with 26 additions and 316 deletions
+2 -3
View File
@@ -60,7 +60,7 @@ class AdminOrders extends AdminTab
'payment' => array('title' => $this->l('Payment'), 'width' => 100),
'osname' => array('title' => $this->l('Status'), 'widthColumn' => 230, 'type' => 'select', 'select' => $statesArray, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'width' => 200),
'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'),
'id_pdf' => array('title' => $this->l('PDF'), 'callback' => 'printPDtFIcons', 'orderby' => false, 'search' => false));
'id_pdf' => array('title' => $this->l('PDF'), 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false));
$this->shopLinkType = 'shop';
$this->shopShareDatas = Shop::SHARE_ORDER;
parent::__construct();
@@ -1002,5 +1002,4 @@ class AdminOrders extends AdminTab
}
return $total;
}
}
}
+3 -4
View File
@@ -26,7 +26,7 @@
*/
include(_PS_ADMIN_DIR_.'/tabs/AdminOrdersStates.php');
include(_PS_CONTROLLER_DIR_.'/admin/AdminReturnStatesController.php');
include(_PS_ADMIN_DIR_.'/tabs/AdminReturnStates.php');
class AdminStatuses extends AdminTab
{
@@ -37,7 +37,7 @@ class AdminStatuses extends AdminTab
{
$this->table = array('order_state', 'order_return_state');
$this->adminOrdersStates = new adminOrdersStates();
$this->adminReturnStates = new AdminReturnStatesController();
$this->adminReturnStates = new adminReturnStates();
parent::__construct();
}
@@ -77,8 +77,7 @@ class AdminStatuses extends AdminTab
if (!Tools::isSubmit('updateorder_return_state') AND !Tools::isSubmit('submitAddorder_return_state'))
echo '<div style="margin:10px">&nbsp;</div>';
echo '<h2>'.$this->l('Order return statuses').'</h2>';
$this->adminReturnStates->initContent($this->token);
$this->adminReturnStates->display($this->token);
}
}
}
+21 -1
View File
@@ -923,6 +923,26 @@ class OrderCore extends ObjectModel
$this->update();
}
public static function printPDFIcons($id_order, $tr)
{
$order = new Order($id_order);
$orderState = OrderHistory::getLastOrderState($id_order);
if (!Validate::isLoadedObject($orderState) OR !Validate::isLoadedObject($order))
die(Tools::displayError('Invalid objects'));
echo '<span style="width:20px; margin-right:5px;">';
if (($orderState->invoice AND $order->invoice_number) AND (int)($tr['product_number']))
echo '<a href="pdf.php?id_order='.(int)($order->id).'&pdf"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>';
else
echo '&nbsp;';
echo '</span>';
echo '<span style="width:20px;">';
if ($orderState->delivery AND $order->delivery_number)
echo '<a href="pdf.php?id_delivery='.(int)($order->delivery_number).'"><img src="../img/admin/delivery.gif" alt="delivery" /></a>';
else
echo '&nbsp;';
echo '</span>';
}
public static function getByDelivery($id_delivery)
{
$sql = 'SELECT id_order
@@ -1022,4 +1042,4 @@ class OrderCore extends ObjectModel
DELETE FROM `'._DB_PREFIX_.'order_detail`
WHERE `id_order` = '.(int)($this->id)) !== false);
}
}
}
-308
View File
@@ -1,314 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
//
// IMPORTANT : don't forget to delete the underscore _ in the file name if you want to use it !
//
// if FB class is already loaded, just enable it. else, enable it only if fb.php exists and is loaded
if (!defined('PS_USE_FIREPHP') AND class_exists('FB'))
define('PS_USE_FIREPHP',true);
elseif (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'fb.php'))
{
if (!defined('PS_USE_FIREPHP'))
{
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'fb.php');
define('PS_USE_FIREPHP',true);
}
else
define('PS_USE_FIREPHP',false);
}
else
define('PS_USE_FIREPHP',class_exists('FB'));
class Tools extends ToolsCore
{
/**
* Redirect user to another page after 5 sec
*
* @param string $url Desired URL
* @param string $baseUri Base URI (optional)
*/
public static function redirect($url, $baseUri = __PS_BASE_URI__, Link $link = null)
{
if (!$link)
$link = Context::getContext()->link;
if (strpos($url, 'http://') === FALSE && strpos($url, 'https://') === FALSE)
{
if (strpos($url, $baseUri) !== FALSE && strpos($url, $baseUri) == 0)
$url = substr($url, strlen($baseUri));
$explode = explode('?', $url);
$url = $link->getPageLink($explode[0], true);
if (isset($explode[1]))
$url .= '?'.$explode[1];
$baseUri = '';
}
if (isset($_SERVER['HTTP_REFERER']) AND ($url == $_SERVER['HTTP_REFERER']))
header('Refresh: 5; url='.$_SERVER['HTTP_REFERER']);
else
header('Refresh: 5; url='.$baseUri.$url);
echo '<h1>Redirection automatique dans 5 secondes</h1><a href='.$url.'>'.$url.'</a>';
exit;
}
/**
* Redirect url wich allready PS_BASE_URI after 5 sec
*
* @param string $url Desired URL
*/
public static function redirectLink($url)
{
if (!preg_match('@^https?://@i', $url))
{
if (strpos($url, __PS_BASE_URI__) !== FALSE && strpos($url, __PS_BASE_URI__) == 0)
$url = substr($url, strlen(__PS_BASE_URI__));
$explode = explode('?', $url);
$url = Context::getContext()->link->getPageLink($explode[0]);
if (isset($explode[1]))
$url .= '?'.$explode[1];
}
header('Refresh: 5; url='.$url);
echo '<h1>Redirection automatique dans 5 secondes</h1><a href='.$url.'>'.$url.'</a>';
exit;
}
/**
* Redirect user to another admin page after 5 sec
*
* @param string $url Desired URL
*/
public static function redirectAdmin($url)
{
header('Refresh: 5; url='.$url);
echo '<h1>Redirection automatique dans 5 secondes</h1><a href='.$url.'>'.$url.'</a>';
exit;
}
/**
* Display an error with detailed object
* (display in firefox console if Firephp is enabled)
*
* @param mixed $object
* @param boolean $kill
* @return $object if $kill = false;
*/
public static function dieObject($object, $kill = true)
{
if(PS_USE_FIREPHP)
FB::error($object);
else
return parent::dieObject($object,$kill);
if ($kill)
die('END');
return $object;
}
/**
* ALIAS OF dieObject() - Display an error with detailed object
* (display in firefox console if Firephp is enabled)
*
* @param object $object Object to display
*/
public static function d($obj, $kill = true)
{
if(PS_USE_FIREPHP)
FB::error($obj);
else
parent::d($obj,$kill);
if ($kill)
die('END');
return $object;
}
/**
* ALIAS OF dieObject() - Display an error with detailed object but don't stop the execution
* (display in firefox console if Firephp is enabled)
*
* @param object $object Object to display
*/
public static function p($object)
{
if(PS_USE_FIREPHP)
FB::info($object);
else
return parent::p($object);
return $object;
}
/**
* Display a warning message indicating that the method is deprecated
* (display in firefox console if Firephp is enabled)
*/
public static function displayAsDeprecated()
{
if (_PS_DISPLAY_COMPATIBILITY_WARNING_)
{
$backtrace = debug_backtrace();
$callee = next($backtrace);
if (PS_USE_FIREPHP)
FB::warn('Function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['line'].'</strong><br />', 'Deprecated method');
else
trigger_error('Function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['line'].'</strong><br />', E_USER_WARNING);
$message = Tools::displayError('The function').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
Logger::addLog($message, 3, $callee['class']);
}
}
/**
* Display a warning message indicating that the parameter is deprecated
* (display in firefox console if Firephp is enabled)
*/
public static function displayParameterAsDeprecated($parameter)
{
if (_PS_DISPLAY_COMPATIBILITY_WARNING_)
{
$backtrace = debug_backtrace();
$callee = next($backtrace);
trigger_error('Parameter <strong>'.$parameter.'</strong> in function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['Line'].'</strong><br />', E_USER_WARNING);
if(PS_USE_FIREPHP)
FB::trace('Parameter <strong>'.$parameter.'</strong> in function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['Line'].'</strong><br />', 'deprecated parameter');
else
$message = Tools::displayError('The parameter').' '.$parameter.' '.Tools::displayError(' in function ').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['Line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
Logger::addLog($message, 3, $callee['class']);
}
}
/**
* use of FirePHP::error() if allowed
*
* @param mixed $obj
* @param string $label
* @return void
*/
public static function error($obj, $label = '')
{
if(PS_USE_FIREPHP)
FB::error($obj, $label);
}
/**
* use of FirePHP::warn() if allowed
*
* @param mixed $obj
* @param string $label
* @return void
*/
public static function warn($obj, $label = '')
{
if(PS_USE_FIREPHP)
FB::warn($obj, $label);
}
/**
* use of FirePHP::info() if allowed
*
* @param mixed $obj
* @param string $label
* @return void
*/
public static function info($obj, $label = '')
{
if(PS_USE_FIREPHP)
FB::info($obj, $label);
}
/**
* use of FirePHP::log() if allowed
*
* @param mixed $obj
* @param string $label
* @return void
*/
public static function log($obj, $label = '')
{
if(PS_USE_FIREPHP)
FB::log($obj,$label);
}
/**
* display debug_backtrace()
* (display in firefox console if Firephp is enabled)
*
* @param mixed $obj
* @return void
*/
public static function trace($obj = NULL, $label = '')
{
if(PS_USE_FIREPHP)
FB::trace($obj, $label);
else{
Tools::p($obj);
echo'<pre><h1>'.$label.'</h1><br/>';
debug_print_backtrace();
echo '</pre>';
}
}
}
// Add some convenient shortcut
if (!function_exists('error'))
{
function error($obj, $label = ''){
return Tools::error($obj, $label);
}
}
if (!function_exists('warn'))
{
function warn($obj, $label = ''){
return Tools::warn($obj,$label);
}
}
if (!function_exists('info'))
{
function info($obj, $label = ''){
return Tools::info($obj, $label);
}
}
if (!function_exists('log'))
{
function log($obj, $label = ''){
return Tools::log($obj, $label);
}
}
if (!function_exists('trace'))
{
function trace($obj, $label = ''){
return Tools::trace($obj, $label);
}
}