Skip to content

Commit

Permalink
Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 6, 2024
2 parents 37f15cf + 74ce8c6 commit 4bdd848
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 14 deletions.
2 changes: 1 addition & 1 deletion htdocs/accountancy/admin/categories_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@
// 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");
}
Expand Down
19 changes: 18 additions & 1 deletion htdocs/admin/limits.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
// 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;
Expand Down Expand Up @@ -312,6 +312,23 @@
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);

Check failure on line 323 in htdocs/admin/limits.php

View workflow job for this annotation

GitHub Actions / phpstan / php-stan (8.2)

Parameter #1 $qty of function calcul_price_total expects float, string given.
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
Expand Down
8 changes: 6 additions & 2 deletions htdocs/bom/class/api_boms.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ public function postLine($id, $request_data = null)
$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) {
Expand Down Expand Up @@ -425,7 +427,9 @@ public function putLine($id, $lineid, $request_data = null)
$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) {
Expand Down
10 changes: 8 additions & 2 deletions htdocs/comm/action/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
}

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');
Expand All @@ -377,11 +377,15 @@
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");
Expand Down Expand Up @@ -444,7 +448,9 @@
$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) {
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4311,8 +4311,8 @@ public function fetchObjectLinked($sourceid = null, $sourcetype = '', $targetid

$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))
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
7 changes: 7 additions & 0 deletions htdocs/core/modules/import/import_xlsx.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ public function __construct($db, $datatoimport)
$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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
$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) {
Expand Down
9 changes: 9 additions & 0 deletions htdocs/imports/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,15 @@
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));

Check failure on line 796 in htdocs/imports/import.php

View workflow job for this annotation

GitHub Actions / phpstan / php-stan (8.2)

Ignored error pattern #^Variable \$relativepath might not be defined\.$# in path /home/runner/work/dolibarr/dolibarr/htdocs/imports/import.php is expected to occur 1 time, but occurred 2 times.
exit;
}

if ($model == 'csv') {
'@phan-var-force ImportCsv $obj';
$obj->separator = $separator_used;
Expand Down
3 changes: 3 additions & 0 deletions htdocs/install/mysql/migration/17.0.0-18.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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';
1 change: 1 addition & 0 deletions htdocs/langs/en_US/admin.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/errors.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/class/api_products.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ public function getCustomerPricesPerQuantity($id)
* @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
Expand Down
2 changes: 1 addition & 1 deletion htdocs/societe/class/api_thirdparties.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public function put($id, $request_data = null)
$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);
Expand Down
1 change: 1 addition & 0 deletions htdocs/societe/project.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
$parameters = array('id'=>$socid);

// List of mass actions available
$arrayofmassactions = array();
if (!empty($permissiontodelete)) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/user/group/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
$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) {
Expand Down

0 comments on commit 4bdd848

Please sign in to comment.