diff --git a/ChangeLog b/ChangeLog index 7f4bf72cd74..a8241b7557a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,10 @@ NEW: Accountancy - Add possibility for specific format FEC to sort with the FEC NEW: Accountancy - Expense report - Add an option to use end period for transfer (#26706) NEW: Accountancy - Show accounting result on balance NEW: Accountancy - Show import key if exist (#29265) +NEW: Accountancy - Auto-determine piece number in FEC import (#29672) +NEW: Accountancy - Option to transfer only reconciled lines from bank (#29408) +NEW: Accountancy - Separation of accounting default account for salary and expense report +NEW: Various payment - Use list of accounting account when edit (#27992) NEW: Add option to change all service dates at once NEW: Add a default limit in nb to agenda export NEW: Add a Feedback-ID into email headers @@ -97,7 +101,6 @@ NEW: Allow smileys into emailing html content NEW: Allow to set a default project for POS sales (#27042) NEW: animation for display spinner when waiting response NEW: Asset Module - make asset model creation in a single step (#26982) -NEW: auto-determine piece number in FEC import (#29672) NEW: auto fill infos in template email NEW: Automatically fill matching extra fields of object on line creation. (#27240) NEW: Can add documents on a payment (#29660) @@ -134,7 +137,7 @@ NEW: fetch object by element for website account card NEW: filter on sale representative in contact list NEW: Filter shipments by selecting multiple shipping methods (#28376) NEW: Font param Look and Feel (#29302) -NEW: fuctionnality for stock configuration prompt in AI module (#28030) +NEW: functionality for stock configuration prompt in AI module (#28030) NEW: functionality to delete contact of company list NEW: functionality to display codebar on pdf files (#29623) NEW: functionality to list event for user @@ -166,7 +169,6 @@ NEW: notification action triggers for cancelling orders and invoices NEW: now button when editing an event NEW: online signature of shipments (#29559) NEW: On OAuth Google login, no prompt at all if already logged in Google -NEW: Option to transfer only reconciliated lines from bank (#29408) NEW: Param to show main menu logo in color look and feel (#29305) NEW: Payment page received from donations NEW: possibility to define a completely inactive module (#29289) @@ -179,7 +181,6 @@ NEW: resource address, phone, email & maxusers (#28185) NEW: Script for fast identification of missing/unused/duplicate translations NEW: search member by date NEW: See the documents of my subordinates (#28318) -NEW: separation of expense report from salary accounting code NEW: Show error on ical parse NEW: Show the profit per attendee on events NEW: signed status CRUD to contract and fichinter @@ -206,7 +207,6 @@ NEW: Update expense report card.php to allow pdf preview even without thumbnail NEW: update price with auto to use const for rounding prices (#29350) NEW: Use a nicer combo list to select the export accounting format NEW: users can set their own length for short lists -NEW: Various payment - Use list of account when edit (#27992) NEW: warning message when cloning a product whose status is not to sell (#28374) PERF: Performance enhancement on Invoice/Paiement area page PERF: Use cache for loaded users/contact on project list @@ -219,6 +219,7 @@ SEC: Reduce nb of var without WAF used when using the website module For developers or integrators: ------------------------------ +NEW: Situation invoice - Add new official progressive mode - (constant INVOICE_USE_SITUATION = 2) NEW: $noescapetags param of dol_escape_html works if attributes NEW: Add createInvoiceFromContract to API invoice (#27277) NEW: add debugging info to api/status if non-production diff --git a/dev/tools/fixcopyrightheader.php b/dev/tools/fixcopyrightheader.php index cc0e40b8517..36e964ca8fd 100755 --- a/dev/tools/fixcopyrightheader.php +++ b/dev/tools/fixcopyrightheader.php @@ -42,6 +42,32 @@ const PREFIXES = [ 'php' => ['/* ', ' * ', ' */', '\d{4}))\s+{$r_name}\s*\<{$r_email}>~"; + // Based on the tendency to limit the length of the spacing between the name + // and email to the smallest one, determine the biggest offset from the start + // of a name to the start of the email, and use that for the current name/email + // offset if it is sufficient. + // Pattern to match any copyright already present + $allpattern = "~(?:{$r_prefix0}|{$r_prefix1})Copyright \(C\)\s+(?:(?:\d{4}-)?(?:\d{4}))\s+(\S.*)<\S+>~"; + // Set minimum offset based of width of new name + $nameStartToMailStartOffset = 4 * (int) ((mb_strlen($r_name) + 4) / 4); + + if (preg_match_all($allpattern, $lines, $allmatches)) { + foreach ($allmatches[1] as $nameAndSpaces) { + //print $nameAndSpaces."\n"; + $nameAndSpaces = expandTabs($nameAndSpaces, 4); + $currentOffset = mb_strlen($nameAndSpaces); + $currentOffset = 4 * (int) ((3 + $currentOffset) / 4); + //print "Other offset $nameAndSpaces: $currentOffset\n"; + if ($currentOffset > $nameStartToMailStartOffset) { + $nameStartToMailStartOffset = $currentOffset; + } + } + } + + // Pattern to match the line matching the current developer + $pattern = "~(?:{$r_prefix0}|{$r_prefix1})Copyright \(C\)\s+(?:(?:\d{4}-)?(?\d{4}))\s+{$r_name}\s*\<{$r_email}>~"; // Check if the lines match the pattern $matches = array(); if (preg_match($pattern, $lines, $matches)) { @@ -90,7 +138,8 @@ function updateCopyrightNotice($filename, $fileType, $name, $email) // If the existing year is the same, no need to update } else { // Adjust tabs for proper alignment - $emailTabs = str_repeat("\t", (int) (max(0, (31 - mb_strlen($name)) / 4))); + print "Offset:".$nameStartToMailStartOffset."\n"; + $emailTabs = str_repeat("\t", (int) (max(0, ($nameStartToMailStartOffset + 4 - mb_strlen($name)) / 4))); // No match found, add a new line to the header $newNotice = "Copyright (C) " . date('Y') . "\t\t" . $name . $emailTabs . "<" . $email . ">"; @@ -113,7 +162,8 @@ function updateCopyrightNotice($filename, $fileType, $name, $email) } // Write the updated content back to the file - file_put_contents($filename, $fileContent); + //file_put_contents($filename, $fileContent); + print $fileContent; return true; // Change detected } diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 23be6232f60..9fd618e9490 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -10,7 +10,7 @@ return [ // # Issue statistics: // PhanPluginUnknownPropertyType : 1550+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 920+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 890+ occurrences // PhanUndeclaredProperty : 840+ occurrences // PhanPossiblyUndeclaredGlobalVariable : 750+ occurrences // PhanPluginUnknownArrayMethodReturnType : 480+ occurrences @@ -55,7 +55,6 @@ return [ 'htdocs/admin/dict.php' => ['PhanRedefineFunction'], 'htdocs/admin/fckeditor.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/mails_templates.php' => ['PhanRedefineFunction'], - 'htdocs/admin/security_file.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/api/class/api_access.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredProperty'], 'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/api/class/api_login.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], @@ -96,11 +95,10 @@ return [ 'htdocs/bookcal/lib/bookcal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/bookcal/lib/bookcal_availabilities.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/bookcal/lib/bookcal_calendar.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/bookmarks/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bookmarks/class/bookmark.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/categories/class/categorie.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchProperty'], - 'htdocs/categories/edit.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch'], + 'htdocs/categories/edit.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/categories/index.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/categories/info.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/categories/photos.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch'], @@ -196,8 +194,8 @@ return [ 'htdocs/compta/paiement/class/cpaiement.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/compta/paiement/class/paiement.class.php' => ['PhanEmptyForeach', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/paiement/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/paiement_charge.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/paiement_vat.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/paiement_charge.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/compta/paiement_vat.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/payment_vat/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], @@ -535,7 +533,7 @@ return [ 'htdocs/core/tpl/advtarget.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/ajaxrow.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/bloc_comment.tpl.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/card_presend.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/tpl/card_presend.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/commonfields_add.tpl.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/core/tpl/commonfields_edit.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/commonfields_view.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -568,7 +566,7 @@ return [ 'htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess'], 'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanPluginEmptyStatementIf', 'PhanUndeclaredProperty'], 'htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/cron/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/cron/card.php' => ['PhanPluginBothLiteralsBinaryOp'], 'htdocs/cron/class/cronjob.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/cron/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/datapolicy/class/datapolicy.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], @@ -644,7 +642,7 @@ return [ 'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/expensereport/payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/payment/info.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/expensereport/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/expensereport/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expensereport/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expensereport/tpl/expensereport_addfile.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/tpl/expensereport_linktofile.tpl.php' => ['PhanUndeclaredGlobalVariable'], @@ -680,7 +678,7 @@ return [ 'htdocs/fourn/facture/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], 'htdocs/fourn/facture/list-rec.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/facture/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/fourn/facture/paiement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/fourn/facture/paiement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], 'htdocs/fourn/paiement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/fourn/paiement/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -794,7 +792,7 @@ return [ 'htdocs/product/ajax/products.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/canvas/product/actions_card_product.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach'], 'htdocs/product/canvas/service/actions_card_service.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach'], - 'htdocs/product/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/product/class/api_products.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], 'htdocs/product/class/html.formproduct.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/product/class/product.class.php' => ['PhanPluginUnknownArrayMethodParamType'], @@ -832,7 +830,7 @@ return [ 'htdocs/product/stock/class/productstockentrepot.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/product/stock/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/massstockmove.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/product/stock/massstockmove.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/product/stock/movement_card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/product.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -1072,7 +1070,6 @@ return [ 'htdocs/webservices/server_contact.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_invoice.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_order.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_other.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_payment.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_productorservice.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_project.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst index fcde147d65f..46124cff57e 100644 --- a/dev/translation/ignore_translation_keys.lst +++ b/dev/translation/ignore_translation_keys.lst @@ -143,7 +143,7 @@ BAN BI BOMs Back -Bad value for email, email lwas not verified by Google +Bad value for email, email was not verified by Google Bad value for returned userinfo[aud] Bad value for returned userinfo[exp]. Token expired. Bad value for returned userinfo[iss] @@ -302,8 +302,6 @@ ECMAreaDesc2 ECMDocsByProducts ECMSectionAutoDesc ECMSectionManualDesc -EMail -EMails EcmFiles EditAdherent EditAdherentAddress diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 086cb033bca..0929cc70717 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -374,6 +374,20 @@ if ($result) { } // After the loop on each line + $parameters = array( + 'tabfac' => &$tabfac, + 'tabht' => &$tabht, + 'tabtva' => &$tabtva, + 'def_tva' => &$def_tva, + 'tabwarranty' => &$tabwarranty, + 'tabrevenuestamp' => &$tabrevenuestamp, + 'tabttc' => &$tabttc, + 'tablocaltax1' => &$tablocaltax1, + 'tablocaltax2' => &$tablocaltax2, + 'tabcompany' => &$tabcompany, + 'vatdata_cache' => &$vatdata_cache, + ); + $reshook = $hookmanager->executeHooks('processedJournalData', $parameters); // Note that $action and $object may have been modified by hook } else { dol_print_error($db); } diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 6c02cf37ae4..f121b013d78 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -100,6 +100,7 @@ if ($action == 'updateMask') { $module = new $classname($db); '@phan-var-force ModelePDFContract $module'; + /** @var ModelePDFContract $module */ if ($module->write_file($contract, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=contract&file=SPECIMEN.pdf"); return; diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index 4647f807755..43b2b25d261 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent + * 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 @@ -41,7 +42,6 @@ if (!$user->admin) { } -$type = array('yesno', 'texte', 'chaine'); $action = GETPOST('action', 'aZ09'); $testsubscribeemail = GETPOST("testsubscribeemail"); @@ -57,13 +57,14 @@ $error = 0; // Action updated or added a constant if ($action == 'update' || $action == 'add') { $tmparray = GETPOST('constname', 'array'); + $tmpvalue = GETPOST('constvalue', 'array'); + $tmpnote = GETPOST('constnote', 'array'); if (is_array($tmparray)) { foreach ($tmparray as $key => $val) { $constname = $tmparray[$key]; - $constvalue = $tmparray[$key]; - $consttype = $tmparray[$key]; - $constnote = $tmparray[$key]; - $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); + $constvalue = $tmpvalue[$key]; + $constnote = $tmpnote[$key]; + $res = dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, $constnote, $conf->entity); if (!($res > 0)) { $error++; diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 16390896977..d3fd5c0917a 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -221,7 +221,7 @@ print ''; // Form to test upload print '
'; $formfile = new FormFile($db); -$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0); +$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, null, '', 1, '', 0); // List of document $filearray = dol_dir_list($upload_dir, "files", 0, '', '', $sortfield, $sortorder == 'desc' ? SORT_DESC : SORT_ASC, 1); diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index c6bc1c5871b..b552609bc8d 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * 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 @@ -42,8 +43,6 @@ if (!$user->admin) { } -$type = array('yesno', 'texte', 'chaine'); - $action = GETPOST('action', 'aZ09'); @@ -55,7 +54,6 @@ $action = GETPOST('action', 'aZ09'); if ($action == 'update' || $action == 'add') { $constnamearray = GETPOST("constname", 'array'); $constvaluearray = GETPOST("constvalue", 'array'); - $consttypearray = GETPOST("consttype", 'array'); $constnotearray = GETPOST("constnote", 'array'); // Action mise a jour ou ajout d'une constante @@ -63,10 +61,9 @@ if ($action == 'update' || $action == 'add') { foreach ($constnamearray as $key => $val) { $constname = dol_escape_htmltag($constnamearray[$key]); $constvalue = dol_escape_htmltag($constvaluearray[$key]); - $consttype = (int) $consttypearray[$key]; $constnote = dol_escape_htmltag($constnotearray[$key]); - $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); + $res = dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, $constnote, $conf->entity); if (!($res > 0)) { $error++; diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 0b02e78e344..44935e91607 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -660,7 +660,7 @@ if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) { } else { print img_picto('', 'minus', 'class="pictofixedwidth"'); } -print ' '.$form->textwithpicto($langs->trans("EnableFileCache").' ('.$langs->trans("Widgets").')', $langs->trans("Option").' MAIN_ACTIVATE_FILECACHE'); +print $form->textwithpicto($langs->trans("EnableFileCache").' ('.$langs->trans("Widgets").')', $langs->trans("Option").' MAIN_ACTIVATE_FILECACHE'); print ': '.yn(getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')); print '
'; @@ -669,7 +669,7 @@ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { } else { print img_picto('', 'minus', 'class="pictofixedwidth"'); } -print ' MAIN_ENABLE_AJAX_TOOLTIP : '; +print 'MAIN_ENABLE_AJAX_TOOLTIP : '; print yn(getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')); print '
'; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 42fb6b8ac3e..9671d5a6828 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -379,11 +379,12 @@ if (empty($dolibarr_main_stream_to_disable)) { } else { print implode(', ', $dolibarr_main_stream_to_disable); } -print ' -> Current PHP streams allowed = '; +print '   -> Current PHP streams allowed = '; $arrayofstreams = stream_get_wrappers(); if (!empty($arrayofstreams)) { sort($arrayofstreams); - print(implode(', ', $arrayofstreams)).'     ('.$langs->trans("Recommended").': '.$langs->trans("TryToKeepOnly", 'file,http,https,php,zip').')'."\n"; + print ''.implode(',', $arrayofstreams).''; + print '     ('.$langs->trans("Recommended").': '.$langs->trans("TryToKeepOnly", 'file,http,https,php,zip').')'."\n"; } print ''; diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 8ae5a83cb02..d8e5f342494 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -167,21 +167,12 @@ if ($action == 'updateMask') { $error++; } - if (GETPOSTISSET('product_category_id')) { - $param_ticket_product_category = GETPOSTINT('product_category_id'); - $res = dolibarr_set_const($db, 'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } - $param_status = GETPOST('TICKET_SET_STATUS_ON_ANSWER'); $res = dolibarr_set_const($db, 'TICKET_SET_STATUS_ON_ANSWER', $param_status, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } - $param_delay_first_response = GETPOSTINT('delay_first_response'); $res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { @@ -625,37 +616,6 @@ print $formcategory->textwithpicto('', $langs->trans("TicketAutoCheckNotifyThird print ''; print ''; -// Assign contact to a message -print ''.$langs->trans("TicketAssignContactToMessage").''; -print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_ASSIGN_CONTACT_TO_MESSAGE'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $formcategory->selectarray("TICKET_ASSIGN_CONTACT_TO_MESSAGE", $arrval, getDolGlobalString('TICKET_ASSIGN_CONTACT_TO_MESSAGE')); -} -print ''; -print ''; -print $formcategory->textwithpicto('', $langs->trans("TicketAssignContactToMessageHelp"), 1, 'help'); -print ''; -print ''; - -if (isModEnabled('product')) { - $htmlname = "product_category_id"; - print ''.$langs->trans("TicketChooseProductCategory").''; - print ''; - print img_picto('', 'category', 'class="pictofixedwidth"'); - $formcategory->selectProductCategory(getDolGlobalString('TICKET_PRODUCT_CATEGORY'), $htmlname); - if ($conf->use_javascript_ajax) { - print ajax_combobox('select_'.$htmlname); - } - print ''; - print ''; - print $formcategory->textwithpicto('', $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help'); - print ''; - print ''; -} - print ''; print ''.$langs->trans("TicketsDelayBeforeFirstAnswer").""; print ' diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 42bd9cc8900..7bb8e2c0b9d 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -28,6 +28,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php"; +require_once DOL_DOCUMENT_ROOT."/core/class/html.formcategory.class.php"; // Load translation files required by the page $langs->loadLangs(array("admin", "ticket")); @@ -221,6 +222,7 @@ if ($action != '') { $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $form = new Form($db); +$formcategory = new FormCategory($db); $help_url = "FR:Module_Ticket"; $page_name = "TicketSetup"; @@ -414,7 +416,7 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { } if (empty($conf->use_javascript_ajax)) { - print ''; + print ''; print ''; } @@ -458,9 +460,29 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help'); print ''; + // Add first contact id found in database from submitter email entered into public interface + // Feature disabled: This has a security trouble. The public interface is a no login interface, so being able to show the contact info from an + // email decided by the submiter allows anybody to get information on any contact (customer or supplier) in Dolibarr database. + // He can even check if contact exists by trying any email if this feature is enabled. + /* + print ''.$langs->trans("TicketAssignContactToMessage").''; + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_ASSIGN_CONTACT_TO_MESSAGE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $formcategory->selectarray("TICKET_ASSIGN_CONTACT_TO_MESSAGE", $arrval, getDolGlobalString('TICKET_ASSIGN_CONTACT_TO_MESSAGE')); + } + print ''; + print ''; + print $formcategory->textwithpicto('', $langs->trans("TicketAssignContactToMessageHelp"), 1, 'help'); + print ''; + print ''; + */ + // Url public interface $url_interface = getDolGlobalString("TICKET_URL_PUBLIC_INTERFACE"); - print ''.$langs->trans("UrlPublicInterfaceLabelAdmin").''; + print ''.$langs->trans("UrlPublicInterfaceLabelAdmin").''; print ''; print ''; print ''; @@ -470,15 +492,17 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print ''; + print '

'; + print load_fiche_titre($langs->trans("Emails")); print '
'; print ''; // Activate email creation to user - print ''; print ''; // Activate email notification when a new message is added - print ''; print ''; // Send notification when a new message is added to a email if a user is not assigned to the ticket - print ''; diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index d5ba9c88431..3272e7174dc 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -234,6 +234,12 @@ $workflowcodes = array_filter( } ); +if ($action == 'setvarworkflow') { // Test on permission already done + if (GETPOSTISSET('product_category_id')) { + $param_ticket_product_category = GETPOSTINT('product_category_id'); + $res = dolibarr_set_const($db, 'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category, 'chaine', 0, '', $conf->entity); + } +} /* @@ -261,22 +267,30 @@ if (count($workflowcodes) < 1) { // Sort on position $workflowcodes = dol_sort_array($workflowcodes, 'position'); -print '
'; + print '
'; print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help'); print ''; @@ -493,7 +517,7 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { // Text of email after creatio of a ticket $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody')); - print '
'; + print '
'; print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help'); print ''; print ''; @@ -504,7 +528,7 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print '
'; + print '
'; print $form->textwithpicto($langs->trans("TicketsPublicNotificationNewMessage"), $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help'); print ''; @@ -518,7 +542,7 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print '
'; + print '
'; print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help'); print ''; print '
'; +print ''; +print ''; +print ''; +print ''; $oldfamily = ''; +$tableopen = 0; +$atleastoneline = 0; foreach ($workflowcodes as $key => $params) { if ($params['family'] == 'separator') { - print '
'; - print '
'; - - print ''; + if ($atleastoneline) { + print '
'; + print '
'; + $oldfamily = ''; + $atleastoneline = 0; + } continue; } $reg = array(); if ($oldfamily != $params['family']) { + // New group if ($params['family'] == 'create') { $header = $langs->trans("AutomaticCreation"); } elseif (preg_match('/classify_(.*)/', $params['family'], $reg)) { @@ -308,6 +322,9 @@ foreach ($workflowcodes as $key => $params) { $header = $langs->trans("Description"); } + print ''; + $tableopen = 1; + print ''; print ''; print ''; @@ -316,6 +333,8 @@ foreach ($workflowcodes as $key => $params) { $oldfamily = $params['family']; } + $atleastoneline = 1; + print ''; print ''; print ''; } -print '
'.$header.''.$langs->trans("Status").'
'; print img_object('', $params['picto'], 'class="pictofixedwidth"'); @@ -328,6 +347,26 @@ foreach ($workflowcodes as $key => $params) { print ' '.img_warning($langs->transnoentitiesnoconv("Deprecated")); } + if ($key == 'WORKFLOW_TICKET_LINK_CONTRACT' && getDolGlobalString('WORKFLOW_TICKET_LINK_CONTRACT')) { + require_once DOL_DOCUMENT_ROOT."/core/class/html.formcategory.class.php"; + + $formcategory = new FormCategory($db); + + $htmlname = "product_category_id"; + print '
'; + print $formcategory->textwithpicto($langs->trans("TicketChooseProductCategory"), $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help'); + if (isModEnabled('category')) { + print '   '.img_picto('', 'category', 'class="pictofixedwidth"'); + $formcategory->selectProductCategory(getDolGlobalInt('TICKET_PRODUCT_CATEGORY'), $htmlname, 1); + if ($conf->use_javascript_ajax) { + print ajax_combobox('select_'.$htmlname); + } + print ''; + } else { + print 'Module category must be enabled'; + } + } + print '
'; @@ -354,7 +393,12 @@ foreach ($workflowcodes as $key => $params) { print '
'; +if ($tableopen) { + print ''; +} + +print ''; + // End of page llxFooter(); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 3750da9a16f..49051464614 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -331,6 +331,8 @@ if (empty($reshook) && $action == 'add' && $usercancreate) { $datep = dol_mktime(GETPOSTINT("aphour"), GETPOSTINT("apmin"), GETPOSTINT("apsec"), GETPOSTINT("apmonth"), GETPOSTINT("apday"), GETPOSTINT("apyear"), 'tzuserrel'); $datef = dol_mktime(GETPOSTINT("p2hour"), GETPOSTINT("p2min"), GETPOSTINT("apsec"), GETPOSTINT("p2month"), GETPOSTINT("p2day"), GETPOSTINT("p2year"), 'tzuserrel'); } + //set end date to now if percentage is set to 100 and end date not set + $datef = (!$datef && $percentage == 100)?dol_now():$datef; // Check parameters if (!$datef && $percentage == 100) { diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index abfcd72a41d..164007ce758 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -71,6 +71,8 @@ if (!empty($user->socid)) { $hookmanager->initHooks(array('proposalcontactcard', 'globalcard')); $result = restrictedArea($user, 'propal', $object->id); +restrictedArea($user, 'propal', $object->id); + $usercancreate = $user->hasRight("propal", "creer"); /* diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index e0dbd6b45b1..0d39226861c 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -81,6 +81,7 @@ $socid = ''; if (!empty($user->socid)) { $socid = $user->socid; } +$hookmanager->initHooks(array('propaldocument', 'globalcard')); restrictedArea($user, 'propal', $object->id); $usercancreate = $user->hasRight("propal", "creer"); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 3a1f57ec9bb..8be71b5b7be 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -746,6 +746,11 @@ class Account extends CommonObject $this->status = $this->clos; } + if (empty($this->address && !empty($this->domiciliation))) { + dol_syslog(get_class($this)."::create domiciliation is deprecated use address", LOG_NOTICE); + $this->address = $this->domiciliation; + } + // Load the library to validate/check a BAN account require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 61d125ab7b9..e5f5b0edccf 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1523,7 +1523,7 @@ class Invoices extends DolibarrApi // Creation of payment line $paymentobj = new Paiement($this->db); - $paymentobj->datepaye = dol_stringtotime($datepaye); + $paymentobj->datepaye = $datepaye; $paymentobj->amounts = $amounts; // Array with all payments dispatching with invoice id $paymentobj->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paymentobj->paiementid = $paymentid; diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index af4956e1530..db74a72f94f 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -79,6 +79,7 @@ $permissiontoadd = $user->hasRight('facture', 'creer'); if ($user->socid) { $socid = $user->socid; } +$hookmanager->initHooks(array('invoicedocument', 'globalcard')); $result = restrictedArea($user, 'facture', $object->id, ''); $usercancreate = $user->hasRight("facture", "creer"); diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 6d6d3a53173..17b48ab42bc 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2011-2020 Laurent Destailleur + * 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 @@ -484,7 +485,7 @@ if ($action == 'encrypt') { if ($resupdate) { $nbupdatedone++; } else { - setEventMessages($db->lasterror(), '', 'errors'); + setEventMessages($db->lasterror(), null, 'errors'); $error++; break; } diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index e90b1998906..2272997784b 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -1,7 +1,8 @@ - * Copyright (C) 2015 Marcos García - * Copyright (C) 2015 Ferran Marcet +/* Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Ferran Marcet + * 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 @@ -111,7 +112,7 @@ if (GETPOST('sendit', 'alpha') && getDolGlobalString('MAIN_UPLOAD_DOC') && !empt } if (!$error) { - dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link, '', 0); + dol_add_file_process($upload_dir, 0, 1, 'userfile', '', $link, '', 0); } } } diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 9e0781fb337..f753baf5158 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1763,7 +1763,7 @@ if (!$error && ($massaction == 'increaseholiday' || ($action == 'increaseholiday $nbdaysholidays = GETPOSTFLOAT('nbdaysholidays'); // May be 1.5 if ($nbdaysholidays <= 0) { - setEventMessages($langs->trans("WrongAmount"), "", 'errors'); + setEventMessages($langs->trans("WrongAmount"), null, 'errors'); $error++; } @@ -1869,7 +1869,7 @@ if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $conf } else { if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("projects"); - setEventMessages($langs->trans('NewTaskRefSuggested'), '', 'warnings'); + setEventMessages($langs->trans('NewTaskRefSuggested'), null, 'warnings'); $duplicate_code_error = true; } else { setEventMessages($clone_task->error, $clone_task->errors, 'errors'); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9a4234b7220..013373b5620 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -45,7 +45,7 @@ class ExtraFields public $db; /** - * @var array,type:array,size:array,default:array,computed:array,unique:array,required:array,param:array,perms:array,list:array,pos:array,totalizable:array,help:array,printable:array,enabled:array,langfile:array,css:array,csslist:array,cssview:array,hidden:array,mandatoryfieldsofotherentities:array,loaded?:int,count:int}> New array to store extrafields definition Note: count set as present to avoid static analysis notices + * @var array,type:array,size:array,default:array,computed:array,unique:array,required:array,param:array,perms:array,list:array,pos:array,totalizable:array,help:array,printable:array,enabled:array,langfile:array,css:array,csslist:array,cssview:array,hidden:array,mandatoryfieldsofotherentities:array,loaded?:int,count:int}> New array to store extrafields definition Note: count set as present to avoid static analysis notices */ public $attributes = array(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f3ea115c745..6a2fc47fccf 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2684,7 +2684,7 @@ class Form if ((int) $warehouseId > 0) { $urloption .= '&warehouseid=' . (int) $warehouseId; } - $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); + $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions); if (isModEnabled('variants') && is_array($selected_combinations)) { // Code to automatically insert with javascript the select of attributes under the select of product @@ -3712,9 +3712,7 @@ class Form $sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, p.fk_product_type, p.stock, p.tva_tx as tva_tx_sale, p.default_vat_code as default_vat_code_sale,"; $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice, pfp.barcode"; - if (isModEnabled('multicurrency')) { - $sql .= ", pfp.multicurrency_code, pfp.multicurrency_unitprice"; - } + $sql .= ", pfp.multicurrency_code, pfp.multicurrency_unitprice"; $sql .= ", pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.default_vat_code, pfp.fk_soc, s.nom as name"; $sql .= ", pfp.supplier_reputation"; // if we use supplier description of the products @@ -4095,7 +4093,7 @@ class Form 'type' => $outtype, 'duration_value' => $outdurationvalue, 'duration_unit' => $outdurationunit, - 'disabled' => empty($objp->idprodfournprice), + 'disabled' => (empty($objp->idprodfournprice) ? true : false), 'description' => $objp->description ); if (isModEnabled('multicurrency')) { diff --git a/htdocs/core/class/html.formcategory.class.php b/htdocs/core/class/html.formcategory.class.php index 193967845ab..731559ed119 100644 --- a/htdocs/core/class/html.formcategory.class.php +++ b/htdocs/core/class/html.formcategory.class.php @@ -23,6 +23,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; /** @@ -101,6 +102,8 @@ class FormCategory extends Form /** * Prints a select form for products categories + * TODO Remove this. We should already have a generic method to get list of product category. + * * @param int $selected Id category pre-selection * @param string $htmlname Name of HTML field * @param int $showempty Add an empty field @@ -108,15 +111,14 @@ class FormCategory extends Form */ public function selectProductCategory($selected = 0, $htmlname = 'product_category_id', $showempty = 0) { - $sql = "SELECT cp.fk_categorie as cat_index, cat.label"; - $sql .= " FROM ".MAIN_DB_PREFIX."categorie_product as cp"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie as cat ON cat.rowid = cp.fk_categorie"; - $sql .= " GROUP BY cp.fk_categorie, cat.label"; + $sql = "SELECT cat.rowid, cat.label"; + $sql .= " FROM ".MAIN_DB_PREFIX."categorie as cat"; + $sql .= " WHERE cat.type = 0"; dol_syslog(get_class($this)."::selectProductCategory", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - print ''; if ($showempty) { print ''; } @@ -125,10 +127,10 @@ class FormCategory extends Form $num_rows = $this->db->num_rows($resql); while ($i < $num_rows) { $category = $this->db->fetch_object($resql); - if ($selected && $selected == $category->cat_index) { - print ''; + if ($selected && $selected == $category->rowid) { + print ''; } else { - print ''; + print ''; } $i++; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5d704678054..c8630c2b057 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -7,8 +7,8 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Bahfir Abbes * Copyright (C) 2016-2017 Ferran Marcet - * Copyright (C) 2019-2023 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -123,7 +123,7 @@ class FormFile $title = $langs->trans("AttachANewFile"); } if ($title != 'none') { - $out .= load_fiche_titre($title, null, null); + $out .= load_fiche_titre($title, '', ''); } if (empty($usewithoutform)) { // Try to avoid this and set instead the form by the caller. @@ -222,7 +222,7 @@ class FormFile $out .= "\n".'
'."\n"; $langs->load('link'); $title = $langs->trans("LinkANewFile"); - $out .= load_fiche_titre($title, null, null); + $out .= load_fiche_titre($title, '', ''); if (empty($usewithoutform)) { $out .= '