This commit is contained in:
Laurent Destailleur 2022-07-15 13:41:36 +02:00
parent a55ab27c67
commit af90eb0d02
3 changed files with 8 additions and 3 deletions

View File

@ -2735,8 +2735,10 @@ if ($module == 'initmodule') {
if (empty($forceddirread) && empty($dirread)) {
$result = dol_include_once($pathtoclass);
$stringofinclude = "dol_include_once(".$pathtoclass.")";
} else {
$result = @include_once $dirread.'/'.$pathtoclass;
$stringofinclude = "@include_once ".$dirread.'/'.$pathtoclass;
}
if (class_exists($tabobj)) {
try {
@ -2744,6 +2746,8 @@ if ($module == 'initmodule') {
} catch (Exception $e) {
dol_syslog('Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING);
}
} else {
print '<span class="warning">'.$langs->trans('Failed to find the class '.$tabobj.' despite the '.$stringofinclude).'</warning><br>';
}
if (!empty($tmpobjet)) {
@ -3078,7 +3082,7 @@ if ($module == 'initmodule') {
print '</form>';
} else {
print '<tr><td><span class="warning">'.$langs->trans('Failed to init the object with the new.').'</warning></td></tr>';
print '<span class="warning">'.$langs->trans('Failed to init the object with the new '.$tabobj.'($db)').'</warning>';
}
} catch (Exception $e) {
print $e->getMessage();

View File

@ -44,6 +44,7 @@ MyModuleAboutPage = MyModule about page
#
# Sample page
#
MyModuleArea = Home MyModule
MyPageName = My page name
#

View File

@ -83,8 +83,8 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
if (empty($conf->partnership->enabled)) accessforbidden();
if (empty($permissiontoread)) accessforbidden();
if ($object->id > 0 && $object->fk_member > 0 && $managedfor != 'member') accessforbidden();
if ($object->id > 0 && $object->fk_soc > 0 && $managedfor != 'thirdparty') accessforbidden();
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
/*