Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2024-01-26 03:58:41 +01:00
commit c49e0bf46b
10 changed files with 36 additions and 14 deletions

View file

@ -283,7 +283,7 @@ The following changes may create regressions for some external modules, but were
* Hidden option ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USEr_ON_SALARY_BANK_PAYMENT has been renamed into ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USER_ON_SALARY_BANK_PAYMENT
* The delete() method of AdherentType, Contact, Delivery, MultiCurrency, CurrencyRate now need $user as first parameter.
* A very high number of class properties (with old name in french) are now deprecated in favor of the property name in english.
* The load of hook context productdao has been removed before calling loadvirtualstock. Modules must use the context of main parent page or 'all' for all cases.
***** ChangeLog for 18.0.4 compared to 18.0.3 *****
FIX: $this->newref already exists and could have been modified by trigger but we still use a local variable for the filesystem-based renaming

View file

@ -1190,6 +1190,10 @@ if (empty($reshook)) {
if (!empty($price_ht) || (string) $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ((float) $tmpvat / 100)), 'MU');
} elseif (!empty($price_ht_devise) || (string) $price_ht_devise === '0') {
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$pu_ht = '';
$pu_ttc = '';
} elseif (!empty($price_ttc) || (string) $price_ttc === '0') {
$pu_ttc = price2num($price_ttc, 'MU');
$pu_ht = price2num($pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU');

View file

@ -2218,6 +2218,10 @@ if (empty($reshook)) {
if (!empty($price_ht) || $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} elseif (!empty($price_ht_devise) || $price_ht_devise === '0') {
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$pu_ht = '';
$pu_ttc = '';
} elseif (!empty($price_ttc) || $price_ttc === '0') {
$pu_ttc = price2num($price_ttc, 'MU');
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
@ -2309,8 +2313,10 @@ if (empty($reshook)) {
$type = $prod->type;
$fk_unit = $prod->fk_unit;
} else {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($price_ttc, 'MU');
if (!empty($price_ht)) $pu_ht = price2num($price_ht, 'MU');
else $pu_ht = '';
if (!empty($price_ttc)) $pu_ttc = price2num($price_ttc, 'MU');
else $pu_ttc = '';
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
$tva_tx = str_replace('*', '', $tva_tx);
if (empty($tva_tx)) {
@ -2336,8 +2342,8 @@ if (empty($reshook)) {
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
$pu_ht_devise = price2num($price_ht_devise, '', 2);
$pu_ttc_devise = price2num($price_ttc_devise, '', 2);
// Prepare a price equivalent for minimum price check
$pu_equivalent = $pu_ht;

View file

@ -1116,7 +1116,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Check if Extrafields is totalizable
if (!empty($extrafields->attributes['projet_task']['totalizable'])) {
foreach ($extrafields->attributes['projet_task']['totalizable'] as $key => $value) {
if (!empty($arrayfields['efpt.'.$key]['checked']) && $arrayfields['ef.'.$key]['checked'] == 1) {
if (!empty($arrayfields['efpt.'.$key]['checked']) && $arrayfields['efpt.'.$key]['checked'] == 1) {
print '<td class="right">';
if ($value == 1) {
print empty($totalarray['totalizable'][$key]['total']) ? '' : $totalarray['totalizable'][$key]['total'];

View file

@ -692,6 +692,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) {
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
jQuery("#price_ttc").val('');
jQuery("#multicurrency_subprice").val('');
jQuery("#multicurrency_price_ht").val('');
}
});
jQuery("#price_ttc").keyup(function(event) {
@ -699,11 +700,19 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) {
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#multicurrency_subprice").val('');
jQuery("#multicurrency_price_ht").val('');
}
});
jQuery("#multicurrency_subprice").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#multicurrency_subprice").val() != '') {
jQuery("#price_ht").val('');
jQuery("#price_ttc").val('');
}
});
jQuery("#multicurrency_price_ht").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#multicurrency_price_ht").val() != '') {
jQuery("#price_ht").val('');
jQuery("#price_ttc").val('');
}

View file

@ -1791,7 +1791,7 @@ if (empty($reshook)) {
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings
}
$price_base_type = 'HT';
$pu_devise = price2num($price_devise, 'CU');
$pu_devise = price2num($price_ht_devise, 'CU');
$result = $object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_devise, $ref_supplier);
}

View file

@ -2213,17 +2213,18 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
if (isset($_POST) && is_array($_POST)) {
foreach ($_POST as $key => $value) {
$key = preg_replace('/[^a-z0-9_\.\-\[\]]/i', '', $key);
if (in_array($key, array('action', 'massaction', 'password'))) {
continue;
}
if (!is_array($value)) {
if ($value !== '') {
$qs .= '&'.$key.'='.urlencode($value);
$qs .= '&'.urlencode($key).'='.urlencode($value);
}
} else {
foreach ($value as $value2) {
if (($value2 !== '') && (!is_array($value2))) {
$qs .= '&'.$key.'[]='.urlencode($value2);
$qs .= '&'.urlencode($key).'[]='.urlencode($value2);
}
}
}

View file

@ -68,7 +68,7 @@ class FormProduct
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
* @param boolean $sumStock sum total stock of a warehouse, default true
* @param array $exclude warehouses ids to exclude
* @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock
* @param bool|int $stockMin [=false] Value of minimum stock to filter (only warehouse with stock > stockMin are loaded) or false not not filter by minimum stock
* @param string $orderBy [='e.ref'] Order by
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
* @throws Exception
@ -276,7 +276,7 @@ class FormProduct
* @param string $morecss Add more css classes to HTML select
* @param array $exclude Warehouses ids to exclude
* @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse
* @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock
* @param bool|int $stockMin [=false] Value of minimum stock to filter (only warehouse with stock > stockMin are loaded) or false not not filter by minimum stock
* @param string $orderBy [='e.ref'] Order by
* @param int $multiselect 1=Allow multiselect
* @return string HTML select

View file

@ -5924,7 +5924,6 @@ class Product extends CommonObject
$this->stock_theorique += ($stock_commande_fournisseur - $stock_reception_fournisseur);
}
$hookmanager->initHooks(array('productdao'));
$parameters = array('id'=>$this->id, 'includedraftpoforvirtual' => $includedraftpoforvirtual);
// Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager->executeHooks('loadvirtualstock', $parameters, $this, $action);

View file

@ -504,8 +504,11 @@ if (empty($reshook)) {
$newobject->fetch_optionals();
$newobject->fetch_thirdparty(); // Load new object
$object = $newobject;
$action = 'edit';
$action = 'view';
$comefromclone = true;
setEventMessages($langs->trans("ProjectCreatedInDolibarr", $newobject->ref), "", 'mesgs');
//var_dump($newobject); exit;
}
}