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

This commit is contained in:
Laurent Destailleur 2024-10-24 20:13:12 +02:00
commit 8bae2d99d8
15 changed files with 88 additions and 25 deletions

View File

@ -338,6 +338,30 @@ if ($action == 'install' && $allowonlineinstall) {
}
}
/*
if (!$error) {
if (GETPOST('checkforcompliance')) {
$dir = $dirins;
$file = $modulenameval;
// $installedmodule
try {
$res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error.
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName) {
if (class_exists($modName)) {
$objMod = new $modName($db);
'@phan-var-force DolibarrModules $objMod';
//var_dump($objMod);
}
}
} catch(Exception $e) {
// Nothing done
}
}
}
*/
if (!$error) {
$searchParams = array(
'search_keyword' => $modulenameval,
@ -1417,7 +1441,7 @@ if ($mode == 'deploy') {
$(document).ready(function() {
jQuery("#fileinstall").on("change", function() {
if(this.files[0].size > '.($maxmin * 1024).') {
alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
alert("'.dol_escape_js($langs->transnoentitiesnoconv("ErrorFileSizeTooLarge")).'");
this.value = "";
}
});

View File

@ -156,7 +156,6 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/comm/propal/list.php';
@ -1721,7 +1720,20 @@ if (empty($reshook)) {
$result = $object->set_demand_reason($user, GETPOSTINT('demand_reason_id'));
} elseif ($action == 'setconditions' && $usercancreate) {
// Terms of payment
$result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), GETPOSTINT('cond_reglement_id_deposit_percent'));
$sql = "SELECT code ";
$sql .= "FROM " . $db->prefix() . "c_payment_term";
$sql .= " WHERE rowid = " . ((int) GETPOST('cond_reglement_id', 'int'));
$result = $db->query($sql);
if ($result) {
$obj = $db->fetch_object($result);
if ($obj->code == 'DEP30PCTDEL') {
$result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), GETPOSTFLOAT('cond_reglement_id_deposit_percent'));
} else {
$object->deposit_percent = 0;
$object->update($user);
$result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), $object->deposit_percent);
}
}
//} elseif ($action == 'setremisepercent' && $usercancreate) {
// $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2));
//} elseif ($action == 'setremiseabsolue' && $usercancreate) {

View File

@ -3,7 +3,7 @@
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
@ -948,7 +948,7 @@ if ($action == 'create') {
// Ref
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : $object->ref).'"></td></tr>';
print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : $object->ref).'" maxlength="12" autofocus></td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';

View File

@ -2209,11 +2209,10 @@ class FormFile
if ($nboflinks > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
}
foreach ($links as $link) {
print '<tr class="oddeven">';
//edit mode
if ($action == 'update' && $selected === $link->id && $permissiontoedit) {
if ($action == 'update' && $selected === (int) $link->id && $permissiontoedit) {
print '<td>';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="linkid" value="'.$link->id.'">';

View File

@ -254,7 +254,7 @@ class Link extends CommonObject
if ($num > 0) {
while ($obj = $this->db->fetch_object($resql)) {
$link = new Link($this->db);
$link->id = $obj->rowid;
$link->id = (int) $obj->rowid;
$link->entity = $obj->entity;
$link->datea = $this->db->jdate($obj->datea);
$link->url = $obj->url;

View File

@ -813,18 +813,25 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
$watermark_x = $w / 2;
$watermark_y = $h / 3;
$pdf->SetFont('', 'B', 40);
$pdf->SetTextColor(255, 192, 203);
$pdf->SetTextColor(255, 0, 0);
//rotate
$pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm', cos($watermark_angle), sin($watermark_angle), -sin($watermark_angle), cos($watermark_angle), $watermark_x * $k, ($h - $watermark_y) * $k, -$watermark_x * $k, -($h - $watermark_y) * $k));
//print watermark
$pdf->SetAlpha(0.5);
$pdf->SetXY($watermark_x_pos, $watermark_y_pos);
// set alpha to semi-transparency
$pdf->SetAlpha(0.3);
$pdf->Cell($w - 20, 25, $outputlangs->convToOutputCharset($text), "", 2, "C", 0);
//antirotate
$pdf->_out('Q');
$pdf->SetXY($savx, $savy);
// Restore alpha
$pdf->SetAlpha(1);
}
@ -2508,7 +2515,15 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
'@phan-var-force array<Commande|CommandeFournisseur> $objects';
$outputlangs->load('orders');
if (count($objects) == 1) {
if (count($objects) > 1 && count($objects) <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) {
if (empty($object->context['DolPublicNoteAppendedGetLinkedObjects'])) { // Check if already appended before add to avoid repeat data
$object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' :');
foreach ($objects as $elementobject) {
$object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ? '' : ' ('.$elementobject->ref_client.')').(empty($elementobject->ref_supplier) ? '' : ' ('.$elementobject->ref_supplier.')').' ');
$object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs));
}
}
} elseif (count($objects) == 1) {
$elementobject = array_shift($objects);
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref).(!empty($elementobject->ref_client) ? ' ('.$elementobject->ref_client.')' : '').(!empty($elementobject->ref_supplier) ? ' ('.$elementobject->ref_supplier.')' : '');
@ -2568,7 +2583,9 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
}
}
$object->note_public = dol_concatdesc($object->note_public, $refListsTxt);
if (empty($object->context['DolPublicNoteAppendedGetLinkedObjects'])) { // Check if already appended before add to avoid repeat data
$object->note_public = dol_concatdesc($object->note_public, $refListsTxt);
}
} elseif (count($objects) == 1) {
$elementobject = array_shift($objects);
$order = null;
@ -2606,6 +2623,8 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
}
}
$object->context['DolPublicNoteAppendedGetLinkedObjects'] = 1;
// For add external linked objects
if (is_object($hookmanager)) {
$parameters = array('linkedobjects' => $linkedobjects, 'outputlangs' => $outputlangs);

View File

@ -158,7 +158,8 @@ class modSalaries extends DolibarrModules
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_user = u.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'salary as s ON s.fk_user = u.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_salary = s.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id';
$this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('user').')';
}

View File

@ -1589,7 +1589,7 @@ if ($action == 'create') {
if ($origin == "commande") {
$cond_reglement_id = 0;
$mode_reglement_id = 0;
$delivery_date = '';
$datelivraison = '';
$objectsrc->note_private = '';
$objectsrc->note_public = '';
if ($societe = $object->thirdparty) {
@ -1613,9 +1613,9 @@ if ($action == 'create') {
$demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0));
//$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_supplier_percent) ? $soc->remise_supplier_percent : 0));
//$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
$dateinvoice = !getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : '';
$dateinvoice = getDolGlobalString('MAIN_AUTOFILL_DATE') ? '' : -1;
$datedelivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '');
$datelivraison = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '');
if (isModEnabled("multicurrency")) {
if (!empty($objectsrc->multicurrency_code)) {
@ -1748,7 +1748,9 @@ if ($action == 'create') {
$usehourmin = 1;
}
print img_picto('', 'action', 'class="pictofixedwidth"');
print $form->selectDate($datelivraison ? $datelivraison : -1, 'liv_', $usehourmin, $usehourmin, 0, "set");
print '</td></tr>';
// Bank Account

View File

@ -6,7 +6,7 @@
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
* Copyright (C) 2017-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023-2024 Nick Fragoulis
@ -28,7 +28,7 @@
/**
* \file htdocs/fourn/facture/card-rec.php
* \ingroup invoice fournisseurs
* \ingroup supplier invoice
* \brief Page to show predefined invoice
*/
@ -480,7 +480,7 @@ if (empty($reshook)) {
}
if ($qty < 0) {
$langs->load("errors");
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
setEventMessages($langs->trans('ErrorQtyForSupplierInvoiceCantBeNegative'), null, 'errors');
$error++;
}
@ -821,7 +821,7 @@ if (empty($reshook)) {
}
if ($qty < 0) {
$langs->load("errors");
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
setEventMessages($langs->trans('ErrorQtyForSupplierInvoiceCantBeNegative'), null, 'errors');
$error++;
}
@ -933,7 +933,7 @@ if ($action == 'create') {
print '</td></tr>';
// Third party
print '<tr><td class="titlefieldcreate">' . $langs->trans("Customer") . '</td><td>' . $object->thirdparty->getNomUrl(1, 'customer') . '</td>';
print '<tr><td class="titlefieldcreate">' . $langs->trans("Supplier") . '</td><td>' . $object->thirdparty->getNomUrl(1, 'supplier') . '</td>';
print '</tr>';
// Invoice subtype
@ -946,7 +946,7 @@ if ($action == 'create') {
$note_public = GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : $object->note_public;
$note_private = GETPOSTISSET('note_private') ? GETPOST('note_private', 'restricthtml') : $object->note_private;
// Help of substitution key
// Help for substitution key
$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);
$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m') . ')';

View File

@ -313,7 +313,7 @@ drop table tmp_societe_double;
-- Sequence to removed duplicated values of llx_accounting_account. Run several times if you still have duplicate.
drop table tmp_accounting_account_double;
--select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2;
create table tmp_accounting_account_double as (select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2);
create table tmp_accounting_account_double as (select account_number, fk_pcg_version, entity, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version, entity having count(rowid) >= 2);
--select * from tmp_accounting_account_double;
delete from llx_accounting_account where (rowid) in (select max_rowid from tmp_accounting_account_double); --update to avoid duplicate, delete to delete
drop table tmp_accounting_account_double;

View File

@ -142,6 +142,7 @@ ErrorFieldCantBeNegativeOnInvoice=Field <strong>%s</strong> cannot be negative o
ErrorLinesCantBeNegativeForOneVATRate=Total of lines (net of tax) can't be negative for a given not null VAT rate (Found a negative total for VAT rate <b>%s</b>%%).
ErrorLinesCantBeNegativeOnDeposits=Lines can't be negative in a deposit. You will face problems when you will need to consume the deposit in final invoice if you do so.
ErrorQtyForCustomerInvoiceCantBeNegative=Quantity for line into customer invoices can't be negative
ErrorQtyForSupplierInvoiceCantBeNegative=Quantity for line into supplier invoices can't be negative
ErrorWebServerUserHasNotPermission=User account <b>%s</b> used to execute web server has no permission for that
ErrorNoActivatedBarcode=No barcode type activated
ErrUnzipFails=Failed to unzip %s with ZipArchive

View File

@ -1986,7 +1986,7 @@ while ($i < $imaxinloop) {
foreach ($arraypricelevel as $key => $value) {
if (!empty($arrayfields['p.sellprice'.$key]['checked'])) {
print '<td class="right nowraponall">';
if (!empty($productpricescache[$obj->rowid])) {
if (!empty($productpricescache[$obj->rowid]) && isset($productpricescache[$obj->rowid][$key]['price_base_type'])) {
if ($productpricescache[$obj->rowid][$key]['price_base_type'] == 'TTC') {
print '<span class="amount">'.price($productpricescache[$obj->rowid][$key]['price_ttc']).' '.$langs->trans("TTC").'</span>';
} else {

View File

@ -1144,6 +1144,11 @@ class Reception extends CommonObject
$mouvS->origin = null;
$result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0) {
$error++;
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
}
}
} else {
$error++;

View File

@ -2165,7 +2165,7 @@ class Societe extends CommonObject
$this->model_pdf = $obj->model_pdf;
$this->last_main_doc = $obj->last_main_doc;
$result = 1;
$result = $this->id;
// fetch optionals attributes and labels
$this->fetch_optionals();

View File

@ -1709,7 +1709,7 @@ if ($action == 'create') {
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryDate');
print '</td>';
if ($action != 'editdate_livraison' && $object->statut == SupplierProposal::STATUS_VALIDATED) {
if ($action != 'editdate_livraison' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1).'</a></td>';
}
print '</tr></table>';