From ddf3431b81078a32b04319984e3771e7a4e2c998 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Sat, 30 Nov 2024 13:31:53 +0100 Subject: [PATCH 01/23] Allow various format of dates on API paiement https://github.com/Dolibarr/dolibarr/issues/32111 --- htdocs/compta/facture/class/api_invoices.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index b4867e8168a..d0735ce1c87 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1463,7 +1463,7 @@ class Invoices extends DolibarrApi * Add payment line to a specific invoice with the remain to pay as amount. * * @param int $id Id of invoice - * @param string $datepaye {@from body} Payment date {@type timestamp} + * @param string $datepaye {@from body} Payment date * @param int $paymentid {@from body} Payment mode Id {@min 1} * @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no} * @param int $accountid {@from body} Account Id {@min 1} @@ -1584,7 +1584,7 @@ class Invoices extends DolibarrApi * Example of value for parameter arrayofamounts: {"1": {"amount": "99.99", "multicurrency_amount": ""}, "2": {"amount": "", "multicurrency_amount": "10"}} * * @param array $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice - * @param string $datepaye {@from body} Payment date {@type timestamp} + * @param string $datepaye {@from body} Payment date * @param int $paymentid {@from body} Payment mode Id {@min 1} * @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no} * @param int $accountid {@from body} Account Id {@min 1} From fa6b0c1a83cf817f00ceb97de1903378e49e9435 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 2 Dec 2024 16:16:11 +0100 Subject: [PATCH 02/23] Debug v21 --- htdocs/core/js/lib_notification.js.php | 43 ++++++++++++++------------ 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 1d9242ff0d0..650c016b9d1 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -71,34 +71,39 @@ print "jQuery(document).ready(function () {\n"; //print " console.log('referrer=".dol_escape_js($_SERVER['HTTP_REFERER'])."');\n"; -print ' var nowtime = Date.now();'; -print ' var time_auto_update = '.max(1, getDolGlobalInt('MAIN_BROWSER_NOTIFICATION_FREQUENCY')).';'."\n"; // Always defined -print ' var time_js_next_test;'."\n"; -print ' var dolnotif_nb_test_for_page = 0;'."\n"; -print ' var dolnotif_idinterval = null;'."\n"; +print 'var nowtime = Date.now();'."\n"; +print 'var time_auto_update = '.max(1, getDolGlobalInt('MAIN_BROWSER_NOTIFICATION_FREQUENCY')).';'."\n"; // Always defined +print 'var time_js_next_test;'."\n"; +print 'var dolnotif_nb_test_for_page = 0;'."\n"; +print 'var dolnotif_idinterval = null;'."\n"; ?> -/* Check if Notification is supported */ -if ("Notification" in window) { - /* Check if permission ok */ - if (Notification.permission !== "granted") { - console.log("Ask Notification.permission"); - Notification.requestPermission(function(result) { - console.log("result for Notification.requestPermission is "+result); - }); +var methodfornotification = ''; + +/* For old method notification system, check if Notification is supported */ +if (methodfornotification == "jsnotification") { + if ("Notification" in window) { + /* Check if permission ok */ + if (Notification.permission !== "granted") { + console.log("Ask Notification.permission"); + Notification.requestPermission(function(result) { + console.log("result for Notification.requestPermission is "+result); + }); + } + } else { + console.log("This browser in this context does not support Notification."); } +} - /* Launch timer */ - +/* Launch timer for notifications */ +if (methodfornotification == "jnotify" || (methodfornotification == "jsnotification" && "Notification" in window)) { // We set a delay before launching first test so next check will arrive after the time_auto_update compared to previous one. //var time_first_execution = (time_auto_update + (time_js_next_test - nowtime)) * 1000; //need milliseconds var time_first_execution = ; - setTimeout(first_execution, time_first_execution * 1000); // Launch a first execution after a time_first_execution delay + setTimeout(first_execution, time_first_execution * 1000); // Launch the function first_execution() after a time_first_execution delay time_js_next_test = nowtime + time_first_execution; console.log("Launch browser notif check: setTimeout is set to launch 'first_execution' function after a wait of time_first_execution="+time_first_execution+". nowtime (time php page generation) = "+nowtime+" time_js_next_check = "+time_js_next_test); -} else { - console.log("This browser in this context does not support Notification."); } /* The method called after time_first_execution on each page */ @@ -111,7 +116,7 @@ function first_execution() { } } -/* the method call frequently every time_auto_update */ +/* The method call frequently every time_auto_update */ function check_events() { var result = 0; dolnotif_nb_test_for_page += 1; From 6eb2fe4689a8fe0c0592c3efe1ed37ff28f91e24 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 3 Dec 2024 10:31:41 +0100 Subject: [PATCH 03/23] Fix trans --- htdocs/comm/mailing/index.php | 8 +++---- htdocs/langs/en_US/admin.lang | 16 +++++++------- htdocs/langs/en_US/companies.lang | 2 +- htdocs/langs/en_US/mails.lang | 36 +++++++++++++++---------------- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 5151e5223d9..225ba2eb748 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -83,11 +83,11 @@ print ''; print '
'; print ''; print ''; -print ''; print ''; -print ''; +print ''; print "
'.$titlesearch.'
'; +print '
'; print $langs->trans("Ref").':
'; -print $langs->trans("Other").':
'; +print $langs->trans("Other").':

\n"; @@ -189,7 +189,7 @@ if ($result) { print ' | '.$langs->trans("Phone"); } print ''; - print ''.$langs->trans("AllEMailings").''; + print '...'; print ''; $num = $db->num_rows($result); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 210e2dfe7fd..90e30555733 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -568,8 +568,8 @@ Module10Name=Accounting (simplified) Module10Desc=Simple accounting reports (journals, turnover) based on database content. Does not use any ledger table. Module20Name=Proposals Module20Desc=Commercial proposal management -Module22Name=Mass Emailings -Module22Desc=Manage bulk emailing +Module22Name=Mass Emails +Module22Desc=Manage mass/bulk email campaign Module23Name=Energy Module23Desc=Monitoring the consumption of energies Module25Name=Sales Orders @@ -848,10 +848,10 @@ Permission212=Order lines Permission213=Activate line Permission214=Setup Telephony Permission215=Setup providers -Permission221=Read emailings -Permission222=Create/modify emailings (topic, recipients...) -Permission223=Validate emailings (allows sending) -Permission229=Delete emailings +Permission221=Read mass emails +Permission222=Create/modify mass emails (topic, recipients...) +Permission223=Validate mass emails (allows sending) +Permission229=Delete mass emails Permission237=View recipients and info Permission238=Manually send mailings Permission239=Delete mailings after validation or sent @@ -1818,9 +1818,9 @@ FCKeditorForNotePrivate=WYSIWYG creation/modification of the field "private note FCKeditorForCompany=WYSIWYG creation/modification of the field description of elements (except products/services) FCKeditorForProductDetails=WYSIWYG creation/modification of products description or lines for objects (lines of proposals, orders, invoices, etc...). FCKeditorForProductDetails2=Warning: Using this option for this case is seriously not recommended as it can create problems with special characters and page formatting when building PDF files. -FCKeditorForMailing= WYSIWYG creation/modification for mass eMailings (Tools->eMailing) +FCKeditorForMailing= WYSIWYG creation/modification for mass eMails (Tools->Mass eMails) FCKeditorForUserSignature=WYSIWYG creation/modification of user signature -FCKeditorForMail=WYSIWYG creation/modification for all mail (except Tools->eMailing) +FCKeditorForMail=WYSIWYG creation/modification for all mail (except Tools->Mass eMails) FCKeditorForTicket=WYSIWYG creation/modification for tickets ##### Stock ##### StockSetup=Stock module setup diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 9cd0ebf20c9..ad0813153e1 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -79,7 +79,7 @@ Chat=Chat PhonePro=Bus. phone PhonePerso=Pers. phone PhoneMobile=Mobile -No_Email=Refuse bulk emailings +No_Email=Refuse mass emails Fax=Fax Zip=Zip Code Town=City diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 9ace4fc3d3c..c2a7d07b030 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -1,9 +1,9 @@ # Dolibarr language file - Source file is en_US - mails Mailing=EMailing EMailing=EMailing -EMailings=EMailings +EMailings=Mass EMails SMSings=SMSings -AllEMailings=All eMailings +AllEMailings=All mass eMails MailCard=EMailing card MailRecipients=Recipients MailRecipient=Recipient @@ -26,19 +26,19 @@ MailFile=Attached files MailMessage=Email body SubjectNotIn=Not in Subject BodyNotIn=Not in Body -ShowEMailing=Show emailing -ListOfEMailings=List of emailings -NewMailing=New emailing +ShowEMailing=Show mass Email +ListOfEMailings=List of mass Email +NewMailing=New mass Email NewSMSing=New smsing -EditMailing=Edit emailing -ResetMailing=Resend emailing +EditMailing=Edit mass Email +ResetMailing=Resend mass Email ConfirmResetMailingTargetMassaction=Confirmation of the reset of targets statusin error ResetMailingTargetMassaction=Reset status in error -DeleteMailing=Delete emailing -PreviewMailing=Preview emailing -CreateMailing=Create emailing +DeleteMailing=Delete mass Email +PreviewMailing=Preview mass Email +CreateMailing=Create mass Email TestMailing=Test -ValidMailing=Valid emailing +ValidMailing=Valid mass Email MailingStatusDraft=Draft MailingStatusValidated=Validated MailingStatusSent=Sent @@ -108,24 +108,24 @@ EmailCollectorFilterDesc=All filters must match to have an email being collected LineInFile=Line %s in file RecipientSelectionModules=Defined requests for recipient's selection MailSelectedRecipients=Selected recipients -MailingArea=EMailings area -LastMailings=Latest %s emailings +MailingArea=Mass Emails +LastMailings=Latest %s mass emails TargetsStatistics=Targets statistics NbOfCompaniesContacts=Unique contacts/addresses MailNoChangePossible=Recipients for validated emailing can't be changed -SearchAMailing=Search mailing -SendMailing=Send emailing +SearchAMailing=Search a mass Email +SendMailing=Send mass Email SentBy=Sent by AdvancedAlternative=Advanced alternative MailingNeedCommand=Sending an emailing can be performed from command line. Ask your server administrator to launch the following command to send the emailing to all recipients: MailingNeedCommand2=You can however send them online by adding parameter MAILING_LIMIT_SENDBYWEB with value of max number of emails you want to send by session. For this, go on Home - Setup - Other. ConfirmSendingEmailing=If you want to send emailing directly from this screen, please confirm you are sure you want to send emailing now from your browser ? -LimitSendingEmailing=Note: Sending of emailings from web interface is done in several times for security and timeout reasons, %s recipients at a time for each sending session. +LimitSendingEmailing=Note: Sending of a mass email from web interface is done in several times for security and timeout reasons, %s recipients at a time for each sending session. TargetsReset=Clear list ToClearAllRecipientsClickHere=Click here to clear the recipient list for this emailing ToAddRecipientsChooseHere=Add recipients by choosing from the lists -NbOfEMailingsReceived=Mass emailings received -NbOfEMailingsSend=Mass emailings sent +NbOfEMailingsReceived=Mass emails received +NbOfEMailingsSend=Mass emails sent IdRecord=ID record DeliveryReceipt=Delivery Ack. YouCanUseCommaSeparatorForSeveralRecipients=You can use the comma separator to specify several recipients. From 203a8e7c6a6bc6aa84f0a5729d60930ba05690aa Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 3 Dec 2024 10:58:52 +0100 Subject: [PATCH 04/23] Debug v21 --- htdocs/product/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c96e53a6279..b3311f24be7 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1750,7 +1750,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $doleditor->Create(); print ""; - //} if (isModEnabled('category')) { // Categories @@ -1773,6 +1772,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''.$langs->trans("VATRate").''; $defaultva = get_default_tva($mysoc, $mysoc); print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); + print ajax_combobox("tva_tx"); print ''; print ''; @@ -1785,6 +1785,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''.$langs->trans("SellingPrice").''; print ''; print $form->selectPriceBaseType(getDolGlobalString('PRODUCT_PRICE_BASE_TYPE'), "price_base_type"); + print ajax_combobox("select_price_base_type"); print ''; // Min price @@ -1796,6 +1797,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''.$langs->trans("VATRate").''; $defaultva = get_default_tva($mysoc, $mysoc); print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); + print ajax_combobox("tva_tx"); print ''; print ''; From 077407018201bffe49232e6a305a306f2e545e85 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 3 Dec 2024 11:18:35 +0100 Subject: [PATCH 05/23] Debug v21 --- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/langs/en_US/website.lang | 2 +- htdocs/langs/fr_FR/website.lang | 2 +- htdocs/product/card.php | 4 ++-- htdocs/website/index.php | 28 ++++++++++++++--------- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index a5aae13bf76..52d4519caea 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -265,7 +265,7 @@ class FormFile } if (getDolGlobalString('MAIN_UPLOAD_DOC')) { - if ($perm) { + if ($perm && empty($conf->dol_optimize_smallscreen)) { $langs->load('other'); $menudolibarrsetupmax = $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Security"); diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 1dd88cc04d6..fc793f5cf2a 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -12,7 +12,7 @@ WEBSITE_ALIASALTDesc=Use here list of other name/aliases so the page can also be WEBSITE_CSS_URL=URL of external CSS file WEBSITE_CSS_INLINE=CSS file content (common to all pages) WEBSITE_JS_INLINE=JavaScript file content (common to all pages) -WEBSITE_HTML_HEADER=Addition at bottom of HTML Header (common to all pages) +WEBSITE_HTML_HEADER=HTML Header (common to all pages) WEBSITE_ROBOT=Robot file (robots.txt) WEBSITE_HTACCESS=Website .htaccess file WEBSITE_MANIFEST_JSON=Website manifest.json file diff --git a/htdocs/langs/fr_FR/website.lang b/htdocs/langs/fr_FR/website.lang index e59490448bb..d41460f4028 100644 --- a/htdocs/langs/fr_FR/website.lang +++ b/htdocs/langs/fr_FR/website.lang @@ -12,7 +12,7 @@ WEBSITE_ALIASALTDesc=Utilisez ici la liste des autres noms / alias afin que la p WEBSITE_CSS_URL=URL du fichier de la feuille de style (CSS) externe WEBSITE_CSS_INLINE=Contenu du fichier CSS (commun à toute les pages) WEBSITE_JS_INLINE=Contenu du fichier JavaScript (commun à toutes les pages) -WEBSITE_HTML_HEADER=Ajout en bas de l'en-tête HTML (commun à toutes les pages) +WEBSITE_HTML_HEADER=En-tête HTML (commun à toutes les pages) WEBSITE_ROBOT=Fichier robot (robots.txt) WEBSITE_HTACCESS=Fichier .htaccess du site web WEBSITE_MANIFEST_JSON=Fichier manifest.json de site Web diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b3311f24be7..38976910f29 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1619,7 +1619,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if ($type == 1) { print ''.$langs->trans("Duration").''; print img_picto('', 'clock', 'class="pictofixedwidth"'); - print ''; + print ''; print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_unit') ? GETPOST('duration_unit', 'alpha') : 'h'), 0, 1); // Mandatory period @@ -2246,7 +2246,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if ($object->isService()) { // Duration print ''.$langs->trans("Duration").''; - print ' '; + print ' '; print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1); // Mandatory period diff --git a/htdocs/website/index.php b/htdocs/website/index.php index aff05a8bd9c..905d4ed6c2a 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1772,13 +1772,17 @@ if ($action == 'updatecss' && $usercanedit) { $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages if (!$errorphpcheck) { - $htaccesscontent = ''; - $htaccesscontent .= $dataposted."\n"; + if ($dataposted) { + $htaccesscontent = ''; + $htaccesscontent .= $dataposted."\n"; - $result = dolSaveHtaccessFile($filehtaccess, $htaccesscontent); - if (!$result) { - $error++; - setEventMessages('Failed to write file '.$filehtaccess, null, 'errors'); + $result = dolSaveHtaccessFile($filehtaccess, $htaccesscontent); + if (!$result) { + $error++; + setEventMessages('Failed to write file '.$filehtaccess, null, 'errors'); + } + } else { + dol_delete_file($filehtaccess, 0, 0); } } else { $error++; @@ -3868,10 +3872,6 @@ if ($action == 'editcss') { } else { $htaccesscontent = GETPOST('WEBSITE_HTACCESS', 'nohtml'); // We must use 'nohtml' and not 'alphanohtml' because we must accept " } - if (!trim($htaccesscontent)) { - $htaccesscontent .= "# Order allow,deny\n"; - $htaccesscontent .= "# Deny from all\n"; - } if (!GETPOSTISSET('WEBSITE_MANIFEST_JSON')) { $manifestjsoncontent = @file_get_contents($filemanifestjson); @@ -4034,7 +4034,13 @@ if ($action == 'editcss') { // .htaccess print ''; - print $langs->trans('WEBSITE_HTACCESS'); + + $textwithhelp3 = $langs->trans("Example"); + $textwithhelp3 .= "
# Order allow,deny\n"; + $textwithhelp3 .= "
# Deny from all\n"; + $textwithhelp3 .= "
# Require all granted\n"; + + print $form->textwithpicto($langs->trans('WEBSITE_HTACCESS'), $textwithhelp3, 1, 'help', '', 0, 2, 'htmlheadertooltip3'); print ''; $poscursor = array('x' => GETPOST('WEBSITE_HTACCESS_x'), 'y' => GETPOST('WEBSITE_HTACCESS_y')); From 2572bc156e0a2696f1031e081a7ad615cbdaeda9 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 3 Dec 2024 11:55:43 +0100 Subject: [PATCH 06/23] Debug v21 --- htdocs/theme/eldy/global.inc.php | 4 +++- htdocs/theme/md/style.css.php | 5 +++++ htdocs/website/index.php | 19 ++++++++++++++----- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 44bfdd42f15..af9fd02c678 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6011,7 +6011,7 @@ span[phptag] { border: none; font-weight: normal; } -.websitebar .button.bordertransp { +.websitebar .button.bordertransp, .websitebar .fa-plus-circle.btnTitle-icon { color: unset; text-decoration: unset !important; margin: 0px 4px 0px 4px !important @@ -7401,9 +7401,11 @@ span#select2-boxbookmark-container { } span.select2-dropdown--below { margin-top: -1px; + min-width: 100px; } span.select2-dropdown--above { margin-bottom: -1px; + min-width: 100px; } .parentonrightofpage { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index c6fdf1969a1..2de3f335e82 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5966,7 +5966,12 @@ span[phptag] { .websitebar .button.bordertransp { color: unset; text-decoration: unset !important; + border: unset !important; /* margin: 0px 4px 0px 4px !important */ + box-shadow: none; +} +.websitebar .fa-plus-circle.btnTitle-icon { + margin: 0px 4px 0px 4px !important; } .websitebar { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 905d4ed6c2a..81dcb2f1dab 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3071,7 +3071,10 @@ if (!GETPOST('hide_websitemenu')) { if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite')) { // Edit website properties - print '
'.dol_escape_htmltag($langs->trans("EditCss")).''; + print ''; + print img_picto('', 'setup'); + print ''.dol_escape_htmltag($langs->trans("EditCss")).''; + print ''; // Import web site $importlabel = $langs->trans("ImportSite"); @@ -3435,10 +3438,16 @@ if (!GETPOST('hide_websitemenu')) { print ''; // Edit web page properties - print ''.dol_escape_htmltag($langs->trans("EditPageMeta")).''; + print ''; + print img_picto('', 'setup'); + print ''.dol_escape_htmltag($langs->trans("EditPageMeta")).''; + print ''; // Edit HTML content - print ''.dol_escape_htmltag($langs->trans($conf->dol_optimize_smallscreen ? "HTML" : "EditHTMLSource")).''; + print ''; + print img_picto('', 'code'); + print ''.dol_escape_htmltag($langs->trans($conf->dol_optimize_smallscreen ? "HTML" : "EditHTMLSource")).''; + print ''; // Edit CKEditor if (getDolGlobalInt('WEBSITE_ALLOW_CKEDITOR')) { @@ -3946,7 +3955,7 @@ if ($action == 'editcss') { print $form->textwithpicto($langs->trans('OtherLanguages'), $htmltext, 1, 'help', '', 0, 2); print ''; print img_picto('', 'language', 'class="picotfixedwidth"'); - print ''; + print ''; print ''; print ''; @@ -4035,7 +4044,7 @@ if ($action == 'editcss') { // .htaccess print ''; - $textwithhelp3 = $langs->trans("Example"); + $textwithhelp3 = $langs->trans("Example").' :'; $textwithhelp3 .= "
# Order allow,deny\n"; $textwithhelp3 .= "
# Deny from all\n"; $textwithhelp3 .= "
# Require all granted\n"; From 69d6f5b60c2b8d3fa283d1f08e6a8a8c28fd2655 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 3 Dec 2024 12:12:22 +0100 Subject: [PATCH 07/23] Clean position of field --- htdocs/install/mysql/tables/llx_user.sql | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 66d3acc0db3..41b87eb8b30 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -35,19 +35,20 @@ create table llx_user tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, -- user who created dataset fk_user_modif integer, -- user who modified dataset + login varchar(50) NOT NULL, pass_encoding varchar(24), pass varchar(128), pass_crypted varchar(128), - pass_temp varchar(128), -- temporary password when asked for forget password or 'hashtoallowreset:YYYMMDDHHMMSS' (where date is max date of validity) - api_key varchar(128), -- key to use REST API by this user + pass_temp varchar(128), -- temporary password when asked for forget password or 'hashtoallowreset:YYYMMDDHHMMSS' (where date is max date of validity) + api_key varchar(128), -- key to use REST API by this user gender varchar(10), civility varchar(6), lastname varchar(50), firstname varchar(50), - address varchar(255), -- user personal address - zip varchar(25), -- zipcode - town varchar(50), -- town + address varchar(255), -- user personal address + zip varchar(25), -- zipcode + town varchar(50), -- town fk_state integer DEFAULT 0, fk_country integer DEFAULT 0, birth date, -- birthday @@ -74,6 +75,7 @@ create table llx_user fk_user_expense_validator integer NULL, fk_user_holiday_validator integer NULL, + national_registration_number varchar(50), idpers1 varchar(128), idpers2 varchar(128), idpers3 varchar(128), @@ -90,10 +92,11 @@ create table llx_user flagdelsessionsbefore datetime DEFAULT NULL, -- set this to a date if we need to launch an external process to invalidate all sessions for the same login created before this date iplastlogin varchar(250), ippreviouslogin varchar(250), - --egroupware_id integer, ldap_sid varchar(255) DEFAULT NULL, openid varchar(255), + statut tinyint DEFAULT 1, + photo varchar(255), -- filename or url of photo lang varchar(6), -- default language for communication. Note that language selected by user as interface language is savec into llx_user_param. color varchar(6), @@ -114,8 +117,9 @@ create table llx_user weeklyhours double(16,8), -- DENORMALIZED FIELD. Value coming from llx_user_employment import_key varchar(14), -- import key + default_range integer, default_c_exp_tax_cat integer, - national_registration_number varchar(50), + fk_warehouse integer -- default warehouse of user )ENGINE=innodb; From 5323368e92e6b6d26c0d88d8b3e0b812c1ea31a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 3 Dec 2024 18:14:34 +0100 Subject: [PATCH 08/23] fix phpstan --- build/phpstan/phpstan-baseline.neon | 36 ----------------------------- htdocs/fourn/commande/index.php | 9 +++++++- 2 files changed, 8 insertions(+), 37 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 3999e4d96da..121bb4c5ca8 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -20946,42 +20946,6 @@ parameters: count: 1 path: ../../htdocs/fourn/commande/document.php - - - message: '#^Variable \$badgeStatus0 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/fourn/commande/index.php - - - - message: '#^Variable \$badgeStatus1 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/fourn/commande/index.php - - - - message: '#^Variable \$badgeStatus4 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/fourn/commande/index.php - - - - message: '#^Variable \$badgeStatus6 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/fourn/commande/index.php - - - - message: '#^Variable \$badgeStatus9 might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/fourn/commande/index.php - - - - message: '#^Variable \$socid might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/fourn/commande/index.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 74c608bfd06..43c87192533 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -52,6 +52,7 @@ $max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5); // Security check $orderid = GETPOST('orderid'); +$socid = GETPOSTINT('socid'); if ($user->socid) { $socid = $user->socid; } @@ -116,7 +117,13 @@ if ($resql) { $db->free($resql); include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; - + /** + * @var string $badgeStatus0 + * @var string $badgeStatus1 + * @var string $badgeStatus4 + * @var string $badgeStatus6 + * @var string $badgeStatus9 + */ print '
'; print ''; print ''; From c9dc2952ca25af8839374d759342ff3fb480a605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 3 Dec 2024 18:26:24 +0100 Subject: [PATCH 09/23] fix phpstan --- .../modules/supplier_order/modules_commandefournisseur.php | 5 +++-- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/commande/contact.php | 2 +- htdocs/fourn/commande/dispatch.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/fourn/commande/index.php | 2 +- htdocs/fourn/commande/info.php | 2 +- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/commande/note.php | 2 +- 9 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index 9a2b8aca0b0..01b04b0a338 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -6,7 +6,8 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2011-2016 Philippe Grand * Copyright (C) 2014 Marcos García - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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 @@ -25,7 +26,7 @@ /** * \file htdocs/core/modules/supplier_order/modules_commandefournisseur.php - * \ingroup order fournisseur + * \ingroup supplier order * \brief File that contains parent class for supplier orders models * and parent class for supplier orders numbering models */ diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 376ca90db2b..d4fff20a846 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -32,7 +32,7 @@ /** * \file htdocs/fourn/commande/card.php - * \ingroup supplier, order + * \ingroup supplier order * \brief Card supplier order */ diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 03efd74eaaa..67b436e308e 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -22,7 +22,7 @@ /** * \file htdocs/fourn/commande/contact.php - * \ingroup order + * \ingroup supplier order * \brief Onglet de gestion des contacts de commande */ diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 485470da945..d61d72ea72b 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -27,7 +27,7 @@ /** * \file htdocs/fourn/commande/dispatch.php - * \ingroup commande + * \ingroup supplier order * \brief Page to dispatch receiving */ diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index e5f3a3f8ebe..5c43e0ba3d8 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -24,7 +24,7 @@ /** * \file htdocs/fourn/commande/document.php - * \ingroup supplier + * \ingroup supplier order * \brief Management page of attached documents to a supplier order */ diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 43c87192533..25f6d7e4f90 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -22,7 +22,7 @@ /** * \file htdocs/fourn/commande/index.php - * \ingroup order fournisseur + * \ingroup supplier order * \brief Home page of supplier's orders area */ diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index e55e2c9a1da..477b4b11f95 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -21,7 +21,7 @@ /** * \file htdocs/fourn/commande/info.php - * \ingroup order + * \ingroup supplier order * \brief Info page for Purchase Order / Supplier Order */ diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 44e6630c970..051e09d453d 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -29,7 +29,7 @@ /** * \file htdocs/fourn/commande/list.php - * \ingroup fournisseur + * \ingroup supplier order * \brief List of purchase orders */ diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 22cf2d2f02e..967a875cd60 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -22,7 +22,7 @@ /** * \file htdocs/fourn/commande/note.php - * \ingroup order + * \ingroup supplier order * \brief page for notes on supplier orders */ From efcf6c6b247995861bf4dd33af64615c1b50e24e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 3 Dec 2024 20:34:47 +0100 Subject: [PATCH 10/23] fix pre-commit and CI (#32213) * fix pre-commit * fix phpstan * clean code --- .github/workflows/pr-18.yaml | 5 ++++- htdocs/expensereport/class/expensereport.class.php | 13 ++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 2682e99df38..b8b18169b58 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install GitHub CLI run: | @@ -36,7 +36,10 @@ jobs: #REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer run: | + # shellcheck disable=2086 echo "GH_TOKEN=$GH_TOKEN" + # shellcheck disable=2086 pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) + # shellcheck disable=2086 gh pr edit $pr_number --add-reviewer "$REVIEWER" continue-on-error: true diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 5f7ef6df827..01827248462 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -616,8 +616,6 @@ class ExpenseReport extends CommonObject */ public function update($user, $notrigger = 0, $userofexpensereport = null) { - global $langs; - $error = 0; $this->db->begin(); @@ -644,24 +642,21 @@ class ExpenseReport extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('EXPENSE_REPORT_MODIFY', $user); - if ($result < 0) { $error++; } // End call triggers } - if (empty($error)) { + if (!$error) { $this->db->commit(); return 1; } else { From 1a4c9736b706ab5d8a2240cce5c0362a60cc542c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 3 Dec 2024 21:17:10 +0100 Subject: [PATCH 11/23] fix phpstan --- build/phpstan/phpstan-baseline.neon | 42 ----------------------------- htdocs/core/lib/functions.lib.php | 6 +++-- htdocs/holiday/card.php | 22 +++++++-------- 3 files changed, 15 insertions(+), 55 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 3999e4d96da..865aabe7cb4 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -21582,48 +21582,6 @@ parameters: count: 1 path: ../../htdocs/ftp/index.php - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 2 - path: ../../htdocs/holiday/card.php - - - - message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 8 - path: ../../htdocs/holiday/card.php - - - - message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 8 - path: ../../htdocs/holiday/card.php - - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 8 - path: ../../htdocs/holiday/card.php - - - - message: '#^Variable \$canread might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/holiday/card.php - - - - message: '#^Variable \$endhalfdaykey might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/holiday/card.php - - - - message: '#^Variable \$starthalfdaykey might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/holiday/card.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9c411ea7caf..d70f3f1e187 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1148,8 +1148,10 @@ function GETPOSTFLOAT($paramname, $rounding = '') * @param string $hourTime 'getpost' to include hour, minute, second values from the HTTP request, * or 'XX:YY:ZZ' to set hour, minute, second respectively (for instance '23:59:59') * or '' means '00:00:00' (default) - * @param string $gm Passed to dol_mktime + * @param int|string $gm Passed to dol_mktime * @return int|string Date as a timestamp, '' or false if error + * + * @see dol_mktime() */ function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto') { @@ -3647,7 +3649,7 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '') * @param int $month Month (1 to 12) * @param int $day Day (1 to 31) * @param int $year Year - * @param mixed $gm True or 1 or 'gmt'=Input information are GMT values + * @param int|string $gm True or 1 or 'gmt'=Input information are GMT values * False or 0 or 'tzserver' = local to server TZ * 'auto' * 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented. diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 95bb39f7f3f..8a19e1a3a5e 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -169,10 +169,10 @@ if (empty($reshook)) { $db->begin(); - $date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); - $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); - $date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1); - $date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1); + $date_debut = GETPOSTDATE('date_debut_', '00:00:00'); + $date_fin = GETPOSTDATE('date_fin_', '00:00:00'); + $date_debut_gmt = GETPOSTDATE('date_debut_', '00:00:00', 1); + $date_fin_gmt = GETPOSTDATE('date_fin_', '00:00:00', 1); $starthalfday = GETPOST('starthalfday'); $endhalfday = GETPOST('endhalfday'); $type = GETPOST('type'); @@ -325,10 +325,10 @@ if (empty($reshook)) { } if ($action == 'update' && !GETPOSTISSET('savevalidator')) { // Test on permission done later - $date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); - $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); - $date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1); - $date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1); + $date_debut = GETPOSTDATE('date_debut_', '00:00:00'); + $date_fin = GETPOSTDATE('date_fin_', '00:00:00'); + $date_debut_gmt = GETPOSTDATE('date_debut_', '00:00:00', 1); + $date_fin_gmt = GETPOSTDATE('date_fin_', '00:00:00', 1); $starthalfday = GETPOST('starthalfday'); $endhalfday = GETPOST('endhalfday'); $halfday = 0; @@ -1154,7 +1154,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { if (!GETPOST('date_debut_')) { // If visitor does not come from agenda print $form->selectDate(-1, 'date_debut_', 0, 0, 0, '', 1, 1); } else { - $tmpdate = dol_mktime(0, 0, 0, GETPOSTINT('date_debut_month'), GETPOSTINT('date_debut_day'), GETPOSTINT('date_debut_year')); + $tmpdate = GETPOSTDATE('date_debut_', '00:00:00'); print $form->selectDate($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1); } print '     '; @@ -1171,7 +1171,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { if (!GETPOST('date_fin_')) { print $form->selectDate(-1, 'date_fin_', 0, 0, 0, '', 1, 1); } else { - $tmpdate = dol_mktime(0, 0, 0, GETPOSTINT('date_fin_month'), GETPOSTINT('date_fin_day'), GETPOSTINT('date_fin_year')); + $tmpdate = GETPOSTDATE('date_fin_', '00:00:00'); print $form->selectDate($tmpdate, 'date_fin_', 0, 0, 0, '', 1, 1); } print '     '; @@ -1349,7 +1349,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print $form->textwithpicto($langs->trans('DateDebCP'), $langs->trans("FirstDayOfHoliday")); print ''; print ''; - print ''; + + // Manufacturing cost + print ''; + + // Find sell price of generated product. We suppose we sell it to a company like ours (same country...). + $object->fetch_product(); + $manufacturedvalued = ''; + if (!empty($object->product)) { + $tmparray = $object->product->getSellPrice($mysoc, $mysoc); + $manufacturedvalued = $tmparray['pu_ht'] * $object->qty; + } + print ''; // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; @@ -658,7 +661,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Services $filtertype = 1; - $res = $object->fetchLinesbytypeproduct(1); // Load all lines services into ->lines + $res = $object->fetchLinesbytypeproduct($filtertype); // Load all lines services into ->lines $object->calculateCosts(); print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service'); diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index 9292c9b2621..b29e53743a3 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -188,8 +188,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - print ''; - print ''; + // Manufacturing cost + print ''; + + // Find sell price of generated product. We suppose we sell it to a company like ours (same country...). + $object->fetch_product(); + $manufacturedvalued = ''; + if (!empty($object->product)) { + $tmparray = $object->product->getSellPrice($mysoc, $mysoc); + $manufacturedvalued = $tmparray['pu_ht'] * $object->qty; + } + print ''; // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index fe3d40c3f32..59df1d5e60a 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1409,7 +1409,7 @@ class BOM extends CommonObject */ public function calculateCosts() { - global $conf, $hookmanager; + global $hookmanager; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $this->unit_cost = 0; diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 4ab671306ff..b96eaafb67b 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -161,7 +161,7 @@ foreach ($object->fields as $key => $val) { $value = $object->$key; $rightpart .= ' 0) $rightpart .= ' fieldrequired'; // No fieldrequired in the view output if ($val['type'] == 'text' || $val['type'] == 'html') { $rightpart .= ' tdtop'; diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index fd303eff68b..61884ad2d54 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -95,6 +95,9 @@ ProductsToConsume=Products to consume ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost +ManufacturingCost=Manufacturing cost +ManufacturingUnitCost=Unit manufacturing cost +ManufacturingGeneratedValue=Manufacturing value generated BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) BOMTotalCostService=If the "Workstation" module is activated and a workstation is defined by default on the line, then the calculation is "quantity (converted into hours) x workstation ahr", otherwise "quantity x cost price of the service" GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. From c6cafe2f1169cf6d321c197200db45cabebc2fad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Dec 2024 08:59:25 +0100 Subject: [PATCH 18/23] Debug v21 --- htdocs/bom/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 704a16507cf..9670bef4fad 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -112,7 +112,7 @@ if ($nolinesbefore) { // Service and workstations are active if ($filtertype == 1 && isModEnabled('workstation')) { - print ''; + print ''; } // Cost print ''; From 56173b0297eb0e599425fca41dfdade12dce1487 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Dec 2024 09:18:46 +0100 Subject: [PATCH 19/23] Fix avoid duplicate filter IN (0, 0) --- htdocs/user/class/user.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 975cbefb98a..9c2f051e51c 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -597,7 +597,11 @@ class User extends CommonObject if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database } else { - $sql .= " WHERE u.entity IN (0, ".((int) (($entity != '' && $entity >= 0) ? $entity : $conf->entity)).")"; // search in entity provided in parameter + if ($entity != '' && $entity == 0) { // If $entity = 0 + $sql .= " WHERE u.entity = 0"; + } else { // if $entity is -1 or > 0 + $sql .= " WHERE u.entity IN (0, ".((int) ($entity > 0 ? $entity : $conf->entity)).")"; + } } } From badbc14c621c1c2dbab04366d1d8bac494c20d7a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 4 Dec 2024 09:39:03 +0100 Subject: [PATCH 20/23] FIX wrong param entity value --- htdocs/core/modules/oauth/generic_oauthcallback.php | 2 +- htdocs/core/modules/oauth/google_oauthcallback.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/oauth/generic_oauthcallback.php b/htdocs/core/modules/oauth/generic_oauthcallback.php index 72acdace030..20a6fa1e41c 100644 --- a/htdocs/core/modules/oauth/generic_oauthcallback.php +++ b/htdocs/core/modules/oauth/generic_oauthcallback.php @@ -340,7 +340,7 @@ if (!GETPOST('code') && !GETPOST('error')) { $storage->clearToken($genericstring); // Delete the token called ("Generic-".$storage->keyforprovider) $tmpuser = new User($db); - $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. + $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, -1, 1); // Load user. Can load with email_oauth2. if ($res > 0) { $username = $tmpuser->login; diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index 474f2724843..d9e823081d8 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -330,7 +330,7 @@ if (!GETPOST('code')) { $storage->clearToken('Google'); // Delete the token called ("Google-".$storage->keyforprovider) $tmpuser = new User($db); - $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. + $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, -1, 1); // Load user. Can load with email_oauth2. if ($res > 0) { $username = $tmpuser->login; From 87dd68a6050252e8ca1d14cfa35f31cec1340274 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 4 Dec 2024 10:03:11 +0100 Subject: [PATCH 21/23] FIX try to fix phpstan error --- htdocs/bom/bom_net_needs.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index b29e53743a3..75c06444f63 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -201,6 +201,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $object->fetch_product(); $manufacturedvalued = ''; if (!empty($object->product)) { + global $mysoc; $tmparray = $object->product->getSellPrice($mysoc, $mysoc); $manufacturedvalued = $tmparray['pu_ht'] * $object->qty; } From 0f50c8e1e8a82d6e20d335dc299e96b25a8a1a5a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 4 Dec 2024 10:22:28 +0100 Subject: [PATCH 22/23] Revert "FIX wrong param entity value" This reverts commit badbc14c621c1c2dbab04366d1d8bac494c20d7a. --- htdocs/core/modules/oauth/generic_oauthcallback.php | 2 +- htdocs/core/modules/oauth/google_oauthcallback.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/oauth/generic_oauthcallback.php b/htdocs/core/modules/oauth/generic_oauthcallback.php index 20a6fa1e41c..72acdace030 100644 --- a/htdocs/core/modules/oauth/generic_oauthcallback.php +++ b/htdocs/core/modules/oauth/generic_oauthcallback.php @@ -340,7 +340,7 @@ if (!GETPOST('code') && !GETPOST('error')) { $storage->clearToken($genericstring); // Delete the token called ("Generic-".$storage->keyforprovider) $tmpuser = new User($db); - $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, -1, 1); // Load user. Can load with email_oauth2. + $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. if ($res > 0) { $username = $tmpuser->login; diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index d9e823081d8..474f2724843 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -330,7 +330,7 @@ if (!GETPOST('code')) { $storage->clearToken('Google'); // Delete the token called ("Google-".$storage->keyforprovider) $tmpuser = new User($db); - $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, -1, 1); // Load user. Can load with email_oauth2. + $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. if ($res > 0) { $username = $tmpuser->login; From 9aa4ce7ac56f8b31ba8ebd904e16f6efad2258ea Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 4 Dec 2024 10:31:48 +0100 Subject: [PATCH 23/23] FIX use GETPOST instead GETPOSTINT --- htdocs/core/login/functions_googleoauth.php | 2 +- htdocs/core/modules/oauth/generic_oauthcallback.php | 2 +- htdocs/core/modules/oauth/google_oauthcallback.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/login/functions_googleoauth.php b/htdocs/core/login/functions_googleoauth.php index c0a77655f29..f4e540b7447 100644 --- a/htdocs/core/login/functions_googleoauth.php +++ b/htdocs/core/login/functions_googleoauth.php @@ -53,7 +53,7 @@ function check_user_password_googleoauth($usertotest, $passwordtotest, $entityto // We save data of form into a variable $_SESSION['datafromloginform'] = array( - 'entity'=>GETPOSTINT('entity'), + 'entity'=>GETPOST('entity', 'int'), // avoid to return 0 if entity var not exists 'backtopage'=>GETPOST('backtopage'), 'tz'=>GETPOST('tz'), 'tz_string'=>GETPOST('tz_string'), diff --git a/htdocs/core/modules/oauth/generic_oauthcallback.php b/htdocs/core/modules/oauth/generic_oauthcallback.php index 72acdace030..2b47b7f798e 100644 --- a/htdocs/core/modules/oauth/generic_oauthcallback.php +++ b/htdocs/core/modules/oauth/generic_oauthcallback.php @@ -334,7 +334,7 @@ if (!GETPOST('code') && !GETPOST('error')) { dol_syslog("we received the login/email to log to, it is ".$useremail); $tmparray = (empty($_SESSION['datafromloginform']) ? array() : $_SESSION['datafromloginform']); - $entitytosearchuser = (isset($tmparray['entity']) ? $tmparray['entity'] : -1); + $entitytosearchuser = ((isset($tmparray['entity']) && $tmparray['entity'] != '') ? $tmparray['entity'] : -1); // Delete the old token $storage->clearToken($genericstring); // Delete the token called ("Generic-".$storage->keyforprovider) diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index 474f2724843..924b78bc07f 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -324,7 +324,7 @@ if (!GETPOST('code')) { dol_syslog("we received the login/email to log to, it is ".$useremail); $tmparray = (empty($_SESSION['datafromloginform']) ? array() : $_SESSION['datafromloginform']); - $entitytosearchuser = (isset($tmparray['entity']) ? $tmparray['entity'] : -1); + $entitytosearchuser = ((isset($tmparray['entity']) && $tmparray['entity'] != '') ? $tmparray['entity'] : -1); // Delete the old token $storage->clearToken('Google'); // Delete the token called ("Google-".$storage->keyforprovider)
'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'
'; - $tmpdate = dol_mktime(0, 0, 0, GETPOSTINT('date_debut_month'), GETPOSTINT('date_debut_day'), GETPOSTINT('date_debut_year')); + $tmpdate = GETPOSTDATE('date_debut_', '00:00:00'); print $form->selectDate($tmpdate ? $tmpdate : $object->date_debut, 'date_debut_'); print '     '; print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday') ? GETPOST('starthalfday') : $starthalfday)); From b2c3ec675b723bbc5e13f6e4571e4712818a345c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 3 Dec 2024 21:30:01 +0100 Subject: [PATCH 12/23] fix phpstan --- build/phpstan/phpstan-baseline.neon | 24 ++++++------------------ htdocs/core/lib/functions.lib.php | 2 +- htdocs/holiday/card.php | 10 ++++++---- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 75b4e9fafba..13eefc2f78a 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -18696,12 +18696,6 @@ parameters: count: 4 path: ../../htdocs/eventorganization/conferenceorboothattendee_card.php - - - message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/eventorganization/conferenceorboothattendee_card.php - - message: '#^Variable \$text might not be defined\.$#' identifier: variable.undefined @@ -18768,12 +18762,6 @@ parameters: count: 1 path: ../../htdocs/eventorganization/core/actions_massactions_mail.inc.php - - - message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/eventorganization/core/actions_massactions_mail.inc.php - - message: '#^Variable \$from might not be defined\.$#' identifier: variable.undefined @@ -21546,6 +21534,12 @@ parameters: count: 1 path: ../../htdocs/ftp/index.php + - + message: '#^If condition is always false\.$#' + identifier: if.alwaysFalse + count: 1 + path: ../../htdocs/holiday/card.php + - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -27714,12 +27708,6 @@ parameters: count: 1 path: ../../htdocs/projet/admin/project.php - - - message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/projet/admin/website.php - - message: '#^Call to function method_exists\(\) with Project and ''fetchComments'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d70f3f1e187..38f173c0a35 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3649,7 +3649,7 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '') * @param int $month Month (1 to 12) * @param int $day Day (1 to 31) * @param int $year Year - * @param int|string $gm True or 1 or 'gmt'=Input information are GMT values + * @param bool|int|string $gm True or 1 or 'gmt'=Input information are GMT values * False or 0 or 'tzserver' = local to server TZ * 'auto' * 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented. diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 8a19e1a3a5e..29595dc17a2 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -85,11 +85,11 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); +$canread = 0; if (($id > 0) || $ref) { $object->fetch($id, $ref); // Check current user can read this leave request - $canread = 0; if ($user->hasRight('holiday', 'readall')) { $canread = 1; } @@ -542,6 +542,9 @@ if (empty($reshook)) { } elseif ($object->halfday == 0 || $object->halfday == 2) { $starthalfdaykey = "Morning"; $endhalfdaykey = "Afternoon"; + } else { + $starthalfdaykey = ""; + $endhalfdaykey = ""; } $link = dol_buildpath("/holiday/card.php", 3) . '?id='.$object->id; @@ -1650,9 +1653,8 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print '
'; print ''; // ancre - $includedocgeneration = 0; - // Documents + /* $includedocgeneration = 0; if ($includedocgeneration) { $objref = dol_sanitizeFileName($object->ref); $relativepath = $objref.'/'.$objref.'.pdf'; @@ -1661,7 +1663,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { $genallowed = ($user->hasRight('holiday', 'read') && $object->fk_user == $user->id) || $user->hasRight('holiday', 'readall'); // If you can read, you can build the PDF to read content $delallowed = ($user->hasRight('holiday', 'write') && $object->fk_user == $user->id) || $user->hasRight('holiday', 'writeall_advance'); // If you can create/edit, you can remove a file on card print $formfile->showdocuments('holiday:Holiday', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); - } + } */ // Show links to link elements //$tmparray = $form->showLinkToObjectBlock($object, null, array('myobject'), 1); From ba18151b9121072513b059154c76896542b0dbc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 3 Dec 2024 21:56:21 +0100 Subject: [PATCH 13/23] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ .../modules/mymodule/doc/pdf_standard_myobject.modules.php | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 13eefc2f78a..51d85397a0d 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -24378,12 +24378,6 @@ parameters: count: 1 path: ../../htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php - - - message: '#^Parameter \#3 \$tab_height of method pdf_standard_myobject\:\:_tableau\(\) expects int, float given\.$#' - identifier: argument.type - count: 6 - path: ../../htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php - - message: '#^Property pdf_standard_myobject\:\:\$cols \(array\\) does not accept non\-empty\-array\\.$#' identifier: assign.propertyType diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index aa2406f6cc8..8621d9aca3c 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -170,7 +170,7 @@ class pdf_standard_myobject extends ModelePDFMyObject public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable - global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines; + global $user, $langs, $conf, $mysoc, $hookmanager, $nblines; dol_syslog("write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null')); @@ -854,8 +854,8 @@ class pdf_standard_myobject extends ModelePDFMyObject * Show table for lines * * @param TCPDF|TCPDI $pdf Object PDF - * @param int $tab_top Top position of table - * @param int $tab_height Height of table (rectangle) + * @param float $tab_top Top position of table + * @param float $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int<-1,1> $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From 29a0eb4d30239cccbef152b5288a6684a3773bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 3 Dec 2024 22:03:22 +0100 Subject: [PATCH 14/23] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ .../core/tpl/linkedobjectblock_myobject.tpl.php | 10 ++++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 51d85397a0d..686d19ca860 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -24438,12 +24438,6 @@ parameters: count: 1 path: ../../htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php - - - message: '#^Variable \$object might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue diff --git a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php index 47d372c68ab..009d9876cb2 100644 --- a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php +++ b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php @@ -1,6 +1,7 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2019 Laurent Destailleur + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * Copyright (C) ---Replace with your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify @@ -17,6 +18,11 @@ * along with this program. If not, see . */ +/** + * @var CommonObject $object + * @var Translate $langs + * @var User $user + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; From 076aae4e01ff558352c5ce240648d57f70f646c6 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 3 Dec 2024 22:22:27 +0100 Subject: [PATCH 15/23] FIX #32169 --- htdocs/core/lib/functions.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9c411ea7caf..662a49eb86c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10577,9 +10577,11 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' $scheck = preg_replace('/\s\(/', '__PARENTHESIS__ ', $scheck); // accept parenthesis in '... (' like in 'if ($a == 1)'. Must replace with __PARENTHESIS__ with a space after to allow following substitutions $scheck = preg_replace('/^!?[a-zA-Z0-9_]+\(/', '__FUNCTION__', $scheck); // accept parenthesis in 'function(' and '!function(' $scheck = preg_replace('/\s!?[a-zA-Z0-9_]+\(/', '__FUNCTION__', $scheck); // accept parenthesis in '... function(' and '... !function(' + $scheck = preg_replace('/^!\(/', '__NOTANDPARENTHESIS__', $scheck); // accept parenthesis in '!(' + $scheck = preg_replace('/\s!\(/', '__NOTANDPARENTHESIS__', $scheck); // accept parenthesis in '... !(' $scheck = preg_replace('/(\^|\')\(/', '__REGEXSTART__', $scheck); // To allow preg_match('/^(aaa|bbb)/'... or isStringVarMatching('leftmenu', '(aaa|bbb)') } - //print 'scheck='.$scheck." : ".strpos($scheck, '(')."
\n"; + if (strpos($scheck, '(') !== false) { if ($returnvalue) { return 'Bad string syntax to evaluate (mode '.$onlysimplestring.', found call of a function or method without using the direct name of the function): '.$s; From 657c3a7432898438dc2f49d7c2f38e6e9fb8039b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 3 Dec 2024 22:23:47 +0100 Subject: [PATCH 16/23] Comment --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 662a49eb86c..92139f01d2a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10581,6 +10581,7 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' $scheck = preg_replace('/\s!\(/', '__NOTANDPARENTHESIS__', $scheck); // accept parenthesis in '... !(' $scheck = preg_replace('/(\^|\')\(/', '__REGEXSTART__', $scheck); // To allow preg_match('/^(aaa|bbb)/'... or isStringVarMatching('leftmenu', '(aaa|bbb)') } + //print 'scheck='.$scheck." : ".strpos($scheck, '(')."
\n"; if (strpos($scheck, '(') !== false) { if ($returnvalue) { From 7a195e01b2ca2d6043f8a7e43a012e14a2205a07 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Dec 2024 08:42:18 +0100 Subject: [PATCH 17/23] Debug v21 - manufacturing cost --- htdocs/bom/bom_card.php | 35 ++++++++++++----------- htdocs/bom/bom_net_needs.php | 19 ++++++++++-- htdocs/bom/class/bom.class.php | 2 +- htdocs/core/tpl/commonfields_view.tpl.php | 2 +- htdocs/langs/en_US/mrp.lang | 3 ++ 5 files changed, 41 insertions(+), 20 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index b72904ad0f3..7d1ffa9e609 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -425,10 +425,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formquestion = array(); if (isModEnabled('bom')) { $langs->load("mrp"); - $forcecombo = 0; - if ($conf->browser->name == 'ie') { - $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - } $formquestion = array( // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), @@ -453,10 +449,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formquestion = array(); if (isModEnabled('bom')) { $langs->load("mrp"); - $forcecombo = 0; - if ($conf->browser->name == 'ie') { - $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - } $formquestion = array( // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), @@ -482,10 +474,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (isModEnabled('bom')) { $langs->load("mrp"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $forcecombo = 0; - if ($conf->browser->name == 'ie') { - $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - } $formquestion = array( // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), @@ -580,9 +568,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Common attributes $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - $object->calculateCosts(); - print '
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'.$form->textwithpicto($langs->trans("ManufacturingCost"), $langs->trans("BOMTotalCost")).''; + print price($object->total_cost); + print ''; + if ($object->total_cost != $object->unit_cost) { + print '    ('.$form->textwithpicto(price($object->unit_cost), $langs->trans("ManufacturingUnitCost"), 1, 'help', '').')'; + } + print '
'.$langs->trans("ManufacturingGeneratedValue").''.price($manufacturedvalued).'
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'.$form->textwithpicto($langs->trans("ManufacturingCost"), $langs->trans("BOMTotalCost")).''; + print price($object->total_cost); + print ''; + if ($object->total_cost != $object->unit_cost) { + print '    ('.$form->textwithpicto(price($object->unit_cost), $langs->trans("ManufacturingUnitCost"), 1, 'help', '').')'; + } + print '
'.$langs->trans("ManufacturingGeneratedValue").''.price($manufacturedvalued).'
' . $form->textwithpicto($langs->trans('Workstation'), '') . '' . $form->textwithpicto($langs->trans('Workstation'), '') . '' . $form->textwithpicto($langs->trans('TotalCost'), '') . '