// Update Accounting for the return display html

This commit is contained in:
vSchoener
2011-11-15 17:11:53 +00:00
parent 63e900aeac
commit 84eb41f7a8
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
* @return bool To know if any modification in the database succeed
*/
public static function setAccountNumberByZoneShop($assoZoneShopList, $table)
public static function setAccountNumberByZoneShop($assoZoneShopList)
{
$query = '
REPLACE INTO`'._DB_PREFIX_.'accounting_zone_shop`
@@ -138,9 +138,9 @@ class AdminAccountingExportControllerCore extends AdminController
private function checkRights()
{
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+')))
$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);
}
@@ -222,7 +222,7 @@ class AdminAccountingExportControllerCore extends AdminController
{
$this->checkRights();
if (!count($this->prevent['errors']) && $this->fd !== NULL)
if (!count($this->_errors) && $this->fd !== NULL)
{
$buffer = '';
foreach($this->exportTypeList[$this->exportSelected]['fields'] as $key => $translation)
@@ -238,6 +238,7 @@ class AdminAccountingExportControllerCore extends AdminController
$buffer .= $val.';';
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);
// Save to the database the account
if (count($tab))
{
Accounting::setAccountNumberByZoneShop($tab);
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
Tools::redirectAdmin(self::$currentIndex.'&token='.$token);
}
if (count($tab) && Accounting::setAccountNumberByZoneShop($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');
//$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->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_currency = (int)($id_currency);
$specificPrice->id_country = (int)($id_country);
@@ -1848,11 +1848,13 @@ if (false)
}
return $preview_url;
}
/**
* Post traitment for accounting
*/
public function postProcessFormAccounting()
{
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
{
$id_shop = $this->context->shop->getID();
@@ -1870,8 +1872,11 @@ if (false)
'id_shop' => $id_shop,
'num' => $num);
if (count($tab))
Accounting::saveProductAccountingInformations($tab);
// Save to the database the account
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');
}
}
}