Skip to content

Commit

Permalink
Import Magento Release 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Magento Mirror committed Jan 17, 2009
1 parent d19f0e1 commit 2815710
Show file tree
Hide file tree
Showing 1,027 changed files with 413 additions and 451 deletions.
2 changes: 1 addition & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ final class Mage {

public static function getVersion()
{
return '1.1.1';
return '1.1.2';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,21 @@ public function getDefaultRecipient()
return '';
}

if($this->getEntity()->getQuote()) {
return $this->getEntity()->getQuote()->getShippingAddress()->getName();
if($this->getEntity()->getOrder()) {
if ($this->getEntity()->getOrder()->getShippingAddress()) {
return $this->getEntity()->getOrder()->getShippingAddress()->getName();
} else if ($this->getEntity()->getOrder()->getBillingAddress()) {
return $this->getEntity()->getOrder()->getBillingAddress()->getName();
}
}

return $this->getEntity()->getShippingAddress()->getName();
if ($this->getEntity()->getShippingAddress()) {
return $this->getEntity()->getShippingAddress()->getName();
} else if ($this->getEntity()->getBillingAddress()) {
return $this->getEntity()->getBillingAddress()->getName();
}

return '';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,20 @@ public function getDefaultRecipient()
}

if($this->getEntity()->getOrder()) {
return $this->getEntity()->getOrder()->getShippingAddress()->getName();
if ($this->getEntity()->getOrder()->getShippingAddress()) {
return $this->getEntity()->getOrder()->getShippingAddress()->getName();
} else if ($this->getEntity()->getOrder()->getBillingAddress()) {
return $this->getEntity()->getOrder()->getBillingAddress()->getName();
}
}

return $this->getEntity()->getShippingAddress()->getName();
if ($this->getEntity()->getShippingAddress()) {
return $this->getEntity()->getShippingAddress()->getName();
} else if ($this->getEntity()->getBillingAddress()) {
return $this->getEntity()->getBillingAddress()->getName();
}

return '';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,20 @@ public function getDefaultRecipient()
}

if($this->getItem()->getOrder()) {
return $this->getItem()->getOrder()->getShippingAddress()->getName();
if ($this->getItem()->getOrder()->getShippingAddress()) {
return $this->getItem()->getOrder()->getShippingAddress()->getName();
} else if ($this->getItem()->getOrder()->getBillingAddress()) {
return $this->getItem()->getOrder()->getBillingAddress()->getName();
}
}

return $this->getItem()->getShippingAddress()->getName();
if ($this->getItem()->getShippingAddress()) {
return $this->getItem()->getShippingAddress()->getName();
} else if ($this->getItem()->getBillingAddress()) {
return $this->getItem()->getBillingAddress()->getName();
}

return '';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function _beforeSave()
$file['tmp_name'] = $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
$file['name'] = $_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
$uploader = new Varien_File_Uploader($file);
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
$uploader->setAllowedExtensions($this->_getAllowedExtensions());
$uploader->setAllowRenameFiles(true);
$uploader->save($uploadDir);
} catch (Exception $e) {
Expand Down Expand Up @@ -133,5 +133,8 @@ protected function _appendScopeInfo($path)
return $path;
}

protected function _getAllowedExtensions()
{
return array('jpg', 'jpeg', 'gif', 'png');
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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 [email protected] so we can send you a copy immediately.
*
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/


/**
* System config image field backend model for Zend PDF generator
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <[email protected]>
*/
class Mage_Adminhtml_Model_System_Config_Backend_Image_Pdf extends Mage_Adminhtml_Model_System_Config_Backend_Image
{
protected function _getAllowedExtensions()
{
return array('tif', 'tiff', 'png', 'jpg', 'jpe', 'jpeg');
}
}
35 changes: 32 additions & 3 deletions app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,16 @@ public function run()
->setHeader('Content-Type','text/xml')
->setBody($template->filter($wsdlContent));

} else {
} elseif ($this->_extensionLoaded()) {
$this->_soap = new SoapServer(Mage::getUrl('*/*/*', array('wsdl'=>1)));
use_soap_error_handler(false);
$this->_soap->setClass($this->getHandler());
$this->_soap->handle();
$this->getController()->getResponse()
->setHeader('Content-Type', 'text/xml')
->setBody($this->_soap->handle());

} else {
$this->fault('0', 'Unable to load Soap extension on the server');
}
return $this;
}
Expand All @@ -124,6 +129,30 @@ public function run()
*/
public function fault($code, $message)
{
throw new SoapFault($code, $message);
if ($this->_extensionLoaded()) {
throw new SoapFault($code, $message);
} else {
die('<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>' . $code . '</faultcode>
<faultstring>' . $message . '</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>');
}

}

/**
* Check whether Soap extension is loaded
*
* @param none
* @return boolean
*/
protected function _extensionLoaded ()
{
return class_exists('SoapServer');
}

} // Class Mage_Api_Model_Server_Adapter_Soap End
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,18 @@ public function draw()
$page = $this->getPage();

$items = $this->getChilds($item);

$_prevOptionId = '';

$shift{0} = 0;
$shift = array(0, 0, 0);

foreach ($items as $_item) {

$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7);

$this->_setFontRegular();
$attributes = $this->getSelectionAttributes($_item);

if ($_item->getOrderItem()->getParentItem()) {
if ($_prevOptionId != $attributes['option_id']) {
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_ITALIC), 7);
$this->_setfontItalic();
$page->drawText($attributes['option_label'], 60, $pdf->y, 'UTF-8');
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7);
$this->_setFontRegular();
$_prevOptionId = $attributes['option_id'];
$pdf->y -= 10;
}
Expand All @@ -69,43 +65,22 @@ public function draw()
$feed = 60;
$name = $_item->getName();
}
if (strlen($name) > 60) {
$drawTextValue = explode(" ", $name);
$drawTextParts = array();
$i = 0;
foreach ($drawTextValue as $drawTextPart) {
if (!empty($drawTextParts{$i}) &&
(strlen($drawTextParts{$i}) + strlen($drawTextPart)) < 60 ) {
$drawTextParts{$i} .= ' '. $drawTextPart;
} else {
$i++;
$drawTextParts{$i} = $drawTextPart;
}
}
$shift{0} = 0;
foreach ($drawTextParts as $drawTextPart) {
$page->drawText($drawTextPart, $feed, $pdf->y-$shift{0}, 'UTF-8');
$shift{0} += 10;
foreach (Mage::helper('core/string')->str_split($name, 60, true, true) as $key => $part) {
$page->drawText($part, $feed, $pdf->y-$shift[0], 'UTF-8');
if ($key > 0) {
$shift[0] += 10;
}

} else {
$page->drawText($name, $feed, $pdf->y, 'UTF-8');
}

if (strlen($_item->getSku()) > 30) {
$drawTextValue = str_split($_item->getSku(), 30);
$shift{2} = 0;
foreach ($drawTextValue as $drawTextPart) {
$page->drawText($drawTextPart, 265, $pdf->y-$shift{2}, 'UTF-8');
$shift{2} += 10;
$shift[2] = 0;
foreach (Mage::helper('core/string')->str_split($item->getSku(), 30) as $key => $part) {
$page->drawText($part, 265, $pdf->y-$shift[2], 'UTF-8');
if ($key > 0) {
$shift[2] += 10;
}

} else {
$page->drawText($_item->getSku(), 265, $pdf->y);
}

$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
$page->setFont($font, 7);
$font = $this->_setFontBold();
//$page->setFont($font);

if ($this->canShowPriceInfo($_item)) {
$page->drawText($order->formatPriceTxt($_item->getTaxAmount()), 380, $pdf->y, 'UTF-8');
Expand All @@ -121,41 +96,23 @@ public function draw()
}

if ($item->getOrderItem()->getProductOptions() || $item->getOrderItem()->getDescription()) {

$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7);

$shift{1} = 10;
$this->_setFontRegular();
$shift[1] = 10;
$options = $item->getOrderItem()->getProductOptions();
if (isset($options['options'])) {
foreach ($options['options'] as $option) {
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_ITALIC), 7);

$optionTxt = strip_tags($option['label']);
if (strlen($optionTxt) > 80) {
$optionTxt = str_split($optionTxt, 80);
foreach ($optionTxt as $_option) {
$page->drawText($_option, 60, $pdf->y-$shift{1}, 'UTF-8');
$shift{1} += 10;
}
} else {
$page->drawText($optionTxt, 60, $pdf->y-$shift{1}, 'UTF-8');
$shift{1} += 10;
$this->_setFontItalic();
foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), 60,false,true) as $_option) {
$page->drawText($_option, 60, $pdf->y-$shift[1], 'UTF-8');
$shift[1] += 10;
}

$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7);

$this->_setFontRegular();
if ($option['value']) {
$values = explode(', ', strip_tags($option['value']));
foreach ($values as $value) {
if (strlen($value) > 80) {
$value = str_split($value, 80);
foreach ($value as $_value) {
$page->drawText($_value, 65, $pdf->y-$shift{1}, 'UTF-8');
$shift{1} += 10;
}
} else {
$page->drawText($value, 65, $pdf->y-$shift{1}, 'UTF-8');
$shift{1} += 10;
foreach (Mage::helper('core/string')->str_split($value, 50,true,true) as $_value) {
$page->drawText($_value, 65, $pdf->y-$shift[1], 'UTF-8');
$shift[1] += 10;
}
}
}
Expand Down
Loading

0 comments on commit 2815710

Please sign in to comment.