2010-05-03 08:22:35 +00:00
|
|
|
<?php
|
2014-02-17 14:21:19 +00:00
|
|
|
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
2018-10-27 12:43:12 +00:00
|
|
|
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
2010-05-03 08:22:35 +00:00
|
|
|
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
2024-03-05 16:12:36 +00:00
|
|
|
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
2026-02-12 15:29:11 +00:00
|
|
|
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
|
2010-05-03 08:22:35 +00:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 14:36:08 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2010-05-03 08:22:35 +00:00
|
|
|
* (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
|
2019-09-23 19:55:30 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2010-05-03 08:22:35 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2010-06-07 23:52:43 +00:00
|
|
|
* \file htdocs/core/class/html.formadmin.class.php
|
2010-11-22 09:18:53 +00:00
|
|
|
* \ingroup core
|
2010-05-03 08:22:35 +00:00
|
|
|
* \brief File of class for html functions for admin pages
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2012-01-27 14:17:36 +00:00
|
|
|
* Class to generate html code for admin pages
|
2010-05-03 08:22:35 +00:00
|
|
|
*/
|
|
|
|
|
class FormAdmin
|
|
|
|
|
{
|
2024-01-09 17:46:54 +00:00
|
|
|
/**
|
|
|
|
|
* @var DoliDB Database handler.
|
|
|
|
|
*/
|
2020-10-31 13:32:18 +00:00
|
|
|
public $db;
|
2024-01-09 17:46:54 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string error message
|
2024-01-09 17:49:58 +00:00
|
|
|
*/
|
2020-10-31 13:32:18 +00:00
|
|
|
public $error;
|
2010-05-03 08:22:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-02-27 22:55:18 +00:00
|
|
|
* Constructor
|
2020-10-31 13:32:18 +00:00
|
|
|
*
|
2023-01-12 11:49:40 +00:00
|
|
|
* @param DoliDB|null $db Database handler
|
2020-10-31 13:32:18 +00:00
|
|
|
*/
|
|
|
|
|
public function __construct($db)
|
|
|
|
|
{
|
|
|
|
|
$this->db = $db;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
|
|
|
|
/**
|
|
|
|
|
* Return html select list with available languages (key='en_US', value='United States' for example)
|
|
|
|
|
*
|
2026-02-12 15:29:11 +00:00
|
|
|
* @param string|string[] $selected Language preselected. Can be an array if $multiselect is 1.
|
2021-04-12 12:26:09 +00:00
|
|
|
* @param string $htmlname Name of HTML select
|
2024-09-15 23:50:58 +00:00
|
|
|
* @param int<0,1> $showauto Show 'auto' choice
|
|
|
|
|
* @param string[] $filter Array of keys to exclude in list (opposite of $onlykeys)
|
|
|
|
|
* @param int<1,1>|string $showempty '1'=Add empty value or 'string to show'
|
|
|
|
|
* @param int<0,1> $showwarning Show a warning if language is not complete
|
|
|
|
|
* @param int<0,1> $disabled Disable edit of select
|
2021-04-12 12:26:09 +00:00
|
|
|
* @param string $morecss Add more css styles
|
2026-05-03 21:32:58 +00:00
|
|
|
* @param int<0,2> $showcode 1=Add language code into label at beginning, 2=Add language code into label at end, 3=Add language code into label at end with no parenthesis
|
2024-09-15 23:50:58 +00:00
|
|
|
* @param int<0,1> $forcecombo Force to use combo box (so no ajax beautify effect)
|
|
|
|
|
* @param int<0,1> $multiselect Make the combo a multiselect
|
|
|
|
|
* @param string[] $onlykeys Array of language keys to restrict list with the following keys (opposite of $filter). Example array('fr', 'es', ...)
|
|
|
|
|
* @param int<0,1> $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...)
|
2021-04-12 12:26:09 +00:00
|
|
|
* @return string Return HTML select string with list of languages
|
2020-10-31 13:32:18 +00:00
|
|
|
*/
|
2025-04-21 12:57:41 +00:00
|
|
|
public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = array(), $showempty = '', $showwarning = 0, $disabled = 0, $morecss = 'minwidth100', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = array(), $mainlangonly = 0)
|
2010-05-03 08:22:35 +00:00
|
|
|
{
|
2018-09-02 21:01:14 +00:00
|
|
|
// phpcs:enable
|
2024-05-09 16:15:57 +00:00
|
|
|
global $langs;
|
2019-03-06 16:07:51 +00:00
|
|
|
|
2023-11-27 10:24:19 +00:00
|
|
|
if (getDolGlobalString('MAIN_DEFAULT_LANGUAGE_FILTER')) {
|
2023-11-07 17:53:37 +00:00
|
|
|
if (!is_array($filter)) {
|
|
|
|
|
$filter = array();
|
|
|
|
|
}
|
2023-10-15 13:32:35 +00:00
|
|
|
$filter[getDolGlobalString('MAIN_DEFAULT_LANGUAGE_FILTER')] = 1;
|
2021-02-23 21:03:23 +00:00
|
|
|
}
|
2010-05-03 08:22:35 +00:00
|
|
|
|
2020-04-10 08:59:32 +00:00
|
|
|
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12, 0, $mainlangonly);
|
2010-09-14 20:42:17 +00:00
|
|
|
|
2022-01-20 18:01:04 +00:00
|
|
|
// If empty value is not allowed and the language to select is not inside the list of available language and we must find
|
2026-02-12 15:29:11 +00:00
|
|
|
// an alternative of the language code to preselect (to avoid to have first element in list preselected).
|
2022-01-20 18:01:04 +00:00
|
|
|
if ($selected && empty($showempty)) {
|
|
|
|
|
if (!is_array($selected) && !array_key_exists($selected, $langs_available)) {
|
|
|
|
|
$tmparray = explode('_', $selected);
|
|
|
|
|
if (!empty($tmparray[1])) {
|
|
|
|
|
$selected = getLanguageCodeFromCountryCode($tmparray[1]);
|
|
|
|
|
}
|
|
|
|
|
if (empty($selected)) {
|
|
|
|
|
$selected = $langs->defaultlang;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// If the preselected value is an array, we do not try to find alternative to preselect
|
2021-09-20 11:20:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-10 08:59:32 +00:00
|
|
|
$out = '';
|
2010-05-03 08:22:35 +00:00
|
|
|
|
2020-04-10 08:59:32 +00:00
|
|
|
$out .= '<select '.($multiselect ? 'multiple="multiple" ' : '').'class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiselect ? '[]' : '').'"'.($disabled ? ' disabled' : '').'>';
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($showempty && !$multiselect) {
|
2023-04-24 00:07:20 +00:00
|
|
|
if (is_numeric($showempty)) {
|
|
|
|
|
$out .= '<option value="0"';
|
|
|
|
|
} else {
|
|
|
|
|
$out .= '<option value="-1"';
|
|
|
|
|
}
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($selected === '') {
|
|
|
|
|
$out .= ' selected';
|
|
|
|
|
}
|
2020-04-10 08:59:32 +00:00
|
|
|
$out .= '>';
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($showempty != '1') {
|
|
|
|
|
$out .= $showempty;
|
|
|
|
|
} else {
|
|
|
|
|
$out .= ' ';
|
|
|
|
|
}
|
2020-04-10 08:59:32 +00:00
|
|
|
$out .= '</option>';
|
2010-05-03 08:22:35 +00:00
|
|
|
}
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($showauto) {
|
2020-04-10 08:59:32 +00:00
|
|
|
$out .= '<option value="auto"';
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($selected === 'auto') {
|
|
|
|
|
$out .= ' selected';
|
|
|
|
|
}
|
QUAL use shorter label on display lang setting (#37243)
* NEW Add status canceled on direct debit payment
* Link are clicable on page
* Debug v24
* Fix link
* Fix link
* Fix list of status
* Fix status code
* Debug v23
* NEW Add direct debit to close on home thumbs
* Fix link
* Debug v23
* Debug v23
* Clean code
* Debug extrafields chckbxlist v23
* Debug extrafields chckbxlist v23
* Debug v23
* Fix missing lagal requirement
* Better rate showing
* Debug v23 - sql request for list of actioncomm must not use a OR
* Clean code
* Code comment
* Debug v23
* Fix the limit
* css
* Debug v23
* Fix max
* Fix CI
* More debug info
* Increase editor height for note input fields (#37128)
* Edit form must match have order of field similat to create form
* Update card.php (#37108)
@defrance https://github.com/Dolibarr/dolibarr/issues/36767
* Update card.php (#37108)
@defrance https://github.com/Dolibarr/dolibarr/issues/36767
* Fix CI
* Fix CI
* Fix CI
* Correct linked_objects assignment for 'propal' #Wrong sourcetype 'commande' instead of 'propal' when creating recurring invoice template from invoice linked to proposal #37099 @defrance (#37112)
* Correct linked_objects assignment for 'propal'
@defrance Adam Hocini
* Refactor linked objects assignment for proposals
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fixed Bug : email sending test #36741 (#37107)
Fixed Bug : email sending test #36741
@defrance
-->
Issue fixed
The problem was caused by initializing $result = 0 in core/actions_sendmails.inc.php.
When sending a test email from Setup → Emails, there is no $object to fetch. As a result, $result remained 0 and the code incorrectly triggered ErrorFailedToReadObject.
The fix consists in explicitly setting $result = 1 when no $object is provided (test email / generic email context). This correctly treats the absence of an object as a valid case and restores the ability to send test emails, while keeping $result properly initialized.
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix CI
* Fixed Bug : email sending test #36741 (#37107)
Fixed Bug : email sending test #36741
@defrance
-->
Issue fixed
The problem was caused by initializing $result = 0 in core/actions_sendmails.inc.php.
When sending a test email from Setup → Emails, there is no $object to fetch. As a result, $result remained 0 and the code incorrectly triggered ErrorFailedToReadObject.
The fix consists in explicitly setting $result = 1 when no $object is provided (test email / generic email context). This correctly treats the absence of an object as a valid case and restores the ability to send test emails, while keeping $result properly initialized.
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Correct linked_objects assignment for 'propal' #Wrong sourcetype 'commande' instead of 'propal' when creating recurring invoice template from invoice linked to proposal #37099 @defrance (#37112)
* Correct linked_objects assignment for 'propal'
@defrance Adam Hocini
* Refactor linked objects assignment for proposals
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix CI
* Fix CI
* FIX Replace direct $_POST access with GETPOST() in origin/originid recovery paths (#37143)
When a create action fails and rolls back, several list/card pages
restore origin parameters by assigning $_POST values directly to
$_GET. This causes 'undefined array key' warnings on PHP 8.1+ if
the POST data is missing or malformed.
Replace raw $_POST['origin'] with GETPOST('origin', 'alpha') and
raw $_POST['originid'] with GETPOSTINT('originid') which safely
handle missing parameters.
Files fixed:
- htdocs/expedition/list.php
- htdocs/fourn/commande/list.php
- htdocs/commande/list.php
- htdocs/compta/facture/card.php
- htdocs/reception/list.php
These files had TODO-style comments ('Keep this ?', 'Keep GET and
POST here ?') indicating the pattern was already questionable.
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
* FIX Add missing isset() check for $_GET['file'] in viewimage.php (#37141)
On line 65, $_GET['file'] is accessed without isset() check inside
the modulepart=='mycompany' condition. This causes an 'undefined array
key' warning on PHP 8.1+ when modulepart is 'mycompany' but no file
parameter is provided.
Note: GETPOST() is intentionally not used here as it is not available
before main.inc.php is loaded (see existing code comment).
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
* CI
* Debug v23
* Debug v23
* FIX Show total on multicurrency only if currency are the same on all
lines
* FIX Show total on multicurrency only if currency are the same on all
lines
* Fix regression
* fix avoids undefined array key (#37103)
* NEW Add method formatLogObject to allow logs in 1 line #37135
* Initialize arrayforbutaction before hook (#37149)
* Initialize arrayforbutaction before hook (#37149)
* FIX #36923 Fix undefined array key warnings in opensurvey create_survey.php (#37140)
The session variable initialization logic was inverted: it set variables
to null only when they already existed, instead of initializing them
when they were missing. This caused 'undefined array key' warnings on
PHP 8.1+ when accessing the poll creation form for the first time.
Changes:
- Inverted isset() condition to !isset() to properly initialize missing
session variables
- Initialize to empty string instead of null
- Added missing session variables (allow_comments, allow_spy, champdatefin)
to the initialization array
- Added dol_escape_htmltag() for title output (XSS hardening)
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* CI
* Debug v23
* FIX #34342 PHP 8.1 undefined array key warnings in Product::getSellPrice() multiprices (#37144)
When using multiprices (PRODUIT_MULTIPRICES or
PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES), getSellPrice() accesses
$this->multiprices[$level], multiprices_ttc, multiprices_min,
multiprices_min_ttc, and multiprices_base_type arrays using the
buyer's price_level as key without checking if the key exists.
This causes 'undefined array key' warnings on PHP 8.1+ when a
third party has a price_level set but the product doesn't have
prices defined for that specific level.
Similarly, prices_by_qty array accesses for PRODUIT_CUSTOMER_PRICES_BY_QTY
and PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES modes could trigger
warnings when the array index doesn't exist.
Changes:
- Add isset() checks with safe defaults for all multiprices array
accesses (0 for prices, 'HT' for price_base_type)
- Replace direct prices_by_qty access with !empty() checks
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix CI
* Qual: Update comments from French to English (#37097)
* Qual: Update comments from French to English
# Qual: Update comments from French to English
* Qual: Fix missing initialisations
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Debug v23
* Ensure that if $object->members is not loaded either we do not send m… (#37126)
* Ensure that if $object->members is not loaded either we do not send members to LDAP or we explicitly loads them before according to LDAP configuration
* Fix typo
* Sec: Add param $dolibarr_website_allow_custom_php to block by default
any PHP content in website module.
* Fix CI
* Comment
* Debug v23 - Min price was wrong in multicurrency mode
* Debug v23 - Filter on action type ko
* Debug v23 - Filter on action type ko
* add fk_parent on group group for permission inheritance (#37152)
* FIX PHP 8.1 undefined array key warnings in ProductCombination multiprices loop (#37142)
When PRODUIT_MULTIPRICES is enabled and a product variant's parent has
multiprices configured, the updateChildPrice() method iterates through
all price levels up to PRODUIT_MULTIPRICES_LIMIT. For price levels that
don't have prices defined, accessing $parent->multiprices[$i] and
related arrays directly causes 'undefined array key' warnings on
PHP 8.1+.
Changes:
- Add isset() check before comparing $parent->multiprices[$i]
- Use isset() ternary for $parent->multiprices_min[$i] (default: 0)
- Use !empty() for $parent->prices_by_qty_list[$i] check
- Use isset() ternary for $parent->multiprices_ttc[$i] (default: 0)
- Use isset() ternary for second $parent->multiprices[$i] (default: 0)
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Add error message
* Avoid ( in sql
* Clean sql
* Fix spellcheck
* Debug v23
* TakePOS hook “AddAction” jamais exécuté (#35961) (#37113)
@defrance
Adam Hocini
* Update modProduct.class.php (#37087)
Fix: allow import of sell_or_eat_by_mandatory for products
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Update modProduct.class.php (#37087)
Fix: allow import of sell_or_eat_by_mandatory for products
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Clean code
* Fix package debian
* NEW Use the js lib into htdocs/public/includes instead of htdocs/includes
* New LNE Collect of buisness informations (#37084)
* Working LNE ping
* remove GPDA
* Add of other informations
* remove testing var
* fix Ci
* fix Ci
* fix ci
* fix CI
* Fix Ci
* fix Ci
---------
Co-authored-by: Lucas Marcouiller <lmarcouiller@dolicloud.com>
* CI
* CI
* CI
* CI
* Clean code. File not used.
* CSS
* CSS
* Fix phpunit
* More legal info
* CI
* Fix CI
* Fix: IRPF tax not applied when creating invoice from project times (#37077)
* Remove 'supplier_invoice' from old path array
* Update module path in arrayforoldpath
Sorry Eldy, I was confused. You are absolutely right, it is already corrected.
* Replace localtax2 assignment with get_localtax function
Error when creating an invoice with personal income tax from project times. The rate does not apply
* Refactor localtax1 calculation using get_localtax
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix: IRPF tax not applied when creating invoice from project times (#37077)
* Remove 'supplier_invoice' from old path array
* Update module path in arrayforoldpath
Sorry Eldy, I was confused. You are absolutely right, it is already corrected.
* Replace localtax2 assignment with get_localtax function
Error when creating an invoice with personal income tax from project times. The rate does not apply
* Refactor localtax1 calculation using get_localtax
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Protect module
* Add currency
* CSS
* WIP LNE
* Fix navigation
* cs
* Debug registration process
* Debug setup navigation
* CI
* CI
* Factorize code
* Fix CI
* Fix CI
* Fix CI
* CI
* CI
* CI
* CI
* Disable phan on v23
* CI
* CI
* FIX: missing include for blockedlog lib (#37165)
* Debug CI
* fix ternary always true (#37161)
* fix ternary always true
* Update requests.php
* Update registration.php
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* CI
* FIX: missing include for blockedlog lib (#37165)
* FIX #37134 Use json_encode for IMAP search logging in EmailCollector (#37135)
var_export() produces multiline output that breaks log aggregators
(Loki, Splunk, Elasticsearch) as each line becomes a separate log entry.
Using json_encode() produces single-line structured output that works
correctly with all log aggregation tools.
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Populate syslog with placeholder (#37163)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Doc
* datamodel for user change password next time (#37155)
* Qual: Update phan baseline (#37172)
* Fix typo in file path (#37160)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix phpunit
* Complete call to setStatus so we have a trigy as 4th parameter (help to
fix the #37129)
* FIX Product - Warning on admin (#37157)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* FIX Product - Warning on admin + CSS (#37158)
* FIX Product - Warning on admin
* CSS
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* CI
* CI
* CI
* Avoid error if include fails
* More functions in blacklist (even if nw we use the whitelist by default)
* #37166 [SQL] add: email template for ticket admin creation (#37182)
* Replace var_export with new function formatLogObject (#37178)
* FIX BOM - Class product missing, column offset and information recording (form/input overlap) in admin (#37177)
* FIX BOM - Class product missing in admin
* Fix column offset and information recording (form/input overlap)
* ci
* ci
* FIX Intracommreport - Warning & link problem on tab (#37176)
* FIX Bank transfer admin - Warning & save 0 on constant PAYMENTBYBANKTRANSFER_ADDDAYS (#37175)
* Look and feel v24
* Update default time handling in index.php (#37150)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix file path comment in supplier invoice module (#37133)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix file path comment in supplier invoice module (#37133)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix CI
* Add template in migration
* fix phpdoc comment (#37184)
* fix phpdoc comment
* fix phpdoc comment
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* CI
* Fix phpstan
* Replace var_export by formatLogObject (continued) (#37188)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Debug amount suggested on membership public form
* Issue 36923 Fix session title handling in survey creation (#37105)
* Issue 36923 Fix session title handling in survey creation
* Change input field to use id attribute for title
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* fix phpstan errors blocking action baseline (#37189)
* fix phpstan errors blocking action baseline
* fix phpstan errors blocking action baseline
* fix phpstan errors blocking action baseline
* fix phpstan errors blocking action baseline
* fix phpstan errors blocking action baseline
* refresh baseline
* QUAL Replace var_export() with json_encode() in dol_syslog() calls (#37138)
var_export() produces multiline output that breaks log aggregators
(Loki, Splunk, Elasticsearch, Graylog) as each line becomes a separate
log entry.
json_encode() produces single-line structured output that works correctly
with all log aggregation tools. This pattern is already used elsewhere
in Dolibarr (accountancy, install modules).
Files changed:
- core/class/commoninvoice.class.php (payment intent logging)
- core/class/commonobject.class.php (payment terms logging)
- core/modules/mailings/advthirdparties.modules.php (mailing targets)
- core/modules/oauth/google_oauthcallback.php (userinfo logging)
- core/modules/oauth/generic_oauthcallback.php (userinfo logging)
- public/payment/newpayment.php (GET/POST debug logging)
- public/payment/paymentok.php (payment tag logging)
- public/stripe/ipn.php (Stripe event data logging)
- paypal/lib/paypal.lib.php (PayPal response logging)
- api/index.php (API debug logging)
- stripe/class/stripe.class.php (payment/setup intent logging)
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix CI
* CI
* Check if upload_max_filesize is not empty
* clean code
* Debug v23
* CI
* Fix #33521 VAT total false (#36990)
* - Fix #33521 VAT total false
- Fix some warnings
- Fix : delete $this->vat_rate
* - Fix #33521 VAT total false
- Fix some warnings
- Fix :delete $this->tva array (replaced by $this->tva_array)
* - Fix #33521 VAT total false
- Fix some warnings
- Fix :delete $this->tva array (replaced by $this->tva_array)
* Update pdf_octopus.modules.php
* Update pdf_octopus.modules.php
* Update pdf_octopus.modules.php
* Update pdf_octopus.modules.php
* Update pdf_octopus.modules.php
---------
Co-authored-by: vmaury <vmaury@vmaury-Lafite-Pro-16-AMD>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* NEW #25829 Automatically send the invoice generated from a template (#36967)
* Update DB
* ADD email template
* Ajout d'une clé de trad
* Ajout des traductions
* Suppression des traductions, sauf en_US
* Add flag auto send
* Modif form + cron auto send
* Suppression auto_send
* correction loopError
* ajout du selected au model de mail
* Prise en compte default model
* Fix pre-commit
* ménage
* precommit
* Correction Phan
* Correction Phan
* Correction, double cal du trigger
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Develop force user change pass userclass (#37174)
* datamodel for user change password next time
* add force_pass_change in user object
* Initialize force_pass_change to 0
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Another step for #37171
* Qual: Partial phan run on PR's, complete run on integration branches (#37186)
* Qual: Partial phan run on PR's, complete on main
# Qual: Partial phan run on PR's, complete on main
The selection is based on the branch name.
To run a complete phan run in a PR, the branch name of the PR must include phan_full.
This can help to fix remaining phan issue before re-integrating to the develop branch.
* qual: Update workflow and pre-commit configurations
- Enable phan workflow by uncommenting the relevant lines
- Update actionlint version to v1.7.10
- Add manual stage to actionlint hook in pre-commit-config.yaml
* qual: Update Phan analysis conditions
The conditions for running Phan analysis have been updated to include an additional check for branches containing 'phan_full'.
* qual: Update Phan workflow
- Replace github.event.ref with github.ref_name
- Add FILE_CHANGE_LIST environment variable for better file handling
- Update file list creation and usage in the workflow
* qual: Update Phan workflow conditions
Fix the branch reference (head_ref in PR, ref_name otherwise)
* Add step for debug information
* Remove debug step
* Fix: Missing initialisations members/new.php
Following a suppression of assignments, the variables disabledphy and disabledmor were undefined.
* fix: Update budget selection dropdown arguments in member creation form
Correct the arguments in the member creation form.
* qual: Add cs2pr to phan workflow
- Add cs2pr to the tools list in the phan workflow
- Change the output mode of phan to checkstyle
- Add a step to add results to PR as Github notices
- Add a step to provide phan log as artifact
* qual: Update Phan workflow to use environment variable for file list
The change fixes the Phan workflow to use the environment variable `$FILE_CHANGED_LIST` to clear the file
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix phan
* Fix phan
* Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 23.0
* Doc
* Qual: Fix ambigious redirect error on Phan workflow (#37200)
# Qual: Fix ambigious redirect error on Phan workflow
Rewrote the shell command that is supposed to suppress a file contents
but is flagged by the environment.
* PHPStan > Update baseline (#37197)
Co-authored-by: Dolibot <dolibarr-bot@users.noreply.github.com>
* Typo fix (#37195)
* css
* qual: Update PHPStan workflow to run on all files in integration (#37207)
The PHPStan workflow has been updated to run on all files in integration branches.
* Fix CI
* CLOSE #37190 ODT Templates for thirdparties - Birthday is returned in epoch format (#37198)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* fix: Remove HTML from accounting menu tooltips in eldy theme (#37203)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Qual: Update spelling (#37199)
* Qual: Update spelling for pre-select variants
# Qual: Update spelling for pre-select variants
In English, preselect is without the hyphen. Update text and made some translations
related to preselect.
* Qual: Update composant to component and/or adequate translation.
# Qual: Update composant to component and/or adequate translation.
"Composant(s)" was mostly referenced in french file/class comments.
Updated
* Qual: Fix misspellings related to "criteria"
# Qual: Fix misspellings related to "criteria"
* Qual: Fix produt misspellings
# Qual: Fix produt misspellings
Change 'produt' to 'product'.
* Qual: Update French comments with "composants"
#Qual: Update French comments with "composants"
- Translating French comments to English (avoid codespell notice)
* Qual: Fixed typo 'bad practive' to 'bad practice'
# Qual: Fixed typo 'bad practive' to 'bad practice'
* Qual: Update phan.yml to exclude specific files from analysis
- Added file exclusion pattern to match phan configuration
- Added check for empty file list to avoid unnecessary phan execution
* Qual: Update file filtering in phan.yml workflow
The change updates the file filtering process in the phan.yml workflow to correctly redirect the output of the grep command to a temporary file.
* Qual: Ignore $systemfunction always exists
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Error handling methods for commonobject (#37201)
* NEW Can request and force user to change its password (#37196)
* force user to change password : redirect to user card on login
* force user to change password : redirect to user card on login
* redirect to a dedicated page
* bad old idea : self change passwd on user card + edit mode and rights: it makes a hole on security check
* only apply on dolibarr auth mode context
* only on dolibarr auth mode context
* Fix force_pass_change SQL assignment logic
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Doc
* Setup easier to understand between INVOICE_CHECK_POSTERIOR_DATE and
FAC_FORCE_DATE_VALIDATION
* Setup easier to understand between INVOICE_CHECK_POSTERIOR_DATE and
FAC_FORCE_DATE_VALIDATION
* Qual: Ignore exit code from `grep -v` in phan flow (#37213)
# Qual: Ignore exit code from `grep -v` in phan flow
`grep -v` returns 1 when the resulting filtered list is empty and would stop the execution.
This is fixed with `|| true` to have a final exit code that is 0.
* WIP LNE
* Debug v23
* WIP LNE
* FIX Bad header name
* Fix CSP for ping
* Compatibility with multicompany
* Debug
* Fix include
* FIX phpdoc on createFixedAmountDiscount() (#37212)
* FIX phpdoc on createFixedAmountDiscount
* FIX phpdoc
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix in card css modal display (#36569)
* Fix display of cards in a modal
* fix php stan
* fix php stan
* Try a change to force CI
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* select language display AutoDetectLangShort if no showcode
* Add short version for AutoDetectLang
* Add AutoDetectLangShort translation to French
* Update html.formadmin.class.php
* Fix spacing in condition for showcode
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Co-authored-by: AnthoXic <a.sapet-dev@proton.me>
Co-authored-by: adamhocini <72007447+adamhocini@users.noreply.github.com>
Co-authored-by: DarmonNoah <152853486+DarmonNoah@users.noreply.github.com>
Co-authored-by: minimexat <minimexat@gmail.com>
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Mathieu G. <118812426+MathieuGDev@users.noreply.github.com>
Co-authored-by: Vanyo <vanyolai@gmail.com>
Co-authored-by: MDW <mdeweerd@users.noreply.github.com>
Co-authored-by: David Beniamine <david.beniamine@tetras-libre.fr>
Co-authored-by: Laurent Destailleur <eldy@users.sourceforge.net>
Co-authored-by: Eric - CAP-REL <1468823+rycks@users.noreply.github.com>
Co-authored-by: Jarvis <94354305+Jarvis-69@users.noreply.github.com>
Co-authored-by: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com>
Co-authored-by: Lucas Marcouiller <lmarcouiller@dolicloud.com>
Co-authored-by: Yamil Esteban Garcia <120027058+developmentOYR@users.noreply.github.com>
Co-authored-by: Noé Cendrier <81741011+altairis-noe@users.noreply.github.com>
Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
Co-authored-by: hansemschnokeloch <hansemschnokeloch@users.noreply.github.com>
Co-authored-by: Alexandre SPANGARO <alexandre.spangaro@gmail.com>
Co-authored-by: evarisk-kilyan <kilyan.evarisk@gmail.com>
Co-authored-by: jeremydassaud <49372108+jeremydassaud@users.noreply.github.com>
Co-authored-by: Vincent Maury <artec.vm@arnac.net>
Co-authored-by: vmaury <vmaury@vmaury-Lafite-Pro-16-AMD>
Co-authored-by: Vincent Penel <vincent.penel@atm-consulting.fr>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dolibot <dolibarr-bot@users.noreply.github.com>
Co-authored-by: Joris Le Blansch <jleblansch@gmail.com>
Co-authored-by: intelliking <tyleradams93226@gmail.com>
Co-authored-by: Benjamin Falière <121813548+BenjaminFlr@users.noreply.github.com>
Co-authored-by: John BOTELLA <68917336+thersane-john@users.noreply.github.com>
2026-02-28 16:44:03 +00:00
|
|
|
if ($showcode > 0) {
|
|
|
|
|
$out .= '>'.$langs->trans("AutoDetectLang").'</option>';
|
|
|
|
|
} else {
|
|
|
|
|
$out .= '>'.$langs->trans("AutoDetectLangShort").'</option>';
|
|
|
|
|
}
|
2010-05-03 08:22:35 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-07 15:54:51 +00:00
|
|
|
asort($langs_available); // array('XX' => 'Language (Country)', ...)
|
2010-05-03 08:22:35 +00:00
|
|
|
|
2021-02-23 21:03:23 +00:00
|
|
|
foreach ($langs_available as $key => $value) {
|
2020-04-10 08:59:32 +00:00
|
|
|
$valuetoshow = $value;
|
2020-12-06 14:59:19 +00:00
|
|
|
if ($showcode == 1) {
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($mainlangonly) {
|
|
|
|
|
$valuetoshow = '<span class="opacitymedium">'.preg_replace('/[_-].*$/', '', $key).'</span> - '.$value;
|
|
|
|
|
} else {
|
|
|
|
|
$valuetoshow = '<span class="opacitymedium">'.$key.'</span> - '.$value;
|
|
|
|
|
}
|
2020-12-06 14:59:19 +00:00
|
|
|
}
|
2026-05-03 20:35:58 +00:00
|
|
|
if ($showcode == 2 || $showcode == 3) {
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($mainlangonly) {
|
2026-06-20 01:40:58 +00:00
|
|
|
$valuetoshow = $value.' <span class="opacitymedium">'.($showcode == 3 ? '' : '(').preg_replace('/[_-].*$/', '', $key).($showcode == 3 ? '' : ')').'</span>';
|
2021-02-23 21:03:23 +00:00
|
|
|
} else {
|
2026-06-20 01:40:58 +00:00
|
|
|
$valuetoshow = $value.' <span class="opacitymedium">'.($showcode == 3 ? '' : '(').$key.($showcode == 3 ? '' : ')').'</span>';
|
2021-02-23 21:03:23 +00:00
|
|
|
}
|
2020-02-21 10:36:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$keytouse = $key;
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($mainlangonly) {
|
|
|
|
|
$keytouse = preg_replace('/[_-].*$/', '', $key);
|
|
|
|
|
}
|
2017-08-25 14:38:45 +00:00
|
|
|
|
2020-02-21 10:36:16 +00:00
|
|
|
if ($filter && is_array($filter) && array_key_exists($keytouse, $filter)) {
|
2020-02-20 00:08:53 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
2020-04-10 08:59:32 +00:00
|
|
|
if ($onlykeys && is_array($onlykeys) && !array_key_exists($keytouse, $onlykeys)) {
|
2020-01-29 10:32:24 +00:00
|
|
|
continue;
|
2010-05-03 08:22:35 +00:00
|
|
|
}
|
2020-02-21 10:36:16 +00:00
|
|
|
|
2021-02-28 13:26:32 +00:00
|
|
|
$valuetoshow = picto_from_langcode($key, 'class="saturatemedium"').' '.$valuetoshow;
|
2026-05-03 21:32:58 +00:00
|
|
|
|
2021-04-12 12:26:09 +00:00
|
|
|
if ((is_string($selected) && (string) $selected == (string) $keytouse) || (is_array($selected) && in_array($keytouse, $selected))) {
|
2020-11-29 14:16:53 +00:00
|
|
|
$out .= '<option value="'.$keytouse.'" selected data-html="'.dol_escape_htmltag($valuetoshow).'">'.$valuetoshow.'</option>';
|
2020-05-21 13:05:19 +00:00
|
|
|
} else {
|
2020-11-29 14:16:53 +00:00
|
|
|
$out .= '<option value="'.$keytouse.'" data-html="'.dol_escape_htmltag($valuetoshow).'">'.$valuetoshow.'</option>';
|
2010-05-03 08:22:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
2020-04-10 08:59:32 +00:00
|
|
|
$out .= '</select>';
|
2010-09-14 20:42:17 +00:00
|
|
|
|
2026-05-03 21:32:58 +00:00
|
|
|
// Make autocompletion
|
2021-02-23 21:03:23 +00:00
|
|
|
if (!$forcecombo) {
|
2020-04-10 08:59:32 +00:00
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
|
|
|
|
$out .= ajax_combobox($htmlname);
|
2018-08-24 13:25:18 +00:00
|
|
|
}
|
2015-05-31 10:25:33 +00:00
|
|
|
|
2010-09-01 20:51:10 +00:00
|
|
|
return $out;
|
2010-05-03 08:22:35 +00:00
|
|
|
}
|
|
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
|
|
|
|
/**
|
|
|
|
|
* Return list of available menus (eldy_backoffice, ...)
|
|
|
|
|
*
|
|
|
|
|
* @param string $selected Preselected menu value
|
|
|
|
|
* @param string $htmlname Name of html select
|
2024-09-15 23:50:58 +00:00
|
|
|
* @param string[] $dirmenuarray Array of directories to scan
|
2020-10-31 13:32:18 +00:00
|
|
|
* @param string $moreattrib More attributes on html select tag
|
2024-03-05 16:12:36 +00:00
|
|
|
* @return integer|void
|
2020-10-31 13:32:18 +00:00
|
|
|
*/
|
|
|
|
|
public function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib = '')
|
|
|
|
|
{
|
2018-09-02 21:01:14 +00:00
|
|
|
// phpcs:enable
|
2020-10-31 13:32:18 +00:00
|
|
|
global $langs, $conf;
|
2010-05-03 08:22:35 +00:00
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
// Clean parameters
|
2013-01-25 16:44:23 +00:00
|
|
|
|
2010-05-03 08:22:35 +00:00
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
// Check parameters
|
2021-02-23 21:03:23 +00:00
|
|
|
if (!is_array($dirmenuarray)) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2012-02-12 14:17:54 +00:00
|
|
|
|
2020-02-21 16:53:37 +00:00
|
|
|
$menuarray = array();
|
2021-02-23 21:03:23 +00:00
|
|
|
foreach ($conf->file->dol_document_root as $dirroot) {
|
|
|
|
|
foreach ($dirmenuarray as $dirtoscan) {
|
2020-10-31 13:32:18 +00:00
|
|
|
$dir = $dirroot.$dirtoscan;
|
|
|
|
|
//print $dir.'<br>';
|
2021-02-23 21:03:23 +00:00
|
|
|
if (is_dir($dir)) {
|
2020-10-31 13:32:18 +00:00
|
|
|
$handle = opendir($dir);
|
2021-02-23 21:03:23 +00:00
|
|
|
if (is_resource($handle)) {
|
|
|
|
|
while (($file = readdir($handle)) !== false) {
|
2023-12-27 11:12:20 +00:00
|
|
|
if (is_file($dir."/".$file) && substr($file, 0, 1) != '.' && substr($file, 0, 3) != 'CVS' && substr($file, 0, 5) != 'index') {
|
2021-02-23 21:03:23 +00:00
|
|
|
if (preg_match('/lib\.php$/i', $file)) {
|
|
|
|
|
continue; // We exclude library files
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/eldy_(backoffice|frontoffice)\.php$/i', $file)) {
|
|
|
|
|
continue; // We exclude all menu manager files
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/auguria_(backoffice|frontoffice)\.php$/i', $file)) {
|
|
|
|
|
continue; // We exclude all menu manager files
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/smartphone_(backoffice|frontoffice)\.php$/i', $file)) {
|
|
|
|
|
continue; // We exclude all menu manager files
|
|
|
|
|
}
|
2020-10-31 13:32:18 +00:00
|
|
|
|
2024-10-11 17:41:31 +00:00
|
|
|
$filetoshow = preg_replace('/\.php$/i', '', $file);
|
|
|
|
|
$filetoshow = ucfirst(preg_replace('/_menu$/i', '', $filetoshow));
|
2020-10-31 13:32:18 +00:00
|
|
|
$prefix = '';
|
2024-01-13 18:48:20 +00:00
|
|
|
// 0=Recommended, 1=Experimental, 2=Development, 3=Other
|
2021-02-23 21:03:23 +00:00
|
|
|
if (preg_match('/^eldy/i', $file)) {
|
|
|
|
|
$prefix = '0';
|
|
|
|
|
} elseif (preg_match('/^smartphone/i', $file)) {
|
|
|
|
|
$prefix = '2';
|
|
|
|
|
} else {
|
|
|
|
|
$prefix = '3';
|
|
|
|
|
}
|
2020-10-31 13:32:18 +00:00
|
|
|
|
2024-05-05 16:04:46 +00:00
|
|
|
$morelabel = '';
|
|
|
|
|
if (preg_match('/^auguria/i', $file)) {
|
|
|
|
|
$morelabel .= ' <span class="opacitymedium">('.$langs->trans("Unstable").')</span>';
|
|
|
|
|
}
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($file == $selected) {
|
2024-10-11 17:41:31 +00:00
|
|
|
$menuarray[$prefix.'_'.$file] = '<option value="'.$file.'" selected data-html="'.dol_escape_htmltag($filetoshow.$morelabel).'">';
|
|
|
|
|
$menuarray[$prefix.'_'.$file] .= $filetoshow.$morelabel;
|
2024-05-05 16:04:46 +00:00
|
|
|
$menuarray[$prefix.'_'.$file] .= '</option>';
|
2020-10-31 13:32:18 +00:00
|
|
|
} else {
|
2024-10-11 17:41:31 +00:00
|
|
|
$menuarray[$prefix.'_'.$file] = '<option value="'.$file.'" data-html="'.dol_escape_htmltag($filetoshow.$morelabel).'">';
|
|
|
|
|
$menuarray[$prefix.'_'.$file] .= $filetoshow.$morelabel;
|
2024-05-05 16:04:46 +00:00
|
|
|
$menuarray[$prefix.'_'.$file] .= '</option>';
|
2020-10-31 13:32:18 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
closedir($handle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-05-03 08:22:35 +00:00
|
|
|
ksort($menuarray);
|
|
|
|
|
|
2011-02-16 19:59:16 +00:00
|
|
|
// Output combo list of menus
|
2024-10-11 17:41:31 +00:00
|
|
|
print '<select class="flat minwidth150" id="'.$htmlname.'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
|
2020-10-31 13:32:18 +00:00
|
|
|
$oldprefix = '';
|
2021-02-23 21:03:23 +00:00
|
|
|
foreach ($menuarray as $key => $val) {
|
2020-02-21 16:53:37 +00:00
|
|
|
$tab = explode('_', $key);
|
|
|
|
|
$newprefix = $tab[0];
|
2024-05-05 16:04:46 +00:00
|
|
|
|
2023-04-28 14:05:25 +00:00
|
|
|
if ($newprefix == '1' && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1)) {
|
2021-02-23 21:03:23 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
2023-04-28 14:05:25 +00:00
|
|
|
if ($newprefix == '2' && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2)) {
|
2021-02-23 21:03:23 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ($newprefix != $oldprefix) { // Add separators
|
2010-05-03 08:22:35 +00:00
|
|
|
// Affiche titre
|
2024-05-05 16:04:46 +00:00
|
|
|
print '<option value="-2" disabled>';
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($newprefix == '0') {
|
|
|
|
|
print '-- '.$langs->trans("VersionRecommanded").' --';
|
|
|
|
|
}
|
|
|
|
|
if ($newprefix == '1') {
|
|
|
|
|
print '-- '.$langs->trans("VersionExperimental").' --';
|
|
|
|
|
}
|
|
|
|
|
if ($newprefix == '2') {
|
|
|
|
|
print '-- '.$langs->trans("VersionDevelopment").' --';
|
|
|
|
|
}
|
|
|
|
|
if ($newprefix == '3') {
|
|
|
|
|
print '-- '.$langs->trans("Other").' --';
|
|
|
|
|
}
|
2010-05-03 08:22:35 +00:00
|
|
|
print '</option>';
|
2020-02-21 16:53:37 +00:00
|
|
|
$oldprefix = $newprefix;
|
2010-05-03 08:22:35 +00:00
|
|
|
}
|
2024-05-05 16:04:46 +00:00
|
|
|
|
2024-10-11 17:41:31 +00:00
|
|
|
print $val."\n"; // Show menu entry ($val contains the <option> tags)
|
2010-05-03 08:22:35 +00:00
|
|
|
}
|
|
|
|
|
print '</select>';
|
2024-01-09 17:46:54 +00:00
|
|
|
|
2024-05-05 16:04:46 +00:00
|
|
|
print ajax_combobox($htmlname);
|
|
|
|
|
|
2024-01-09 17:46:54 +00:00
|
|
|
return;
|
2020-10-31 13:32:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
|
|
|
|
/**
|
|
|
|
|
* Return combo list of available menu families
|
|
|
|
|
*
|
2026-02-12 15:29:11 +00:00
|
|
|
* @param string $selected Menu preselected
|
2020-10-31 13:32:18 +00:00
|
|
|
* @param string $htmlname Name of html select
|
|
|
|
|
* @param string[] $dirmenuarray Directories to scan
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function select_menu_families($selected, $htmlname, $dirmenuarray)
|
|
|
|
|
{
|
|
|
|
|
// phpcs:enable
|
|
|
|
|
global $langs, $conf;
|
|
|
|
|
|
|
|
|
|
//$expdevmenu=array('smartphone_backoffice.php','smartphone_frontoffice.php'); // Menu to disable if $conf->global->MAIN_FEATURES_LEVEL is not set
|
|
|
|
|
$expdevmenu = array();
|
2011-01-09 23:15:52 +00:00
|
|
|
|
2020-02-21 16:53:37 +00:00
|
|
|
$menuarray = array();
|
2010-11-01 16:00:38 +00:00
|
|
|
|
2021-02-23 21:03:23 +00:00
|
|
|
foreach ($dirmenuarray as $dirmenu) {
|
|
|
|
|
foreach ($conf->file->dol_document_root as $dirroot) {
|
2020-10-31 13:32:18 +00:00
|
|
|
$dir = $dirroot.$dirmenu;
|
2021-02-23 21:03:23 +00:00
|
|
|
if (is_dir($dir)) {
|
2020-10-31 13:32:18 +00:00
|
|
|
$handle = opendir($dir);
|
2021-02-23 21:03:23 +00:00
|
|
|
if (is_resource($handle)) {
|
|
|
|
|
while (($file = readdir($handle)) !== false) {
|
2023-12-27 11:12:20 +00:00
|
|
|
if (is_file($dir."/".$file) && substr($file, 0, 1) != '.' && substr($file, 0, 3) != 'CVS') {
|
2020-10-31 13:32:18 +00:00
|
|
|
$filelib = preg_replace('/(_backoffice|_frontoffice)?\.php$/i', '', $file);
|
2021-02-23 21:03:23 +00:00
|
|
|
if (preg_match('/^index/i', $filelib)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/^default/i', $filelib)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/^empty/i', $filelib)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/\.lib/i', $filelib)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2021-11-05 13:23:19 +00:00
|
|
|
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') == 0 && in_array($file, $expdevmenu)) {
|
2021-02-23 21:03:23 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
2020-10-31 13:32:18 +00:00
|
|
|
|
|
|
|
|
$menuarray[$filelib] = 1;
|
|
|
|
|
}
|
|
|
|
|
$menuarray['all'] = 1;
|
|
|
|
|
}
|
|
|
|
|
closedir($handle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-09-23 10:02:27 +00:00
|
|
|
}
|
2010-11-01 16:00:38 +00:00
|
|
|
|
2010-05-03 08:22:35 +00:00
|
|
|
ksort($menuarray);
|
|
|
|
|
|
2024-06-16 10:11:47 +00:00
|
|
|
// Show combo list of menu handlers
|
2025-04-08 16:18:05 +00:00
|
|
|
print '<select class="flat width150" id="'.$htmlname.'" name="'.$htmlname.'">';
|
2021-02-23 21:03:23 +00:00
|
|
|
foreach ($menuarray as $key => $val) {
|
2020-02-21 16:53:37 +00:00
|
|
|
$tab = explode('_', $key);
|
2010-05-03 08:22:35 +00:00
|
|
|
print '<option value="'.$key.'"';
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($key == $selected) {
|
2015-05-07 10:20:20 +00:00
|
|
|
print ' selected';
|
2010-05-03 08:22:35 +00:00
|
|
|
}
|
|
|
|
|
print '>';
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($key == 'all') {
|
|
|
|
|
print $langs->trans("AllMenus");
|
|
|
|
|
} else {
|
|
|
|
|
print $key;
|
|
|
|
|
}
|
2010-05-03 08:22:35 +00:00
|
|
|
print '</option>'."\n";
|
|
|
|
|
}
|
|
|
|
|
print '</select>';
|
2022-09-07 14:25:06 +00:00
|
|
|
|
|
|
|
|
print ajax_combobox($htmlname);
|
2020-10-31 13:32:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
|
|
|
|
/**
|
|
|
|
|
* Return a HTML select list of timezones
|
|
|
|
|
*
|
2026-02-12 15:29:11 +00:00
|
|
|
* @param string $selected Preselected Menu
|
|
|
|
|
* @param string $htmlname Name of the selected zone
|
2020-10-31 13:32:18 +00:00
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function select_timezone($selected, $htmlname)
|
|
|
|
|
{
|
|
|
|
|
// phpcs:enable
|
|
|
|
|
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
|
|
|
|
print '<option value="-1"> </option>';
|
|
|
|
|
|
|
|
|
|
$arraytz = array(
|
2024-03-09 15:32:02 +00:00
|
|
|
"Pacific/Midway" => "GMT-11:00",
|
|
|
|
|
"Pacific/Fakaofo" => "GMT-10:00",
|
|
|
|
|
"America/Anchorage" => "GMT-09:00",
|
|
|
|
|
"America/Los_Angeles" => "GMT-08:00",
|
|
|
|
|
"America/Dawson_Creek" => "GMT-07:00",
|
|
|
|
|
"America/Chicago" => "GMT-06:00",
|
|
|
|
|
"America/Bogota" => "GMT-05:00",
|
|
|
|
|
"America/Anguilla" => "GMT-04:00",
|
|
|
|
|
"America/Araguaina" => "GMT-03:00",
|
|
|
|
|
"America/Noronha" => "GMT-02:00",
|
|
|
|
|
"Atlantic/Azores" => "GMT-01:00",
|
|
|
|
|
"Africa/Abidjan" => "GMT+00:00",
|
|
|
|
|
"Europe/Paris" => "GMT+01:00",
|
|
|
|
|
"Europe/Helsinki" => "GMT+02:00",
|
|
|
|
|
"Europe/Moscow" => "GMT+03:00",
|
|
|
|
|
"Asia/Dubai" => "GMT+04:00",
|
|
|
|
|
"Asia/Karachi" => "GMT+05:00",
|
|
|
|
|
"Indian/Chagos" => "GMT+06:00",
|
|
|
|
|
"Asia/Jakarta" => "GMT+07:00",
|
|
|
|
|
"Asia/Hong_Kong" => "GMT+08:00",
|
|
|
|
|
"Asia/Tokyo" => "GMT+09:00",
|
|
|
|
|
"Australia/Sydney" => "GMT+10:00",
|
|
|
|
|
"Pacific/Noumea" => "GMT+11:00",
|
|
|
|
|
"Pacific/Auckland" => "GMT+12:00",
|
|
|
|
|
"Pacific/Enderbury" => "GMT+13:00"
|
2010-05-03 08:22:35 +00:00
|
|
|
);
|
2020-10-31 13:32:18 +00:00
|
|
|
foreach ($arraytz as $lib => $gmt) {
|
|
|
|
|
print '<option value="'.$lib.'"';
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($selected == $lib || $selected == $gmt) {
|
|
|
|
|
print ' selected';
|
|
|
|
|
}
|
2020-10-31 13:32:18 +00:00
|
|
|
print '>'.$gmt.'</option>'."\n";
|
|
|
|
|
}
|
|
|
|
|
print '</select>';
|
|
|
|
|
}
|
2010-05-03 08:22:35 +00:00
|
|
|
|
2011-08-11 01:34:54 +00:00
|
|
|
|
|
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
2011-08-11 01:34:54 +00:00
|
|
|
/**
|
2018-08-13 15:26:32 +00:00
|
|
|
* Return html select list with available languages (key='en_US', value='United States' for example)
|
2011-08-31 10:59:54 +00:00
|
|
|
*
|
2026-02-12 15:29:11 +00:00
|
|
|
* @param string $selected Paper format preselected
|
2018-08-13 15:26:32 +00:00
|
|
|
* @param string $htmlname Name of HTML select field
|
2019-02-27 22:55:18 +00:00
|
|
|
* @param string $filter Value to filter on code
|
|
|
|
|
* @param int $showempty Add empty value
|
2021-07-06 14:12:11 +00:00
|
|
|
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
|
2019-02-27 22:55:18 +00:00
|
|
|
* @return string Return HTML output
|
2011-08-11 01:34:54 +00:00
|
|
|
*/
|
2024-01-10 18:52:21 +00:00
|
|
|
public function select_paper_format($selected = '', $htmlname = 'paperformat_id', $filter = '', $showempty = 0, $forcecombo = 0)
|
2011-08-11 01:34:54 +00:00
|
|
|
{
|
2018-09-02 21:01:14 +00:00
|
|
|
// phpcs:enable
|
2011-08-11 01:34:54 +00:00
|
|
|
global $langs;
|
|
|
|
|
|
2014-02-17 14:21:19 +00:00
|
|
|
$langs->load("dict");
|
|
|
|
|
|
|
|
|
|
$sql = "SELECT code, label, width, height, unit";
|
2022-01-27 09:19:35 +00:00
|
|
|
$sql .= " FROM ".$this->db->prefix()."c_paper_format";
|
2020-02-21 16:53:37 +00:00
|
|
|
$sql .= " WHERE active=1";
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($filter) {
|
|
|
|
|
$sql .= " AND code LIKE '%".$this->db->escape($filter)."%'";
|
|
|
|
|
}
|
2020-10-31 13:32:18 +00:00
|
|
|
|
2024-03-09 15:32:02 +00:00
|
|
|
$paperformat = array();
|
|
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
$resql = $this->db->query($sql);
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($resql) {
|
2020-10-31 13:32:18 +00:00
|
|
|
$num = $this->db->num_rows($resql);
|
|
|
|
|
$i = 0;
|
2021-02-23 21:03:23 +00:00
|
|
|
while ($i < $num) {
|
2020-10-31 13:32:18 +00:00
|
|
|
$obj = $this->db->fetch_object($resql);
|
|
|
|
|
$unitKey = $langs->trans('SizeUnit'.$obj->unit);
|
|
|
|
|
|
|
|
|
|
$paperformat[$obj->code] = $langs->trans('PaperFormat'.strtoupper($obj->code)).' - '.round($obj->width).'x'.round($obj->height).' '.($unitKey == 'SizeUnit'.$obj->unit ? $obj->unit : $unitKey);
|
|
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2014-02-17 14:21:19 +00:00
|
|
|
dol_print_error($this->db);
|
|
|
|
|
return '';
|
|
|
|
|
}
|
2020-02-21 16:53:37 +00:00
|
|
|
$out = '';
|
2011-08-11 01:34:54 +00:00
|
|
|
|
2020-02-21 16:53:37 +00:00
|
|
|
$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($showempty) {
|
2020-02-21 16:53:37 +00:00
|
|
|
$out .= '<option value=""';
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($selected == '') {
|
|
|
|
|
$out .= ' selected';
|
|
|
|
|
}
|
2020-02-21 16:53:37 +00:00
|
|
|
$out .= '> </option>';
|
2011-08-11 01:34:54 +00:00
|
|
|
}
|
2021-02-23 21:03:23 +00:00
|
|
|
foreach ($paperformat as $key => $value) {
|
|
|
|
|
if ($selected == $key) {
|
2020-02-21 16:53:37 +00:00
|
|
|
$out .= '<option value="'.$key.'" selected>'.$value.'</option>';
|
2020-05-21 13:05:19 +00:00
|
|
|
} else {
|
2020-02-21 16:53:37 +00:00
|
|
|
$out .= '<option value="'.$key.'">'.$value.'</option>';
|
2011-08-11 01:34:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
2020-02-21 16:53:37 +00:00
|
|
|
$out .= '</select>';
|
2011-08-11 01:34:54 +00:00
|
|
|
|
2021-07-06 14:12:11 +00:00
|
|
|
if (!$forcecombo) {
|
|
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
|
|
|
|
$out .= ajax_combobox($htmlname);
|
|
|
|
|
}
|
2021-07-04 17:23:04 +00:00
|
|
|
|
2011-08-11 01:34:54 +00:00
|
|
|
return $out;
|
|
|
|
|
}
|
2023-10-14 14:23:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2024-01-13 18:48:20 +00:00
|
|
|
* Function to show the combo select to chose a type of field (varchar, int, email, ...)
|
2023-10-14 14:23:28 +00:00
|
|
|
*
|
2024-09-15 23:50:58 +00:00
|
|
|
* @param string $htmlname Name of HTML select component
|
|
|
|
|
* @param string $type Type preselected
|
2024-09-16 22:22:47 +00:00
|
|
|
* @param array<string,string[]> $typewecanchangeinto Array of possible switch combination from 1 type to another one. This will grey not possible combinations.
|
2023-10-14 14:23:28 +00:00
|
|
|
* @return string The combo HTML select component
|
|
|
|
|
*/
|
|
|
|
|
public function selectTypeOfFields($htmlname, $type, $typewecanchangeinto = array())
|
|
|
|
|
{
|
2025-03-31 11:37:21 +00:00
|
|
|
$type2label = ExtraFields::getListOfTypesLabels();
|
2023-10-14 14:23:28 +00:00
|
|
|
|
|
|
|
|
$out = '';
|
|
|
|
|
|
2025-03-31 11:37:21 +00:00
|
|
|
$out .= '<!-- combo with type of extrafields -->'."\n";
|
2023-10-14 14:23:28 +00:00
|
|
|
$out .= '<select class="flat type" id="'.$htmlname.'" name="'.$htmlname.'">';
|
|
|
|
|
foreach ($type2label as $key => $val) {
|
|
|
|
|
$selected = '';
|
|
|
|
|
if ($key == $type) {
|
|
|
|
|
$selected = ' selected="selected"';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set $valhtml with the picto for the type
|
|
|
|
|
$valhtml = ($key ? getPictoForType($key) : '').$val;
|
|
|
|
|
|
|
|
|
|
if (empty($typewecanchangeinto) || in_array($key, $typewecanchangeinto[$type])) {
|
|
|
|
|
$out .= '<option value="'.$key.'"'.$selected.' data-html="'.dol_escape_htmltag($valhtml).'">'.($val ? $val : ' ').'</option>';
|
|
|
|
|
} else {
|
|
|
|
|
$out .= '<option value="'.$key.'" disabled="disabled"'.$selected.' data-html="'.dol_escape_htmltag($valhtml).'">'.($val ? $val : ' ').'</option>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$out .= '</select>';
|
|
|
|
|
$out .= ajax_combobox('type');
|
|
|
|
|
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
2010-05-03 08:22:35 +00:00
|
|
|
}
|