Merge branch 'develop' into qual/phan20251209

This commit is contained in:
Laurent Destailleur 2025-12-11 01:24:47 +01:00 committed by GitHub
commit 3dabe3f0c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 161 additions and 152 deletions

View file

@ -7356,24 +7356,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/import/import_csv.modules.php
-
message: '#^Property ModeleImports\:\:\$errors \(array\<string\>\) does not accept array\<array\<string, mixed\>\|string\>\.$#'
identifier: assign.propertyType
count: 3
path: ../../../htdocs/core/modules/import/import_csv.modules.php
-
message: '#^Property ModeleImports\:\:\$errors \(array\<string\>\) does not accept array\<array\<string, string\>\|string\>\.$#'
identifier: assign.propertyType
count: 3
path: ../../../htdocs/core/modules/import/import_csv.modules.php
-
message: '#^Property ModeleImports\:\:\$warnings \(array\<string\>\) does not accept array\<array\<string, mixed\>\|string\>\.$#'
identifier: assign.propertyType
count: 1
path: ../../../htdocs/core/modules/import/import_csv.modules.php
-
message: '#^Variable \$key might not be defined\.$#'
identifier: variable.undefined
@ -7422,24 +7404,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/import/import_xlsx.modules.php
-
message: '#^Property ModeleImports\:\:\$errors \(array\<string\>\) does not accept array\<array\<string, mixed\>\|string\>\.$#'
identifier: assign.propertyType
count: 3
path: ../../../htdocs/core/modules/import/import_xlsx.modules.php
-
message: '#^Property ModeleImports\:\:\$errors \(array\<string\>\) does not accept array\<array\<string, string\>\|string\>\.$#'
identifier: assign.propertyType
count: 3
path: ../../../htdocs/core/modules/import/import_xlsx.modules.php
-
message: '#^Property ModeleImports\:\:\$warnings \(array\<string\>\) does not accept array\<array\<string, mixed\>\|string\>\.$#'
identifier: assign.propertyType
count: 1
path: ../../../htdocs/core/modules/import/import_xlsx.modules.php
-
message: '#^Variable \$where might not be defined\.$#'
identifier: variable.undefined

View file

@ -186,8 +186,8 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
}
*/
$dates = dol_get_first_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') ? GETPOSTINT('monthtoexport') : 1);
$datee = dol_get_last_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') ? GETPOSTINT('monthtoexport') : 12);
$dates = dol_get_first_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') > 0 ? GETPOSTINT('monthtoexport') : 1);
$datee = dol_get_last_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') > 0 ? GETPOSTINT('monthtoexport') : 12);
if ($datee >= dol_now()) {
setEventMessages($langs->trans("ErrorPeriodMustBePastToAllowExport"), null, "errors");
@ -280,7 +280,7 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
$fh = fopen($tmpfile, 'w');
// Print line with title
fwrite($fh, "BEGIN - date=".$yearmonthdateofexport." - period=".$yearmonthtoexport
fwrite($fh, "BEGIN - date=".$yearmonthdateofexport." - period=".$yearmonthtoexport." - format=V1"
.';'.$langs->transnoentities('Id')
.';'.$langs->transnoentities('DateCreation')
.';'.$langs->transnoentities('Action')
@ -295,6 +295,7 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
.';'.$langs->transnoentities('Fingerprint')
.';'.$langs->transnoentities('Status')
.';'.$langs->transnoentities('FingerprintExport')
.';'.$langs->transnoentities('FingerprintFormat')
//.';'.$langs->transnoentities('FingerprintExportHMAC')
."\n");
@ -307,14 +308,13 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
$block_static->id = $obj->rowid;
$block_static->entity = $obj->entity;
$block_static->date_creation = $db->jdate($obj->date_creation); // TODO Use gmt
$block_static->date_creation = $db->jdate($obj->date_creation); // jdate(date_creation) is UTC
$block_static->amounts = (float) $obj->amounts; // Database store value with 8 digits, we cut ending 0 them with (flow)
$block_static->vat = $obj->vat;
$block_static->action = $obj->action;
$block_static->date_object = $db->jdate($obj->date_object); // TODO Use gmt ?
$block_static->date_object = $db->jdate($obj->date_object); // jdate(date_object) is UTC
$block_static->ref_object = $obj->ref_object;
$block_static->user_fullname = $obj->user_fullname;
@ -341,7 +341,7 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
$block_static->debuginfo = $obj->debuginfo;
//var_dump($block->id.' '.$block->signature, $block->object_data);
$checksignature = $block_static->checkSignature($previoushash); // If $previoushash is not defined, checkSignature will search it
$checksignature = $block_static->checkSignature($previoushash); // If $previoushash is not defined, checkSignature will search it
if ($checksignature) {
$statusofrecord = 'Valid';
@ -360,8 +360,11 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
$statusofrecordnote = $langs->trans("PreviousFingerprint").': '.$previoushash.($statusofrecordnote ? ' - '.$statusofrecordnote : '');
}
$signatureexport = 'TODO';
$signatureexporthmac = 'TODO';
$concatenateddata = $block_static->buildKeyForSignature();
// Version archive V1=sha256
$signatureexport = dol_hash($previoushash.$concatenateddata, 'sha256'); // SHA256
//$signatureexporthmac = 'TODO';
fwrite($fh,
';'.$block_static->id
@ -377,7 +380,8 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
.';"'.str_replace('"', '""', $block_static->object_version).'";"'
.str_replace('"', '""', $block_static->signature).'";"'
.str_replace('"', '""', $statusofrecord).'";"'
.str_replace('"', '""', $signatureexport).'";'
.str_replace('"', '""', $signatureexport).'";"'
.str_replace('"', '""', $block_static->object_format).'";'
//.str_replace('"', '""', $signatureexporthmac).'"'
//.';'.$statusofrecordnote
."\n");

View file

@ -64,7 +64,7 @@ $search_startday = GETPOSTINT('search_startday');
$search_endyear = GETPOSTINT('search_endyear');
$search_endmonth = GETPOSTINT('search_endmonth');
$search_endday = GETPOSTINT('search_endday');
$search_id = GETPOST('search_id', 'alpha');
$search_id = GETPOST('search_id', 'alpha'); // Can be a USF search string
$search_fk_user = GETPOST('search_fk_user', 'intcomma');
$search_start = -1;
if (GETPOST('search_startyear') != '') {
@ -384,7 +384,7 @@ $help_url = "EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Ina
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-blockedlog page-admin_blockedlog_list');
$blocks = $block_static->getLog('all', (int) $search_id, $MAXLINES, $sortfield, $sortorder, (int) $search_fk_user, $search_start, $search_end, $search_ref, $search_amount, $search_code, $search_signature);
$blocks = $block_static->getLog('all', (string) $search_id, $MAXLINES, $sortfield, $sortorder, (int) $search_fk_user, $search_start, $search_end, $search_ref, $search_amount, $search_code, $search_signature);
if (!is_array($blocks)) {
if ($blocks == -2) {
setEventMessages($langs->trans("TooManyRecordToScanRestrictFilters", $MAXLINES), null, 'errors');

View file

@ -980,15 +980,15 @@ class BlockedLog
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->date_creation = $this->db->jdate($obj->date_creation); // TODO Use gmt ?
$this->date_modification = $this->db->jdate($obj->tms); // TODO Use gmt ?
$this->date_creation = $this->db->jdate($obj->date_creation); // jdate(date_creation)is UTC
$this->date_modification = $this->db->jdate($obj->tms); // jdate(tms) is UTC
$this->amounts = (float) $obj->amounts;
$this->action = $obj->action;
$this->element = $obj->element;
$this->fk_object = $obj->fk_object;
$this->date_object = $this->db->jdate($obj->date_object); // TODO Use gmt ?
$this->date_object = $this->db->jdate($obj->date_object); // jdate(date_object) is UTC
$this->ref_object = $obj->ref_object;
$this->fk_user = $obj->fk_user;
@ -1132,9 +1132,9 @@ class BlockedLog
try {
$previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done and transaction closed
$concatenatedata = $this->buildKeyForSignature(); // All the information for the hash (meta data + data saved)
$concatenateddata = $this->buildKeyForSignature(); // All the information for the hash (meta data + data saved)
$this->signature = $this->buildFinalSignatureHash($previoushash.$concatenatedata); // Build the hmac signature
$this->signature = $this->buildFinalSignatureHash($previoushash.$concatenateddata); // Build the hmac signature
// For debug:
$this->debuginfo = $this->buildFirstPartOfKeyForSignature(); // Not used
@ -1150,7 +1150,7 @@ class BlockedLog
if ($forcesignature) {
$this->signature = $forcesignature;
}
//var_dump($concatenatedata);var_dump($previoushash);var_dump($this->signature);
//var_dump($concatenateddata);var_dump($previoushash);var_dump($this->signature);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."blockedlog (";
$sql .= " date_creation,";
@ -1232,15 +1232,15 @@ class BlockedLog
$previoushash = $this->getPreviousHash(0, $this->id);
}
$concatenatedata = '';
$concatenateddata = '';
$signature = '';
// Recalculate the signature
try {
// Build the string for the signature
$concatenatedata = $this->buildKeyForSignature();
$concatenateddata = $this->buildKeyForSignature();
$signature = $this->buildFinalSignatureHash($previoushash.$concatenatedata);
$signature = $this->buildFinalSignatureHash($previoushash.$concatenateddata);
} catch (Exception $e) {
$res = ($signature === $this->signature);
$this->error = $e->getMessage();
@ -1262,13 +1262,13 @@ class BlockedLog
if ($returnarray) {
if ($returnarray == 1) {
unset($concatenatedata);
unset($concatenateddata);
return array('checkresult' => $res, 'calculatedsignature' => $signature, 'previoushash' => $previoushash);
} else { // Consume much memory ($concatenatedata is a large var)
return array('checkresult' => $res, 'calculatedsignature' => $signature, 'previoushash' => $previoushash, 'keyforsignature' => $concatenatedata);
} else { // Consume much memory ($concatenateddata is a large var)
return array('checkresult' => $res, 'calculatedsignature' => $signature, 'previoushash' => $previoushash, 'keyforsignature' => $concatenateddata);
}
} else {
unset($concatenatedata);
unset($concatenateddata);
return $res;
}
}
@ -1299,12 +1299,10 @@ class BlockedLog
/**
* Return the string for signature (clear data).
* Note: rowid of line not included as it is not a business data and this allow to make backup of a year
* and restore it into another database with different ids without comprimising checksums
*
* @return string Key for signature
*/
private function buildKeyForSignature()
public function buildKeyForSignature()
{
//print_r($this->object_data);
if ($this->object_format == '') {
@ -1415,7 +1413,7 @@ class BlockedLog
* Return array of log objects (with criteria)
*
* @param string $element Element to search
* @param int $fk_object Id of object to search
* @param string|int $fk_object Id of object to search. Can be a UFS search criteria.
* @param int<0,max> $limit Max number of element, 0 for all
* @param string $sortfield Sort field
* @param string $sortorder Sort order

View file

@ -36,6 +36,13 @@
*/
require '../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
@ -55,14 +62,6 @@ if (isModEnabled('category')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Load translation files required by the page
$langs->loadLangs(array("categories", "orders", 'sendings', 'companies', 'compta', 'bills', 'stocks', 'products'));
@ -156,10 +155,10 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
$sortfield = 'pr.ref';
$sortfield = 'c.ref';
}
if (!$sortorder) {
$sortorder = 'ASC';
$sortorder = 'DESC';
}
$show_shippable_command = GETPOST('show_shippable_command', 'aZ09');

View file

@ -3,7 +3,7 @@
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -140,7 +140,7 @@ class box_members_last_subscriptions extends ModeleBoxes
'asis' => 1,
);
$daterange = get_date_range($this->db->jdate($obj->date_start), $this->db->jdate($obj->date_end), '', null, 0);
$daterange = get_date_range($this->db->jdate($obj->date_start), $this->db->jdate($obj->date_end), '', $langs, 0);
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone" title="'.dol_escape_htmltag($daterange).'"',
'text' => '<span class="opacitymedium small">'.$daterange.'</span>',

View file

@ -824,9 +824,9 @@ class Translate
/**
* Return translation of a key depending on country
*
* @param string $str string root to translate
* @param string $countrycode country code (FR, ...)
* @return string translated string
* @param string $str String root to translate. Example 'TotalHT', 'AmountLT1', 'ProfId1', 'ProfId2', 'LocalTax1IsUsedExample', ...
* @param string $countrycode Country code (FR, ...)
* @return string Translated string
* @see transcountrynoentities(), picto_from_langcode()
*/
public function transcountry($str, $countrycode)

View file

@ -6583,7 +6583,7 @@ function img_allow($allow, $titlealt = 'default')
* @param string $morecss More CSS
* @return string Return img tag
*/
function img_credit_card($brand, $morecss = null)
function img_credit_card($brand, $morecss = 'fa-2x inline-block valignmiddle')
{
if (is_null($morecss)) {
$morecss = 'fa-2x';
@ -9385,8 +9385,10 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
* @return string Translated string for the key
*/
function ($m) {
return '__BRACKETSTART' . $m[1] . 'BRACKETEND__'; },
$out);
return '__BRACKETSTART' . $m[1] . 'BRACKETEND__';
},
$out
);
$dom->loadHTML($out, LIBXML_HTML_NODEFDTD | LIBXML_ERR_NONE | LIBXML_HTML_NOIMPLIED | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_NOERROR | LIBXML_NOXMLDECL);
@ -9402,8 +9404,10 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
* @return string Translated string for the key
*/
function ($m) {
return '__[' . $m[1] . ']__'; },
$out);
return '__[' . $m[1] . ']__';
},
$out
);
// Remove the trick added to solve pb with text in utf8 and text without parent tag
//$out = preg_replace('/^'.preg_quote('<?xml encoding="UTF-8">', '/').'/', '', $out);
@ -10973,8 +10977,8 @@ function print_date_range($date_start, $date_end, $format = '', $outputlangs = n
* @param int $date_start Start date
* @param int $date_end End date
* @param string $format Output date format ('day', 'dayhour', ...)
* @param Translate $outputlangs Output language
* @param integer $withparenthesis 1=Add space and parenthesis, 0=no parenthesis, 2=Add parenthesis
* @param ?Translate $outputlangs Output language
* @param int<0,2> $withparenthesis 1=Add space and parenthesis, 0=no parenthesis, 2=Add parenthesis
* @return string String
*/
function get_date_range($date_start, $date_end, $format = '', $outputlangs = null, $withparenthesis = 1)

View file

@ -2,7 +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>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -244,12 +244,12 @@ class MenuManager
// Start a new ul level 1
$level = 1;
print str_pad('', $level).'<ul class="ullevel1">'."\n";
print str_repeat(' ', $level).'<ul class="ullevel1">'."\n";
// Do we have to add an extra entry that is not into menu array ?
if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools')))
|| (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) {
print str_pad('', $level).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print str_repeat(' ', $level).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print '<a href="'.$relurl.'">';
if ($val['level'] == 0) {
@ -291,7 +291,7 @@ class MenuManager
$newlinelevel = ($val2['level'] + 1);
if ($newlinelevel > $lastlinelevel) {
print str_pad('', $newlinelevel).'<ul class="ullevel'.$newlinelevel.'" xx>'."\n";
print str_repeat(' ', $newlinelevel).'<ul class="ullevel'.$newlinelevel.'" xx>'."\n";
}
$lastlinelevel = ($val2['level'] + 1);
@ -331,7 +331,7 @@ class MenuManager
// Show entry li level $val2['level']+1
// @phan-suppress-next-line PhanParamSuspiciousOrder
print str_pad('', ($val2['level'] + 1));
print str_repeat(' ', ($val2['level'] + 1));
print '<li class="lilevel'.($val2['level'] + 1);
if ($val2['level'] == 0) {
print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
@ -359,7 +359,7 @@ class MenuManager
if ($val2['level'] == 0 && !empty($val2['prefix'])) {
print $val2['prefix']; // the picto must have class="pictofixedwidth paddingright"
} else {
print '<i class="fa fa-does-not-exists fa-fw paddingright pictofixedwidth level'.($val2['level']+1).'"></i>';
print '<i class="fa fa-does-not-exists fa-fw paddingright pictofixedwidth level'.($val2['level'] + 1).'"></i>';
}
print $val2['titre'];
@ -379,8 +379,8 @@ class MenuManager
print '</li>'."\n";
$fromcursor = 0;
while ($fromcursor < ($currentlevel - $nextlevel)) {
print str_pad('', $currentlevel - $fromcursor).'</ul>'."\n";
print str_pad('', $currentlevel - $fromcursor - 1).'</li>'."\n"; // end level $val2['level']+1
print str_repeat(' ', $currentlevel - $fromcursor).'</ul>'."\n";
print str_repeat(' ', $currentlevel - $fromcursor - 1).'</li>'."\n"; // end level $val2['level']+1
$fromcursor++;
}
} else {
@ -389,8 +389,8 @@ class MenuManager
}
}
print str_pad('', $level).'</ul>'."\n"; // end ul level 1
print str_pad('', $level - 1).'</li>'."\n"; // end ul level 1
print str_repeat(' ', $level).'</ul>'."\n"; // end ul level 1
print str_repeat(' ', $level - 1).'</li>'."\n"; // end ul level 1
} elseif ($val['enabled'] == 2) {
print '<li class="lilevel0">';

View file

@ -1,7 +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>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -246,12 +246,12 @@ class MenuManager
// Start a new ul level 1
$level = 1;
print str_pad('', $level).'<ul class="ullevel1">'."\n";
print str_repeat(' ', $level).'<ul class="ullevel1">'."\n";
// Do we have to add an extra entry that is not into menu array ?
if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools')))
|| (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) {
print str_pad('', $level).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print str_repeat(' ', $level).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print '<a href="'.$relurl.'">';
if ($val['level'] == 0) {
@ -283,7 +283,7 @@ class MenuManager
$newlinelevel = ($val2['level'] + 1);
if ($newlinelevel > $lastlinelevel) {
print str_pad('', $newlinelevel).'<ul class="ullevel'.$newlinelevel.'" xx>'."\n";
print str_repeat(' ', $newlinelevel).'<ul class="ullevel'.$newlinelevel.'" xx>'."\n";
}
$lastlinelevel = ($val2['level'] + 1);
@ -322,7 +322,7 @@ class MenuManager
// Show entry li level $val2['level']+1
// @phan-suppress-next-line PhanParamSuspiciousOrder
print str_pad('', ($val2['level'] + 1));
print str_repeat(' ', ($val2['level'] + 1));
print '<li class="lilevel'.($val2['level'] + 1);
if ($val2['level'] == 0) {
print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
@ -351,7 +351,7 @@ class MenuManager
if ($val2['level'] == 0 && !empty($val2['prefix'])) {
print $val2['prefix']; // the picto must have class="pictofixedwidth paddingright"
} else {
print '<i class="fa fa-does-not-exists fa-fw paddingright pictofixedwidth level'.($val2['level']+1).'"></i>';
print '<i class="fa fa-does-not-exists fa-fw paddingright pictofixedwidth level'.($val2['level'] + 1).'"></i>';
}
print $val2['titre'];
@ -370,8 +370,8 @@ class MenuManager
print '</li>'."\n";
$fromcursor = 0;
while ($fromcursor < ($currentlevel - $nextlevel)) {
print str_pad('', $currentlevel - $fromcursor).'</ul>'."\n";
print str_pad('', $currentlevel - $fromcursor - 1).'</li>'."\n"; // end level $val2['level']+1
print str_repeat(' ', $currentlevel - $fromcursor).'</ul>'."\n";
print str_repeat(' ', $currentlevel - $fromcursor - 1).'</li>'."\n"; // end level $val2['level']+1
$fromcursor++;
}
} else {
@ -381,8 +381,8 @@ class MenuManager
//var_dump($submenu);
}
print str_pad('', $level).'</ul>'."\n"; // end ul level 1
print str_pad('', $level - 1).'</li>'."\n"; // end ul level 1
print str_repeat(' ', $level).'</ul>'."\n"; // end ul level 1
print str_repeat(' ', $level - 1).'</li>'."\n"; // end ul level 1
} elseif ($val['enabled'] == 2) {
print '<li class="lilevel0">';

View file

@ -414,7 +414,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$widget[$j]['relpath'] = $relpath[$key];
$widget[$j]['iscoreorexternal'] = $iscoreorexternal[$key];
$widget[$j]['version'] = empty($objMod->version) ? '' : $objMod->version;
$widget[$j]['status'] = img_picto($langs->trans("Active"), 'tick');
$widget[$j]['status'] = img_picto($langs->trans("Active"), 'tick', 'class="pictofixedwidth"');
if ($disabledbyname > 0 || $disabledbymodule > 1) {
$widget[$j]['status'] = '';
}

View file

@ -93,14 +93,17 @@ class mailing_partnership extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."c_partnership_type as pt";
$sql .= " WHERE s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing = ".((int) $mailing_id).")";
$sql .= " AND p.fk_soc = s.rowid";
$sql .= " AND pt.rowid = p.fk_type";
if (GETPOSTINT('countryid') > 0) {
$sql .= " AND s.fk_pays = ".((int) GETPOSTINT('countryid'));
}
if (GETPOSTINT('filter') > 0) {
$sql .= " AND pt.rowid=".(GETPOSTINT('filter'));
$sql .= " AND pt.rowid = ".((int) GETPOSTINT('filter'));
}
if (GETPOSTISSET('filter_status_partnership') && GETPOSTINT('filter_status_partnership') >= 0) {
$sql .= " AND p.status = ".GETPOSTINT('filter_status_partnership');
$sql .= " AND p.status = ".((int) GETPOSTINT('filter_status_partnership'));
}
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
@ -112,14 +115,17 @@ class mailing_partnership extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as s, ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."c_partnership_type as pt";
$sql .= " WHERE s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('member').")";
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing = ".((int) $mailing_id).")";
$sql .= " AND p.fk_member = s.rowid";
$sql .= " AND pt.rowid = p.fk_type";
if (GETPOSTINT('countryid') > 0) {
$sql .= " AND s.country = ".((int) GETPOSTINT('countryid'));
}
if (GETPOSTINT('filter') > 0) {
$sql .= " AND pt.rowid=".(GETPOSTINT('filter'));
$sql .= " AND pt.rowid=".((int) GETPOSTINT('filter'));
}
if (GETPOSTISSET('filter_status_partnership') && GETPOSTINT('filter_status_partnership') >= 0) {
$sql .= " AND p.status = ".GETPOSTINT('filter_status_partnership');
$sql .= " AND p.status = ".((int) GETPOSTINT('filter_status_partnership'));
}
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
@ -237,13 +243,14 @@ class mailing_partnership extends MailingTargets
$langs->load("companies");
// Add filter on partnership type
$s = '<select id="filter_partnership" name="filter" class="flat">';
// Show type of partnership
// Get all types of partnership
$sql = "SELECT rowid, label, code, active";
$sql .= " FROM ".MAIN_DB_PREFIX."c_partnership_type";
$sql .= " WHERE active = 1";
$sql .= " AND entity = ".$conf->entity;
$sql .= " AND entity = ".((int) $conf->entity);
$sql .= " ORDER BY label";
//print $sql;
@ -251,8 +258,8 @@ class mailing_partnership extends MailingTargets
if ($resql) {
$num = $this->db->num_rows($resql);
if (empty($conf->partnership->enabled)) {
$num = 0; // Force empty list if category module is not enabled
if (!isModEnabled("partnership")) {
$num = 0; // Force empty list if module is not enabled
}
if ($num) {
@ -263,7 +270,7 @@ class mailing_partnership extends MailingTargets
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$s .= '<option value="'.$obj->rowid.'">'.dol_escape_htmltag($obj->label);
$s .= '<option value="'.$obj->rowid.'"'.($obj->rowid == GETPOST('filter') ? "selected" : "").'>'.dol_escape_htmltag($obj->label);
$s .= '</option>';
$i++;
}
@ -274,13 +281,17 @@ class mailing_partnership extends MailingTargets
$s .= '</select> ';
// filter_status_thirdparties
// Add filter on thirdparties status
include_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
$tmppartnership = new Partnership($this->db);
$dummy = $tmppartnership->getLibStatut(0); // We call this only to have $tmppartnership->labelStatus loaded
$s .= $form->selectarray('filter_status_partnership', $tmppartnership->labelStatus, GETPOST('filter_status_partnership'), $langs->trans("Status"));
// Add filter on country
$s .= $form->select_country(GETPOST('countryid'), 'countryid', '', 0, 'minwidth150 maxwidth200', '', $langs->trans("Country"), 0, 0, array(), 0, 0);
return $s;
}

View file

@ -54,11 +54,6 @@ class mailing_thirdparties_services_expired extends MailingTargets
*/
public $picto = 'company';
/**
* @var array<int,string>
*/
public $arrayofproducts = array();
/**
* Constructor
@ -67,14 +62,13 @@ class mailing_thirdparties_services_expired extends MailingTargets
*/
public function __construct($db)
{
global $conf;
$this->db = $db;
/*
$this->arrayofproducts = array();
// List of services
$sql = "SELECT ref FROM ".MAIN_DB_PREFIX."product";
$sql = "SELECT id, ref FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")";
if (!getDolGlobalString('CONTRACT_SUPPORT_PRODUCTS')) {
$sql .= " AND fk_product_type = 1"; // By default, only services
@ -89,11 +83,12 @@ class mailing_thirdparties_services_expired extends MailingTargets
while ($i < $num) {
$obj = $this->db->fetch_object($result);
$i++;
$this->arrayofproducts[$i] = $obj->ref;
$this->arrayofproducts[$obj->id] = $obj->ref;
}
} else {
dol_print_error($this->db);
}
*/
}
@ -106,40 +101,37 @@ class mailing_thirdparties_services_expired extends MailingTargets
*/
public function add_to_target($mailing_id)
{
global $conf;
global $conf, $langs;
// phpcs:enable
$key = GETPOSTINT('filter');
$productid = GETPOSTINT('productid');
$cibles = array();
$j = 0;
$product = '';
if ($key == '0') {
$this->error = "Error: You must choose a filter";
if ($productid <= 0) {
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProductOrService"));
$this->errors[] = $this->error;
return -1;
}
$product = $this->arrayofproducts[$key];
$now = dol_now();
// La requete doit retourner: id, email, name
// Request must return: id, email, name
$sql = "SELECT s.rowid as id, s.email, s.nom as name, cd.rowid as cdid, cd.date_ouverture as date_start_real, cd.date_fin_validite as date_end, cd.fk_contrat";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing = ".((int) $mailing_id).")";
$sql .= " AND s.rowid = c.fk_soc AND cd.fk_contrat = c.rowid AND s.email != ''";
$sql .= " AND cd.statut= 4 AND cd.fk_product=p.rowid AND p.ref = '".$this->db->escape($product)."'";
$sql .= " AND cd.statut= 4 AND cd.fk_product = p.rowid AND p.rowid = ".((int) $productid);
$sql .= " AND cd.date_fin_validite < '".$this->db->idate($now)."'";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
$sql .= " ORDER BY s.email";
// Stocke destinataires dans cibles
// Save target emails
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
@ -153,8 +145,8 @@ class mailing_thirdparties_services_expired extends MailingTargets
if ($old != $obj->email) {
$cibles[$j] = array(
'email' => $obj->email,
'lastname' => $obj->name, // For thirdparties, lastname must be name
'firstname' => '', // For thirdparties, firstname is ''
'lastname' => $obj->name, // For thirdparties, lastname must be name
'firstname' => '', // For thirdparties, firstname is ''
'other' =>
('DateStart='.dol_print_date($this->db->jdate($obj->date_start_real), 'day')).';'. // date start real
('DateEnd='.dol_print_date($this->db->jdate($obj->date_end), 'day')).';'. // date end planned
@ -217,12 +209,14 @@ class mailing_thirdparties_services_expired extends MailingTargets
// Example: return parent::getNbOfRecipients("SELECT count(*) as nb from dolibarr_table");
// Example: return 500;
$sql = "SELECT count(*) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c,";
$sql .= " ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
$sql .= " AND s.rowid = c.fk_soc AND cd.fk_contrat = c.rowid AND s.email != ''";
$sql .= " AND cd.statut= 4 AND cd.fk_product=p.rowid";
$sql .= " AND p.ref IN (".$this->db->sanitize("'".implode("','", $this->arrayofproducts)."'", 1).")";
$sql .= " AND cd.statut= 4 AND cd.fk_product = p.rowid";
if (!getDolGlobalString('CONTRACT_SUPPORT_PRODUCTS')) {
$sql .= " AND p.fk_product_type = 1"; // By default, only services
}
$sql .= " AND cd.date_fin_validite < '".$this->db->idate($now)."'";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
@ -241,9 +235,20 @@ class mailing_thirdparties_services_expired extends MailingTargets
*/
public function formFilter()
{
global $langs;
global $form, $langs, $user;
$s = img_picto('', 'product', 'class="pictofixedwidth"').'<select id="filter_services_expired" name="filter" class="flat">';
$socid = 0;
if (!empty($user->socid)) {
$socid = $user->socid;
}
$filtertype = (getDolGlobalString('CONTRACT_SUPPORT_PRODUCTS') ? '' : 1); // '' in select_produits means all, 1 means services only
$showempty = $langs->trans("ProductOrService");
$s = img_picto('', 'product', 'class="pictofixedwidth"');
$s .= $form->select_produits(GETPOSTINT('productid'), 'productid', $filtertype, 0, 0, -1, 2, '', 0, array(), $socid, $showempty, 0, '', 0, '', null, 1);
/*
.'<select id="filter_services_expired" name="filter" class="flat">';
if (count($this->arrayofproducts)) {
$langs->loadLangs(array("products"));
$s .= '<option value="-1">'.$langs->trans("ProductOrService").'</option>';
@ -255,6 +260,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
}
$s .= '</select>';
$s .= ajax_combobox("filter_services_expired");
*/
return $s;
}

View file

@ -104,7 +104,10 @@ if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_
//print '<script>$(document).ready(function() { $(".clickvatforalllines").click(function() { jQuery(".classvatforalllines").toggle(); }); });</script>';
if (GETPOST('mode', 'aZ09') == 'vatforalllines') {
print '<div class="classvatforalllines inline-block nowraponall">';
print $form->load_tva('vatforalllines', '', $mysoc, $object->thirdparty, 0, 0, '', false, 1);
$societe_vendeuse = strpos($object->element, 'supplier') === false ? $mysoc : $object->thirdparty;
$societe_acheteuse = strpos($object->element, 'supplier') === false ? $object->thirdparty : $mysoc;
$vat_mode = strpos($object->element, 'supplier') === false ? 1 : 2;
print $form->load_tva('vatforalllines', '', $societe_vendeuse, $societe_acheteuse, 0, 0, '', false, 1, $vat_mode);
print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforalllines" value="'.$langs->trans("Update").'">';
print '</div>';
}

View file

@ -2356,11 +2356,11 @@ class ExpenseReport extends CommonObject
* deleteline
*
* @param int $rowid Row id
* @param User|string $fuser User
* @param ?User $fuser User
* @param int<0,1> $notrigger 1=No trigger
* @return int<-1,1> Return integer <0 if KO, >0 if OK
*/
public function deleteLine($rowid, $fuser = '', $notrigger = 0)
public function deleteLine($rowid, $fuser = null, $notrigger = 0)
{
$error = 0;

View file

@ -138,6 +138,7 @@ $usercancreatecontract = $user->hasRight("contrat", "creer");
// Advanced permissions
$usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight("fournisseur", "supplier_invoice_advance", "validate")));
$usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight("fournisseur", "supplier_invoice_advance", "send"));
$usercancreatecreditransfer = $user->hasRight('paymentbybanktransfer', 'create');
// Permissions for includes
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
@ -4221,6 +4222,24 @@ if ($action == 'create') {
}
}
// Request a direct debit order
if ($object->status > FactureFournisseur::STATUS_DRAFT && $object->paid == 0) {
$langs->load("withdrawals");
if ($resteapayer > 0) {
if ($usercancreatecreditransfer) {
if (!$objectidnext && $object->close_code != 'replaced') { // Not replaced by another invoice
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'&type=bank-transfer" title="'.dol_escape_htmltag($langs->trans("MakeBankTransferOrder")).'">'.$langs->trans("MakeBankTransferOrder").'</a>';
} else {
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('MakeBankTransferOrder').'</span>';
}
} else {
//print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
}
} else {
//print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
}
}
// Create payment
if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->status == FactureFournisseur::STATUS_VALIDATED && $object->paid == 0) {
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.DOL_URL_ROOT.'/fourn/facture/paiement.php?facid='.$object->id.'&action=create'.($object->fk_account > 0 ? '&amp;accountid='.$object->fk_account : '').'">'.$langs->trans('DoPayment').'</a>'; // must use facid because id is for payment id not invoice

View file

@ -186,7 +186,7 @@ ACCOUNTING_RESULT_LOSS=Ergebnisabrechnungskonto (Verlust)
ACCOUNTING_CLOSURE_DEFAULT_JOURNAL=Journal für Abschlussbuchungen
ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT=Kontengruppen, die zur Berechnung der Bilanz verwendet werden
ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNTHelp=Legen Sie hier die Liste der Kontengruppen (definiert im Kontenplan) fest, die verwendet werden müssen, um alle Konten zur Berechnung der Bilanz zu finden. Trennen Sie die einzelnen Werte durch Kommas.<br>Beispiel: CAPIT,IMMOSTOCK,FINAN,THIRDPARTY
ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT=Kontenruppen, die zur Berechnung der Gewinn- und Verlustrechnung verwendet werden
ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT=Kontengruppen, die zur Berechnung der Gewinn- und Verlustrechnung verwendet werden
ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENTHelp=Legen Sie hier die Liste der Kontengruppen (definiert im Kontenplan) fest, die verwendet werden müssen, um alle Konten zu finden um die Gewinn- und Verlustrechnung zu berechnen. Trennen Sie die einzelnen Werte durch Kommas.<br>Beispiel: ERLÖSE,AUFWENDUNGEN
ACCOUNTING_ACCOUNT_TRANSFER_CASH=Konto (aus dem Kontenplan), das als Verrechnungskonto/Transferkonto für Banküberweisungen verwendet werden soll
TransitionalAccount=Überweisungskonto

View file

@ -25,6 +25,7 @@ ListOfTrackedEvents=List of tracked events
Fingerprint=Fingerprint
FingerprintExport=Fingerprint export
FingerprintExportHMAC=Fingerprint export HMAC
FingerprintFormat=Fingerprint format
DownloadLogCSV=Export unalterable logs (CSV)
DataOfArchivedEvent=Complete data of archived event
DataOfArchivedEventHelp=This field contains the complementary data that was archived on real time. Even if some parent business event could have been canceled or modified, the data stored here is the original data, and it can't be modified.