NEW Add import / export of MO and BOMLines - Close #18499
This commit is contained in:
parent
67db0f1bdb
commit
8ea1a9602b
@ -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);
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ class SMTPs
|
||||
/**
|
||||
* An array of options for stream_context_create()
|
||||
*/
|
||||
private $_options = [];
|
||||
private $_options = array();
|
||||
|
||||
/**
|
||||
* Set delivery receipt
|
||||
@ -239,7 +239,7 @@ class SMTPs
|
||||
* @param array $_options An array of options for stream_context_create()
|
||||
* @return void
|
||||
*/
|
||||
public function setOptions($_options = [])
|
||||
public function setOptions($_options = array())
|
||||
{
|
||||
$this->_options = $_options;
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ function getCustomerInvoicePieChart($socid = 0)
|
||||
$i = 0;
|
||||
|
||||
$total = 0;
|
||||
$vals = [];
|
||||
$vals = array();
|
||||
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
@ -279,14 +279,14 @@ function getCustomerInvoicePieChart($socid = 0)
|
||||
$result .= '</tr>';
|
||||
|
||||
$objectstatic = new Facture($db);
|
||||
$array = [Facture::STATUS_DRAFT, Facture::STATUS_VALIDATED, Facture::STATUS_CLOSED, Facture::STATUS_ABANDONED];
|
||||
$dataseries = [];
|
||||
$array = array(Facture::STATUS_DRAFT, Facture::STATUS_VALIDATED, Facture::STATUS_CLOSED, Facture::STATUS_ABANDONED);
|
||||
$dataseries = array();
|
||||
|
||||
foreach ($array as $status) {
|
||||
$objectstatic->statut = $status;
|
||||
$objectstatic->paye = $status == Facture::STATUS_CLOSED ? -1 : 0;
|
||||
|
||||
$dataseries[] = [$objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0)];
|
||||
$dataseries[] = array($objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
|
||||
if ($status == Facture::STATUS_DRAFT) {
|
||||
$colorseries[$status] = '-'.$badgeStatus0;
|
||||
}
|
||||
@ -376,7 +376,7 @@ function getPurchaseInvoicePieChart($socid = 0)
|
||||
$i = 0;
|
||||
|
||||
$total = 0;
|
||||
$vals = [];
|
||||
$vals = array();
|
||||
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
@ -400,14 +400,14 @@ function getPurchaseInvoicePieChart($socid = 0)
|
||||
$result .= '</tr>';
|
||||
|
||||
$objectstatic = new FactureFournisseur($db);
|
||||
$array = [FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_CLOSED, FactureFournisseur::STATUS_ABANDONED];
|
||||
$dataseries = [];
|
||||
$array = array(FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_CLOSED, FactureFournisseur::STATUS_ABANDONED);
|
||||
$dataseries = array();
|
||||
|
||||
foreach ($array as $status) {
|
||||
$objectstatic->statut = $status;
|
||||
$objectstatic->paye = $status == FactureFournisseur::STATUS_CLOSED ? -1 : 0;
|
||||
|
||||
$dataseries[] = [$objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0)];
|
||||
$dataseries[] = array($objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
|
||||
if ($status == FactureFournisseur::STATUS_DRAFT) {
|
||||
$colorseries[$status] = '-'.$badgeStatus0;
|
||||
}
|
||||
|
||||
@ -326,12 +326,12 @@ 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_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] = [
|
||||
'b.ref' => 'Document Ref*',
|
||||
'b.label' => 'BomLabel*',
|
||||
$this->import_entities_array[$r] = array();
|
||||
$this->import_tables_array[$r] = array('b' => MAIN_DB_PREFIX.'bom_bom', 'extra' => MAIN_DB_PREFIX.'bom_bom_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('b' => 'fk_user_creat'); // Fields to store import user id
|
||||
$this->import_fields_array[$r] = array(
|
||||
'b.ref' => 'Ref*',
|
||||
'b.label' => 'Label*',
|
||||
'b.fk_product' => 'ProductRef*',
|
||||
'b.description' => 'Description',
|
||||
'b.note_public' => 'Note',
|
||||
@ -346,12 +346,12 @@ class modBom extends DolibarrModules
|
||||
'b.fk_user_valid' => 'ValidatedById',
|
||||
'b.model_pdf' => 'Model',
|
||||
'b.status' => 'Status*',
|
||||
'b.bomtype' => 'BomType*'
|
||||
|
||||
];
|
||||
'b.bomtype' => 'Type*'
|
||||
);
|
||||
$import_sample = array();
|
||||
|
||||
// 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);
|
||||
|
||||
@ -365,61 +365,62 @@ class modBom extends DolibarrModules
|
||||
}
|
||||
// End add extra fields
|
||||
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'bom_bom'];
|
||||
$this->import_regex_array[$r] = [
|
||||
'b.ref' => '(CPV\d{4}-\d{4}|BOM\d{4}-\d{4}|PROV.{1,32}$)'
|
||||
];
|
||||
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'bom_bom');
|
||||
$this->import_regex_array[$r] = array(
|
||||
'b.ref' => ''
|
||||
);
|
||||
|
||||
$this->import_updatekeys_array[$r] = ['b.ref' => 'Ref'];
|
||||
$this->import_convertvalue_array[$r] = [
|
||||
'b.fk_product' => [
|
||||
$this->import_updatekeys_array[$r] = array('b.ref' => 'Ref');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'b.fk_product' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/product/class/product.class.php',
|
||||
'class' => 'Product',
|
||||
'method' => 'fetch',
|
||||
'element' => 'Product'
|
||||
],
|
||||
'b.fk_warehouse' => [
|
||||
),
|
||||
'b.fk_warehouse' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/product/stock/class/entrepot.class.php',
|
||||
'class' => 'Entrepot',
|
||||
'method' => 'fetch',
|
||||
'element' => 'Warehouse'
|
||||
],
|
||||
'b.fk_user_valid' => [
|
||||
),
|
||||
'b.fk_user_valid' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/user/class/user.class.php',
|
||||
'class' => 'User',
|
||||
'method' => 'fetch',
|
||||
'element' => 'user'
|
||||
],
|
||||
'b.fk_user_modif' => [
|
||||
),
|
||||
'b.fk_user_modif' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/user/class/user.class.php',
|
||||
'class' => 'User',
|
||||
'method' => 'fetch',
|
||||
'element' => 'user'
|
||||
],
|
||||
];
|
||||
),
|
||||
);
|
||||
|
||||
//Import BOM Lines
|
||||
$r++;
|
||||
$this->import_code[$r] = 'bom_lines_'.$r;
|
||||
$this->import_label[$r] = 'BillOfMaterialsLine';
|
||||
$this->import_label[$r] = 'BillOfMaterialsLines';
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = [];
|
||||
$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*',
|
||||
$this->import_entities_array[$r] = array();
|
||||
$this->import_tables_array[$r] = array('bd' => MAIN_DB_PREFIX.'bom_bomline', 'extra' => MAIN_DB_PREFIX.'bom_bomline_extrafields');
|
||||
$this->import_fields_array[$r] = array(
|
||||
'bd.fk_bom' => 'BOM*',
|
||||
'bd.fk_product' => 'ProductRef',
|
||||
'bd.fk_bom_child' => 'BOMChild',
|
||||
'bd.description' => 'Description',
|
||||
'bd.qty' => 'LineQty',
|
||||
'bd.qty_frozen' => 'LineIsFrozen',
|
||||
'bd.qty_frozen' => 'LineIsFrozen',
|
||||
'bd.disable_stock_change' => 'Disable Stock Change',
|
||||
'bd.efficiency' => 'Efficiency',
|
||||
'bd.position' => 'LinePosition'
|
||||
];
|
||||
);
|
||||
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'bom_bomline' AND entity IN (0, ".$conf->entity.")";
|
||||
@ -433,25 +434,25 @@ 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_updatekeys_array[$r] = ['bd.fk_bom' => 'BOM Id'];
|
||||
$this->import_convertvalue_array[$r] = [
|
||||
'bd.fk_bom' => [
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'bom_bomline');
|
||||
$this->import_regex_array[$r] = array();
|
||||
$this->import_updatekeys_array[$r] = array('bd.fk_bom' => 'BOM Id');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'bd.fk_bom' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/bom/class/bom.class.php',
|
||||
'class' => 'BOM',
|
||||
'method' => 'fetch',
|
||||
'element' => 'bom'
|
||||
],
|
||||
'bd.fk_product' => [
|
||||
),
|
||||
'bd.fk_product' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/product/class/product.class.php',
|
||||
'class' => 'Product',
|
||||
'method' => 'fetch',
|
||||
'element' => 'Product'
|
||||
],
|
||||
];
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -285,10 +285,10 @@ 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_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] = [
|
||||
$this->import_entities_array[$r] = array();
|
||||
$this->import_tables_array[$r] = array('c' => MAIN_DB_PREFIX.'commande', 'extra' => MAIN_DB_PREFIX.'commande_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('c' => 'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r] = array(
|
||||
'c.ref' => 'Document Ref*',
|
||||
'c.ref_client' => 'RefCustomer',
|
||||
'c.fk_soc' => 'ThirdPartyName*',
|
||||
@ -310,7 +310,7 @@ class modCommande extends DolibarrModules
|
||||
'c.fk_cond_reglement' => 'Payment Condition',
|
||||
'c.fk_mode_reglement' => 'Payment Mode',
|
||||
'c.model_pdf' => 'Model'
|
||||
];
|
||||
);
|
||||
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency';
|
||||
@ -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 elementtype = 'commande' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -337,7 +337,6 @@ class modCommande extends DolibarrModules
|
||||
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande'];
|
||||
$this->import_regex_array[$r] = [
|
||||
'c.ref' => '(CPV\d{4}-\d{4}|CO\d{4}-\d{4}|PROV.{1,32}$)',
|
||||
'c.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'
|
||||
];
|
||||
|
||||
@ -371,9 +370,9 @@ 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_tables_array[$r] = ['cd' => MAIN_DB_PREFIX.'commandedet', 'extra' => MAIN_DB_PREFIX.'commandedet_extrafields'];
|
||||
$this->import_fields_array[$r] = [
|
||||
$this->import_entities_array[$r] = array();
|
||||
$this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commandedet', 'extra' => MAIN_DB_PREFIX.'commandedet_extrafields');
|
||||
$this->import_fields_array[$r] = array(
|
||||
'cd.fk_commande' => 'Document Ref*',
|
||||
'cd.fk_parent_line' => 'PrParentLine',
|
||||
'cd.fk_product' => 'IdProduct',
|
||||
@ -393,7 +392,7 @@ class modCommande extends DolibarrModules
|
||||
'cd.date_end' => 'End Date',
|
||||
'cd.buy_price_ht' => 'LineBuyPriceHT',
|
||||
'cd.rang' => 'LinePosition'
|
||||
];
|
||||
);
|
||||
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency';
|
||||
|
||||
@ -504,10 +504,10 @@ 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_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] = [
|
||||
$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] = array('f' => MAIN_DB_PREFIX.'facture_fourn', 'extra' => MAIN_DB_PREFIX.'facture_fourn_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('f' => 'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r] = array(
|
||||
'f.ref' => 'InvoiceRef*',
|
||||
'f.ref_supplier' => 'RefSupplier',
|
||||
'f.type' => 'Type*',
|
||||
@ -531,7 +531,7 @@ class modFournisseur extends DolibarrModules
|
||||
'f.fk_mode_reglement' => 'Payment Mode',
|
||||
'f.model_pdf' => 'Model',
|
||||
'f.date_valid' => 'Validation Date'
|
||||
];
|
||||
);
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['f.multicurrency_code'] = 'Currency';
|
||||
$this->import_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate';
|
||||
@ -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 elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -552,9 +552,9 @@ class modFournisseur extends DolibarrModules
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture_fourn'];
|
||||
$this->import_regex_array[$r] = ['f.ref' => '(SI\d{4}-\d{4}|PROV.{1,32}$)', 'f.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'];
|
||||
$import_sample = [
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture_fourn');
|
||||
$this->import_regex_array[$r] = array('f.ref' => '(SI\d{4}-\d{4}|PROV.{1,32}$)', 'f.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency');
|
||||
$import_sample = array(
|
||||
'f.ref' => '(PROV001)',
|
||||
'f.ref_supplier' => 'Supplier1',
|
||||
'f.type' => '0',
|
||||
@ -583,23 +583,23 @@ class modFournisseur extends DolibarrModules
|
||||
'f.multicurrency_total_ht' => '1000',
|
||||
'f.multicurrency_total_tva' => '0',
|
||||
'f.multicurrency_total_ttc' => '1000'
|
||||
];
|
||||
);
|
||||
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
|
||||
$this->import_updatekeys_array[$r] = ['f.ref' => 'Ref'];
|
||||
$this->import_convertvalue_array[$r] = [
|
||||
$this->import_updatekeys_array[$r] = array('f.ref' => 'Ref');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
//'c.ref'=>array('rule'=>'getrefifauto'),
|
||||
'f.fk_soc' => ['rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'],
|
||||
'f.fk_account' => ['rule' => 'fetchidfromref', 'file' => '/compta/bank/class/account.class.php', 'class' => 'Account', 'method' => 'fetch', 'element' => 'bank_account'],
|
||||
];
|
||||
'f.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'),
|
||||
'f.fk_account' => array('rule' => 'fetchidfromref', 'file' => '/compta/bank/class/account.class.php', 'class' => 'Account', 'method' => 'fetch', 'element' => 'bank_account'),
|
||||
);
|
||||
|
||||
//Import Supplier Invoice Lines
|
||||
$r++;
|
||||
$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_tables_array[$r] = ['fd' => MAIN_DB_PREFIX.'facture_fourn_det', 'extra' => MAIN_DB_PREFIX.'facture_fourn_det_extrafields'];
|
||||
$this->import_fields_array[$r] = [
|
||||
$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] = array('fd' => MAIN_DB_PREFIX.'facture_fourn_det', 'extra' => MAIN_DB_PREFIX.'facture_fourn_det_extrafields');
|
||||
$this->import_fields_array[$r] = array(
|
||||
'fd.fk_facture_fourn' => 'InvoiceRef*',
|
||||
'fd.fk_parent_line' => 'FacParentLine',
|
||||
'fd.fk_product' => 'IdProduct',
|
||||
@ -618,7 +618,7 @@ class modFournisseur extends DolibarrModules
|
||||
'fd.date_start' => 'Start Date',
|
||||
'fd.date_end' => 'End Date',
|
||||
'fd.fk_unit' => 'Unit'
|
||||
];
|
||||
);
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['fd.multicurrency_code'] = 'Currency';
|
||||
$this->import_fields_array[$r]['fd.multicurrency_subprice'] = 'CurrencyRate';
|
||||
@ -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 elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -639,9 +639,9 @@ class modFournisseur extends DolibarrModules
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture_fourn_det'];
|
||||
$this->import_regex_array[$r] = ['fd.product_type' => '[0|1]$', 'fd.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product', 'fd.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'];
|
||||
$import_sample = [
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture_fourn_det');
|
||||
$this->import_regex_array[$r] = array('fd.product_type' => '[0|1]$', 'fd.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product', 'fd.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency');
|
||||
$import_sample = array(
|
||||
'fd.fk_facture_fourn' => '(PROV001)',
|
||||
'fd.fk_parent_line' => '',
|
||||
'fd.fk_product' => '',
|
||||
@ -665,22 +665,22 @@ class modFournisseur extends DolibarrModules
|
||||
'fd.multicurrency_total_ht' => '50000',
|
||||
'fd.multicurrency_total_tva' => '0',
|
||||
'fd.multicurrency_total_ttc' => '50000'
|
||||
];
|
||||
);
|
||||
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
|
||||
$this->import_updatekeys_array[$r] = ['fd.rowid' => 'Row Id', 'fd.fk_facture_fourn' => 'Invoice Id', 'fd.fk_product' => 'Product Id'];
|
||||
$this->import_convertvalue_array[$r] = [
|
||||
'fd.fk_facture_fourn' => ['rule' => 'fetchidfromref', 'file' => '/fourn/class/fournisseur.facture.class.php', 'class' => 'FactureFournisseur', 'method' => 'fetch'],
|
||||
];
|
||||
$this->import_updatekeys_array[$r] = array('fd.rowid' => 'Row Id', 'fd.fk_facture_fourn' => 'Invoice Id', 'fd.fk_product' => 'Product Id');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'fd.fk_facture_fourn' => array('rule' => 'fetchidfromref', 'file' => '/fourn/class/fournisseur.facture.class.php', 'class' => 'FactureFournisseur', 'method' => 'fetch'),
|
||||
);
|
||||
|
||||
//Import Purchase Orders
|
||||
$r++;
|
||||
$this->import_code[$r] = 'commande_fournisseur_'.$r;
|
||||
$this->import_label[$r] = 'SuppliersOrders';
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = [];
|
||||
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX.'commande_fournisseur', 'extra' => MAIN_DB_PREFIX.'commande_fournisseur_extrafields'];
|
||||
$this->import_tables_creator_array[$r] = ['c' => 'fk_user_author']; // Fields to store import user id
|
||||
$this->import_fields_array[$r] = [
|
||||
$this->import_entities_array[$r] = array();
|
||||
$this->import_tables_array[$r] = array('c' => MAIN_DB_PREFIX.'commande_fournisseur', 'extra' => MAIN_DB_PREFIX.'commande_fournisseur_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('c' => 'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r] = array(
|
||||
'c.ref' => 'Document Ref*',
|
||||
'c.ref_supplier' => 'RefSupplier',
|
||||
'c.fk_soc' => 'ThirdPartyName*',
|
||||
@ -705,7 +705,7 @@ class modFournisseur extends DolibarrModules
|
||||
'c.fk_cond_reglement' => 'Payment Condition',
|
||||
'c.fk_mode_reglement' => 'Payment Mode',
|
||||
'c.model_pdf' => 'Model'
|
||||
];
|
||||
);
|
||||
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency';
|
||||
@ -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 elementtype = 'commande_fournisseur' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -730,39 +730,38 @@ class modFournisseur extends DolibarrModules
|
||||
}
|
||||
// End add extra fields
|
||||
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande_fournisseur'];
|
||||
$this->import_regex_array[$r] = [
|
||||
'c.ref' => '(PO\d{4}-\d{4}|PORDER.{1,32}$|PROV.{1,32}$)',
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande_fournisseur');
|
||||
$this->import_regex_array[$r] = array(
|
||||
'c.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'
|
||||
];
|
||||
);
|
||||
|
||||
$this->import_updatekeys_array[$r] = ['c.ref' => 'Ref'];
|
||||
$this->import_convertvalue_array[$r] = [
|
||||
'c.fk_soc' => [
|
||||
$this->import_updatekeys_array[$r] = array('c.ref' => 'Ref');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'c.fk_soc' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/societe/class/societe.class.php',
|
||||
'class' => 'Societe',
|
||||
'method' => 'fetch',
|
||||
'element' => 'ThirdParty'
|
||||
],
|
||||
'c.fk_mode_reglement' => [
|
||||
),
|
||||
'c.fk_mode_reglement' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
'file' => '/compta/paiement/class/cpaiement.class.php',
|
||||
'class' => 'Cpaiement',
|
||||
'method' => 'fetch',
|
||||
'element' => 'cpayment'
|
||||
],
|
||||
'c.source' => ['rule' => 'zeroifnull'],
|
||||
];
|
||||
),
|
||||
'c.source' => array('rule' => 'zeroifnull'),
|
||||
);
|
||||
|
||||
//Import PO Lines
|
||||
// Import PO Lines
|
||||
$r++;
|
||||
$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_tables_array[$r] = ['cd' => MAIN_DB_PREFIX.'commande_fournisseurdet', 'extra' => MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields'];
|
||||
$this->import_fields_array[$r] = [
|
||||
$this->import_entities_array[$r] = array();
|
||||
$this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commande_fournisseurdet', 'extra' => MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields');
|
||||
$this->import_fields_array[$r] = array(
|
||||
'cd.fk_commande' => 'Document Ref*',
|
||||
'cd.fk_parent_line' => 'PrParentLine',
|
||||
'cd.fk_product' => 'IdProduct',
|
||||
@ -783,7 +782,7 @@ class modFournisseur extends DolibarrModules
|
||||
'cd.special_code' => 'Special Code',
|
||||
'cd.rang' => 'LinePosition',
|
||||
'cd.fk_unit' => 'Unit'
|
||||
];
|
||||
);
|
||||
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency';
|
||||
@ -805,24 +804,24 @@ class modFournisseur extends DolibarrModules
|
||||
}
|
||||
// End add extra fields
|
||||
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande_fournisseurdet'];
|
||||
$this->import_regex_array[$r] = [
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande_fournisseurdet');
|
||||
$this->import_regex_array[$r] = array(
|
||||
'cd.product_type' => '[0|1]$',
|
||||
'cd.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product',
|
||||
'cd.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'
|
||||
];
|
||||
$this->import_updatekeys_array[$r] = ['cd.fk_commande' => 'Purchase Order Id'];
|
||||
$this->import_convertvalue_array[$r] = [
|
||||
'cd.fk_commande' => [
|
||||
);
|
||||
$this->import_updatekeys_array[$r] = array('cd.fk_commande' => 'Purchase Order Id');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'cd.fk_commande' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/fourn/class/fournisseur.commande.class.php',
|
||||
'class' => 'CommandeFournisseur',
|
||||
'method' => 'fetch',
|
||||
'element' => 'order_supplier'
|
||||
],
|
||||
'cd.info_bits' => ['rule' => 'zeroifnull'],
|
||||
'cd.special_code' => ['rule' => 'zeroifnull'],
|
||||
];
|
||||
),
|
||||
'cd.info_bits' => array('rule' => 'zeroifnull'),
|
||||
'cd.special_code' => array('rule' => 'zeroifnull'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -263,31 +263,78 @@ class modMrp extends DolibarrModules
|
||||
/* BEGIN MODULEBUILDER TOPMENU */
|
||||
/* END MODULEBUILDER LEFTMENU MO */
|
||||
|
||||
$langs->loadLangs(array("mrp", "stocks"));
|
||||
|
||||
// Exports profiles provided by this module
|
||||
$r = 1;
|
||||
/* BEGIN MODULEBUILDER EXPORT MO */
|
||||
/*
|
||||
$langs->load("mrp");
|
||||
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='MoLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='mo@mrp';
|
||||
$keyforclass = 'Mo'; $keyforclassfile='/mymobule/class/mo.class.php'; $keyforelement='mo';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='mo'; $keyforaliasextra='extra'; $keyforelement='mo';
|
||||
$this->export_label[$r]='MOs'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='mrp';
|
||||
$this->export_fields_array[$r] = array(
|
||||
'm.rowid'=>"Id",
|
||||
'm.ref'=>"Ref",
|
||||
'm.label'=>"Label",
|
||||
'm.fk_project'=>'Project',
|
||||
'm.fk_bom'=>"Bom",
|
||||
'm.date_start_planned'=>"DateStartPlanned",
|
||||
'm.date_end_planned'=>"DateEndPlanned",
|
||||
'm.fk_product'=>"Product",
|
||||
'm.status'=>'Status',
|
||||
'm.model_pdf'=>'Model',
|
||||
'm.fk_user_valid'=>'ValidatedById',
|
||||
'm.fk_user_modif'=>'ModifiedById',
|
||||
'm.fk_user_creat'=>'CreatedById',
|
||||
'm.date_valid'=>'DateValidation',
|
||||
'm.note_private'=>'NotePrivate',
|
||||
'm.note_public'=>'Note',
|
||||
'm.fk_soc'=>'Tiers',
|
||||
'e.rowid'=>'WarehouseId',
|
||||
'e.ref'=>'WarehouseRef',
|
||||
'm.qty'=>'Qty',
|
||||
'm.date_creation'=>'DateCreation',
|
||||
'm.tms'=>'DateModification'
|
||||
);
|
||||
$keyforselect = 'mrp_mo';
|
||||
$keyforelement = 'mrp_mo';
|
||||
$keyforaliasextra = 'extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'mo as t';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('mo').')';
|
||||
$r++; */
|
||||
/* END MODULEBUILDER EXPORT MO */
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'm.ref'=>"Text",
|
||||
'm.label'=>"Text",
|
||||
'm.fk_project'=>'Numeric',
|
||||
'm.fk_bom'=>"Numeric",
|
||||
'm.date_end_planned'=>"Date",
|
||||
'm.date_start_planned'=>"Date",
|
||||
'm.fk_product'=>"Numeric",
|
||||
'm.status'=>'Numeric',
|
||||
'm.model_pdf'=>'Text',
|
||||
'm.fk_user_valid'=>'Numeric',
|
||||
'm.fk_user_modif'=>'Numeric',
|
||||
'm.fk_user_creat'=>'Numeric',
|
||||
'm.date_valid'=>'Date',
|
||||
'm.note_private'=>'Text',
|
||||
'm.note_public'=>'Text',
|
||||
'm.fk_soc'=>'Numeric',
|
||||
'e.fk_warehouse'=>'Numeric',
|
||||
'e.ref'=>'Text',
|
||||
'm.qty'=>'Numeric',
|
||||
'm.date_creation'=>'Date',
|
||||
'm.tms'=>'Date'
|
||||
|
||||
);
|
||||
$this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'mrp_mo as m';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'mrp_mo_extrafields as extra ON m.rowid = extra.fk_object';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON e.rowid = m.fk_warehouse';
|
||||
$this->export_sql_end[$r] .= ' WHERE m.entity IN ('.getEntity('mrp_mo').')'; // For product and service profile
|
||||
|
||||
// Imports profiles provided by this module
|
||||
$r = 1;
|
||||
$r = 0;
|
||||
$langs->load("mrp");
|
||||
/* BEGIN MODULEBUILDER IMPORT MO */
|
||||
/*
|
||||
$langs->load("mrp");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='MoLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='mo@mrp';
|
||||
@ -302,6 +349,89 @@ class modMrp extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('mo').')';
|
||||
$r++; */
|
||||
/* END MODULEBUILDER IMPORT MO */
|
||||
$r++;
|
||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->import_label[$r]='MOs'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->import_icon[$r]='mrp';
|
||||
$this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon
|
||||
$this->import_tables_array[$r] = array('m'=>MAIN_DB_PREFIX.'mrp_mo', 'extra'=>MAIN_DB_PREFIX.'mrp_mo_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('m'=>'fk_user_creat'); // Fields to store import user id
|
||||
$this->import_fields_array[$r] = array(
|
||||
'm.ref' => "Ref*",
|
||||
'm.label' => "Label*",
|
||||
'm.fk_project'=>'Project',
|
||||
'm.fk_bom'=>"Bom",
|
||||
'm.date_start_planned'=>"DateStartPlanned",
|
||||
'm.date_end_planned'=>"DateEndPlanned",
|
||||
'm.fk_product'=>"Product*",
|
||||
'm.status'=>'Status',
|
||||
'm.model_pdf'=>'Model',
|
||||
'm.fk_user_valid'=>'ValidatedById',
|
||||
'm.fk_user_modif'=>'ModifiedById',
|
||||
'm.fk_user_creat'=>'CreatedById',
|
||||
'm.date_valid'=>'DateValid',
|
||||
'm.note_private'=>'NotePrivate',
|
||||
'm.note_public'=>'Note',
|
||||
'm.fk_soc'=>'Tiers',
|
||||
'm.fk_warehouse'=>'Warehouse',
|
||||
'm.qty'=>'Qty*',
|
||||
'm.date_creation'=>'DateCreation',
|
||||
'm.tms'=>'DateModification',
|
||||
);
|
||||
$import_sample = array();
|
||||
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'mrp_mo' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$fieldname = 'extra.'.$obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||
$import_extrafield_sample[$fieldname] = $fieldlabel;
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'mrp_mo');
|
||||
/*$this->import_regex_array[$r] = array(
|
||||
'm.ref' => ''
|
||||
);*/
|
||||
|
||||
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
|
||||
$this->import_updatekeys_array[$r] = array('m.ref' => 'Ref');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'm.fk_product' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/product/class/product.class.php',
|
||||
'class' => 'Product',
|
||||
'method' => 'fetch',
|
||||
'element' => 'Product'
|
||||
),
|
||||
'm.fk_warehouse' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/product/stock/class/entrepot.class.php',
|
||||
'class' => 'Entrepot',
|
||||
'method' => 'fetch',
|
||||
'element' => 'Warehouse'
|
||||
),
|
||||
'm.fk_user_valid' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/user/class/user.class.php',
|
||||
'class' => 'User',
|
||||
'method' => 'fetch',
|
||||
'element' => 'user'
|
||||
),
|
||||
'm.fk_user_modif' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/user/class/user.class.php',
|
||||
'class' => 'User',
|
||||
'method' => 'fetch',
|
||||
'element' => 'user'
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -276,10 +276,10 @@ 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_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] = [
|
||||
$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] = array('c' => MAIN_DB_PREFIX.'propal', 'extra' => MAIN_DB_PREFIX.'propal_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('c'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r] = array(
|
||||
'c.ref' => 'Document Ref*',
|
||||
'c.ref_client' => 'RefCustomer',
|
||||
'c.fk_soc' => 'ThirdPartyName*',
|
||||
@ -293,7 +293,7 @@ class modPropale extends DolibarrModules
|
||||
'c.note_public' => 'Note',
|
||||
'c.date_livraison' => 'DeliveryDate',
|
||||
'c.fk_user_valid' => 'ValidatedById'
|
||||
];
|
||||
);
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency';
|
||||
$this->import_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate';
|
||||
@ -302,7 +302,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 elementtype = 'propal' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -353,12 +353,12 @@ 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_tables_array[$r] = [
|
||||
$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] = array(
|
||||
'cd' => MAIN_DB_PREFIX.'propaldet',
|
||||
'extra' => MAIN_DB_PREFIX.'propaldet_extrafields'
|
||||
];
|
||||
$this->import_fields_array[$r] = [
|
||||
);
|
||||
$this->import_fields_array[$r] = array(
|
||||
'cd.fk_propal' => 'Document Ref*',
|
||||
'cd.fk_parent_line' => 'PrParentLine',
|
||||
'cd.fk_product' => 'IdProduct',
|
||||
@ -377,7 +377,7 @@ class modPropale extends DolibarrModules
|
||||
'cd.date_start' => 'Start Date',
|
||||
'cd.date_end' => 'End Date',
|
||||
'cd.buy_price_ht' => 'LineBuyPriceHT'
|
||||
];
|
||||
);
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency';
|
||||
$this->import_fields_array[$r]['cd.multicurrency_subprice'] = 'CurrencyRate';
|
||||
@ -386,7 +386,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 elementtype = 'propaldet' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -398,9 +398,9 @@ class modPropale extends DolibarrModules
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'propaldet'];
|
||||
$this->import_regex_array[$r] = ['cd.product_type' => '[0|1]$'];
|
||||
$import_sample = [
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'propaldet');
|
||||
$this->import_regex_array[$r] = array('cd.product_type' => '[0|1]$');
|
||||
$import_sample = array(
|
||||
'cd.fk_propal' => 'PROV(0001)',
|
||||
'cd.fk_parent_line' => '',
|
||||
'cd.fk_product' => '',
|
||||
@ -424,17 +424,17 @@ class modPropale extends DolibarrModules
|
||||
'cd.multicurrency_total_ht' => '10000',
|
||||
'cd.multicurrency_total_tva' => '0',
|
||||
'cd.multicurrency_total_ttc' => '10100'
|
||||
];
|
||||
);
|
||||
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
|
||||
$this->import_updatekeys_array[$r] = ['cd.fk_propal' => 'Quotation Id', 'cd.fk_product' => 'Product Id'];
|
||||
$this->import_convertvalue_array[$r] = [
|
||||
'cd.fk_propal' => [
|
||||
$this->import_updatekeys_array[$r] = array('cd.fk_propal' => 'Quotation Id', 'cd.fk_product' => 'Product Id');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'cd.fk_propal' => array(
|
||||
'rule'=>'fetchidfromref',
|
||||
'file'=>'/comm/propal/class/propal.class.php',
|
||||
'class'=>'Propal',
|
||||
'method'=>'fetch'
|
||||
]
|
||||
];
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ LatestBOMModified=Latest %s Bills of materials modified
|
||||
LatestMOModified=Latest %s Manufacturing Orders modified
|
||||
Bom=Bills of Material
|
||||
BillOfMaterials=Bill of Materials
|
||||
BillOfMaterialsLines=Bill of Materials lines
|
||||
BOMsSetup=Setup of module BOM
|
||||
ListOfBOMs=List of bills of material - BOM
|
||||
ListOfManufacturingOrders=List of Manufacturing Orders
|
||||
@ -102,3 +103,4 @@ HumanMachine=Human / Machine
|
||||
WorkstationArea=Workstation area
|
||||
Machines=Machines
|
||||
THMEstimatedHelp=This rate makes it possible to define a forecast cost of the item
|
||||
MOAndLines=Manufacturing Orders and lines
|
||||
@ -261,3 +261,5 @@ ProductDoesNotExist=Product does not exist
|
||||
ErrorSameBatchNumber=Same batch number found in inventory list
|
||||
ProductBatchDoesNotExist=Product with batch/serial does not exist
|
||||
ProductBarcodeDoesNotExist=Product with barcode does not exist
|
||||
WarehouseId=Warehouse ID
|
||||
WarehouseRef=Warehouse Ref
|
||||
@ -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'];
|
||||
$childs = [];
|
||||
$keys = array('rowid', 'qty', 'fk_product_type', 'label', 'incdec');
|
||||
$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;
|
||||
@ -2025,8 +2025,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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user