Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into

develop
This commit is contained in:
Laurent Destailleur 2024-09-05 22:44:57 +02:00
commit 40f0173678
5 changed files with 48 additions and 8 deletions

View File

@ -1269,7 +1269,7 @@ if ($action == 'create') {
}
// Title
print '<tr><td'.(!getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Label").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
print '<tr><td'.(!getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
// Full day
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td>';

View File

@ -8281,7 +8281,24 @@ class Form
{
global $conf, $extrafields, $user;
//var_dump($objectdesc); debug_print_backtrace();
// Example of common usage for a link to a thirdparty
// We got this in a modulebuilder form of "MyObject" of module "mymodule".
// ->fields is array( ... "fk_soc" => array("type"=>"integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))" ...)
// $objectdesc = 'Societe'
// $objectfield = 'myobject@mymodule:fk_soc' ('fk_soc' is code to retrieve myobject->fields['fk_soc'])
// We got this when showing an extrafields on resource that is a link to societe
// extrafields 'link_to_societe' of Resource is 'link' to 'Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))" ...)'
// $objectdesc = 'Societe'
// $objectfield = 'resource:options_link_to_societe'
// With old usage:
// $objectdesc = 'Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))'
// $objectfield = ''
//var_dump($objectdesc.' '.$objectfield);
//debug_print_backtrace();
$objectdescorig = $objectdesc;
$objecttmp = null;

View File

@ -1324,7 +1324,7 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) {
foreach ($arrayofforeignkey as $tmptable => $foreignkeyname) {
if ($table[0] == $tmptable) {
print '<tr><td colspan="2">';
$sqltmp = 'ALTER TABLE '.$db->sanitize($table[0]).' DROP FOREIGN KEY '.$db->sanitize($foreignkeyname);
$sqltmp = "ALTER TABLE ".$db->sanitize($table[0])." DROP FOREIGN KEY ".$db->sanitize($foreignkeyname);
print $sqltmp;
if ($force_utf8_on_tables == 'confirmed') {
$resqltmp = $db->query($sqltmp);
@ -1371,7 +1371,7 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) {
// Restore dropped foreign keys
foreach ($foreignkeystorestore as $tmptable => $foreignkeyname) {
$stringtofindinline = 'ALTER TABLE .* ADD CONSTRAINT '.$db->sanitize($foreignkeyname);
$stringtofindinline = "ALTER TABLE .* ADD CONSTRAINT ".$db->sanitize($foreignkeyname);
$fileforkeys = DOL_DOCUMENT_ROOT.'/install/mysql/tables/'.$tmptable.'.key.sql';
//print 'Search in '.$fileforkeys.' to get '.$stringtofindinline."<br>\n";
@ -1448,7 +1448,7 @@ if ($ok && GETPOST('force_utf8mb4_on_tables', 'alpha')) {
foreach ($arrayofforeignkey as $tmptable => $foreignkeyname) {
if ($table[0] == $tmptable) {
print '<tr><td colspan="2">';
$sqltmp = 'ALTER TABLE '.$db->sanitize($table[0]).' DROP FOREIGN KEY '.$db->sanitize($foreignkeyname);
$sqltmp = "ALTER TABLE ".$db->sanitize($table[0])." DROP FOREIGN KEY ".$db->sanitize($foreignkeyname);
print $sqltmp;
if ($force_utf8mb4_on_tables == 'confirmed') {
$resqltmp = $db->query($sqltmp);
@ -1495,7 +1495,7 @@ if ($ok && GETPOST('force_utf8mb4_on_tables', 'alpha')) {
// Restore dropped foreign keys
foreach ($foreignkeystorestore as $tmptable => $foreignkeyname) {
$stringtofindinline = 'ALTER TABLE .* ADD CONSTRAINT '.$db->sanitize($foreignkeyname);
$stringtofindinline = "ALTER TABLE .* ADD CONSTRAINT ".$db->sanitize($foreignkeyname);
$fileforkeys = DOL_DOCUMENT_ROOT.'/install/mysql/tables/'.$tmptable.'.key.sql';
//print 'Search in '.$fileforkeys.' to get '.$stringtofindinline."<br>\n";

View File

@ -1633,7 +1633,7 @@ if (!function_exists("llxHeader")) {
}
if (getDolGlobalString('MAIN_OPTIMIZEFORCOLORBLIND')) {
$tmpcsstouse .= ' colorblind-'.strip_tags($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
$tmpcsstouse .= ' colorblind-'.strip_tags(getDolGlobalString('MAIN_OPTIMIZEFORCOLORBLIND'));
}
print '<body id="mainbody" class="'.$tmpcsstouse.'">'."\n";

View File

@ -216,6 +216,25 @@ foreach ($dirsrootforscan as $tmpdirread) {
$i++;
}
/**
* Add management to catch fatal errors - shutdown handler
*
* @return void
*/
function moduleBuilderShutdownFunction()
{
$error = error_get_last();
if ($error && ($error['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR))) {
// Handle the fatal error
echo "Fatal error occurred: {$error['message']} in {$error['file']} on line {$error['line']}";
// If a header was already send, we suppose it is the llx_Header() so we call the llxFooter()
if (headers_sent()) {
llxFooter();
}
}
}
register_shutdown_function("moduleBuilderShutdownFunction");
/**
* Produce copyright replacement string for user
@ -3125,6 +3144,7 @@ if ($dirins && $action == "update_props_module" && !empty(GETPOST('keydescriptio
}
}
/*
* View
*/
@ -4206,9 +4226,10 @@ if ($module == 'initmodule') {
$result = dol_include_once($pathtoclass);
$stringofinclude = "dol_include_once(".$pathtoclass.")";
} else {
$result = @include_once $dirread.'/'.$pathtoclass;
$result = include_once $dirread.'/'.$pathtoclass;
$stringofinclude = "@include_once ".$dirread.'/'.$pathtoclass;
}
if (class_exists($tabobj)) {
try {
$tmpobject = @new $tabobj($db);
@ -4780,7 +4801,9 @@ if ($module == 'initmodule') {
print '<span class="warning">'.$langs->trans('Failed to init the object with the new %s (%s)', $tabobj, (string) $db).'</warning>';
}
} catch (Exception $e) {
print 'ee';
print $e->getMessage();
print 'ff';
}
} else {
if (empty($forceddirread)) {