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

develop
This commit is contained in:
Laurent Destailleur
2022-09-25 17:12:03 +02:00
16 changed files with 43 additions and 18 deletions

View File

@@ -582,6 +582,17 @@ begin
end; end;
end; end;
if browser = 'iexplore.exe' then
begin
if FileExists (pfPath+'/Microsoft/Edge/Application/msedge.exe') then
begin
if MsgBox(CustomMessage('MicrosoftEdgeDetected'),mbConfirmation,MB_YESNO) = IDYES then
begin
browser := pfPath+'/Microsoft/Edge/Application/msedge.exe';
end;
end;
end;
if browser = 'iexplore.exe' then if browser = 'iexplore.exe' then
begin begin
if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then

View File

@@ -910,7 +910,8 @@ class BookKeeping extends CommonObject
} }
// Affichage par compte comptable // Affichage par compte comptable
if (!empty($option)) { if (!empty($option)) {
$sql .= ' AND t.subledger_account IS NOT NULL'; $sql .= " AND t.subledger_account IS NOT NULL";
$sql .= " AND t.subledger_account <> ''";
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : ''); $sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
$sortorder = 'ASC'.($sortfield ? ','.$sortfield : ''); $sortorder = 'ASC'.($sortfield ? ','.$sortfield : '');
} else { } else {

View File

@@ -1742,7 +1742,7 @@ if ($action == 'create') {
//$warehouse_id = $soc->warehouse_id; //$warehouse_id = $soc->warehouse_id;
} else { } else {
print '<td class="valuefieldcreate">'; print '<td class="valuefieldcreate">';
print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); print img_picto('', 'company').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script type="text/javascript"> print '<script type="text/javascript">

View File

@@ -1751,7 +1751,7 @@ if ($action == 'create' && $usercancreate) {
print '</td>'; print '</td>';
} else { } else {
print '<td>'; print '<td>';
print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx'); print img_picto('', 'company').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script type="text/javascript"> print '<script type="text/javascript">

View File

@@ -1110,7 +1110,6 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
// @todo : propose model selection // @todo : propose model selection
if (!$error && $massaction == 'generate_doc' && $permissiontoread) { if (!$error && $massaction == 'generate_doc' && $permissiontoread) {
$db->begin(); $db->begin();
$objecttmp = new $objectclass($db); $objecttmp = new $objectclass($db);
$nbok = 0; $nbok = 0;
foreach ($toselect as $toselectid) { foreach ($toselect as $toselectid) {
@@ -1128,6 +1127,10 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) {
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && isset($objecttmp->default_lang)) { if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && isset($objecttmp->default_lang)) {
$newlang = $objecttmp->default_lang; // for thirdparty $newlang = $objecttmp->default_lang; // for thirdparty
} }
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && empty($objecttmp->thirdparty)) { //load lang from thirdparty
$objecttmp->fetch_thirdparty();
$newlang = $objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ...
}
if (!empty($newlang)) { if (!empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);

View File

@@ -427,9 +427,9 @@ class CUnits // extends CommonObject
{ {
if ($mode == 'short_label') { if ($mode == 'short_label') {
return dol_getIdFromCode($this->db, $code, 'c_units', 'short_label', 'rowid', 0, ' AND unit_type = "'.$this->db->escape($unit_type).'"'); return dol_getIdFromCode($this->db, $code, 'c_units', 'short_label', 'rowid', 0, " AND unit_type = '".$this->db->escape($unit_type)."'");
} elseif ($mode == 'code') { } elseif ($mode == 'code') {
return dol_getIdFromCode($this->db, $code, 'c_units', 'code', 'rowid', 0, ' AND unit_type = "'. $this->db->escape($unit_type) .'"'); return dol_getIdFromCode($this->db, $code, 'c_units', 'code', 'rowid', 0, " AND unit_type = '". $this->db->escape($unit_type) ."'");
} }
return $code; return $code;

View File

@@ -143,15 +143,20 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
textarea[key] = item[value]; textarea[key] = item[value];
}); });
} }
console.log("Return value from GET to the rest of code");
return { label: label, value: item.value, id: item.key, disabled: item.disabled, return { label: label, value: item.value, id: item.key, disabled: item.disabled,
update: update, textarea: textarea, update: update,
textarea: textarea,
pbq: item.pbq, pbq: item.pbq,
type: item.type, qty: item.qty, discount: item.discount, type: item.type,
qty: item.qty,
discount: item.discount,
pricebasetype: item.pricebasetype, pricebasetype: item.pricebasetype,
price_ht: item.price_ht, price_ht: item.price_ht,
price_ttc: item.price_ttc, price_ttc: item.price_ttc,
description : item.description, description : item.description,
ref_customer: item.ref_customer } ref_customer: item.ref_customer,
tva_tx: item.tva_tx }
})); }));
} else { } else {
console.error("Error: Ajax url '.$url.($urloption ? '?'.$urloption : '').' has returned an empty page. Should be an empty json array."); console.error("Error: Ajax url '.$url.($urloption ? '?'.$urloption : '').' has returned an empty page. Should be an empty json array.");
@@ -173,6 +178,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
$("#'.$htmlnamejquery.'").attr("data-discount", ui.item.discount); $("#'.$htmlnamejquery.'").attr("data-discount", ui.item.discount);
$("#'.$htmlnamejquery.'").attr("data-description", ui.item.description); $("#'.$htmlnamejquery.'").attr("data-description", ui.item.description);
$("#'.$htmlnamejquery.'").attr("data-ref-customer", ui.item.ref_customer); $("#'.$htmlnamejquery.'").attr("data-ref-customer", ui.item.ref_customer);
$("#'.$htmlnamejquery.'").attr("data-tvatx", ui.item.tva_tx);
'; ';
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
$script .= ' $script .= '

View File

@@ -8558,7 +8558,7 @@ function dol_osencode($str)
* @param string $fieldkey Field to search the key into * @param string $fieldkey Field to search the key into
* @param string $fieldid Field to get * @param string $fieldid Field to get
* @param int $entityfilter Filter by entity * @param int $entityfilter Filter by entity
* @param string $filters Filter on other fields * @param string $filters Filters to add. WARNING: string must be escaped for SQL and not coming from user input.
* @return int <0 if KO, Id of code if OK * @return int <0 if KO, Id of code if OK
* @see $langs->getLabelFromKey * @see $langs->getLabelFromKey
*/ */

View File

@@ -260,7 +260,7 @@ class modAccounting extends DolibarrModules
$this->export_permission[$r] = array(array("accounting", "chartofaccount")); $this->export_permission[$r] = array(array("accounting", "chartofaccount"));
$this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa2.account_number'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status'); $this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa2.account_number'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status');
$this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa2.account_number'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa2.account_number'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status');
$this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa2.account_number'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting"); $this->export_entities_array[$r] = array(); // We define here only fields that use another picto
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'accounting_account as aa'; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'accounting_account as aa';

View File

@@ -957,12 +957,15 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
var discount = parseFloat($('option:selected', this).attr('data-discount')); var discount = parseFloat($('option:selected', this).attr('data-discount'));
if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));} if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));}
/* var tva_tx = $('option:selected', this).data('tvatx'); */ var tva_tx = parseFloat($('option:selected', this).attr('data-tvatx')); // When select is done from HTML select
if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery('#idprodfournprice').attr('data-tvatx'));} // When select is done from HTML input with autocomplete
console.log("We find supplier price :"+up+" qty: "+qty+" tva_tx="+tva_tx+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val()); console.log("We find supplier price :"+up+" qty: "+qty+" tva_tx="+tva_tx+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val());
jQuery("#price_ht").val(up); jQuery("#price_ht").val(up);
/* $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); */ /* $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); */
$('#tva_tx option').val(tva_tx);
if (jQuery("#qty").val() < qty) { if (jQuery("#qty").val() < qty) {
jQuery("#qty").val(qty); jQuery("#qty").val(qty);

View File

@@ -2094,7 +2094,7 @@ class CommandeFournisseur extends CommonOrder
// Method change if qty < 0 // Method change if qty < 0
if (!empty($conf->global->SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN) && $qty < 0) { if (!empty($conf->global->SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN) && $qty < 0) {
$result = $mouv->livraison($user, $product, $entrepot, $qty*(-1), $price, $comment, $now, $eatby, $sellby, $batch); $result = $mouv->livraison($user, $product, $entrepot, $qty*(-1), $price, $comment, $now, $eatby, $sellby, $batch, 0, $inventorycode);
} else { } else {
$result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch, '', 0, $inventorycode); $result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch, '', 0, $inventorycode);
} }

View File

@@ -2053,7 +2053,7 @@ if ($action == 'create') {
print $societe->getNomUrl(1, 'supplier'); print $societe->getNomUrl(1, 'supplier');
print '<input type="hidden" name="socid" value="'.$societe->id.'">'; print '<input type="hidden" name="socid" value="'.$societe->id.'">';
} else { } else {
print img_picto('', 'company').$form->select_company(!empty($societe->id) ? $societe->id : 0, 'socid', 's.fournisseur=1', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 widthcentpercentminusxx maxwidth500'); print img_picto('', 'company').$form->select_company(empty($societe->id) ? 0 : $societe->id, 'socid', '(s.fournisseur = 1 AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 widthcentpercentminusxx maxwidth500');
// reload page to retrieve supplier informations // reload page to retrieve supplier informations
if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) {
print '<script type="text/javascript"> print '<script type="text/javascript">

View File

@@ -551,9 +551,9 @@ if ($id > 0 || $ref) {
print '<tr><td class="fieldrequired">'.$langs->trans("SupplierRef").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("SupplierRef").'</td><td>';
if ($rowid) { if ($rowid) {
print '<input type="hidden" name="ref_fourn_old" value="'.$object->ref_supplier.'">'; print '<input type="hidden" name="ref_fourn_old" value="'.$object->ref_supplier.'">';
print '<input class="flat width150" maxlength="30" name="ref_fourn" value="'.$object->ref_supplier.'">'; print '<input class="flat width150" maxlength="128" name="ref_fourn" value="'.$object->ref_supplier.'">';
} else { } else {
print '<input class="flat width150" maxlength="30" name="ref_fourn" value="'.(GETPOST("ref_fourn") ? GETPOST("ref_fourn") : '').'">'; print '<input class="flat width150" maxlength="128" name="ref_fourn" value="'.(GETPOST("ref_fourn") ? GETPOST("ref_fourn") : '').'">';
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@@ -994,7 +994,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Delete (need delete permission, or if draft, just need create/modify permission) // Delete (need delete permission, or if draft, just need create/modify permission)
if ($object->status < $object::STATUS_TRANSFERED && $permissiontodelete) { if ($object->status < $object::STATUS_TRANSFERED && $permissiontodelete) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'."\n"; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
} }
/*else /*else
{ {

View File

@@ -720,6 +720,7 @@ class User extends CommonObject
'inventory' => 'stock', 'inventory' => 'stock',
'invoice' => 'facture', 'invoice' => 'facture',
'invoice_supplier' => 'fournisseur', 'invoice_supplier' => 'fournisseur',
'order_supplier' => 'fournisseur',
'knowledgerecord' => 'knowledgerecord@knowledgemanagement', 'knowledgerecord' => 'knowledgerecord@knowledgemanagement',
'skill@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" 'skill@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all"
'job@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" 'job@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all"