Qual: Fix phan notices (in order of appearance) (#31768)

* Qual: Fix phan notices (in order of appearance)

* Qual: Fix phan notices (in order of appearance)/2
This commit is contained in:
MDW 2024-11-12 00:35:14 +01:00 committed by GitHub
parent cf0782d96d
commit 56dc321665
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 160 additions and 212 deletions

View File

@ -2050,11 +2050,6 @@ parameters:
count: 1
path: ../../htdocs/blockedlog/admin/blockedlog_list.php
-
message: "#^Parameter \\#1 \\$objtoshow of function formatObject expects object, array given\\.$#"
count: 1
path: ../../htdocs/blockedlog/ajax/block-info.php
-
message: "#^Dead catch \\- Exception is never thrown in the try block\\.$#"
count: 1
@ -2355,6 +2350,11 @@ parameters:
count: 1
path: ../../htdocs/bookcal/availabilities_document.php
-
message: "#^Empty array passed to foreach\\.$#"
count: 1
path: ../../htdocs/bookcal/availabilities_list.php
-
message: "#^If condition is always false\\.$#"
count: 1
@ -2475,6 +2475,11 @@ parameters:
count: 1
path: ../../htdocs/bookcal/calendar_document.php
-
message: "#^Empty array passed to foreach\\.$#"
count: 1
path: ../../htdocs/bookcal/calendar_list.php
-
message: "#^If condition is always false\\.$#"
count: 1
@ -3130,11 +3135,6 @@ parameters:
count: 1
path: ../../htdocs/comm/mailing/cibles.php
-
message: "#^Variable \\$mesgs might not be defined\\.$#"
count: 1
path: ../../htdocs/comm/mailing/cibles.php
-
message: "#^Negated boolean expression is always true\\.$#"
count: 2
@ -3835,36 +3835,16 @@ parameters:
count: 1
path: ../../htdocs/commande/list_det.php
-
message: "#^Variable \\$oldref might not be defined\\.$#"
count: 1
path: ../../htdocs/commande/list_det.php
-
message: "#^Variable \\$permissiontoadd might not be defined\\.$#"
count: 1
path: ../../htdocs/commande/list_det.php
-
message: "#^Variable \\$permissiontoread might not be defined\\.$#"
count: 1
path: ../../htdocs/commande/list_det.php
-
message: "#^Variable \\$searchCategoryProductOperator might not be defined\\.$#"
count: 3
path: ../../htdocs/commande/list_det.php
-
message: "#^Variable \\$search_product_category_array might not be defined\\.$#"
count: 2
path: ../../htdocs/commande/list_det.php
-
message: "#^Variable \\$text_icon might not be defined\\.$#"
count: 1
path: ../../htdocs/commande/list_det.php
-
message: "#^If condition is always false\\.$#"
count: 1
@ -3910,16 +3890,6 @@ parameters:
count: 2
path: ../../htdocs/compta/bank/account_statement_document.php
-
message: "#^Variable \\$max might not be defined\\.$#"
count: 1
path: ../../htdocs/compta/bank/annuel.php
-
message: "#^Variable \\$min might not be defined\\.$#"
count: 1
path: ../../htdocs/compta/bank/annuel.php
-
message: "#^If condition is always false\\.$#"
count: 2
@ -3945,21 +3915,6 @@ parameters:
count: 1
path: ../../htdocs/compta/bank/bankentries_list.php
-
message: "#^Variable \\$numr might not be defined\\.$#"
count: 1
path: ../../htdocs/compta/bank/bankentries_list.php
-
message: "#^Variable \\$css might not be defined\\.$#"
count: 1
path: ../../htdocs/compta/bank/card.php
-
message: "#^Variable \\$name might not be defined\\.$#"
count: 4
path: ../../htdocs/compta/bank/card.php
-
message: "#^Variable \\$noback in empty\\(\\) always exists and is always falsy\\.$#"
count: 1
@ -4080,36 +4035,6 @@ parameters:
count: 3
path: ../../htdocs/compta/bank/graph.php
-
message: "#^Variable \\$morehtml might not be defined\\.$#"
count: 1
path: ../../htdocs/compta/bank/graph.php
-
message: "#^Variable \\$show1 might not be defined\\.$#"
count: 1
path: ../../htdocs/compta/bank/graph.php
-
message: "#^Variable \\$show2 might not be defined\\.$#"
count: 1
path: ../../htdocs/compta/bank/graph.php
-
message: "#^Variable \\$show3 might not be defined\\.$#"
count: 1
path: ../../htdocs/compta/bank/graph.php
-
message: "#^Variable \\$show4 might not be defined\\.$#"
count: 1
path: ../../htdocs/compta/bank/graph.php
-
message: "#^Variable \\$show5 might not be defined\\.$#"
count: 1
path: ../../htdocs/compta/bank/graph.php
-
message: "#^Right side of && is always true\\.$#"
count: 2
@ -4170,11 +4095,6 @@ parameters:
count: 1
path: ../../htdocs/compta/bank/releve.php
-
message: "#^Variable \\$total might not be defined\\.$#"
count: 3
path: ../../htdocs/compta/bank/releve.php
-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
@ -4215,11 +4135,6 @@ parameters:
count: 1
path: ../../htdocs/compta/bank/various_payment/card.php
-
message: "#^Variable \\$formproject might not be defined\\.$#"
count: 1
path: ../../htdocs/compta/bank/various_payment/card.php
-
message: "#^Variable \\$ref might not be defined\\.$#"
count: 1

View File

@ -10,11 +10,11 @@
return [
// # Issue statistics:
// PhanUndeclaredProperty : 560+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 520+ occurrences
// PhanUndeclaredGlobalVariable : 350+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 310+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 500+ occurrences
// PhanUndeclaredGlobalVariable : 340+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 270+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 180+ occurrences
// PhanTypeMismatchProperty : 160+ occurrences
// PhanTypeMismatchProperty : 140+ occurrences
// PhanPluginUnknownPropertyType : 130+ occurrences
// PhanPluginUnknownArrayMethodParamType : 120+ occurrences
// PhanPossiblyUndeclaredVariable : 110+ occurrences
@ -22,9 +22,9 @@ return [
// PhanRedefineFunction : 45+ occurrences
// PhanTypeExpectedObjectPropAccess : 45+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 45+ occurrences
// PhanTypeMismatchDimFetch : 40+ occurrences
// PhanPluginEmptyStatementIf : 35+ occurrences
// PhanTypeInvalidDimOffset : 35+ occurrences
// PhanPluginEmptyStatementIf : 30+ occurrences
// PhanTypeMismatchDimFetch : 30+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanEmptyForeach : 10+ occurrences
// PhanPluginUnknownObjectMethodCall : 10+ occurrences
@ -62,51 +62,34 @@ return [
'htdocs/api/class/api_login.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/api/class/api_setup.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/asset/admin/setup.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeInvalidDimOffset'],
'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanTypeInvalidDimOffset'],
'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'],
'htdocs/asset/depreciation.php' => ['PhanPluginEmptyStatementIf'],
'htdocs/asset/disposal.php' => ['PhanPluginEmptyStatementIf'],
'htdocs/asset/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/asset/model/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/asset/tpl/accountancy_codes_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/asset/tpl/depreciation_options_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/asset/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/asterisk/wrapper.php' => ['PhanRedefineFunction'],
'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/blockedlog/ajax/block-info.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/bom/bom_card.php' => ['PhanUndeclaredProperty'],
'htdocs/bom/bom_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/bom/class/api_boms.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/bom/tpl/objectline_edit.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/bom/tpl/objectline_view.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/bookcal/availabilities_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/bookcal/availabilities_list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/bookcal/calendar_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/bookcal/calendar_list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/bookcal/class/availabilities.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/bookcal/class/calendar.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/categories/class/categorie.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/categories/edit.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/index.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/info.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/photos.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/traduction.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/viewcat.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
'htdocs/categories/viewcat.php' => ['PhanUndeclaredProperty'],
'htdocs/collab/index.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'],
'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp'],
'htdocs/comm/action/class/api_agendaevents.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchProperty'],
'htdocs/comm/action/class/cactioncomm.class.php' => ['PhanPluginUnknownArrayPropertyType'],
'htdocs/comm/action/document.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/comm/action/index.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'],
'htdocs/comm/action/index.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'],
'htdocs/comm/action/info.php' => ['PhanUndeclaredProperty'],
'htdocs/comm/action/list.php' => ['PhanTypeMismatchProperty'],
'htdocs/comm/action/pertype.php' => ['PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchDimFetch'],
'htdocs/comm/action/peruser.php' => ['PhanTypeComparisonFromArray'],
'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/comm/mailing/cibles.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/comm/mailing/cibles.php' => ['PhanUndeclaredProperty'],
'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'],
'htdocs/comm/propal/card.php' => ['PhanTypeMismatchProperty'],
'htdocs/comm/propal/class/api_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
@ -116,21 +99,13 @@ return [
'htdocs/commande/class/commande.class.php' => ['PhanUndeclaredProperty'],
'htdocs/commande/customer.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/commande/list.php' => ['PhanUndeclaredProperty'],
'htdocs/commande/list_det.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/commande/list_det.php' => ['PhanTypeInvalidDimOffset'],
'htdocs/commande/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/accounting-files.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'],
'htdocs/compta/bank/account_statement_document.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/bank/annuel.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/bank/bankentries_list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/bank/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/bank/class/account.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/bank/class/api_bankaccounts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/bank/graph.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/bank/line.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/bank/releve.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/bank/transfer.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/bank/treso.php' => ['PhanTypeMismatchProperty'],
'htdocs/compta/bank/various_payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/line.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/bank/various_payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'],
@ -374,7 +349,6 @@ return [
'htdocs/don/payment/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/don/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/don/tpl/linkedobjectblock.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/ecm/class/ecmdirectory.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/ecm/dir_card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/ecm/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'],
@ -404,7 +378,7 @@ return [
'htdocs/expensereport/tpl/expensereport_linktofile.tpl.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/fichinter/card-rec.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'],
'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'],
'htdocs/fichinter/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
@ -637,7 +611,6 @@ return [
'htdocs/supplier_proposal/class/api_supplier_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'],
'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/supplier_proposal/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/takepos/admin/orderprinters.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/takepos/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/takepos/floors.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/takepos/freezone.php' => ['PhanTypeMismatchArgumentProbablyReal'],

View File

@ -67,7 +67,7 @@ $config['suppress_issue_types'] = [
'PhanCompatibleNegativeStringOffset', // return false positive
'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is
// 'PhanPluginUnknownArrayPropertyType', // Helps find missing array keys or mismatches, remaining occurrences are likely unused properties
// 'PhanTypeArraySuspiciousNullable', // All fixed.
'PhanTypeArraySuspiciousNullable', // About 400 cases
// 'PhanTypeInvalidDimOffset', // Helps identify missing array indexes in types or reference to unset indexes
'PhanTypeObjectUnsetDeclaredProperty',
'PhanTypePossiblyInvalidDimOffset', // a lot of false positive, in most cases, we want to keep the code as it is

View File

@ -542,7 +542,7 @@ if ($action == 'edit') {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$formaccounting = new FormAccounting($db);
print $formaccounting->select_account($selected, $constname, 1, null, 1, 1, 'minwidth150 maxwidth300', 1);
print $formaccounting->select_account($selected, $constname, 1, array(), 1, 1, 'minwidth150 maxwidth300', 1);
} else {
print '<input name="' . $constname . '" class="maxwidth200" value="' . dol_escape_htmltag($selected) . '">';
}

View File

@ -96,8 +96,11 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
/*
if (empty($reshook)) {
}
*/
/*

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -86,8 +87,10 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
/*
if (empty($reshook)) {
}
*/
/*

View File

@ -3,6 +3,7 @@
* Copyright (C) 2018-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -116,11 +117,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($val['visible'])) {
$visible = (int) dol_eval((string) $val['visible'], 1);
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>(abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
'label' => $val['label'],
'checked' => (($visible < 0) ? 0 : 1),
'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
'position' => $val['position'],
'help' => isset($val['help']) ? $val['help'] : ''
);
}
}
@ -143,7 +144,8 @@ if (!isModEnabled('asset')) {
if ($user->socid > 0) {
accessforbidden();
}
$socid = 0; if ($user->socid > 0) {
$socid = 0;
if ($user->socid > 0) {
$socid = $user->socid;
}
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
@ -498,7 +500,7 @@ foreach ($object->fields as $key => $val) {
} elseif ($key == 'lang') {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db);
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
} else {
print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
}
@ -509,7 +511,7 @@ foreach ($object->fields as $key => $val) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -541,7 +543,7 @@ foreach ($object->fields as $key => $val) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -625,7 +627,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -664,7 +666,7 @@ if ($num == 0) {
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View File

@ -495,7 +495,7 @@ foreach ($object->fields as $key => $val) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
$form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
@ -503,7 +503,7 @@ foreach ($object->fields as $key => $val) {
} elseif ($key == 'lang') {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db);
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
} else {
print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
}

View File

@ -441,7 +441,7 @@ if ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')) {
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromproduct') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"><label for="fillfromproduct"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'</label>';
print '<br>';
print '<div class="showforproductselector">';
$form->select_produits(GETPOSTINT('productid'), 'productid', '', '', 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1);
$form->select_produits(GETPOSTINT('productid'), 'productid', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1);
print ' &nbsp; <input type="submit" class="button small" id="submitproduct" name="submitproduct" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
print '</div>';
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 @@ $db->close();
/**
* formatObject
*
* @param Object $objtoshow Object to show
* @param Object|array<string,mixed> $objtoshow Object to show
* @param string $prefix Prefix of key
* @return string String formatted
*/

View File

@ -596,7 +596,7 @@ foreach ($object->fields as $key => $val) {
} elseif ($key == 'lang') {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db);
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
} else {
print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Alice Adminson <aadminson@example.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -105,7 +106,7 @@ foreach ($object->fields as $key => $val) {
}
// List of fields to search into when doing a "search in all"
// $fieldstosearchall = array();
$fieldstosearchall = array();
// foreach ($object->fields as $key => $val) {
// if (!empty($val['searchall'])) {
// $fieldstosearchall['t.'.$key] = $val['label'];
@ -120,10 +121,6 @@ foreach ($object->fields as $key => $val) {
// }
// $fieldstosearchall is supposedly defined further below, ensure that it is.
if (!isset($fieldstosearchall) || !is_array($fieldstosearchall)) {
$fieldstosearchall = array();
}
'
@phan-var-force array<string,string> $fieldstosearchall
';
@ -566,7 +563,7 @@ foreach ($object->fields as $key => $val) {
} elseif ($key == 'lang') {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db);
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
} else {
print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023 Alice Adminson <aadminson@example.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -105,7 +106,7 @@ foreach ($object->fields as $key => $val) {
}
// List of fields to search into when doing a "search in all"
// $fieldstosearchall = array();
$fieldstosearchall = array();
// foreach ($object->fields as $key => $val) {
// if (!empty($val['searchall'])) {
// $fieldstosearchall['t.'.$key] = $val['label'];
@ -119,10 +120,6 @@ foreach ($object->fields as $key => $val) {
// $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']);
// }
// $fieldstosearchall is supposedly defined further below, ensure that it is.
if (!isset($fieldstosearchall) || !is_array($fieldstosearchall)) {
$fieldstosearchall = array();
}
'
@phan-var-force array<string,string> $fieldstosearchall
';
@ -549,7 +546,7 @@ foreach ($object->fields as $key => $val) {
} elseif ($key == 'lang') {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db);
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
} else {
print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
}

View File

@ -549,7 +549,7 @@ if ($type == Categorie::TYPE_PRODUCT) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddProductServiceIntoCategory").' &nbsp;';
$form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1, array(), 0, 1, 0, '', 0, '', null);
$form->select_produits(0, 'elemid', '', 0, 0, -1, 2, '', 1, array(), 0, 1, 0, '', 0, '', null);
print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';

View File

@ -340,7 +340,7 @@ if (empty($reshook) && $action == 'add' && $usercancreate) {
$datef = dol_mktime(GETPOSTINT("p2hour"), GETPOSTINT("p2min"), GETPOSTINT("apsec"), GETPOSTINT("p2month"), GETPOSTINT("p2day"), GETPOSTINT("p2year"), 'tzuserrel');
}
//set end date to now if percentage is set to 100 and end date not set
$datef = (!$datef && $percentage == 100)?dol_now():$datef;
$datef = (!$datef && $percentage == 100) ? dol_now() : $datef;
// Check parameters
if (!$datef && $percentage == 100) {
@ -1463,13 +1463,16 @@ if ($action == 'create') {
if (!empty($_SESSION['assignedtouser'])) {
$listofuserid = json_decode($_SESSION['assignedtouser'], true);
}
if (!is_array($listofuserid)) {
$listofuserid = array();
}
$firstelem = reset($listofuserid);
if (isset($listofuserid[$firstelem['id']])) {
$listofuserid[$firstelem['id']]['transparency'] = (GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 0); // 0 by default when refreshing
}
}
print '<div class="assignedtouser">';
print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
print '</div>';
print '</td></tr>';
@ -1482,7 +1485,7 @@ if ($action == 'create') {
// Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 3);
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'minwidth300 quatrevingtpercent widthcentpercentminusx', 0, 0);
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), 0, 0, 'minwidth300 quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
}
@ -1501,13 +1504,16 @@ if ($action == 'create') {
if (!empty($_SESSION['assignedtoresource'])) {
$listofresourceid = json_decode($_SESSION['assignedtoresource'], true);
}
if (!is_array($listofresourceid)) {
$listofresourceid = array();
}
$firstelem = reset($listofresourceid);
if (isset($listofresourceid[$firstelem['id']])) {
$listofresourceid[$firstelem['id']]['transparency'] = (GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 0); // 0 by default when refreshing
}
}
print '<div class="assignedtoresource">';
print $form->select_dolresources_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtoresource', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0', 1, $listofresourceid);
print $form->select_dolresources_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtoresource', 1, array(), 0, '', array(), 0, 0, 0, 'AND u.statut != 0', 1, $listofresourceid);
print '</div>';
print '</td></tr>';
}
@ -1584,10 +1590,10 @@ if ($action == 'create') {
*/
$sav = getDolGlobalString('CONTACT_USE_SEARCH_TO_SELECT');
$conf->global->CONTACT_USE_SEARCH_TO_SELECT = 0;
print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 widthcentpercentminusxx maxwidth500', 0, 0, array(), false, 'multiple', 'contactid');
print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 widthcentpercentminusxx maxwidth500', 0, 0, 0, array(), 'multiple', 'contactid');
$conf->global->CONTACT_USE_SEARCH_TO_SELECT = $sav;
} else {
print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 widthcentpercentminusxx maxwidth500', 0, 0, array(), false, 'multiple', 'contactid');
print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 widthcentpercentminusxx maxwidth500', 0, 0, 0, array(), 'multiple', 'contactid');
}
print '</td></tr>';
@ -2083,7 +2089,7 @@ if ($id > 0) {
print '<tr><td class="tdtop nowrap fieldrequired">'.$langs->trans("ActionAssignedTo").'</td><td colspan="3">';
print '<div class="assignedtouser">';
print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
print '</div>';
/*if (in_array($user->id,array_keys($listofuserid)))
{
@ -2114,7 +2120,7 @@ if ($id > 0) {
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
}
@ -2264,9 +2270,11 @@ if ($id > 0) {
$actionCommReminder->typeremind = 'email';
}
$disabled = '';
/*
if ($object->datep < dol_now()) {
//$disabled = 'disabled title="'.dol_escape_htmltag($langs->trans("EventExpired")).'"';
}
*/
print '<label for="addreminder">'.img_picto('', 'bell', 'class="pictofixedwidth"').$langs->trans("AddReminder").'</label> <input type="checkbox" id="addreminder" name="addreminder"'.($checked ? ' '.$checked : '').($disabled ? ' '.$disabled : '').'><br>';
@ -2559,7 +2567,7 @@ if ($id > 0) {
$listofcontactid = array(); // not used yet
$listofotherid = array(); // not used yet
print '<div class="assignedtouser">';
print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid);
print $form->select_dolusers_forevent('view', 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid);
print '</div>';
/*
if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid)))

View File

@ -82,7 +82,7 @@ class CActionComm
public $picto;
/**
* @var array array of type_actions
* @var array array of type_actions // TODO: Remove or explain
*/
public $type_actions = array();

View File

@ -6,6 +6,7 @@
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -278,7 +279,7 @@ if ($object->id > 0) {
$listofuserid = array();
if (empty($donotclearsession)) {
if ($object->userownerid > 0) {
$listofuserid[$object->userownerid] = array('id'=>$object->userownerid, 'transparency'=>$object->transparency); // Owner first
$listofuserid[$object->userownerid] = array('id' => $object->userownerid, 'transparency' => $object->transparency); // Owner first
}
if (!empty($object->userassigned)) { // Now concat assigned users
// Restore array with key with same value than param 'id'
@ -298,7 +299,7 @@ if ($object->id > 0) {
$listofcontactid = array(); // not used yet
$listofotherid = array(); // not used yet
print '<div class="assignedtouser">';
print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid);
print $form->select_dolusers_forevent('view', 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid);
print '</div>';
/*if (in_array($user->id,array_keys($listofuserid)))
{

View File

@ -2158,9 +2158,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
'@phan-var-force ActionComm $event';
if (empty($reshook)) {
// Other calendar
/*
if (empty($event->fulldayevent)) {
//print $event->getNomUrl(2).' ';
}
*/
// Date
if (empty($event->fulldayevent)) {

View File

@ -1149,8 +1149,8 @@ while ($i < $imaxinloop) {
print '<td class="tdoverflowmax150">';
if ($obj->socid > 0) {
$societestatic->id = $obj->socid;
$societestatic->client = $obj->client;
$societestatic->name = $obj->societe;
$societestatic->client = (int) $obj->client;
$societestatic->name = (string) $obj->societe;
$societestatic->email = $obj->socemail;
print $societestatic->getNomUrl(1, '', 28);

View File

@ -93,6 +93,7 @@ $result = $object->fetch($id);
$hookmanager->initHooks(array('ciblescard', 'globalcard'));
$sqlmessage = '';
$mesgs = array();
// List of sending methods
$listofmethods = array();

View File

@ -91,6 +91,7 @@ $search_dateorder_end = dol_mktime(23, 59, 59, GETPOSTINT('search_dateorder_end_
$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datedelivery_start_month'), GETPOSTINT('search_datedelivery_start_day'), GETPOSTINT('search_datedelivery_start_year'));
$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datedelivery_end_month'), GETPOSTINT('search_datedelivery_end_day'), GETPOSTINT('search_datedelivery_end_year'));
$search_product_category_array = array();
if (isModEnabled('category')) {
$search_product_category_array = GETPOST("search_category_".Categorie::TYPE_PRODUCT."_list", "array");
$searchCategoryProductOperator = 0;
@ -255,6 +256,7 @@ if ($user->socid) {
}
$result = restrictedArea($user, 'commande', $id, '');
$permissiontoread = false;
/*
* Actions
@ -1498,6 +1500,7 @@ if ($resql) {
// Détail commande
$totalqty = 0;
$oldref = null;
$totalarray = array();
$totalarray['nbfield'] = 0;
@ -1816,7 +1819,7 @@ if ($resql) {
// Channel
if (!empty($arrayfields['c.fk_input_reason']['checked'])) {
print '<td>';
$form->formInputReason($_SERVER['PHP_SELF'], $obj->fk_input_reason, 'none', '');
$form->formInputReason($_SERVER['PHP_SELF'], $obj->fk_input_reason, 'none', 0);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -2101,6 +2104,7 @@ if ($resql) {
if (!empty($arrayfields['shippable']['checked'])) {
print '<td class="center">';
if (!empty($show_shippable_command) && isModEnabled('stock')) {
$text_icon = '';
if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
$generic_commande->loadExpeditions(); // Load array ->expeditions

View File

@ -417,11 +417,11 @@ if ($action == 'searchfiles' || $action == 'dl') { // Test on permission not req
//var_dump($files);
if (count($files) < 1) {
$nofile = array();
$nofile['id'] = $objd->id;
$nofile['entity'] = $objd->entity;
$nofile['id'] = (int) $objd->id;
$nofile['entity'] = (int) $objd->entity;
$nofile['date'] = $db->jdate($objd->date);
$nofile['date_due'] = $db->jdate($objd->date_due);
$nofile['paid'] = $objd->paid;
$nofile['paid'] = (int) $objd->paid;
$nofile['amount_ht'] = $objd->total_ht;
$nofile['amount_ttc'] = $objd->total_ttc;
$nofile['amount_vat'] = $objd->total_vat;
@ -444,11 +444,11 @@ if ($action == 'searchfiles' || $action == 'dl') { // Test on permission not req
$filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile;
} else {
foreach ($files as $key => $file) {
$file['id'] = $objd->id;
$file['entity'] = $objd->entity;
$file['id'] = (int) $objd->id;
$file['entity'] = (int) $objd->entity;
$file['date'] = $db->jdate($objd->date);
$file['date_due'] = $db->jdate($objd->date_due);
$file['paid'] = $objd->paid;
$file['paid'] = (int) $objd->paid;
$file['amount_ht'] = $objd->total_ht;
$file['amount_ttc'] = $objd->total_ttc;
$file['amount_vat'] = $objd->total_vat;
@ -816,7 +816,7 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<td class="nowraponall tdoverflowmax150">';
if ($data['item'] == 'Invoice') {
$invoice->id = $data['id'];
$invoice->id = (int) $data['id'];
$invoice->ref = $data['ref'];
$invoice->total_ht = $data['amount_ht'];
$invoice->total_ttc = $data['amount_ttc'];
@ -827,7 +827,7 @@ if (!empty($date_start) && !empty($date_stop)) {
$invoice->multicurrency_code = $data['currency'];
print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
} elseif ($data['item'] == 'SupplierInvoice') {
$supplier_invoice->id = $data['id'];
$supplier_invoice->id = (int) $data['id'];
$supplier_invoice->ref = $data['ref'];
$supplier_invoice->total_ht = $data['amount_ht'];
$supplier_invoice->total_ttc = $data['amount_ttc'];
@ -838,27 +838,27 @@ if (!empty($date_start) && !empty($date_stop)) {
$supplier_invoice->multicurrency_code = $data['currency'];
print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
} elseif ($data['item'] == 'ExpenseReport') {
$expensereport->id = $data['id'];
$expensereport->id = (int) $data['id'];
$expensereport->ref = $data['ref'];
print $expensereport->getNomUrl(1, 0, 0, 0, 0, 0);
} elseif ($data['item'] == 'SalaryPayment') {
$salary_payment->id = $data['id'];
$salary_payment->id = (int) $data['id'];
$salary_payment->ref = $data['ref'];
print $salary_payment->getNomUrl(1);
} elseif ($data['item'] == 'Donation') {
$don->id = $data['id'];
$don->id = (int) $data['id'];
$don->ref = $data['ref'];
print $don->getNomUrl(1, 0, '', 0);
} elseif ($data['item'] == 'SocialContributions') {
$charge_sociales->id = $data['id'];
$charge_sociales->id = (int) $data['id'];
$charge_sociales->ref = $data['ref'];
print $charge_sociales->getNomUrl(1, 0, 0, 0, 0);
} elseif ($data['item'] == 'VariousPayment') {
$various_payment->id = $data['id'];
$various_payment->id = (int) $data['id'];
$various_payment->ref = $data['ref'];
print $various_payment->getNomUrl(1, '', 0, 0);
} elseif ($data['item'] == 'LoanPayment') {
$payment_loan->id = $data['id'];
$payment_loan->id = (int) $data['id'];
$payment_loan->ref = $data['ref'];
print $payment_loan->getNomUrl(1, 0, 0, '', 0);
} else {

View File

@ -305,11 +305,11 @@ if ($result < 0) {
$obj = $db->fetch_object($resql);
$min = $db->jdate($obj->min);
$max = $db->jdate($obj->max);
$log = "graph.php: min=".$min." max=".$max;
dol_syslog($log);
} else {
dol_print_error($db);
}
$log = "graph.php: min=".$min." max=".$max;
dol_syslog($log);
// CRED PART
// Chargement du tableau des années

View File

@ -974,6 +974,7 @@ if ($resql) {
$last_receipts = array();
$last_releve = '';
$last_ok = 0;
$numr = 0;
$resqlr = $db->query($sql);
if ($resqlr) {
@ -1101,7 +1102,7 @@ if ($resql) {
// Bank line
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('RubriquesTransactions');
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, $search_bid, 'parent', null, null, 1);
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, $search_bid, 'parent', 0, 0, 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_bid', $cate_arbo, $search_bid, $tmptitle, 0, 0, '', 0, 0, 0, '', '', 1);
$moreforfilter .= '</div>';
}

View File

@ -505,7 +505,7 @@ if ($action == 'create') {
$arrayselected[] = $cat->id;
}
}
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
}
@ -594,6 +594,10 @@ if ($action == 'create') {
$name = 'cle_rib';
$sizecss = 'minwidth50';
$content = $object->cle_rib;
} else {
$name = 'undefined';
$sizecss = 'undefined';
$content = 'undefined';
}
print '<td>'.$langs->trans($val).'</td>';
@ -651,7 +655,7 @@ if ($action == 'create') {
print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
print '<td>';
print img_picto('', 'accounting_account', 'class="pictofixedwidth"');
print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
print $formaccounting->select_account($object->account_number, 'account_number', 1, array(), 1, 1);
if ($formaccounting->nbaccounts == 0) {
$langs->load("errors");
$htmltext = $langs->transnoentitiesnoconv("WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv("MenuAccountancy"), $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Chartofaccounts"));
@ -1069,7 +1073,7 @@ if ($action == 'create') {
$arrayselected[] = $cat->id;
}
}
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
}
@ -1110,7 +1114,7 @@ if ($action == 'create') {
if (isModEnabled('accounting')) {
/** @var FormAccounting $formaccounting */
print img_picto('', 'accounting_account', 'class="pictofixedwidth"');
print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
print $formaccounting->select_account($object->account_number, 'account_number', 1, array(), 1, 1);
if ($formaccounting->nbaccounts == 0) {
$langs->load("errors");
$htmltext = $langs->transnoentitiesnoconv("WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv("MenuAccountancy"), $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Chartofaccounts"));
@ -1182,6 +1186,10 @@ if ($action == 'create') {
$name = 'cle_rib';
$css = 'width50';
$content = $object->cle_rib;
} else {
$name = 'undefined';
$css = 'undefined';
$content = 'undefined';
}
print '<tr><td>'.$langs->trans($val).'</td>';

View File

@ -94,6 +94,13 @@ if (GETPOST("ref")) {
$title = $object->ref.' - '.$langs->trans("Graph");
$helpurl = "";
$show1 = '';
$show2 = '';
$show3 = '';
$show4 = '';
$show5 = '';
$morehtml = '';
llxHeader('', $title, $helpurl);
$result = dol_mkdir($conf->bank->dir_temp);

View File

@ -636,7 +636,7 @@ if ($result) {
// Bank line
print '<tr><td class="toptd">'.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1);
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, '', 'parent', 0, 0, 1);
$arrayselected = array();
@ -647,7 +647,7 @@ if ($result) {
$arrayselected[] = $cat->id;
}
}
print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, 0, 0, '', 0, "90%");
print "</td></tr>";
}

View File

@ -495,6 +495,8 @@ if (empty($numref)) {
$obj = $db->fetch_object($resql);
$total = $obj->amount;
$db->free($resql);
} else {
$total = 0;
}
$totalc = $totald = 0;

View File

@ -173,13 +173,13 @@ if ($action == 'add' && $user->hasRight('banque', 'transfer')) {
}
if (!$error) {
$bank_line_id_from = $tmpaccountfrom->addline($dateo[$n], $typefrom, $label[$n], price2num(-1 * (float) $amount[$n]), '', '', $user);
$bank_line_id_from = $tmpaccountfrom->addline($dateo[$n], $typefrom, $label[$n], price2num(-1 * (float) $amount[$n]), '', 0, $user);
}
if (!($bank_line_id_from > 0)) {
$error++;
}
if (!$error) {
$bank_line_id_to = $tmpaccountto->addline($dateo[$n], $typeto, $label[$n], $amountto[$n], '', '', $user);
$bank_line_id_to = $tmpaccountto->addline($dateo[$n], $typeto, $label[$n], $amountto[$n], '', 0, $user);
}
if (!($bank_line_id_to > 0)) {
$error++;

View File

@ -5,6 +5,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com
* Copyright (C) 2016-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -283,7 +284,7 @@ if (GETPOST("account") || GETPOST("ref")) {
if ($tmpobj->family == 'invoice') {
$facturestatic->ref = $tmpobj->ref;
$facturestatic->id = $tmpobj->objid;
$facturestatic->type = $tmpobj->type;
$facturestatic->type = (int) $tmpobj->type;
$ref = $facturestatic->getNomUrl(1, '');
$societestatic->id = $tmpobj->socid;

View File

@ -226,6 +226,8 @@ if (empty($reshook)) {
if ($result > 0) {
$result = $accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
}
} else {
$account_line = null;
}
if ($result >= 0) {
@ -233,7 +235,7 @@ if (empty($reshook)) {
header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/list.php');
exit;
} else {
$object->error = $accountline->error;
$object->error = $accountline ? $accountline->error : 'No AccountLine';
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
@ -356,9 +358,13 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) {
$form = new Form($db);
if (isModEnabled('accounting')) {
$formaccounting = new FormAccounting($db);
} else {
$formaccounting = null;
}
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
} else {
$formproject = null;
}
if ($id) {
@ -531,7 +537,7 @@ if ($action == 'create') {
// TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
print '<td>';
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1);
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, array(), 1, 1);
print '</td></tr>';
} else { // For external software
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountAccounting").'</td>';
@ -606,7 +612,7 @@ if ($id) {
$morehtmlref = '<div class="refidno">';
// Project
if (isModEnabled('project')) {
if (isModEnabled('project') && $formproject !== null) {
$langs->load("projects");
//$morehtmlref .= '<br>';
if ($permissiontoadd) {

View File

@ -449,4 +449,20 @@ class MailingTargets // This can't be abstract as it is used for some method
dol_syslog($msg, LOG_ERR);
return array();
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add destinations in the targets table
*
* @param int $mailing_id Id of emailing
* @return int Return integer < 0 on error, count of added when ok
*/
public function add_to_target($mailing_id)
{
// phpcs:enable
// Needs to be implemented in child class
$msg = get_class($this)."::".__FUNCTION__." not implemented";
dol_syslog($msg, LOG_ERR);
return -1;
}
}