From 930d58ab961c4d1e0095fb460e8ff72b4db28f7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Feb 2018 10:03:06 +0100 Subject: [PATCH] Fix import supplier product price vat --- htdocs/core/modules/modProduct.class.php | 15 +++++++++------ htdocs/core/modules/modService.class.php | 16 +++++++++++----- htdocs/core/modules/modSociete.class.php | 2 +- htdocs/langs/en_US/companies.lang | 4 ++-- htdocs/langs/en_US/main.lang | 2 ++ htdocs/resource/list.php | 16 +++++++--------- htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 8 files changed, 34 insertions(+), 25 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 5f44b843e1fc9..e747f05b3f695 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -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') diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index eed1008ca3473..7a9a3f4df3fa2 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -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'), diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 897a954a88fb4..ba16efbea58ff 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -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", diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 7cff22df09219..353b8ca0c475f 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -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 diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 1501d0c13813d..28ddd9d56a892 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -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 diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 4f11119d44f1f..190659628f2b4 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -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'); @@ -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; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b3b92387309f0..ad5dd90306467 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -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; } /* ============================================================================== */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index ef5350421b691..d9b89ab2b405a 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -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;