diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon
index 1790a9abd68..74de89b1ee4 100644
--- a/dev/build/phpstan/phpstan-baseline.neon
+++ b/dev/build/phpstan/phpstan-baseline.neon
@@ -7200,18 +7200,6 @@ parameters:
count: 1
path: ../../../htdocs/core/lib/functions2.lib.php
- -
- message: '#^Parameter \#3 \$value of function curl_setopt expects 0\|2, bool given\.$#'
- identifier: argument.type
- count: 1
- path: ../../../htdocs/core/lib/geturl.lib.php
-
- -
- message: '#^Parameter \#3 \$value of function curl_setopt expects bool, int given\.$#'
- identifier: argument.type
- count: 4
- path: ../../../htdocs/core/lib/geturl.lib.php
-
-
message: '#^Call to function function_exists\(\) with ''imagecreatefromgif''\|''imagecreatefromjpeg''\|''imagecreatefrompng''\|''imagecreatefromwbmp''\|''imagecreatefromwebp'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@@ -7326,12 +7314,6 @@ parameters:
count: 1
path: ../../../htdocs/core/lib/signature.lib.php
- -
- message: '#^Negated boolean expression is always false\.$#'
- identifier: booleanNot.alwaysFalse
- count: 6
- path: ../../../htdocs/core/lib/tax.lib.php
-
-
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@@ -7590,12 +7572,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php
- -
- message: '#^Property modTcpdfbarcode\:\:\$is2d has no type specified\.$#'
- identifier: missingType.property
- count: 1
- path: ../../../htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php
-
-
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@@ -7842,30 +7818,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php
- -
- message: '#^Property mod_facture_mars\:\:\$prefixcreditnote has no type specified\.$#'
- identifier: missingType.property
- count: 1
- path: ../../../htdocs/core/modules/facture/mod_facture_mars.php
-
- -
- message: '#^Property mod_facture_mars\:\:\$prefixdeposit has no type specified\.$#'
- identifier: missingType.property
- count: 1
- path: ../../../htdocs/core/modules/facture/mod_facture_mars.php
-
- -
- message: '#^Property mod_facture_mars\:\:\$prefixinvoice has no type specified\.$#'
- identifier: missingType.property
- count: 1
- path: ../../../htdocs/core/modules/facture/mod_facture_mars.php
-
- -
- message: '#^Property mod_facture_mars\:\:\$prefixreplacement has no type specified\.$#'
- identifier: missingType.property
- count: 1
- path: ../../../htdocs/core/modules/facture/mod_facture_mars.php
-
-
message: '#^Access to constant TYPE_NON on an unknown class Sprain\\SwissQrBill\\DataGroup\\Element\\PaymentReference\.$#'
identifier: class.notFound
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index fbc12ca76c7..86175a54e92 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -14708,7 +14708,7 @@ function getElementProperties($elementType)
} elseif ($elementType == 'usergroup') {
$classpath = 'user/class';
$module = 'user';
- } elseif ($elementType == 'mo') {
+ } elseif ($elementType == 'mo' || $elementType == 'mrp') {
$classpath = 'mrp/class';
$classfile = 'mo';
$classname = 'Mo';
diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php
index fe5e660a2f3..21b278f5f85 100644
--- a/htdocs/core/lib/geturl.lib.php
+++ b/htdocs/core/lib/geturl.lib.php
@@ -67,7 +67,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
print $USE_PROXY."-".$gv_ApiErrorURL."
";
print $nvpStr;
exit;*/
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
+ curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function'); // set the Dolibarr user agent name
// We use @ here because this may return warning if safe mode is on or open_basedir is on (following location is forbidden when safe mode is on).
@@ -102,7 +102,12 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
// Turning off the server and peer verification(TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ($ssl_verifypeer ? true : false));
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($ssl_verifypeer ? true : false));
+
+ // 0 to not check the names
+ // 1 to check the existence of a common name in the SSL peer certificate
+ // 2 to check the existence of a common name and also verify that it matches the hostname provided.
+ // In production environments the value of this option should be kept at 2 (default value).
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($ssl_verifypeer ? 2 : 0));
// Restrict use to some protocols only
$protocols = 0;
@@ -143,9 +148,9 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
}
//curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); // PHP 5.5
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // We want response
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // We want response
if ($postorget == 'POST') {
- curl_setopt($ch, CURLOPT_POST, 1); // POST
+ curl_setopt($ch, CURLOPT_POST, true); // POST
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields
} elseif ($postorget == 'POSTALREADYFORMATED') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); // HTTP request is 'POST' but param string is taken as it is
@@ -182,7 +187,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
} elseif ($postorget == 'DELETE') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); // POST
} else {
- curl_setopt($ch, CURLOPT_POST, 0); // GET
+ curl_setopt($ch, CURLOPT_POST, false); // GET
}
//if USE_PROXY constant set at begin of this method.
diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php
index 0050910fced..5deae096d44 100644
--- a/htdocs/core/lib/tax.lib.php
+++ b/htdocs/core/lib/tax.lib.php
@@ -7,7 +7,7 @@
* Copyright (C) 2012-2014 Raphaël Doursenaud
* Copyright (C) 2015 Marcos García
* Copyright (C) 2021-2022 Open-Dsi
- * Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2024-2025 Frédéric France
* Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
@@ -275,87 +275,79 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
$sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
- if (!$sql) {
- return -1;
- }
- if ($sql == 'TODO') {
- return -2;
- }
- if ($sql != 'TODO') {
- dol_syslog("Tax.lib.php::tax_by_thirdparty", LOG_DEBUG);
+ dol_syslog("Tax.lib.php::tax_by_thirdparty", LOG_DEBUG);
- $resql = $db->query($sql);
- if ($resql) {
- $company_id = -1;
- $oldrowid = '';
- while ($assoc = $db->fetch_array($resql)) {
- if (!isset($list[$assoc['company_id']]['totalht'])) {
- $list[$assoc['company_id']]['totalht'] = 0;
- }
- if (!isset($list[$assoc['company_id']]['vat'])) {
- $list[$assoc['company_id']]['vat'] = 0;
- }
- if (!isset($list[$assoc['company_id']]['localtax1'])) {
- $list[$assoc['company_id']]['localtax1'] = 0;
- }
- if (!isset($list[$assoc['company_id']]['localtax2'])) {
- $list[$assoc['company_id']]['localtax2'] = 0;
- }
-
- if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
- $oldrowid = $assoc['rowid'];
- $list[$assoc['company_id']]['totalht'] += (float) $assoc['total_ht'];
- $list[$assoc['company_id']]['vat'] += (float) $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1'] += (float) $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2'] += (float) $assoc['total_localtax2'];
- }
-
- $list[$assoc['company_id']]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
- $list[$assoc['company_id']]['dtype'][] = (int) $assoc['dtype'];
- $list[$assoc['company_id']]['datef'][] = $db->jdate($assoc['datef']);
- $list[$assoc['company_id']]['datep'][] = $db->jdate($assoc['datep']);
-
- $list[$assoc['company_id']]['company_name'][] = (string) $assoc['company_name'];
- $list[$assoc['company_id']]['company_id'][] = (int) $assoc['company_id'];
- $list[$assoc['company_id']]['company_alias'][] = (string) $assoc['company_alias'];
- $list[$assoc['company_id']]['company_email'][] = (string) $assoc['company_email'];
- $list[$assoc['company_id']]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
- $list[$assoc['company_id']]['company_client'][] = (int) $assoc['company_client'];
- $list[$assoc['company_id']]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
- $list[$assoc['company_id']]['company_customer_code'][] = (string) $assoc['company_customer_code'];
- $list[$assoc['company_id']]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
- $list[$assoc['company_id']]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
- $list[$assoc['company_id']]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
- $list[$assoc['company_id']]['company_status'][] = (int) $assoc['company_status'];
-
- $list[$assoc['company_id']]['drate'][] = $assoc['rate'];
- $list[$assoc['company_id']]['ddate_start'][] = $db->jdate($assoc['date_start']);
- $list[$assoc['company_id']]['ddate_end'][] = $db->jdate($assoc['date_end']);
-
- $list[$assoc['company_id']]['facid'][] = (int) $assoc['facid'];
- $list[$assoc['company_id']]['facnum'][] = (string) $assoc['facnum'];
- $list[$assoc['company_id']]['type'][] = (int) $assoc['type'];
- $list[$assoc['company_id']]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
- $list[$assoc['company_id']]['descr'][] = (string) $assoc['descr'];
-
- $list[$assoc['company_id']]['totalht_list'][] = (float) $assoc['total_ht'];
- $list[$assoc['company_id']]['vat_list'][] = (float) $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1_list'][] = (float) $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2_list'][] = (float) $assoc['total_localtax2'];
-
- $list[$assoc['company_id']]['pid'][] = (int) $assoc['pid'];
- $list[$assoc['company_id']]['pref'][] = (string) $assoc['pref'];
- $list[$assoc['company_id']]['ptype'][] = (int) $assoc['ptype'];
-
- $list[$assoc['company_id']]['payment_id'][] = (int) $assoc['payment_id'];
- $list[$assoc['company_id']]['payment_amount'][] = (float) $assoc['payment_amount'];
-
- $company_id = $assoc['company_id'];
+ $resql = $db->query($sql);
+ if ($resql) {
+ $company_id = -1;
+ $oldrowid = '';
+ while ($assoc = $db->fetch_array($resql)) {
+ if (!isset($list[$assoc['company_id']]['totalht'])) {
+ $list[$assoc['company_id']]['totalht'] = 0;
}
- } else {
- dol_print_error($db);
- return -3;
+ if (!isset($list[$assoc['company_id']]['vat'])) {
+ $list[$assoc['company_id']]['vat'] = 0;
+ }
+ if (!isset($list[$assoc['company_id']]['localtax1'])) {
+ $list[$assoc['company_id']]['localtax1'] = 0;
+ }
+ if (!isset($list[$assoc['company_id']]['localtax2'])) {
+ $list[$assoc['company_id']]['localtax2'] = 0;
+ }
+
+ if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
+ $oldrowid = $assoc['rowid'];
+ $list[$assoc['company_id']]['totalht'] += (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat'] += (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2'] += (float) $assoc['total_localtax2'];
+ }
+
+ $list[$assoc['company_id']]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
+ $list[$assoc['company_id']]['dtype'][] = (int) $assoc['dtype'];
+ $list[$assoc['company_id']]['datef'][] = $db->jdate($assoc['datef']);
+ $list[$assoc['company_id']]['datep'][] = $db->jdate($assoc['datep']);
+
+ $list[$assoc['company_id']]['company_name'][] = (string) $assoc['company_name'];
+ $list[$assoc['company_id']]['company_id'][] = (int) $assoc['company_id'];
+ $list[$assoc['company_id']]['company_alias'][] = (string) $assoc['company_alias'];
+ $list[$assoc['company_id']]['company_email'][] = (string) $assoc['company_email'];
+ $list[$assoc['company_id']]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
+ $list[$assoc['company_id']]['company_client'][] = (int) $assoc['company_client'];
+ $list[$assoc['company_id']]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
+ $list[$assoc['company_id']]['company_customer_code'][] = (string) $assoc['company_customer_code'];
+ $list[$assoc['company_id']]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
+ $list[$assoc['company_id']]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
+ $list[$assoc['company_id']]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
+ $list[$assoc['company_id']]['company_status'][] = (int) $assoc['company_status'];
+
+ $list[$assoc['company_id']]['drate'][] = $assoc['rate'];
+ $list[$assoc['company_id']]['ddate_start'][] = $db->jdate($assoc['date_start']);
+ $list[$assoc['company_id']]['ddate_end'][] = $db->jdate($assoc['date_end']);
+
+ $list[$assoc['company_id']]['facid'][] = (int) $assoc['facid'];
+ $list[$assoc['company_id']]['facnum'][] = (string) $assoc['facnum'];
+ $list[$assoc['company_id']]['type'][] = (int) $assoc['type'];
+ $list[$assoc['company_id']]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$assoc['company_id']]['descr'][] = (string) $assoc['descr'];
+
+ $list[$assoc['company_id']]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2_list'][] = (float) $assoc['total_localtax2'];
+
+ $list[$assoc['company_id']]['pid'][] = (int) $assoc['pid'];
+ $list[$assoc['company_id']]['pref'][] = (string) $assoc['pref'];
+ $list[$assoc['company_id']]['ptype'][] = (int) $assoc['ptype'];
+
+ $list[$assoc['company_id']]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$assoc['company_id']]['payment_amount'][] = (float) $assoc['payment_amount'];
+
+ $company_id = $assoc['company_id'];
}
+ } else {
+ dol_print_error($db);
+ return -3;
}
@@ -465,87 +457,78 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
$sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
- if (!$sql) {
- dol_syslog("Tax.lib.php::tax_by_thirdparty no accountancy module enabled".$sql, LOG_ERR);
- return -1; // -1 = Not accountancy module enabled
- }
- if ($sql == 'TODO') {
- return -2; // -2 = Feature not yet available
- }
- if ($sql != 'TODO') {
- dol_syslog("Tax.lib.php::tax_by_thirdparty", LOG_DEBUG);
- $resql = $db->query($sql);
- if ($resql) {
- $company_id = -1;
- $oldrowid = '';
- while ($assoc = $db->fetch_array($resql)) {
- if (!isset($list[$assoc['company_id']]['totalht'])) {
- $list[$assoc['company_id']]['totalht'] = 0;
- }
- if (!isset($list[$assoc['company_id']]['vat'])) {
- $list[$assoc['company_id']]['vat'] = 0;
- }
- if (!isset($list[$assoc['company_id']]['localtax1'])) {
- $list[$assoc['company_id']]['localtax1'] = 0;
- }
- if (!isset($list[$assoc['company_id']]['localtax2'])) {
- $list[$assoc['company_id']]['localtax2'] = 0;
- }
-
- if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
- $oldrowid = $assoc['rowid'];
- $list[$assoc['company_id']]['totalht'] += (float) $assoc['total_ht'];
- $list[$assoc['company_id']]['vat'] += (float) $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1'] += (float) $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2'] += (float) $assoc['total_localtax2'];
- }
- $list[$assoc['company_id']]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
- $list[$assoc['company_id']]['dtype'][] = $assoc['dtype'];
- $list[$assoc['company_id']]['datef'][] = $db->jdate($assoc['datef']);
- $list[$assoc['company_id']]['datep'][] = $db->jdate($assoc['datep']);
-
- $list[$assoc['company_id']]['company_name'][] = (string) $assoc['company_name'];
- $list[$assoc['company_id']]['company_id'][] = (int) $assoc['company_id'];
- $list[$assoc['company_id']]['company_alias'][] = (string) $assoc['company_alias'];
- $list[$assoc['company_id']]['company_email'][] = (string) $assoc['company_email'];
- $list[$assoc['company_id']]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
- $list[$assoc['company_id']]['company_client'][] = (int) $assoc['company_client'];
- $list[$assoc['company_id']]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
- $list[$assoc['company_id']]['company_customer_code'][] = (string) $assoc['company_customer_code'];
- $list[$assoc['company_id']]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
- $list[$assoc['company_id']]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
- $list[$assoc['company_id']]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
- $list[$assoc['company_id']]['company_status'][] = (int) $assoc['company_status'];
-
- $list[$assoc['company_id']]['drate'][] = $assoc['rate'];
- $list[$assoc['company_id']]['ddate_start'][] = $db->jdate($assoc['date_start']);
- $list[$assoc['company_id']]['ddate_end'][] = $db->jdate($assoc['date_end']);
-
- $list[$assoc['company_id']]['facid'][] = (int) $assoc['facid'];
- $list[$assoc['company_id']]['facnum'][] = (string) $assoc['facnum'];
- $list[$assoc['company_id']]['type'][] = (int) $assoc['type'];
- $list[$assoc['company_id']]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
- $list[$assoc['company_id']]['descr'][] = (string) $assoc['descr'];
-
- $list[$assoc['company_id']]['totalht_list'][] = (float) $assoc['total_ht'];
- $list[$assoc['company_id']]['vat_list'][] = (float) $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1_list'][] = (float) $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2_list'][] = (float) $assoc['total_localtax2'];
-
- $list[$assoc['company_id']]['pid'][] = (int) $assoc['pid'];
- $list[$assoc['company_id']]['pref'][] = (string) $assoc['pref'];
- $list[$assoc['company_id']]['ptype'][] = (int) $assoc['ptype'];
-
- $list[$assoc['company_id']]['payment_id'][] = (int) $assoc['payment_id'];
- $list[$assoc['company_id']]['payment_ref'][] = (string) $assoc['payment_ref'];
- $list[$assoc['company_id']]['payment_amount'][] = (float) $assoc['payment_amount'];
-
- $company_id = $assoc['company_id'];
+ dol_syslog("Tax.lib.php::tax_by_thirdparty", LOG_DEBUG);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $company_id = -1;
+ $oldrowid = '';
+ while ($assoc = $db->fetch_array($resql)) {
+ if (!isset($list[$assoc['company_id']]['totalht'])) {
+ $list[$assoc['company_id']]['totalht'] = 0;
}
- } else {
- dol_print_error($db);
- return -3;
+ if (!isset($list[$assoc['company_id']]['vat'])) {
+ $list[$assoc['company_id']]['vat'] = 0;
+ }
+ if (!isset($list[$assoc['company_id']]['localtax1'])) {
+ $list[$assoc['company_id']]['localtax1'] = 0;
+ }
+ if (!isset($list[$assoc['company_id']]['localtax2'])) {
+ $list[$assoc['company_id']]['localtax2'] = 0;
+ }
+
+ if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
+ $oldrowid = $assoc['rowid'];
+ $list[$assoc['company_id']]['totalht'] += (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat'] += (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2'] += (float) $assoc['total_localtax2'];
+ }
+ $list[$assoc['company_id']]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
+ $list[$assoc['company_id']]['dtype'][] = $assoc['dtype'];
+ $list[$assoc['company_id']]['datef'][] = $db->jdate($assoc['datef']);
+ $list[$assoc['company_id']]['datep'][] = $db->jdate($assoc['datep']);
+
+ $list[$assoc['company_id']]['company_name'][] = (string) $assoc['company_name'];
+ $list[$assoc['company_id']]['company_id'][] = (int) $assoc['company_id'];
+ $list[$assoc['company_id']]['company_alias'][] = (string) $assoc['company_alias'];
+ $list[$assoc['company_id']]['company_email'][] = (string) $assoc['company_email'];
+ $list[$assoc['company_id']]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
+ $list[$assoc['company_id']]['company_client'][] = (int) $assoc['company_client'];
+ $list[$assoc['company_id']]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
+ $list[$assoc['company_id']]['company_customer_code'][] = (string) $assoc['company_customer_code'];
+ $list[$assoc['company_id']]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
+ $list[$assoc['company_id']]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
+ $list[$assoc['company_id']]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
+ $list[$assoc['company_id']]['company_status'][] = (int) $assoc['company_status'];
+
+ $list[$assoc['company_id']]['drate'][] = $assoc['rate'];
+ $list[$assoc['company_id']]['ddate_start'][] = $db->jdate($assoc['date_start']);
+ $list[$assoc['company_id']]['ddate_end'][] = $db->jdate($assoc['date_end']);
+
+ $list[$assoc['company_id']]['facid'][] = (int) $assoc['facid'];
+ $list[$assoc['company_id']]['facnum'][] = (string) $assoc['facnum'];
+ $list[$assoc['company_id']]['type'][] = (int) $assoc['type'];
+ $list[$assoc['company_id']]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$assoc['company_id']]['descr'][] = (string) $assoc['descr'];
+
+ $list[$assoc['company_id']]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2_list'][] = (float) $assoc['total_localtax2'];
+
+ $list[$assoc['company_id']]['pid'][] = (int) $assoc['pid'];
+ $list[$assoc['company_id']]['pref'][] = (string) $assoc['pref'];
+ $list[$assoc['company_id']]['ptype'][] = (int) $assoc['ptype'];
+
+ $list[$assoc['company_id']]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$assoc['company_id']]['payment_ref'][] = (string) $assoc['payment_ref'];
+ $list[$assoc['company_id']]['payment_amount'][] = (float) $assoc['payment_amount'];
+
+ $company_id = $assoc['company_id'];
}
+ } else {
+ dol_print_error($db);
+ return -3;
}
@@ -587,88 +570,79 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
}
$sql .= " ORDER BY e.rowid";
- if (!$sql) {
- dol_syslog("Tax.lib.php::tax_by_thirdparty no accountancy module enabled".$sql, LOG_ERR);
- return -1; // -1 = Not accountancy module enabled
- }
- if ($sql == 'TODO') {
- return -2; // -2 = Feature not yet available
- }
- if ($sql != 'TODO') {
- dol_syslog("Tax.lib.php::tax_by_thirdparty", LOG_DEBUG);
- $resql = $db->query($sql);
- if ($resql) {
- $company_id = -1;
- $oldrowid = '';
- while ($assoc = $db->fetch_array($resql)) {
- if (!isset($list[$assoc['company_id']]['totalht'])) {
- $list[$assoc['company_id']]['totalht'] = 0;
- }
- if (!isset($list[$assoc['company_id']]['vat'])) {
- $list[$assoc['company_id']]['vat'] = 0;
- }
- if (!isset($list[$assoc['company_id']]['localtax1'])) {
- $list[$assoc['company_id']]['localtax1'] = 0;
- }
- if (!isset($list[$assoc['company_id']]['localtax2'])) {
- $list[$assoc['company_id']]['localtax2'] = 0;
- }
-
- if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
- $oldrowid = $assoc['rowid'];
- $list[$assoc['company_id']]['totalht'] += (float) $assoc['total_ht'];
- $list[$assoc['company_id']]['vat'] += (float) $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1'] += (float) $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2'] += (float) $assoc['total_localtax2'];
- }
-
- $list[$assoc['company_id']]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
- $list[$assoc['company_id']]['dtype'][] = 'ExpenseReportPayment';
- $list[$assoc['company_id']]['datef'][] = (int) $assoc['datef'];
-
- $list[$assoc['company_id']]['company_name'][] = '';
- $list[$assoc['company_id']]['company_id'][] = 0;
- $list[$assoc['company_id']]['company_alias'][] = '';
- $list[$assoc['company_id']]['company_email'][] = '';
- $list[$assoc['company_id']]['company_tva_intra'][] = '';
- $list[$assoc['company_id']]['company_client'][] = 0;
- $list[$assoc['company_id']]['company_fournisseur'][] = 0;
- $list[$assoc['company_id']]['company_customer_code'][] = '';
- $list[$assoc['company_id']]['company_supplier_code'][] = '';
- $list[$assoc['company_id']]['company_customer_accounting_code'][] = '';
- $list[$assoc['company_id']]['company_supplier_accounting_code'][] = '';
- $list[$assoc['company_id']]['company_status'][] = 0;
-
- $list[$assoc['company_id']]['user_id'][] = (int) $assoc['fk_user_author'];
- $list[$assoc['company_id']]['drate'][] = $assoc['rate'];
- $list[$assoc['company_id']]['ddate_start'][] = $db->jdate($assoc['date_start']);
- $list[$assoc['company_id']]['ddate_end'][] = $db->jdate($assoc['date_end']);
-
- $list[$assoc['company_id']]['facid'][] = (int) $assoc['facid'];
- $list[$assoc['company_id']]['facnum'][] = (string) $assoc['facnum'];
- $list[$assoc['company_id']]['type'][] = (int) $assoc['type'];
- $list[$assoc['company_id']]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
- $list[$assoc['company_id']]['descr'][] = (string) $assoc['descr'];
-
- $list[$assoc['company_id']]['totalht_list'][] = (float) $assoc['total_ht'];
- $list[$assoc['company_id']]['vat_list'][] = (float) $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1_list'][] = (float) $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2_list'][] = (float) $assoc['total_localtax2'];
-
- $list[$assoc['company_id']]['pid'][] = (int) $assoc['pid'];
- $list[$assoc['company_id']]['pref'][] = (string) $assoc['pref'];
- $list[$assoc['company_id']]['ptype'][] = 'ExpenseReportPayment';
-
- $list[$assoc['company_id']]['payment_id'][] = (int) $assoc['payment_id'];
- $list[$assoc['company_id']]['payment_ref'][] = (string) $assoc['payment_ref'];
- $list[$assoc['company_id']]['payment_amount'][] = (float) $assoc['payment_amount'];
-
- $company_id = $assoc['company_id'];
+ dol_syslog("Tax.lib.php::tax_by_thirdparty", LOG_DEBUG);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $company_id = -1;
+ $oldrowid = '';
+ while ($assoc = $db->fetch_array($resql)) {
+ if (!isset($list[$assoc['company_id']]['totalht'])) {
+ $list[$assoc['company_id']]['totalht'] = 0;
}
- } else {
- dol_print_error($db);
- return -3;
+ if (!isset($list[$assoc['company_id']]['vat'])) {
+ $list[$assoc['company_id']]['vat'] = 0;
+ }
+ if (!isset($list[$assoc['company_id']]['localtax1'])) {
+ $list[$assoc['company_id']]['localtax1'] = 0;
+ }
+ if (!isset($list[$assoc['company_id']]['localtax2'])) {
+ $list[$assoc['company_id']]['localtax2'] = 0;
+ }
+
+ if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
+ $oldrowid = $assoc['rowid'];
+ $list[$assoc['company_id']]['totalht'] += (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat'] += (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2'] += (float) $assoc['total_localtax2'];
+ }
+
+ $list[$assoc['company_id']]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
+ $list[$assoc['company_id']]['dtype'][] = 'ExpenseReportPayment';
+ $list[$assoc['company_id']]['datef'][] = (int) $assoc['datef'];
+
+ $list[$assoc['company_id']]['company_name'][] = '';
+ $list[$assoc['company_id']]['company_id'][] = 0;
+ $list[$assoc['company_id']]['company_alias'][] = '';
+ $list[$assoc['company_id']]['company_email'][] = '';
+ $list[$assoc['company_id']]['company_tva_intra'][] = '';
+ $list[$assoc['company_id']]['company_client'][] = 0;
+ $list[$assoc['company_id']]['company_fournisseur'][] = 0;
+ $list[$assoc['company_id']]['company_customer_code'][] = '';
+ $list[$assoc['company_id']]['company_supplier_code'][] = '';
+ $list[$assoc['company_id']]['company_customer_accounting_code'][] = '';
+ $list[$assoc['company_id']]['company_supplier_accounting_code'][] = '';
+ $list[$assoc['company_id']]['company_status'][] = 0;
+
+ $list[$assoc['company_id']]['user_id'][] = (int) $assoc['fk_user_author'];
+ $list[$assoc['company_id']]['drate'][] = $assoc['rate'];
+ $list[$assoc['company_id']]['ddate_start'][] = $db->jdate($assoc['date_start']);
+ $list[$assoc['company_id']]['ddate_end'][] = $db->jdate($assoc['date_end']);
+
+ $list[$assoc['company_id']]['facid'][] = (int) $assoc['facid'];
+ $list[$assoc['company_id']]['facnum'][] = (string) $assoc['facnum'];
+ $list[$assoc['company_id']]['type'][] = (int) $assoc['type'];
+ $list[$assoc['company_id']]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$assoc['company_id']]['descr'][] = (string) $assoc['descr'];
+
+ $list[$assoc['company_id']]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2_list'][] = (float) $assoc['total_localtax2'];
+
+ $list[$assoc['company_id']]['pid'][] = (int) $assoc['pid'];
+ $list[$assoc['company_id']]['pref'][] = (string) $assoc['pref'];
+ $list[$assoc['company_id']]['ptype'][] = 'ExpenseReportPayment';
+
+ $list[$assoc['company_id']]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$assoc['company_id']]['payment_ref'][] = (string) $assoc['payment_ref'];
+ $list[$assoc['company_id']]['payment_amount'][] = (float) $assoc['payment_amount'];
+
+ $company_id = $assoc['company_id'];
}
+ } else {
+ dol_print_error($db);
+ return -3;
}
}
@@ -836,94 +810,85 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
- if (!$sql) {
- return -1;
- }
- if ($sql == 'TODO') {
- return -2;
- }
- if ($sql != 'TODO') {
- dol_syslog("Tax.lib.php::tax_by_rate", LOG_DEBUG);
+ dol_syslog("Tax.lib.php::tax_by_rate", LOG_DEBUG);
- $resql = $db->query($sql);
- if ($resql) {
- $rate = -1;
- $oldrowid = '';
- while ($assoc = $db->fetch_array($resql)) {
- $rate_key = $assoc['rate'];
- if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
- $rate_key .= ' (' . $assoc['vat_src_code'] . ')';
- }
-
- // Code to avoid warnings when array entry not defined
- if (!isset($list[$rate_key]['totalht'])) {
- $list[$rate_key]['totalht'] = 0;
- }
- if (!isset($list[$rate_key]['vat'])) {
- $list[$rate_key]['vat'] = 0;
- }
- if (!isset($list[$rate_key]['localtax1'])) {
- $list[$rate_key]['localtax1'] = 0;
- }
- if (!isset($list[$rate_key]['localtax2'])) {
- $list[$rate_key]['localtax2'] = 0;
- }
-
- if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
- $oldrowid = $assoc['rowid'];
- $list[$rate_key]['totalht'] += (float) $assoc['total_ht'];
- $list[$rate_key]['vat'] += (float) $assoc['total_vat'];
- $list[$rate_key]['localtax1'] += (float) $assoc['total_localtax1'];
- $list[$rate_key]['localtax2'] += (float) $assoc['total_localtax2'];
- }
- $list[$rate_key]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
- $list[$rate_key]['dtype'][] = (int) $assoc['dtype'];
- $list[$rate_key]['datef'][] = $db->jdate($assoc['datef']);
- $list[$rate_key]['datep'][] = $db->jdate($assoc['datep']);
-
- $list[$rate_key]['company_name'][] = (string) $assoc['company_name'];
- $list[$rate_key]['company_id'][] = (int) $assoc['company_id'];
- $list[$rate_key]['company_alias'][] = (string) $assoc['company_alias'];
- $list[$rate_key]['company_email'][] = (string) $assoc['company_email'];
- $list[$rate_key]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
- $list[$rate_key]['company_client'][] = (int) $assoc['company_client'];
- $list[$rate_key]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
- $list[$rate_key]['company_customer_code'][] = (string) $assoc['company_customer_code'];
- $list[$rate_key]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
- $list[$rate_key]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
- $list[$rate_key]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
- $list[$rate_key]['company_status'][] = (int) $assoc['company_status'];
-
- $list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
- $list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
-
- $list[$rate_key]['facid'][] = (int) $assoc['facid'];
- $list[$rate_key]['facnum'][] = (string) $assoc['facnum'];
- $list[$rate_key]['type'][] = (int) $assoc['type'];
- $list[$rate_key]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
- $list[$rate_key]['descr'][] = (string) $assoc['descr'];
-
- $list[$rate_key]['totalht_list'][] = (float) $assoc['total_ht'];
- $list[$rate_key]['vat_list'][] = (float) $assoc['total_vat'];
- $list[$rate_key]['localtax1_list'][] = (float) $assoc['total_localtax1'];
- $list[$rate_key]['localtax2_list'][] = (float) $assoc['total_localtax2'];
-
- $list[$rate_key]['pid'][] = (int) $assoc['pid'];
- $list[$rate_key]['pref'][] = (string) $assoc['pref'];
- $list[$rate_key]['ptype'][] = (int) $assoc['ptype'];
-
- $list[$rate_key]['payment_id'][] = (int) $assoc['payment_id'];
- $list[$rate_key]['payment_ref'][] = (string) $assoc['payment_ref'];
- $list[$rate_key]['payment_amount'][] = (float) $assoc['payment_amount'];
-
- $rate = $assoc['rate'];
+ $resql = $db->query($sql);
+ if ($resql) {
+ $rate = -1;
+ $oldrowid = '';
+ while ($assoc = $db->fetch_array($resql)) {
+ $rate_key = $assoc['rate'];
+ if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
+ $rate_key .= ' (' . $assoc['vat_src_code'] . ')';
}
- } else {
- dol_print_error($db);
- return -3;
- }
- }
+ // Code to avoid warnings when array entry not defined
+ if (!isset($list[$rate_key]['totalht'])) {
+ $list[$rate_key]['totalht'] = 0;
+ }
+ if (!isset($list[$rate_key]['vat'])) {
+ $list[$rate_key]['vat'] = 0;
+ }
+ if (!isset($list[$rate_key]['localtax1'])) {
+ $list[$rate_key]['localtax1'] = 0;
+ }
+ if (!isset($list[$rate_key]['localtax2'])) {
+ $list[$rate_key]['localtax2'] = 0;
+ }
+
+ if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
+ $oldrowid = $assoc['rowid'];
+ $list[$rate_key]['totalht'] += (float) $assoc['total_ht'];
+ $list[$rate_key]['vat'] += (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2'] += (float) $assoc['total_localtax2'];
+ }
+ $list[$rate_key]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
+ $list[$rate_key]['dtype'][] = (int) $assoc['dtype'];
+ $list[$rate_key]['datef'][] = $db->jdate($assoc['datef']);
+ $list[$rate_key]['datep'][] = $db->jdate($assoc['datep']);
+
+ $list[$rate_key]['company_name'][] = (string) $assoc['company_name'];
+ $list[$rate_key]['company_id'][] = (int) $assoc['company_id'];
+ $list[$rate_key]['company_alias'][] = (string) $assoc['company_alias'];
+ $list[$rate_key]['company_email'][] = (string) $assoc['company_email'];
+ $list[$rate_key]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
+ $list[$rate_key]['company_client'][] = (int) $assoc['company_client'];
+ $list[$rate_key]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
+ $list[$rate_key]['company_customer_code'][] = (string) $assoc['company_customer_code'];
+ $list[$rate_key]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
+ $list[$rate_key]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
+ $list[$rate_key]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
+ $list[$rate_key]['company_status'][] = (int) $assoc['company_status'];
+
+ $list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
+ $list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
+
+ $list[$rate_key]['facid'][] = (int) $assoc['facid'];
+ $list[$rate_key]['facnum'][] = (string) $assoc['facnum'];
+ $list[$rate_key]['type'][] = (int) $assoc['type'];
+ $list[$rate_key]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$rate_key]['descr'][] = (string) $assoc['descr'];
+
+ $list[$rate_key]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$rate_key]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2_list'][] = (float) $assoc['total_localtax2'];
+
+ $list[$rate_key]['pid'][] = (int) $assoc['pid'];
+ $list[$rate_key]['pref'][] = (string) $assoc['pref'];
+ $list[$rate_key]['ptype'][] = (int) $assoc['ptype'];
+
+ $list[$rate_key]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$rate_key]['payment_ref'][] = (string) $assoc['payment_ref'];
+ $list[$rate_key]['payment_amount'][] = (float) $assoc['payment_amount'];
+
+ $rate = $assoc['rate'];
+ }
+ } else {
+ dol_print_error($db);
+ return -3;
+ }
// CASE OF SERVICES
@@ -1025,94 +990,84 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
- if (!$sql) {
- dol_syslog("Tax.lib.php::tax_by_rate no accountancy module enabled".$sql, LOG_ERR);
- return -1; // -1 = Not accountancy module enabled
- }
- if ($sql == 'TODO') {
- return -2; // -2 = Feature not yet available
- }
- if ($sql != 'TODO') {
- dol_syslog("Tax.lib.php::tax_by_rate", LOG_DEBUG);
- $resql = $db->query($sql);
- if ($resql) {
- $rate = -1;
- $oldrowid = '';
- while ($assoc = $db->fetch_array($resql)) {
- $rate_key = $assoc['rate'];
- if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
- $rate_key .= ' (' . $assoc['vat_src_code'] . ')';
- }
-
- // Code to avoid warnings when array entry not defined
- if (!isset($list[$rate_key]['totalht'])) {
- $list[$rate_key]['totalht'] = 0;
- }
- if (!isset($list[$rate_key]['vat'])) {
- $list[$rate_key]['vat'] = 0;
- }
- if (!isset($list[$rate_key]['localtax1'])) {
- $list[$rate_key]['localtax1'] = 0;
- }
- if (!isset($list[$rate_key]['localtax2'])) {
- $list[$rate_key]['localtax2'] = 0;
- }
-
- if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
- $oldrowid = $assoc['rowid'];
- $list[$rate_key]['totalht'] += (float) $assoc['total_ht'];
- $list[$rate_key]['vat'] += (float) $assoc['total_vat'];
- $list[$rate_key]['localtax1'] += (float) $assoc['total_localtax1'];
- $list[$rate_key]['localtax2'] += (float) $assoc['total_localtax2'];
- }
- $list[$rate_key]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
- $list[$rate_key]['dtype'][] = (int) $assoc['dtype'];
- $list[$rate_key]['datef'][] = $db->jdate($assoc['datef']);
- $list[$rate_key]['datep'][] = $db->jdate($assoc['datep']);
-
- $list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
- $list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
-
- $list[$rate_key]['company_name'][] = (string) $assoc['company_name'];
- $list[$rate_key]['company_id'][] = (int) $assoc['company_id'];
- $list[$rate_key]['company_alias'][] = (string) $assoc['company_alias'];
- $list[$rate_key]['company_email'][] = (string) $assoc['company_email'];
- $list[$rate_key]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
- $list[$rate_key]['company_client'][] = (int) $assoc['company_client'];
- $list[$rate_key]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
- $list[$rate_key]['company_customer_code'][] = (string) $assoc['company_customer_code'];
- $list[$rate_key]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
- $list[$rate_key]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
- $list[$rate_key]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
- $list[$rate_key]['company_status'][] = (int) $assoc['company_status'];
-
- $list[$rate_key]['facid'][] = (int) $assoc['facid'];
- $list[$rate_key]['facnum'][] = (string) $assoc['facnum'];
- $list[$rate_key]['type'][] = (int) $assoc['type'];
- $list[$rate_key]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
- $list[$rate_key]['descr'][] = (string) $assoc['descr'];
-
- $list[$rate_key]['totalht_list'][] = (float) $assoc['total_ht'];
- $list[$rate_key]['vat_list'][] = (float) $assoc['total_vat'];
- $list[$rate_key]['localtax1_list'][] = (float) $assoc['total_localtax1'];
- $list[$rate_key]['localtax2_list'][] = (float) $assoc['total_localtax2'];
-
- $list[$rate_key]['pid'][] = (int) $assoc['pid'];
- $list[$rate_key]['pref'][] = (string) $assoc['pref'];
- $list[$rate_key]['ptype'][] = (int) $assoc['ptype'];
-
- $list[$rate_key]['payment_id'][] = (int) $assoc['payment_id'];
- $list[$rate_key]['payment_ref'][] = (string) $assoc['payment_ref'];
- $list[$rate_key]['payment_amount'][] = (float) $assoc['payment_amount'];
-
- $rate = $assoc['rate'];
+ dol_syslog("Tax.lib.php::tax_by_rate", LOG_DEBUG);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $rate = -1;
+ $oldrowid = '';
+ while ($assoc = $db->fetch_array($resql)) {
+ $rate_key = $assoc['rate'];
+ if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
+ $rate_key .= ' (' . $assoc['vat_src_code'] . ')';
}
- } else {
- dol_print_error($db);
- return -3;
- }
- }
+ // Code to avoid warnings when array entry not defined
+ if (!isset($list[$rate_key]['totalht'])) {
+ $list[$rate_key]['totalht'] = 0;
+ }
+ if (!isset($list[$rate_key]['vat'])) {
+ $list[$rate_key]['vat'] = 0;
+ }
+ if (!isset($list[$rate_key]['localtax1'])) {
+ $list[$rate_key]['localtax1'] = 0;
+ }
+ if (!isset($list[$rate_key]['localtax2'])) {
+ $list[$rate_key]['localtax2'] = 0;
+ }
+
+ if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
+ $oldrowid = $assoc['rowid'];
+ $list[$rate_key]['totalht'] += (float) $assoc['total_ht'];
+ $list[$rate_key]['vat'] += (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2'] += (float) $assoc['total_localtax2'];
+ }
+ $list[$rate_key]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
+ $list[$rate_key]['dtype'][] = (int) $assoc['dtype'];
+ $list[$rate_key]['datef'][] = $db->jdate($assoc['datef']);
+ $list[$rate_key]['datep'][] = $db->jdate($assoc['datep']);
+
+ $list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
+ $list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
+
+ $list[$rate_key]['company_name'][] = (string) $assoc['company_name'];
+ $list[$rate_key]['company_id'][] = (int) $assoc['company_id'];
+ $list[$rate_key]['company_alias'][] = (string) $assoc['company_alias'];
+ $list[$rate_key]['company_email'][] = (string) $assoc['company_email'];
+ $list[$rate_key]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
+ $list[$rate_key]['company_client'][] = (int) $assoc['company_client'];
+ $list[$rate_key]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
+ $list[$rate_key]['company_customer_code'][] = (string) $assoc['company_customer_code'];
+ $list[$rate_key]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
+ $list[$rate_key]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
+ $list[$rate_key]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
+ $list[$rate_key]['company_status'][] = (int) $assoc['company_status'];
+
+ $list[$rate_key]['facid'][] = (int) $assoc['facid'];
+ $list[$rate_key]['facnum'][] = (string) $assoc['facnum'];
+ $list[$rate_key]['type'][] = (int) $assoc['type'];
+ $list[$rate_key]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$rate_key]['descr'][] = (string) $assoc['descr'];
+
+ $list[$rate_key]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$rate_key]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2_list'][] = (float) $assoc['total_localtax2'];
+
+ $list[$rate_key]['pid'][] = (int) $assoc['pid'];
+ $list[$rate_key]['pref'][] = (string) $assoc['pref'];
+ $list[$rate_key]['ptype'][] = (int) $assoc['ptype'];
+
+ $list[$rate_key]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$rate_key]['payment_ref'][] = (string) $assoc['payment_ref'];
+ $list[$rate_key]['payment_amount'][] = (float) $assoc['payment_amount'];
+
+ $rate = $assoc['rate'];
+ }
+ } else {
+ dol_print_error($db);
+ return -3;
+ }
// CASE OF EXPENSE REPORT
@@ -1152,81 +1107,72 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
}
$sql .= " ORDER BY e.rowid";
- if (!$sql) {
- dol_syslog("Tax.lib.php::tax_by_rate no accountancy module enabled".$sql, LOG_ERR);
- return -1; // -1 = Not accountancy module enabled
- }
- if ($sql == 'TODO') {
- return -2; // -2 = Feature not yet available
- }
- if ($sql != 'TODO') {
- dol_syslog("Tax.lib.php::tax_by_rate", LOG_DEBUG);
- $resql = $db->query($sql);
- if ($resql) {
- $rate = -1;
- $oldrowid = '';
- while ($assoc = $db->fetch_array($resql)) {
- $rate_key = $assoc['rate'];
- if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
- $rate_key .= ' (' . $assoc['vat_src_code'] . ')';
- }
-
- // Code to avoid warnings when array entry not defined
- if (!isset($list[$rate_key]['totalht'])) {
- $list[$rate_key]['totalht'] = 0;
- }
- if (!isset($list[$rate_key]['vat'])) {
- $list[$rate_key]['vat'] = 0;
- }
- if (!isset($list[$rate_key]['localtax1'])) {
- $list[$rate_key]['localtax1'] = 0;
- }
- if (!isset($list[$rate_key]['localtax2'])) {
- $list[$rate_key]['localtax2'] = 0;
- }
-
- if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
- $oldrowid = $assoc['rowid'];
- $list[$rate_key]['totalht'] += (float) $assoc['total_ht'];
- $list[$rate_key]['vat'] += (float) $assoc['total_vat'];
- $list[$rate_key]['localtax1'] += (float) $assoc['total_localtax1'];
- $list[$rate_key]['localtax2'] += (float) $assoc['total_localtax2'];
- }
-
- $list[$rate_key]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
- $list[$rate_key]['dtype'][] = 'ExpenseReportPayment';
- $list[$rate_key]['datef'][] = (int) $assoc['datef'];
- $list[$rate_key]['company_name'][] = '';
- $list[$rate_key]['company_id'][] = 0;
- $list[$rate_key]['user_id'][] = (int) $assoc['fk_user_author'];
- $list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
- $list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
-
- $list[$rate_key]['facid'][] = (int) $assoc['facid'];
- $list[$rate_key]['facnum'][] = (string) $assoc['facnum'];
- $list[$rate_key]['type'][] = (int) $assoc['type'];
- $list[$rate_key]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
- $list[$rate_key]['descr'][] = (string) $assoc['descr'];
-
- $list[$rate_key]['totalht_list'][] = (float) $assoc['total_ht'];
- $list[$rate_key]['vat_list'][] = (float) $assoc['total_vat'];
- $list[$rate_key]['localtax1_list'][] = (float) $assoc['total_localtax1'];
- $list[$rate_key]['localtax2_list'][] = (float) $assoc['total_localtax2'];
-
- $list[$rate_key]['pid'][] = (int) $assoc['pid'];
- $list[$rate_key]['pref'][] = (string) $assoc['pref'];
- $list[$rate_key]['ptype'][] = 'ExpenseReportPayment';
-
- $list[$rate_key]['payment_id'][] = (int) $assoc['payment_id'];
- $list[$rate_key]['payment_ref'][] = (string) $assoc['payment_ref'];
- $list[$rate_key]['payment_amount'][] = (float) $assoc['payment_amount'];
-
- $rate = $assoc['rate'];
+ dol_syslog("Tax.lib.php::tax_by_rate", LOG_DEBUG);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $rate = -1;
+ $oldrowid = '';
+ while ($assoc = $db->fetch_array($resql)) {
+ $rate_key = $assoc['rate'];
+ if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
+ $rate_key .= ' (' . $assoc['vat_src_code'] . ')';
}
- } else {
- dol_print_error($db);
- return -3;
+
+ // Code to avoid warnings when array entry not defined
+ if (!isset($list[$rate_key]['totalht'])) {
+ $list[$rate_key]['totalht'] = 0;
+ }
+ if (!isset($list[$rate_key]['vat'])) {
+ $list[$rate_key]['vat'] = 0;
+ }
+ if (!isset($list[$rate_key]['localtax1'])) {
+ $list[$rate_key]['localtax1'] = 0;
+ }
+ if (!isset($list[$rate_key]['localtax2'])) {
+ $list[$rate_key]['localtax2'] = 0;
+ }
+
+ if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
+ $oldrowid = $assoc['rowid'];
+ $list[$rate_key]['totalht'] += (float) $assoc['total_ht'];
+ $list[$rate_key]['vat'] += (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2'] += (float) $assoc['total_localtax2'];
+ }
+
+ $list[$rate_key]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
+ $list[$rate_key]['dtype'][] = 'ExpenseReportPayment';
+ $list[$rate_key]['datef'][] = (int) $assoc['datef'];
+ $list[$rate_key]['company_name'][] = '';
+ $list[$rate_key]['company_id'][] = 0;
+ $list[$rate_key]['user_id'][] = (int) $assoc['fk_user_author'];
+ $list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
+ $list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
+
+ $list[$rate_key]['facid'][] = (int) $assoc['facid'];
+ $list[$rate_key]['facnum'][] = (string) $assoc['facnum'];
+ $list[$rate_key]['type'][] = (int) $assoc['type'];
+ $list[$rate_key]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$rate_key]['descr'][] = (string) $assoc['descr'];
+
+ $list[$rate_key]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$rate_key]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2_list'][] = (float) $assoc['total_localtax2'];
+
+ $list[$rate_key]['pid'][] = (int) $assoc['pid'];
+ $list[$rate_key]['pref'][] = (string) $assoc['pref'];
+ $list[$rate_key]['ptype'][] = 'ExpenseReportPayment';
+
+ $list[$rate_key]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$rate_key]['payment_ref'][] = (string) $assoc['payment_ref'];
+ $list[$rate_key]['payment_amount'][] = (float) $assoc['payment_amount'];
+
+ $rate = $assoc['rate'];
}
+ } else {
+ dol_print_error($db);
+ return -3;
}
}
diff --git a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php
index e93e8dfee23..a70f99016cf 100644
--- a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php
+++ b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php
@@ -1,8 +1,9 @@
- * Copyright (C) 2005 Regis Houssin
- * Copyright (C) 2015 Francis Appels
- * Copyright (C) 2024 MDW
+/* Copyright (C) 2005-2009 Laurent Destailleur
+ * Copyright (C) 2005 Regis Houssin
+ * Copyright (C) 2015 Francis Appels
+ * Copyright (C) 2024 MDW
+ * Copyright (C) 2025 Frédéric France
*
* 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,6 +44,9 @@ class modTcpdfbarcode extends ModeleBarCode
*/
public $error = '';
+ /**
+ * @var bool Is this barcode 2d or 1d
+ */
public $is2d = false;
/**
diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php
index f221b045f10..42a8c3172e8 100644
--- a/htdocs/core/modules/facture/mod_facture_mars.php
+++ b/htdocs/core/modules/facture/mod_facture_mars.php
@@ -1,9 +1,9 @@
- * Copyright (C) 2005-2018 Regis Houssin
- * Copyright (C) 2013 Juanjo Menent
- * Copyright (C) 2024 Frédéric France
- * Copyright (C) 2024 MDW
+/* Copyright (C) 2005-2008 Laurent Destailleur
+ * Copyright (C) 2005-2018 Regis Houssin
+ * Copyright (C) 2013 Juanjo Menent
+ * Copyright (C) 2024-2025 Frédéric France
+ * Copyright (C) 2024 MDW
*
* 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
@@ -48,12 +48,24 @@ class mod_facture_mars extends ModeleNumRefFactures
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
+ /**
+ * @var string
+ */
public $prefixinvoice = 'FA';
+ /**
+ * @var string
+ */
public $prefixreplacement = 'FR';
+ /**
+ * @var string
+ */
public $prefixdeposit = 'AC';
+ /**
+ * @var string
+ */
public $prefixcreditnote = 'AV';
/**
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index a2447aa5614..9562f292d20 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -820,7 +820,7 @@ while ($i < $imaxinloop) {
} else {
// Show line of result
$j = 0;
- print '';
+ print '
';
// Action column
if ($conf->main_checkbox_left_column) {