Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 11.0

Conflicts:
	ChangeLog
	htdocs/fourn/class/fournisseur.product.class.php
This commit is contained in:
Laurent Destailleur 2020-04-02 16:49:37 +02:00
commit 19084286be
4 changed files with 109 additions and 18 deletions

View File

@ -380,6 +380,77 @@ Following changes may create regressions for some external modules, but were nec
* The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core.
***** ChangeLog for 10.0.7 compared to 10.0.6 *****
FIX: 10.0 - missing translations for "orders" homepage "orders" box
FIX: 10.0 - status missing from last customer invoices box when using MAIN_STATUS_USES_CSS
FIX: 10.0 - translations for "orders" not loaded in the homepage box
FIX: #10309
FIX: #12875
FIX: #12932
FIX: #12966
FIX: #12973
FIX: #13304
FIX: advanced target emailing sql and ergonomy
FIX: an external user can not approved
FIX: Bad translation for productlot EatBy and SellBy
FIX: better check
FIX: better method to check user rights AND usergroup rights !
FIX: CA by prod list filter
FIX: can be a string or integer
FIX: Check on unicity on prof id was not triggered sometimes
FIX: clone of purchase order
FIX: compatibility with multicompany (avoid duplicate data)
FIX: complex export model loading
FIX: date filter not used if no operator
FIX: date order was -1D and desc with label repetition
FIX: default lang selection when filter
FIX: dom and missing param
FIX: drafts are now implemented for stats
FIX: Error in log for email sending with smtps was not complete
FIX: Extrafield position in export field list must respect "pos" field
FIX: FEC export format
FIX: FEC export have specific name
FIX: fetching account on current entity
FIX: Filenames must not contains non ascii char or we will get non ascii
FIX: fk_type subscription list via api REST
FIX: Force FEC export to txt format
FIX: get remain to pay with rounding decimals
FIX: Invert isSellerInEEC and isBuyerInEEC
FIX: keep assigned users in session when loading projects and tasks
FIX: length, width and height units coherence in product table
FIX: links in products/services index
FIX: Mail smtps truncated if content has a line with single .
FIX: missing array option
FIX: missing global $conf
FIX: missing hook parameter
FIX: Missing Linked objects Fichinter Ref. in PDF formats
FIX: missing "statut" for getNomUrl() function
FIX: multicompany for discount
FIX: must be == and not =
FIX: Problem with column label in subscription list
FIX: regex for include or exclude categories in full arbo
FIX: Remove unexisting link
FIX: remove unused var, $usercancreate can be change by Multicompany
FIX: require category class in extrafield
FIX: round MT in accountancy books
FIX: search with '0'
FIX: send expense report mail in HTML format
FIX: SQL request and phpunit
FIX: substitute lines dates values on doc generator (ODT, ...)
FIX: test on 0 better than isset
FIX: The "automatic bind" was linked EEC to export accountancy code
FIX: thirdparty alias name desappeared if we change country with THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION conf
FIX: timezone must be tzserver and not tzuser as well as on contract card
FIX: typo on ckeck method
FIX: use "usergroup" instead "user"
FIX: Visualization rights correction on last modified contacts box
FIX: Warning on admin/export_files
FIX: We want to be able to import data for extrafields of entity 0 too
FIX: when we filter a list on a view status, we want this filter to be on bookmark that we create
FIX: wrong test
FIX: XSS vulnerability in description of list of audit events.
FIX: z-index for moretabsList with constant MAIN_MAXTABS_IN_CARD
***** ChangeLog for 10.0.6 compared to 10.0.5 *****
FIX Regression of 10.0.5 to create/edit proposals and orders.
FIX: #12760 #12763 #12755 #12765 #12751

View File

@ -432,7 +432,7 @@ class ProductFournisseur extends Product
$sql .= " ".($newdefaultvatcode ? "'".$this->db->escape($newdefaultvatcode)."'" : "null").",";
$sql .= " ".$newnpr.",";
$sql .= $conf->entity.",";
$sql .= $delivery_time_days.",";
$sql .= ($delivery_time_days != '' ? $delivery_time_days : 'null') . ",";
$sql .= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
$sql .= (empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
$sql .= (empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
@ -451,7 +451,7 @@ class ProductFournisseur extends Product
if (!$error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) {
// Add record into log table
// $this->product_fourn_price_id must be set
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrenc, $multicurrency_code);
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrency, $multicurrency_code);
if ($result < 0) {
$error++;
}

View File

@ -1800,25 +1800,25 @@ class SupplierProposal extends CommonObject
*/
public function updateOrCreatePriceFournisseur($user)
{
$productsupplier = new ProductFournisseur($this->db);
global $conf;
dol_syslog(get_class($this)."::updateOrCreatePriceFournisseur", LOG_DEBUG);
foreach ($this->lines as $product)
{
if ($product->subprice <= 0) continue;
$productsupplier = new ProductFournisseur($this->db);
$idProductFourn = $productsupplier->find_min_price_product_fournisseur($product->fk_product, $product->qty);
$res = $productsupplier->fetch($idProductFourn);
$multicurrency_tx = 1;
$fk_multicurrency = 0;
if ($productsupplier->id) {
if ($productsupplier->fourn_qty == $product->qty) {
$this->updatePriceFournisseur($productsupplier->product_fourn_price_id, $product, $user);
} else {
$this->createPriceFournisseur($product, $user);
}
} else {
$this->createPriceFournisseur($product, $user);
}
if(empty($this->thirdparty)) $this->fetch_thirdparty();
$ref_fourn = $product->ref_fourn;
if(empty($ref_fourn)) $ref_fourn = $product->ref_supplier;
if(!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) list($fk_multicurrency, $multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $product->multicurrency_code);
$productsupplier->id = $product->fk_product;
$productsupplier->update_buyprice($product->qty, $product->subprice, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_subprice, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', '');
}
return 1;
@ -1856,11 +1856,12 @@ class SupplierProposal extends CommonObject
*/
public function createPriceFournisseur($product, $user)
{
$price=price2num($product->subprice*$product->qty, 'MU');
global $conf;
$price=price2num($product->subprice*$product->qty, 'MU');
$qty=price2num($product->qty);
$unitPrice = price2num($product->subprice, 'MU');
$now=dol_now();
$values = array(
"'".$this->db->idate($now)."'",
$product->fk_product,
@ -1872,9 +1873,28 @@ class SupplierProposal extends CommonObject
$product->tva_tx,
$user->id
);
if (!empty($conf->multicurrency->enabled)) {
if (!empty($product->multicurrency_code)) {
include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
$multicurrency = new MultiCurrency($this->db); //need to fetch because empty fk_multicurrency and rate
$multicurrency->fetch(0, $product->multicurrency_code);
if(! empty($multicurrency->id)) {
$values[] = $multicurrency->id;
$values[] = "'".$product->multicurrency_code."'";
$values[] = $product->multicurrency_subprice;
$values[] = $product->multicurrency_total_ht;
$values[] = $multicurrency->rate->rate;
}
else {
for($i = 0; $i < 5; $i++) $values[] = 'NULL';
}
}
}
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_fournisseur_price ';
$sql .= '(datec, fk_product, fk_soc, ref_fourn, price, quantity, unitprice, tva_tx, fk_user) VALUES ('.implode(',', $values).')';
$sql .= '(datec, fk_product, fk_soc, ref_fourn, price, quantity, unitprice, tva_tx, fk_user';
if(!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) $sql .= ',fk_multicurrency, multicurrency_code, multicurrency_unitprice, multicurrency_price, multicurrency_tx';
$sql .= ') VALUES ('.implode(',', $values).')';
$resql = $this->db->query($sql);
if (!$resql) {

View File

@ -47,7 +47,7 @@ if (defined('THEME_ONLY_CONSTANT')) return;
session_cache_limiter('public');
require_once '../../main.inc.php';
require_once __DIR__.'/../../main.inc.php'; // __DIR__ allow this script to be included in custom themes
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)