Merge branch 'develop' into 24_Quadra

This commit is contained in:
Alexandre SPANGARO 2025-12-22 12:01:11 +01:00
commit e8d573cf33
84 changed files with 473 additions and 542 deletions

View file

@ -284,11 +284,12 @@ repos:
(dev/build/perl/virtualmin/dolibarr.pl
)$
args: [ --tabs, --nola ]
- repo: https://github.com/henryykt/pre-commit-perl
rev: v0.0.5
hooks:
- id: perlcritic
# virtualmin excuded - reason https://github.com/Dolibarr/dolibarr/pull/36370#issuecomment-3565101823
exclude: (?x)^
(dev/build/perl/virtualmin/dolibarr.pl
)$
#- repo: https://github.com/henryykt/pre-commit-perl
# rev: v0.0.5
# hooks:
# - id: perlcritic
# # virtualmin excluded - reason https://github.com/Dolibarr/dolibarr/pull/36370#issuecomment-3565101823
# exclude: (?x)^
# (dev/build/perl/virtualmin/dolibarr.pl
# )$

View file

@ -535,9 +535,9 @@ script:
echo
- |
echo Show some debug info like table content or log
#echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
cat $TRAVIS_BUILD_DIR/upgrade18001900.log
echo Show some debug info, like table content, or migration log from some versions
echo '\d llx_blockedlog' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
cat $TRAVIS_BUILD_DIR/upgrade500600.log
cat $TRAVIS_BUILD_DIR/upgrade19002000.log
echo
@ -557,6 +557,7 @@ script:
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KnowledgeManagement,MAIN_MODULE_EventOrganization,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_EmailCollector >> $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_BlockedLog >> $TRAVIS_BUILD_DIR/enablemodule.log
echo $?
cd -
set +e

View file

@ -7,3 +7,4 @@
/dolibarr-*.zip
/*.exe
/html
/makepack-dolibarr.pl.bak

View file

@ -40,6 +40,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
define('DOL_DOCUMENT_ROOT', dirname(dirname($path)).'/htdocs');
$algo = 'sha256';
require_once $path."../../htdocs/master.inc.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
@ -231,7 +233,7 @@ if ($release) {
$gitcommit = trim($fileforgitcontent);
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'" gitcommit="'.$gitcommit.'">'."\n");
fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'" algo="'.$algo.'" gitcommit="'.$gitcommit.'">'."\n");
foreach ($includeconstants as $countrycode => $tmp) {
fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n");
@ -265,9 +267,9 @@ if ($release) {
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
$hashoffile = hash_file($algo, $file);
$checksumconcat[] = $hashoffile;
fputs($fp, ' <'.$algo.'file name="'.basename($file).'" size="'.filesize($file).'">'.$hashoffile.'</'.$algo.'file>'."\n");
}
}
if ($needtoclose) {
@ -277,10 +279,10 @@ if ($release) {
fputs($fp, '</dolibarr_htdocs_dir>'."\n");
asort($checksumconcat); // Sort list of checksum
$md5htdocsdir = md5(join(',', $checksumconcat));
$hashhtdocsdir = hash($algo, join(',', $checksumconcat));
fputs($fp, '<dolibarr_htdocs_dir_checksum>'."\n");
fputs($fp, $md5htdocsdir."\n");
fputs($fp, $hashhtdocsdir."\n");
fputs($fp, '</dolibarr_htdocs_dir_checksum>'."\n\n");
@ -308,9 +310,9 @@ if ($release) {
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
$hashoffile = hash_file($algo, $file);
$checksumconcat[] = $hashoffile;
fputs($fp, ' <'.$algo.'file name="'.basename($file).'" size="'.filesize($file).'">'.$hashoffile.'</'.$algo.'file>'."\n");
}
}
if ($needtoclose) {
@ -320,10 +322,10 @@ if ($release) {
fputs($fp, '</dolibarr_scripts_dir>'."\n");
asort($checksumconcat); // Sort list of checksum
$md5scriptsdir = md5(join(',', $checksumconcat));
$hashscriptsdir = hash($algo, join(',', $checksumconcat));
fputs($fp, '<dolibarr_scripts_dir_checksum>'."\n");
fputs($fp, $md5scriptsdir."\n");
fputs($fp, $hashscriptsdir."\n");
fputs($fp, '</dolibarr_scripts_dir_checksum>'."\n\n");
}
@ -371,10 +373,10 @@ foreach ($arrayofunalterablefiles as $entry) {
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
$hashoffile = hash_file($algo, $file);
$checksumconcat[] = $hashoffile;
if ($release) {
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
fputs($fp, ' <'.$algo.'file name="'.basename($file).'" size="'.filesize($file).'">'.$hashoffile.'</'.$algo.'file>'."\n");
}
}
}
@ -407,10 +409,10 @@ foreach ($arrayofunalterablefiles as $entry) {
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
$hashoffile = hash_file($algo, $file);
$checksumconcat[] = $hashoffile;
if ($release) {
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
fputs($fp, ' <'.$algo.'file name="'.basename($file).'" size="'.filesize($file).'">'.$hashoffile.'</'.$algo.'file>'."\n");
}
}
if ($needtoclose) {
@ -423,13 +425,13 @@ foreach ($arrayofunalterablefiles as $entry) {
}
asort($checksumconcat); // Sort list of checksum
$md5unalterable_files = md5(join(',', $checksumconcat));
$hashunalterable_files = hash($algo, join(',', $checksumconcat));
if ($release) {
fputs($fp, '</dolibarr_unalterable_files>'."\n");
fputs($fp, '<dolibarr_unalterable_files_checksum>'."\n");
fputs($fp, $md5unalterable_files."\n");
fputs($fp, $hashunalterable_files."\n");
fputs($fp, '</dolibarr_unalterable_files_checksum>'."\n\n");
// End of file
@ -443,9 +445,9 @@ print "\n";
if ($release) {
if (empty($buildzip)) {
print "File ".$outputfile." generated.\n";
print "Signature for htdocs files: ".$md5htdocsdir."\n";
print "Signature for scripts files: ".$md5scriptsdir."\n";
print "Signature for the ".count($checksumconcat)." unalterable files: ".$md5unalterable_files."\n";
print "Signature for htdocs files: ".$hashhtdocsdir."\n";
print "Signature for scripts files: ".$hashscriptsdir."\n";
print "Signature for the ".count($checksumconcat)." unalterable files: ".$hashunalterable_files."\n";
} else {
if ($buildzip == '1' || $buildzip == 'zip') {
$result = dol_compress_file($outputfile, $outputfile.'.zip', 'zip');
@ -464,7 +466,7 @@ if ($release) {
}
if ($checklock) {
print "Signature for unalterable files: ".$md5unalterable_files."\n";
print "Signature for unalterable files: ".$algo." ".$hashunalterable_files."\n";
$lockedfile = DOL_DOCUMENT_ROOT.'/../dev/lockedfiles.txt';
$checksuminlockedfile = '';
@ -475,15 +477,15 @@ if ($checklock) {
// Now we check the content of lockedfiles.txt
$arraylocked = file($lockedfile);
foreach ($arraylocked as $line) {
$tmparray = preg_split("/\s+/", $line, 3);
if ($tmparray[0] == $checklockmajorversion) {
$checksuminlockedfile = $tmparray[2];
$tmparray = preg_split("/\s+/", $line, 4);
if ($tmparray[0] == $checklockmajorversion && $tmparray[2] == $algo) {
$checksuminlockedfile = $tmparray[3];
}
}
if (empty($checksuminlockedfile)) {
print "The major version ".$checklockmajorversion." is not locked on the scope ".$checksource." (file found but no matching entry found into dev/lockedfiles.txt).\n";
} elseif ($checksuminlockedfile != $md5unalterable_files) {
print "The major version ".$checklockmajorversion." is locked on scope '".$checksource."' to checksum ".$checksuminlockedfile."\n";
print "The major version ".$checklockmajorversion." is not locked on the scope '".$checksource."' (file found but no matching entry found into dev/lockedfiles.txt).\n";
} elseif ($checksuminlockedfile != $hashunalterable_files) {
print "The major version ".$checklockmajorversion." is locked on scope '".$checksource."' to checksum ".$algo." ".$checksuminlockedfile."\n";
if ($checklockmajorversion != $checksource) {
print "The checksum now differs from the locked one, so we return an error.\n";
print "\n";

View file

@ -14,7 +14,7 @@
#----------------------------------------------------------------------------
## no critic (InputOutput::ProhibitExplicitStdin,InputOutput::RequireBriefOpen)
use strict;
#use strict;
use warnings;
use Cwd;
use Term::ANSIColor;

View file

@ -2,6 +2,6 @@
This file is the list of the signatures of some set of files locked to block a commit if files are tried to be modified for a given version.
It is used by the CI or the script to check and guarantee that no change is done on a given scope of files.
Version Scope Signature (generated by dev/build/generate_filelist_xml.php) that must remain unchanged for this couple version/scope
Version Scope Algo Signature (generated by dev/build/generate_filelist_xml.php) that must remain unchanged for this couple version/scope
x.0.0 unalterable_files 123456
23.0.0 unalterable_files sha256 123456

View file

@ -225,6 +225,7 @@ class DolibarrApi
unset($object->error);
unset($object->errors);
unset($object->errorhidden);
unset($object->warnings);
unset($object->TRIGGER_PREFIX);
unset($object->ref_previous);

View file

@ -106,15 +106,15 @@ $morehtmlcenter = '';
$registrationnumber = getHashUniqueIdOfRegistration();
$texttop = '<small class="opacitymedium">'.$langs->trans("RegistrationNumber").':</small> <small>'.dol_trunc($registrationnumber, 10).'</small>';
print load_fiche_titre($title, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter);
print load_fiche_titre($title.'<br>'.$texttop, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter);
if ($withtab) {
$head = blockedlogadmin_prepare_head(GETPOST('withtab', 'alpha'));
print dol_get_fiche_head($head, 'blockedlog', '', -1);
}
print $texttop;
print '<br><br>';
//print $texttop;
//print '<br><br>';
print '<span class="opacitymedium">'.$langs->trans("BlockedLogDesc")."</span><br>\n";

View file

@ -447,14 +447,14 @@ $morehtmlcenter = '';
$registrationnumber = getHashUniqueIdOfRegistration();
$texttop = '<small class="opacitymedium">'.$langs->trans("RegistrationNumber").':</small> <small>'.dol_trunc($registrationnumber, 10).'</small>';
print load_fiche_titre($title, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter);
print load_fiche_titre($title.'<br>'.$texttop, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter);
$head = blockedlogadmin_prepare_head(GETPOST('withtab', 'alpha'));
print dol_get_fiche_head($head, 'archives', '', -1);
print $texttop;
print '<br><br>';
//print $texttop;
//print '<br><br>';
print '<div class="opacitymedium hideonsmartphone justify">';
@ -546,7 +546,7 @@ print '<input type="hidden" name="action" value="export">';
print '<div class="right">';
print $langs->trans("RestrictYearToExport").': ';
print '<span class="hideonsmartphone">'.$langs->trans("RestrictYearToExport").': </span>';
// Month
print $formother->select_month((string) GETPOSTINT('monthtoexport'), 'monthtoexport', $langs->trans("Month"), 0, 'minwidth50 maxwidth75imp valignmiddle', true);
print '<input type="text" name="yeartoexport" class="valignmiddle maxwidth75imp" value="'.GETPOST('yeartoexport').'" placeholder="'.$langs->trans("Year").'">';

View file

@ -405,14 +405,14 @@ $morehtmlcenter = '';
$registrationnumber = getHashUniqueIdOfRegistration();
$texttop = '<small class="opacitymedium">'.$langs->trans("RegistrationNumber").':</small> <small>'.dol_trunc($registrationnumber, 10).'</small>';
print load_fiche_titre($title, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter);
print load_fiche_titre($title.'<br>'.$texttop, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter);
$head = blockedlogadmin_prepare_head(GETPOST('withtab', 'alpha'));
print dol_get_fiche_head($head, 'fingerprints', '', -1);
print $texttop;
print '<br><br>';
//print $texttop;
//print '<br><br>';
print '<div class="opacitymedium hideonsmartphone justify">';

View file

@ -233,6 +233,9 @@ if (empty($error) && !empty($xml)) {
$file_list = array();
$out = '';
//$algo = 'md5'; // For v22-
$algo = 'sha256'; // For v23+
// Forced constants
if (is_object($xml->dolibarr_constants[0]) || $mode == 'unalterable') {
$out .= load_fiche_titre($langs->trans("ForcedConstants"));
@ -349,6 +352,7 @@ if (empty($error) && !empty($xml)) {
$onlymodifiedorremoved = 0;
}
// Scan htdocs
if (is_object($listoffilestoanalyze)) {
// @phan-suppress-next-line PhanTypeArraySuspicious
@ -361,15 +365,15 @@ if (empty($error) && !empty($xml)) {
// Fill file_list with files in signature, new files, modified files
getFilesUpdated($file_list, $listoffilestoanalyze, '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list
'@phan-var-force array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list';
'@phan-var-force array{insignature:string[],missing?:array<array{filename:string,expectedhash:string,expectedsize:string,algo:string}>,updated:array<array{filename:string,expectedhash:string,expectedsize:string,hash:string,algo:string}>} $file_list';
// Complete with list of new files into $file_list['added']
if ($onlymodifiedorremoved) {
if (empty($onlymodifiedorremoved)) {
foreach ($scanfiles as $valfile) {
$tmprelativefilename = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', $valfile['fullname']);
if (!in_array($tmprelativefilename, $file_list['insignature'])) {
$md5newfile = @md5_file($valfile['fullname']); // Can fails if we don't have permission to open/read file
$file_list['added'][] = array('filename' => $tmprelativefilename, 'md5' => $md5newfile);
$hashnewfile = @hash_file($algo, $valfile['fullname']); // Can fails if we don't have permission to open/read file
$file_list['added'][] = array('filename' => $tmprelativefilename, 'hash' => $hashnewfile, 'algo' => $algo);
}
}
}
@ -398,7 +402,7 @@ if (empty($error) && !empty($xml)) {
$out .= dol_print_size((int) $file['expectedsize']);
}
$out .= '</td>'."\n";
$out .= '<td class="center">'.dol_escape_htmltag($file['expectedmd5']).'</td>'."\n";
$out .= '<td class="center">'.dol_escape_htmltag($file['expectedhash']).'</td>'."\n";
$out .= "</tr>\n";
}
} else {
@ -432,8 +436,8 @@ if (empty($error) && !empty($xml)) {
$out .= '<tr class="oddeven">';
$out .= '<td>'.$i.'</td>'."\n";
$out .= '<td>'.dol_escape_htmltag($file['filename']).'</td>'."\n";
$out .= '<td class="center">'.dol_escape_htmltag($file['expectedmd5']).'</td>'."\n";
$out .= '<td class="center">'.dol_escape_htmltag($file['md5']).'</td>'."\n";
$out .= '<td class="center">'.dol_escape_htmltag($file['expectedhash']).'</td>'."\n";
$out .= '<td class="center">'.dol_escape_htmltag($file['hash']).'</td>'."\n";
$out .= '<td class="right">';
if ($file['expectedsize']) {
$out .= dol_print_size((int) $file['expectedsize']);
@ -490,8 +494,8 @@ if (empty($error) && !empty($xml)) {
$out .= ' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i);
}
$out .= '</td>'."\n";
$out .= '<td class="center">'.dol_escape_htmltag((string) $file['expectedmd5']).'</td>'."\n"; // @phan-suppress-current-line PhanTypeInvalidDimOffset
$out .= '<td class="center">'.dol_escape_htmltag($file['md5']).'</td>'."\n";
$out .= '<td class="center">'.dol_escape_htmltag((string) $file['expectedhash']).'</td>'."\n"; // @phan-suppress-current-line PhanTypeInvalidDimOffset
$out .= '<td class="center">'.dol_escape_htmltag($file['hash']).'</td>'."\n";
$size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
$totalsize += $size;
$out .= '<td class="right">'.dol_print_size($size).'</td>'."\n";
@ -525,14 +529,14 @@ if (empty($error) && !empty($xml)) {
if (is_object($xml->dolibarr_scripts_dir[0])) {
$file_list = array();
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', ???, $checksumconcat); // Fill array $file_list
'@phan-var-force array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list';
'@phan-var-force array{insignature:string[],missing?:array<array{filename:string,expectedhash:string,expectedsize:string,algo:string}>,updated:array<array{filename:string,expectedhash:string,expectedsize:string,hash:string,algo:string}>} $file_list';
}*/
// Section Globalchecksum
asort($checksumconcat); // Sort list of checksum
$checksumget = md5(implode(',', $checksumconcat));
$checksumget = hash($algo, implode(',', $checksumconcat));
if ($mode == 'unalterable') {
$nameofsection = 'dolibarr_unalterable_files_checksum';
@ -585,7 +589,16 @@ if (empty($error) && !empty($xml)) {
$outforlistoffiles .= '<textarea id="listofunalterablefiles" class="hideobject quatrevingtpercent" rows="12">';
$i = 0;
foreach ($listoffilestoanalyze as $dirtoanalyze) {
foreach ($dirtoanalyze->md5file as $filetoanalyze) {
$entry = array();
if (!empty($dirtoanalyze->md5file)) {
$entry = $dirtoanalyze->md5file;
$algo = 'md5';
} elseif (!empty($dirtoanalyze->sha256file)) {
$entry = $dirtoanalyze->sha256file;
$algo = 'sha256';
}
foreach ($entry as $filetoanalyze) {
if ($i) {
$outforlistoffiles .= "\n";
}

View file

@ -29,10 +29,6 @@
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once '../lib/bookcal.lib.php';
/**
* @var Conf $conf
* @var DoliDB $db
@ -40,6 +36,8 @@ require_once '../lib/bookcal.lib.php';
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once '../lib/bookcal.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('agenda', 'admin'));
@ -66,17 +64,15 @@ if (!$user->admin) {
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
/*
* View
*/
$textobject = $langs->transnoentitiesnoconv("Availabilities");
$help_url = '';
$page_name = "BookCalSetup";
$title = $langs->trans($page_name);
llxHeader('', $langs->trans("BookCalSetup"), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_availabilities_extrafields');
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_availabilities_extrafields');
$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
@ -85,14 +81,13 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
$head = bookcalAdminPrepareHead();
print dol_get_fiche_head($head, 'availabilities_extrafields', $langs->trans($page_name), -1, 'fa-calendar-check');
print dol_get_fiche_head($head, 'availabilities_extrafields', $title, -1, 'fa-calendar-check');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print dol_get_fiche_end();
/*
* Creation of an optional field
*/

View file

@ -72,12 +72,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
$textobject = $langs->transnoentitiesnoconv("Calendar");
$help_url = '';
$page_name = "BookCalSetup";
$title = $langs->trans($page_name);
llxHeader('', $langs->trans("BookCalSetup"), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_calender_extrafields');
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_calender_extrafields');
$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
@ -93,16 +92,6 @@ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print dol_get_fiche_end();
// Buttons
if ((float) DOL_VERSION < 17) { // On v17+, the "New Attribute" button is included into tpl. @phpstan-ignore-line
if ($action != 'create' && $action != 'edit') {
print '<div class="tabsAction">';
print '<a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a>';
print "</div>";
}
}
/*
* Creation of an optional field
*/

View file

@ -26,11 +26,6 @@
// Load Dolibarr environment
require '../../main.inc.php';
// Libraries
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once '../lib/bookcal.lib.php';
/**
* @var Conf $conf
* @var DoliDB $db
@ -38,6 +33,11 @@ require_once '../lib/bookcal.lib.php';
* @var Translate $langs
* @var User $user
*/
// Libraries
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once '../lib/bookcal.lib.php';
// Translations
$langs->loadLangs(array("admin", "agenda"));
@ -168,8 +168,9 @@ $form = new Form($db);
$help_url = '';
$page_name = "BookCalSetup";
$title = $langs->trans($page_name);
llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_setup');
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_setup');
// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
@ -178,7 +179,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
// Configuration header
$head = bookcalAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "fa-calendar-check");
print dol_get_fiche_head($head, 'settings', $title, -1, "fa-calendar-check");
print '<br>';

View file

@ -1145,6 +1145,7 @@ if ($type == Categorie::TYPE_USER) {
} else {
/** @var User[] $users */
'@phan-var-force User[] $users';
// Form to add record into a category
print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -1215,6 +1216,7 @@ if ($type == Categorie::TYPE_USER) {
if ($type == Categorie::TYPE_WAREHOUSE) {
if ($user->hasRight("stock", "read")) {
$permission = $user->hasRight('stock', 'creer');
$showclassifyform = $user->hasRight('stock', 'creer');
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
@ -1241,6 +1243,16 @@ if ($type == Categorie::TYPE_WAREHOUSE) {
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
print_barre_liste($langs->trans("Warehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'stock', 0, $newcardbutton, '', $limit);
if ($showclassifyform) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddTicketIntoCategory").' &nbsp;';
print $form->selectForForms('Entrepot:product/stock/class/entrepot.class.php', 'elemid', '', 1, '', '', 'maxwidth500');
print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
}
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
@ -1374,11 +1386,9 @@ if ($type == Categorie::TYPE_FICHINTER) {
} else {
/** @var Fichinter[] $fichinters */
'@phan-var-force Fichinter[] $fichinters';
// Form to add record into a category
if ($showclassifyform) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formintervention.class.php';
$formfichinter = new FormIntervention($db);
print '<br>';
print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -1389,7 +1399,7 @@ if ($type == Categorie::TYPE_FICHINTER) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddFichinterIntoCategory").' &nbsp;';
print $formfichinter->select_interventions(-1, 0, 'elemid');
print $form->selectForForms('Fichinter:fichinter/class/fichinter.class.php', 'elemid', '', 1, '', '', 'maxwidth500');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
@ -1476,7 +1486,7 @@ if ($type == Categorie::TYPE_ORDER) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddOrderIntoCategory").' &nbsp;';
$form->selectOrder('', 'elemid');
print $form->selectForForms('Commande:commande/class/commande.class.php', 'elemid', '', 1, '', '', 'maxwidth500');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
@ -1557,7 +1567,7 @@ if ($type == Categorie::TYPE_INVOICE) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddInvoiceIntoCategory").' &nbsp;';
print $form->selectInvoice(-1, '', 'elemid', 24, 0, '1', 0, 0, 0, 'maxwidth500', '', '');
print $form->selectForForms('Facture:compta/facture/class/facture.class.php', 'elemid', '', 1, '', '', 'maxwidth500');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
@ -1639,7 +1649,7 @@ if ($type == Categorie::TYPE_SUPPLIER_ORDER) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddSupplierOrderIntoCategory").' &nbsp;';
$form->selectSupplierOrder('', 'elemid');
print $form->selectForForms('CommandeFournisseur:fourn/class/fournisseur.commande.class.php', 'elemid', '', 1, '', '', 'maxwidth500');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
@ -1720,7 +1730,7 @@ if ($type == Categorie::TYPE_SUPPLIER_INVOICE) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddSupplierInvoiceIntoCategory").' &nbsp;';
$form->selectSupplierInvoice('', 'elemid');
print $form->selectForForms('FactureFournisseur:fourn/class/fournisseur.facture.class.php', 'elemid', '', 1, '', '', 'maxwidth500');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';

View file

@ -198,6 +198,11 @@ if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('b
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
}
if ($contextpage == 'poslist' && !GETPOSTISSET('limit')) {
$limit = 5;
}
$offset = $limit * $page;
if (!$sortorder && getDolGlobalString('INVOICE_DEFAULT_UNPAYED_SORT_ORDER') && $search_status == '1') {
$sortorder = getDolGlobalString('INVOICE_DEFAULT_UNPAYED_SORT_ORDER');
@ -2762,7 +2767,7 @@ if ($num > 0) {
// Author
if (!empty($arrayfields['u.login']['checked'])) {
print '<td class="tdoverflowmax125">';
print '<td class="tdoverflowmax100">';
if ($userstatic->id) {
print $userstatic->getNomUrl(-1);
} else {

View file

@ -631,6 +631,8 @@ class Paiement extends CommonObject
dol_syslog(get_class($this).'::create Regenerate end result='.$result, LOG_DEBUG);
$this->warnings = $invoice->warnings;
if ($result < 0) {
$this->error = $invoice->error;
$this->errors = $invoice->errors;

View file

@ -58,6 +58,11 @@ abstract class CommonDocGenerator
*/
public $errors = array();
/**
* @var string[] Array of warnings strings
*/
public $warnings = array();
/**
* @var DoliDB Database handler.
*/

View file

@ -91,6 +91,11 @@ abstract class CommonObject
*/
public $errors = array();
/**
* @var string[] Array of warning strings
*/
public $warnings = array();
/**
* @var array<string,string> To store error results of ->validateField()
*/
@ -230,7 +235,7 @@ abstract class CommonObject
private $linkedObjectsFullLoaded = array();
/**
* @var ?static To store a cloned copy of the object before editing it (to keep track of its former properties)
* @var ?static To store a cloned copy of the object before editing it (to keep track of its former properties) by doing $object->oldcopy = dol_clone($object, 2);
*/
public $oldcopy;
@ -2724,8 +2729,8 @@ abstract class CommonObject
}
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
$sql .= ' WHERE rowid='.((int) $this->id);
$sql .= " SET ".$this->db->sanitize($fieldname)." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
$sql .= ' WHERE rowid = '.((int) $this->id);
if ($this->db->query($sql)) {
$this->mode_reglement_id = $id;
@ -6106,6 +6111,7 @@ abstract class CommonObject
}
// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
if ($resultwritefile > 0) {
$outputlangs->charset_output = $sav_charset_output;
@ -6135,11 +6141,14 @@ abstract class CommonObject
// Success in building document. We build meta file.
dol_meta_create($this);
$this->warnings = $obj->warnings;
return 1;
} else {
$outputlangs->charset_output = $sav_charset_output;
$this->error = $obj->error;
$this->errors = $obj->errors;
$this->warnings = $obj->warnings;
dol_syslog("Error generating document for ".__CLASS__.". Error: ".$obj->error, LOG_ERR);
return -1;
}

View file

@ -8995,7 +8995,7 @@ class Form
* @param string $objectdesc 'ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]'. For hard coded custom needs. Try to prefer method using $objectfield array instead of $objectdesc.
* @param string $htmlname Name of HTML select component
* @param int $preSelectedValue Preselected value (ID of element)
* @param string|int<0,1> $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
* @param string|int<0,1> $showempty 0 or ''=empty values not allowed, 1=Add empty value, 'string'=value show if we allow empty values (for example 'All', ...)
* @param string $searchkey Search criteria
* @param string $placeholder Place holder
* @param string $morecss More CSS
@ -11476,11 +11476,11 @@ class Form
/**
* Return HTML to show the search and clear search button
*
* @param int $addcheckuncheckall Add the check all/uncheck all checkbox (use javascript) and code to manage this
* @param string $cssclass CSS class
* @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes
* @param string $massactionname Mass action name
* @return string
* @param int $addcheckuncheckall Add the check all/uncheck all checkbox (use javascript) and code to manage this
* @param string $cssclass CSS class
* @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes
* @param string $massactionname Mass action name
* @return string
*/
public function showFilterAndCheckAddButtons($addcheckuncheckall = 0, $cssclass = 'checkforaction', $calljsfunction = 0, $massactionname = "massaction")
{
@ -11494,15 +11494,15 @@ class Form
/**
* Return HTML to show the select of expense categories
*
* @param string $selected preselected category
* @param string $htmlname name of HTML select list
* @param int<0,1> $useempty 1=Add empty line
* @param int[] $excludeid id to exclude
* @param string $target htmlname of target select to bind event
* @param int $default_selected default category to select if fk_c_type_fees change = EX_KME
* @param array<string,int|string> $params param to give
* @param int<0,1> $info_admin Show the tooltip help picto to setup list
* @return string
* @param string $selected preselected category
* @param string $htmlname name of HTML select list
* @param int<0,1> $useempty 1=Add empty line
* @param int[] $excludeid id to exclude
* @param string $target htmlname of target select to bind event
* @param int $default_selected default category to select if fk_c_type_fees change = EX_KME
* @param array<string,int|string> $params param to give
* @param int<0,1> $info_admin Show the tooltip help picto to setup list
* @return string
*/
public function selectExpenseCategories($selected = '', $htmlname = 'fk_c_exp_tax_cat', $useempty = 0, $excludeid = array(), $target = '', $default_selected = 0, $params = array(), $info_admin = 1)
{
@ -11623,12 +11623,12 @@ class Form
/**
* Return HTML to show a select of expense
*
* @param string $selected preselected category
* @param string $htmlname name of HTML select list
* @param integer $useempty 1=Add empty choice
* @param integer $allchoice 1=Add all choice
* @param integer $useid 0=use 'code' as key, 1=use 'id' as key
* @return string
* @param string $selected preselected category
* @param string $htmlname name of HTML select list
* @param integer $useempty 1=Add empty choice
* @param integer $allchoice 1=Add all choice
* @param integer $useid 0=use 'code' as key, 1=use 'id' as key
* @return string
*/
public function selectExpenseFees($selected = '', $htmlname = 'fk_c_type_fees', $useempty = 0, $allchoice = 1, $useid = 0)
{
@ -11913,319 +11913,6 @@ class Form
}
/**
* Output a combo list with orders qualified for a third party
* TODO Bad method. This is used by viewcat.php. We must use a generic method in viewcat to use an ajax search ad remove this one that download all the database.
*
* @param string $selected Id order preselected
* @param string $htmlname Name of HTML select
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param string $morecss More css added to the select component
*
* @return int Nbr of project if OK, <0 if KO
*/
public function selectOrder($selected = '', $htmlname = 'orderid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500')
{
global $conf;
$out = '';
$hideunselectables = false;
if (getDolGlobalString('ORDER_HIDE_UNSELECTABLES')) {
$hideunselectables = true;
}
// Search all orders
$sql = "SELECT c.rowid, c.ref";
$sql .= ' FROM '.$this->db->prefix().'commande as c';
$sql .= " ORDER BY c.ref ASC";
$resql = $this->db->query($sql);
if ($resql) {
// Use select2 selector
if (!empty($conf->use_javascript_ajax)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
$out .= $comboenhancement;
$morecss = 'minwidth200imp maxwidth500';
}
if (empty($option_only)) {
$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
}
if (!empty($show_empty)) {
$out .= '<option value="0" class="optiongrey">';
if (!is_numeric($show_empty)) {
$out .= $show_empty;
} else {
$out .= '&nbsp;';
}
$out .= '</option>';
}
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
if ($discard_closed == 1 && $obj->fk_statut == Project::STATUS_CLOSED) {
$i++;
continue;
}
$labeltoshow = dol_trunc($obj->ref, 18); // Order ref
if (!empty($selected) && $selected == $obj->rowid) {
$out .= '<option value="'.$obj->rowid.'" selected';
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
$out .= '>'.$labeltoshow.'</option>';
} else {
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
$resultat = '';
} else {
$resultat = '<option value="'.$obj->rowid.'"';
if ($disabled) {
$resultat .= ' disabled';
}
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$resultat .= '>';
$resultat .= $labeltoshow;
$resultat .= '</option>';
}
$out .= $resultat;
}
$i++;
}
}
if (empty($option_only)) {
$out .= '</select>';
}
print $out;
$this->db->free($resql);
return $num;
} else {
dol_print_error($this->db);
return -1;
}
}
/**
* Output a combo list with supplier orders qualified for a third party
* TODO Bad method. This is used by viewcat.php. We must use a generic method in viewcat to use an ajax search ad remove this one that download all the database.
*
* @param string $selected Id supplier order preselected
* @param string $htmlname Name of HTML select
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param string $morecss More css added to the select component
*
* @return int Nbr of project if OK, <0 if KO
*/
public function selectSupplierOrder($selected = '', $htmlname = 'supplierorderid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500')
{
global $conf;
$out = '';
$hideunselectables = false;
if (getDolGlobalString('SUPPLIER_ORDER_HIDE_UNSELECTABLES')) {
$hideunselectables = true;
}
// Search all supplier orders
$sql = "SELECT cf.rowid, cf.ref";
$sql .= ' FROM '.$this->db->prefix().'commande_fournisseur as cf';
$sql .= " ORDER BY cf.ref ASC";
$resql = $this->db->query($sql);
if ($resql) {
// Use select2 selector
if (!empty($conf->use_javascript_ajax)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
$out .= $comboenhancement;
$morecss = 'minwidth200imp maxwidth500';
}
if (empty($option_only)) {
$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
}
if (!empty($show_empty)) {
$out .= '<option value="0" class="optiongrey">';
if (!is_numeric($show_empty)) {
$out .= $show_empty;
} else {
$out .= '&nbsp;';
}
$out .= '</option>';
}
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
if ($discard_closed == 1 && $obj->fk_statut == Project::STATUS_CLOSED) {
$i++;
continue;
}
$labeltoshow = dol_trunc($obj->ref, 18); // Supplier order ref
if (!empty($selected) && $selected == $obj->rowid) {
$out .= '<option value="'.$obj->rowid.'" selected';
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
$out .= '>'.$labeltoshow.'</option>';
} else {
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
$resultat = '';
} else {
$resultat = '<option value="'.$obj->rowid.'"';
if ($disabled) {
$resultat .= ' disabled';
}
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$resultat .= '>';
$resultat .= $labeltoshow;
$resultat .= '</option>';
}
$out .= $resultat;
}
$i++;
}
}
if (empty($option_only)) {
$out .= '</select>';
}
print $out;
$this->db->free($resql);
return $num;
} else {
dol_print_error($this->db);
return -1;
}
}
/**
* Output a combo list with supplier invoices qualified for a third party
* TODO Bad method. This is used by viewcat.php. We must use a generic method in viewcat to use an ajax search ad remove this one that download all the database.
*
* @param string $selected Id supplier order preselected
* @param string $htmlname Name of HTML select
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param string $morecss More css added to the select component
*
* @return int Nbr of project if OK, <0 if KO
*/
public function selectSupplierInvoice($selected = '', $htmlname = 'supplierinvoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500')
{
global $conf;
$out = '';
$hideunselectables = false;
if (getDolGlobalString('SUPPLIER_INVOICE_HIDE_UNSELECTABLES')) {
$hideunselectables = true;
}
// Search all supplier orders
$sql = "SELECT ff.rowid, ff.ref";
$sql .= ' FROM '.$this->db->prefix().'facture_fourn as ff';
$sql .= " ORDER BY ff.ref ASC";
$resql = $this->db->query($sql);
if ($resql) {
// Use select2 selector
if (!empty($conf->use_javascript_ajax)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
$out .= $comboenhancement;
$morecss = 'minwidth200imp maxwidth500';
}
if (empty($option_only)) {
$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
}
if (!empty($show_empty)) {
$out .= '<option value="0" class="optiongrey">';
if (!is_numeric($show_empty)) {
$out .= $show_empty;
} else {
$out .= '&nbsp;';
}
$out .= '</option>';
}
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
if ($discard_closed == 1 && $obj->fk_statut == Project::STATUS_CLOSED) {
$i++;
continue;
}
$labeltoshow = dol_trunc($obj->ref, 18); // Supplier order ref
if (!empty($selected) && $selected == $obj->rowid) {
$out .= '<option value="'.$obj->rowid.'" selected';
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
$out .= '>'.$labeltoshow.'</option>';
} else {
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
$resultat = '';
} else {
$resultat = '<option value="'.$obj->rowid.'"';
if ($disabled) {
$resultat .= ' disabled';
}
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$resultat .= '>';
$resultat .= $labeltoshow;
$resultat .= '</option>';
}
$out .= $resultat;
}
$i++;
}
}
if (empty($option_only)) {
$out .= '</select>';
}
print $out;
$this->db->free($resql);
return $num;
} else {
dol_print_error($this->db);
return -1;
}
}
/**
* Output the component to make advanced search criteria
*

View file

@ -139,11 +139,13 @@ class FormSetup
/**
* Generate the form (in read or edit mode depending on $editMode)
*
* @param bool $editMode true will display output on edit mod
* @param bool $hideTitle True to hide the first title line
* @return string Html output
* @param bool $editMode True will display output on edit mod
* @param bool $hideTitle True to hide the first title line
* @param string $title Title of first line
* @param string $cssfirstcolumn CSS first column
* @return string Html output
*/
public function generateOutput($editMode = false, $hideTitle = false)
public function generateOutput($editMode = false, $hideTitle = false, $title = '', $cssfirstcolumn = '')
{
global $hookmanager, $action;
@ -175,7 +177,7 @@ class FormSetup
}
// generate output table
$out .= $this->generateTableOutput($editMode, $hideTitle);
$out .= $this->generateTableOutput($editMode, $hideTitle, $title, $cssfirstcolumn);
$reshook = $hookmanager->executeHooks('formSetupBeforeGenerateOutputButton', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
@ -208,11 +210,13 @@ class FormSetup
/**
* generateTableOutput
*
* @param bool $editMode True will display output on edit modECM
* @param bool $hideTitle True to hide the first title line
* @return string Html output
* @param bool $editMode True will display output on edit modECM
* @param bool $hideTitle True to hide the first title line
* @param string $title Title of first line
* @param string $cssfirstcolumn CSS first column
* @return string Html output
*/
public function generateTableOutput($editMode = false, $hideTitle = false)
public function generateTableOutput($editMode = false, $hideTitle = false, $title = '', $cssfirstcolumn = '')
{
global $hookmanager, $action;
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
@ -230,9 +234,12 @@ class FormSetup
} else {
$out = '<table class="noborder centpercent">';
if (empty($hideTitle)) {
if (empty($title)) {
$title = $this->langs->transnoentitiesnoconv("Parameter");
}
$out .= '<thead>';
$out .= '<tr class="liste_titre">';
$out .= ' <td>' . $this->langs->trans("Parameter") . '</td>';
$out .= ' <td'.($cssfirstcolumn ? ' class="'.$cssfirstcolumn.'"' : '').'>' . dolPrintHTML($title) . '</td>';
$out .= ' <td></td>';
$out .= '</tr>';
$out .= '</thead>';

View file

@ -473,6 +473,19 @@ abstract class DoliDB implements Database
return false;
}
/**
* Get the last ID of an auto-increment field of a table
*
* @param string $table Name of table
* @return int Next ID or -1 if error
*/
public function getNextAutoIncrementId($table)
{
$this->lasterror = 'getNextAutoIncrementId() not implemented for this driver. Failed to get next ID for table '.$table;
return -1;
}
/**
* Prepare a SQL statement for execution
*

View file

@ -603,7 +603,7 @@ class DoliDBMysqli extends DoliDB
/**
* Get last ID after an insert INSERT
*
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
* @param string $tab Table name concerned by insert. Use of this could be avoided with MySql as last inset id is stored into the Mysqli object but we use it for compatibility with Postgresql
* @param string $fieldid Field name
* @return int|string Id of row
*/
@ -1295,6 +1295,28 @@ class DoliDBMysqli extends DoliDB
return $result;
}
/**
* Get the last ID of an auto-increment field of a table
*
* @param string $table Name of table
* @return int Next ID or < 0 if error
*/
public function getNextAutoIncrementId($table)
{
// Request to get last status of table
$sql = "SHOW TABLE STATUS LIKE '".$this->escape($table)."'";
$result = $this->query($sql);
if ($result) {
$obj = $this->fetch_object($result);
if ($obj && isset($obj->Auto_increment)) {
return (int) $obj->Auto_increment;
}
}
return -1;
}
/**
* Prepare a SQL statement for execution
*

View file

@ -855,18 +855,20 @@ class DoliDBPgsql extends DoliDB
/**
* Get last ID after an insert INSERT
*
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec PostgreSQL
* @param string $table Table name concerned by insert.
* @param string $fieldid Field name
* @return int Id of row
* @return int Id of row or -1 if error
*/
public function last_insert_id($tab, $fieldid = 'rowid')
public function last_insert_id($table, $fieldid = 'rowid')
{
// phpcs:enable
//$result = pg_query($this->db,"SELECT MAX(".$fieldid.") FROM ".$tab);
$result = pg_query($this->db, "SELECT currval('".$tab."_".$fieldid."_seq')");
$sequencename = $table."_".$fieldid."_seq";
//$result = pg_query($this->db,"SELECT MAX(".$fieldid.") FROM ".$table);
$result = pg_query($this->db, "SELECT currval('".$sequencename."')");
if (!$result) {
print pg_last_error($this->db);
exit;
return -1;
}
//$nbre = pg_num_rows($result);
$row = pg_fetch_result($result, 0, 0);
@ -1513,6 +1515,18 @@ class DoliDBPgsql extends DoliDB
return array();
}
/**
* Get the last ID of an auto-increment field of a table
*
* @param string $table Name of table
* @return int Next ID or < 0 if error
*/
public function getNextAutoIncrementId($table)
{
return $this->last_insert_id($table, 'rowid') + 1;
}
/**
* Prepare a SQL statement for execution (PostgreSQL prepared statement)
*

View file

@ -3875,12 +3875,12 @@ function dirbasename($pathfile)
* Function to get list of updated or modified files.
* $file_list is used as global variable
*
* @param array{}|array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list Array for response
* @param array{}|array{insignature:string[],missing?:array<array{filename:string,expectedhash:string,expectedsize:string,algo:string}>,updated:array<array{filename:string,expectedhash:string,expectedsize:string,hash:string,algo:string}>} $file_list Array for response
* @param SimpleXMLElement $dir SimpleXMLElement of files to test
* @param string $path Path of files relative to $pathref. We start with ''. Used by recursive calls.
* @param string $pathref Path ref (DOL_DOCUMENT_ROOT)
* @param string[] $checksumconcat Array of checksum
* @return array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list Array of filenames
* @return array{insignature:string[],missing?:array<array{filename:string,expectedhash:string,expectedsize:string,algo:string}>,updated:array<array{filename:string,expectedhash:string,expectedsize:string,hash:string,algo:string}>} $file_list Array of filenames
*/
function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathref = '', &$checksumconcat = array())
{
@ -3888,24 +3888,33 @@ function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathre
//$exclude = 'install';
foreach ($dir->md5file as $file) { // $file is a simpleXMLElement
$entry = array();
if (!empty($dir->md5file)) {
$entry = $dir->md5file;
$algo = 'md5';
} elseif (!empty($dir->sha256file)) {
$entry = $dir->sha256file;
$algo = 'sha256';
}
foreach ($entry as $file) { // $file is a simpleXMLElement
$filename = $path.$file['name'];
$file_list['insignature'][] = $filename;
$expectedsize = (empty($file['size']) ? '' : $file['size']);
$expectedmd5 = (string) $file;
$expectedhash = (string) $file;
if (!file_exists($pathref.'/'.$filename)) {
$file_list['missing'][] = array('filename' => $filename, 'expectedmd5' => $expectedmd5, 'expectedsize' => $expectedsize);
$file_list['missing'][] = array('filename' => $filename, 'expectedhash' => $expectedhash, 'expectedsize' => $expectedsize, 'algo' => (string) $algo);
} else {
$md5_local = md5_file($pathref.'/'.$filename);
$hash_local = hash_file($algo, $pathref.'/'.$filename);
if ($conffile == '/etc/dolibarr/conf.php' && $filename == '/filefunc.inc.php') { // For install with deb or rpm, we ignore test on filefunc.inc.php that was modified by package
$checksumconcat[] = $expectedmd5;
$checksumconcat[] = $expectedhash;
} else {
if ($md5_local != $expectedmd5) {
$file_list['updated'][] = array('filename' => $filename, 'expectedmd5' => $expectedmd5, 'expectedsize' => $expectedsize, 'md5' => (string) $md5_local);
if ($hash_local != $expectedhash) {
$file_list['updated'][] = array('filename' => $filename, 'expectedhash' => $expectedhash, 'expectedsize' => $expectedsize, 'hash' => (string) $hash_local, 'algo' => (string) $algo);
}
$checksumconcat[] = $md5_local;
$checksumconcat[] = $hash_local;
}
}
}

View file

@ -11289,10 +11289,10 @@ function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'o
} elseif ($mesgstring && preg_match('/class="warning"/i', $mesgstring)) {
$iswarning++;
}
if ($style == 'error') {
if ($style == 'error' || $style == 'errors') {
$iserror++;
}
if ($style == 'warning') {
if ($style == 'warning' || $style == 'warnings') {
$iswarning++;
}
@ -14128,8 +14128,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
/**
* Function dolGetButtonAction
*
* @param string $label Label or tooltip of button if $text is provided. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text.
* @param string $text Optional : short label on button. Can be escaped HTML content or full simple text.
* @param string $label Label or tooltip of button if $text is provided. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text. Used only if $url not defined.
* @param string $text Optional : short label on button. Can be escaped HTML content or full simple text. Used only if $url not defined.
* @param string $actionType 'default', 'edit', 'danger', 'email', 'clone', 'cancel', 'delete', ...
* @param string|array<int,array{lang:string,enabled:bool,perm:bool|int,label:string,url:string,urlroot?:string,isDropDown?:int<0,1>}> $url Url for link or array of subbutton description
* Example when an array is used:
@ -14232,7 +14232,14 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
$tmpurl = dolCompletUrlForDropdownButton($tmpurl, $params, empty($subbutton['urlroot']));
}
$out .= dolGetButtonAction('', $langs->trans($subbutton['label']), 'default', $tmpurl, '', $subbutton['perm'], $params);
$label = $langs->trans($subbutton['label']);
$text = $subbutton['text'] ?? '';
if (empty($text)) {
$text = $label;
$label = '';
}
$out .= dolGetButtonAction($label, $text, 'default', $tmpurl, '', $subbutton['perm'], $params);
}
}

View file

@ -213,7 +213,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
$tplcontent .= '<title>'.dol_string_nohtmltag($objectpage->title, 1, 'UTF-8').'</title>'."\n";
$tplcontent .= '<meta charset="utf-8">'."\n";
$tplcontent .= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
$tplcontent .= '<meta name="robots" content="index, follow" />'."\n";
$tplcontent .= '<meta name="robots" content="'.($objectpage->index ? 'index' : 'noindex').', '.($objectpage->follow ? 'follow' : 'nofollow').'" />'."\n";
$tplcontent .= '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n";
$tplcontent .= '<meta name="keywords" content="'.dol_string_nohtmltag($objectpage->keywords, 1, 'UTF-8').'" />'."\n";
$tplcontent .= '<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 1, 'UTF-8').'" />'."\n";

View file

@ -559,6 +559,7 @@ class pdf_balance extends ModelePdfAccountancy
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -544,6 +544,7 @@ class pdf_bookkeeping extends ModelePdfAccountancy
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -598,6 +598,7 @@ class pdf_ledger extends ModelePdfAccountancy
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -260,6 +260,7 @@ class pdf_standard_actions
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -695,6 +695,7 @@ class pdf_standard_asset extends ModelePDFAsset
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -258,6 +258,7 @@ class pdf_ban extends ModeleBankAccountDoc
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -459,6 +459,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -227,6 +227,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -671,6 +671,7 @@ class pdf_einstein extends ModelePDFCommandes
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -942,6 +942,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -499,6 +499,7 @@ class pdf_strato extends ModelePDFContract
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -581,6 +581,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -582,6 +582,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -833,6 +833,7 @@ class pdf_espadon extends ModelePdfExpedition
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -401,6 +401,7 @@ class pdf_merou extends ModelePdfExpedition
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -689,6 +689,7 @@ class pdf_rouget extends ModelePdfExpedition
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -545,6 +545,7 @@ class pdf_standard_expensereport extends ModeleExpenseReport
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -932,6 +932,7 @@ class pdf_crabe extends ModelePDFFactures
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -1250,6 +1250,7 @@ class pdf_octopus extends ModelePDFFactures
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -1142,6 +1142,7 @@ class pdf_sponge extends ModelePDFFactures
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -427,6 +427,7 @@ class pdf_soleil extends ModelePDFFicheinter
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -466,6 +466,7 @@ class pdf_standard_evaluation extends ModelePDFEvaluation
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -790,6 +790,7 @@ class pdf_standard_movementstock extends ModelePDFMovement
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -604,6 +604,7 @@ class pdf_vinci extends ModelePDFMo
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -584,6 +584,7 @@ class pdf_standard extends ModelePDFProduct
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -489,6 +489,7 @@ class pdf_baleine extends ModelePDFProjects
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -744,6 +744,7 @@ class pdf_beluga extends ModelePDFProjects
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -487,6 +487,7 @@ class pdf_timespent extends ModelePDFProjects
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -874,6 +874,7 @@ class pdf_azur extends ModelePDFPropales
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -1045,6 +1045,7 @@ class pdf_cyan extends ModelePDFPropales
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -407,6 +407,7 @@ class pdf_paiement extends CommonDocGenerator
$parameters = array('file' => $file, 'object' => $this, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -660,6 +660,7 @@ class pdf_squille extends ModelePdfReception
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -586,6 +586,7 @@ class pdf_standard_stock extends ModelePDFStock
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -748,6 +748,7 @@ class pdf_eagle extends ModelePDFStockTransfer
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -820,6 +820,7 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -590,6 +590,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -827,6 +827,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -687,6 +687,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -490,6 +490,7 @@ class pdf_standard_supplierpayment extends ModelePDFSuppliersPayments
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -676,6 +676,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -806,6 +806,7 @@ class pdf_zenith extends ModelePDFSupplierProposal
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -73,6 +73,12 @@ abstract class DolibarrTriggers
*/
public $errors;
/**
* Warnings reported by the trigger
* @var string[]
*/
public $warnings;
/**
* @var string module is in development
* @deprecated Use self::VERSIONS

View file

@ -19,16 +19,10 @@
/**
* \file core/triggers/interface_99_modWebhook_WebhookTriggers.class.php
* \ingroup webhook
* \brief Example trigger.
* \brief Trigger for webhook module.
*
* Put detailed description here.
*
* \remarks You can create other triggers by copying this one.
* - File name should be either:
* - interface_99_modWebhook_MyTrigger.class.php
* - interface_99_all_MyTrigger.class.php
* - The file must stay in core/triggers
* - The class name must be InterfaceMytrigger
* This trigger check the setup of the module WebHook. If a target exists for the trigger action code,
* a JSON message is sent.
*/
require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
@ -81,7 +75,8 @@ class InterfaceWebhookTriggers extends DolibarrTriggers
$errors = 0;
$errorforhistory = 0;
$static_object = new Target($this->db);
$target_url = $static_object->fetchAll(); // TODO Replace this with a search with filter on $action trigger to avoid to filter later.
$filter = ''; // TODO Replace this with a search with filter on $action trigger to avoid to filter later.
$target_url = $static_object->fetchAll('', '', 0, 0, $filter);
if (is_numeric($target_url) && $target_url < 0) {
dol_syslog("Error Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
@ -95,7 +90,7 @@ class InterfaceWebhookTriggers extends DolibarrTriggers
}
// Create new instance of db for webhook history save
$dbhistory = getDoliDBInstance($conf->db->type, $conf->db->host, (string) $conf->db->user, $dolibarr_main_db_pass, $conf->db->name, (int) $conf->db->port);
$dbhistory = null;
$sendmanualtriggers = (!empty($object->context['sendmanualtriggers']) ? $object->context['sendmanualtriggers'] : "");
foreach ($target_url as $key => $tmpobject) {
@ -150,7 +145,12 @@ class InterfaceWebhookTriggers extends DolibarrTriggers
}*/
}
if (empty($dbhistory)) {
$dbhistory = getDoliDBInstance($conf->db->type, $conf->db->host, (string) $conf->db->user, $dolibarr_main_db_pass, $conf->db->name, (int) $conf->db->port);
}
$dbhistory->begin();
$triggerhistory = new TriggerHistory($dbhistory);
$triggerhistory->trigger_code = $action;
$triggerhistory->trigger_data = $jsonstr;
@ -158,10 +158,13 @@ class InterfaceWebhookTriggers extends DolibarrTriggers
$triggerhistory->url = $tmpobject->url;
$triggerhistory->error_message = $errormsg;
$triggerhistory->status = ($errorforhistory == 0 ? 1 : -1);
$resql = $triggerhistory->create($user);
if (!$resql) {
$errors++;
$this->errors = array_merge($this->errors, $triggerhistory->errors);
$this->warnings = array_merge($this->warnings, $triggerhistory->warnings);
$dbhistory->rollback();
} else {
$dbhistory->commit();
@ -169,7 +172,10 @@ class InterfaceWebhookTriggers extends DolibarrTriggers
}
}
$dbhistory->close();
if ($dbhistory) {
$dbhistory->close();
}
dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id." -> nbPost=".$nbPosts);
if (!empty($errors)) {

View file

@ -1,5 +1,5 @@
-- ===================================================================
-- Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2007-2025 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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
@ -20,19 +20,19 @@ CREATE TABLE llx_blockedlog
(
-- fields included into signature
rowid integer AUTO_INCREMENT PRIMARY KEY, -- field included into line signature
entity integer DEFAULT 1 NOT NULL, -- field included into line signature
date_creation datetime, -- field included into line signature
action varchar(50), -- The type of event. field included into line signature
entity integer DEFAULT 1 NOT NULL, -- field included into line signature
date_creation datetime, -- field included into line signature
action varchar(50), -- The type of event. field included into line signature
amounts double(24,8) NOT NULL, -- field included into line signature (denormalized data from object_data)
ref_object varchar(255), -- field included into line signature (denormalized data from object_data)
date_object datetime, -- field included into line signature (denormalized data from object_data)
user_fullname varchar(255), -- field included into line signature (denormalized data from object_data)
object_data mediumtext, -- field included into line signature
linktoref varchar(255), -- Link to ref. field included into line signature
linktype varchar(16), -- Link type. field included into line signature
ref_object varchar(255), -- field included into line signature (denormalized data from object_data)
date_object datetime, -- field included into line signature (denormalized data from object_data)
user_fullname varchar(255), -- field included into line signature (denormalized data from object_data)
object_data mediumtext, -- field included into line signature
linktoref varchar(255), -- Link to ref. field included into line signature
linktype varchar(16), -- Link type. field included into line signature
-- the signature of line
signature varchar(100) NOT NULL, -- the hash of the key for signature with previous hash before
-- fields used for debug only or to retreive link to more complete business events
-- fields used for debug only
element varchar(50),
fk_user integer,
fk_object integer,

View file

@ -74,7 +74,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EX
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_blockedlog FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_blockedlog_authority FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bordereau_cheque FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_boxes_def FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_c_email_templates FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View file

@ -270,6 +270,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
*
***************************************************************************************/
dol_syslog("Process upgrade2 (step common to all entities)");
// Force to execute this at begin to avoid the new core code into Dolibarr to be broken.
$sql = 'ALTER TABLE '.MAIN_DB_PREFIX.'user ADD COLUMN birth date';
$db->query($sql, 1);
@ -298,7 +300,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
$db->begin();
foreach ($listofentities as $entity) {
dol_syslog("Process upgrade2 for entity ".$entity);
dol_syslog("Process upgrade2 (step a) for entity ".$entity);
// Set $conf context for entity
$conf->setEntityValues($db, $entity);
@ -313,7 +315,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
$versiontoarray = array();
$versionranarray = array();
dol_syslog("Process upgrade2 d for entity ".$entity);
dol_syslog("Process upgrade2 (step b) for entity ".$entity);
if (!$error) {
if (count($listofentities) > 1) {

View file

@ -16,7 +16,7 @@ FileCheck=Fileset integrity check
FileCheckDesc=This tool checks the integrity of your files and application setup by comparing each file with the official version. It also verifies certain setup constants. Use this tool to detect if any files have been modified (e.g., by a hacker).
FileIntegrityIsStrictlyConformedWithReference=File integrity strictly matches the reference.
FileIntegrityIsOkButFilesWereAdded=File integrity check passed, but some new files were added.
FileIntegrityIsKO=File integrity check failed, some files were modified or removed. See the detail lower...
FileIntegrityIsKO=The check of file integrity has failed, some files were modified or removed. See the detail lower...
FileIntegritySomeFilesWereRemovedOrModified=File integrity check failed: some files were modified, removed, or added.
GlobalChecksum=Global checksum
MakeIntegrityAnalysisFrom=Perform integrity analysis of application files from
@ -26,7 +26,7 @@ FilesMissing=Missing files
FilesUpdated=Updated files
FilesModified=Modified files
FilesAdded=Added files
FileCheckDolibarr=Check application file integrity
FileCheckDolibarr=Files integrity
AvailableOnlyOnPackagedVersions=Local integrity file is only available for packaged installations. Use the remote signature if unavailable.
XmlNotFound=Application XML integrity file not found
SessionId=Session ID

View file

@ -171,3 +171,5 @@ Printers=Printers
PrintOn=Print on printer %s
SentToPrinter=Sent to printer
FailedToSendToPrinter=Failed to send to printer
TemporaryReceipt=Temporary
SignatureID=Signature ID

View file

@ -817,6 +817,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -628,6 +628,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$this->warnings = $hookmanager->warnings;
if ($reshook < 0) {
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;

View file

@ -148,10 +148,10 @@ if ($pay == 'cheque') {
$paycode = 'CHQ'; // For backward compatibility
}
// Retrieve paiementid
// Retrieve paiementid and paiementcode
$paiementid = 0;
if ($paycode) {
$sql = "SELECT id FROM ".MAIN_DB_PREFIX."c_paiement";
$sql = "SELECT id, code FROM ".MAIN_DB_PREFIX."c_paiement";
$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
$sql .= " AND code = '".$db->escape($paycode)."'";
$resql = $db->query($sql);
@ -244,6 +244,8 @@ if (empty($reshook)) {
$invoice = new Facture($db);
$invoice->fetch($placeid);
$invoice->oldcopy = dol_clone($invoice, 2);
$db->begin();
if ($invoice->total_ttc < 0) {
@ -338,18 +340,25 @@ if (empty($reshook)) {
// We do not set $payments->multicurrency_amounts because we want payment to be in main currency.
$payment->paiementid = $paiementid;
$payment->paiementcode = $paycode;
$payment->num_payment = $invoice->ref;
if ($pay != "delayed") {
$res = $payment->create($user);
$res = $payment->create($user); // This record payment and regenerate the PDF
if ($res < 0) {
$error++;
dol_htmloutput_errors($langs->trans('Error').' '.$payment->error, $payment->errors, 1);
//setEventMessages($payment->error, $payment->errors, 'error');
dol_htmloutput_mesg($payment->error, $payment->errors, 'error', 1);
} else {
//setEventMessages(null, $payment->warnings, 'warnings');
if (!empty($payment->warnings)) {
dol_htmloutput_mesg(null, $payment->warnings, 'warning', 1);
}
$res = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
if ($res < 0) {
$error++;
dol_htmloutput_errors($langs->trans('ErrorNoPaymentDefined').' '.$payment->error, $payment->errors, 1);
dol_htmloutput_mesg($langs->trans('ErrorNoPaymentDefined').' '.$payment->error, $payment->errors, 'error', 1);
}
}
$remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded
@ -364,6 +373,7 @@ if (empty($reshook)) {
if ($result > 0) {
$invoice->paye = 1;
$invoice->status = $invoice::STATUS_CLOSED;
$invoice->close_code = '';
}
// set payment method
$invoice->setPaymentMethods($paiementid);
@ -374,6 +384,7 @@ if (empty($reshook)) {
dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
}
$warehouseid = 0;
// Update stock for batch products
if (!$error && $res >= 0) {
@ -422,6 +433,11 @@ if (empty($reshook)) {
if (!$error && $res >= 0) {
$db->commit();
} else {
$invoice->ref = $invoice->oldcopy->ref;
$invoice->paye = $invoice->oldcopy->paye;
$invoice->status = $invoice->oldcopy->status;
$invoice->statut = $invoice->oldcopy->statut;
$db->rollback();
}
}
@ -1321,34 +1337,36 @@ if (empty($reshook)) {
$customprinttemplateallowed = false; // Custom printer may be allowed if mandatory information in template are guaranteed. For the moment, we prefer not allow this.
}
if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) {
$sectionwithinvoicelink .= ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">'.$langs->trans("Invoice").'</a>';
} elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
// Used when the external addon takeposconnector is installed. Deprecated.
if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.')">'.$langs->trans('PrintTicket').'</button>';
if ($invoice->status == $invoice::STATUS_CLOSED) {
if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) {
$sectionwithinvoicelink .= ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">'.$langs->trans("Invoice").'</a>';
} elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
// Used when the external addon takeposconnector is installed. Deprecated.
if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.')">'.$langs->trans('PrintTicket').'</button>';
} else {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposPrinting('.$placeid.')">'.$langs->trans('PrintTicket').'</button>';
}
} elseif ($customprinterallowed && (isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { // @phpstan-ignore-line
// If we set to use a specific receipt printer
$nameOfPrinter = dol_getIdFromCode($db, getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term), 'printer_receipt', 'rowid', 'name', 1);
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="DolibarrTakeposPrinting('.$placeid.')" title="'.dolPrintHTMLForAttribute($langs->trans("SentToPrinter").' '.$nameOfPrinter).'">'.$langs->trans('PrintTicket').'</button>';
} else {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposPrinting('.$placeid.')">'.$langs->trans('PrintTicket').'</button>';
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="Print('.$placeid.')">'.$langs->trans('PrintTicket').'</button>';
if (getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS')) {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="PrintBox('.$placeid.', \'without_details\')">'.$langs->trans('PrintWithoutDetails').'</button>';
}
if (getDolGlobalString('TAKEPOS_GIFT_RECEIPT')) {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="Print('.$placeid.', 1)">'.$langs->trans('GiftReceipt').'</button>';
}
}
} elseif ($customprinterallowed && (isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { // @phpstan-ignore-line
// If we set to use a specific receipt printer
$nameOfPrinter = dol_getIdFromCode($db, getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term), 'printer_receipt', 'rowid', 'name', 1);
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="DolibarrTakeposPrinting('.$placeid.')" title="'.dolPrintHTMLForAttribute($langs->trans("SentToPrinter").' '.$nameOfPrinter).'">'.$langs->trans('PrintTicket').'</button>';
} else {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="Print('.$placeid.')">'.$langs->trans('PrintTicket').'</button>';
if (getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS')) {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="PrintBox('.$placeid.', \'without_details\')">'.$langs->trans('PrintWithoutDetails').'</button>';
if (getDolGlobalString('TAKEPOS_EMAIL_TEMPLATE_INVOICE') && getDolGlobalInt('TAKEPOS_EMAIL_TEMPLATE_INVOICE') > 0) {
$sectionwithinvoicelink .= ' <button id="buttonsend" type="button" onclick="SendTicket('.$placeid.')">'.$langs->trans('SendTicket').'</button>';
}
if (getDolGlobalString('TAKEPOS_GIFT_RECEIPT')) {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="Print('.$placeid.', 1)">'.$langs->trans('GiftReceipt').'</button>';
}
}
if (getDolGlobalString('TAKEPOS_EMAIL_TEMPLATE_INVOICE') && getDolGlobalInt('TAKEPOS_EMAIL_TEMPLATE_INVOICE') > 0) {
$sectionwithinvoicelink .= ' <button id="buttonsend" type="button" onclick="SendTicket('.$placeid.')">'.$langs->trans('SendTicket').'</button>';
}
if ($remaintopay <= 0 && getDolGlobalString('TAKEPOS_AUTO_PRINT_TICKETS') && $action != "history") {
$sectionwithinvoicelink .= '<script type="text/javascript">console.log("Emulate click on #buttonprint"); $("#buttonprint").click();</script>';
if ($remaintopay <= 0 && getDolGlobalString('TAKEPOS_AUTO_PRINT_TICKETS') && $action != "history") {
$sectionwithinvoicelink .= '<script type="text/javascript">console.log("Emulate click on #buttonprint"); $("#buttonprint").click();</script>';
}
}
}
}

View file

@ -30,7 +30,7 @@
*/
// Include main (when file in included into send.php, $action is set and main was already loaded)
// Include the main.inc.php (note: when file is included into send.php, $action is already set and main.inc.php was already loaded)
/**
* @var string $action
*/
@ -249,23 +249,42 @@ if (getDolGlobalString('TAKEPOS_SHOW_CUSTOMER')) {
print "<br>".$langs->trans("Customer").': '.$soc->name;
}
}
// Transaction ID
if (isALNERunningVersion()) {
$unalterablelogid = 'TODO';
print "<br>".$langs->trans("TransactionID").': '.$unalterablelogid.'<br>';
}
// Date
print $langs->trans('Date')." ".dol_print_date($object->date ? $object->date : dol_now(), 'day');
print "<br>".$langs->trans('Date').": ".dol_print_date($object->date ? $object->date : dol_now(), 'day');
// Date of printing
if (isALNERunningVersion() || !getDolGlobalString('TAKEPOS_HIDE_DATE_OF_PRINTING')) {
print "<br>".$langs->trans("DateOfPrinting").': '.dol_print_date(dol_now(), 'dayhour', 'tzuserrel').'<br>';
print "<br>".$langs->trans("DateOfPrinting").': '.dol_print_date(dol_now(), 'dayhour', 'tzuserrel');
}
// Transaction ID
if (isALNERunningVersion() && isModEnabled('blockedlog')) {
if ($object->status == $object::STATUS_CLOSED) {
$unalterablelogid = 'UNDEFINED';
$sql = "SELECT signature FROM ".MAIN_DB_PREFIX."blockedlog";
$sql .= " WHERE action = 'BILL_VALIDATE' AND element = 'facture' AND ref_object = '".$db->escape($object->ref)."'";
$sql .= $db->order('rowid', 'DESC');
$sql .= $db->plimit(1);
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) {
$unalterablelogid = $obj->signature;
}
}
print "<br>".$langs->trans("SignatureID").': '.dol_trunc(strtoupper($unalterablelogid), 10);
}
}
// TODO Show if it is a duplicata
$isADuplicata = $object->pos_print_counter;
if ($isADuplicata) {
print '<b>*** DUPLICATA***</b>'; // Hard coded string
if ($object->status == $object::STATUS_CLOSED) {
if ($isADuplicata) {
print '<br><b>*** DUPLICATA***</b>'; // Hard coded string
}
} else {
print '<br><b>*** '.strtoupper($langs->trans("TemporaryReceipt")).' ***</b>'; // Hard coded string
}
?>
</p>
@ -274,7 +293,7 @@ if ($isADuplicata) {
<table class="centpercent" style="border-top-style: double;">
<thead>
<tr>
<th class="center"><?php print $langs->trans("Label"); ?></th>
<th class="left"><?php print $langs->trans("Label"); ?></th>
<th class="right"><?php print $langs->trans("Qty"); ?></th>
<th class="right"><?php if ($gift != 1) {
print $langs->trans("Price");

View file

@ -991,6 +991,8 @@ th .button {
.maxwidthsearch { /* Max width of column with the search picto */
width: 54px;
min-width: 54px;
padding-left: 4px !important;
padding-right: 4px !important;
}
.valigntop {
vertical-align: top;

View file

@ -1156,6 +1156,8 @@ th .button {
.maxwidthsearch { /* Max width of column with the search picto */
width: 54px;
min-width: 54px;
padding-left: 4px !important;
padding-right: 4px !important;
}
.valigntop {

View file

@ -117,6 +117,16 @@ class WebsitePage extends CommonObject
*/
public $allowed_in_frames;
/**
* @var int Use meta robot tag "index" (else "noindex")
*/
public $index = 1;
/**
* @var string Use meta robot tag "follow" (else "nofollow")
*/
public $follow = 1;
/**
* @var string Disable WAF ('all', 'NOSCANAUDIOFORINJECTION,NOSCANIFRAMEFORINJECTION,NOSCANOBJECTFORINJECTION')
*/

View file

@ -83,6 +83,27 @@ class BlockedLogAndLNETest extends CommonClassTest
}
/**
* testGetNextAutoIncrementId
* This test must be done after a creation of a first record.
*
* @return int
*/
public function testGetNextAutoIncrementId()
{
global $conf,$user,$langs,$db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
print __METHOD__.' db->type = '.$db->type."\n";
$result = $db->getNextAutoIncrementId(MAIN_DB_PREFIX.'blockedlog');
$this->assertGreaterThan(0, $result); // Must be strictlyhigher than 0
print __METHOD__." result=".$result."\n";
}
// TODO Add more tests
// #LNExxx
}

View file

@ -123,6 +123,13 @@ class PgsqlTest extends CommonClassTest
print __METHOD__." result=".$result."\n";
$this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c::TEXT, ','::TEXT) FROM table GROUP BY a.b", 'Test GROUP_CONCAT (with SEPARATOR)');
// Test CREATE TABLE
$sql = "CREATE TABLE llx_blockedlog ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, action varchar(50), amounts real NOT NULL, signature varchar(100) NOT NULL, signature_line varchar(100) NOT NULL, element varchar(50), fk_object integer, ref_object varchar(100), date_object datetime, object_data text, fk_user integer, entity integer DEFAULT 1 NOT NULL, certified integer ) ENGINE=innodb;";
$result = $tmpdb->convertSQLFromMysql($sql);
print __METHOD__." result=".$result."\n";
$this->assertEquals($result, "CREATE TABLE llx_blockedlog ( rowid SERIAL PRIMARY KEY, tms timestamp without time zone DEFAULT now() NOT NULL , action varchar(50), amounts real NOT NULL, signature varchar(100) NOT NULL, signature_line varchar(100) NOT NULL, element varchar(50), fk_object integer, ref_object varchar(100), date_object timestamp, object_data text, fk_user integer, entity integer DEFAULT 1 NOT NULL, certified integer );");
return $result;
}
}