2
0
forked from Wavyzz/dolibarr

clean code (#35640)

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code
This commit is contained in:
Frédéric FRANCE
2025-10-05 16:51:29 +02:00
committed by GitHub
parent 76916ad1cf
commit 78ca88f4fc
11 changed files with 80 additions and 102 deletions

View File

@@ -2358,30 +2358,12 @@ parameters:
count: 1 count: 1
path: ../../../htdocs/comm/propal/list.php path: ../../../htdocs/comm/propal/list.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: ../../../htdocs/commande/card.php
-
message: '#^Right side of && is always true\.$#'
identifier: booleanAnd.rightAlwaysTrue
count: 2
path: ../../../htdocs/commande/card.php
- -
message: '#^Variable \$classname might not be defined\.$#' message: '#^Variable \$classname might not be defined\.$#'
identifier: variable.undefined identifier: variable.undefined
count: 3 count: 3
path: ../../../htdocs/commande/card.php path: ../../../htdocs/commande/card.php
-
message: '#^Parameter \#1 \$object of method Orders\:\:_cleanObjectDatas\(\) expects object, array\<int, array\<string, int\|string\>\>\|int given\.$#'
identifier: argument.type
count: 1
path: ../../../htdocs/commande/class/api_orders.class.php
- -
message: '#^Variable \$socid might not be defined\.$#' message: '#^Variable \$socid might not be defined\.$#'
identifier: variable.undefined identifier: variable.undefined
@@ -9846,12 +9828,6 @@ parameters:
count: 1 count: 1
path: ../../../htdocs/fourn/card.php path: ../../../htdocs/fourn/card.php
-
message: '#^Parameter \#1 \$object of method SupplierOrders\:\:_cleanObjectDatas\(\) expects object, array\<mixed\> given\.$#'
identifier: argument.type
count: 1
path: ../../../htdocs/fourn/class/api_supplier_orders.class.php
- -
message: '#^Variable \$contact might not be defined\.$#' message: '#^Variable \$contact might not be defined\.$#'
identifier: variable.undefined identifier: variable.undefined

View File

@@ -303,6 +303,7 @@ foreach ($dirModMember as $dirroot) {
$arrayofmodules = dol_sort_array($arrayofmodules, 'position'); $arrayofmodules = dol_sort_array($arrayofmodules, 'position');
'@phan-var-force array<string,ModeleNumRefMembers> $arrayofmodules'; '@phan-var-force array<string,ModeleNumRefMembers> $arrayofmodules';
/** @var array<string,ModeleNumRefMembers> $arrayofmodules */
foreach ($arrayofmodules as $file => $modCodeMember) { foreach ($arrayofmodules as $file => $modCodeMember) {
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
@@ -405,6 +406,7 @@ foreach ($dirmodels as $reldir) {
require_once $dir.'/'.$file; require_once $dir.'/'.$file;
$module = new $classname($db); $module = new $classname($db);
'@phan-var-force doc_generic_member_odt|pdf_standard_member $module'; '@phan-var-force doc_generic_member_odt|pdf_standard_member $module';
/** @var doc_generic_member_odt|pdf_standard_member $module */
$modulequalified = 1; $modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {

View File

@@ -4,7 +4,7 @@
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2006-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com> * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr> * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com> * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -237,14 +237,16 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
print "</td></tr>\n"; print "</td></tr>\n";
// Force nature of member (mor/phy) // Force nature of member (mor/phy)
$morphys = array(); $morphys = [
$morphys["phy"] = $langs->trans("Physical"); "" => $langs->trans("MorAndPhy"), // for empty choice
$morphys["mor"] = $langs->trans("Moral"); "phy" => $langs->trans("Physical"),
"mor" => $langs->trans("Moral"),
];
print '<tr class="oddeven drag" id="trforcenature"><td>'; print '<tr class="oddeven drag" id="trforcenature"><td>';
print $langs->trans("ForceMemberNature"); print $langs->trans("ForceMemberNature");
print '</td><td>'; print '</td><td>';
$forcenature = getDolGlobalInt('MEMBER_NEWFORM_FORCEMORPHY', 0); $forcenature = getDolGlobalString('MEMBER_NEWFORM_FORCEMORPHY');
print $form->selectarray("MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature, 1); print $form->selectarray("MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature);
print "</td></tr>\n"; print "</td></tr>\n";
// Amount // Amount

View File

@@ -554,10 +554,11 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
// Morphy // Morphy
$morphys = array(); $morphys = [
$morphys[""] = $langs->trans("MorAndPhy"); "" => $langs->trans("MorAndPhy"), // for empty choice
$morphys["phy"] = $langs->trans("Physical"); "phy" => $langs->trans("Physical"),
$morphys["mor"] = $langs->trans("Moral"); "mor" => $langs->trans("Moral"),
];
print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>'; print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy'); print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
print "</td></tr>"; print "</td></tr>";

View File

@@ -391,11 +391,9 @@ if (empty($reshook)) {
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx'); $object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx');
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
if (!$error) { $ret = $extrafields->setOptionalsFromPost(null, $object);
$ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) {
if ($ret < 0) { $error++;
$error++;
}
} }
// If creation from another object of another module (Example: origin=propal, originid=1) // If creation from another object of another module (Example: origin=propal, originid=1)
@@ -440,6 +438,7 @@ if (empty($reshook)) {
$classname = ucfirst($subelement); $classname = ucfirst($subelement);
$srcobject = new $classname($db); $srcobject = new $classname($db);
'@phan-var-force Commande|Propal|Contrat $srcobject'; '@phan-var-force Commande|Propal|Contrat $srcobject';
/** @var Commande|Propal|Contrat $srcobject */
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines"); dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
$result = $srcobject->fetch($object->origin_id); $result = $srcobject->fetch($object->origin_id);
@@ -2044,7 +2043,7 @@ if (empty($reshook)) {
if (!$error && getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB') && $usercancreate) { if (!$error && getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB') && $usercancreate) {
if ($action == 'addcontact' && $usercancreate) { if ($action == 'addcontact') { // Test on permission already done
if ($object->id > 0) { if ($object->id > 0) {
$contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid')); $contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
@@ -2062,14 +2061,14 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} elseif ($action == 'swapstatut' && $usercancreate) { } elseif ($action == 'swapstatut') { // Test on permission already done
// bascule du statut d'un contact // bascule du statut d'un contact
if ($object->id > 0) { if ($object->id > 0) {
$result = $object->swapContactStatus(GETPOSTINT('ligne')); $result = $object->swapContactStatus(GETPOSTINT('ligne'));
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} elseif ($action == 'deletecontact' && $usercancreate) { } elseif ($action == 'deletecontact') { // Test on permission already done
// Efface un contact // Efface un contact
$result = $object->delete_contact($lineid); $result = $object->delete_contact($lineid);
@@ -2186,10 +2185,10 @@ if ($action == 'create' && $usercancreate) {
$fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0)); $fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));
$availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : 0); $availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : 0);
$shipping_method_id = (!empty($objectsrc->shipping_method_id) ? $objectsrc->shipping_method_id : (!empty($soc->shipping_method_id) ? $soc->shipping_method_id : 0)); $shipping_method_id = (!empty($objectsrc->shipping_method_id) ? $objectsrc->shipping_method_id : (!empty($soc->shipping_method_id) ? $soc->shipping_method_id : 0));
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0)); $warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
$demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0)); $demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0));
//$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0)); // $remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0));
//$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); // $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
$dateorder = !getDolGlobalString('MAIN_AUTOFILL_DATE_ORDER') ? -1 : ''; $dateorder = !getDolGlobalString('MAIN_AUTOFILL_DATE_ORDER') ? -1 : '';
$date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); $date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '');
@@ -2218,9 +2217,9 @@ if ($action == 'create' && $usercancreate) {
$shipping_method_id = $soc->shipping_method_id; $shipping_method_id = $soc->shipping_method_id;
$warehouse_id = $soc->fk_warehouse; $warehouse_id = $soc->fk_warehouse;
$demand_reason_id = $soc->demand_reason_id; $demand_reason_id = $soc->demand_reason_id;
//$remise_percent = $soc->remise_percent; // $remise_percent = $soc->remise_percent;
//$remise_absolue = 0; // $remise_absolue = 0;
$dateorder = !getDolGlobalString('MAIN_AUTOFILL_DATE_ORDER') ? -1 : ''; $dateorder = !getDolGlobalString('MAIN_AUTOFILL_DATE_ORDER') ? -1 : '';
if (isModEnabled("multicurrency") && !empty($soc->multicurrency_code)) { if (isModEnabled("multicurrency") && !empty($soc->multicurrency_code)) {
$currency_code = $soc->multicurrency_code; $currency_code = $soc->multicurrency_code;
@@ -2484,7 +2483,7 @@ if ($action == 'create' && $usercancreate) {
} }
// Categories // Categories
if (!empty($conf->categorie->enabled)) { if (isModEnabled('category')) {
print '<tr><td>' . $langs->trans("Categories") . '</td><td colspan="3">'; print '<tr><td>' . $langs->trans("Categories") . '</td><td colspan="3">';
print $form->selectCategories(Categorie::TYPE_ORDER, 'categories', $object); print $form->selectCategories(Categorie::TYPE_ORDER, 'categories', $object);
print "</td></tr>"; print "</td></tr>";
@@ -2521,13 +2520,12 @@ if ($action == 'create' && $usercancreate) {
$objectsrc->update_price(1); $objectsrc->update_price(1);
} }
print "\n<!-- " . $classname . " info -->"; print "\n<!-- " . $classname . " info -->\n";
print "\n"; print '<input type="hidden" name="amount" value="' . $objectsrc->total_ht . '">' . "\n";
print '<input type="hidden" name="amount" value="' . $objectsrc->total_ht . '">' . "\n"; print '<input type="hidden" name="total" value="' . $objectsrc->total_ttc . '">' . "\n";
print '<input type="hidden" name="total" value="' . $objectsrc->total_ttc . '">' . "\n"; print '<input type="hidden" name="tva" value="' . $objectsrc->total_tva . '">' . "\n";
print '<input type="hidden" name="tva" value="' . $objectsrc->total_tva . '">' . "\n"; print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">';
print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">'; print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
switch ($classname) { switch ($classname) {
case 'Propal': case 'Propal':
@@ -2752,7 +2750,6 @@ if ($action == 'create' && $usercancreate) {
); );
} }
$paymentTermsSelect = $form->getSelectConditionsPaiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200'); $paymentTermsSelect = $form->getSelectConditionsPaiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200');
$formquestion[] = array( $formquestion[] = array(
@@ -2819,12 +2816,17 @@ if ($action == 'create' && $usercancreate) {
if ($conf->browser->name == 'ie') { if ($conf->browser->name == 'ie') {
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
} }
$formquestion = array( $formquestion = [
// 'text' => $langs->trans("ConfirmClone"), // 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse') ? GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) [
); 'type' => 'other',
'name' => 'idwarehouse',
'label' => $langs->trans("SelectWarehouseForStockIncrease"),
'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse') ? GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)
]
];
} }
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('UnvalidateOrder'), $text, 'confirm_modif', $formquestion, "yes", 1, 220); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('UnvalidateOrder'), $text, 'confirm_modif', $formquestion, "yes", 1, 220);
@@ -2898,12 +2900,12 @@ if ($action == 'create' && $usercancreate) {
$langs->load('subtotals'); $langs->load('subtotals');
$type = 'title'; $type = 'title';
$depth_array = $object->getPossibleLevels($langs); $depth_array = $object->getPossibleLevels($langs);
require dol_buildpath('/core/tpl/subtotal_create.tpl.php'); include DOL_DOCUMENT_ROOT . '/core/tpl/subtotal_create.tpl.php';
} elseif ($action == 'add_subtotal_line') { } elseif ($action == 'add_subtotal_line') {
$langs->load('subtotals'); $langs->load('subtotals');
$type = 'subtotal'; $type = 'subtotal';
$titles = $object->getPossibleTitles(); $titles = $object->getPossibleTitles();
require dol_buildpath('/core/tpl/subtotal_create.tpl.php'); include DOL_DOCUMENT_ROOT . '/core/tpl/subtotal_create.tpl.php';
} }
// Call Hook formConfirm // Call Hook formConfirm
@@ -2956,7 +2958,6 @@ if ($action == 'create' && $usercancreate) {
} }
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
// Call Hook tabContentViewOrder // Call Hook tabContentViewOrder

View File

@@ -523,7 +523,7 @@ if ($action == 'create') {
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Category // Category
if (is_array($options) && count($options) && $conf->categorie->enabled) { if (is_array($options) && count($options) && isModEnabled('category')) {
print '<tr><td>'.$langs->trans("RubriquesTransactions").'</td><td>'; print '<tr><td>'.$langs->trans("RubriquesTransactions").'</td><td>';
print img_picto('', 'category').Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1, 0, 0, '', 0, 0, 0, '', 'minwidth300', 1); print img_picto('', 'category').Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1, 0, 0, '', 0, 0, 0, '', 'minwidth300', 1);
print '</td></tr>'; print '</td></tr>';

View File

@@ -431,6 +431,8 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir, $object =
if (is_null($object)) { if (is_null($object)) {
$object = new stdClass(); $object = new stdClass();
$object->id = null;
$object->element = null;
} }
$filearrayindatabase = dol_dir_list_in_database(rtrim($relativedir, "/\\"), '', null, 'name', SORT_ASC, 0, '', $object); $filearrayindatabase = dol_dir_list_in_database(rtrim($relativedir, "/\\"), '', null, 'name', SORT_ASC, 0, '', $object);
@@ -461,11 +463,6 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir, $object =
} }
} }
//var_dump($relativedir);
//var_dump($filearray);
//var_dump($filearrayindatabase);
//var_dump($object->entity);
// Complete filearray with properties found into $filearrayindatabase // Complete filearray with properties found into $filearrayindatabase
foreach ($filearray as $key => $val) { foreach ($filearray as $key => $val) {
$tmpfilename = preg_replace('/\.noexe$/', '', $filearray[$key]['name']); $tmpfilename = preg_replace('/\.noexe$/', '', $filearray[$key]['name']);

View File

@@ -272,7 +272,7 @@ class pdf_standard_member extends CommonStickerGenerator
* @param string $filename Name of output file (without extension) * @param string $filename Name of output file (without extension)
* @return int<-1,1> 1=OK, <=0=KO * @return int<-1,1> 1=OK, <=0=KO
*/ */
public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = '', $filename = 'tmp_cards') public function write_file($object, $outputlangs, $srctemplatepath = '', $mode = 'member', $nooutput = '', $filename = 'tmp_cards')
{ {
// phpcs:enable // phpcs:enable
global $user, $conf, $langs, $mysoc; global $user, $conf, $langs, $mysoc;

View File

@@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2008-2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2010 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2008-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr> * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -27,12 +27,6 @@
// Load Dolibarr environment // Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
/** /**
* @var Conf $conf * @var Conf $conf
* @var DoliDB $db * @var DoliDB $db
@@ -41,6 +35,12 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
* @var User $user * @var User $user
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('ecm', 'companies', 'other', 'users', 'orders', 'propal', 'bills', 'contracts')); $langs->loadLangs(array('ecm', 'companies', 'other', 'users', 'orders', 'propal', 'bills', 'contracts'));
@@ -143,9 +143,9 @@ if ($action == 'renamefile') { // Test on permission not required here. Must be
// Add directory // Add directory
if ($action == 'add' && $permissiontouploadfile) { if ($action == 'add' && $permissiontouploadfile) {
$ecmdir->ref = 'NOTUSEDYET'; $ecmdir->ref = 'NOTUSEDYET';
$ecmdir->label = GETPOST("label"); $ecmdir->label = GETPOST("label");
$ecmdir->description = GETPOST("desc"); $ecmdir->description = GETPOST("desc");
$id = $ecmdir->create($user); $id = $ecmdir->create($user);
if ($id > 0) { if ($id > 0) {
@@ -188,8 +188,6 @@ if ($action == 'refreshmanual' && $permissiontoread) {
$adirwascreated = 0; $adirwascreated = 0;
// Now we compare both trees to complete missing trees into database // Now we compare both trees to complete missing trees into database
//var_dump($disktree);
//var_dump($sqltree);
foreach ($disktree as $dirdesc) { // Loop on tree onto disk foreach ($disktree as $dirdesc) { // Loop on tree onto disk
$dirisindatabase = 0; $dirisindatabase = 0;
foreach ($sqltree as $dirsqldesc) { foreach ($sqltree as $dirsqldesc) {
@@ -202,7 +200,6 @@ if ($action == 'refreshmanual' && $permissiontoread) {
if (!$dirisindatabase) { if (!$dirisindatabase) {
$txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it"; $txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it";
dol_syslog($txt); dol_syslog($txt);
//print $txt."<br>\n";
// We must first find the fk_parent of directory to create $dirdesc['fullname'] // We must first find the fk_parent of directory to create $dirdesc['fullname']
$fk_parent = -1; $fk_parent = -1;
@@ -237,23 +234,24 @@ if ($action == 'refreshmanual' && $permissiontoread) {
} }
if ($fk_parent >= 0) { if ($fk_parent >= 0) {
$ecmdirtmp->ref = 'NOTUSEDYET'; $ecmdirtmp->ref = 'NOTUSEDYET';
$ecmdirtmp->label = dol_basename($dirdesc['fullname']); $ecmdirtmp->label = dol_basename($dirdesc['fullname']);
$ecmdirtmp->description = ''; $ecmdirtmp->description = '';
$ecmdirtmp->fk_parent = $fk_parent; $ecmdirtmp->fk_parent = $fk_parent;
$txt = "We create directory ".$ecmdirtmp->label." with parent ".$fk_parent; $txt = "We create directory ".$ecmdirtmp->label." with parent ".$fk_parent;
dol_syslog($txt); dol_syslog($txt);
//print $ecmdirtmp->cachenbofdoc."<br>\n";exit; //print $ecmdirtmp->cachenbofdoc."<br>\n";exit;
$id = $ecmdirtmp->create($user); $id = $ecmdirtmp->create($user);
if ($id > 0) { if ($id > 0) {
$newdirsql = array('id' => $id, $newdirsql = [
'id_mere' => $ecmdirtmp->fk_parent, 'id' => $id,
'label' => $ecmdirtmp->label, 'id_mere' => $ecmdirtmp->fk_parent,
'description' => $ecmdirtmp->description, 'label' => $ecmdirtmp->label,
'fullrelativename' => $relativepathmissing); 'description' => $ecmdirtmp->description,
'fullrelativename' => $relativepathmissing,
];
$sqltree[] = $newdirsql; // We complete fulltree for following loops $sqltree[] = $newdirsql; // We complete fulltree for following loops
//var_dump($sqltree);
$adirwascreated = 1; $adirwascreated = 1;
} else { } else {
dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR); dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR);
@@ -261,7 +259,6 @@ if ($action == 'refreshmanual' && $permissiontoread) {
} else { } else {
$txt = "Parent of ".$dirdesc['fullname']." not found"; $txt = "Parent of ".$dirdesc['fullname']." not found";
dol_syslog($txt); dol_syslog($txt);
//print $txt."<br>\n";
} }
} }
} }

View File

@@ -118,13 +118,13 @@ class PriceParser
if (in_array($code, array(9, 14, 19, 20))) { //Errors which have 0 arg if (in_array($code, array(9, 14, 19, 20))) { //Errors which have 0 arg
return $langs->trans("ErrorPriceExpression".$code); return $langs->trans("ErrorPriceExpression".$code);
} elseif (in_array($code, array(1, 2, 3, 4, 5, 8, 10, 11, 17, 21, 22))) { //Errors which have 1 arg } elseif (in_array($code, array(1, 2, 3, 4, 5, 8, 10, 11, 17, 21, 22))) { //Errors which have 1 arg
return $langs->trans("ErrorPriceExpression".$code, $info); return $langs->trans("ErrorPriceExpression".$code, (string) $info);
} elseif (in_array($code, array(6, 23))) { //Errors which have 2 args } elseif (in_array($code, array(6, 23))) { //Errors which have 2 args
return $langs->trans("ErrorPriceExpression".$code, $info[0], $info[1]); return $langs->trans("ErrorPriceExpression".$code, $info[0], $info[1]);
} elseif (in_array($code, array(7, 12, 13, 15, 16, 18))) { //Internal errors } elseif (in_array($code, array(7, 12, 13, 15, 16, 18))) { //Internal errors
return $langs->trans("ErrorPriceExpressionInternal", $code); return $langs->trans("ErrorPriceExpressionInternal", $code);
} else { //Unknown errors } else { //Unknown errors
return $langs->trans("ErrorPriceExpressionUnknown", $code); return $langs->trans("ErrorPriceExpressionUnknown", (string) $code);
} }
} }

View File

@@ -4,7 +4,7 @@
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org> * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr> * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Waël Almoman <info@almoman.com> * Copyright (C) 2021 Waël Almoman <info@almoman.com>
* Copyright (C) 2022 Udo Tamm <dev@dolibit.de> * Copyright (C) 2022 Udo Tamm <dev@dolibit.de>
@@ -609,9 +609,11 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Moral/Physic attribute // Moral/Physic attribute
$morphys = array(); $morphys = [
$morphys["phy"] = $langs->trans("Physical"); // "" => $langs->trans("MorAndPhy"),
$morphys["mor"] = $langs->trans("Moral"); "phy" => $langs->trans("Physical"),
"mor" => $langs->trans("Moral"),
];
$checkednature = GETPOST("morphy", 'alpha'); $checkednature = GETPOST("morphy", 'alpha');
$listetype_natures = $adht->morphyByType(1); // Load the array of morphy per type $listetype_natures = $adht->morphyByType(1); // Load the array of morphy per type
$listetype_natures_json = json_encode($listetype_natures); $listetype_natures_json = json_encode($listetype_natures);