| Server IP : 213.186.33.4 / Your IP : 216.73.216.193 Web Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : awebpaca ( 35430) PHP Version : 8.5.0 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/a/w/e/awebpaca/boutiques/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/ |
Upload File : |
<?php
/**
* Magento
*
* 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@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
* Order history tab
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Adminhtml_Block_Sales_Order_View_Tab_History
extends Mage_Adminhtml_Block_Template
implements Mage_Adminhtml_Block_Widget_Tab_Interface
{
protected function _construct()
{
parent::_construct();
$this->setTemplate('sales/order/view/tab/history.phtml');
}
/**
* Retrieve order model instance
*
* @return Mage_Sales_Model_Order
*/
public function getOrder()
{
return Mage::registry('current_order');
}
/**
* Compose and get order full history.
* Consists of the status history comments as well as of invoices, shipments and creditmemos creations
* @return array
*/
public function getFullHistory()
{
$order = $this->getOrder();
$history = array();
foreach ($order->getAllStatusHistory() as $orderComment){
$history[$orderComment->getEntityId()] = $this->_prepareHistoryItem(
$orderComment->getStatusLabel(),
$orderComment->getIsCustomerNotified(),
$orderComment->getCreatedAtDate(),
$orderComment->getComment()
);
}
foreach ($order->getCreditmemosCollection() as $_memo){
$history[$_memo->getEntityId()] =
$this->_prepareHistoryItem($this->__('Credit memo #%s created', $_memo->getIncrementId()),
$_memo->getEmailSent(), $_memo->getCreatedAtDate());
foreach ($_memo->getCommentsCollection() as $_comment){
$history[$_comment->getEntityId()] =
$this->_prepareHistoryItem($this->__('Credit memo #%s comment added', $_memo->getIncrementId()),
$_comment->getIsCustomerNotified(), $_comment->getCreatedAtDate(), $_comment->getComment());
}
}
foreach ($order->getShipmentsCollection() as $_shipment){
$history[$_shipment->getEntityId()] =
$this->_prepareHistoryItem($this->__('Shipment #%s created', $_shipment->getIncrementId()),
$_shipment->getEmailSent(), $_shipment->getCreatedAtDate());
foreach ($_shipment->getCommentsCollection() as $_comment){
$history[$_comment->getEntityId()] =
$this->_prepareHistoryItem($this->__('Shipment #%s comment added', $_shipment->getIncrementId()),
$_comment->getIsCustomerNotified(), $_comment->getCreatedAtDate(), $_comment->getComment());
}
}
foreach ($order->getInvoiceCollection() as $_invoice){
$history[$_invoice->getEntityId()] =
$this->_prepareHistoryItem($this->__('Invoice #%s created', $_invoice->getIncrementId()),
$_invoice->getEmailSent(), $_invoice->getCreatedAtDate());
foreach ($_invoice->getCommentsCollection() as $_comment){
$history[$_comment->getEntityId()] =
$this->_prepareHistoryItem($this->__('Invoice #%s comment added', $_invoice->getIncrementId()),
$_comment->getIsCustomerNotified(), $_comment->getCreatedAtDate(), $_comment->getComment());
}
}
foreach ($order->getTracksCollection() as $_track){
$history[$_track->getEntityId()] =
$this->_prepareHistoryItem($this->__('Tracking number %s for %s assigned', $_track->getNumber(), $_track->getTitle()),
false, $_track->getCreatedAtDate());
}
krsort($history);
return $history;
}
/**
* Status history date/datetime getter
* @param array $item
* @return string
*/
public function getItemCreatedAt(array $item, $dateType = 'date', $format = 'medium')
{
if (!isset($item['created_at'])) {
return '';
}
if ('date' === $dateType) {
return $this->helper('core')->formatDate($item['created_at'], $format);
}
return $this->helper('core')->formatTime($item['created_at'], $format);
}
/**
* Status history item title getter
* @param array $item
* @return string
*/
public function getItemTitle(array $item)
{
return (isset($item['title']) ? $this->escapeHtml($item['title']) : '');
}
/**
* Check whether status history comment is with customer notification
* @param array $item
* @return bool
*/
public function isItemNotified(array $item, $isSimpleCheck = true)
{
if ($isSimpleCheck) {
return !empty($item['notified']);
}
return isset($item['notified']) && false !== $item['notified'];
}
/**
* Status history item comment getter
* @param array $item
* @return string
*/
public function getItemComment(array $item)
{
$allowedTags = array('b','br','strong','i','u');
return (isset($item['comment']) ? $this->escapeHtml($item['comment'], $allowedTags) : '');
}
/**
* Map history items as array
* @param string $label
* @param bool $notified
* @param Zend_Date $created
* @param string $comment
*/
protected function _prepareHistoryItem($label, $notified, $created, $comment = '')
{
return array(
'title' => $label,
'notified' => $notified,
'comment' => $comment,
'created_at' => $created
);
}
/**
* ######################## TAB settings #################################
*/
public function getTabLabel()
{
return Mage::helper('sales')->__('Comments History');
}
public function getTabTitle()
{
return Mage::helper('sales')->__('Order History');
}
public function getTabClass()
{
return 'ajax only';
}
public function getClass()
{
return $this->getTabClass();
}
public function getTabUrl()
{
return $this->getUrl('*/*/commentsHistory', array('_current' => true));
}
public function canShowTab()
{
return true;
}
public function isHidden()
{
return false;
}
}