Fix import supplier product price vat

This commit is contained in:
Laurent Destailleur 2018-02-06 10:03:06 +01:00
parent bf7ae08c48
commit 930d58ab96
8 changed files with 34 additions and 25 deletions

View File

@ -299,15 +299,18 @@ class modProduct extends DolibarrModules
$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('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price');
$this->import_tables_creator_array[$r]=array('sp'=>'fk_user');
$this->import_fields_array[$r]=array('sp.fk_product'=>"ProductOrService*",
'sp.fk_soc'=>"Supplier*", 'sp.ref_fourn'=>'SupplierRef', 'sp.quantity'=>"QtyMin*", 'sp.tva_tx'=>'VATRate',
$this->import_fields_array[$r]=array(
'sp.fk_product'=>"ProductOrService*",
'sp.fk_soc'=>"Supplier*", 'sp.ref_fourn'=>'SupplierRef', 'sp.quantity'=>"QtyMin*", 'sp.tva_tx'=>'VATRate', 'sp.default_vat_code'=>'VATCode'
);
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.recuperableonly'=>'VATNPR'));
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type'));
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type'));
$this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array(
'sp.price'=>"PriceQtyMinHT*",
'sp.unitprice'=>'UnitPriceHT*', // TODO Make this field not required and calculate it from price and qty
'sp.remise_percent'=>'DiscountQtyMin'
);
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.recuperableonly'=>'NPR'));
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type'));
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type'));
));
$this->import_convertvalue_array[$r]=array(
'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),
'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')

View File

@ -272,12 +272,18 @@ class modService extends DolibarrModules
$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('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price');
$this->import_tables_creator_array[$r]=array('sp'=>'fk_user');
$this->import_fields_array[$r]=array('sp.fk_product'=>"ProductOrService*",
'sp.fk_soc'=>"Supplier*", 'sp.ref_fourn'=>'SupplierRef', 'sp.quantity'=>"QtyMin*", 'sp.tva_tx'=>'VATRate',
'sp.price'=>"PriceQtyMinHT*",
'sp.unitprice'=>'UnitPriceHT*', // TODO Make this file not required and calculate it from price and qty
'sp.remise_percent'=>'DiscountQtyMin'
$this->import_fields_array[$r]=array(
'sp.fk_product'=>"ProductOrService*",
'sp.fk_soc'=>"Supplier*", 'sp.ref_fourn'=>'SupplierRef', 'sp.quantity'=>"QtyMin*", 'sp.tva_tx'=>'VATRate', 'sp.default_vat_code'=>'VATCode'
);
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.recuperableonly'=>'VATNPR'));
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type'));
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type'));
$this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array(
'sp.price'=>"PriceQtyMinHT*",
'sp.unitprice'=>'UnitPriceHT*', // TODO Make this field not required and calculate it from price and qty
'sp.remise_percent'=>'DiscountQtyMin'
));
$this->import_convertvalue_array[$r]=array(
'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),

View File

@ -411,7 +411,7 @@ class modSociete extends DolibarrModules
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]="ImportDataset_company_3"; // Translation key
$this->import_icon[$r]='account';
$this->import_icon[$r]='company';
$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('sr'=>MAIN_DB_PREFIX.'societe_rib');
$this->import_fields_array[$r]=array('sr.fk_soc'=>"ThirdPartyName*",'sr.bank'=>"Bank",

View File

@ -377,8 +377,8 @@ ExportDataset_company_1=Third parties (Companies / foundations / physical people
ExportDataset_company_2=Contacts and properties
ImportDataset_company_1=Third parties (Companies / foundations / physical people) and properties
ImportDataset_company_2=Contacts/Addresses (of thirdparties or not) and attributes
ImportDataset_company_3=Bank details
ImportDataset_company_4=Third parties/Sales representatives (Affect sales representatives users to companies)
ImportDataset_company_3=Bank accounts of thirdparties
ImportDataset_company_4=Third parties/Sales representatives (Assign sales representatives users to companies)
PriceLevel=Price level
DeliveryAddress=Delivery address
AddAddress=Add address

View File

@ -389,6 +389,8 @@ LT2ES=IRPF
LT1IN=CGST
LT2IN=SGST
VATRate=Tax Rate
VATCode=Tax Rate code
VATNPR=Tax Rate NPR
DefaultTaxRate=Default tax rate
Average=Average
Sum=Sum

View File

@ -26,18 +26,16 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
// Load translations files required by page
$langs->load("resource");
$langs->load("companies");
$langs->load("other");
$langs->loadLangs(array("resource","companies","other"));
// Get parameters
$id = GETPOST('id','int');
$id = GETPOST('id','int');
$action = GETPOST('action','alpha');
$lineid = GETPOST('lineid','int');
$element = GETPOST('element','alpha');
$element_id = GETPOST('element_id','int');
$resource_id = GETPOST('resource_id','int');
$lineid = GETPOST('lineid','int');
$element = GETPOST('element','alpha');
$element_id = GETPOST('element_id','int');
$resource_id = GETPOST('resource_id','int');
$sortorder = GETPOST('sortorder','alpha');
$sortfield = GETPOST('sortfield','alpha');
@ -89,7 +87,7 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con
$hookmanager->initHooks(array('resource_list'));
if (empty($sortorder)) $sortorder="ASC";
if (empty($sortfield)) $sortfield="t.rowid";
if (empty($sortfield)) $sortfield="t.ref";
if (empty($arch)) $arch = 0;
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;

View File

@ -3598,7 +3598,7 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; }
.cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; }
.cal_event_busy a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); }
.cal_event_busy { }
.cal_peruserviewname { max-width: 100px; height: 22px; }
.cal_peruserviewname { max-width: 140px; height: 22px; }
/* ============================================================================== */

View File

@ -3649,7 +3649,7 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; }
.cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; }
.cal_event_busy a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); }
.cal_event_busy { }
.cal_peruserviewname { max-width: 100px; height: 22px; }
.cal_peruserviewname { max-width: 140px; height: 22px; }
.topmenuimage {
background-size: 28px auto;