2
0
forked from Wavyzz/dolibarr

clean code (#35341)

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code
This commit is contained in:
Frédéric FRANCE
2025-09-15 16:15:49 +02:00
committed by GitHub
parent e69ff3428b
commit 4c80eee890
3 changed files with 13 additions and 36 deletions

View File

@@ -6924,12 +6924,6 @@ parameters:
count: 1
path: ../../../htdocs/core/class/html.formfile.class.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 3
path: ../../../htdocs/core/class/html.formfile.class.php
-
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
@@ -6960,24 +6954,6 @@ parameters:
count: 1
path: ../../../htdocs/core/class/html.formfile.class.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
count: 3
path: ../../../htdocs/core/class/html.formfile.class.php
-
message: '#^Variable \$fileinfo might not be defined\.$#'
identifier: variable.undefined
count: 4
path: ../../../htdocs/core/class/html.formfile.class.php
-
message: '#^Left side of && is always false\.$#'
identifier: booleanAnd.leftAlwaysFalse
count: 1
path: ../../../htdocs/core/class/html.formintervention.class.php
-
message: '#^Left side of && is always true\.$#'
identifier: booleanAnd.leftAlwaysTrue

View File

@@ -8,7 +8,7 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -1029,10 +1029,10 @@ class FormFile
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
//print '<span class="opacitymedium">'.$langs->trans("Hash").' : '.$file['share'].'</span>';
$forcedownload = 0;
$forcedownload = getDolGlobalInt('MAIN_FORCE_DOWNLOAD_IN_HTML_FORMFILE');
$paramlink = '';
if (!empty($file['share'])) {
$paramlink .= ($paramlink ? '&' : '').'hashp='.$file['share']; // Hash for public share
$paramlink .= /* ($paramlink ? '&' : ''). */'hashp='.$file['share']; // Hash for public share
}
if ($forcedownload) {
$paramlink .= ($paramlink ? '&' : '').'attachment=1';
@@ -1584,8 +1584,8 @@ class FormFile
print '<td class="center nowraponall">'.dol_print_date($file['date'], "dayhour", "tzuser").'</td>';
// Preview
$fileinfo = pathinfo($file['name']);
if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
$fileinfo = pathinfo($file['name']);
print '<td class="center">';
if (image_format_supported($file['name']) >= 0) {
if ($useinecm == 5 || $useinecm == 6) {
@@ -1639,10 +1639,10 @@ class FormFile
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
//print '<span class="opacitymedium">'.$langs->trans("Hash").' : '.$file['share'].'</span>';
$forcedownload = 0;
$forcedownload = getDolGlobalInt('MAIN_FORCE_DOWNLOAD_IN_HTML_FORMFILE');
$paramlink = '';
if (!empty($file['share'])) {
$paramlink .= ($paramlink ? '&' : '').'hashp='.$file['share']; // Hash for public share
$paramlink .= /* ($paramlink ? '&' : ''). */'hashp='.$file['share']; // Hash for public share
}
if ($forcedownload) {
$paramlink .= ($paramlink ? '&' : '').'attachment=1';
@@ -2163,10 +2163,10 @@ class FormFile
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
//print '<span class="opacitymedium">'.$langs->trans("Hash").' : '.$file['share'].'</span>';
$forcedownload = 0;
$forcedownload = getDolGlobalInt('MAIN_FORCE_DOWNLOAD_IN_HTML_FORMFILE');
$paramlink = '';
if (!empty($file['share'])) {
$paramlink .= ($paramlink ? '&' : '').'hashp='.$file['share']; // Hash for public share
$paramlink .= /* ($paramlink ? '&' : ''). */'hashp='.$file['share']; // Hash for public share
}
if ($forcedownload) {
$paramlink .= ($paramlink ? '&' : '').'attachment=1';

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2012-2013 Charles-Fr BENKE <charles.fr@benke.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -24,7 +25,7 @@
*/
/**
* Class to manage generation of HTML components for contract module
* Class to manage generation of HTML components for intervention module
*/
class FormIntervention
{
@@ -52,7 +53,7 @@ class FormIntervention
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show a combo list with contracts qualified for a third party
* Show a combo list with interventions qualified for a third party
*
* @param int $socid Id third party (-1=all, 0=only interventions not linked to a third party, id=intervention not linked or linked to third party id)
* @param int $selected Id intervention preselected
@@ -69,7 +70,7 @@ class FormIntervention
$out = '';
$hideunselectables = false;
$hideunselectables = getDolGlobalInt('MAIN_SHOW_UNSELECTABLES_IN_SELECT_INTERVENTIONS');
// Search all contacts
$sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut as status";
@@ -86,7 +87,7 @@ class FormIntervention
$sql .= " AND f.fk_statut = 0";
}
dol_syslog(get_class($this)."::select_intervention", LOG_DEBUG);
dol_syslog(get_class($this)."::select_interventions", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= '<select id="'.dol_escape_htmltag($htmlname).'" class="flat" name="'.dol_escape_htmltag($htmlname).'">';