Merge branch 'develop' into fix/PhanTypeMismatchDimAssignment

This commit is contained in:
Laurent Destailleur 2024-03-11 14:41:04 +01:00 committed by GitHub
commit e236553ea8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 1787 additions and 1821 deletions

View file

@ -9,8 +9,7 @@ concurrency:
cancel-in-progress: true
env:
CACHE_KEY_PART: ${{ github.event_name == 'pull_request' && format('{0}-{1}',
github.base_ref, github.head_ref) || github.ref_name }}
CACHE_KEY_PART: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }}
GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
@ -57,7 +56,8 @@ jobs:
# Run PHPStan
- name: Run PHPStan
id: phpstan
run: phpstan -vvv analyse --error-format=checkstyle --memory-limit 4G -a build/phpstan/bootstrap_action.php -c phpstan.neon | tee _stan.xml | cs2pr --graceful-warnings
run: |
phpstan -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php | tee _stan.xml | cs2pr --graceful-warnings
# continue-on-error: true
# Save cache

18
.gitignore vendored
View file

@ -66,8 +66,21 @@ doc/install.lock
/composer.json
/composer.lock
# to execute pre-commit
local.sh
# Local script, executed during pre-commit
/local.sh
# Local phpstan configuration
/phpstan.neon
/phpstan-baseline.neon
# Logs
/*.log
# Vim swap files
*.sw?
# Generated by PHPUNIT.BAT
/INI_PHPUNIT
# ignore cache builds
/build/phpstan/phpstan
@ -75,3 +88,4 @@ local.sh
phpstan_custom.neon
/.php-cs-fixer.cache
/.php_cs.cache
/.cache

View file

@ -10,7 +10,6 @@
return [
// # Issue statistics:
// PhanPluginSuspiciousParamPosition : 45+ occurrences
// PhanPluginDuplicateIfStatements : 30+ occurrences
// PhanParamSignatureMismatch : 25+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences
@ -32,26 +31,19 @@ return [
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
'htdocs/adherents/card.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/adherents/stats/geo.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/adherents/type.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/admin/receiptprinter.php' => ['PhanRedefineFunctionInternal'],
'htdocs/admin/translation.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/bom/bom_list.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected'],
'htdocs/categories/viewcat.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/collab/index.php' => ['PhanParamTooMany'],
'htdocs/comm/action/card.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/comm/action/index.php' => ['PhanPluginSuspiciousParamPosition', 'PhanTypeArraySuspiciousNull', 'PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/comm/action/pertype.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/comm/action/peruser.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/comm/mailing/card.php' => ['PhanPluginDuplicateIfStatements', 'PhanPluginSuspiciousParamPosition'],
'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/comm/mailing/cibles.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/comm/mailing/info.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/comm/propal/list.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/commande/list.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/compta/accounting-files.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/compta/bank/various_payment/card.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginSuspiciousParamPosition'],
@ -68,38 +60,34 @@ return [
'htdocs/compta/sociales/note.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/compta/tva/document.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/actions_massactions.inc.php' => ['PhanPluginDuplicateIfStatements', 'PhanPluginSuspiciousParamOrder'],
'htdocs/core/actions_massactions.inc.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/class/commondocgenerator.class.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/core/class/commonobject.class.php' => ['PhanPluginDuplicateIfCondition', 'PhanPluginDuplicateIfStatements', 'PhanPluginSuspiciousParamPosition'],
'htdocs/core/class/commonobject.class.php' => ['PhanPluginDuplicateIfCondition', 'PhanPluginSuspiciousParamPosition'],
'htdocs/core/class/evalmath.class.php' => ['PhanPluginUnsafeEval'],
'htdocs/core/class/html.form.class.php' => ['PhanPluginDuplicateIfStatements', 'PhanPluginSuspiciousParamPosition'],
'htdocs/core/class/html.form.class.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/class/html.formmail.class.php' => ['PhanNoopArray'],
'htdocs/core/class/rssparser.class.php' => ['PhanPluginDuplicateIfStatements', 'PhanUndeclaredFunctionInCallable'],
'htdocs/core/db/mysqli.class.php' => ['PhanParamSignatureMismatch', 'PhanPluginDuplicateIfStatements'],
'htdocs/core/class/rssparser.class.php' => ['PhanUndeclaredFunctionInCallable'],
'htdocs/core/db/mysqli.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/db/pgsql.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/db/sqlite3.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/get_info.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginDuplicateIfCondition'],
'htdocs/core/lib/ftp.lib.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanPluginAlwaysReturnFunction', 'PhanPluginDuplicateIfCondition', 'PhanPluginUnsafeEval', 'PhanRedefineFunctionInternal'],
'htdocs/core/lib/price.lib.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/lib/usergroups.lib.php' => ['PhanNoopArrayAccess'],
'htdocs/core/menus/standard/auguria_menu.php' => ['PhanParamSuspiciousOrder', 'PhanPluginDuplicateIfStatements'],
'htdocs/core/menus/standard/eldy_menu.php' => ['PhanParamSuspiciousOrder', 'PhanPluginDuplicateIfStatements'],
'htdocs/core/menus/standard/empty.php' => ['PhanParamSuspiciousOrder', 'PhanPluginDuplicateIfStatements'],
'htdocs/core/menus/standard/auguria_menu.php' => ['PhanParamSuspiciousOrder'],
'htdocs/core/menus/standard/eldy_menu.php' => ['PhanParamSuspiciousOrder'],
'htdocs/core/menus/standard/empty.php' => ['PhanParamSuspiciousOrder'],
'htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/modules/member/doc/pdf_standard.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/modules/movement/doc/pdf_standard.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/core/modules/societe/modules_societe.class.php' => ['PhanPluginDuplicateIfCondition'],
'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'],
'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany'],
'htdocs/ecm/index_auto.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/expensereport/card.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/fourn/facture/card-rec.php' => ['PhanPluginSuspiciousParamPosition'],
@ -114,8 +102,6 @@ return [
'htdocs/mrp/class/mo.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/product/admin/product_tools.php' => ['PhanNoopStringLiteral'],
'htdocs/product/card.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/product/popuprop.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/product/stats/card.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/projet/tasks/list.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/public/bookcal/index.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/public/opensurvey/index.php' => ['PhanPluginSuspiciousParamOrder'],
@ -126,7 +112,6 @@ return [
'htdocs/takepos/invoice.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/user/class/user.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/variants/class/ProductCombination.class.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/webportal/class/html.formwebportal.class.php' => ['PhanPluginSuspiciousParamPosition'],
'internal' => ['PhanUndeclaredConstant'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.

View file

@ -5,6 +5,7 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.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
@ -206,7 +207,7 @@ if ($action == 'update') {
$sql_exists .= " WHERE fk_product = " . ((int) $productid) . " AND entity = " . ((int) $conf->entity);
$resql_exists = $db->query($sql_exists);
if (!$resql_exists) {
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$resql_exists.'</pre></span></div>';
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.json_encode($resql_exists).'</pre></span></div>';
$ko++;
} else {
$nb_exists = $db->num_rows($resql_exists);

View file

@ -528,25 +528,45 @@ $sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.doc_date') {
$sqlwhere[] = $key."='".$db->idate($value)."'";
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key."'".$db->escape($value)."'";
$sqlwhere[] = $db->sanitize($key).' = \''.$db->idate($value).'\'';
} elseif ($key == 't.doc_date>=') {
$sqlwhere[] = "t.doc_date >= '".$db->idate($value)."'";
} elseif ($key == 't.doc_date<=') {
$sqlwhere[] = "t.doc_date <= '".$db->idate($value)."'";
} elseif ($key == 't.doc_date>') {
$sqlwhere[] = "t.doc_date > '".$db->idate($value)."'";
} elseif ($key == 't.doc_date<') {
$sqlwhere[] = "t.doc_date < '".$db->idate($value)."'";
} elseif ($key == 't.numero_compte>=') {
$sqlwhere[] = "t.numero_compte >= '".$db->escape($value)."'";
} elseif ($key == 't.numero_compte<=') {
$sqlwhere[] = "t.numero_compte <= '".$db->escape($value)."'";
} elseif ($key == 't.subledger_account>=') {
$sqlwhere[] = "t.subledger_account >= '".$db->escape($value)."'";
} elseif ($key == 't.subledger_account<=') {
$sqlwhere[] = "t.subledger_account <= '".$db->escape($value)."'";
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.((int) $value);
$sqlwhere[] = $db->sanitize($key).'='.((int) $value);
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
$sqlwhere[] = $db->sanitize($key)." LIKE '".$db->escape($db->escapeforlike($value))."%'";
} elseif ($key == 't.subledger_account') {
$sqlwhere[] = natural_search($key, $value, 0, 1);
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.tms>=') {
$sqlwhere[] = "t.tms >= '".$db->idate($value)."'";
} elseif ($key == 't.tms<=') {
$sqlwhere[] = "t.tms <= '".$db->idate($value)."'";
} elseif ($key == 't.date_creation>=') {
$sqlwhere[] = 't.date_creation >= \''.$db->idate($value).'\'';
} elseif ($key == 't.date_creation<=') {
$sqlwhere[] = 't.date_creation <= \''.$db->idate($value).'\'';
} elseif ($key == 't.date_export>=') {
$sqlwhere[] = 't.date_export >= \''.$db->idate($value).'\'';
} elseif ($key == 't.date_export<=') {
$sqlwhere[] = 't.date_export <= \''.$db->idate($value).'\'';
} elseif ($key == 't.date_validated>=') {
$sqlwhere[] = 't;date_validate >= \''.$db->idate($value).'\'';
} elseif ($key == 't.date_validated<=') {
$sqlwhere[] = 't;date_validate <= \''.$db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') {

View file

@ -620,25 +620,45 @@ $sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.doc_date') {
$sqlwhere[] = $key."='".$db->idate($value)."'";
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key."'".$db->escape($value)."'";
$sqlwhere[] = $db->sanitize($key).' = \''.$db->idate($value).'\'';
} elseif ($key == 't.doc_date>=') {
$sqlwhere[] = "t.doc_date >= '".$db->idate($value)."'";
} elseif ($key == 't.doc_date<=') {
$sqlwhere[] = "t.doc_date <= '".$db->idate($value)."'";
} elseif ($key == 't.doc_date>') {
$sqlwhere[] = "t.doc_date > '".$db->idate($value)."'";
} elseif ($key == 't.doc_date<') {
$sqlwhere[] = "t.doc_date < '".$db->idate($value)."'";
} elseif ($key == 't.numero_compte>=') {
$sqlwhere[] = "t.numero_compte >= '".$db->escape($value)."'";
} elseif ($key == 't.numero_compte<=') {
$sqlwhere[] = "t.numero_compte <= '".$db->escape($value)."'";
} elseif ($key == 't.subledger_account>=') {
$sqlwhere[] = "t.subledger_account >= '".$db->escape($value)."'";
} elseif ($key == 't.subledger_account<=') {
$sqlwhere[] = "t.subledger_account <= '".$db->escape($value)."'";
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.((int) $value);
$sqlwhere[] = $db->sanitize($key).' = '.((int) $value);
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
$sqlwhere[] = $db->sanitize($key)." LIKE '".$db->escape($db->escapeforlike($value))."%'";
} elseif ($key == 't.subledger_account') {
$sqlwhere[] = natural_search($key, $value, 0, 1);
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.tms>=') {
$sqlwhere[] = "t.tms >= '".$db->idate($value)."'";
} elseif ($key == 't.tms<=') {
$sqlwhere[] = "t.tms <= '".$db->idate($value)."'";
} elseif ($key == 't.date_creation>=') {
$sqlwhere[] = 't.date_creation >= \''.$db->idate($value).'\'';
} elseif ($key == 't.date_creation<=') {
$sqlwhere[] = 't.date_creation <= \''.$db->idate($value).'\'';
} elseif ($key == 't.date_export>=') {
$sqlwhere[] = 't.date_export >= \''.$db->idate($value).'\'';
} elseif ($key == 't.date_export<=') {
$sqlwhere[] = 't.date_export <= \''.$db->idate($value).'\'';
} elseif ($key == 't.date_validated>=') {
$sqlwhere[] = 't;date_validate >= \''.$db->idate($value).'\'';
} elseif ($key == 't.date_validated<=') {
$sqlwhere[] = 't;date_validate <= \''.$db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') {

View file

@ -938,6 +938,8 @@ class BookKeeping extends CommonObject
$sqlwhere[] = 't.date_export <= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_validated>=') {
$sqlwhere[] = 't;date_validate >= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_validated<=') {
$sqlwhere[] = 't;date_validate <= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') {

View file

@ -8,6 +8,7 @@
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
* 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
@ -699,11 +700,7 @@ if (empty($reshook)) {
}
} else {
$error++;
if ($object->error) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
setEventMessages($object->error, $object->errors, 'errors');
}
if (!$error) {
@ -771,11 +768,7 @@ if (empty($reshook)) {
} else {
$error++;
if ($object->error) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}
@ -842,11 +835,7 @@ if (empty($reshook)) {
} else {
$error++;
if ($object->error) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}

View file

@ -150,8 +150,7 @@ if ($action == 'updateMask') {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
} elseif ($action == 'setmod') {
// TODO Verifier si module numerotation choisi peut etre active
// par appel method canBeActivated
// TODO Check if numbering module chosen can ba activated by calling method canBeActivated()
dolibarr_set_const($db, "FACTURE_ADDON", $value, 'chaine', 0, '', $conf->entity);
} elseif ($action == 'setribchq') {
@ -629,10 +628,10 @@ if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) { // Hidden conf
print "</tr>\n";
$listtype = array(
Facture::TYPE_STANDARD => $langs->trans("InvoiceStandard"),
Facture::TYPE_REPLACEMENT => $langs->trans("InvoiceReplacement"),
Facture::TYPE_CREDIT_NOTE => $langs->trans("InvoiceAvoir"),
Facture::TYPE_DEPOSIT => $langs->trans("InvoiceDeposit"),
Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"),
Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
);
if (getDolGlobalInt('INVOICE_USE_SITUATION')) {
$listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");

View file

@ -77,7 +77,7 @@ print '<!-- Force style container -->'."\n".'<style>
}
</style>';
$arrayofnatures = array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
$arrayofnatures = array('core' => $langs->transnoentitiesnoconv("Core"), 'external' => $langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
// Search modules dirs
$modulesdir = dolGetModulesDirs();
@ -116,6 +116,7 @@ foreach ($modulesdir as $dir) {
if (class_exists($modName)) {
try {
$objMod = new $modName($db);
'@phan-var-force DolibarrModules $objMod';
$modNameLoaded[$modName] = $dir;
if (!$objMod->numero > 0 && $modName != 'modUser') {
@ -235,7 +236,10 @@ foreach ($orders as $tmpkey => $tmpvalue) {
}
$value = $orders[$key];
$tab = explode('_', $value);
$familyposition = $tab[0]; $familykey = $tab[1]; $module_position = $tab[2]; $numero = $tab[3];
$familyposition = $tab[0];
$familykey = $tab[1];
$module_position = $tab[2];
$numero = $tab[3];

View file

@ -341,12 +341,13 @@ if (!getDolGlobalString('SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF')) {
}
print '<strong>$dolibarr_main_stream_to_disable</strong>: ';
// $arrayofstreamtodisable is defined into filefunc.inc.php
if (empty($dolibarr_main_stream_to_disable)) {
print '<span class="opacitymedium">'.$langs->trans("Undefined").' = '.implode(', ', $arrayofstreamtodisable).'</span>';
} else {
print implode(', ', $dolibarr_main_stream_to_disable);
}
print '<span class="bold"> -> PHP streams allowed = </span>';
print '<span class="bold"> -> Current PHP streams allowed = </span>';
$arrayofstreams = stream_get_wrappers();
if (!empty($arrayofstreams)) {
sort($arrayofstreams);

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2009-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -90,7 +91,12 @@ if (function_exists('socket_create')) {
//$client = socket_accept($sock);
$client = socket_connect($socket, $address, $port);
if ($client) {
print "Connection established: ".$client." - address=".$address." port=".$port."<br>\n";
if (is_bool($client)) {
$client_str = 'true';
} else {
$client_str = (string) $client;
}
print "Connection established: ".$client_str." - address=".$address." port=".$port."<br>\n";
print "There is a Remote debug server at this address.<br>\n";
print "<br>\n";
print "To be sure this debugger accepts input from your PHP server and xdebug, be sure to have\n";

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
* Copyright (C) 2017-2020 Laurent Destailleur <eldy@destailleur.fr>
* Copyright (C) 2022 charlene benke <charlene@patas-monkey.com>
* 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
@ -1014,7 +1015,7 @@ class BlockedLog
unset($keyforsignature);
return array('checkresult' => $res, 'calculatedsignature' => $signature, 'previoushash' => $previoushash);
} else { // Consume much memory ($keyforsignature is a large var)
return array('checkresult' => $res, 'calculatedsignature' => $signature, 'previoushash' => $previoushash, 'keyforsignature'=>$keyforsignature);
return array('checkresult' => $res, 'calculatedsignature' => $signature, 'previoushash' => $previoushash, 'keyforsignature' => $keyforsignature);
}
} else {
unset($keyforsignature);
@ -1227,7 +1228,7 @@ class BlockedLog
dol_print_error($this->db);
}
dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".$result);
dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".json_encode($result));
return $result;
}

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -109,11 +110,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($val['visible'])) {
$visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>(abs($visible) != 3 && (int) 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 && (int) dol_eval($val['enabled'], 1)),
'position' => $val['position'],
'help' => isset($val['help']) ? $val['help'] : ''
);
}
}
@ -218,11 +219,7 @@ if (empty($reshook)) {
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
}
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
$db->commit();
} else {
$db->rollback();
@ -266,11 +263,7 @@ if (empty($reshook)) {
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
}
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
$db->commit();
} else {
$db->rollback();
@ -343,7 +336,7 @@ foreach ($search as $key => $val) {
}
} else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'";
@ -474,8 +467,8 @@ $param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
'enable'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Enable"),
'disable'=>img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Disable"),
'enable' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Enable"),
'disable' => img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Disable"),
);
if (!empty($permissiontodelete)) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
@ -500,8 +493,8 @@ print '<input type="hidden" name="page_y" value="">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->hasRight('bom', 'write'));
@ -607,7 +600,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, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -650,7 +643,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, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -711,7 +704,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('', array('prod'=>$prod, 'selected' => $selected));
print $object->getKanbanView('', array('prod' => $prod, 'selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';
@ -787,7 +780,7 @@ while ($i < $imaxinloop) {
// 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, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -830,7 +823,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, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View file

@ -228,6 +228,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) {
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Title
print '<tr><td class="titlefield">';
if ($action == 'edit') {
print '<span class="fieldrequired">';
@ -247,6 +248,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) {
}
print '</td></tr>';
// URL
print '<tr><td>';
if ($action == 'edit') {
print '<span class="fieldrequired">';
@ -255,7 +257,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) {
if ($action == 'edit') {
print '</span>';
}
print '</td><td>';
print '</td><td class="tdoverflowmax500">';
if ($action == 'edit') {
print '<input class="flat minwidth500 quatrevingtpercent" name="url" value="'.(GETPOSTISSET("url") ? GETPOST("url") : $object->url).'">';
} else {

View file

@ -1411,11 +1411,7 @@ if ($action == 'create') {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
}
print ' <span class="hideonsmartphone">&nbsp; &nbsp; - &nbsp; &nbsp;</span> ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
} else {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
}
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
print '</td></tr>';
print '<tr><td class="">&nbsp;</td><td></td></tr>';
@ -1949,21 +1945,9 @@ if ($id > 0) {
*/
print '</td><td td colspan="3">';
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} else {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
}
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
print ' <span class="hideonsmartphone">&nbsp; &nbsp; - &nbsp; &nbsp;</span> ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} else {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
}
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
print '</td></tr>';
print '<tr><td class="">&nbsp;</td><td></td></tr>';

View file

@ -6,6 +6,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-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
@ -2728,7 +2729,7 @@ class ActionComm extends CommonObject
return 0;
} else {
$this->db->commit(); // We commit also on error, to have the error message recorded.
$this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? implode(', ', $errorsMsg) : $error;
$this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg) ? implode(', ', $errorsMsg) : $error);
dol_syslog(__METHOD__." end - ".$this->error, LOG_INFO);

View file

@ -695,20 +695,11 @@ if ($resql) {
// Defined date_start_in_calendar and date_end_in_calendar property
// They are date start and end of action but modified to not be outside calendar view.
if ($event->percentage <= 0) {
$event->date_start_in_calendar = $datep;
if ($datep2 != '' && $datep2 >= $datep) {
$event->date_end_in_calendar = $datep2;
} else {
$event->date_end_in_calendar = $datep;
}
$event->date_start_in_calendar = $datep;
if ($datep2 != '' && $datep2 >= $datep) {
$event->date_end_in_calendar = $datep2;
} else {
$event->date_start_in_calendar = $datep;
if ($datep2 != '' && $datep2 >= $datep) {
$event->date_end_in_calendar = $datep2;
} else {
$event->date_end_in_calendar = $datep;
}
$event->date_end_in_calendar = $datep;
}
// Check values

View file

@ -714,20 +714,11 @@ if ($resql) {
// Defined date_start_in_calendar and date_end_in_calendar property
// They are date start and end of action but modified to not be outside calendar view.
if ($event->percentage <= 0) {
$event->date_start_in_calendar = $datep;
if ($datep2 != '' && $datep2 >= $datep) {
$event->date_end_in_calendar = $datep2;
} else {
$event->date_end_in_calendar = $datep;
}
$event->date_start_in_calendar = $datep;
if ($datep2 != '' && $datep2 >= $datep) {
$event->date_end_in_calendar = $datep2;
} else {
$event->date_start_in_calendar = $datep;
if ($datep2 != '' && $datep2 >= $datep) {
$event->date_end_in_calendar = $datep2;
} else {
$event->date_end_in_calendar = $datep;
}
$event->date_end_in_calendar = $datep;
}
//print '<br>'.$i.' - eventid='.$event->id.' '.dol_print_date($event->date_start_in_calendar, 'dayhour').' '.dol_print_date($firstdaytoshow, 'dayhour').' - '.dol_print_date($event->date_end_in_calendar, 'dayhour').' '.dol_print_date($lastdaytoshow, 'dayhour').'<br>'."\n";

View file

@ -3,6 +3,7 @@
* Copyright (C) 2005-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
* 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
@ -70,7 +71,7 @@ $signature = ((!empty($user->signature) && !getDolGlobalString('MAIN_MAIL_DO_NOT
$targetobject = null; // Not defined with mass emailing
$parameters = array('mode'=>'emailing');
$parameters = array('mode' => 'emailing');
$substitutionarray = FormMail::getAvailableSubstitKey('emailing', $targetobject);
$object->substitutionarrayfortest = $substitutionarray;
@ -237,7 +238,7 @@ if (empty($reshook)) {
$signature = ((!empty($user->signature) && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $user->signature : '');
$parameters = array('mode'=>'emailing');
$parameters = array('mode' => 'emailing');
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
@ -437,19 +438,14 @@ if (empty($reshook)) {
// Loop finished, set global statut of mail
if ($nbko > 0) {
$statut = 2; // Status 'sent partially' (because at least one error)
if ($nbok > 0) {
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs');
}
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs');
} else {
if ($nbok >= $num) {
$statut = 3; // Send to everybody
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs');
} else {
$statut = 2; // Status 'sent partially' (because not send to everybody)
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs');
}
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs');
}
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".((int) $statut)." WHERE rowid = ".((int) $object->id);
@ -488,7 +484,7 @@ if (empty($reshook)) {
$signature = ((!empty($user->signature) && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $user->signature : '');
$parameters = array('mode'=>'emailing');
$parameters = array('mode' => 'emailing');
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object
// other are set at begin of page
@ -536,7 +532,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans("MailSuccessfulySent", $mailfile->getValidAddress($object->email_from, 2), $mailfile->getValidAddress($object->sendto, 2)), null, 'mesgs');
$action = '';
} else {
setEventMessages($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, null, 'errors');
setEventMessages($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.json_encode($result), null, 'errors');
$action = 'test';
}
}
@ -883,7 +879,7 @@ if ($action == 'create') {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.(!empty($urlfrom) ? '&urlfrom='.urlencode($urlfrom) : ''), $langs->trans("DeleteMailing"), $langs->trans("ConfirmDeleteMailing"), "confirm_delete", '', '', 1);
}
if ($action != 'edit' && $action != 'edittxt' &&$action != 'edithtml') {
if ($action != 'edit' && $action != 'edittxt' && $action != 'edithtml') {
print dol_get_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
/*
@ -1190,7 +1186,7 @@ if ($action == 'create') {
$formmail = new FormMail($db);
$formmail->fromname = $object->email_from;
$formmail->frommail = $object->email_from;
$formmail->withsubstit =0;
$formmail->withsubstit = 0;
$formmail->withfrom = 0;
$formmail->withto = $user->email ? $user->email : 1;
$formmail->withtocc = 0;

File diff suppressed because it is too large Load diff

View file

@ -12,6 +12,7 @@
* Copyright (C) 2016-2023 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2023 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2021-2024 Anthony Berton <anthony.berton@bb2a.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
@ -783,11 +784,7 @@ if (!$error && $massaction === 'setbilled' && $permissiontoclose) {
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
}
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
$db->commit();
} else {
$db->rollback();

View file

@ -12,7 +12,7 @@
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2024 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
@ -1662,7 +1662,7 @@ if (empty($reshook)) {
null,
0,
'',
1
(!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)?0:1)
);
}

View file

@ -5915,7 +5915,7 @@ class Facture extends CommonInvoice
return 0;
} else {
$this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? implode(', ', $errorsMsg) : $error;
$this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg) ? implode(', ', $errorsMsg) : $error);
dol_syslog(__METHOD__." end - ".$this->error, LOG_INFO);

View file

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* 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
@ -154,9 +155,9 @@ if ($resql) {
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj) {
$nb[$obj->status.true] = $obj->nb;
$nb[$obj->status.((string) true)] = $obj->nb;
if ($obj->status != 5) {
$vals[$obj->status.true] = $obj->nb;
$vals[$obj->status.((string) true)] = $obj->nb;
$totalinprocess += $obj->nb;
}
$total += $obj->nb;
@ -175,26 +176,28 @@ include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Services").'</th></tr>'."\n";
$listofstatus = array(0, 4, 4, 5); $bool = false;
$listofstatus = array(0, 4, 4, 5);
$bool = false;
foreach ($listofstatus as $status) {
$dataseries[] = array($staticcontratligne->LibStatut($status, 1, ($bool ? 1 : 0)), (isset($nb[$status.$bool]) ? (int) $nb[$status.$bool] : 0));
$bool_str = (string) $bool;
$dataseries[] = array($staticcontratligne->LibStatut($status, 1, ($bool ? 1 : 0)), (isset($nb[$status.$bool_str]) ? (int) $nb[$status.$bool_str] : 0));
if ($status == ContratLigne::STATUS_INITIAL) {
$colorseries[$status.$bool] = '-'.$badgeStatus0;
$colorseries[$status.$bool_str] = '-'.$badgeStatus0;
}
if ($status == ContratLigne::STATUS_OPEN && !$bool) {
$colorseries[$status.$bool] = $badgeStatus4;
$colorseries[$status.$bool_str] = $badgeStatus4;
}
if ($status == ContratLigne::STATUS_OPEN && $bool) {
$colorseries[$status.$bool] = $badgeStatus1;
$colorseries[$status.$bool_str] = $badgeStatus1;
}
if ($status == ContratLigne::STATUS_CLOSED) {
$colorseries[$status.$bool] = $badgeStatus6;
$colorseries[$status.$bool_str] = $badgeStatus6;
}
if (empty($conf->use_javascript_ajax)) {
print '<tr class="oddeven">';
print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).'</td>';
print '<td class="right"><a href="services_list.php?search_status='.((int) $status).($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>';
print '<td class="right"><a href="services_list.php?search_status='.((int) $status).($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool_str] ? $nb[$status.$bool_str] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>';
print "</tr>\n";
}
if ($status == 4 && !$bool) {
@ -219,12 +222,14 @@ if (!empty($conf->use_javascript_ajax)) {
print '</td></tr>';
}
$listofstatus = array(0, 4, 4, 5); $bool = false;
$listofstatus = array(0, 4, 4, 5);
$bool = false;
foreach ($listofstatus as $status) {
$bool_str = (string) $bool;
if (empty($conf->use_javascript_ajax)) {
print '<tr class="oddeven">';
print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).'</td>';
print '<td class="right"><a href="services_list.php?search_status='.((int) $status).($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>';
print '<td class="right"><a href="services_list.php?search_status='.((int) $status).($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool_str] ? $nb[$status.$bool_str] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>';
if ($status == 4 && !$bool) {
$bool = true;
} else {

View file

@ -4,6 +4,7 @@
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@netlogic.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
@ -373,9 +374,9 @@ if (!$error && $massaction == 'confirm_presend') {
if ($filepath_found) {
// Create form object
$attachedfilesThirdpartyObj[$thirdpartyid][$objectid] = array(
'paths'=>array($filepath_found),
'names'=>array($filename_found),
'mimes'=>array(dol_mimetype($filepath_found))
'paths' => array($filepath_found),
'names' => array($filename_found),
'mimes' => array(dol_mimetype($filepath_found))
);
} else {
$nbignored++;
@ -477,7 +478,7 @@ if (!$error && $massaction == 'confirm_presend') {
$substitutionarray['__EMAIL__'] = $thirdparty->email;
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag=undefined&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-undefined", 'md5').'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
$parameters = array('mode'=>'formemail');
$parameters = array('mode' => 'formemail');
if (!empty($listofobjectthirdparties)) {
$parameters['listofobjectthirdparties'] = $listofobjectthirdparties;
@ -491,16 +492,16 @@ if (!$error && $massaction == 'confirm_presend') {
$subjectreplaced = make_substitutions($subject, $substitutionarray);
$messagereplaced = make_substitutions($message, $substitutionarray);
$attachedfiles = array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
$attachedfiles = array('paths' => array(), 'names' => array(), 'mimes' => array());
if ($oneemailperrecipient) {
// if "one email per recipient" is check we must collate $attachedfiles by thirdparty
if (is_array($attachedfilesThirdpartyObj[$thirdparty->id]) && count($attachedfilesThirdpartyObj[$thirdparty->id])) {
foreach ($attachedfilesThirdpartyObj[$thirdparty->id] as $keyObjId => $objAttachedFiles) {
// Create form object
$attachedfiles = array(
'paths'=>array_merge($attachedfiles['paths'], $objAttachedFiles['paths']),
'names'=>array_merge($attachedfiles['names'], $objAttachedFiles['names']),
'mimes'=>array_merge($attachedfiles['mimes'], $objAttachedFiles['mimes'])
'paths' => array_merge($attachedfiles['paths'], $objAttachedFiles['paths']),
'names' => array_merge($attachedfiles['names'], $objAttachedFiles['names']),
'mimes' => array_merge($attachedfiles['mimes'], $objAttachedFiles['mimes'])
);
}
}
@ -720,11 +721,7 @@ if (!$error && $massaction == 'cancelorders') {
}
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
}
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
$db->commit();
} else {
$db->rollback();
@ -1205,9 +1202,9 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) {
if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd) {
$db->begin();
$affecttag_type=GETPOST('affecttag_type', 'alpha');
$affecttag_type = GETPOST('affecttag_type', 'alpha');
if (!empty($affecttag_type)) {
$affecttag_type_array=explode(',', $affecttag_type);
$affecttag_type_array = explode(',', $affecttag_type);
} else {
setEventMessage('CategTypeNotFound', 'errors');
}
@ -1215,8 +1212,8 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd
//check if tag type submitted exists into Tag Map categorie class
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$categ = new Categorie($db);
$to_affecttag_type_array=array();
$categ_type_array=$categ->getMapList();
$to_affecttag_type_array = array();
$categ_type_array = $categ->getMapList();
foreach ($categ_type_array as $categdef) {
if (in_array($categdef['code'], $affecttag_type_array)) {
$to_affecttag_type_array[] = $categdef['code'];
@ -1250,13 +1247,9 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null);
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null);
}
setEventMessages($langs->trans("RecordsModified", $nbok), null);
$db->commit();
$toselect=array();
$toselect = array();
} else {
$db->rollback();
}
@ -1265,7 +1258,7 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd
if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoadd) {
$db->begin();
if (GETPOSTISSET('pricerate')) {
$pricepercentage=GETPOSTINT('pricerate');
$pricepercentage = GETPOSTINT('pricerate');
if ($pricepercentage == 0) {
setEventMessages($langs->trans("RecordsModified", 0), null);
} else {
@ -1300,7 +1293,7 @@ if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoa
setEventMessages($langs->trans("RecordsModified", $nbok), null);
}
$db->commit();
$toselect=array();
$toselect = array();
} else {
$db->rollback();
}
@ -1308,7 +1301,7 @@ if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoa
if (!$error && ($action == 'setsupervisor' && $confirm == 'yes') && $permissiontoadd) {
$db->begin();
$supervisortoset=GETPOST('supervisortoset');
$supervisortoset = GETPOST('supervisortoset');
if (!empty($supervisortoset)) {
foreach ($toselect as $toselectid) {
$result = $object->fetch($toselectid);
@ -1333,13 +1326,9 @@ if (!$error && ($action == 'setsupervisor' && $confirm == 'yes') && $permissiont
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null);
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null);
}
setEventMessages($langs->trans("RecordsModified", $nbok), null);
$db->commit();
$toselect=array();
$toselect = array();
} else {
$db->rollback();
}
@ -1348,9 +1337,9 @@ if (!$error && ($action == 'setsupervisor' && $confirm == 'yes') && $permissiont
if (!$error && ($action == 'affectuser' && $confirm == 'yes') && $permissiontoadd) {
$db->begin();
$usertoaffect=GETPOST('usertoaffect');
$projectrole=GETPOST('projectrole');
$tasksrole=GETPOST('tasksrole');
$usertoaffect = GETPOST('usertoaffect');
$projectrole = GETPOST('projectrole');
$tasksrole = GETPOST('tasksrole');
if (!empty($usertoaffect)) {
foreach ($toselect as $toselectid) {
$result = $object->fetch($toselectid);
@ -1387,13 +1376,9 @@ if (!$error && ($action == 'affectuser' && $confirm == 'yes') && $permissiontoad
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null);
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null);
}
setEventMessages($langs->trans("RecordsModified", $nbok), null);
$db->commit();
$toselect=array();
$toselect = array();
} else {
$db->rollback();
}
@ -1406,9 +1391,9 @@ if (!$error && ($massaction == 'enable' || ($action == 'enable' && $confirm == '
$nbok = 0;
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
if ($result>0) {
if ($result > 0) {
if (in_array($objecttmp->element, array('societe'))) {
$result =$objecttmp->setStatut(1);
$result = $objecttmp->setStatut(1);
}
if ($result <= 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
@ -1443,9 +1428,9 @@ if (!$error && ($massaction == 'disable' || ($action == 'disable' && $confirm ==
$nbok = 0;
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
if ($result>0) {
if ($result > 0) {
if (in_array($objecttmp->element, array('societe'))) {
$result =$objecttmp->setStatut(0);
$result = $objecttmp->setStatut(0);
}
if ($result <= 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
@ -1488,7 +1473,7 @@ if (!$error && $action == 'confirm_edit_value_extrafields' && $confirm == 'yes'
/** @var CommonObject $objecttmp */
$objecttmp = new $objectclass($db); // to avoid ghost data
$result = $objecttmp->fetch($toselectid);
if ($result>0) {
if ($result > 0) {
// Fill array 'array_options' with data from add form
$ret = $e->setOptionalsFromPost(null, $objecttmp, $extrafieldKeyToUpdate);
if ($ret > 0) {
@ -1524,7 +1509,7 @@ if (!$error && ($massaction == 'affectcommercial' || ($action == 'affectcommerci
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
if ($result>0) {
if ($result > 0) {
if (in_array($objecttmp->element, array('societe'))) {
$result = $objecttmp->setSalesRep(GETPOST("commercial", "alpha"));
}
@ -1719,7 +1704,7 @@ if (!$error && ($massaction == 'increaseholiday' || ($action == 'increaseholiday
setEventMessages($langs->trans("HolidayRecordIncreased"), null, 'mesgs');
}
$db->commit();
$toselect=array();
$toselect = array();
} else {
$db->rollback();
}

View file

@ -3,6 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Frederic 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
@ -194,7 +195,7 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo
* Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function)
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param array<array<array{tr?:string,text?:string,text2?:string,textnoformat?:string,tooltip?:string,logo?:string,url?:string,maxlength?:string}>> $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/

View file

@ -1667,11 +1667,7 @@ abstract class CommonObject
$tmpelement = $obj->element;
$transkey = "TypeContact_".$tmpelement."_".$source."_".$obj->code;
$libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->type_label);
if (empty($option)) {
$tab[$obj->rowid] = $libelle_element.' - '.$libelle_type;
} else {
$tab[$obj->rowid] = $libelle_element.' - '.$libelle_type;
}
$tab[$obj->rowid] = $libelle_element.' - '.$libelle_type;
}
}
}
@ -7396,7 +7392,7 @@ abstract class CommonObject
$isDependList = 1;
}
$tmpselect .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
$tmpselect .= '>'.$valb.'</option>';
$tmpselect .= '>'.$langs->trans($valb).'</option>';
}
$out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>';
@ -8026,7 +8022,7 @@ abstract class CommonObject
} elseif ($type == 'select') {
$value = isset($param['options'][$value]) ? $param['options'][$value] : '';
if (strpos($value, "|") !== false) {
$value = explode('|', $value)[0];
$value = $langs->trans(explode('|', $value)[0]);
}
} elseif ($type == 'sellist') {
$param_list = array_keys($param['options']);
@ -8846,13 +8842,7 @@ abstract class CommonObject
}
$out .= ($display_type == 'card' ? '</td>' : '</div>');
if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && (($e % 2) == 1)) {
$out .= ($display_type == 'card' ? '</tr>' : '</div>');
} else {
$out .= ($display_type == 'card' ? '</tr>' : '</div>');
}
$out .= ($display_type == 'card' ? '</tr>' : '</div>');
$e++;
}
}

View file

@ -44,7 +44,7 @@ class ExtraFields
public $db;
/**
* @var array<string,array{label:array<string,string>,type:array<string,string>,size:array<string,string>,default:array<string,string>,computed:array<string,string>,unique:array<string,int>,required:array<string,int>,param:array<string,mixed>,perms:array<string,mixed[]>,list:array<string,mixed[]>,totalizable:array<string,int>,help:array<string,string>,printable:array<string,int>,enabled:array<string,int>,langfile:array<string,string>,css:array<string,string>,csslist:array<string,string>,hidden:array<string,int>,mandatoryfieldsofotherentities:array<string,string>,isameasure?:array<string,string>}> New array to store extrafields definition
* @var array<string,array{label:array<string,string>,type:array<string,string>,size:array<string,string>,default:array<string,string>,computed:array<string,string>,unique:array<string,int>,required:array<string,int>,param:array<string,mixed>,perms:array<string,mixed[]>,list:array<string,mixed[]>,totalizable:array<string,int>,help:array<string,string>,printable:array<string,int>,enabled:array<string,int>,langfile:array<string,string>,css:array<string,string>,csslist:array<string,string>,hidden:array<string,int>,mandatoryfieldsofotherentities:array<string,string>}> New array to store extrafields definition
*/
public $attributes;

View file

@ -23,6 +23,7 @@
* Copyright (C) 2018 Josep Lluis Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* Copyright (C) 2023 Nick Fragoulis
* 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
@ -3753,13 +3754,8 @@ class Form
$outvallabel .= " - " . $reputations[$objp->supplier_reputation];
}
} else {
if (empty($alsoproductwithnosupplierprice)) { // No supplier price defined for couple product/supplier
$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
} else { // No supplier price defined for product, even on other suppliers
$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
}
$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
}
if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
@ -10183,13 +10179,8 @@ class Form
public function showFilterButtons($pos = '')
{
$out = '<div class="nowraponall">';
if ($pos == 'left') {
$out .= '<button type="submit" class="liste_titre button_search reposition" name="button_search_x" value="x"><span class="fas fa-search"></span></button>';
$out .= '<button type="submit" class="liste_titre button_removefilter reposition" name="button_removefilter_x" value="x"><span class="fas fa-times"></span></button>';
} else {
$out .= '<button type="submit" class="liste_titre button_search reposition" name="button_search_x" value="x"><span class="fas fa-search"></span></button>';
$out .= '<button type="submit" class="liste_titre button_removefilter reposition" name="button_removefilter_x" value="x"><span class="fas fa-times"></span></button>';
}
$out .= '<button type="submit" class="liste_titre button_search reposition" name="button_search_x" value="x"><span class="fas fa-search"></span></button>';
$out .= '<button type="submit" class="liste_titre button_removefilter reposition" name="button_removefilter_x" value="x"><span class="fas fa-times"></span></button>';
$out .= '</div>';
return $out;

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2018-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
@ -511,8 +512,8 @@ class Menubase
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @return array Return array with menu entries for top menu
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @return array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> Return array with menu entries for top menu
*/
public function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
{
@ -541,7 +542,7 @@ class Menubase
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
* @param array $tabMenu Array with menu entries already loaded
* @param array<array{rowid:string,fk_menu:string,module:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu Array with menu entries already loaded
* @return Menu Menu array for particular mainmenu value or full tabArray
*/
public function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
@ -573,7 +574,6 @@ class Menubase
if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu) { // We found a menu entry not linked to parent with good mainmenu
//print 'Try to add menu (current is mainmenu='.$mainmenu.' leftmenu='.$leftmenu.') for '.join(',',$val).' fk_mainmenu='.$val['fk_mainmenu'].' fk_leftmenu='.$val['fk_leftmenu'].'<br>';
//var_dump($this->newmenu->liste);exit;
if (empty($val['fk_leftmenu'])) {
$this->newmenu->add($val['url'], $val['titre'], 0, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position'], '', '', '', $val['prefix']);
//var_dump($this->newmenu->liste);
@ -624,7 +624,7 @@ class Menubase
* @param string $myleftmenu Value for left that defined leftmenu
* @param int $type_user Looks for menu entry for 0=Internal users, 1=External users
* @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...)
* @param array $tabMenu Array to store new entries found (in most cases, it's empty, but may be already filled)
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu Array to store new entries found (in most cases, it's empty, but may be already filled)
* @return int >0 if OK, <0 if KO
*/
public function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
@ -757,7 +757,7 @@ class Menubase
/**
* Complete this->newmenu with menu entry found in $tab
*
* @param array $tab Tab array with all menu entries
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tab Tab array with all menu entries
* @param int $pere Id of parent
* @param int $level Level
* @return void

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -475,30 +476,21 @@ class RssParser
}
}
} elseif ($rss->_format == 'atom') {
if (getDolGlobalString('EXTERNALRSS_USE_SIMPLEXML')) {
$itemLink = (isset($item['link']) ? sanitizeVal((string) $item['link']) : '');
$itemTitle = sanitizeVal((string) $item['title']);
$itemDescription = sanitizeVal($this->getAtomItemDescription($item));
$itemPubDate = sanitizeVal((string) $item['created']);
$itemId = sanitizeVal((string) $item['id']);
$itemAuthor = sanitizeVal((string) ($item['author'] ? $item['author'] : $item['author_name']));
} else {
$itemLink = (isset($item['link']) ? sanitizeVal((string) $item['link']) : '');
$itemTitle = sanitizeVal((string) $item['title']);
$itemDescription = sanitizeVal($this->getAtomItemDescription($item));
$itemPubDate = sanitizeVal((string) $item['created']);
$itemId = sanitizeVal((string) $item['id']);
$itemAuthor = sanitizeVal((string) ($item['author'] ? $item['author'] : $item['author_name']));
}
$itemLink = (isset($item['link']) ? sanitizeVal((string) $item['link']) : '');
$itemTitle = sanitizeVal((string) $item['title']);
$itemDescription = sanitizeVal($this->getAtomItemDescription($item));
$itemPubDate = sanitizeVal((string) $item['created']);
$itemId = sanitizeVal((string) $item['id']);
$itemAuthor = sanitizeVal((string) ($item['author'] ? $item['author'] : $item['author_name']));
$itemCategory = array();
} else {
$itemCategory = array();
$itemLink = '';
$itemTitle = '';
$itemDescription = '';
$itemPubDate = '';
$itemId = '';
$itemAuthor = '';
$itemCategory = array();
print 'ErrorBadFeedFormat';
}

View file

@ -5,6 +5,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -337,12 +338,7 @@ class DoliDBMysqli extends DoliDB
}
try {
if (!$this->database_name) {
// SQL query not needing a database connection (example: CREATE DATABASE)
$ret = $this->db->query($query, $result_mode);
} else {
$ret = $this->db->query($query, $result_mode);
}
$ret = $this->db->query($query, $result_mode);
} catch (Exception $e) {
dol_syslog(get_class($this)."::query Exception in query instead of returning an error: ".$e->getMessage(), LOG_ERR);
$ret = false;

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2022-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Anthony Berton <bertonanthony@gmail.com>
* 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
@ -43,7 +44,7 @@ function dol_ftp_connect($ftp_server, $ftp_port, $ftp_user, $ftp_password, $sect
$error = 0;
$connect_id = null;
$newsectioniso = '';
$mesg="";
$mesg = "";
if (!is_numeric($ftp_port)) {
$mesg = $langs->transnoentitiesnoconv("FailedToConnectToFTPServer", $ftp_server, $ftp_port);
@ -110,7 +111,7 @@ function dol_ftp_connect($ftp_server, $ftp_port, $ftp_user, $ftp_password, $sect
}
}
$arrayresult = array('conn_id'=>$connect_id, 'ok'=>$ok, 'mesg'=>$mesg, 'curdir'=>$section, 'curdiriso'=>$newsectioniso);
$arrayresult = array('conn_id' => $connect_id, 'ok' => $ok, 'mesg' => $mesg, 'curdir' => $section, 'curdiriso' => $newsectioniso);
return $arrayresult;
}
@ -144,10 +145,7 @@ function dol_ftp_close($connect_id)
// Close FTP connection
if ($connect_id) {
if (getDolGlobalString('FTP_CONNECT_WITH_SFTP')) {
} elseif (getDolGlobalString('FTP_CONNECT_WITH_SSL')) {
return ftp_close($connect_id);
} else {
if (!getDolGlobalString('FTP_CONNECT_WITH_SFTP')) {
return ftp_close($connect_id);
}
}

View file

@ -10395,6 +10395,8 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
$newtab[1] = $label;
$newtab[2] = str_replace('+', '', $values[1]);
$h++;
} else {
continue;
}
} elseif (count($values) == 5) { // case deprecated
dol_syslog('Passing 5 values in tabs module_parts is deprecated. Please update to 6 with permissions.', LOG_WARNING);

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2010-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* 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
@ -31,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
* @param DoliDB $db Database handler
* @param string $atarget Target (Example: '' or '_top')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param Menu $menu Object Menu to return back list of menu entries
* @param int $noout 1=Disable output (Initialise &$menu only).
* @param string $mode 'top', 'topnb', 'left', 'jmobile'
@ -51,6 +52,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout
// Show personalized menus
$menuArbo = new Menubase($db, 'auguria');
$newTabMenu = $menuArbo->menuTopCharger('', '', $type_user, 'auguria', $tabMenu);
'@phan-var-force array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $newTabMenu';
$substitarray = getCommonSubstitutionArray($langs, 0, null, null);
@ -307,9 +309,9 @@ function print_end_menu_array_auguria()
* Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home)
*
* @param DoliDB $db Database handler
* @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add)
* @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add)
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param Menu $menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -317,11 +318,7 @@ class MenuManager
print $val2['titre'];
if ($relurl2) {
if ($val2['enabled']) { // Allowed
print '</a>';
} else {
print '</a>';
}
print '</a>';
}
print '</li>'."\n";
}

View file

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
* @param DoliDB $db Database handler
* @param string $atarget Target (Example: '' or '_top')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty). For eldy menu, it contains menu entries loaded from database.
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty). For eldy menu, it contains menu entries loaded from database.
* @param Menu $menu Object Menu to return back list of menu entries
* @param int $noout 1=Disable output (Initialise &$menu only).
* @param string $mode 'top', 'topnb', 'left', 'jmobile'
@ -638,7 +638,7 @@ function print_start_menu_entry($idsel, $classname, $showmode)
* @param string $idsel Id sel
* @param string $classname Class name
* @param string $atarget Target
* @param array $menuval All the $menuval array
* @param array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string} $menuval All the $menuval array
* @return void
*/
function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menuval = array())
@ -719,9 +719,9 @@ function print_end_menu_array()
* Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home)
*
* @param DoliDB $db Database handler
* @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add)
* @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add)
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param Menu $menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
@ -2440,18 +2440,18 @@ function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu
$newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $titlelist, 1, $user->hasRight('mailing', 'lire'));
}
if (isModEnabled('import')) {
$langs->load("exports");
$newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->hasRight('import', 'run'), '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->hasRight('import', 'run'));
}
if (isModEnabled('export')) {
$langs->load("exports");
$newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->hasRight('export', 'lire'), '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->hasRight('export', 'creer'));
//$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->hasRight('export', 'lire'));
}
if (isModEnabled('import')) {
$langs->load("exports");
$newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->hasRight('import', 'run'), '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->hasRight('import', 'run'));
}
}
}

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@inodbox.com>
* 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
@ -323,11 +324,7 @@ class MenuManager
print $val2['titre'];
if ($relurl2) {
if ($val2['enabled']) { // Allowed
print '</a>';
} else {
print '</a>';
}
print '</a>';
}
print '</li>'."\n";
}

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -34,6 +35,9 @@ class MenuManager
public $atarget = ""; // To store default target to use onto links
public $name = "empty";
/**
* @var Menu
*/
public $menu;
public $menu_array_after;
@ -309,13 +313,7 @@ class MenuManager
}
print $val2['titre'];
if ($relurl2) {
if ($val2['enabled']) {
// Allowed
print '</a>';
} else {
// Not allowed
print '</a>';
}
print '</a>';
}
print '</li>'."\n";
}

View file

@ -247,7 +247,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
public $export_code;
/**
* @var string Module export label
* @var string[] Module export label
*/
public $export_label;
@ -279,7 +279,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
public $import_code;
/**
* @var string Module import label
* @var string[] Module import label
*/
public $import_label;

View file

@ -297,6 +297,10 @@ class html_cerfafr extends ModeleDon
$prim = array();
$secon = array();
$trio = array();
'@phan-var string[] $prim
@phan-var string[] $secon
@phan-var string[] $trio
';
for ($i = 1; $i <= 3; $i++) {
$prim[$i] = '';
$secon[$i] = '';

View file

@ -258,7 +258,6 @@ class ExportExcel2007 extends ModeleExports
public function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
{
// phpcs:enable
global $conf;
// Create a format for the column headings
$this->workbook->getActiveSheet()->getStyle('1')->getFont()->setBold(true);
@ -284,13 +283,17 @@ class ExportExcel2007 extends ModeleExports
}
$this->col++;
}
// Complete with some columns to add columns with the labels of columns of type Select, so we have more then the ID
foreach ($selectlabel as $key => $value) {
$code = preg_replace('/_label$/', '', $key);
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $outputlangs->transnoentities($value));
if (!empty($array_types[$code]) && in_array($array_types[$code], array('Date', 'Numeric', 'TextAuto'))) { // Set autowidth for some types
$this->workbook->getActiveSheet()->getColumnDimension($this->column2Letter($this->col + 1))->setAutoSize(true);
}
$this->col++;
}
$this->row++;
return 0;
}
@ -308,7 +311,6 @@ class ExportExcel2007 extends ModeleExports
public function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
{
// phpcs:enable
global $conf;
// Define first row
$this->col = 1;
@ -371,7 +373,12 @@ class ExportExcel2007 extends ModeleExports
}
$this->col++;
}
// Complete with some columns to add columns with the labels of columns of type Select, so we have more then the ID
foreach ($selectlabelvalues as $key => $newvalue) {
$code = preg_replace('/_label$/', '', $key);
$typefield = isset($array_types[$code]) ? $array_types[$code] : '';
if (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/i', $newvalue)) {
$newvalue = dol_stringtotime($newvalue);
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($newvalue));
@ -394,6 +401,7 @@ class ExportExcel2007 extends ModeleExports
}
$this->col++;
}
$this->row++;
return 0;
}
@ -422,7 +430,6 @@ class ExportExcel2007 extends ModeleExports
public function close_file()
{
// phpcs:enable
global $conf;
$objWriter = new Xlsx($this->workbook);
$objWriter->save($this->file);

View file

@ -741,7 +741,7 @@ class ImportCsv extends ModeleImports
// ...
}
// Define $listfields and $listvalues to build SQL request
// Define $listfields and $listvalues to build the SQL request
if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) {
if (!in_array("socialnetworks", $listfields)) {
$listfields[] = "socialnetworks";
@ -768,7 +768,7 @@ class ImportCsv extends ModeleImports
$listfields[] = $fieldname;
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) {
$listvalues[] = ($newval == '0' ? $newval : "null");
$listvalues[] = ($newval == '0' ? (int) $newval : "null");
} elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) {
$listvalues[] = "''";
} else {
@ -796,7 +796,7 @@ class ImportCsv extends ModeleImports
$lastinsertid = (isset($last_insert_id_array[$tmp[1]])) ? $last_insert_id_array[$tmp[1]] : 0;
$keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $tmpkey);
$listfields[] = $keyfield;
$listvalues[] = $lastinsertid;
$listvalues[] = (int) $lastinsertid;
//print $tmpkey."-".$tmpval."-".$listfields."-".$listvalues."<br>";exit;
} elseif (preg_match('/^const-/', $tmpval)) {
$tmp = explode('-', $tmpval, 2);
@ -809,6 +809,7 @@ class ImportCsv extends ModeleImports
$file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']);
$class = $objimport->array_import_convertvalue[0][$fieldname]['class'];
$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
$type = $objimport->array_import_convertvalue[0][$fieldname]['type'];
$resultload = dol_include_once($file);
if (empty($resultload)) {
dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
@ -821,8 +822,16 @@ class ImportCsv extends ModeleImports
if (count($fieldArr) > 0) {
$fieldname = $fieldArr[1];
}
// Set $listfields and $listvalues
$listfields[] = $fieldname;
$listvalues[] = $res;
if ($type == 'int') {
$listvalues[] = (int) $res;
} elseif ($type == 'double') {
$listvalues[] = (float) $res;
} else {
$listvalues[] = "'".$this->db->escape($res)."'";
}
} else {
$this->errors[$error]['type'] = 'CLASSERROR';
$this->errors[$error]['lib'] = implode(
@ -964,7 +973,7 @@ class ImportCsv extends ModeleImports
$data = array_combine($listfields, $listvalues);
$set = array();
foreach ($data as $key => $val) {
$set[] = $key." = ".$val;
$set[] = $key." = ".$val; // $val was escaped/sanitized previously
}
$sqlstart .= " SET ".implode(', ', $set).", import_key = '".$this->db->escape($importid)."'";

View file

@ -787,7 +787,7 @@ class ImportXlsx extends ModeleImports
// ...
}
// Define $listfields and $listvalues to build SQL request
// Define $listfields and $listvalues to build the SQL request
if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) {
if (!in_array("socialnetworks", $listfields)) {
$listfields[] = "socialnetworks";
@ -813,7 +813,7 @@ class ImportXlsx extends ModeleImports
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
if (empty($newval) && $arrayrecord[($key)]['type'] < 0) {
$listvalues[] = ($newval == '0' ? $newval : "null");
$listvalues[] = ($newval == '0' ? (int) $newval : "null");
} elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) {
$listvalues[] = "''";
} else {
@ -841,7 +841,7 @@ class ImportXlsx extends ModeleImports
$lastinsertid = (isset($last_insert_id_array[$tmp[1]])) ? $last_insert_id_array[$tmp[1]] : 0;
$keyfield = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
$listfields[] = $keyfield;
$listvalues[] = $lastinsertid;
$listvalues[] = (int) $lastinsertid;
//print $key."-".$val."-".$listfields."-".$listvalues."<br>";exit;
} elseif (preg_match('/^const-/', $val)) {
$tmp = explode('-', $val, 2);
@ -854,6 +854,7 @@ class ImportXlsx extends ModeleImports
$file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']);
$class = $objimport->array_import_convertvalue[0][$fieldname]['class'];
$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
$type = $objimport->array_import_convertvalue[0][$fieldname]['type'];
$resultload = dol_include_once($file);
if (empty($resultload)) {
dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
@ -865,8 +866,16 @@ class ImportXlsx extends ModeleImports
if (count($fieldArr) > 0) {
$fieldname = $fieldArr[1];
}
// Set $listfields and $listvalues
$listfields[] = $fieldname;
$listvalues[] = $res;
if ($type == 'int') {
$listvalues[] = (int) $res;
} elseif ($type == 'double') {
$listvalues[] = (float) $res;
} else {
$listvalues[] = "'".$this->db->escape($res)."'";
}
} else {
$this->errors[$error]['type'] = 'CLASSERROR';
$this->errors[$error]['lib'] = implode(
@ -1011,7 +1020,7 @@ class ImportXlsx extends ModeleImports
$data = array_combine($listfields, $listvalues);
$set = array();
foreach ($data as $key => $val) {
$set[] = $key." = ".$val;
$set[] = $key." = ".$val; // $val was escaped/sanitized previously
}
$sqlstart .= " SET " . implode(', ', $set) . ", import_key = '" . $this->db->escape($importid) . "'";

View file

@ -362,14 +362,14 @@ class modAccounting extends DolibarrModules
'b.sens'=>'rule-computeDirection'
); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_convertvalue_array[$r]=array(
'b.piece_num' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanValue', 'element' => 'Accountancy'),
'b.piece_num' => array('rule' => 'compute', 'type' => 'int', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanValue', 'element' => 'Accountancy'),
'b.numero_compte'=>array('rule'=>'accountingaccount'),
'b.subledger_account'=>array('rule'=>'accountingaccount'),
'b.debit' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'),
'b.credit' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'),
'b.multicurrency_amount' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'),
'b.montant' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeAmount', 'element' => 'Accountancy'),
'b.sens' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeDirection', 'element' => 'Accountancy'),
'b.debit' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'),
'b.credit' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'),
'b.multicurrency_amount' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'),
'b.montant' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeAmount', 'element' => 'Accountancy'),
'b.sens' => array('rule' => 'compute', 'type' => 'varchar', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeDirection', 'element' => 'Accountancy'),
);
$this->import_regex_array[$r] = array(
//'b.doc_date'=>'^\d{4}\d{2}\d{2}$',

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -192,12 +193,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$codetouse = $prefix.strtoupper($codetouse);
$is_dispo = $this->verif($db, $codetouse, $societe, $type);
if (!$is_dispo) {
$this->code = $codetouse;
} else {
// Pour retour
$this->code = $codetouse;
}
$this->code = $codetouse;
dol_syslog("mod_codecompta_aquarium::get_code found code=".$this->code);
return $is_dispo;
}

View file

@ -71,7 +71,8 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield
$totalarray['totalizable'][$key]['total'] += $obj->$tmpkey;
}
}
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
// key 'totalizable' if in extrafields same as 'isameasure' into ->$fields
if (!empty($extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) && $extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key] == 1) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = $extrafieldsobjectprefix.$tmpkey;
}

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 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
@ -240,11 +241,11 @@ if ($action == 'refreshmanual') {
//print $ecmdirtmp->cachenbofdoc."<br>\n";exit;
$id = $ecmdirtmp->create($user);
if ($id > 0) {
$newdirsql = array('id'=>$id,
'id_mere'=>$ecmdirtmp->fk_parent,
'label'=>$ecmdirtmp->label,
'description'=>$ecmdirtmp->description,
'fullrelativename'=>$relativepathmissing);
$newdirsql = array('id' => $id,
'id_mere' => $ecmdirtmp->fk_parent,
'label' => $ecmdirtmp->label,
'description' => $ecmdirtmp->description,
'fullrelativename' => $relativepathmissing);
$sqltree[] = $newdirsql; // We complete fulltree for following loops
//var_dump($sqltree);
$adirwascreated = 1;
@ -313,93 +314,93 @@ if (!getDolGlobalString('ECM_AUTO_TREE_HIDEN')) {
if (isModEnabled("product") || isModEnabled("service")) {
$langs->load("products");
$rowspan++;
$sectionauto[] = array('position'=>10, 'level'=>1, 'module'=>'product', 'test'=>(isModEnabled("product") || isModEnabled("service")), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts"));
$sectionauto[] = array('position' => 10, 'level' => 1, 'module' => 'product', 'test' => (isModEnabled("product") || isModEnabled("service")), 'label' => $langs->trans("ProductsAndServices"), 'desc' => $langs->trans("ECMDocsByProducts"));
}
if (isModEnabled("societe")) {
$rowspan++;
$sectionauto[] = array('position'=>20, 'level'=>1, 'module'=>'company', 'test'=>isModEnabled('societe'), 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties")));
$sectionauto[] = array('position' => 20, 'level' => 1, 'module' => 'company', 'test' => isModEnabled('societe'), 'label' => $langs->trans("ThirdParties"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties")));
}
if (isModEnabled("propal")) {
$rowspan++;
$sectionauto[] = array('position'=>30, 'level'=>1, 'module'=>'propal', 'test'=>isModEnabled('propal'), 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals")));
$sectionauto[] = array('position' => 30, 'level' => 1, 'module' => 'propal', 'test' => isModEnabled('propal'), 'label' => $langs->trans("Proposals"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals")));
}
if (isModEnabled('contract')) {
$rowspan++;
$sectionauto[] = array('position'=>40, 'level'=>1, 'module'=>'contract', 'test'=>isModEnabled('contract'), 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts")));
$sectionauto[] = array('position' => 40, 'level' => 1, 'module' => 'contract', 'test' => isModEnabled('contract'), 'label' => $langs->trans("Contracts"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts")));
}
if (isModEnabled('order')) {
$rowspan++;
$sectionauto[] = array('position'=>50, 'level'=>1, 'module'=>'order', 'test'=>isModEnabled('order'), 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders")));
$sectionauto[] = array('position' => 50, 'level' => 1, 'module' => 'order', 'test' => isModEnabled('order'), 'label' => $langs->trans("CustomersOrders"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders")));
}
if (isModEnabled('invoice')) {
$rowspan++;
$sectionauto[] = array('position'=>60, 'level'=>1, 'module'=>'invoice', 'test'=>isModEnabled('invoice'), 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices")));
$sectionauto[] = array('position' => 60, 'level' => 1, 'module' => 'invoice', 'test' => isModEnabled('invoice'), 'label' => $langs->trans("CustomersInvoices"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices")));
}
if (isModEnabled('supplier_proposal')) {
$langs->load("supplier_proposal");
$rowspan++;
$sectionauto[] = array('position'=>70, 'level'=>1, 'module'=>'supplier_proposal', 'test'=>isModEnabled('supplier_proposal'), 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals")));
$sectionauto[] = array('position' => 70, 'level' => 1, 'module' => 'supplier_proposal', 'test' => isModEnabled('supplier_proposal'), 'label' => $langs->trans("SupplierProposals"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals")));
}
if (isModEnabled("supplier_order")) {
$rowspan++;
$sectionauto[] = array('position'=>80, 'level'=>1, 'module'=>'order_supplier', 'test'=>isModEnabled("supplier_order"), 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
$sectionauto[] = array('position' => 80, 'level' => 1, 'module' => 'order_supplier', 'test' => isModEnabled("supplier_order"), 'label' => $langs->trans("SuppliersOrders"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
}
if (isModEnabled("supplier_invoice")) {
$rowspan++;
$sectionauto[] = array('position'=>90, 'level'=>1, 'module'=>'invoice_supplier', 'test'=>isModEnabled("supplier_invoice"), 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
$sectionauto[] = array('position' => 90, 'level' => 1, 'module' => 'invoice_supplier', 'test' => isModEnabled("supplier_invoice"), 'label' => $langs->trans("SuppliersInvoices"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
}
if (isModEnabled('tax')) {
$langs->load("compta");
$rowspan++;
$sectionauto[] = array('position'=>100, 'level'=>1, 'module'=>'tax', 'test'=>isModEnabled('tax'), 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions")));
$sectionauto[] = array('position' => 100, 'level' => 1, 'module' => 'tax', 'test' => isModEnabled('tax'), 'label' => $langs->trans("SocialContributions"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions")));
$rowspan++;
$sectionauto[] = array('position'=>110, 'level'=>1, 'module'=>'tax-vat', 'test'=>isModEnabled('tax'), 'label'=>$langs->trans("VAT"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("VAT")));
$sectionauto[] = array('position' => 110, 'level' => 1, 'module' => 'tax-vat', 'test' => isModEnabled('tax'), 'label' => $langs->trans("VAT"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("VAT")));
}
if (isModEnabled('salaries')) {
$langs->load("compta");
$rowspan++;
$sectionauto[] = array('position'=>120, 'level'=>1, 'module'=>'salaries', 'test'=>isModEnabled('salaries'), 'label'=>$langs->trans("Salaries"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Salaries")));
$sectionauto[] = array('position' => 120, 'level' => 1, 'module' => 'salaries', 'test' => isModEnabled('salaries'), 'label' => $langs->trans("Salaries"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Salaries")));
}
if (isModEnabled('project')) {
$rowspan++;
$sectionauto[] = array('position'=>130, 'level'=>1, 'module'=>'project', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
$sectionauto[] = array('position' => 130, 'level' => 1, 'module' => 'project', 'test' => isModEnabled('project'), 'label' => $langs->trans("Projects"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
$rowspan++;
$sectionauto[] = array('position'=>140, 'level'=>1, 'module'=>'project_task', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
$sectionauto[] = array('position' => 140, 'level' => 1, 'module' => 'project_task', 'test' => isModEnabled('project'), 'label' => $langs->trans("Tasks"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
}
if (isModEnabled('intervention')) {
$langs->load("interventions");
$rowspan++;
$sectionauto[] = array('position'=>150, 'level'=>1, 'module'=>'fichinter', 'test'=>isModEnabled('intervention'), 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
$sectionauto[] = array('position' => 150, 'level' => 1, 'module' => 'fichinter', 'test' => isModEnabled('intervention'), 'label' => $langs->trans("Interventions"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
}
if (isModEnabled('expensereport')) {
$langs->load("trips");
$rowspan++;
$sectionauto[] = array('position'=>160, 'level'=>1, 'module'=>'expensereport', 'test'=>isModEnabled('expensereport'), 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports")));
$sectionauto[] = array('position' => 160, 'level' => 1, 'module' => 'expensereport', 'test' => isModEnabled('expensereport'), 'label' => $langs->trans("ExpenseReports"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports")));
}
if (isModEnabled('holiday')) {
$langs->load("holiday");
$rowspan++;
$sectionauto[] = array('position'=>170, 'level'=>1, 'module'=>'holiday', 'test'=>isModEnabled('holiday'), 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays")));
$sectionauto[] = array('position' => 170, 'level' => 1, 'module' => 'holiday', 'test' => isModEnabled('holiday'), 'label' => $langs->trans("Holidays"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays")));
}
if (isModEnabled("bank")) {
$langs->load("banks");
$rowspan++;
$sectionauto[] = array('position'=>180, 'level'=>1, 'module'=>'banque', 'test'=>isModEnabled('bank'), 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
$sectionauto[] = array('position' => 180, 'level' => 1, 'module' => 'banque', 'test' => isModEnabled('bank'), 'label' => $langs->trans("BankAccount"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
$rowspan++;
$sectionauto[] = array('position'=>190, 'level'=>1, 'module'=>'chequereceipt', 'test'=>isModEnabled('bank'), 'label'=>$langs->trans("CheckReceipt"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
$sectionauto[] = array('position' => 190, 'level' => 1, 'module' => 'chequereceipt', 'test' => isModEnabled('bank'), 'label' => $langs->trans("CheckReceipt"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
}
if (isModEnabled('mrp')) {
$langs->load("mrp");
$rowspan++;
$sectionauto[] = array('position'=>200, 'level'=>1, 'module'=>'mrp-mo', 'test'=>isModEnabled('mrp'), 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));
$sectionauto[] = array('position' => 200, 'level' => 1, 'module' => 'mrp-mo', 'test' => isModEnabled('mrp'), 'label' => $langs->trans("MOs"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));
}
if (isModEnabled('recruitment')) {
$langs->load("recruitment");
$rowspan++;
$sectionauto[] = array('position'=>210, 'level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>isModEnabled('recruitment'), 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications")));
$sectionauto[] = array('position' => 210, 'level' => 1, 'module' => 'recruitment-recruitmentcandidature', 'test' => isModEnabled('recruitment'), 'label' => $langs->trans("Candidatures"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications")));
}
$rowspan++;
$sectionauto[] = array('position'=>220, 'level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users")));
$sectionauto[] = array('position' => 220, 'level' => 1, 'module' => 'user', 'test' => 1, 'label' => $langs->trans("Users"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users")));
$parameters = array();
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
@ -481,15 +482,9 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $act
}
print '<li class="directory collapsed">';
if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) {
print '<a class="fmdirlia jqft ecmjqft" href="'.$_SERVER["PHP_SELF"].'?module='.urlencode($val['module']).'">';
print $val['label'];
print '</a>';
} else {
print '<a class="fmdirlia jqft ecmjqft" href="'.$_SERVER["PHP_SELF"].'?module='.urlencode($val['module']).'">';
print $val['label'];
print '</a>';
}
print '<a class="fmdirlia jqft ecmjqft" href="'.$_SERVER["PHP_SELF"].'?module='.urlencode($val['module']).'">';
print $val['label'];
print '</a>';
print '<div class="ecmjqft">';
// Info

View file

@ -1479,7 +1479,7 @@ if ($action == 'create') {
$nbofsuggested = 0;
foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
if ($stock_warehouse->real > 0) {
if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
$nbofsuggested++;
}
}
@ -1492,7 +1492,7 @@ if ($action == 'create') {
}
$tmpwarehouseObject->fetch($warehouse_id);
if ($stock_warehouse->real > 0) {
if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
$stock = + $stock_warehouse->real; // Convert it to number
$deliverableQty = min($quantityToBeDelivered, $stock);
$deliverableQty = max(0, $deliverableQty);
@ -1603,7 +1603,7 @@ if ($action == 'create') {
// Define nb of lines suggested for this order line
$nbofsuggested = 0;
foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
$nbofsuggested += count($stock_warehouse->detail_batch);
}
}
@ -1616,7 +1616,7 @@ if ($action == 'create') {
}
$tmpwarehouseObject->fetch($warehouse_id);
if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
foreach ($stock_warehouse->detail_batch as $dbatch) {
$batchStock = + $dbatch->qty; // To get a numeric
if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
@ -1707,6 +1707,9 @@ if ($action == 'create') {
$disabled = 'disabled="disabled"';
}
print '<input class="qtyl right" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> ';
if (empty($disabled) && getDolGlobalString('STOCK_ALLOW_NEGATIVE_TRANSFER')) {
print '<input name="ent1' . $indiceAsked . '_' . $subj . '" type="hidden" value="' . $warehouse_selected_id . '">';
}
} else {
print $langs->trans("NA");
}

View file

@ -5,6 +5,7 @@
* Copyright (C) 2015-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
@ -1693,7 +1694,7 @@ if ($action == 'create') {
}
if ($action == 'cancel') {
$array_input = array('text'=>$langs->trans("ConfirmCancelTrip"), array('type'=>"text", 'label'=>'<strong>'.$langs->trans("Comment").'</strong>', 'name'=>"detail_cancel", 'value'=>""));
$array_input = array('text' => $langs->trans("ConfirmCancelTrip"), array('type' => "text", 'label' => '<strong>'.$langs->trans("Comment").'</strong>', 'name' => "detail_cancel", 'value' => ""));
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("Cancel"), "", "confirm_cancel", $array_input, "", 1);
}
@ -1702,7 +1703,7 @@ if ($action == 'create') {
}
if ($action == 'refuse') { // Deny
$array_input = array('text'=>$langs->trans("ConfirmRefuseTrip"), array('type'=>"text", 'label'=>$langs->trans("Comment"), 'name'=>"detail_refuse", 'value'=>""));
$array_input = array('text' => $langs->trans("ConfirmRefuseTrip"), array('type' => "text", 'label' => $langs->trans("Comment"), 'name' => "detail_refuse", 'value' => ""));
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("Deny"), '', "confirm_refuse", $array_input, "yes", 1);
}
@ -1882,8 +1883,6 @@ if ($action == 'create') {
$rowspan = 5;
if ($object->status <= ExpenseReport::STATUS_VALIDATED) {
$rowspan++;
} elseif ($object->status == ExpenseReport::STATUS_CANCELED) {
$rowspan += 2;
} else {
$rowspan += 2;
}

View file

@ -1934,7 +1934,7 @@ class FactureFournisseur extends CommonInvoice
// Set new ref and define current statut
if (!$error) {
$this->ref = $num;
$this->ref = $this->newref;
$this->statut = self::STATUS_VALIDATED;
//$this->date_validation=$now; this is stored into log table
}

View file

@ -414,10 +414,10 @@ class ProductFournisseur extends Product
$fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $multicurrency_code);
}
$buyprice = price2num($buyprice, 'MU');
$charges = price2num($charges, 'MU');
$qty = price2num($qty, 'MS');
$unitBuyPrice = price2num($buyprice / $qty, 'MU');
$buyprice = (float) price2num($buyprice, 'MU');
$charges = (float) price2num($charges, 'MU');
$qty = (float) price2num($qty, 'MS');
$unitBuyPrice = (float) price2num($buyprice / $qty, 'MU');
// We can have a purchase ref that need to buy 100 min for a given price and with a packaging of 50.
//$packaging = price2num(((empty($this->packaging) || $this->packaging < $qty) ? $qty : $this->packaging), 'MS');
@ -446,10 +446,6 @@ class ProductFournisseur extends Product
$localtax2 = 0; // If = '' then = 0
}
// Check parameters
if ($buyprice != '' && !is_numeric($buyprice)) {
}
$this->db->begin();
if ($this->product_fourn_price_id > 0) {
@ -478,6 +474,7 @@ class ProductFournisseur extends Product
}
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql .= " SET fk_user = ".((int) $user->id)." ,";
$sql .= " datec = '".$this->db->idate($now)."' ,"; // Note: Even if this is an update, we update the creation date as the log of each change is tracked into product_fournisseur_log.
$sql .= " ref_fourn = '".$this->db->escape($ref_fourn)."',";
$sql .= " desc_fourn = '".$this->db->escape($desc_fourn)."',";
$sql .= " price = ".((float) $buyprice).",";

View file

@ -2717,7 +2717,11 @@ if ($action == 'create') {
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
print '<td class="maxwidthonsmartphone">';
print img_picto('', 'currency', 'class="pictofixedwidth"');
print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $currency_code), 'multicurrency_code');
$used_currency_code = $currency_code;
if (!GETPOST('changecompany')) {
$used_currency_code = GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $currency_code;
}
print $form->selectMultiCurrency($used_currency_code, 'multicurrency_code');
print '</td></tr>';
}

View file

@ -48,6 +48,7 @@ $action = GETPOST('action', 'alpha');
$massaction = GETPOST('massaction', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'vendorpaymentlist';
$mode = GETPOST('mode', 'aZ');
$socid = GETPOSTINT('socid');

View file

@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -74,8 +75,6 @@ $tmpproduct = new Product($db);
$helpurl = '';
if ($type == '0') {
$helpurl = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
} elseif ($type == '1') {
$helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
} else {
$helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
}
@ -171,7 +170,7 @@ if (!empty($mode) && $mode != '-1') {
while ($i < $num) {
$objp = $db->fetch_object($resql);
$infoprod[$objp->rowid] = array('type'=>$objp->type, 'ref'=>$objp->ref, 'label'=>$objp->label, 'tobuy'=>$objp->tobuy, 'tosell'=>$objp->tobuy, 'tobatch'=>$objp->tobatch, 'barcode'=>$objp->barcode);
$infoprod[$objp->rowid] = array('type' => $objp->type, 'ref' => $objp->ref, 'label' => $objp->label, 'tobuy' => $objp->tobuy, 'tosell' => $objp->tobuy, 'tobatch' => $objp->tobatch, 'barcode' => $objp->barcode);
$infoprod[$objp->rowid]['nbline'] = $objp->c;
$i++;

View file

@ -5,6 +5,7 @@
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
* 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
@ -109,10 +110,6 @@ if (!($id > 0) && empty($ref) || $notab) {
$helpurl = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
//$title=$langs->trans("StatisticsOfProducts");
$title = $langs->trans("Statistics");
} elseif ($type == '1') {
$helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
//$title=$langs->trans("StatisticsOfServices");
$title = $langs->trans("Statistics");
} else {
$helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
//$title=$langs->trans("StatisticsOfProductsOrServices");
@ -203,7 +200,7 @@ if ($result || !($id > 0)) {
if (!($id > 0) || $notab) {
// Type
print '<tr class="nooddeven"><td class="titlefield">'.$langs->trans("Type").'</td><td>';
$array = array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
$array = array('-1' => '&nbsp;', '0' => $langs->trans('Product'), '1' => $langs->trans('Service'));
print $form->selectarray('type', $array, $type, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
print '</td></tr>';
@ -344,50 +341,50 @@ if ($result || !($id > 0)) {
$arrayforlabel = array('byunit' => 'NumberOfUnits', 'bynumber' => 'NumberOf', 'byamount' => 'AmountIn');
if (isModEnabled('propal')) {
$graphfiles['propal'] = array('modulepart'=>'productstats_proposals',
$graphfiles['propal'] = array('modulepart' => 'productstats_proposals',
'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("Proposals")));
}
if (isModEnabled('supplier_proposal')) {
$langs->load("supplier_proposal");
$graphfiles['proposalssuppliers'] = array('modulepart'=>'productstats_proposalssuppliers',
$graphfiles['proposalssuppliers'] = array('modulepart' => 'productstats_proposalssuppliers',
'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("SupplierProposals")));
}
if (isModEnabled('order')) {
$graphfiles['orders'] = array('modulepart'=>'productstats_orders',
$graphfiles['orders'] = array('modulepart' => 'productstats_orders',
'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("Orders")));
}
if (isModEnabled('supplier_order')) {
$graphfiles['orderssuppliers'] = array('modulepart'=>'productstats_orderssuppliers',
$graphfiles['orderssuppliers'] = array('modulepart' => 'productstats_orderssuppliers',
'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("SuppliersOrders")));
}
if (isModEnabled('invoice')) {
$graphfiles['invoices'] = array('modulepart'=>'productstats_invoices',
$graphfiles['invoices'] = array('modulepart' => 'productstats_invoices',
'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("Invoices")));
}
if (isModEnabled('supplier_invoice')) {
$graphfiles['invoicessuppliers'] = array('modulepart'=>'productstats_invoicessuppliers',
$graphfiles['invoicessuppliers'] = array('modulepart' => 'productstats_invoicessuppliers',
'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("SupplierInvoices")));
}
if (isModEnabled('contract')) {
$graphfiles['contracts'] = array('modulepart'=>'productstats_contracts',
$graphfiles['contracts'] = array('modulepart' => 'productstats_contracts',
'file' => $object->id.'/contracts12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode], $langs->transnoentitiesnoconv("Contracts")));
}
if (isModEnabled('mrp') && $mode != 'byamount') {
$graphfiles['mrp'] = array('modulepart'=>'productstats_mrp',
$graphfiles['mrp'] = array('modulepart' => 'productstats_mrp',
'file' => $object->id.'/mos12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => $langs->transnoentitiesnoconv($arrayforlabel[$mode]."Mos"));
}

View file

@ -383,7 +383,7 @@ div.paymentbordline
margin: 0 auto;
width: 100%;
height: 55%;
overflow: hidden;
overflow-x: hidden;
}
.div1{

View file

@ -1,11 +1,13 @@
parameters:
tmpDir: ./.github/tmp
parallel:
jobSize: 8
# Commented some of the settings, reminding the defaults:
# should adapt better to target machines
# jobSize: 8 # default is 20
processTimeout: 600.0
maximumNumberOfProcesses: 20
minimumNumberOfJobsPerProcess: 2
buffer: 134217728 # 128 MB
# maximumNumberOfProcesses: 20 # default is 32
# minimumNumberOfJobsPerProcess: 2 # default is 2
# buffer: 134217728 # 128 MB # Not documented
customRulesetUsed: true
level: 2
fileExtensions:
@ -13,13 +15,6 @@ parameters:
paths:
- htdocs
- scripts
stubFiles:
# - dev/tools/phan/stubs/GeoIP2.php
# - dev/tools/phan/stubs/geoip_inc.php
- dev/tools/phan/stubs/module_numberwords.php
- dev/tools/phan/stubs/restler.php
- dev/tools/phan/stubs/stripe.php
- dev/tools/phan/stubs/swiss-qr-bill.php
excludePaths:
analyseAndScan:
- htdocs/custom/*