fix an old error (#29850)

* fix an old error

* fix OdfException is never thrown in the try block

* fix OdfException is never thrown in the try block

* fix Undefined array key "name"

* fix missing translation

* fix missing translation

* fix Undefined variable $lineid

* fix warnings

* fix upload dir

* fix phpcs
This commit is contained in:
Frédéric FRANCE 2024-06-08 16:59:40 +02:00 committed by GitHub
parent 53f8b7693e
commit 1ff0e8a821
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 41 additions and 48 deletions

View File

@ -931,7 +931,6 @@ WebServiceKey
WebServiceURL
Website
WebsiteMustBeSameThanClonedPageIfTranslation
Weighted
WelcomeOnOnlineSignaturePage
WidgetDisabledAsModuleDisabled
Widgets

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@products.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2024 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
@ -412,8 +412,6 @@ class doc_generic_product_odt extends ModelePDFProduct
foreach ($array_lines as $key => $val) {
try {
$listlines->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}

View File

@ -3,7 +3,7 @@
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro>
* Copyright (C) 2016-2023 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
@ -596,8 +596,8 @@ class doc_generic_project_odt extends ModelePDFProjects
// Make substitution
$substitutionarray = array(
'__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email,
'__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email,
);
complete_substitutions_array($substitutionarray, $langs, $object);
// Call the ODTSubstitution hook
@ -610,10 +610,10 @@ class doc_generic_project_odt extends ModelePDFProjects
$odfHandler = new Odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->project->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
'PATH_TO_TMP' => $conf->project->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
)
);
} catch (Exception $e) {
@ -624,9 +624,6 @@ class doc_generic_project_odt extends ModelePDFProjects
// After construction $odfHandler->contentXml contains content and
// [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
// [!-- BEGIN lines --]*[!-- END lines --]
//print html_entity_decode($odfHandler->__toString());
//print exit;
// Define substitution array
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
@ -772,8 +769,6 @@ class doc_generic_project_odt extends ModelePDFProjects
foreach ($tmparray as $key => $val) {
try {
$listlinestasktime->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
@ -805,8 +800,6 @@ class doc_generic_project_odt extends ModelePDFProjects
foreach ($tmparray as $key => $val) {
try {
$listlinestasktime->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
@ -831,8 +824,6 @@ class doc_generic_project_odt extends ModelePDFProjects
foreach ($tmparray as $key => $val) {
try {
$listtasksfiles->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
@ -866,8 +857,6 @@ class doc_generic_project_odt extends ModelePDFProjects
foreach ($tmparray as $key => $val) {
try {
$listlines->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
@ -913,8 +902,6 @@ class doc_generic_project_odt extends ModelePDFProjects
foreach ($tmparray as $key => $val) {
try {
$listlines->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
@ -1105,8 +1092,6 @@ class doc_generic_project_odt extends ModelePDFProjects
foreach ($tmparray as $key => $val) {
try {
$listlines->setVars($key, $val, true, 'UTF-8');
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
} catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}

View File

@ -3,7 +3,7 @@
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
@ -318,14 +318,14 @@ class doc_generic_task_odt extends ModelePDFTask
global $conf;
return array(
'tasktime_rowid' => $tasktime['rowid'],
'tasktime_task_date' => dol_print_date($tasktime['task_date'], 'day'),
'tasktime_task_duration' => convertSecondToTime($tasktime['task_duration'], 'all'),
'tasktime_note' => $tasktime['note'],
'tasktime_fk_user' => $tasktime['fk_user'],
'tasktime_user_name' => $tasktime['name'],
'tasktime_user_first' => $tasktime['firstname'],
'tasktime_fullcivname' => $tasktime['fullcivname']
'tasktime_rowid' => $tasktime['rowid'],
'tasktime_task_date' => dol_print_date($tasktime['task_date'], 'day'),
'tasktime_task_duration' => convertSecondToTime($tasktime['task_duration'], 'all'),
'tasktime_note' => $tasktime['note'],
'tasktime_fk_user' => $tasktime['fk_user'],
'tasktime_user_name' => $tasktime['lastname'],
'tasktime_user_first' => $tasktime['firstname'],
'tasktime_fullcivname' => $tasktime['fullcivname']
);
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 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
@ -198,10 +199,10 @@ if ($action == 'convert') {
if ($vat_src_code_old) {
$sql .= " AND default_vat_code = '".$db->escape($vat_src_code_old)."'";
} else {
" AND default_vat_code = IS NULL";
$sql .= " AND default_vat_code = IS NULL";
}
$sql .= " AND s.fk_pays = ".((int) $country_id);
//print $sql;
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);

View File

@ -1401,7 +1401,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
if (strcmp($object->opp_amount, '')) {
print '<span class="amount">'.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).'</span>';
if (strcmp($object->opp_percent, '')) {
print ' &nbsp; &nbsp; &nbsp; <span title="'.dol_escape_htmltag($langs->trans('OpportunityWeightedAmount')).'"><span class="opacitymedium">'.$langs->trans("Weighted").'</span>: <span class="amount">'.price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).'</span></span>';
print ' &nbsp; &nbsp; &nbsp; <span title="'.dol_escape_htmltag($langs->trans('OpportunityWeightedAmount')).'"><span class="opacitymedium">'.$langs->trans("OpportunityWeightedAmountShort").'</span>: <span class="amount">'.price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).'</span></span>';
}
}
print '</td></tr>';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 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
@ -441,7 +442,7 @@ if ($id > 0 || !empty($ref)) {
if (strcmp($object->opp_amount, '')) {
print '<span class="amount">'.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).'</span>';
if (strcmp($object->opp_percent, '')) {
print ' &nbsp; &nbsp; &nbsp; <span title="'.dol_escape_htmltag($langs->trans('OpportunityWeightedAmount')).'"><span class="opacitymedium">'.$langs->trans("Weighted").'</span>: <span class="amount">'.price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).'</span></span>';
print ' &nbsp; &nbsp; &nbsp; <span title="'.dol_escape_htmltag($langs->trans('OpportunityWeightedAmount')).'"><span class="opacitymedium">'.$langs->trans("OpportunityWeightedAmountShort").'</span>: <span class="amount">'.price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).'</span></span>';
}
}
print '</td></tr>';

View File

@ -8,8 +8,9 @@
* Copyright (C) 2016 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021-2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr>
* Copyright (C) 2023 Frédéric France wfrederic.france@netlogic.fr>
* Copyright (C) 2023 Frédéric France wfrederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 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
* the Free Software Foundation; either version 3 of the License, or
@ -316,7 +317,7 @@ if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
if (!is_null($object->opp_amount) && strcmp($object->opp_amount, '')) {
print '<span class="amount">'.price($object->opp_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>';
if (strcmp($object->opp_percent, '')) {
print ' &nbsp; &nbsp; &nbsp; <span title="'.dol_escape_htmltag($langs->trans('OpportunityWeightedAmount')).'"><span class="opacitymedium">'.$langs->trans("Weighted").'</span>: <span class="amount">'.price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).'</span></span>';
print ' &nbsp; &nbsp; &nbsp; <span title="'.dol_escape_htmltag($langs->trans('OpportunityWeightedAmount')).'"><span class="opacitymedium">'.$langs->trans("OpportunityWeightedAmountShort").'</span>: <span class="amount">'.price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).'</span></span>';
}
}
print '</td></tr>';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 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
@ -215,7 +216,7 @@ if ($id > 0 || !empty($ref)) {
if (strcmp($projectstatic->opp_amount, '')) {
print price($projectstatic->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
if (strcmp($projectstatic->opp_percent, '')) {
print ' &nbsp; &nbsp; &nbsp; <span title="'.dol_escape_htmltag($langs->trans('OpportunityWeightedAmount')).'"><span class="opacitymedium">'.$langs->trans("Weighted").'</span>: <span class="amount">'.price($projectstatic->opp_amount * $projectstatic->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).'</span></span>';
print ' &nbsp; &nbsp; &nbsp; <span title="'.dol_escape_htmltag($langs->trans('OpportunityWeightedAmount')).'"><span class="opacitymedium">'.$langs->trans("OpportunityWeightedAmountShort").'</span>: <span class="amount">'.price($projectstatic->opp_amount * $projectstatic->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).'</span></span>';
}
}
print '</td></tr>';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 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
@ -85,7 +86,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->workstation->multidir_output[$object->entity]."/".$object->id;
$upload_dir = rtrim(getMultidirOutput($object, '', 1), '/');
}
// Permissions

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 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
@ -93,7 +94,7 @@ $permissiontodelete = $user->hasRight('workstation', 'workstation', 'delete') ||
$permissionnote = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->workstation->multidir_output[isset($object->entity) ? $object->entity : 1];
$upload_dir = rtrim(getMultidirOutput($object, '', 1), '/');
// Security check
$isdraft = 0;
@ -335,7 +336,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$parameters = array(
'formConfirm' => $formconfirm,
// 'lineid' => $lineid,
);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 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
@ -75,7 +76,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->workstation->multidir_output[$object->entity ? $object->entity : $conf->entity]."/workstation/".get_exdir(0, 0, 0, 1, $object);
$upload_dir = rtrim(getMultidirOutput($object, '', 1), '/');
}
// Security check
@ -186,7 +187,7 @@ if ($object->id) {
$modulepart = 'workstation';
$param = '&id='.$object->id;
//$relativepathwithnofile='workstation/' . dol_sanitizeFileName($object->id).'/';
$relativepathwithnofile = 'workstation/'.dol_sanitizeFileName($object->ref).'/';
//$relativepathwithnofile = 'workstation/'.dol_sanitizeFileName($object->ref).'/';
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 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
@ -53,7 +54,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->workstation->multidir_output[$object->entity]."/".$object->id;
$upload_dir = rtrim(getMultidirOutput($object, '', 1), '/');
}
$permissionnote = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_setnotes.inc.php