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

This commit is contained in:
Laurent Destailleur 2024-11-06 13:26:08 +01:00
commit 4bdd848bbe
16 changed files with 63 additions and 14 deletions

View File

@ -908,7 +908,7 @@ if ($resql) {
// Active
print '<td class="center" class="nowrap">';
if ($canbedisabled) {
print '<a class="reposition" href="'.$url.'action='.$acts[$obj->active].'&token='.newToken().'">'.$actl[$obj->active].'</a>';
print '<a class="reposition" href="'.$url.'action='.urlencode($acts[$obj->active]).'&token='.newToken().'">'.$actl[$obj->active].'</a>';
} else {
print $langs->trans("AlwaysActive");
}

View File

@ -243,7 +243,7 @@ if (empty($mysoc->country_code)) {
// Show examples
print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', '');
print '<span class="opacitymedium">'.$langs->trans("Format").':</span> '.price(price2num(1234.56789, 'MT'), 0, $langs, 1, -1, -1, $currencycode)."<br>\n";
print '<span class="opacitymedium">'.$langs->trans("NumberFormatForATotalPrice", '1234.56789').':</span> '.price(price2num(1234.56789, 'MT'), 0, $langs, 1, -1, -1, $currencycode)."<br>\n";
// Always show vat rates with vat 0
$s = 2 / 3;
@ -312,6 +312,23 @@ if (empty($mysoc->country_code)) {
print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
print "<br>\n";
}
if (getDolGlobalString('MAIN_ADD_MORE_EXAMPLE_IN_ACCURANCY_SETUP')) {
$qty = '1.234';
$vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
$localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
$s = 10 / 3;
$tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
print ' - <span class="opacitymedium">'.$langs->trans("VAT").':</span> '.$vat.'%';
print($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ";
print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
print "<br>\n";
}
}
} else {
// More examples if not specific vat rate found

View File

@ -376,7 +376,9 @@ class Boms extends DolibarrApi
$request_data->position,
$request_data->fk_bom_child,
$request_data->import_key,
$request_data->fk_unit
$request_data->fk_unit,
$request_data->array_options,
$request_data->fk_default_workstation
);
if ($updateRes > 0) {
@ -425,7 +427,9 @@ class Boms extends DolibarrApi
$request_data->efficiency,
$request_data->position,
$request_data->import_key,
$request_data->fk_unit
$request_data->fk_unit,
$request_data->array_options,
$request_data->fk_default_workstation
);
if ($updateRes > 0) {

View File

@ -368,7 +368,7 @@ if (empty($reshook) && $action == 'add' && $usercancreate) {
}
if (!$error) {
// Initialisation object actioncomm
// Initialisation of object actioncomm
$object->priority = GETPOSTISSET("priority") ? GETPOSTINT("priority") : 0;
$object->fulldayevent = ($fulldayevent ? 1 : 0);
$object->location = GETPOST("location", 'alphanohtml');
@ -377,11 +377,15 @@ if (empty($reshook) && $action == 'add' && $usercancreate) {
if (GETPOST("elementtype", 'alpha')) {
$elProp = getElementProperties(GETPOST("elementtype", 'alpha'));
$modulecodetouseforpermissioncheck = $elProp['module'];
$submodulecodetouseforpermissioncheck = $elProp['subelement'];
$hasPermissionOnLinkedObject = 0;
if ($user->hasRight($modulecodetouseforpermissioncheck, 'read')) {
$hasPermissionOnLinkedObject = 1;
} elseif ($user->hasRight($modulecodetouseforpermissioncheck, $submodulecodetouseforpermissioncheck, 'read')) {
$hasPermissionOnLinkedObject = 1;
}
if ($hasPermissionOnLinkedObject) {
$object->fk_element = GETPOSTINT("fk_element");
$object->elementid = GETPOSTINT("fk_element");
@ -444,7 +448,9 @@ if (empty($reshook) && $action == 'add' && $usercancreate) {
$object->note_private = trim(GETPOST("note", "restricthtml"));
if (GETPOSTISSET("contactid")) {
$object->contact = $contact;
$object->contact_id = GETPOSTINT("contactid");
$object->contact = $contact; // For backward compatibility
}
if (GETPOSTINT('socid') > 0) {

View File

@ -4311,8 +4311,8 @@ abstract class CommonObject
$sourceid = (!empty($sourceid) ? $sourceid : $this->id);
$targetid = (!empty($targetid) ? $targetid : $this->id);
$sourcetype = (!empty($sourcetype) ? $sourcetype : $this->element);
$targettype = (!empty($targettype) ? $targettype : $this->element);
$sourcetype = (!empty($sourcetype) ? $sourcetype : $this->getElementType());
$targettype = (!empty($targettype) ? $targettype : $this->getElementType());
/*if (empty($sourceid) && empty($targetid))
{

View File

@ -466,7 +466,7 @@ function getEntity($element, $shared = 1, $currentobject = null)
} else {
$out = '';
$addzero = array('user', 'usergroup', 'cronjob', 'c_email_templates', 'email_template', 'default_values', 'overwrite_trans');
if (getDolGlobalString('HOLIDAY_ALLOW_ZERO_IN_DIC')) {
if (getDolGlobalString('HOLIDAY_ALLOW_ZERO_IN_DIC')) { // this constant break the dictionary admin without Multicompany
$addzero[] = 'c_holiday_types';
}
if (in_array($element, $addzero)) {

View File

@ -149,6 +149,13 @@ class ImportXlsx extends ModeleImports
$this->label_lib = 'PhpSpreadSheet';
$this->version_lib = '1.8.0';
$arrayofstreams = stream_get_wrappers();
if (!in_array('zip', $arrayofstreams)) {
$langs->load("errors");
$this->error = $langs->trans('ErrorStreamMustBeEnabled', 'zip');
return;
}
$this->datatoimport = $datatoimport;
if (preg_match('/^societe_/', $datatoimport)) {
$this->thirdpartyobject = new Societe($this->db);

View File

@ -332,8 +332,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
$totalonlinkedelements += $element->total_ht;
}
}
dol_syslog("Amount of linked reception = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
if ($totalonlinkedelements == $object->total_ht) {
dol_syslog("Amount of linked reception = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".((string) $totalonlinkedelements == (string) $object->total_ht), LOG_DEBUG);
if ( (string) $totalonlinkedelements == (string) $object->total_ht) {
foreach ($object->linkedObjects['reception'] as $element) {
$ret = $element->setClosed();
if ($ret < 0) {

View File

@ -788,6 +788,15 @@ if ($step == 4 && $datatoimport) {
require_once $dir.$file;
$obj = new $classname($db, $datatoimport);
'@phan-var-force ModeleImports $obj';
if (!empty($obj->error)) {
$langs->load("errors");
$param = '&datatoimport='.$datatoimport.'&format='.$format;
setEventMessages($obj->error, null, 'errors');
header("Location: ".$_SERVER["PHP_SELF"].'?step=3'.$param.'&filetoimport='.urlencode($relativepath));
exit;
}
if ($model == 'csv') {
'@phan-var-force ImportCsv $obj';
$obj->separator = $separator_used;

View File

@ -571,3 +571,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
UPDATE llx_menu SET url = '/fourn/paiement/list.php?mainmenu=billing&leftmenu=suppliers_bills_payment' WHERE leftmenu = 'suppliers_bills_payment';
UPDATE llx_paiement SET ref = rowid WHERE ref IS NULL OR ref = '';
-- rename const WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE to WORKFLOW_RECEPTION_CLASSIFY_CLOSED_INVOICE
UPDATE llx_const SET name = 'WORKFLOW_RECEPTION_CLASSIFY_CLOSED_INVOICE' WHERE name = 'WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE';

View File

@ -2046,6 +2046,7 @@ Enter0or1=Enter 0 or 1
EnterYesOrNo=Enter Yes or No
UnicodeCurrency=Enter here between braces, list of byte number that represent the currency symbol. For example: for $, enter [36] - for brazil real R$ [82,36] - for €, enter [8364]
ColorFormat=The RGB color is in HEX format, eg: FF0000
NumberFormatForATotalPrice=Number format for the total price %s
PictoHelp=Icon name in format:<br>- image.png for an image file into the current theme directory<br>- image.png@module if file is into the directory /img/ of a module<br>- fa-xxx for a FontAwesome fa-xxx picto<br>- fontawesome_xxx_fa_color_size for a FontAwesome fa-xxx picto (with prefix, color and size set)
PositionIntoComboList=Position of line into combo lists
SellTaxRate=Sales tax rate

View File

@ -345,6 +345,7 @@ ErrorTooManyLinesToProcessPleaseUseAMoreSelectiveFilter=Too many lines to proces
ErrorEmptyValueForQty=Quantity cannot be zero.
ErrorQtyOrderedLessQtyShipped = The quantity ordered cannot be less than the quantity shipped.
ErrorVariousPaymentOnBankAccountWithADifferentCurrencyNotYetSupported=Error, creating a various payment on a bank account with a currency different than the currency of the company is not yet supported.
ErrorStreamMustBeEnabled=The PHP stream %s is not available. Check your PHP modules and Dolibarr parameter $dolibarr_main_stream_to_disable.
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.

View File

@ -818,7 +818,7 @@ class Products extends DolibarrApi
* @param int $availability Product availability
* @param string $ref_fourn Supplier ref
* @param float $tva_tx New VAT Rate (For example 8.5. Should not be a string)
* @param string|float $charges costs affering to product
* @param float $charges costs affering to product
* @param float $remise_percent Discount regarding qty (percent)
* @param float $remise Discount regarding qty (amount)
* @param int $newnpr Set NPR or not

View File

@ -342,7 +342,7 @@ class Thirdparties extends DolibarrApi
$this->company->setNoEmail($this->company->no_email);
}
if ($this->company->update($id, DolibarrApiAccess::$user, 1, '', '', 'update', 1) > 0) {
if ($this->company->update($id, DolibarrApiAccess::$user, 1, 1, 1, 'update', 1) > 0) {
return $this->get($id);
} else {
throw new RestException(500, $this->company->error);

View File

@ -94,6 +94,7 @@ if ($reshook < 0) {
$parameters = array('id'=>$socid);
// List of mass actions available
$arrayofmassactions = array();
if (!empty($permissiontodelete)) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}

View File

@ -200,7 +200,7 @@ $sql .= " GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec, g.tms";
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(DISTINCT g.rowid) as nbtotalofrecords', $sql);
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
$resql = $db->query($sqlforcount);
if ($resql) {