// Update Accounting for the return display html

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10145 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vSchoener
2011-11-15 17:11:53 +00:00
parent 3689276b37
commit adae213cec
4 changed files with 19 additions and 13 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ class AccountingCore
* @var array $assoZoneShopList correspond to an associated list of id_zone - id_shop - num * @var array $assoZoneShopList correspond to an associated list of id_zone - id_shop - num
* @return bool To know if any modification in the database succeed * @return bool To know if any modification in the database succeed
*/ */
public static function setAccountNumberByZoneShop($assoZoneShopList, $table) public static function setAccountNumberByZoneShop($assoZoneShopList)
{ {
$query = ' $query = '
REPLACE INTO`'._DB_PREFIX_.'accounting_zone_shop` REPLACE INTO`'._DB_PREFIX_.'accounting_zone_shop`
@@ -138,9 +138,9 @@ class AdminAccountingExportControllerCore extends AdminController
private function checkRights() private function checkRights()
{ {
if (!is_writeable($this->downloadDir)) if (!is_writeable($this->downloadDir))
$this->prevent['errors'][] = $this->l('The download folder doesn\'t have the sufficient right…'); $this->_errors[] = $this->l('The download folder doesn\'t have the sufficient right…');
if (!($this->fd = fopen($this->downloadFile, 'w+'))) if (!($this->fd = fopen($this->downloadFile, 'w+')))
$this->prevent['errors'][] = $this->l('The file can\'t be opened or created, please check the right'); $this->_errors[] = $this->l('The file can\'t be opened or created, please check the right');
@chmod($this->downloadFile, 0777); @chmod($this->downloadFile, 0777);
} }
@@ -222,7 +222,7 @@ class AdminAccountingExportControllerCore extends AdminController
{ {
$this->checkRights(); $this->checkRights();
if (!count($this->prevent['errors']) && $this->fd !== NULL) if (!count($this->_errors) && $this->fd !== NULL)
{ {
$buffer = ''; $buffer = '';
foreach($this->exportTypeList[$this->exportSelected]['fields'] as $key => $translation) foreach($this->exportTypeList[$this->exportSelected]['fields'] as $key => $translation)
@@ -238,6 +238,7 @@ class AdminAccountingExportControllerCore extends AdminController
$buffer .= $val.';'; $buffer .= $val.';';
fwrite($this->fd, rtrim($buffer, ';')."\r\n"); fwrite($this->fd, rtrim($buffer, ';')."\r\n");
} }
$this->confirmations[] = $this->l('Export has been successfully done');
} }
} }
@@ -133,12 +133,12 @@ class AdminAccountingManagementControllerCore extends AdminController
'num' => $num); 'num' => $num);
// Save to the database the account // Save to the database the account
if (count($tab)) if (count($tab) && Accounting::setAccountNumberByZoneShop($tab))
{ $this->confirmations[] = $this->l('Account numbers have been updated');
Accounting::setAccountNumberByZoneShop($tab); else
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token; $this->_errors[] = $this->l('Account Numbers could not be updated or added in the database');
Tools::redirectAdmin(self::$currentIndex.'&token='.$token); //$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
} //Tools::redirectAdmin(self::$currentIndex.'&token='.$token);
} }
} }
@@ -810,7 +810,7 @@ class AdminProductsController extends AdminController
{ {
$specificPrice = new SpecificPrice(); $specificPrice = new SpecificPrice();
$specificPrice->id_product = $id_product; $specificPrice->id_product = $id_product;
$specificPrice->id_product_attribute = (int)Tools::getValue('sp_id_product_attribute'); $specificPrice->id_product_attribute = (int)Tools::getValue('id_product_attribute');
$specificPrice->id_shop = (int)$id_shop; $specificPrice->id_shop = (int)$id_shop;
$specificPrice->id_currency = (int)($id_currency); $specificPrice->id_currency = (int)($id_currency);
$specificPrice->id_country = (int)($id_country); $specificPrice->id_country = (int)($id_country);
@@ -1848,11 +1848,13 @@ if (false)
} }
return $preview_url; return $preview_url;
} }
/** /**
* Post traitment for accounting * Post traitment for accounting
*/ */
public function postProcessFormAccounting() public function postProcessFormAccounting()
{ {
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product'))))) if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
{ {
$id_shop = $this->context->shop->getID(); $id_shop = $this->context->shop->getID();
@@ -1870,8 +1872,11 @@ if (false)
'id_shop' => $id_shop, 'id_shop' => $id_shop,
'num' => $num); 'num' => $num);
if (count($tab)) // Save to the database the account
Accounting::saveProductAccountingInformations($tab); if (count($tab) && Accounting::saveProductAccountingInformations($tab))
$this->confirmations[] = $this->l('Account numbers have been updated');
else
$this->_errors[] = $this->l('Account Numbers could not be updated or added in the database');
} }
} }
} }