Merge pull request #9026 from inoveaconseil/FixExtrafieldResource

Fix extrafields resource
This commit is contained in:
Laurent Destailleur 2018-07-15 20:13:24 +02:00 committed by GitHub
commit e92052353d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View File

@ -58,10 +58,16 @@ else // Old method
if (in_array($extrafields->attribute_type[$key], array('date', 'datetime', 'timestamp'))) if (in_array($extrafields->attribute_type[$key], array('date', 'datetime', 'timestamp')))
{ {
$value = $db->jdate($obj->$tmpkey); $value = $db->jdate($obj->$tmpkey);
if (is_array($obj->array_options) && isset($obj->array_options[$tmpkey])){
$value = $db->jdate($obj->array_options[$tmpkey]);
}
} }
else else
{ {
$value = $obj->$tmpkey; $value = $obj->$tmpkey;
if (is_array($obj->array_options) && isset($obj->array_options[$tmpkey])){
$value = $obj->array_options[$tmpkey];
}
} }
print $extrafields->showOutputField($key, $value, ''); print $extrafields->showOutputField($key, $value, '');
print '</td>'; print '</td>';
@ -74,4 +80,4 @@ else // Old method
} }
} }
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Jean-François Ferry <jfefe@aternatik.fr> /* Copyright (C) 2013-2014 Jean-François Ferry <jfefe@aternatik.fr>
* * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
@ -237,14 +238,14 @@ print "</tr>\n";
if ($ret) if ($ret)
{ {
foreach ($object->lines as $resource) foreach ($object->lines as $obj)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['t.ref']['checked'])) if (! empty($arrayfields['t.ref']['checked']))
{ {
print '<td>'; print '<td>';
print $resource->getNomUrl(5); print $obj->getNomUrl(5);
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -252,7 +253,7 @@ if ($ret)
if (! empty($arrayfields['ty.label']['checked'])) if (! empty($arrayfields['ty.label']['checked']))
{ {
print '<td>'; print '<td>';
print $resource->type_label; print $obj->type_label;
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -260,11 +261,11 @@ if ($ret)
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
print '<td align="center">'; print '<td align="center">';
print '<a href="./card.php?action=edit&id='.$resource->id.'">'; print '<a href="./card.php?action=edit&id='.$obj->id.'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';
print '&nbsp;'; print '&nbsp;';
print '<a href="./card.php?action=delete&id='.$resource->id.'">'; print '<a href="./card.php?action=delete&id='.$obj->id.'">';
print img_delete(); print img_delete();
print '</a>'; print '</a>';
print '</td>'; print '</td>';