Skip to content
Merged

20.0 #22

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c396a08
fix const WORKFLOW_RECEPTION_CLASSIFY_CLOSED_INVOICE (#31601)
thomas-Ngr Oct 29, 2024
87fdd4e
FIX #28505 Blank page from thirparty to projects (#31637)
PsyCrow-code Oct 30, 2024
bb3589e
Fix #31670 (#31671)
Humml87 Nov 4, 2024
f1581e9
Update commonobject.class.php (#31667)
Jarod1980 Nov 4, 2024
c580e5f
FIX #30432 make thirdparty code_client and code_compta modifiable via…
iLLixM Nov 4, 2024
578d2fe
Fix #31677 (#31678)
Humml87 Nov 4, 2024
2e4cba0
Fix missing token
eldy Nov 4, 2024
a781211
Merge branch '20.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Nov 4, 2024
b8286ab
fix: List of UserGroup display wrong count of records( actual: nb gr…
FHenry Nov 5, 2024
56925af
Merge branch '18.0' of [email protected]:Dolibarr/dolibarr.git into 19.0
eldy Nov 5, 2024
6a01be1
Merge branch '19.0' of [email protected]:Dolibarr/dolibarr.git into 19.0
eldy Nov 5, 2024
46b80e8
Merge branch '19.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Nov 5, 2024
141755f
Add more code to help debug
eldy Nov 6, 2024
74ce8c6
Merge branch '20.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Nov 6, 2024
00b9943
Rename var to make debug easier
eldy Nov 6, 2024
b7821bd
FIX the autofix corrupted vat value must be triggered only if we are
eldy Nov 6, 2024
a9b6e69
FIX column position on PDF of payments
eldy Nov 6, 2024
43fb9db
Merge branch '19.0' of [email protected]:Dolibarr/dolibarr.git into 19.0
eldy Nov 6, 2024
ce7a364
Add option to test fix of #31696
eldy Nov 6, 2024
0819a57
Better fix for #31015
eldy Nov 6, 2024
bbf83c7
fix dol_getdate() when timestamp is an empty string (#31714)
uvaldenaire-opendsi Nov 6, 2024
bc8d443
FIX: Corrected typo preventing data from being saved (#31716)
atm-quentin Nov 6, 2024
e1b0cb6
Merge branch '18.0' of [email protected]:Dolibarr/dolibarr.git into 19.0
eldy Nov 6, 2024
bb6c4b2
Merge branch '19.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Nov 6, 2024
0ab967a
Merge branch '20.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Nov 6, 2024
434697e
FIX Search on batch code
eldy Nov 6, 2024
9374a31
Fix const INVOICE_USE_RETAINED_WARRANTY (#30533)
thomas-Ngr Nov 7, 2024
a7a18ba
Fix confusing behavior by add hidden conf MAIN_LIST_ORDER_LINK_DONT_U…
thersane-john Nov 7, 2024
1a3e9de
Fix save of error
eldy Nov 9, 2024
5bb34ab
Fix save of error
eldy Nov 9, 2024
c28cd8e
Merge branch '19.0' of [email protected]:Dolibarr/dolibarr.git into 19.0
eldy Nov 9, 2024
1b36a10
Merge branch '19.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Nov 9, 2024
83a9070
Merge branch '20.0' of [email protected]:Dolibarr/dolibarr.git into 20.0
eldy Nov 9, 2024
e17eafa
FIX select variant by attribute. (#31759)
fappels Nov 10, 2024
940324f
fix dol_time_plus_duree with unit egal mn instead i (#31746)
frederic34 Nov 10, 2024
4d29fd4
More complete fix for #31746
eldy Nov 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion htdocs/accountancy/admin/categories_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@
// Active
print '<td class="center" class="nowrap">';
if ($canbedisabled) {
print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$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
8 changes: 1 addition & 7 deletions htdocs/admin/invoice_situation.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,11 @@

$item = $formSetup->newItem('INVOICE_USE_RETAINED_WARRANTY');
$item->nameText = $langs->trans('AllowedInvoiceForRetainedWarranty');

$arrayAvailableType = array(
Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation"),
Facture::TYPE_STANDARD.'+'.Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation").' + '.$langs->trans("InvoiceStandard"),
);

if ($action == 'edit') {
$item->fieldInputOverride = $form->selectarray('INVOICE_USE_RETAINED_WARRANTY', $arrayAvailableType, $conf->global->INVOICE_USE_RETAINED_WARRANTY, 1);
} else {
$item->fieldOutputOverride= isset($arrayAvailableType[getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')]) ? $arrayAvailableType[getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')] : '';
}
$item->setAsSelect($arrayAvailableType);

//$item = $formSetup->newItem('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION')->setAsYesNo();
//$item->nameText = $langs->trans('RetainedWarrantyOnlyForSituation');
Expand Down
19 changes: 18 additions & 1 deletion htdocs/admin/limits.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,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 @@ -303,6 +303,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);
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: 4 additions & 4 deletions htdocs/admin/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
print '<script type="text/javascript">';
print ' function getStringArg(){';
print ' var pattern = "";';
print ' pattern += $("#minlenght").val() + ";";';
print ' pattern += $("#minlength").val() + ";";';
print ' pattern += $("#NbMajMin").val() + ";";';
print ' pattern += $("#NbNumMin").val() + ";";';
print ' pattern += $("#NbSpeMin").val() + ";";';
Expand All @@ -342,14 +342,14 @@
print ' }';

print ' function valuePossible(){';
print ' var fields = ["#minlenght", "#NbMajMin", "#NbNumMin", "#NbSpeMin", "#NbIteConsecutive"];';
print ' var fields = ["#minlength", "#NbMajMin", "#NbNumMin", "#NbSpeMin", "#NbIteConsecutive"];';
print ' for(var i = 0 ; i < fields.length ; i++){';
print ' if($(fields[i]).val() < $(fields[i]).attr("min")){';
print ' return false;';
print ' }';
print ' }';
print ' ';
print ' var length = parseInt($("#minlenght").val());';
print ' var length = parseInt($("#minlength").val());';
print ' var length_mini = parseInt($("#NbMajMin").val()) + parseInt($("#NbNumMin").val()) + parseInt($("#NbSpeMin").val());';
print ' return length >= length_mini;';
print ' }';
Expand All @@ -373,7 +373,7 @@
print ' }';
print ' }';

print ' $("#minlenght").change(function(){valuePatternChange();});';
print ' $("#minlength").change(function(){valuePatternChange();});';
print ' $("#NbMajMin").change(function(){valuePatternChange();});';
print ' $("#NbNumMin").change(function(){valuePatternChange();});';
print ' $("#NbSpeMin").change(function(){valuePatternChange();});';
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
2 changes: 1 addition & 1 deletion htdocs/comm/mailing/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
dol_syslog("comm/mailing/card.php: error for #".$iforemailloop.($mail->error ? ' - '.$mail->error : ''), LOG_WARNING);

$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql .= " SET statut=-1, error_text='".$db->escape($mail->error)."', date_envoi='".$db->idate($now)."' WHERE rowid=".((int) $obj->rowid);
$sql .= " SET statut=-1, error_text='".$db->escape(dol_trunc($mail->error, 250))."', date_envoi='".$db->idate($now)."' WHERE rowid=".((int) $obj->rowid);
$resql2 = $db->query($sql);
if (!$resql2) {
dol_print_error($db);
Expand Down
10 changes: 9 additions & 1 deletion htdocs/commande/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -2212,7 +2212,15 @@
// Ref
if (!empty($arrayfields['c.ref']['checked'])) {
print '<td class="nowraponall">';
print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
$getNomUrlOption = $search_status != 2 ? 0 : $obj->fk_statut;
if (getDolGlobalInt('MAIN_LIST_ORDER_LINK_DONT_USE_STATUS')) {
// TODO : This hidden conf must be added to the user's individual conf.
// The user must be able to manage this behavior to adapt it to his use of the software, because depending on the employee's workstation, his use differs.
// This hidden configuration ensures that users are not confused by keeping the same behavior of click, whatever the current filter.
// If the aim is to use a different url when the filter is applied via the link in the left-hand menu, then this detection should be adapted instead.
$getNomUrlOption = '';
}
print $generic_commande->getNomUrl(1, $getNomUrlOption, 0, 0, 0, 1, 1);

$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref);
Expand Down
12 changes: 10 additions & 2 deletions htdocs/compta/facture/class/api_invoices.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,11 @@ public function addPayment($id, $datepaye, $paymentid, $closepaidinvoices, $acco

// Creation of payment line
$paymentobj = new Paiement($this->db);
$paymentobj->datepaye = $datepaye;
if (is_numeric($datepaye)) {
$paymentobj->datepaye = $datepaye;
} else {
$paymentobj->datepaye = dol_stringtotime($datepaye);
}
$paymentobj->amounts = $amounts; // Array with all payments dispatching with invoice id
$paymentobj->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paymentobj->paiementid = $paymentid;
Expand Down Expand Up @@ -1650,7 +1654,11 @@ public function addPaymentDistributed($arrayofamounts, $datepaye, $paymentid, $c

// Creation of payment line
$paymentobj = new Paiement($this->db);
$paymentobj->datepaye = $datepaye;
if (is_numeric($datepaye)) {
$paymentobj->datepaye = $datepaye;
} else {
$paymentobj->datepaye = dol_stringtotime($datepaye);
}
$paymentobj->amounts = $amounts; // Array with all payments dispatching with invoice id
$paymentobj->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paymentobj->paiementid = $paymentid;
Expand Down
42 changes: 29 additions & 13 deletions htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3917,25 +3917,41 @@ public function update_price($exclspec = 0, $roundingadjust = 'auto', $nodatabas

if ($diff_on_current_total) {
// This should not happen, we should always have in table: total_ttc = total_ht + total_vat + total_localtax1 + total_localtax2
$sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldtva." = ".price2num((float) $tmpcal[1]).", total_ttc = ".price2num((float) $tmpcal[2])." WHERE rowid = ".((int) $obj->rowid);
dol_syslog('We found inconsistent data into detailed line (diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (ht=".$obj->total_ht." vat=".$obj->total_tva." tax1=".$obj->total_localtax1." tax2=".$obj->total_localtax2." ttc=".$obj->total_ttc."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix, LOG_WARNING);
$sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line;
$sqlfix .= " SET ".$fieldtva." = ".price2num((float) $tmpcal[1]).", total_ttc = ".price2num((float) $tmpcal[2]);
$sqlfix .= ", multicurrency_total_tva = ".price2num((float) $tmpcal[17]).", multicurrency_total_ttc = ".price2num((float) $tmpcal[18]);
$sqlfix .= " WHERE rowid = ".((int) $obj->rowid);
dol_syslog('Warn1: We found inconsistent data into detailed line (diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (ht=".$obj->total_ht." vat=".$obj->total_tva." tax1=".$obj->total_localtax1." tax2=".$obj->total_localtax2." ttc=".$obj->total_ttc."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix, LOG_WARNING);
$resqlfix = $this->db->query($sqlfix);
if (!$resqlfix) {
dol_print_error($this->db, 'Failed to update line');
}
$obj->total_tva = $tmpcal[1];
$obj->total_ttc = $tmpcal[2];
$obj->multicurrency_total_tva = $tmpcal[17];
$obj->multicurrency_total_ttc = $tmpcal[18];
} elseif ($diff_when_using_price_ht) {
// After calculation from HT, total is consistent but we have found a difference between VAT part in calculation and into database and
// we ask to force the use of rounding on line (like done on calculation) so we force update of line
$sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldtva." = ".price2num((float) $tmpcal[1]).", total_ttc = ".price2num((float) $tmpcal[2])." WHERE rowid = ".((int) $obj->rowid);
dol_syslog('We found a line with different rounding data into detailed line (diff_when_using_price_ht = '.$diff_when_using_price_ht.' and diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (total vat of line calculated=".$tmpcal[1].", database=".$obj->total_tva."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix);
$resqlfix = $this->db->query($sqlfix);
if (!$resqlfix) {
dol_print_error($this->db, 'Failed to update line');
// If total_ht calculated from unit price is different than the one in database, we do nothing, this may be a regular case to have also a different VAT, that can be explained
// because price was entered included tax and we round the unit price without tax to store it in database (so recalculation will give different results).
if ((float) $tmpcal[0] == (float) $obj->total_ht) {
// After calculation from HT, total is consistent and total_ht is same, but we have found a difference between VAT part calculated from unit price and the VAT part into database,
// and we ask to force the use of rounding on line (like done on calculation) so this should not happen, so we force the update of line to fix.

// This part of code must be called only to fix corrupted data due to the use of the feature to round total instead of rounding lines.
$sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line;
$sqlfix .= " SET ".$fieldtva." = ".price2num((float) $tmpcal[1]).", total_ttc = ".price2num((float) $tmpcal[2]);
$sqlfix .= ", multicurrency_total_tva = ".price2num((float) $tmpcal[17]).", multicurrency_total_ttc = ".price2num((float) $tmpcal[18]);
$sqlfix .= " WHERE rowid = ".((int) $obj->rowid);
dol_syslog('Warn2: We found a line with different rounding data into detailed line (diff_when_using_price_ht = '.$diff_when_using_price_ht.' and diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (total vat of line calculated=".$tmpcal[1].", database=".$obj->total_tva."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix);
$resqlfix = $this->db->query($sqlfix);
if (!$resqlfix) {
dol_print_error($this->db, 'Failed to update line');
}
$obj->total_tva = $tmpcal[1];
$obj->total_ttc = $tmpcal[2];
$obj->multicurrency_total_tva = $tmpcal[17];
$obj->multicurrency_total_ttc = $tmpcal[18];
}
$obj->total_tva = $tmpcal[1];
$obj->total_ttc = $tmpcal[2];
}
}

Expand Down Expand Up @@ -4249,8 +4265,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
4 changes: 2 additions & 2 deletions htdocs/core/lib/date.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforend
if ($duration_unit == 's') {
return $time + ($duration_value);
}
if ($duration_unit == 'i') {
if ($duration_unit == 'i' || $duration_unit == 'mn' || $duration_unit == 'min') {
return $time + (60 * $duration_value);
}
if ($duration_unit == 'h') {
Expand Down Expand Up @@ -338,7 +338,7 @@ function convertDurationtoHour($duration_value, $duration_unit)
if ($duration_unit == 's') {
$result = $duration_value / 3600;
}
if ($duration_unit == 'i') {
if ($duration_unit == 'i' || $duration_unit == 'mn' || $duration_unit == 'min') {
$result = $duration_value / 60;
}
if ($duration_unit == 'h') {
Expand Down
Loading
Loading