Fix php syntax

This commit is contained in:
Laurent Destailleur 2021-12-30 18:46:26 +01:00
parent 62a74ed428
commit 108df3726a
6 changed files with 30 additions and 30 deletions

View File

@ -103,7 +103,7 @@ class Categories extends DolibarrApi
if (!is_array($cats)) {
throw new RestException(500, 'Error when fetching child categories', array_merge(array($this->category->error), $this->category->errors));
}
$this->category->childs = [];
$this->category->childs = array();
foreach ($cats as $cat) {
$this->category->childs[] = $this->_cleanObjectDatas($cat);
}

View File

@ -326,7 +326,7 @@ class modBom extends DolibarrModules
$this->import_code[$r] = 'bom_'.$r;
$this->import_label[$r] = 'BillOfMaterials';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = ['b' => MAIN_DB_PREFIX.'bom_bom', 'extra' => MAIN_DB_PREFIX.'bom_bom_extrafields'];
$this->import_tables_creator_array[$r] = ['b' => 'fk_user_creat']; // Fields to store import user id
$this->import_fields_array[$r] = [
@ -351,7 +351,7 @@ class modBom extends DolibarrModules
];
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'bom_bom' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
@ -407,7 +407,7 @@ class modBom extends DolibarrModules
$this->import_code[$r] = 'bom_lines_'.$r;
$this->import_label[$r] = 'BillOfMaterialsLine';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = ['bd' => MAIN_DB_PREFIX.'bom_bomline', 'extra' => MAIN_DB_PREFIX.'bom_bomline_extrafields'];
$this->import_fields_array[$r] = [
'bd.fk_bom' => 'Document Ref*',
@ -434,7 +434,7 @@ class modBom extends DolibarrModules
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'bom_bomline'];
$this->import_regex_array[$r] = [];
$this->import_regex_array[$r] = array();
$this->import_updatekeys_array[$r] = ['bd.fk_bom' => 'BOM Id'];
$this->import_convertvalue_array[$r] = [
'bd.fk_bom' => [

View File

@ -285,7 +285,7 @@ class modCommande extends DolibarrModules
$this->import_code[$r] = 'commande_'.$r;
$this->import_label[$r] = 'CustomersOrders';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX.'commande', 'extra' => MAIN_DB_PREFIX.'commande_extrafields'];
$this->import_tables_creator_array[$r] = ['c' => 'fk_user_author']; // Fields to store import user id
$this->import_fields_array[$r] = [
@ -321,7 +321,7 @@ class modCommande extends DolibarrModules
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commande' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
@ -371,7 +371,7 @@ class modCommande extends DolibarrModules
$this->import_code[$r] = 'commande_lines_'.$r;
$this->import_label[$r] = 'SaleOrderLines';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = ['cd' => MAIN_DB_PREFIX.'commandedet', 'extra' => MAIN_DB_PREFIX.'commandedet_extrafields'];
$this->import_fields_array[$r] = [
'cd.fk_commande' => 'Document Ref*',

View File

@ -504,7 +504,7 @@ class modFournisseur extends DolibarrModules
$this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = "SupplierInvoices"; // Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = ['f' => MAIN_DB_PREFIX.'facture_fourn', 'extra' => MAIN_DB_PREFIX.'facture_fourn_extrafields'];
$this->import_tables_creator_array[$r] = ['f' => 'fk_user_author']; // Fields to store import user id
$this->import_fields_array[$r] = [
@ -540,7 +540,7 @@ class modFournisseur extends DolibarrModules
$this->import_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) {
@ -597,7 +597,7 @@ class modFournisseur extends DolibarrModules
$this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = "SupplierInvoiceLines"; // Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = ['fd' => MAIN_DB_PREFIX.'facture_fourn_det', 'extra' => MAIN_DB_PREFIX.'facture_fourn_det_extrafields'];
$this->import_fields_array[$r] = [
'fd.fk_facture_fourn' => 'InvoiceRef*',
@ -627,7 +627,7 @@ class modFournisseur extends DolibarrModules
$this->import_fields_array[$r]['fd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) {
@ -716,7 +716,7 @@ class modFournisseur extends DolibarrModules
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commande_fournisseur' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
@ -760,7 +760,7 @@ class modFournisseur extends DolibarrModules
$this->import_code[$r] = 'commande_fournisseurdet_'.$r;
$this->import_label[$r] = 'PurchaseOrderLines';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = ['cd' => MAIN_DB_PREFIX.'commande_fournisseurdet', 'extra' => MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields'];
$this->import_fields_array[$r] = [
'cd.fk_commande' => 'Document Ref*',

View File

@ -275,7 +275,7 @@ class modPropale extends DolibarrModules
$this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = 'Proposals'; // Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX.'propal', 'extra' => MAIN_DB_PREFIX.'propal_extrafields'];
$this->import_tables_creator_array[$r] = ['c'=>'fk_user_author']; // Fields to store import user id
$this->import_fields_array[$r] = [
@ -301,7 +301,7 @@ class modPropale extends DolibarrModules
$this->import_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'propal' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) {
@ -352,7 +352,7 @@ class modPropale extends DolibarrModules
$this->import_code[$r] = $this->rights_class.'line_'.$r;
$this->import_label[$r] = "ProposalLines"; // Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = [
'cd' => MAIN_DB_PREFIX.'propaldet',
'extra' => MAIN_DB_PREFIX.'propaldet_extrafields'
@ -385,7 +385,7 @@ class modPropale extends DolibarrModules
$this->import_fields_array[$r]['cd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$import_extrafield_sample = [];
$import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'propaldet' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -269,15 +269,15 @@ class Products extends DolibarrApi
$total = $this->db->fetch_object($totalsResult)->total;
$tmp = $obj_ret;
$obj_ret = [];
$obj_ret = array();
$obj_ret['data'] = $tmp;
$obj_ret['pagination'] = [
$obj_ret['pagination'] = array(
'total' => (int) $total,
'page' => $page, //count starts from 0
'page_count' => ceil((int) $total/$limit),
'limit' => $limit
];
);
}
return $obj_ret;
@ -462,8 +462,8 @@ class Products extends DolibarrApi
$childsArbo = $this->product->getChildsArbo($id, 1);
$keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec', 'ref'];
$childs = [];
$keys = array('rowid', 'qty', 'fk_product_type', 'label', 'incdec', 'ref');
$childs = array();
foreach ($childsArbo as $values) {
$childs[] = array_combine($keys, $values);
}
@ -1023,7 +1023,7 @@ class Products extends DolibarrApi
throw new RestException(503, 'Error when retrieve product attribute list : '.$this->db->lasterror());
}
$return = [];
$return = array();
while ($result = $this->db->fetch_object($query)) {
$tmp = new ProductAttribute($this->db);
$tmp->id = $result->rowid;
@ -1113,7 +1113,7 @@ class Products extends DolibarrApi
$result = $this->db->fetch_object($query);
$attr = [];
$attr = array();
$attr['id'] = $result->rowid;
$attr['ref'] = $result->ref;
$attr['ref_ext'] = $result->ref_ext;
@ -1160,7 +1160,7 @@ class Products extends DolibarrApi
$result = $this->db->fetch_object($query);
$attr = [];
$attr = array();
$attr['id'] = $result->rowid;
$attr['ref'] = $result->ref;
$attr['ref_ext'] = $result->ref_ext;
@ -1317,7 +1317,7 @@ class Products extends DolibarrApi
$result = $this->db->fetch_object($query);
$attrval = [];
$attrval = array();
$attrval['id'] = $result->rowid;
$attrval['fk_product_attribute'] = $result->fk_product_attribute;
$attrval['ref'] = $result->ref;
@ -1361,7 +1361,7 @@ class Products extends DolibarrApi
$result = $this->db->fetch_object($query);
$attrval = [];
$attrval = array();
$attrval['id'] = $result->rowid;
$attrval['fk_product_attribute'] = $result->fk_product_attribute;
$attrval['ref'] = $result->ref;
@ -2029,8 +2029,8 @@ class Products extends DolibarrApi
if ($includesubproducts) {
$childsArbo = $this->product->getChildsArbo($id, 1);
$keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec'];
$childs = [];
$keys = array('rowid', 'qty', 'fk_product_type', 'label', 'incdec');
$childs = array();
foreach ($childsArbo as $values) {
$childs[] = array_combine($keys, $values);
}