diff --git a/.github/workflows/exakat.yml.disabled b/.github/workflows/exakat.yml similarity index 100% rename from .github/workflows/exakat.yml.disabled rename to .github/workflows/exakat.yml diff --git a/ChangeLog b/ChangeLog index da15649487f..a7845e69220 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,11 +19,11 @@ NEW: Accountancy - Manage intra-community VAT on supplier invoices - FPC22 NEW: Accountancy - iSuiteExpert export model NEW: Accountancy - Quadratus export with attachments in accountancy export NEW: Accountancy - Can filter on a custom group of accounts. Perf or ledger list. +NEW: Accountancy - Can select the export format during export of journals NEW: Can upload a file with drag and drop on purchase invoice, vats, salaries and social contributions NEW: Authentication: #22740 add OpenID Connect impl NEW: Authentication: add experimental support for Google OAuth2 connexion NEW: Authentication: can now edit service name for OAuth token -NEW: Add a public virtual card page for each user NEW: Add a status on supplier price ref (WIP to close a supplier ref) NEW: add bookmarks in selectable landing pages for users NEW: Add column ext_payment_site into societe_rib to allow multiple payment mode @@ -35,39 +35,31 @@ NEW: Add filters and sort on product unit column NEW: Add link to edit VAT list from error message of missing VAT NEW: add margins in paiement/card.php NEW: Add mass action delete on VAT -NEW: Add origin info when create a product batch when created from a movement stock NEW: Add possibility to choose format #21426 -NEW: Add SQL contraint on product_stock table to allow only exsting product and warehouse #23543 -NEW: Add STRIPE_DEBUG, a way to log Stripe IPN NEW: An external module can modify the quick search fields -NEW: Auto activate some modules on install (Export/Import/Wysiwyg editor) -NEW: Autofill email form with the email template with status "Default" on -NEW: Bank name no more mandatory on creation. Can be generated if empty. +NEW: Bank: Bank name no more mandatory on creation. Can be generated if empty. NEW: Bank: Add fields zip, town, country for owner of a bank account NEW: batch referential objets NEW: Can add the add now link on date into addfieldvalue() NEW: Can bin accounting line for a given month -NEW: Can edit account on miscellaneous payment (if not transfered) NEW: Can edit inline the VAT number from supplier tab -NEW: Can fill date of salary payment with date of start of salary NEW: Can go back to draft on shipment when stock change not on validate NEW: Can modify bank account of sepa payment (if file not sent yet) -NEW: Customers: add date due and labels into customer comm card -NEW: Can select the export format during export of journals NEW: Can set a checkbox in formconfirm by clicking on the label -NEW: Can set flag default value on email templates NEW: Can set the page "List of opportunities" as landing page -NEW: Can show the sql request used on emailing selection +NEW: Can show the SQL request used on emailing selection NEW: can stay on edit field when errors occurs NEW: comment in api_mymodule for seperate methods NEW: create email substitution variable for intervention signature URL +NEW: Contacts: presend mass action in contact list +NEW: Contacts: hook printFieldListFrom in contact list +NEW: Customers: add date due and labels into customer comm card NEW: Debug the custom CSS feature to avoid a directory search/scan at NEW: dev name NEW: Disable bad reputation product price -NEW: dolExplodeIntoArray can accept regex -NEW: dol_sort_array can sort on alphabetical order even if val is num -NEW: element time integration code + SQL +NEW: Email: autofill email form with the email template with status "Default" on NEW: Email: don't have closed contact proposed as receiver for the mails +NEW: Email: can set flag default value on email templates NEW: Email-Collector: add field reply-to in email collector as possible filter NEW: Email-Collector: substitute date now in email collector NEW: Email-Collector: operation type in email collector to load or create contact @@ -89,14 +81,15 @@ NEW: GUI: can set background style with MAIN_LOGIN_BACKGROUND_STYLE NEW: Help: Tooltip to explain how to add a photo on a product NEW: Help: Possibility to link to German pages in help NEW: helper functions for dates + small demo case -NEW: hook printFieldListFrom in contact list +NEW: HR - Salary: can fill date of salary payment with date of start of salary NEW: HR - Salary: can modify the date of payment of a salary (if not reconciled) NEW: HR - Salary: date for salary payment includes the hour/min NEW: HR - Salary: adding button Send Email on the salary file NEW: Import: filter on entity in import NEW: Import: map table to element for get entity in import NEW: inc.php: handle parameters from argv -NEW: Invoice - show category of operations +NEW: Installation: Auto activate some modules on install (Export/Import/Wysiwyg editor) +NEW: Invoice: show category of operations NEW: Keep a link between user created from recruitment and application NEW: Mass Actions: Better responsive for mass actions NEW: Members: add numbering modules for members @@ -111,7 +104,8 @@ NEW: No overwrite of optionals during put() contact NEW: Notifications: add Customer Order delivered (ORDER_NEW) in module Notification NEW: Notifications: for Sign or Refused Propal from Online Page NEW: Now we can edit amount on VAT and salaries clone action -NEW: only get openned contact from liste_contact function, to not have acces to closed contact as mail receiver +NEW: only get opened contact from liste_contact function, to not have access to closed contact as mail receiver +NEW: Option: MAIN_SECURITY_MAXFILESIZE_DOWNLOADED #yogosha10660 NEW: Option to manage deposit slips for more payment modes (not only NEW: Option to show column for field and line selection on the left NEW: Orders: add sub total in order list det @@ -120,19 +114,21 @@ NEW: Orders export: allow to export field 'shipment method' NEW: payment default values when supplier order created from reception NEW: Payment: manage contracts NEW: Payment: sepaStripe now creates the payment mode with type pm_ using new API -NEW: presend mass action in contact list +NEW: Payment: add partial payment reason "withholding tax" +NEW: Payment: Can edit account on miscellaneous payment (if not transfered) NEW: Print PDF: category of operation for crabe PDF model NEW: Print PDF: Name and date to print on PDF Sign NEW: Print PDF: Use the more recent PDF templates for documents by default on a fresh install NEW: Print PDF: Option PDF_SHOW_PHONE_AFTER_USER_CONTACT to show phone after specific assigned contact on PDF NEW: Print PDF: Option PDF_SHOW_EMAIL_AFTER_USER_CONTACT to show email after specific assigned contact on PDF NEW: product images on popup are cached +NEW: Products: Add origin info when create a product batch when created from a movement stock NEW: Products: Add statistics by amount on statistics of products. +NEW: Products: Add SQL contraint on product_stock table to allow only exsting product and warehouse #23543 NEW: Proposals: filter for Signed+Billed in proposals NEW: Proposals: can modify margin rates in offers like VAT rates NEW: Proposals: option filter for NoSalesRepresentativeAffected in proposals list NEW: Proposals: constant PROPALE_ADDON_NOTE_PUBLIC_DEFAULT -NEW: Provide the oldcopy value when calling setValueFrom() function with a trigger key NEW: Reception: can receive more than qty ordered on reception NEW: referential objects of batch NEW: remove keys whose table element is the same as element in map list @@ -153,23 +149,24 @@ NEW: Supplier Invoices: add ability of ODT support to supplier invoices NEW: Stock limit for alert and desired optimal stock by product and warehouse import NEW: Stock: Add warehouse create and modify triggers. NEW: Stock: Can select several warehouses into the view stock at date in past +NEW: Stripe: add STRIPE_DEBUG, a way to log Stripe IPN NEW: Support different bank account for several direct debit payments NEW: Support multiselect in the warehouse selection combo box -NEW: Option: MAIN_SECURITY_MAXFILESIZE_DOWNLOADED #yogosha10660 NEW: Survey: Comment on survey is possible only after vote. -NEW: tables: llx_element_time to store time spent on several elements (mo, ticket...) NEW: TakePOS: adapt category and product pictures sizes on TakePOS NEW: TakePOS: limit load products in TakePOS NEW: The batch for remind on due date can be setup for using validation date NEW: The refresh link for IMAP collector is always visible -NEW: The upgrade process can be done by creating a file upgrade.unlock +NEW: Third-Party: use an ajax component to switch prospection status on thirdparty list NEW: Tickets: Send a notification email when ticket assigned NEW: Tickets: set ticket status to answered if the client has answered from the public interface NEW: Tickets: added an option to display the progress of tickets on the public interface NEW: Tickets: add link to thirdparty tickets history NEW: Tickets: notify also the contributor affected to a ticket if a new message public is post (add global TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ALSO_CONTRIBUTOR) +NEW: Upgrades: The upgrade process can be done by creating a file upgrade.unlock NEW: Use a cache file for external RSS in calendar NEW: Use by default the domain $dolibarr_main_url_root for SMTP HELO +NEW: Users: add a public virtual card page for each user NEW: VAT can be modified during add of line NEW: Website Module: Increment website counter on each page access in website module NEW: write all fields and their properties in asciidoc format @@ -177,8 +174,6 @@ NEW: Can add an array of several links in date selector NEW: Widgets: Implement MAIN_ACTIVATE_FILECACHE on birthday widget NEW: Widgets: Add widget "The next upcoming events" NEW: Widgets: Add widget of open opportunities -NEW: use an ajax component to switch prospection status on thirdparty list -NEW: Add partial payment reason "withholding tax" @@ -188,19 +183,24 @@ For developers or integrators: NEW: Make it possible to select hours and minutes in form_confirm NEW: add triggers on mailing NEW: Add a trigger when create a shipping line batch and fix propagate missing errors -NEW: add function for listiong objects from directory +NEW: add function for listing objects from directory NEW: add helplist property to describe fields of objects -NEW: Hooks: printFieldListFrom in contact list -NEW: Hooks: add hook in loadLotStock() in html.formproduct.class.php file, add hook 'llxFooter', Add hook online sign -NEW: Update lib parsedownto 1.7.4, phpspreadsheet lib to v1.12, ESCPOS v3.0, jquery, Stripe. NEW: API: Support contact in post() document API NEW: API: more APIs (update currency rate, upload of supplier documents, ...) +NEW: Hooks: printFieldListFrom in contact list +NEW: Hooks: add hook in loadLotStock() in html.formproduct.class.php file, add hook 'llxFooter', add hook online sign +NEW: Libraries: Update libs parsedownto 1.7.4, phpspreadsheet lib to v1.12, ESCPOS v3.0, jquery, Stripe. NEW: ModuleBuilder: updating in modulbuilder on tab Menu when adding object NEW: ModuleBuilder: add/edit permissions NEW: ModuleBuilder: better generated documentation NEW: add sent info in the parameters provided to the hook sendMailAfter NEW: add setAsSelectUser into factory for generic setup page NEW: add option keepspace into dol_string_nospecialchar() +NEW: dol_sort_array can sort on alphabetical order even if val is num +NEW: dolExplodeIntoArray can accept regex +NEW: element time integration code + SQL +NEW: tables: llx_element_time to store time spent on several elements (mo, ticket...) +NEW: Provide the oldcopy value when calling setValueFrom() function with a trigger key WARNING: diff --git a/SECURITY.md b/SECURITY.md index 02f3c4968dd..06d3378553a 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,16 +4,15 @@ This file contains some policies about the security reports on Dolibarr ERP CRM ## Supported Versions for security reports -| Version | Supported | -| ---------- | ---------------------- | -| <= 17.0.0 | :x: | -| >= 17.0.1 | :white_check_mark: | -| >= develop | :white_check_mark: | +Security report are valid only on current stable version (see https://dolibarr.org web site to get current stable version) or on development version (branch "develop" on https://github.com/Dolibarr/dolibarr). ## Reporting a Vulnerability -To report a vulnerability, for a private report, please use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new) (if you have permissions). -Alternatively send an email to security@dolibarr.org (for everybody) +To report a vulnerability, for a private report, you can: + +- Send your report on [https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US](https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US) (recommended for everybody) +- Or if you have permissions, use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new) +- Or send by email to security@dolibarr.org a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary ## Hunting vulnerabilities on Dolibarr @@ -39,12 +38,12 @@ We are happy to thank everyone who submits valid reports which help us improve t You must be the first reporter of the vulnerability (duplicate reports are closed). -You must send a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary. - You must avoid tests that could cause degradation or interruption of our service (refrain from using automated tools, and limit yourself about requests per second), that's why we recommand to install software on your own platform. You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability. +Reports are processed around once a month. + ## Scope for qualified vulnerabilities ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid": diff --git a/dev/setup/qodana/README.md b/dev/setup/qodana/README.md index 37b465cabc9..aa7ce3013d5 100644 --- a/dev/setup/qodana/README.md +++ b/dev/setup/qodana/README.md @@ -3,10 +3,10 @@ QODANA TUTO This README explains how to use qodana to generate static analytics reports on the code Install docker + apt install docker - -Install qodana - +Install qodana into ~/.loca/bin/qodana + curl -fsSL https://jb.gg/qodana-cli/install | bash To run inspection on CLI cd ~/git/dirtoscan diff --git a/dev/setup/sonarqube/README.md b/dev/setup/sonarqube/README.md new file mode 100644 index 00000000000..efb98f337a3 --- /dev/null +++ b/dev/setup/sonarqube/README.md @@ -0,0 +1,15 @@ += Install SonarQube locally + +Check you are using Install Java SDK 17 +java --version must show 61 + +To install java sdk 17 on ubuntu: +sudo apt update +sudo apt install -y openjdk-17-jdk + +Unzip the sonar package into a directory + +Edit the file conf/sonar.properties to modify port 9000 and 9001 (already used by Eclipse or xdebug) into 9080 and 9081 + +Launch sonar with +bin/linux*/sonar.sh console diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index ff7178a9ed3..b3d44ad6718 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -221,6 +221,7 @@ if (empty($conf->use_javascript_ajax)) { $editor = new DolEditor('formtestfield', isset($conf->global->FCKEDITOR_TEST) ? $conf->global->FCKEDITOR_TEST : 'Test', '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly); $editor->Create(); } else { + // CKEditor inline enabled with the contenteditable="true" print '
'; print $conf->global->FCKEDITOR_TEST; print '
'; diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index f5096960b8b..647f1688ddf 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -65,6 +65,9 @@ if (empty($reshook)) { if (!dolibarr_set_const($db, 'LDAP_SERVER_TYPE', GETPOST("type", 'aZ09'), 'chaine', 0, '', $conf->entity)) { $error++; } + if (!dolibarr_set_const($db, 'LDAP_USERACCOUNTCONTROL', GETPOST("userAccountControl", 'int'), 'chaine', 0, '', $conf->entity)) { + $error++; + } if (!dolibarr_set_const($db, 'LDAP_SERVER_PROTOCOLVERSION', GETPOST("LDAP_SERVER_PROTOCOLVERSION", 'aZ09'), 'chaine', 0, '', $conf->entity)) { $error++; } @@ -195,6 +198,11 @@ print ''.$langs->trans("Type").''; print $formldap->selectLdapServerType(getDolGlobalString('LDAP_SERVER_TYPE'), 'type'); print ' '; +// userAccountControl +print ''.$langs->trans("LDAPUserAccountControl").''; +print ''; +print ''.$langs->trans("LDAPUserAccountControlExample").''; + // Version print ''.$langs->trans("Version").''; print $formldap->selectLdapServerProtocolVersion(getDolGlobalString('LDAP_SERVER_PROTOCOLVERSION'), 'LDAP_SERVER_PROTOCOLVERSION'); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 6976682dc1f..7166b4f4853 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -116,14 +116,14 @@ if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { // Nom des champs d'edition pour modification d'un enregistrement $tabfieldvalue = array(); -$tabfieldvalue[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content"; +$tabfieldvalue[25] = "label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content"; if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $tabfieldvalue[25] .= ',content_lines'; } // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert = array(); -$tabfieldinsert[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content"; +$tabfieldinsert[25] = "label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content"; if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $tabfieldinsert[25] .= ',content_lines'; } @@ -168,6 +168,7 @@ $tabhelp[25] = array( 'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"), 'topic'=>''.$helpsubstit.'', + 'email_from'=>$langs->trans('ForceEmailFrom'), 'joinfiles'=>$langs->trans('AttachMainDocByDefault'), 'defaultfortype'=>$langs->trans("DefaultForTypeDesc"), 'content'=>''.$helpsubstit.'', @@ -575,7 +576,7 @@ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu $morejs = array(); $morecss = array(); -$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, defaultfortype, content_lines, content, enabled, active"; +$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, email_from,joinfiles, defaultfortype, content_lines, content, enabled, active"; $sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates"; $sql .= " WHERE entity IN (".getEntity('email_template').")"; if (!$user->admin) { @@ -805,15 +806,18 @@ if ($action == 'create') { print ''; // Show fields for topic, join files and body - $fieldsforcontent = array('topic', 'joinfiles', 'content'); + $fieldsforcontent = array('topic', 'email_from', 'joinfiles', 'content'); if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { - $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); + $fieldsforcontent = array('topic', 'email_from', 'joinfiles', 'content', 'content_lines'); } foreach ($fieldsforcontent as $tmpfieldlist) { // Topic of email if ($tmpfieldlist == 'topic') { print ''.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; } + if ($tmpfieldlist == 'email_from') { + print $form->textwithpicto($langs->trans("MailFrom"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist); + } if ($tmpfieldlist == 'joinfiles') { print ''.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; } @@ -827,6 +831,8 @@ if ($action == 'create') { // Input field if ($tmpfieldlist == 'topic') { print ''; + } elseif ($tmpfieldlist == 'email_from') { + print ''; } elseif ($tmpfieldlist == 'joinfiles') { print $form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1); } else { @@ -1088,7 +1094,7 @@ if ($num) { print ''; print ''; - $fieldsforcontent = array('topic', 'joinfiles', 'content'); + $fieldsforcontent = array('topic', 'email_from','joinfiles', 'content'); if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent[] = 'content_lines'; } @@ -1106,6 +1112,11 @@ if ($num) { print ''; print '
'."\n"; } + if ($tmpfieldlist == 'email_from') { + print ''.$form->textwithpicto($langs->trans("MailFrom"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; + print ''; + print '
'."\n"; + } if ($tmpfieldlist == 'joinfiles') { print ''.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1); diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 07ddb48dba4..e149544b634 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -208,6 +208,14 @@ print ''; +print ''.$langs->trans("MaxNumberOfFailedAuth").''; +print ''; +print ''; +print ' '.$langs->trans("FailedAuth"); +print ''; +print ''; + /* if (empty($conf->global->MAIN_APPLICATION_TITLE)) { $conf->global->MAIN_APPLICATION_TITLE = ""; diff --git a/htdocs/bookcal/admin/availabilities_extrafields.php b/htdocs/bookcal/admin/availabilities_extrafields.php index 190a44f339d..cf677ac6115 100644 --- a/htdocs/bookcal/admin/availabilities_extrafields.php +++ b/htdocs/bookcal/admin/availabilities_extrafields.php @@ -21,9 +21,9 @@ */ /** - * \file admin/availabilities_extrafields.php - * \ingroup bookcal - * \brief Page to setup extra fields of availabilities + * \file htdocs/bookcal/admin/availabilities_extrafields.php + * \ingroup bookcal + * \brief Page to setup extra fields of availabilities */ // Load Dolibarr environment @@ -87,13 +87,6 @@ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; print dol_get_fiche_end(); -// Buttons -if ($action != 'create' && $action != 'edit') { - print '
'; - print ''.$langs->trans("NewAttribute").''; - print "
"; -} - /* * Creation of an optional field diff --git a/htdocs/bookcal/admin/booking_extrafields.php b/htdocs/bookcal/admin/booking_extrafields.php index b4029a99338..de09660f63d 100644 --- a/htdocs/bookcal/admin/booking_extrafields.php +++ b/htdocs/bookcal/admin/booking_extrafields.php @@ -21,9 +21,9 @@ */ /** - * \file admin/booking_extrafields.php - * \ingroup bookcal - * \brief Page to setup extra fields of booking + * \file htdocs/bookcal/admin/booking_extrafields.php + * \ingroup bookcal + * \brief Page to setup extra fields of booking */ // Load Dolibarr environment @@ -87,13 +87,6 @@ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; print dol_get_fiche_end(); -// Buttons -if ($action != 'create' && $action != 'edit') { - print '
'; - print ''.$langs->trans("NewAttribute").''; - print "
"; -} - /* * Creation of an optional field diff --git a/htdocs/bookcal/admin/calendar_extrafields.php b/htdocs/bookcal/admin/calendar_extrafields.php index 284ad0be1ac..54b7b97407c 100644 --- a/htdocs/bookcal/admin/calendar_extrafields.php +++ b/htdocs/bookcal/admin/calendar_extrafields.php @@ -21,9 +21,9 @@ */ /** - * \file admin/calendar_extrafields.php - * \ingroup bookcal - * \brief Page to setup extra fields of calendar + * \file htdocs/bookcal/admin/calendar_extrafields.php + * \ingroup bookcal + * \brief Page to setup extra fields of calendar */ // Load Dolibarr environment diff --git a/htdocs/bookcal/class/booking.class.php b/htdocs/bookcal/class/booking.class.php index 897936f995b..9b2e68f84b7 100644 --- a/htdocs/bookcal/class/booking.class.php +++ b/htdocs/bookcal/class/booking.class.php @@ -111,7 +111,7 @@ class Booking extends CommonObject 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), - 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'picto'=>'user', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), + 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>-1, 'visible'=>-2,), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index ab1c3941076..ba2e28e3ac7 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -966,7 +966,7 @@ class BonPrelevement extends CommonObject if ($format == 'FRST' && $bac->frstrecur != 'FRST') { continue; } - if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR')) { + if ($format == 'RCUR' && $bac->frstrecur != 'RCUR') { continue; } } diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index c8122ec27c3..57f65320979 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -72,8 +72,10 @@ $bon = new BonPrelevement($db); $hookmanager->initHooks(array('withdrawalsreceiptslist')); $usercancreate = $user->rights->prelevement->bons->creer; +$permissiontodelete = $user->hasRight('prelevement', 'creer'); if ($type == 'bank-transfer') { $usercancreate = $user->rights->paymentbybanktransfer->create; + $permissiontodelete = $user->hasRight('paymentbybanktransfer', 'create'); } // Security check @@ -97,6 +99,61 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_amount = ""; } +// Mass actions + +// Delete draft +if (($massaction == "delete" || ($action == 'delete' && $confirm == 'yes')) && $permissiontodelete) { + $db->begin(); + $objecttmp = new BonPrelevement($db); + foreach ($toselect as $toselectid) { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + if ($objecttmp->status != $objecttmp::STATUS_DRAFT || $objecttmp->credite > 0 || $objecttmp->date_creation != null) { + $langs->load("errors"); + $nbignored++; + $TMsg[] = '
'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).'

'; + continue; + } + $result = $objecttmp->delete($user); + if ($result < 0) { // if delete returns is < 0, there is an error, we break and rollback later + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } else { + $nbok++; + } + } else { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + if (empty($error)) { + // Message for elements well deleted + if ($nbok > 1) { + setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); + } elseif ($nbok > 0) { + setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs'); + } else { + setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs'); + } + + // Message for elements which can't be deleted + if (!empty($TMsg)) { + sort($TMsg); + setEventMessages('', array_unique($TMsg), 'warnings'); + } + + $db->commit(); + } else { + $db->rollback(); + } + $massaction = ''; +} +$objectclass = 'BonPrelevement'; +$objectlabel = 'BonPrelevement'; +$uploaddir = $conf->prelevement->dir_output; +include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; /* * View @@ -194,6 +251,9 @@ $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); +if (!empty($permissiontodelete)) { + $arrayofmassactions['predeletedraft'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); +} $massactionbutton = $form->selectMassAction('', $arrayofmassactions); print '
'."\n"; @@ -221,7 +281,10 @@ if ($usercancreate) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type='.urlencode($type)); } -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1); + +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + $moreforfilter = ''; /*$moreforfilter.='
'; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 3a4128f01cf..4fbdf3f096b 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1552,8 +1552,11 @@ class Contact extends CommonObject if ($withpicto) { if ($withpicto < 0) { $result .= ''.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).''; + if ($withpicto != 2 && $withpicto != -2) { + $result .= ' '; + } } else { - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').'"'), 0, 0, $notooltip ? 0 : 1); } } if ($withpicto != 2 && $withpicto != -2) { @@ -2210,7 +2213,7 @@ class Contact extends CommonObject $return .= ''; if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) { - $return .= '
'.$this->thirdparty->getNomUrl(1).'
'; + $return .= '
'.$this->thirdparty->getNomUrl(1).'
'; } /*if (property_exists($this, 'phone_pro') && !empty($this->phone_pro)) { $return .= '
'.img_picto($langs->trans("Phone"), 'phone'); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 40ea623911e..d3564774f61 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1347,7 +1347,7 @@ while ($i < $imaxinloop) { // (Last) Name if (!empty($arrayfields['p.lastname']['checked'])) { print ''; - print $contactstatic->getNomUrl(1); + print $contactstatic->getNomUrl(-1); print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 21427edba07..621e4c84204 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -296,6 +296,14 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO if ($obj) { $from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>'; } + } elseif (preg_match('/from_template_(\d+)/', $fromtype, $reg)) { + $sql = 'SELECT rowid, email_from FROM '.MAIN_DB_PREFIX.'c_email_templates'; + $sql .= ' WHERE rowid = '.(int) $reg[1]; + $resql = $db->query($sql); + $obj = $db->fetch_object($resql); + if ($obj) { + $from = $obj->email_from; + } } else { $from = dol_string_nospecial(GETPOST('fromname'), ' ', array(",")).' <'.GETPOST('frommail').'>'; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2ee3fd3aa48..7858b406fda 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -57,12 +57,12 @@ abstract class CommonObject public $db; /** - * @var int The object identifier + * @var int The object identifier */ public $id; /** - * @var int The environment ID when using a multicompany module + * @var int The environment ID when using a multicompany module */ public $entity; @@ -83,38 +83,38 @@ abstract class CommonObject public $errors = array(); /** - * @var array To store error results of ->validateField() + * @var array To store error results of ->validateField() */ private $validateFieldsErrors = array(); /** - * @var string ID to identify managed object + * @var string ID to identify managed object */ public $element; /** - * @var int The related element + * @var int The related element */ public $fk_element; /** - * @var string Name to use for 'features' parameter to check module permissions user->rights->feature with restrictedArea(). - * Undefined means same value than $element. Can be use to force a check on another element for example for class of line, we mention here the parent element. + * @var string Name to use for 'features' parameter to check module permissions user->rights->feature with restrictedArea(). + * Undefined means same value than $element. Can be use to force a check on another element for example for class of line, we mention here the parent element. */ public $element_for_permission; /** - * @var string Name of table without prefix where object is stored + * @var string Name of table without prefix where object is stored */ public $table_element; /** - * @var string Name of subtable line + * @var string Name of subtable line */ public $table_element_line = ''; /** - * @var int 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table + * @var int 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table */ public $ismultientitymanaged; @@ -129,7 +129,7 @@ abstract class CommonObject public $array_options = array(); /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -174,7 +174,7 @@ abstract class CommonObject protected $table_ref_field = ''; /** - * @var integer 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user + * @var integer 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user */ public $restrictiononfksoc = 0; @@ -204,7 +204,7 @@ abstract class CommonObject public $fk_project; /** - * @var Project The related project object + * @var Project The related project object * @deprecated * @see project */ @@ -235,56 +235,57 @@ abstract class CommonObject public $thirdparty; /** - * @var User A related user + * @var User A related user * @see fetch_user() */ public $user; /** - * @var string The type of originating object ('commande', 'facture', ...). Note: on some object this field is called $origin_type + * @var string The type of originating object ('commande', 'facture', ...). Note: on some object this field is called $origin_type * @see fetch_origin() */ public $origin; /** - * @var int The id of originating object + * @var int The id of originating object * @see fetch_origin() */ public $origin_id; /** - * @var string The object's reference + * @var string The object's reference */ public $ref; /** - * @var string An external reference for the object + * @var string An external reference for the object */ public $ref_ext; /** - * @var string The object's previous reference + * @var string The object's previous reference */ public $ref_previous; /** - * @var string The object's next reference + * @var string The object's next reference */ public $ref_next; /** - * @var string Ref to store on object to save the new ref to use for example when making a validate() of an object + * @var string Ref to store on object to save the new ref to use for example when making a validate() of an object */ public $newref; /** - * @var int The object's status. Prefer use of status. + * @var int The object's status. Prefer use of status. + * @deprecated * @see setStatut() */ public $statut; /** - * @var int The object's status + * @var int The object's status * @see setStatut() */ public $status; @@ -370,50 +371,50 @@ abstract class CommonObject public $barcode_type_coder; /** - * @var int Payment method ID (cheque, cash, ...) + * @var int Payment method ID (cheque, cash, ...) * @see setPaymentMethods() */ public $mode_reglement_id; /** - * @var int Payment terms ID + * @var int Payment terms ID * @see setPaymentTerms() */ public $cond_reglement_id; /** - * @var int Demand reason ID + * @var int Demand reason ID */ public $demand_reason_id; /** - * @var int Transport mode ID (For module intracomm report) + * @var int Transport mode ID (For module intracomm report) * @see setTransportMode() */ public $transport_mode_id; /** - * @var int Payment terms ID + * @var int Payment terms ID * @deprecated Kept for compatibility * @see cond_reglement_id; */ public $cond_reglement; /** - * @var int Delivery address ID + * @var int Delivery address ID * @see setDeliveryAddress() * @deprecated */ public $fk_delivery_address; /** - * @var int Shipping method ID + * @var int Shipping method ID * @see setShippingMethod() */ public $shipping_method_id; /** - * @var string Shipping method label + * @var string Shipping method label * @see setShippingMethod() */ public $shipping_method; @@ -448,31 +449,31 @@ abstract class CommonObject public $last_main_doc; /** - * @var int Bank account ID sometimes, ID of record into llx_bank sometimes + * @var int Bank account ID sometimes, ID of record into llx_bank sometimes * @deprecated * @see $fk_account */ public $fk_bank; /** - * @var int Bank account ID + * @var int Bank account ID * @see SetBankAccount() */ public $fk_account; /** - * @var string Open ID + * @var string Open ID */ public $openid; /** - * @var string Public note + * @var string Public note * @see update_note() */ public $note_public; /** - * @var string Private note + * @var string Private note * @see update_note() */ public $note_private; @@ -484,31 +485,31 @@ abstract class CommonObject public $note; /** - * @var float Total amount before taxes + * @var float Total amount before taxes * @see update_price() */ public $total_ht; /** - * @var float Total VAT amount + * @var float Total VAT amount * @see update_price() */ public $total_tva; /** - * @var float Total local tax 1 amount + * @var float Total local tax 1 amount * @see update_price() */ public $total_localtax1; /** - * @var float Total local tax 2 amount + * @var float Total local tax 2 amount * @see update_price() */ public $total_localtax2; /** - * @var float Total amount with taxes + * @var float Total amount with taxes * @see update_price() */ public $total_ttc; @@ -525,22 +526,22 @@ abstract class CommonObject public $comments = array(); /** - * @var string The name + * @var string The name */ public $name; /** - * @var string The lastname + * @var string The lastname */ public $lastname; /** - * @var string The firstname + * @var string The firstname */ public $firstname; /** - * @var string The civility code, not an integer + * @var string The civility code, not an integer */ public $civility_id; @@ -559,9 +560,10 @@ abstract class CommonObject * @var integer|string $date_modification; */ public $date_modification; // Date last change (tms field) + /** * @var integer|string $date_modification; - * @deprecated Use date_modification + * @deprecated Use date_modification */ public $date_update; @@ -575,11 +577,13 @@ abstract class CommonObject * @TODO Merge with user_creation */ public $user_author; + /** * @var User|int User author/creation * @TODO Remove type id */ public $user_creation; + /** * @var int User id author/creation */ @@ -590,15 +594,18 @@ abstract class CommonObject * @TODO Merge with user_validation */ public $user_valid; + /** * @var User|int User of validation * @TODO Remove type id */ public $user_validation; + /** * @var int User id of validation */ public $user_validation_id; + /** * @var int User id closing object */ @@ -609,6 +616,7 @@ abstract class CommonObject * @TODO Remove type id */ public $user_modification; + /** * @var int User id last modifier */ @@ -623,26 +631,26 @@ abstract class CommonObject public $specimen = 0; /** - * @var int Id of contact to send object (used by the trigger of module Agenda) + * @var int Id of contact to send object (used by the trigger of module Agenda) */ public $sendtoid; /** - * @var float Amount already paid (used to show correct status) + * @var float Amount already paid (used to show correct status) */ public $alreadypaid; - public $labelStatus; + protected $labelStatusShort; /** - * @var int showphoto_on_popup + * @var int show photo on popup */ public $showphoto_on_popup; /** - * @var array nb used in load_stateboard + * @var array nb used in load_stateboard */ public $nb = array(); @@ -652,12 +660,12 @@ abstract class CommonObject public $output; /** - * @var array extraparams + * @var array extra parameters */ public $extraparams = array(); /** - * @var array List of child tables. To test if we can delete object. + * @var array List of child tables. To test if we can delete object. */ protected $childtables = array(); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 75729040138..58451817686 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -999,9 +999,9 @@ class ExtraFields } elseif ($type == 'radio') { $morecss = 'width25'; } else { - if (empty($size) || round($size) < 12) { + if (empty($size) || round((float) $size) < 12) { $morecss = 'minwidth100'; - } elseif (round($size) <= 48) { + } elseif (round((float) $size) <= 48) { $morecss = 'minwidth200'; } else { $morecss = 'minwidth400'; diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 2c0610084aa..1cc1244d8df 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -77,7 +77,7 @@ class HookManager * Then when a hook executeHooks('aMethod'...) is called, the method aMethod found into class will be executed. * * @param string[] $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ... - * @return int|void Always 1 + * @return int 0 or 1 */ public function initHooks($arraycontext) { @@ -85,7 +85,7 @@ class HookManager // Test if there is hooks to manage if (!is_array($conf->modules_parts['hooks']) || empty($conf->modules_parts['hooks'])) { - return; + return 0; } // For backward compatibility diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 73060a38d43..0cf52473a29 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -753,14 +753,14 @@ class FormCompany extends Form if ($disabled) { print ' disabled'; } - print ' selected>' . dol_trunc($obj->name, 24) . ''; + print ' selected>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . ''; $firstCompany = $obj->rowid; } else { print ''; + print '>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . ''; } $i++; } diff --git a/htdocs/core/class/html.formexpensereport.class.php b/htdocs/core/class/html.formexpensereport.class.php index 8b6d45be1c5..c08431b534e 100644 --- a/htdocs/core/class/html.formexpensereport.class.php +++ b/htdocs/core/class/html.formexpensereport.class.php @@ -75,7 +75,7 @@ class FormExpenseReport } foreach ($arrayoflabels as $key => $val) { if ($selected != '' && $selected == $key) { - $html .= '