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

This commit is contained in:
Laurent Destailleur 2024-01-23 22:15:36 +01:00
commit cca01cbda4
20 changed files with 60 additions and 57 deletions

View File

@ -304,22 +304,15 @@ if (isset($_GET['img']))
// Definition de la langue et des textes
// Definition of language and texts
if (isset ($_GET['lang']))
{
$langue = $_GET['lang'];
}
elseif (preg_match("/^fr/", $_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
if (isset ($_GET['lang'])) {
$langue = preg_replace('/[^a-z_]/i', '', $_GET['lang']);
} elseif (preg_match("/^fr/", $_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$langue = 'fr';
}
elseif (preg_match("/^es/", $_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
} elseif (preg_match("/^es/", $_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$langue = 'es';
}
else
{
} else {
$langue = 'en';
}
@ -327,29 +320,25 @@ else
// Read PHP extensions
$loaded_extensions = get_loaded_extensions();
$phpExtContents='';
foreach ($loaded_extensions as $extension)
foreach ($loaded_extensions as $extension) {
$phpExtContents .= "<li>${extension}</li>";
}
// Read alias directory
$listoffile=array();
$aliasarray=array();
$aliasContents='';
if (is_dir($aliasDir))
{
if (is_dir($aliasDir)) {
$handle=opendir($aliasDir);
if (is_resource($handle))
{
while ($file = readdir($handle))
{
if (is_resource($handle)) {
while ($file = readdir($handle)) {
$listoffiles[]=$file;
}
}
sort($listoffiles);
foreach($listoffiles as $file)
{
foreach($listoffiles as $file) {
if (is_file($aliasDir.$file) && preg_match('/\.conf/',$file))
{
$msg = '';
@ -374,8 +363,7 @@ if (!isset($aliasContents))
// Read projects in www dir
$listoffiles=array();
$handle=opendir(".");
if (is_resource($handle))
{
if (is_resource($handle)) {
while ($file = readdir($handle))
{
$listoffiles[]=$file;
@ -383,8 +371,7 @@ if (is_resource($handle))
closedir($handle);
}
foreach($listoffiles as $file)
{
foreach($listoffiles as $file) {
if (is_dir($file) && !in_array($file,$projectsListIgnore) && !in_array($file,$aliasarray))
{
$projectContents .= '<tr><td><ul class="projects">';
@ -397,9 +384,9 @@ foreach($listoffiles as $file)
}
}
if (!isset($projectContents))
if (!isset($projectContents)) {
$projectContents = '<tr><td colspan="3">'.$langues[$langue]['txtNoProjet'].'</td></tr>';
}
$nameServer=getenv("COMPUTERNAME");

View File

@ -1545,8 +1545,14 @@ if ($action == 'create') {
if ($origin=='contact') {
$preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int');
}
// select "all" or "none" contact by default
if (getDolGlobalInt('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT')) {
$select_contact_default = 0; // select "all" contacts by default : avoid to use it if there is a lot of contacts
} else {
$select_contact_default = -1; // select "none" by default
}
print img_picto('', 'contact', 'class="paddingrightonly"');
print $form->selectcontacts(!getDolGlobalString('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT') ? GETPOST('socid', 'int') : 0, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 widthcentpercentminusxx maxwidth500', false, 0, array(), false, 'multiple', 'contactid');
print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 widthcentpercentminusxx maxwidth500', false, 0, array(), false, 'multiple', 'contactid');
print '</td></tr>';
}

View File

@ -1643,14 +1643,15 @@ if (empty($reshook)) {
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
} elseif ($action == 'update_extras') {
$object->oldcopy = dol_clone($object, 2);
$attribute_name = GETPOST('attribute', 'restricthtml');
// Fill array 'array_options' with data from update form
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
$ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name);
if ($ret < 0) {
$error++;
}
if (!$error) {
$result = $object->insertExtraFields('PROPAL_MODIFY');
$result = $object->updateExtraField($attribute_name, 'PROPAL_MODIFY');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;

View File

@ -558,6 +558,8 @@ class Account extends CommonObject
*/
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '', $amount_main_currency = null)
{
global $langs;
// Deprecation warning
if (is_numeric($oper)) {
dol_syslog(__METHOD__.": using numeric operations is deprecated", LOG_WARNING);
@ -590,11 +592,11 @@ class Account extends CommonObject
// Check parameters
if (!$oper) {
$this->error = "Operation code not defined";
$this->error = $langs->trans("OperNotDefined");
return -1;
}
if (!$this->id) {
$this->error = "this->id not defined";
$this->error = $langs->trans("ThisIdNotDefined");
return -2;
}
if ($this->courant == Account::TYPE_CASH && $oper != 'LIQ') {

View File

@ -5924,7 +5924,7 @@ if ($action == 'create') {
print dolGetButtonAction($htmltooltip, $langs->trans('Delete'), 'delete', $deleteHref, '', $enableDelete, $params);
} else {
$params['attr']['title'] = '';
print dolGetButtonAction($langs->trans('Delete'), $langs->trans('Delete'), 'delete', '#', '', false);
print dolGetButtonAction($htmltooltip, $langs->trans('Delete'), 'delete', '#', '', false);
}
}
print '</div>';

View File

@ -277,7 +277,7 @@ class Paiement extends CommonObject
// Add controls of input validity
if ($value_converted === false) {
// We failed to find the conversion for one invoice
$this->error = 'FailedToFoundTheConversionRateForInvoice';
$this->error = $langs->trans('FailedToFoundTheConversionRateForInvoice');
return -1;
}
if (empty($currencyofpayment)) {
@ -326,7 +326,7 @@ class Paiement extends CommonObject
// Check parameters
if (empty($totalamount) && empty($atleastonepaymentnotnull)) { // We accept negative amounts for withdraw reject but not empty arrays
$this->errors[] = 'TotalAmountEmpty';
$this->error = 'TotalAmountEmpty';
$this->error = $langs->trans('TotalAmountEmpty');
return -1;
}

View File

@ -405,7 +405,7 @@ if ($action == 'create') {
print '<tr><td>';
print $langs->trans('Employee');
print '</td>';
print '<td>'.img_picto('', 'user', 'class="pictofixedwidth"').$form->select_dolusers($fk_user, 'userid', 1).'</td></tr>';
print '<td>'.img_picto('', 'user', 'class="pictofixedwidth"').$form->select_dolusers('', 'userid', 1).'</td></tr>';
// Project
if (isModEnabled('project')) {

View File

@ -1824,6 +1824,7 @@ class Contact extends CommonObject
$sql .= " WHERE sc.fk_soc =".((int) $this->socid);
$sql .= " AND sc.fk_c_type_contact=tc.rowid";
$sql .= " AND tc.element = '".$this->db->escape($element)."'";
$sql .= " AND sp.entity IN (".getEntity('contact').")";
$sql .= " AND tc.active = 1";
dol_syslog(__METHOD__, LOG_DEBUG);

View File

@ -6863,6 +6863,7 @@ abstract class CommonObject
$this->array_options["options_".$key] = $new_array_options["options_".$key];
}
break;
case 'price':
case 'double':
$value = price2num($value);
if (!is_numeric($value) && $value != '') {
@ -6885,11 +6886,6 @@ abstract class CommonObject
$this->array_options["options_".$key] = $new_array_options["options_".$key];
}
break;*/
case 'price':
$new_array_options["options_".$key] = price2num($this->array_options["options_".$key]);
$this->array_options["options_".$key] = $new_array_options["options_".$key];
break;
case 'password':
$algo = '';
if ($this->array_options["options_".$key] != '' && is_array($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])) {

View File

@ -71,6 +71,7 @@ function societe_prepare_head(Societe $object)
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " WHERE p.fk_soc = ".((int) $object->id);
$sql .= " AND entity IN (".getEntity($object->element).")";
// Add where from hooks
$parameters = array('contacttab' => true);
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook

View File

@ -35,7 +35,7 @@ function showOnlineSignatureUrl($type, $ref, $obj = null)
$servicename = 'Online';
$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlineSignature", $servicename).'</span><br>';
$url = getOnlineSignatureUrl(0, $type, $ref, $obj);
$url = getOnlineSignatureUrl(0, $type, $ref, 1, $obj);
$out .= '<div class="urllink">';
if ($url == $langs->trans("FeatureOnlineSignDisabled")) {
$out .= $url;

View File

@ -6,6 +6,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -503,7 +504,7 @@ class modFacture extends DolibarrModules
's.code_compta_fournisseur'=>'SupplierAccountancyCode',
's.tva_intra'=>'VATIntra',
't.libelle'=>"ThirdPartyType", // 'ce.code'=>"Staff", "cfj.libelle"=>"JuridicalStatus",
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.fk_facture_source'=>'SourceInvoiceId',
'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total_ht'=>"TotalHT",
'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", 'f.localtax1'=>'LT1', 'f.localtax2'=>'LT2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment',
'none.rest'=>'Rest',
@ -546,7 +547,7 @@ class modFacture extends DolibarrModules
's.rowid'=>'Numeric', 's.nom'=>'Text', 'ps.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text',
't.libelle'=>"Text", // 'ce.code'=>"List:c_effectif:libelle:code", "cfj.libelle"=>"Text",
'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", 'f.fk_mode_reglement'=>'Numeric',
'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.fk_facture_source'=>'Numeric', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", 'f.fk_mode_reglement'=>'Numeric',
'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.close_code'=>'Text', 'f.close_note'=>'Text',
'none.rest'=>"NumericCompute",
'f.note_private'=>"Text", 'f.note_public'=>"Text",
@ -630,7 +631,7 @@ class modFacture extends DolibarrModules
's.phone'=>'Phone',
's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode',
's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra',
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.fk_facture_source'=>'SourceInvoiceId',
'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total_ht'=>"TotalHT",
'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", 'f.localtax1'=>'LT1', 'f.localtax2'=>'LT2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment',
'none.rest'=>'Rest',
@ -655,7 +656,7 @@ class modFacture extends DolibarrModules
$this->export_TypeFields_array[$r] = array(
's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text',
'f.rowid'=>"Numeric", 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
'f.rowid'=>"Numeric", 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.fk_facture_source'=>'Numeric', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', 'f.close_code'=>'Text', 'f.close_note'=>'Text',
'none.rest'=>'NumericCompute',
'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text',

View File

@ -197,7 +197,7 @@ class PaiementFourn extends Paiement
// Add controls of input validity
if ($value_converted === false) {
// We failed to find the conversion for one invoice
$this->error = 'FailedToFoundTheConversionRateForInvoice';
$this->error = $langs->trans('FailedToFoundTheConversionRateForInvoice');
return -1;
}
if (empty($currencyofpayment)) {

View File

@ -1150,13 +1150,13 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha')) {
}
if ($key == 'js') {
$value = $obj->value;
$valuearray = json_decode($value);
$valuearray = (array) json_decode($value); // Force cast into array because sometimes it is a stdClass
$reloffile = $valuearray[0];
$reloffile = preg_replace('/^\//', '', $valuearray[0]);
}
if ($key == 'css') {
$value = $obj->value;
$valuearray = json_decode($value);
$valuearray = (array) json_decode($value); // Force cast into array because sometimes it is a stdClass
if ($value && (!is_array($valuearray) || count($valuearray) == 0)) {
$valuearray = array();
$valuearray[0] = $value; // If value was not a json array but a string

View File

@ -354,6 +354,7 @@ HelpAbandonOther=This amount has been abandoned since it was an error (wrong cus
IdSocialContribution=Social/fiscal tax payment id
PaymentId=Payment id
PaymentRef=Payment ref.
SourceInvoiceId=Source invoice id
InvoiceId=Invoice id
InvoiceRef=Invoice ref.
InvoiceDateCreation=Invoice creation date

View File

@ -403,3 +403,8 @@ BadSetupOfFieldClassNotFoundForValidation = Error bad setup of field : Class not
BadSetupOfFieldFileNotFound = Error bad setup of field : File not found for inclusion
BadSetupOfFieldFetchNotCallable = Error bad setup of field : Fetch not callable on class
ErrorTooManyAttempts= Too many attempts, please try again later
TotalAmountEmpty=Total Amount Empty
FailedToFoundTheConversionRateForInvoice=Failed to found the conversion rate for invoice
ThisIdNotDefined=$this->id not defined
OperNotDefined=Oper not defined

View File

@ -352,6 +352,7 @@ HelpAbandonOther=Ce montant a été abandonné car il s'agissait d'une erreur de
IdSocialContribution=Id de paiement charge fiscale ou sociale
PaymentId=Id paiement
PaymentRef=Ref paiement
SourceInvoiceId=Id facture source
InvoiceId=Id facture
InvoiceRef=Réf. facture
InvoiceDateCreation=Date création facture

View File

@ -1154,7 +1154,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
print '<script type="text/javascript">';
print '$(document).ready(function () {
var canHaveCategoryIfNotCustomerProspectSupplier = ' . (!getDolGlobalString('THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ? '0' : '1') . ';
var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!getDolGlobalString('THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ? '0' : '1') . ';
init_customer_categ();
$("#customerprospect").change(function() {
@ -1162,7 +1162,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
});
function init_customer_categ() {
console.log("is customer or prospect = "+jQuery("#customerprospect").val());
if (jQuery("#customerprospect").val() == 0 && !canHaveCategoryIfNotCustomerProspectSupplier) {
if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
jQuery(".visibleifcustomer").hide();
} else {
jQuery(".visibleifcustomer").show();
@ -1979,7 +1979,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
}
});
var canHaveCategoryIfNotCustomerProspectSupplier = ' . (!getDolGlobalString('THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ? '0' : '1') . ';
var canHaveCustomerCategoryIfNotCustomerProspect = ' . (getDolGlobalInt('THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ? '1' : '0') . ';
init_customer_categ();
$("#customerprospect").change(function() {
@ -1987,7 +1987,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
});
function init_customer_categ() {
console.log("is customer or prospect = "+jQuery("#customerprospect").val());
if (jQuery("#customerprospect").val() == 0 && !canHaveCategoryIfNotCustomerProspectSupplier)
if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspect)
{
jQuery(".visibleifcustomer").hide();
}

View File

@ -3120,6 +3120,7 @@ class Societe extends CommonObject
$sql = "SELECT rowid, email, statut as status, phone_mobile, lastname, poste, firstname";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople";
$sql .= " WHERE fk_soc = ".((int) $this->id);
$sql .= " AND entity IN (".getEntity($this->element).")";
$sql .= " ORDER BY lastname, firstname";
$resql = $this->db->query($sql);

View File

@ -2023,8 +2023,8 @@ while ($i < $imaxinloop) {
// Parent company
if (!empty($arrayfields['s2.nom']['checked'])) {
print '<td class="center tdoverflowmax100">';
if ($companystatic->fk_parent > 0) {
$companyparent->fetch($companystatic->fk_parent);
if ($companystatic->parent > 0) {
$companyparent->fetch($companystatic->parent);
print $companyparent->getNomUrl(1);
}
print "</td>";