diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 90ab6c01ccd..b87be10d64e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -7,12 +7,12 @@ Bug reports and feature requests *Note*: **GitHub Issues is not a support forum.** If you have questions about Dolibarr / need help using the software, please use [the forums](https://www.dolibarr.org/forum.php). Forums exist in different languages. Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues). -Default **language here is english**. So please prepare your contributions in english. +Default **language here is English**. So please prepare your contributions in English. 1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem. 2. [Create an issue](https://help.github.com/articles/creating-an-issue). Choose an appropriate title. Prepend appropriately with Bug or Feature Request. 3. Tell us the version you are using! (look at /htdocs/admin/system/dolibarr.php? and check if you are using the latest version) -4. Write a report with as much detail as possible (Use [screenshots](https://help.github.com/articles/issue-attachments) or even screencasts and provide logging and debugging informations whenever possible). +4. Write a report with as much detail as possible (Use [screenshots](https://help.github.com/articles/issue-attachments) or even screencasts and provide logging and debugging information whenever possible). 5. Delete unnecessary submissions. 6. **Check your Message at Preview before sending.** @@ -45,12 +45,12 @@ The rule N - 2 is just a tip if you don't know which version to choose to get th and number of potential beneficiaries of the correction. ### General rules -Please don't edit the ChangeLog file. File will be generated from all commit messages during release process by the project manager. +Please don't edit the ChangeLog file. This file is generated from all commit messages during release process by the project manager. ### Commits Use clear commit messages with the following structure: -``` +```plaintext [KEYWORD] [ISSUENUM] DESC LONGDESC @@ -68,12 +68,12 @@ where #### Keyword In uppercase if you want to have the log comment appears into the generated ChangeLog file. -The keyword can be ommitted if your commit does not fit in any of the following categories: +The keyword can be omitted if your commit does not fit in any of the following categories: - Fix/FIX: for a bug fix - Close/CLOSE: for closing a referenced feature request -- New/NEW: for an unreferenced new feature (Opening a feature request and using close is prefered) -- Perf/PERF: for performance enhancement +- New/NEW: for an unreferenced new feature (Opening a feature request and using close is preferred) +- Perf/PERF: for a performance enhancement - Qual/QUAL: for quality code enhancement or re-engineering #### Issuenum @@ -150,7 +150,7 @@ All other translations are managed online at [Transifex](https://www.transifex.c Translations done on transifex are available in the next major release. -Note: Sometimes, the source text (english) is modified. In such a case, the translation is reset. Transifex assume that if the original source +Note: Sometimes, the source text (English) is modified. In such a case, the translation is reset. Transifex assume that if the original source has changed, the translation is surely no more correct so must be done again. But old translation is not lost and you can use the tab "History" to retrieve all old translation of a source text, and restore the translation in one click with no need to retranslate it if there is no need to. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index d7dc3d584e3..3795b1b7222 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -68,4 +68,4 @@ body: id: files attributes: label: Attached files - description: Screenshots, screencasts, dolibarr.log, debugging informations + description: Screenshots, screencasts, dolibarr.log, debugging information diff --git a/.github/workflows/github_ci_php71_pgsql.yml.disabled b/.github/workflows/github_ci_php71_pgsql.yml.disabled index 856e2eb18a5..d324d1c1481 100644 --- a/.github/workflows/github_ci_php71_pgsql.yml.disabled +++ b/.github/workflows/github_ci_php71_pgsql.yml.disabled @@ -235,7 +235,7 @@ jobs: sudo cat /etc/apache2/sites-enabled/000-default.conf sudo service apache2 restart curl -I localhost - - name: Chech Apache availability + - name: Check Apache availability run: | echo "Checking webserver availability by a wget -O - --debug http://127.0.0.1" # Ensure we stop on error with set -e diff --git a/.github/workflows/github_ci_php81_mysql.yml.disabled b/.github/workflows/github_ci_php81_mysql.yml.disabled index c1f78f2033a..047fcd63fb5 100644 --- a/.github/workflows/github_ci_php81_mysql.yml.disabled +++ b/.github/workflows/github_ci_php81_mysql.yml.disabled @@ -190,7 +190,7 @@ jobs: sudo cat /etc/apache2/sites-enabled/000-default.conf sudo service apache2 restart curl -I localhost - - name: Chech Apache availability + - name: Check Apache availability run: | echo "Checking webserver availability by a wget -O - --debug http://127.0.0.1" # Ensure we stop on error with set -e diff --git a/ChangeLog b/ChangeLog index a70b7b6da76..8cbe117b234 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,7 +8,9 @@ English Dolibarr ChangeLog For users: ---------- NEW: Compatibility with PHP 8.2 +NEW: Module for Advanced stock transfert is now stable (#26594) NEW: Add a confirmation popup when deleting extrafields +NEW: Add type 'icon' type for extrafields NEW: Close #20930 Use ajax for state loading after country change NEW: #23331 Add support for parent projects (#24856) NEW: #22531 Expense report - Add two fields into export : Qty & Unit price (excl.) (#26309) @@ -101,7 +103,6 @@ NEW: Date d'entree en stock sur les exped au moment de la création NEW: Date field for shipment export (#25574) NEW: Date format dayhoursec is using year on 2 char on smartphones NEW: Default customer, category and product when enable TakePOS (#25031) -NEW: Disable not used PHP streams NEW: do not add default value in list NEW: drop down for action button show a simple button if only 1 action NEW: Enhance github_commits_perversion to get more stats on git commits @@ -172,6 +173,7 @@ NEW: When an user unset the batch management of products, transformation of each SEC: #25512 applicative anti bruteforce - security on too many login attempts (#25520) SEC: Add action confirm_... as sensitive to need a CSRF token +SEC: Disable not used PHP streams For developers or integrators: diff --git a/README-FR.md b/README-FR.md index 74be3f1754c..105c2ac6ef9 100644 --- a/README-FR.md +++ b/README-FR.md @@ -70,7 +70,7 @@ Note: *Le processus de migration peut être lancé manuellement et plusieurs foi ## CE QUI EST NOUVEAU -See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file. +Voir le fichier [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog). ## CE QUE DOLIBARR PEUT FAIRE @@ -88,11 +88,11 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Gestion de contrats de services - Gestion de stock et inventaires - Gestion des expéditions -- Gestion des demandes de congès +- Gestion des demandes de congés - Gestion des notes de frais - Gestion de recrutement - GED (Gestion Electronique de Documents) -- EMailings de masse +- E-Mailings de masse - Réalisation de sondages - Gestion d'adhérents - Point de vente/Caisse enregistreuse @@ -107,17 +107,17 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Support des codes barres - Calcul des marges - Connectivité LDAP -- Intégratn de ClickToDial +- Intégration de ClickToDial - Intégration RSS -- Intégation Skype -- Intégration de système de paiements (Paypal, Stripe, Paybox...) +- Intégration Skype +- Intégration de système de paiements (PayPal, Stripe, Paybox...) - … ### Divers - Multi-langue. - Multi-utilisateurs avec différents niveaux de permissions par module. -- Multi-devise. +- Multidevise. - Peux être multi-société par ajout du module externe multi-société. - Plusieurs thèmes visuels. - Application simple à utiliser. @@ -127,7 +127,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Génération PDF et ODT des éléments (factures, propositions commerciales, commandes, bons expéditions, etc...) - Code simple et facilement personnalisable (pas de framework lourd; mécanisme de hook et triggers). - Support natif de nombreuses fonctions spécifiques aux pays comme: - - La tax espagnole TE et ISPF + - La taxe espagnole TE et ISPF - Gestion de la TVA NPR (non perçue récupérable - pour les utilisateurs français des DOM-TOM) - La loi française Finance 2016 et logiciels de caisse - La double taxe canadienne @@ -139,7 +139,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) ### Extension -Dolibarr peut aussi être étendu à volonté avec l'ajout de module/applications externes développées par des développeus tiers, disponible sur [DoliStore](https://www.dolistore.com). +Dolibarr peut aussi être étendu à volonté avec l'ajout de modules/applications externes développées par des développeurs tiers, disponible sur [DoliStore](https://www.dolistore.com). ## CE QUE DOLIBARR NE PEUT PAS (ENCORE) FAIRE @@ -168,15 +168,15 @@ Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/CO ## ACTUALITES ET RESEAUX SOCIAUX -Suivez le projet Dolibarr project sur les réseaux francophones +Suivez le projet Dolibarr sur les réseaux francophones - [Facebook](https://www.facebook.com/dolibarr.fr) -- [Twitter](https://www.twitter.com/dolibarr_france) +- [X](https://www.twitter.com/dolibarr_france) ou sur les réseaux anglophones - [Facebook](https://www.facebook.com/dolibarr) -- [Twitter](https://www.twitter.com/dolibarr) +- [X](https://www.twitter.com/dolibarr) - [LinkedIn](https://www.linkedin.com/company/association-dolibarr) - [YouTube](https://www.youtube.com/user/DolibarrERPCRM) - [GitHub](https://github.com/Dolibarr/dolibarr) diff --git a/README.md b/README.md index 761b952983b..4645176a3f5 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) Product Management -- Products and/or Services catalog +- Products and/or Services catalogue - Stock / Warehouse management + Inventory - Barcodes - Batches / Lots / Serials @@ -239,7 +239,7 @@ See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) fil Follow Dolibarr project on: - [Facebook](https://www.facebook.com/dolibarr) -- [Twitter](https://www.twitter.com/dolibarr) +- [X](https://x.com/dolibarr) - [LinkedIn](https://www.linkedin.com/company/association-dolibarr) - [Reddit](https://www.reddit.com/r/Dolibarr_ERP_CRM/) - [YouTube](https://www.youtube.com/user/DolibarrERPCRM) diff --git a/SECURITY.md b/SECURITY.md index a64518800a4..953059e625f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -20,9 +20,9 @@ We believe that the future of software is online SaaS. This means software are m If you believe you've found a security bug in our service, we are happy to work with you to resolve the issue promptly and ensure you are fairly rewarded for your discovery. -Any type of denial of service attacks is strictly forbidden, as well as any interference with network equipment and Dolibarr infrastructure. +Any type of denial-of-service attack is strictly forbidden, as well as any interference with network equipment and Dolibarr infrastructure. -We recommand to install Dolibarr ERP CRM on your own server (as most Open Source software, download and use is free: [https://www.dolibarr.org/download](https://www.dolibarr.org/download)) to get access on every side of application. +We recommend to install Dolibarr ERP CRM on your own server (as most Open Source software, download and use is free: [https://www.dolibarr.org/download](https://www.dolibarr.org/download)) to get access on every side of application. ### User Agent @@ -30,7 +30,7 @@ If you try to find bug on Dolibarr, we recommend to append to your user-agent he ### Account access -You can install the web application yourself on your own platform/server so you get full access to application and sources. Download the zip of the files to put into your own web server virtual host from [https://www.dolibarr.org/download](https://www.dolibarr.org/download) +You can install the web application yourself on your own platform/server so you get full access to application and sources. Download the zip of the files to put in your own web server virtual host from [https://www.dolibarr.org/download](https://www.dolibarr.org/download) ## Eligibility and Responsible Disclosure @@ -38,7 +38,7 @@ 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 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 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 recommend to install software on your own platform. You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability. @@ -48,27 +48,27 @@ Reports are processed around once a month. ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid": -* The version to analyze must be the last version available into "develop" branch or into last stable "vX.Y" released version. Reports on vulnerabilities already fixed (so already reported) into the develop branch will not be validated. -* $dolibarr_main_prod must be set to 1 into conf.php -* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value) +* The version to analyze must be the last version available in the "develop" branch or in the last stable "vX.Y" released version. Reports on vulnerabilities already fixed (so already reported) in the develop branch will not be validated. +* $dolibarr_main_prod must be set to 1 in conf.php +* $dolibarr_nocsrfcheck must be kept to the value 0 in conf.php (this is the default value) * $dolibarr_main_force_https must be set to something else than 0. -* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 into backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default). CSRF attacks are accepted but +* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 in the backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default). CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3. -* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities). +* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles in "experimental", "development" or external modules are not valid vulnerabilities). * The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer). * The web server setup must be done so that only the documents directory is in write mode. The root directory called htdocs must be read-only. * The modules DebugBar and ModuleBuilder must NOT be enabled. (by default, these modules are not enabled. They are developer tools) -* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user. -* Fail2ban rules for rate limit on the login page,password forgotten page, api calls and all public pages (/public/*) must be installed as recommendend into the section "About - Admin tools - Section Access limits and mitigation". +* Ability for a high-level user to edit web site pages in the CMS by including HTML or JavaScript is an expected feature. Vulnerabilities in the website module are validated only if HTML or JavaScript injection can be done by a non-allowed user. +* Fail2ban rules for rate limit on the login page, forgotten password page, API calls and all public pages (/public/*) must be installed as recommended in the section "About - Admin tools - Section Access limits and mitigation". -Scope is the web application (back office) and the APIs. +Scope is the web application (backoffice) and the APIs. ## Examples of vulnerabilities that are Qualified for reporting. * Remote code execution (RCE) * Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA) * Code injections (JS, SQL, PHP). HTML are covered only for fields that are not description, notes or comments fields (where rich content is allowed on purpose). -* Cross-Site Scripting (XSS), except from setup page of module "External web site" (allowing any content here, editable by admin user only, is accepted on purpose) and except into module "Web site" when permission to edit website content is allowed (injecting any data in this case is allowed too). +* Cross-Site Scripting (XSS), except from setup page of module "External web site" (allowing any content here, editable by admin user only, is accepted on purpose) and except in the module "Web site" when permission to edit website content is allowed (injecting any data in this case is allowed too). * Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users) * Open redirect * Broken authentication & session management @@ -76,8 +76,8 @@ Scope is the web application (back office) and the APIs. * Cross-Origin Resource Sharing (CORS) with real security impact * Horizontal and vertical privilege escalation * "HTTP Host Header" XSS -* Software version disclosure (for non admin users only) -* Stack traces or path disclosure (for non admin users only) +* Software version disclosure (for non-admin users only) +* Stack traces or path disclosure (for non-admin users only) ## Examples of vulnerabilities that are Non-qualified for reporting. @@ -95,5 +95,5 @@ Scope is the web application (back office) and the APIs. * Reports on features flagged as "experimental" or "development" * Software version or private IP disclosure when logged-in user is admin * Stack traces or path disclosure when logged-in user is admin -* Any vulnerabilities due to a configuration different than the one defined into chapter "Scope for qualified vulnerabilities". +* Any vulnerabilities due to a configuration different than the one defined in chapter "Scope for qualified vulnerabilities". * Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the fail2ban recommended fail2ban rules were not installed. diff --git a/build/docker/README.md b/build/docker/README.md index fbf9b05851c..6daf6d6bd5c 100644 --- a/build/docker/README.md +++ b/build/docker/README.md @@ -1,7 +1,7 @@ # How to use it ? The docker-compose.yml file is a sample of a config file to use to build and run Dolibarr in the current workspace with Docker. -This docker image is intended for developpement usage. +This docker image is intended for development usage. For production usage you should consider other contributor reference like https://hub.docker.com/r/tuxgasy/dolibarr Before build/run, define the variable HOST_USER_ID as following: diff --git a/htdocs/admin/supplierinvoice_rec_extrafields.php b/htdocs/admin/supplierinvoice_rec_extrafields.php new file mode 100644 index 00000000000..2fda69ff695 --- /dev/null +++ b/htdocs/admin/supplierinvoice_rec_extrafields.php @@ -0,0 +1,109 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 Florian Henry + * Copyright (C) 2013-2018 Philippe Grand + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2023 Nick Fragoulis + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/supplierinvoice_rec_extrafields.php + * \ingroup fourn + * \brief Page to setup extra fields of recurring supplierinvoice + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("admin", "other", "bills", "orders", "suppliers")); + +if (!$user->admin) { + accessforbidden(); +} + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) { + $type2label[$key] = $langs->transnoentitiesnoconv($val); +} + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'facture_fourn_rec'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject = $langs->transnoentitiesnoconv("BillsSuppliers"); + +llxHeader('', $langs->trans("SuppliersSetup")); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup'); +print "
\n"; + +$head = supplierorder_admin_prepare_head(); + +print dol_get_fiche_head($head, 'attributesrec', $langs->trans("Suppliers"), -1, 'company'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +// Creation of an optional field +if ($action == 'create') { + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +// Edition of an optional field +if ($action == 'edit' && !empty($attrname)) { + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/supplierinvoicedet_rec_extrafields.php b/htdocs/admin/supplierinvoicedet_rec_extrafields.php new file mode 100644 index 00000000000..666430611d8 --- /dev/null +++ b/htdocs/admin/supplierinvoicedet_rec_extrafields.php @@ -0,0 +1,111 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 Florian Henry + * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Claudio Aschieri + * Copyright (C) 2023 Nick Fragoulis + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/supplierinvoicedet_rec_extrafields.php + * \ingroup fourn + * \brief Page to setup extra fields of recurring supplierinvoice line + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + + +if (!$user->admin) { + accessforbidden(); +} + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'other', 'bills', 'orders', 'suppliers')); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) { + $type2label[$key] = $langs->transnoentitiesnoconv($val); +} + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'facture_fourn_det_rec'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject = $langs->transnoentitiesnoconv("BillsSuppliers"); + +llxHeader('', $langs->trans("SuppliersSetup")); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup'); +print "
\n"; + +$head = supplierorder_admin_prepare_head(); + +print dol_get_fiche_head($head, 'attributeslinesrec', $langs->trans("Suppliers"), -1, 'company'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +// Creation of an optional field +if ($action == 'create') { + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +// Edition of an optional field +if ($action == 'edit' && !empty($attrname)) { + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 5a17bba35d9..52ed7a2b3c7 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -42,6 +42,14 @@ if ($user->socid) { $result = restrictedArea($user, 'banque', '', ''); $search_ref = GETPOST('search_ref', 'alpha'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); $search_account = GETPOST('search_account', 'int'); $search_amount = GETPOST('search_amount', 'alpha'); $mode = GETPOST('mode', 'alpha'); @@ -63,8 +71,6 @@ if (!$sortfield) { $sortfield = "bc.date_bordereau"; } -$year = GETPOST("year"); -$month = GETPOST("month"); $optioncss = GETPOST('optioncss', 'alpha'); $view = GETPOST("view", 'alpha'); @@ -83,18 +89,48 @@ foreach ($arrayofpaymentmodetomanage as $key => $val) { $arrayoflabels[$key] = $labelval; } +$arrayfields = array( + 'bc.ref' => array('label'=>"Ref", 'checked'=>1, 'position'=>10), + 'bc.type' => array('label'=>"Type", 'checked'=>1, 'position'=>20), + 'bc.date_bordereau' => array('label'=>"DateCreation", 'checked'=>1, 'position'=>30), + 'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>40), + 'bc.nbcheque' => array('label'=>"NbOfCheques", 'checked'=>1, 'position'=>50), + 'bc.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>60), + 'bc.statut' => array('label'=>"Status", 'checked'=>1, 'position'=>70) +); +$arrayfields = dol_sort_array($arrayfields, 'position'); + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('chequelist')); +$object = new RemiseCheque($db); /* * Actions */ -// If click on purge search criteria ? -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers - $search_ref = ''; - $search_amount = ''; - $search_account = ''; - $year = ''; - $month = ''; +$parameters = array('socid'=>$socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + $search_ref = ''; + $search_amount = ''; + $search_account = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + } } @@ -103,12 +139,19 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' * View */ +$form = new Form($db); + llxHeader('', $langs->trans("ChequeDeposits")); $sql = "SELECT bc.rowid, bc.ref, bc.date_bordereau,"; $sql .= " bc.nbcheque, bc.amount, bc.statut, bc.type,"; $sql .= " ba.rowid as bid, ba.label"; +// Add fields from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sqlfields = $sql; // $sql fields to remove for count total $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,"; @@ -126,7 +169,17 @@ if ($search_account > 0) { if ($search_amount) { $sql .= natural_search("bc.amount", price2num($search_amount)); } -$sql .= dolSqlDateFilter('bc.date_bordereau', 0, $month, $year); +if ($search_date_start) { + $sql .= " AND bc.date_bordereau >= '" . $db->idate($search_date_start) . "'"; +} +if ($search_date_end) { + $sql .= " AND bc.date_bordereau <= '" . $db->idate($search_date_end) . "'"; +} + +// Add where from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; // Count total nb of records $nbtotalofrecords = ''; @@ -149,6 +202,7 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $db->free($resql); } +// Complete request and execute it with limit $sql .= $db->order($sortfield, $sortorder); if ($limit) { $sql .= $db->plimit($limit + 1, $offset); @@ -166,9 +220,33 @@ if ($resql) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.$contextpage; } + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); + } + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + } + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); + } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.$limit; } + if ($search_amount != '') { + $param .= '&search_amount='.urlencode($search_amount); + } + if ($search_account > 0) { + $param .= '&search_account='.urlencode($search_account); + } $url = DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'; if (!empty($socid)) { @@ -195,54 +273,157 @@ if ($resql) { print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit); - $moreforfilter = ''; + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields + $massactionbutton = ''; + if ($massactionbutton) { + $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); + } + $moreforfilter = ''; print '
'; - print ''."\n"; + print '
'; // Fields title search - print ''; - print ''; - // Type - print ''; - print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; } - print ''; - print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + + // Filter: Ref + if (!empty($arrayfields['bc.ref']['checked'])) { + print ''; + } + + // Filter: Type + if (!empty($arrayfields['bc.type']['checked'])) { + print ''; + } + + // Filter: Date + if (!empty($arrayfields['bc.date_bordereau']['checked'])) { + print ''; + } + + // Filter: Bank account + if (!empty($arrayfields['ba.label']['checked'])) { + print ''; + } + + // Filter: Number of cheques + if (!empty($arrayfields['bc.nbcheque']['checked'])) { + print ''; + } + + // Filter: Amount + if (!empty($arrayfields['bc.amount']['checked'])) { + print ''; + } + + // Filter: Status (only placeholder) + if (!empty($arrayfields['bc.statut']['checked'])) { + print ''; + } + + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields); + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print "\n"; + $totalarray = array(); + $totalarray['nbfield'] = 0; + + // Fields title label + // -------------------------------------------------------------------- print ''; - print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "bc.type", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("NbOfCheques", $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bc.amount", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "bc.statut", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre(''); + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.ref']['checked'])) { + print_liste_field_titre($arrayfields['bc.ref']['label'], $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.type']['checked'])) { + print_liste_field_titre($arrayfields['bc.type']['label'], $_SERVER["PHP_SELF"], "bc.type", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.date_bordereau']['checked'])) { + print_liste_field_titre($arrayfields['bc.date_bordereau']['label'], $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['ba.label']['checked'])) { + print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.nbcheque']['checked'])) { + print_liste_field_titre($arrayfields['bc.nbcheque']['label'], $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.amount']['checked'])) { + print_liste_field_titre($arrayfields['bc.amount']['label'], $_SERVER["PHP_SELF"], "bc.amount", "", $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.statut']['checked'])) { + print_liste_field_titre($arrayfields['bc.statut']['label'], $_SERVER["PHP_SELF"], "bc.statut", "", $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; + } + + // Hook fields + $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + $totalarray['nbfield']++; + } + print "\n"; + $checkedCount = 0; + foreach ($arrayfields as $column) { + if ($column['checked']) { + $checkedCount++; + } + } + if ($num > 0) { $savnbfield = 8; + $i = 0; + $totalarray = array(); + $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); @@ -273,48 +454,111 @@ if ($resql) { } else { print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Num ref cheque - print ''; + if (!empty($arrayfields['bc.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Type - $labelpaymentmode = ($langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) != "PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type); - print ''; + if (!empty($arrayfields['bc.type']['checked'])) { + $labelpaymentmode = ($langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) != "PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Date - print ''; + if (!empty($arrayfields['bc.date_bordereau']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Bank - print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; // Number of cheques - print ''; + if (!empty($arrayfields['bc.nbcheque']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Amount - print ''; + if (!empty($arrayfields['bc.amount']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (empty($totalarray['val']['amount'])) { + $totalarray['val']['amount'] = $objp->amount; + } else { + $totalarray['val']['amount'] += $objp->amount; + } + } - // Statut - print ''; + // Status + if (!empty($arrayfields['bc.statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } - print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } print "\n"; } $i++; } } else { - print ''; - print '"; - print ''; + // If no record found + if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''; + print '"; + print ''; + } } print "
'; - print ''; - print ''; - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; + // -------------------------------------------------------------------- + print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; - $form->select_comptes($search_account, 'search_account', 0, '', 1); - print ' '; - print ''; - print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print ''; + print ''; + print ''; + print ''; + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + $form->select_comptes($search_account, 'search_account', 0, '', 1); + print ' '; + print ''; + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; - print $checkdepositstatic->getNomUrl(1); - print ''; + print $checkdepositstatic->getNomUrl(1); + print ''.dol_escape_htmltag($labelpaymentmode).''.dol_escape_htmltag($labelpaymentmode).''.dol_print_date($db->jdate($objp->date_bordereau), 'dayhour', 'tzuser').''.dol_print_date($db->jdate($objp->date_bordereau), 'dayhour', 'tzuser').''; - if ($objp->bid) { - print ''.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.''; - } else { - print ' '; + if (!empty($arrayfields['ba.label']['checked'])) { + print ''; + if ($objp->bid) { + print ''.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.''; + } else { + print ' '; + } + print ''.$objp->nbcheque.''.$objp->nbcheque.''.price($objp->amount).''.price($objp->amount).''; - print $checkdepositstatic->LibStatut($objp->statut, 5); - print ''; + print $checkdepositstatic->LibStatut($objp->statut, 5); + print '
'.$langs->trans("None")."
' . $langs->trans("NoRecordFound") . "
"; print "
"; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 755c620446e..6e7e3090b1e 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2017-2021 Alexandre Spangaro + * Copyright (C) 2017-2023 Alexandre Spangaro * Copyright (C) 2018-2021 Ferran Marcet * Copyright (C) 2018 Charlene Benke * Copyright (C) 2020 Tobias Sekan @@ -368,7 +368,7 @@ if ($search_all) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields $massactionbutton = ''; if ($massactionbutton) { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); @@ -378,10 +378,19 @@ $moreforfilter = ''; print '
'; print ''; +// Fields title search +// -------------------------------------------------------------------- print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + // Filters: Lines (placeholder) -print ''; if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print ''; @@ -458,13 +467,22 @@ $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print ''; +// Action column +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} print ""; +// Fields title label +// -------------------------------------------------------------------- print ''; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +} if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); } @@ -501,7 +519,10 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +} + print ""; $checkedCount = 0; @@ -526,6 +547,14 @@ while ($i < min($num, $limit)) { print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // No if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print ''; @@ -644,10 +673,12 @@ while ($i < min($num, $limit)) { } } - // Buttons - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } print ''; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index d9199baa03c..a12f14741cb 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -748,14 +748,14 @@ if ($id > 0) { print ''; } - print '\n"; - print '\n"; + print '\n"; + print '\n"; $resteapayer = $object->amount - $totalpaid; $cssforamountpaymentcomplete = 'amountpaymentcomplete'; print '"; - print '\n"; + print '\n"; print "
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print '
'; print ''; -print $form->showFilterAndCheckAddButtons(0); -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'.(($offset * $limit) + $i).'
'.$langs->trans("AlreadyPaid").' :'.price($totalpaid)."
'.$langs->trans("AmountExpected").' :'.price($object->amount)."
'.$langs->trans("AlreadyPaid").' :'.price($totalpaid)."
'.$langs->trans("AmountExpected").' :'.price($object->amount)."
'.$langs->trans("RemainderToPay")." :'.price($resteapayer)."
'.price($resteapayer)."
"; print '
'; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index fbd4db0883b..a08357071b5 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -687,51 +687,30 @@ abstract class CommonInvoice extends CommonObject */ public function getSubtypeLabel($table = '') { + $subtypeLabel = ''; if ($table === 'facture' || $table === 'facture_fourn') { $sql = "SELECT s.label FROM " . MAIN_DB_PREFIX . $table . " AS f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "c_invoice_subtype AS s ON f.subtype = s.rowid"; $sql .= " WHERE f.ref = '".$this->db->escape($this->ref)."'"; - - $resql = $this->db->query($sql); - - if ($resql) { - $subtypeLabel = ''; - - while ($obj = $this->db->fetch_object($resql)) { - $subtypeLabel = $obj->label; - } - - if (!empty($subtypeLabel)) { - return $subtypeLabel; - } - } else { - dol_print_error($this->db); - return -1; - } } elseif ($table === 'facture_rec' || $table === 'facture_fourn_rec') { $sql = "SELECT s.label FROM " . MAIN_DB_PREFIX . $table . " AS f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "c_invoice_subtype AS s ON f.subtype = s.rowid"; $sql .= " WHERE f.titre = '".$this->db->escape($this->titre)."'"; - - $resql = $this->db->query($sql); - - if ($resql) { - $subtypeLabel = ''; - - while ($obj = $this->db->fetch_object($resql)) { - $subtypeLabel = $obj->label; - } - - if (!empty($subtypeLabel)) { - return $subtypeLabel; - } - } else { - dol_print_error($this->db); - return -1; - } + } else { + return -1; } - return ''; + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + $subtypeLabel = $obj->label; + } + } else { + dol_print_error($this->db); + return -1; + } + + return $subtypeLabel; } /** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a53e9cbaf0d..d8ba9353af9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -260,6 +260,21 @@ abstract class CommonObject */ public $origin_id; + /** + * @var Object Origin object. This is set by fetch_origin() from this->origin and this->origin_id. + */ + public $origin_object; + + // TODO Remove this. Has been replaced with ->origin_object. + // This is set by fetch_origin() from this->origin and this->origin_id + /** @deprecated */ + public $expedition; + /** @deprecated */ + public $livraison; + /** @deprecated */ + public $commandeFournisseur; + + /** * @var string The object's reference */ @@ -1870,7 +1885,9 @@ abstract class CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Read linked origin object + * Read linked origin object. + * Set ->origin_object + * Set also ->expedition or ->livraison or ->commandFournisseur (deprecated) * * @return void */ @@ -1883,15 +1900,18 @@ abstract class CommonObject if ($this->origin == 'delivery') { $this->origin = 'livraison'; } - if ($this->origin == 'order_supplier') { + if ($this->origin == 'order_supplier' || $this->origin == 'supplier_order') { $this->origin = 'commandeFournisseur'; } $origin = $this->origin; $classname = ucfirst($origin); - $this->$origin = new $classname($this->db); - $this->$origin->fetch($this->origin_id); + $this->origin_object = new $classname($this->db); + $this->origin_object->fetch($this->origin_id); + + // TODO Remove this line + $this->$origin = $this->origin_object; } /** @@ -10430,7 +10450,7 @@ abstract class CommonObject $project_result = $this->fetch_projet(); if ($project_result >= 0) { - $element = 'projet/'.dol_sanitizeFileName($object->project->ref).'/'; + $element = 'projet/'.dol_sanitizeFileName($this->project->ref).'/'; } default: $element = $this->element; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4aebc763344..9fae05f39e0 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -87,6 +87,7 @@ class ExtraFields 'mail'=>'ExtrafieldMail', 'url'=>'ExtrafieldUrl', 'ip'=>'ExtrafieldIP', + 'icon'=>'Icon', 'password' => 'ExtrafieldPassword', 'select' => 'ExtrafieldSelect', 'sellist' => 'ExtrafieldSelectList', @@ -225,7 +226,7 @@ class ExtraFields } elseif ($type == 'phone') { $typedb = 'varchar'; $lengthdb = '20'; - } elseif ($type == 'mail' || $type == 'ip') { + } elseif ($type == 'mail' || $type == 'ip' || $type == 'icon') { $typedb = 'varchar'; $lengthdb = '128'; } elseif ($type == 'url') { @@ -579,7 +580,7 @@ class ExtraFields } elseif ($type == 'phone') { $typedb = 'varchar'; $lengthdb = '20'; - } elseif ($type == 'mail' || $type == 'ip') { + } elseif ($type == 'mail' || $type == 'ip' || $type == 'icon') { $typedb = 'varchar'; $lengthdb = '128'; } elseif ($type == 'url') { @@ -1070,6 +1071,26 @@ class ExtraFields $out = ''; } elseif (in_array($type, array('mail', 'ip', 'phone', 'url'))) { $out = ''; + } elseif ($type == 'icon') { + $out =''; + $out.=''; + $out.= ''; + $out.=''; } elseif ($type == 'text') { if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -1652,6 +1673,8 @@ class ExtraFields $value = dol_print_email($value, 0, 0, 0, 64, 1, 1); } elseif ($type == 'ip') { $value = dol_print_ip($value, 0); + } elseif ($type == 'icon') { + $value = ''; } elseif ($type == 'url') { $value = dol_print_url($value, '_blank', 32, 1); } elseif ($type == 'phone') { @@ -1948,11 +1971,11 @@ class ExtraFields $cssstring = ''; - if (in_array($type, array('date', 'datetime', 'datetimegmt'))) { + if (in_array($type, array('date', 'datetime', 'datetimegmt',))) { $cssstring = "center"; } elseif (in_array($type, array('int', 'price', 'double'))) { $cssstring = "right"; - } elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip'))) { + } elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip', 'icon'))) { $cssstring = "center"; } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 817521f954b..d8dfe544584 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -996,7 +996,7 @@ class FormOther $file = $conf->$module->dir_temp.'/'.$name.'.png'; - // On cree le repertoire contenant les icones + // We create temp directory if (!file_exists($conf->$module->dir_temp)) { dol_mkdir($conf->$module->dir_temp); } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7f45bc2e4ab..411cc3f4234 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2882,7 +2882,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, //$original_file=$conf->barcode->dir_temp.'/'.$original_file; $original_file = ''; } elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp)) { - // Wrapping pour les icones de background des mailings + // Wrapping for icon of background of mailings $accessallowed = 1; $original_file = $conf->mailing->dir_temp.'/'.$original_file; } elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 3f2bcd48da7..767d1912bb2 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2006 Marc Barilley * Copyright (C) 2011-2013 Philippe Grand * Copyright (C) 2022-2023 Frédéric France + * Copyright (C) 2023 Nick Fragoulis * * 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 @@ -258,6 +259,8 @@ function supplierorder_admin_prepare_head() $extrafields->fetch_name_optionals_label('commande_fournisseurdet'); $extrafields->fetch_name_optionals_label('facture_fourn'); $extrafields->fetch_name_optionals_label('facture_fourn_det'); + $extrafields->fetch_name_optionals_label('facture_fourn_rec'); + $extrafields->fetch_name_optionals_label('facture_fourn_det_rec'); $h = 0; $head = array(); @@ -315,6 +318,24 @@ function supplierorder_admin_prepare_head() $head[$h][2] = 'supplierinvoicedet'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_rec_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesRec"); + $nbExtrafields = $extrafields->attributes['facture_fourn_rec']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } + $head[$h][2] = 'attributesrec'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoicedet_rec_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesLinesRec"); + $nbExtrafields = $extrafields->attributes['facture_fourn_det_rec']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } + $head[$h][2] = 'attributeslinesrec'; + $h++; + complete_head_from_modules($conf, $langs, null, $head, $h, 'supplierorder_admin', 'remove'); return $head; diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 719f135cec8..1861def1283 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -590,6 +590,8 @@ class pdf_strato extends ModelePDFContract // phpcs:enable global $conf, $langs, $hookmanager; + $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, (is_object($outputlangsbis) ? $outputlangsbis : null)); + $ltrdirection = 'L'; if ($outputlangs->trans("DIRECTION") == 'rtl') { $ltrdirection = 'R'; diff --git a/htdocs/core/modules/modStockTransfer.class.php b/htdocs/core/modules/modStockTransfer.class.php index b0b616e3b36..74f324ecace 100644 --- a/htdocs/core/modules/modStockTransfer.class.php +++ b/htdocs/core/modules/modStockTransfer.class.php @@ -63,7 +63,7 @@ class modStockTransfer extends DolibarrModules // Used only if file README.md and README-LL.md not found. $this->descriptionlong = "Advanced management of stock transfer orders with generation of stock transfer sheets"; // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' - $this->version = 'experimental'; + $this->version = 'dolibarr'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index de07c221bb2..c2fa8d38aa5 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1272,6 +1272,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTextColor(0, 0, 0); + $resteapayer = 0; /* $resteapayer = $object->total_ttc - $deja_regle; if (!empty($object->paye)) $resteapayer=0; @@ -1287,8 +1288,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0); /* - if ($object->close_code == 'discount_vat') - { + if ($object->close_code == 'discount_vat') { $index++; $pdf->SetFillColor(255,255,255); diff --git a/htdocs/core/triggers/dolibarrtriggers.class.php b/htdocs/core/triggers/dolibarrtriggers.class.php index 6690d2a2a40..d5da87dc121 100644 --- a/htdocs/core/triggers/dolibarrtriggers.class.php +++ b/htdocs/core/triggers/dolibarrtriggers.class.php @@ -143,6 +143,22 @@ abstract class DolibarrTriggers } } + /** + * setErrorsFromObject + * + * @param CommonObject $object commonobject + * @return void + */ + public function setErrorsFromObject($object) + { + if (!empty($object->error)) { + $this->errors = array_merge($this->errors, array($object->error)); + } + if (!empty($object->errors)) { + $this->errors = array_merge($this->errors, $object->errors); + } + } + /** * Function called when a Dolibarrr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 861eeda8a93..685973068a2 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -534,7 +534,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers if (isModEnabled('ficheinter') && isModEnabled('ticket') && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_CREATE_INTERVENTION)) { $fichinter = new Fichinter($this->db); $fichinter->socid = (int) $object->fk_soc; - $fichinter->fk_project = $projectid; + $fichinter->fk_project = (int) $object->fk_project; $fichinter->fk_contrat = (int) $object->fk_contract; $fichinter->author = $user->id; $fichinter->model_pdf = (!empty($conf->global->FICHEINTER_ADDON_PDF)) ? $conf->global->FICHEINTER_ADDON_PDF : 'soleil'; diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index e15867ae590..b6f1fd76950 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -205,7 +205,7 @@ class ActionsDatapolicy extends CommonHookActions /* print_r($parameters); print_r($object); echo "action: " . $action; */ if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' - $this->resprints = ''; + $this->resprints = ''; } if (!$error) { diff --git a/htdocs/emailcollector/README.md b/htdocs/emailcollector/README.md index 4c307183f19..beb1b69c66f 100644 --- a/htdocs/emailcollector/README.md +++ b/htdocs/emailcollector/README.md @@ -1,6 +1,6 @@ EMailCollector ============== -This module provides a sheduled job that scan regularly one or several IMAP email boxes, with filtering rules, to automatically record data in your application, like +This module provides a scheduled job that scan regularly one or several IMAP email boxes, with filtering rules, to automatically record data in your application, like * recording the email in the history of events (event is automatically linked to its related objects if possible, for example when a customer reply to an email sent from the application, the answer is automatically linked to the good objects) * and/or creating a lead diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3690c6e75d4..50ca67b83ab 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1755,7 +1755,8 @@ if ($action == 'create') { $typeobject = $object->origin; $origin = $object->origin; $origin_id = $object->origin_id; - $object->fetch_origin(); // Load property $object->commande, $object->propal, ... + + $object->fetch_origin(); // Load property $object->origin_object (old $object->commande, $object->propal, ...) } $soc = new Societe($db); @@ -1768,7 +1769,7 @@ if ($action == 'create') { $formconfirm = ''; - // Confirm deleteion + // Confirm deletion if ($action == 'delete') { $formquestion = array(); if ($object->statut == Expedition::STATUS_CLOSED && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { diff --git a/htdocs/fourn/js/lib_dispatch.js.php b/htdocs/fourn/js/lib_dispatch.js.php index d8df7dc2da8..1b4b799fc8f 100644 --- a/htdocs/fourn/js/lib_dispatch.js.php +++ b/htdocs/fourn/js/lib_dispatch.js.php @@ -125,7 +125,10 @@ function addDispatchLine(index, type, mode) { //create new select2 to avoid duplicate id of cloned one $row.find("select[name='" + 'entrepot_' + nbrTrs + '_' + index + "']").select2(); - // TODO find solution to copy selected option to new select + // Copy selected option to new select + let $prevRow = $("tr[name^='" + type + "_'][name$='_" + index + "']:last") + let $prevEntr = Number($prevRow.find("select[name='" + 'entrepot_' + (nbrTrs-1) + '_' + index + "']").val()) + $row.find("select[name='" + 'entrepot_' + nbrTrs + '_' + index + "']").val($prevEntr) // TODO find solution to keep new tr's after page refresh //clear value $row.find("input[name^='qty']").val(''); diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 4d737f98a51..b3ee63c311c 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -1103,6 +1103,36 @@ class Job extends CommonObject $return .= ''; return $return; } + /** + * function for get required skills associate to job object + * @param int $id Id of object + * @return array|int list of ids skillranks + */ + public function getSkillRankForJob($id) + { + if (empty($id)) { + return -1; + } + $skillranks = array(); + $sql = "SELECT rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."hrm_skillrank"; + $sql .= " WHERE fk_object = ".((int) $id); + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + $skillranks[] = $obj; + $i++; + } + $this->db->free($resql); + } else { + dol_print_error($this->db); + } + return $skillranks; + } } diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index b14ab679c30..3edb8e0eb90 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -234,9 +234,10 @@ class SkillRank extends CommonObject * * @param User $user User that creates * @param int $fromid Id of object to clone + * @param int $fk_object id of Job object (if new job object) * @return mixed New object created, <0 if KO */ - public function createFromClone(User $user, $fromid) + public function createFromClone(User $user, $fromid, $fk_object = 0) { global $langs, $extrafields; $error = 0; @@ -261,6 +262,10 @@ class SkillRank extends CommonObject unset($object->id); unset($object->fk_user_creat); unset($object->import_key); + if (!empty($fk_object) && $fk_object > 0) { + unset($object->fk_object); + } + // Clear fields if (property_exists($object, 'ref')) { @@ -278,6 +283,11 @@ class SkillRank extends CommonObject if (property_exists($object, 'date_modification')) { $object->date_modification = null; } + if (!empty($fk_object) && $fk_object > 0) { + if (property_exists($object, 'fk_object')) { + $object->fk_object = ($fk_object = 0 ? $this->fk_object : $fk_object); + } + } // ... // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) { diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php index 89c8c0a2412..0d458e7806e 100644 --- a/htdocs/hrm/job_card.php +++ b/htdocs/hrm/job_card.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php'; // Load translation files required by the page $langs->loadLangs(array('hrm', 'other', 'products')); // why products? @@ -120,7 +121,9 @@ if (empty($reshook)) { // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen - include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; + if ($action != 'confirm_clone') { + include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; + } // Actions when linking object each other include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; @@ -146,6 +149,56 @@ if (empty($reshook)) { $autocopy = 'MAIN_MAIL_AUTOCOPY_JOB_TO'; $trackid = 'job' . $object->id; include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; + + if ($action == 'confirm_clone' && $confirm != 'yes') { + $action = ''; + } + + if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->hasRight('salaries', 'write'))) { + $db->begin(); + + $originalId = $id; + + $object->fetch($id); + $skillRequire = $object->getSkillRankForJob($originalId); + if ($object->id > 0) { + $object->id = $object->ref = null; + + if (GETPOST('clone_label', 'alphanohtml')) { + $object->label = GETPOST('clone_label', 'alphanohtml'); + } else { + $object->label = $langs->trans("CopyOf").' '.$object->label; + } + if (GETPOST('clone_skills_required')) { + $cloneSkillRequired = GETPOST('clone_skills_required'); + } + + $id = $object->create($user); + if ($id > 0) { + if (!empty($cloneSkillRequired)) { + $i = 0; + while ($i < count($skillRequire)) { + $skillrank = new SkillRank($db); + $skillrank->createFromClone($user, $skillRequire[$i]->rowid, $id); + $i++; + } + } + $db->commit(); + $db->close(); + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } else { + $id = $originalId; + $db->rollback(); + + setEventMessages($object->error, $object->errors, 'errors'); + } + } else { + $db->rollback(); + dol_print_error($db, $object->error); + } + } } @@ -275,8 +328,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Clone confirmation if ($action == 'clone') { // Create an array for form - $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + $formquestion = array( + array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label), + array('type' => 'checkbox', 'name' => 'clone_skills_required', 'label' => $langs->trans("RequiredSkills"), 'value' => '',), + + ); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->label), 'confirm_clone', $formquestion, 'yes', 1, 280); } // Confirmation of action xxxx @@ -413,6 +470,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd); + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=clone&token=' . newToken(), '', $permissiontoadd); + // Delete (need delete permission, or if draft, just need create/modify permission) print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete); } diff --git a/htdocs/hrm/position_card.php b/htdocs/hrm/position_card.php index 15e01079200..76f21e7d244 100644 --- a/htdocs/hrm/position_card.php +++ b/htdocs/hrm/position_card.php @@ -193,6 +193,7 @@ function displayPositionCard(&$object) global $user, $langs, $db, $conf, $extrafields, $hookmanager, $action, $permissiontoadd, $permissiontodelete; $id = $object->id; + $ref = $object->ref; /* * View diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index 4dc0417d54d..e55631138bc 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -191,3 +191,10 @@ CREATE TABLE llx_mrp_production_extrafields ) ENGINE=innodb; ALTER TABLE llx_mrp_production_extrafields ADD INDEX idx_mrp_production_fk_object(fk_object); + +ALTER TABLE llx_salary ADD COLUMN ref_ext varchar(255); +ALTER TABLE llx_salary ADD COLUMN note_public text; + +ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN element_type varchar(50) DEFAULT 'supplier_order' NOT NULL; + +ALTER TABLE llx_expensereport DROP INDEX idx_expensereport_fk_refuse, ADD INDEX idx_expensereport_fk_refuse(fk_user_refuse); diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql index fa7cd92ba1f..6bbaea61c45 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql @@ -14,21 +14,23 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- This table is just an history table to track all receiving done for a +-- This table is just an history table to track all receiption to do or done for a -- particular supplier order. A movement with same information is also done -- into stock_movement so this table may be useless. -- -- Detail of each lines of a reception (qty, batch and into which warehouse must be -- received or has been receveived a purchase order line). --- This table should have been named llx_receptiondet_batch +-- +-- This table should be renamed into llx_receptiondet_batch -- =================================================================== create table llx_commande_fournisseur_dispatch ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_product integer, - fk_commande integer, - fk_commandefourndet integer, + fk_commande integer, -- should be renamed into fk_element + fk_commandefourndet integer, -- should be renamed into fk_elementdet + element_type varchar(50) DEFAULT 'supplier_order' NOT NULL, -- Type of source ('supplier_order', ...) fk_projet integer DEFAULT NULL, fk_reception integer DEFAULT NULL, qty float, -- qty to move diff --git a/htdocs/install/mysql/tables/llx_expedition.sql b/htdocs/install/mysql/tables/llx_expedition.sql index f61ab8224f0..f5c910af583 100644 --- a/htdocs/install/mysql/tables/llx_expedition.sql +++ b/htdocs/install/mysql/tables/llx_expedition.sql @@ -17,6 +17,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- +-- Note: a shipment is linked to an order or other object using llx_element_element table. -- =================================================================== create table llx_expedition @@ -31,11 +32,11 @@ create table llx_expedition ref_ext varchar(255), -- reference into an external system (not used by dolibarr) ref_customer varchar(255), -- customer number - date_creation datetime, -- date de creation + date_creation datetime, -- date of creation fk_user_author integer, -- author of creation fk_user_modif integer, -- author of last change - date_valid datetime, -- date de validation - fk_user_valid integer, -- valideur + date_valid datetime, -- date of validation + fk_user_valid integer, -- user that validate date_delivery datetime DEFAULT NULL, -- date planned of delivery date_expedition datetime, -- not used (deprecated) fk_address integer DEFAULT NULL, -- delivery address (deprecated) diff --git a/htdocs/install/mysql/tables/llx_expensereport.key.sql b/htdocs/install/mysql/tables/llx_expensereport.key.sql index cd882997085..329bb9089ff 100644 --- a/htdocs/install/mysql/tables/llx_expensereport.key.sql +++ b/htdocs/install/mysql/tables/llx_expensereport.key.sql @@ -27,7 +27,7 @@ ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_statut (fk_statut); ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_author (fk_user_author); ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_valid (fk_user_valid); ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_approve (fk_user_approve); -ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_approve); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_refuse); --ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); --ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); diff --git a/htdocs/install/mysql/tables/llx_reception.sql b/htdocs/install/mysql/tables/llx_reception.sql index d506215ee4a..26f9ed00863 100644 --- a/htdocs/install/mysql/tables/llx_reception.sql +++ b/htdocs/install/mysql/tables/llx_reception.sql @@ -17,6 +17,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- +-- Note: a reception is linked to a supplier order or other object using llx_element_element table. -- =================================================================== create table llx_reception @@ -29,7 +30,7 @@ create table llx_reception fk_projet integer DEFAULT NULL, ref_ext varchar(30), -- reference into an external system (not used by dolibarr) - ref_supplier varchar(255), -- supplier number + ref_supplier varchar(255), -- reference of reception on supplier side date_creation datetime, -- date de creation fk_user_author integer, -- author of creation diff --git a/htdocs/install/mysql/tables/llx_salary.sql b/htdocs/install/mysql/tables/llx_salary.sql index b68ac1e7a1e..92ac93511b9 100644 --- a/htdocs/install/mysql/tables/llx_salary.sql +++ b/htdocs/install/mysql/tables/llx_salary.sql @@ -1,6 +1,7 @@ -- =================================================================== --- Copyright (C) 2011-2018 Alexandre Spangaro --- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2011-2018 Alexandre Spangaro +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2023 Laurent Destailleur -- -- 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 @@ -14,13 +15,13 @@ -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . --- -- =================================================================== create table llx_salary ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) + ref_ext varchar(255), -- reference into an external system (not used by dolibarr) tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer NOT NULL, @@ -29,13 +30,14 @@ create table llx_salary salary double(24,8), -- salary of user when payment was done amount double(24,8) NOT NULL DEFAULT 0, fk_projet integer DEFAULT NULL, - fk_typepayment integer NOT NULL, - num_payment varchar(50), -- num cheque or other + fk_typepayment integer NOT NULL, -- default expected payment + num_payment varchar(50), -- num cheque or other (deprecated, now stored into the payment) label varchar(255), datesp date, -- date start period dateep date, -- date end period entity integer DEFAULT 1 NOT NULL, -- multi company id note text, + note_public text, fk_bank integer, paye smallint default 0 NOT NULL, fk_account integer, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d41cdccec91..3844ee142c0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2427,3 +2427,5 @@ LargeModern=Large - Modern SpecialCharActivation=Enable the button to open a virtual keyboard to enter special characters DeleteExtrafield=Delete extrafield ConfirmDeleteExtrafield=Confirm delete %s extrafield ? All data is going to be lost +ExtraFieldsSupplierInvoicesRec=Complementary attributes (templates invoices) +ExtraFieldsSupplierInvoicesLinesRec=Complementary attributes (invoice lines) diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md index 03cf25d74f4..2e63e69bd0b 100644 --- a/htdocs/modulebuilder/template/README.md +++ b/htdocs/modulebuilder/template/README.md @@ -17,7 +17,7 @@ Translations can be completed manually by editing files into directories *langs* diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 73c6bcbefe0..2bd89809c95 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -158,6 +158,33 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } +// Definition of fields for list +$arrayfields = array(); +$arrayfields['t.element_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1); +$arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1','checked'=>1); +$arrayfields['s.name_alias'] = array('label'=>$langs->trans("AliasNameShort"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1'); +if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task + if (! empty($allprojectforuser)) { + $arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => 1]; + $arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => 1]; + } + $arrayfields['t.element_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1); + $arrayfields['t.element_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1); +} +$arrayfields['author'] = array('label' => $langs->trans("By"), 'checked' => 1); +$arrayfields['t.note'] = array('label' => $langs->trans("Note"), 'checked' => 1); +if (isModEnabled('service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { + $arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1); +} +$arrayfields['t.element_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1); +$arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>isModEnabled("salaries")); +$arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time)); +// Extra fields +include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php'; + +$arrayfields = dol_sort_array($arrayfields, 'position'); + + $parameters = array('socid' => $socid, 'projectid' => $projectid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -1264,31 +1291,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Print form confirm print $formconfirm; - // Definition of fields for list - $arrayfields = array(); - $arrayfields['t.element_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1); - $arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1','checked'=>1); - $arrayfields['s.name_alias'] = array('label'=>$langs->trans("AliasNameShort"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1'); - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task - if (! empty($allprojectforuser)) { - $arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => 1]; - $arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => 1]; - } - $arrayfields['t.element_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1); - $arrayfields['t.element_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1); - } - $arrayfields['author'] = array('label' => $langs->trans("By"), 'checked' => 1); - $arrayfields['t.note'] = array('label' => $langs->trans("Note"), 'checked' => 1); - if (isModEnabled('service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { - $arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1); - } - $arrayfields['t.element_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1); - $arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>isModEnabled("salaries")); - $arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time)); - // Extra fields - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php'; - $arrayfields = dol_sort_array($arrayfields, 'position'); $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 913bfa11e94..131359ca999 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -122,6 +122,7 @@ if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); + $typeobject = ''; if (!empty($object->origin)) { $origin = $object->origin; @@ -129,11 +130,10 @@ if ($id > 0 || !empty($ref)) { $typeobject = $object->origin; } - // Linked documents - if ($origin == 'order_supplier' && $object->$typeobject->id && isModEnabled("supplier_order")) { - $origin_id = $object->$typeobject->id; - $objectsrc = new CommandeFournisseur($db); - $objectsrc->fetch($object->$typeobject->id); + // Set $origin_id and $objectsrc + if (($origin == 'order_supplier' || $origin == 'supplier_order') && is_object($object->origin_object) && isModEnabled("supplier_order")) { + $origin_id = $object->origin_object->id; + $objectsrc = $object->origin_object; } } diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 5eda8e9d1bc..12b894f6bed 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -191,7 +191,7 @@ if ($action == 'create') { print ''; - dol_set_focus('input[name="label"]'); + dol_set_focus('input[name="ref"]'); } elseif (($id || $ref) && $action == 'edit') { // Part to edit record print load_fiche_titre($langs->trans("ProductAttribute"), '', 'object_' . $object->picto); diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 1c8e79e824d..ff13faea433 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -100,7 +100,7 @@ class ProductAttribute extends CommonObject */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), - 'ref' => array('type'=>'varchar(255)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), + 'ref' => array('type'=>'varchar(255)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'width200'), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'ExternalRef', 'enabled' => 1, 'visible' => 0, 'position' => 20, 'searchall'=>1), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'help'=>"", 'showoncombobox'=>'1',), 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>40, 'notnull'=>1,), diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index d6fad65c570..9ff1b0da4b5 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -576,7 +576,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase $result=GETPOST("param15", 'restricthtml'); // param15 = src=>0xbeefed that is a dangerous string print __METHOD__." result=".$result."\n"; - $this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... + // $this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... //$this->assertEquals(' src=>0xbeefed', $result, 'Test 15b'); // ... on other PHP and libxml versions, we got a HTML that has been cleaned @@ -641,7 +641,22 @@ class SecurityTest extends PHPUnit\Framework\TestCase $_POST["pagecontentwithlinks"]=''; $result=GETPOST("pagecontentwithlinks", 'restricthtml'); print __METHOD__." result=".$result."\n"; - $this->assertEquals('TooManyLinksIntoHTMLString', $result, 'Test on limit on GETPOST fails'); + $this->assertEquals('ErrorTooManyLinksIntoHTMLString', $result, 'Test on limit on GETPOST fails'); + + // Test that img src="data:..." is excluded from the count of external links + $conf->global->MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT = 3; + $_POST["pagecontentwithlinks"]=''; + $result=GETPOST("pagecontentwithlinks", 'restricthtml'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('', $result, 'Test on limit on GETPOST fails'); + + // Test that no links is allowed + $conf->global->MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1; + $_POST["pagecontentwithlinks"]=''; + $result=GETPOST("pagecontentwithlinks", 'restricthtml'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('ErrorHTMLLinksNotAllowed', $result, 'Test on limit on GETPOST fails'); + return $result; }