Skip to content

Commit

Permalink
Fix import supplier product price vat
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 6, 2018
1 parent bf7ae08 commit 930d58a
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 25 deletions.
15 changes: 9 additions & 6 deletions htdocs/core/modules/modProduct.class.php
Expand Up @@ -299,15 +299,18 @@ function __construct($db)
$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 field 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'=>'NPR'));
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'),
'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
Expand Down
16 changes: 11 additions & 5 deletions htdocs/core/modules/modService.class.php
Expand Up @@ -272,12 +272,18 @@ function __construct($db)
$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'),
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/modSociete.class.php
Expand Up @@ -411,7 +411,7 @@ function __construct($db)
$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",
Expand Down
4 changes: 2 additions & 2 deletions htdocs/langs/en_US/companies.lang
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions htdocs/langs/en_US/main.lang
Expand Up @@ -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
Expand Down
16 changes: 7 additions & 9 deletions htdocs/resource/list.php
Expand Up @@ -26,18 +26,16 @@
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');
Expand Down Expand Up @@ -89,7 +87,7 @@
$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;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/theme/eldy/style.css.php
Expand Up @@ -3598,7 +3598,7 @@
.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; }


/* ============================================================================== */
Expand Down
2 changes: 1 addition & 1 deletion htdocs/theme/md/style.css.php
Expand Up @@ -3649,7 +3649,7 @@
.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;
Expand Down

0 comments on commit 930d58a

Please sign in to comment.