From 9bf090b263b697d02f253fb6e8a02a1ca8fe549c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 17 Jan 2025 01:52:19 +0100 Subject: [PATCH 01/22] Debug v21 --- htdocs/website/samples/wrapper.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index 0823b551efe..f7127a3d815 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -266,6 +266,11 @@ if ($rss) { exit; } + // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension + if (image_format_supported($fullpath_original_file) && !dol_is_file($fullpath_original_file)) { + $fullpath_original_file = getImageFileNameForSize($fullpath_original_file, '', '.png'); + } + clearstatcache(); $filename = basename($fullpath_original_file); From 5dd02bd09f9393f8aea53e23f066f220fd4ef7a6 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 17 Jan 2025 12:20:55 +0100 Subject: [PATCH 02/22] Fix link --- htdocs/admin/dict.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 360488a2410..320d8ca9e82 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -598,7 +598,7 @@ $tabcond[DICT_ASSET_DISPOSAL_TYPE] = isModEnabled('asset'); // List of help for fields (no more used, help is defined into tabcomplete) $tabhelp = array(); -// Table to store complete information (will replace all other table). Key is table name. +// Table to store complete information (will replace all other tables). Key is table name. $tabcomplete = array( 'c_forme_juridique' => array( 'picto' => 'company', @@ -2679,7 +2679,11 @@ if ($id > 0) { print ''; if (!empty($tabcond[$i])) { $tabnamenoprefix = preg_replace('/'.MAIN_DB_PREFIX.'/', '', $tabname[$i]); - print ''; + print ''; if (!empty($tabcomplete[$tabnamenoprefix]['picto'])) { print img_picto('', $tabcomplete[$tabnamenoprefix]['picto'], 'class="pictofixedwidth paddingrightonly"'); } From 7433b5e7d7b3c38bb6525337000e4fb9943c87b6 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 17 Jan 2025 12:55:47 +0100 Subject: [PATCH 03/22] Trans --- htdocs/langs/en_US/compta.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index ba68fd31f41..0e88b2ab2f5 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -88,7 +88,7 @@ PaymentCustomerInvoice=Customer invoice payment PaymentSupplierInvoice=vendor invoice payment PaymentSocialContribution=Social/fiscal tax payment PaymentVat=VAT payment -AutomaticCreationPayment=Automatically record the payment +AutomaticCreationPayment=Also record the payment ListPayment=List of payments ListOfCustomerPayments=List of customer payments ListOfSupplierPayments=List of vendor payments From 737e216c5f654c343fe1bfc228cf209cc123557b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 17 Jan 2025 13:05:37 +0100 Subject: [PATCH 04/22] Debug v21 - use a better error message --- htdocs/accountancy/journal/bankjournal.php | 6 ++++-- htdocs/langs/en_US/accountancy.lang | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index a108c040353..ccada3d1f81 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1326,7 +1326,7 @@ if (empty($action) || $action == 'view') { $reflabel .= isset($val['soclib']) ? $val['soclib'] : ""; } - print ''; + print ''; print ''; // Date @@ -1405,9 +1405,11 @@ if (empty($action) || $action == 'view') { if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') { //print ''.$langs->trans("ThirdpartyAccountNotDefined").''; if (!empty($tabcompany[$key]['code_compta'])) { - if (in_array($tabtype[$key], array('payment_various', 'payment_salary'))) { + if (in_array($tabtype[$key], array('payment_various'))) { // For such case, if subledger is not defined, we won't use subledger accounts. $accounttoshowsubledger = ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").''; + } elseif (in_array($tabtype[$key], array('payment_salary'))) { + $accounttoshowsubledger = ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored2").''; } else { $accounttoshowsubledger = ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index c4e8cfb2e9f..d0984b30ca3 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -262,6 +262,7 @@ UnknownAccountForThirdparty=Unknown third-party account. We will use %s UnknownAccountForThirdpartyBlocking=Unknown third-party account. Blocking error ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Subledger account not defined or third party or user unknown. We will use %s ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored=Third-party unknown and subledger not defined on the payment. We will keep the subledger account value empty. +ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored2=Subledger account not defined or third party or user unknown. We will keep the subledger account value empty. ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Subledger account not defined or third party or user unknown. Blocking error. UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error PaymentsNotLinkedToProduct=Payment not linked to any product / service From 3ce842eab08f2e2616c98e257190dd152fd10cbc Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 17 Jan 2025 13:16:13 +0100 Subject: [PATCH 05/22] Debug v21 - CSS --- htdocs/accountancy/journal/bankjournal.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index ccada3d1f81..c778c17bfc3 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1277,7 +1277,7 @@ if (empty($action) || $action == 'view') { print "".$date.""; // Ref - print "".dol_escape_htmltag($ref).""; + print ''.dol_escape_htmltag($ref).""; // Ledger account $accounttoshow = length_accountg($k); @@ -1299,7 +1299,7 @@ if (empty($action) || $action == 'view') { print ""; // Label operation - print ''; + print ''; print $reflabel; // This is already html escaped content print ""; @@ -1332,8 +1332,8 @@ if (empty($action) || $action == 'view') { // Date print "".$date.""; - // Ref - print "".dol_escape_htmltag($ref).""; + // Ref / Piece + print ''.dol_escape_htmltag($ref).""; // Ledger account @@ -1421,11 +1421,14 @@ if (empty($action) || $action == 'view') { $accounttoshowsubledger = ''; } } - print ''; + print ''; print $accounttoshowsubledger; // This is a html string print ""; - print "".$reflabel.""; + // Label operation + print ''; + print $reflabel; // This is a html string + print ""; print ''.$val["type_payment"].""; From 1f017863950c77069abb735abaea4e203def6158 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 17 Jan 2025 13:37:30 +0100 Subject: [PATCH 06/22] Debug v21 --- htdocs/accountancy/journal/bankjournal.php | 36 ++++++++++------------ 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index c778c17bfc3..bf257a9facf 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -446,9 +446,9 @@ if ($result) { // If we fill it here to, we must concat. if ($userstatic->id > 0) { if ($is_sc) { - $tabpay[$obj->rowid]["soclib"] .= ' '.$userstatic->getNomUrl(1, 'accountancy', 0); + $tabpay[$obj->rowid]["soclib"] .= ' '.$userstatic->getNomUrl(-1, 'accountancy', 0); } else { - $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0); + $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(-1, 'accountancy', 0); } } else { $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment. @@ -600,7 +600,7 @@ if ($result) { } } elseif ($links[$key]['type'] == 'banktransfert') { $accountLinestatic->fetch($links[$key]['url_id']); - $tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1); + $tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").' '.$accountLinestatic ->getNomUrl(1); $tabtp[$obj->rowid][$account_transfer] = isset($tabtp[$obj->rowid][$account_transfer]) ? $tabtp[$obj->rowid][$account_transfer] + $amounttouse : $amounttouse; $bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']); $tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2); @@ -699,11 +699,11 @@ if (!$error && $action == 'writebookkeeping' && $user->hasRight('accounting', 'b $reflabel = ''; if (!empty($val['lib'])) { - $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + $reflabel .= dol_string_nohtmltag($val['lib'])." / "; } $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']); if (!empty($val['soclib'])) { - $reflabel .= " - ".dol_string_nohtmltag($val['soclib']); + $reflabel .= " / ".dol_string_nohtmltag($val['soclib']); } $bookkeeping = new BookKeeping($db); @@ -760,7 +760,7 @@ if (!$error && $action == 'writebookkeeping' && $user->hasRight('accounting', 'b $reflabel = ''; if (!empty($val['lib'])) { - $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : ""); + $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " / " : ""); } if ($tabtype[$key] == 'banktransfert') { $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); @@ -889,7 +889,7 @@ if (!$error && $action == 'writebookkeeping' && $user->hasRight('accounting', 'b if ($mt) { $reflabel = ''; if (!empty($val['lib'])) { - $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + $reflabel .= dol_string_nohtmltag($val['lib'])." / "; } $reflabel .= dol_string_nohtmltag('WaitingAccount'); @@ -1010,11 +1010,11 @@ if ($action == 'exportcsv' && $user->hasRight('accounting', 'bind', 'write')) { if ($mt) { $reflabel = ''; if (!empty($val['lib'])) { - $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + $reflabel .= dol_string_nohtmltag($val['lib'])." / "; } $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']); if (!empty($val['soclib'])) { - $reflabel .= " - ".dol_string_nohtmltag($val['soclib']); + $reflabel .= " / ".dol_string_nohtmltag($val['soclib']); } print '"'.$key.'"'.$sep; @@ -1037,7 +1037,7 @@ if ($action == 'exportcsv' && $user->hasRight('accounting', 'bind', 'write')) { if ($mt) { $reflabel = ''; if (!empty($val['lib'])) { - $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : ""); + $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " / " : ""); } if ($tabtype[$key] == 'banktransfert') { $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); @@ -1076,7 +1076,7 @@ if ($action == 'exportcsv' && $user->hasRight('accounting', 'bind', 'write')) { if ($mt) { $reflabel = ''; if (!empty($val['lib'])) { - $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + $reflabel .= dol_string_nohtmltag($val['lib'])." / "; } $reflabel .= dol_string_nohtmltag('WaitingAccount'); @@ -1250,8 +1250,6 @@ if (empty($action) || $action == 'view') { print ''.$langs->trans("AccountingCredit").""; print "\n"; - $r = ''; - foreach ($tabpay as $key => $val) { // $key is rowid in llx_bank $date = dol_print_date($val["date"], 'day'); @@ -1262,15 +1260,15 @@ if (empty($action) || $action == 'view') { if ($mt) { $reflabel = ''; if (!empty($val['lib'])) { - $reflabel .= $val['lib']." - "; + $reflabel .= $val['lib']." / "; } $reflabel .= $langs->trans("Bank").' '.$val['bank_account_ref']; if (!empty($val['soclib'])) { - $reflabel .= " - ".$val['soclib']; + $reflabel .= " / ".$val['soclib']; } //var_dump($tabpay[$key]); - print ''; + print ''; print ''; // Date @@ -1318,7 +1316,7 @@ if (empty($action) || $action == 'view') { if ($mt) { $reflabel = ''; if (!empty($val['lib'])) { - $reflabel .= $val['lib'].(isset($val['soclib']) ? " - " : ""); + $reflabel .= $val['lib'].(isset($val['soclib']) ? " / " : ""); } if ($tabtype[$key] == 'banktransfert') { $reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer; @@ -1326,7 +1324,7 @@ if (empty($action) || $action == 'view') { $reflabel .= isset($val['soclib']) ? $val['soclib'] : ""; } - print ''; + print ''; print ''; // Date @@ -1446,7 +1444,7 @@ if (empty($action) || $action == 'view') { if ($mt) { $reflabel = ''; if (!empty($val['lib'])) { - $reflabel .= $val['lib']." - "; + $reflabel .= $val['lib']." / "; } $reflabel .= 'WaitingAccount'; From ef9105cc44baeeea527440091ad7a8e5a48188be Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 17 Jan 2025 14:08:39 +0100 Subject: [PATCH 07/22] Debug v21 --- htdocs/accountancy/journal/bankjournal.php | 17 +++++++++++++---- htdocs/compta/sociales/card.php | 12 ++++++------ .../sociales/class/chargesociales.class.php | 5 +++-- htdocs/langs/en_US/admin.lang | 1 - htdocs/langs/en_US/main.lang | 1 + 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index bf257a9facf..b133e0399e4 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -476,13 +476,10 @@ if ($result) { $chargestatic->label = $links[$key]['label']; } $chargestatic->ref = $chargestatic->label; - //$chargestatic->fetch($chargestatic->id); - - $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); - $tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id; // Retrieve the accounting code of the social contribution of the payment from link of payment. // Note: We have the social contribution id, it can be faster to get accounting code from social contribution id. + /* $sqlmid = "SELECT cchgsoc.accountancy_code"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc"; $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type = cchgsoc.id"; @@ -495,7 +492,19 @@ if ($result) { if ($resultmid) { $objmid = $db->fetch_object($resultmid); $tabtp[$obj->rowid][$objmid->accountancy_code] = isset($tabtp[$obj->rowid][$objmid->accountancy_code]) ? $tabtp[$obj->rowid][$objmid->accountancy_code] + $amounttouse : $amounttouse; + }*/ + $tmpcharge = new ChargeSociales($db); + $resultmid = $tmpcharge->fetch($chargestatic->id); + if ($resultmid) { + $chargestatic->type_label = $tmpcharge->type_label; + $chargestatic->type_code = $tmpcharge->type_code; + $chargestatic->type_accountancy_code = $tmpcharge->type_accountancy_code; + + $tabtp[$obj->rowid][$tmpcharge->type_accountancy_code] = isset($tabtp[$obj->rowid][$tmpcharge->type_accountancy_code]) ? $tabtp[$obj->rowid][$tmpcharge->type_accountancy_code] + $amounttouse : $amounttouse; } + + $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); + $tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id; } elseif ($links[$key]['type'] == 'payment_donation') { $paymentdonstatic->id = $links[$key]['url_id']; $paymentdonstatic->ref = (string) $links[$key]['url_id']; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index d33cb0e1be6..123f3c0bf4b 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -37,13 +37,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; if (isModEnabled('project')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } -if (isModEnabled('accounting')) { - include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; -} /** * @var Conf $conf @@ -351,13 +350,11 @@ if (isModEnabled('project')) { $formproject = new FormProjets($db); } -$now = dol_now(); - $title = $langs->trans("SocialContribution").' - '.$langs->trans("Card"); $help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module_Taxes_et_charges_spéciales|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)'; llxHeader("", $title, $help_url); -$reseapayer = 0; +$resteapayer = 0; // Form to create a social contribution @@ -603,6 +600,9 @@ if ($id > 0) { $formsocialcontrib->select_type_socialcontrib($actionPostValue ? $actionPostValue : $object->type, 'actioncode', 1); } else { print $object->type_label; + if (isModEnabled("accounting")) { + print '   ('.$langs->trans("AccountancyCode").': '.(empty($object->type_accountancy_code) ? $langs->trans("Unknown") : length_accountg($object->type_accountancy_code)).')'; + } } print ""; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index f6ca5ff79dc..97ac741e52e 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -679,8 +679,9 @@ class ChargeSociales extends CommonObject } if (!empty($this->type_label)) { $label .= '
'.$langs->trans('Type').': '.$this->type_label; - if (!empty($this->type_accountancy_code)) { - $label .= ' ('.$langs->trans('AccountancyCode').': '.$this->type_accountancy_code.')'; + if (isModEnabled('accounting') || !empty($this->type_accountancy_code)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + $label .= ' ('.$langs->trans('AccountancyCode').': '.(empty($this->type_accountancy_code) ? $langs->trans("Unknown") : length_accountg($this->type_accountancy_code)).')'; } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 421291cc7ed..7859c0eec2f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1872,7 +1872,6 @@ Buy=Buy Sell=Sell InvoiceDateUsed=Invoice date used YourCompanyDoesNotUseVAT=Your company has been defined to not use VAT (Home - Setup - Company/Organization), so there is no VAT options to setup. -AccountancyCode=Accounting Code AccountancyCodeSell=Sale account. code AccountancyCodeBuy=Purchase account. code CREATE_NEW_VAT_WITHOUT_AUTO_PAYMENT=Keep the checkbox “Automatically create the payment” empty by default when creating a new tax diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index d01964bc47c..a76687104cb 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -891,6 +891,7 @@ OriginFileName=Original filename SetDemandReason=Set source SetBankAccount=Define Bank Account AccountCurrency=Account currency +AccountancyCode=Accounting Code ViewPrivateNote=View notes XMoreLines=%s line(s) hidden ShowMoreLines=Show more/less lines From 654aa24e8cbc22b5a7607f8cb4d057420ff707b7 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 17 Jan 2025 14:21:55 +0100 Subject: [PATCH 08/22] Debug v21 --- htdocs/core/actions_massactions.inc.php | 2 +- htdocs/societe/website.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 82a25fd2678..266bae09fc0 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -107,7 +107,7 @@ if (!empty($permtodelete) && empty($permissiontodelete)) { } // Mass actions. Controls on number of lines checked. -$maxformassaction = (!getDolGlobalString('MAIN_LIMIT_FOR_MASS_ACTIONS') ? 1000 : $conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS); +$maxformassaction = getDolGlobalInt('MAIN_LIMIT_FOR_MASS_ACTIONS', 1000); if ($massaction && is_array($toselect) && count($toselect) < 1) { $error++; setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 77f9f92a4dc..4ed8e18f7d6 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -133,6 +133,10 @@ if ($id > 0) { $result = $object->fetch($id); } +if (!($object->id > 0) && $action == 'view') { + recordNotFound(); +} + // Security check $id = GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('socid'); if ($user->socid) { @@ -186,7 +190,8 @@ if (empty($reshook)) { // Mass actions $objectclass = 'WebsiteAccount'; $objectlabel = 'WebsiteAccount'; - $uploaddir = $conf->societe->multidir_output[$object->entity]; + $uploaddir = empty($conf->societe->multidir_output[$object->entity]) ? $conf->societe->dir_output : $conf->societe->multidir_output[$object->entity]; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -196,8 +201,6 @@ if (empty($reshook)) { * View */ -$contactstatic = new Contact($db); - $form = new Form($db); $langs->load("companies"); From cd4e5c8998fdab65399c25f6d470cd11173e13da Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 17 Jan 2025 15:24:21 +0100 Subject: [PATCH 09/22] Debug v21 --- htdocs/societe/class/societe.class.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a1a3b9306bb..13dd05eff14 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1510,11 +1510,11 @@ class Societe extends CommonObject $this->capital = ($this->capital != '') ? (float) price2num(trim((string) $this->capital)) : null; - $this->effectif_id = (int) trim((string) $this->effectif_id); - $this->forme_juridique_code = (int) trim((string) $this->forme_juridique_code); + $this->effectif_id = (int) $this->effectif_id; + $this->forme_juridique_code = (int) $this->forme_juridique_code; //Gencod - $this->barcode = trim($this->barcode); + $this->barcode = trim((string) $this->barcode); // For automatic creation if ($this->code_client == -1 || $this->code_client === 'auto') { @@ -1524,10 +1524,10 @@ class Societe extends CommonObject $this->get_codefournisseur($this, 1); } - $this->accountancy_code_customer_general = trim($this->accountancy_code_customer_general); - $this->code_compta_client = trim($this->code_compta_client); - $this->accountancy_code_supplier_general = trim($this->accountancy_code_supplier_general); - $this->code_compta_fournisseur = trim($this->code_compta_fournisseur); + $this->accountancy_code_customer_general = trim((string) $this->accountancy_code_customer_general); + $this->code_compta_client = trim((string) $this->code_compta_client); + $this->accountancy_code_supplier_general = trim((string) $this->accountancy_code_supplier_general); + $this->code_compta_fournisseur = trim((string) $this->code_compta_fournisseur); // Check parameters. More tests are done later in the ->verify() if (!is_numeric($this->client) && !is_numeric($this->fournisseur)) { @@ -1563,15 +1563,15 @@ class Societe extends CommonObject } //Web services - $this->webservices_url = $this->webservices_url ? clean_url($this->webservices_url, 0) : ''; - $this->webservices_key = trim($this->webservices_key); + $this->webservices_url = empty($this->webservices_url) ? '' : clean_url($this->webservices_url, 0); + $this->webservices_key = trim((string) $this->webservices_key); $this->accountancy_code_buy = (empty($this->accountancy_code_buy) ? '' : trim($this->accountancy_code_buy)); $this->accountancy_code_sell = (empty($this->accountancy_code_sell) ? '' : trim($this->accountancy_code_sell)); //Incoterms $this->fk_incoterms = (int) $this->fk_incoterms; - $this->location_incoterms = trim($this->location_incoterms); + $this->location_incoterms = trim((string) $this->location_incoterms); $this->db->begin(); From 3598855e748430266c138086f2d76b139128658a Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 17 Jan 2025 16:18:56 +0100 Subject: [PATCH 10/22] Debug v21 - type of public note --- htdocs/install/mysql/migration/20.0.0-21.0.0.sql | 5 +++++ htdocs/install/mysql/tables/llx_product.sql | 4 ++-- htdocs/install/mysql/tables/llx_product_lang.sql | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 189922844e2..cb821e230ae 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -61,6 +61,11 @@ ALTER TABLE llx_asset_model ADD COLUMN ref_ext varchar(255) AFTER ref; -- V21 migration +ALTER TABLE llx_product MODIFY COLUMN note_public mediumtext; +ALTER TABLE llx_product MODIFY COLUMN note mediumtext; +ALTER TABLE llx_product_lang MODIFY COLUMN note mediumtext; + + CREATE TABLE llx_categorie_fichinter ( fk_categorie integer NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index afb612aacdb..f75a4f4ef3f 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -36,8 +36,8 @@ create table llx_product label varchar(255) NOT NULL, description text, - note_public text, - note text, + note_public mediumtext, + note mediumtext, customcode varchar(32), -- Customs|Commodity|HS|TARIC code see https://github.com/Dolibarr/dolibarr/issues/31679 fk_country integer DEFAULT NULL, -- Optional id of original country fk_state integer DEFAULT NULL, -- Optional id of original state/province diff --git a/htdocs/install/mysql/tables/llx_product_lang.sql b/htdocs/install/mysql/tables/llx_product_lang.sql index de21c8049af..c0eff4c6f3b 100644 --- a/htdocs/install/mysql/tables/llx_product_lang.sql +++ b/htdocs/install/mysql/tables/llx_product_lang.sql @@ -25,6 +25,6 @@ create table llx_product_lang lang varchar(5) DEFAULT 0 NOT NULL, label varchar(255) NOT NULL, description text, - note text, + note mediumtext, import_key varchar(14) DEFAULT NULL )ENGINE=innodb; From de67a70325101a0da3ba77c81ba94994f99a7e69 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 17 Jan 2025 17:09:47 +0100 Subject: [PATCH 11/22] Debug v21 --- htdocs/core/class/doleditor.class.php | 52 +++++++++++++-------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 31297131479..9a5e139d361 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -26,7 +26,7 @@ /** * Class to manage a WYSIWYG editor. - * Usage: $doleditor=new DolEditor('body',$message,320,'toolbar_mailing'); + * Usage: $doleditor = new DolEditor('body', $message, 320, 'toolbar_mailing'); * $doleditor->Create(); */ class DolEditor @@ -188,23 +188,31 @@ class DolEditor * Output edit area inside the HTML stream. * Output depends on this->tool (fckeditor, ckeditor, textarea, ...) * - * @param int $noprint 1=Return HTML string instead of printing it to output - * @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });". Used by CKEditor only. - * @param boolean $disallowAnyContent Disallow to use any content. true=restrict to a predefined list of allowed elements. Used by CKEditor only. - * @param string $titlecontent Show title content before editor area. Used by ACE editor only. - * @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', 'json', ...) - * @param string $moreparam Add extra tags to the textarea - * @param string $morecss Add extra css to the textarea + * @param int $noprint 1=Return HTML string instead of printing it to output + * @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });". Used by CKEditor only. + * @param boolean|string $restrictContent Decide which content is allowed. Used by CKEditor only. + * true = restrict allowed content to a predefined list of allowed elements. + * false = allow anything + * string = true + add values into string + * @param string $titlecontent Show title content before editor area. Used by ACE editor only. + * @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', 'json', ...) + * @param string $moreparam Add extra tags to the textarea + * @param string $morecss Add extra css to the textarea * @return void|string */ - public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '', $moreparam = '', $morecss = '') + public function Create($noprint = 0, $morejs = '', $restrictContent = true, $titlecontent = '', $option = '', $moreparam = '', $morecss = '') { // phpcs:enable global $conf, $langs; $fullpage = false; + + $extraAllowedContent = 'a[target];section[contenteditable,id];div{float,display}'; + if (is_string($restrictContent)) { + $extraAllowedContent = $restrictContent; + } if (isset($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT)) { - $disallowAnyContent = !getDolGlobalString('FCKEDITOR_ALLOW_ANY_CONTENT'); // Only predefined list of html tags are allowed or all + $restrictContent = !getDolGlobalString('FCKEDITOR_ALLOW_ANY_CONTENT'); // Only predefined list of html tags are allowed or all } $found = 0; @@ -214,9 +222,7 @@ class DolEditor if (in_array($this->tool, array('textarea', 'ckeditor'))) { $found = 1; - //$out.= '