mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 09:08:09 +01:00
Clean code. Replace property with local variable.
This commit is contained in:
@@ -395,10 +395,6 @@ class pdf_standard_movementstock extends ModelePDFMovement
|
||||
$file = $dir."/".$objectref.".pdf";
|
||||
}
|
||||
|
||||
$stockFournisseur = new ProductFournisseur($this->db);
|
||||
$supplierprices = $stockFournisseur->list_product_fournisseur_price($object->id);
|
||||
$object->supplierprices = $supplierprices;
|
||||
|
||||
$productstatic = new Product($this->db);
|
||||
|
||||
if (!file_exists($dir)) {
|
||||
|
||||
@@ -245,7 +245,6 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
}
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$supplierprices = $productFournisseur->list_product_fournisseur_price($object->id);
|
||||
$object->supplierprices = $supplierprices;
|
||||
|
||||
$dir = $conf->product->dir_output;
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
@@ -415,8 +414,8 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
// Replace tags of lines
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('supplierprices');
|
||||
if (!empty($object->supplierprices)) {
|
||||
foreach ($object->supplierprices as $supplierprice) {
|
||||
if (!empty($supplierprices)) {
|
||||
foreach ($supplierprices as $supplierprice) {
|
||||
$array_lines = $this->get_substitutionarray_each_var_object($supplierprice, $outputlangs);
|
||||
complete_substitutions_array($array_lines, $outputlangs, $object, $supplierprice, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
|
||||
@@ -159,10 +159,6 @@ class pdf_standard extends ModelePDFProduct
|
||||
$file = $dir."/".$objectref.".pdf";
|
||||
}
|
||||
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$supplierprices = $productFournisseur->list_product_fournisseur_price($object->id);
|
||||
$object->supplierprices = $supplierprices;
|
||||
|
||||
if (!file_exists($dir)) {
|
||||
if (dol_mkdir($dir) < 0) {
|
||||
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
|
||||
@@ -248,7 +248,6 @@ class doc_generic_stock_odt extends ModelePDFStock
|
||||
|
||||
$stockFournisseur = new ProductFournisseur($this->db);
|
||||
$supplierprices = $stockFournisseur->list_stock_fournisseur_price($object->id);
|
||||
$object->supplierprices = $supplierprices;
|
||||
|
||||
$dir = $conf->product->dir_output;
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
@@ -419,8 +418,8 @@ class doc_generic_stock_odt extends ModelePDFStock
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
if ($foundtagforlines && !empty($object->supplierprices)) {
|
||||
foreach ($object->supplierprices as $supplierprice) {
|
||||
if ($foundtagforlines && !empty($supplierprices)) {
|
||||
foreach ($supplierprices as $supplierprice) {
|
||||
$array_lines = $this->get_substitutionarray_each_var_object($supplierprice, $outputlangs);
|
||||
complete_substitutions_array($array_lines, $outputlangs, $object, $supplierprice, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
|
||||
@@ -195,10 +195,6 @@ class pdf_standard_stock extends ModelePDFStock
|
||||
$file = $dir."/".$objectref.".pdf";
|
||||
}
|
||||
|
||||
$stockFournisseur = new ProductFournisseur($this->db);
|
||||
$supplierprices = $stockFournisseur->list_product_fournisseur_price($object->id);
|
||||
$object->supplierprices = $supplierprices;
|
||||
|
||||
$productstatic = new Product($this->db);
|
||||
|
||||
if (!file_exists($dir)) {
|
||||
|
||||
@@ -2231,8 +2231,6 @@ class Products extends DolibarrApi
|
||||
unset($object->fk_bank);
|
||||
unset($object->fk_account);
|
||||
|
||||
unset($object->supplierprices); // Must use another API to get them
|
||||
|
||||
if (!DolibarrApiAccess::$user->hasRight('stock', 'lire')) {
|
||||
unset($object->stock_reel);
|
||||
unset($object->stock_theorique);
|
||||
|
||||
@@ -777,13 +777,6 @@ class Product extends CommonObject
|
||||
*/
|
||||
public $price_autogen = 0;
|
||||
|
||||
/**
|
||||
* Array with list of supplier prices of product
|
||||
*
|
||||
* @var ProductFournisseur[]
|
||||
*/
|
||||
public $supplierprices;
|
||||
|
||||
/**
|
||||
* Array with list of sub-products for Kits
|
||||
*
|
||||
|
||||
@@ -47,7 +47,7 @@ class Workstations extends DolibarrApi
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $conf;
|
||||
global $db;
|
||||
|
||||
$this->db = $db;
|
||||
$this->workstation = new Workstation($this->db);
|
||||
@@ -185,8 +185,8 @@ class Workstations extends DolibarrApi
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param Object $object Object to clean
|
||||
* @return Object Object with cleaned properties
|
||||
* @param Object $object Object to clean
|
||||
* @return Object Object with cleaned properties
|
||||
*/
|
||||
protected function _cleanObjectDatas($object)
|
||||
{
|
||||
@@ -284,8 +284,6 @@ class Workstations extends DolibarrApi
|
||||
unset($object->fk_bank);
|
||||
unset($object->fk_account);
|
||||
|
||||
unset($object->supplierprices);
|
||||
|
||||
unset($object->stock_reel);
|
||||
unset($object->stock_theorique);
|
||||
unset($object->stock_warehouse);
|
||||
|
||||
Reference in New Issue
Block a user