';
@@ -3331,9 +3330,13 @@ if ($module == 'initmodule') {
if (empty($firstobjectname)) {
$firstobjectname = $objectname;
}
+ $pictoname = 'generic';
+ if (preg_match('/\$picto\s*=\s*["\']([^"\']+)["\']/', $tmpcontent, $reg)) {
+ $pictoname = $reg[1];
+ }
$head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj='.$objectname;
- $head3[$h][1] = $objectname;
+ $head3[$h][1] = img_picto('', $pictoname, 'class="pictofixedwidth"').$objectname;
$head3[$h][2] = $objectname;
$h++;
}
@@ -3341,7 +3344,7 @@ if ($module == 'initmodule') {
if ($h > 1) {
$head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj=deleteobject';
- $head3[$h][1] =img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("DangerZone");
+ $head3[$h][1] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Dangeddddddd|fffffffffffrZone");
$head3[$h][2] = 'deleteobject';
$h++;
}
@@ -3355,7 +3358,7 @@ if ($module == 'initmodule') {
}
}
- print dol_get_fiche_head($head3, $tabobj, '', -1, ''); // Level 3
+ print dol_get_fiche_head($head3, $tabobj, '', -1, '', 0, '', '', 0, 'forobjectsuffix'); // Level 3
if ($tabobj == 'newobject') {
// New object tab
@@ -3378,8 +3381,8 @@ if ($module == 'initmodule') {
print '
';
print '
';
@@ -3514,7 +3517,14 @@ if ($module == 'initmodule') {
$pathtolib = strtolower($module).'/lib/'.strtolower($module).'.lib.php';
$pathtoobjlib = strtolower($module).'/lib/'.strtolower($module).'_'.strtolower($tabobj).'.lib.php';
- $pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png';
+
+ if (is_object($tmpobject) && property_exists($tmpobject, 'picto')) {
+ $pathtopicto = $tmpobject->picto;
+ $realpathtopicto = '';
+ } else {
+ $pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png';
+ $realpathtopicto = $dirread.'/'.$pathtopicto;
+ }
//var_dump($pathtoclass);
//var_dump($dirread);
@@ -3533,7 +3543,6 @@ if ($module == 'initmodule') {
$realpathtosqlextrakey = $dirread.'/'.$pathtosqlextrakey;
$realpathtolib = $dirread.'/'.$pathtolib;
$realpathtoobjlib = $dirread.'/'.$pathtoobjlib;
- $realpathtopicto = $dirread.'/'.$pathtopicto;
if (empty($realpathtoapi)) { // For compatibility with some old modules
$pathtoapi = strtolower($module).'/class/api_'.strtolower($module).'s.class.php';
@@ -3552,12 +3561,12 @@ if ($module == 'initmodule') {
print '
'.img_picto($langs->trans("Edit"), 'edit').'';
print '
';
// Image
- if (dol_is_file($realpathtopicto)) {
+ if ($realpathtopicto && dol_is_file($realpathtopicto)) {
print '
'.$langs->trans("Image").' :
'.(dol_is_file($realpathtopicto) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).(dol_is_file($realpathtopicto) ? '' : '').'';
//print '
'.img_picto($langs->trans("Edit"), 'edit').'';
print '
';
} elseif (!empty($tmpobject)) {
- print '
'.$langs->trans("Image").' : '.img_picto('', $tmpobject->picto, 'class="pictofixedwidth"');
+ print '
'.$langs->trans("Image").' : '.img_picto('', $tmpobject->picto, 'class="pictofixedwidth"').$tmpobject->picto;
print '
';
}