Merge pull request #22184 from fboitel/fboitel-dev-scrutinizer-10/09/2022

Fix scrutinizer 1
This commit is contained in:
Laurent Destailleur 2022-09-25 17:17:48 +02:00 committed by GitHub
commit 8952530fad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 37 additions and 24 deletions

View File

@ -875,7 +875,7 @@ class AccountingAccount extends CommonObject
} elseif ($type == 'supplier') { } elseif ($type == 'supplier') {
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1); $result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
} }
if ($result < 0) { if (isset($result) && $result < 0) {
return -1; return -1;
} }

View File

@ -163,8 +163,8 @@ class AssetDepreciationOptions extends CommonObject
} }
// Unset required option (notnull) if field disabled // Unset required option (notnull) if field disabled
if (!empty($mode_info['enabled_field'])) { if (!empty($field_info['enabled_field'])) {
$info = explode(':', $mode_info['enabled_field']); $info = explode(':', $field_info['enabled_field']);
if ($this->deprecation_options[$info[0]][$info[1]] != $info[2] && isset($this->fields[$field_key]['notnull'])) { if ($this->deprecation_options[$info[0]][$info[1]] != $info[2] && isset($this->fields[$field_key]['notnull'])) {
unset($this->fields[$field_key]['notnull']); unset($this->fields[$field_key]['notnull']);
} }

View File

@ -94,6 +94,7 @@ function printDropdownBookmarksList()
$listbtn = '<a class="top-menu-dropdown-link" title="'.dol_escape_htmltag($langs->trans('Bookmarks')).'" href="'.DOL_URL_ROOT.'/bookmarks/list.php">'; $listbtn = '<a class="top-menu-dropdown-link" title="'.dol_escape_htmltag($langs->trans('Bookmarks')).'" href="'.DOL_URL_ROOT.'/bookmarks/list.php">';
$listbtn .= img_picto('', 'edit', 'class="paddingright opacitymedium"').$langs->trans('EditBookmarks').'</a>'; $listbtn .= img_picto('', 'edit', 'class="paddingright opacitymedium"').$langs->trans('EditBookmarks').'</a>';
$bookmarkList = '';
// Menu with list of bookmarks // Menu with list of bookmarks
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark"; $sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
$sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)"; $sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)";

View File

@ -878,7 +878,11 @@ class CMailFile
$keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
$keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
if (isset($supportedoauth2array)) {
$OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : '')); $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : ''));
} else {
$OAUTH_SERVICENAME = 'Unknown';
}
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';

View File

@ -758,6 +758,8 @@ class FormSetupItem
$val = GETPOST($this->confKey, 'array'); $val = GETPOST($this->confKey, 'array');
if ($val && is_array($val)) { if ($val && is_array($val)) {
$val_const = implode(',', $val); $val_const = implode(',', $val);
} else {
$val_const = '';
} }
} elseif ($this->type == 'html') { } elseif ($this->type == 'html') {
$val_const = GETPOST($this->confKey, 'restricthtml'); $val_const = GETPOST($this->confKey, 'restricthtml');

View File

@ -625,6 +625,8 @@ class Notify
$mimefilename_list[] = $ref.".pdf"; $mimefilename_list[] = $ref.".pdf";
} }
$labeltouse = !empty($labeltouse) ? $labeltouse : '';
$parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list, 'outputlangs'=>$outputlangs, 'labeltouse'=>$labeltouse); $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list, 'outputlangs'=>$outputlangs, 'labeltouse'=>$labeltouse);
if (!isset($action)) { if (!isset($action)) {
$action = ''; $action = '';

View File

@ -193,11 +193,12 @@ function dol_ftp_delete($connect_id, $file, $newsection)
* Download a FTP file * Download a FTP file
* *
* @param resource $connect_id Connection handler * @param resource $connect_id Connection handler
* @param string $file File * @param string $localfile The local file path
* @param string $file The remote file path
* @param string $newsection $newsection * @param string $newsection $newsection
* @return result * @return result
*/ */
function dol_ftp_get($connect_id, $file, $newsection) function dol_ftp_get($connect_id, $localfile, $file, $newsection)
{ {
global $conf; global $conf;

View File

@ -332,6 +332,7 @@ class printing_printgcp extends PrintingDriver
} }
$fileprint .= '/'.$file; $fileprint .= '/'.$file;
$mimetype = dol_mimetype($fileprint); $mimetype = dol_mimetype($fileprint);
$printer_id = '';
// select printer uri for module order, propal,... // select printer uri for module order, propal,...
$sql = "SELECT rowid, printer_id, copy FROM ".MAIN_DB_PREFIX."printing WHERE module='".$this->db->escape($module)."' AND driver='printgcp' AND userid=".((int) $user->id); $sql = "SELECT rowid, printer_id, copy FROM ".MAIN_DB_PREFIX."printing WHERE module='".$this->db->escape($module)."' AND driver='printgcp' AND userid=".((int) $user->id);
$result = $this->db->query($sql); $result = $this->db->query($sql);

View File

@ -317,7 +317,7 @@ if ($action == 'download') {
$newsection = $section; $newsection = $section;
$result = dol_ftp_get($connect_id, $file, $newsection); $result = dol_ftp_get($connect_id, $localfile, $file, $newsection);
if ($result) { if ($result) {

View File

@ -657,10 +657,12 @@ if (is_object($db)) {
} }
/** /**
* send email to validator for current leave represented by (id) * send email to validator for current leave represented by (id)
* @param $id validator for current leave represented by (id) *
* @param $cancreate flag for user right * @param int $id validator for current leave represented by (id)
* @param $now date * @param int $cancreate flag for user right
* @param $autoValidation boolean flag on autovalidation * @param int $now date
* @param int $autoValidation boolean flag on autovalidation
*
* @return stdClass * @return stdClass
* @throws Exception * @throws Exception
*/ */

View File

@ -82,7 +82,7 @@ if ($action == "send") {
$sendto = $email; $sendto = $email;
$from = $mysoc->email; $from = $mysoc->email;
$mail = new CMailFile($subject, $sendto, $from, $msg, array(), array(), array(), '', '', 0, 1); $mail = new CMailFile($subject, $sendto, $from, $msg, array(), array(), array(), '', '', 0, 1);
if ($mail->error || $mail->errors) { if ($mail->error || !empty($mail->errors)) {
setEventMessages($mail->error, $mail->errors, 'errors'); setEventMessages($mail->error, $mail->errors, 'errors');
} else { } else {
$result = $mail->sendfile(); $result = $mail->sendfile();