Fix Object Linked MO Line
This commit is contained in:
parent
bc2e226ef8
commit
6dbc57998a
@ -7544,7 +7544,6 @@ class Form
|
|||||||
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0, $selected_input_value = '')
|
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0, $selected_input_value = '')
|
||||||
{
|
{
|
||||||
global $conf, $user;
|
global $conf, $user;
|
||||||
|
|
||||||
$objecttmp = null;
|
$objecttmp = null;
|
||||||
|
|
||||||
// Example of value for $objectdec:
|
// Example of value for $objectdec:
|
||||||
@ -8509,7 +8508,6 @@ class Form
|
|||||||
{
|
{
|
||||||
global $conf, $langs, $hookmanager;
|
global $conf, $langs, $hookmanager;
|
||||||
global $bc, $action;
|
global $bc, $action;
|
||||||
|
|
||||||
$object->fetchObjectLinked();
|
$object->fetchObjectLinked();
|
||||||
|
|
||||||
// Bypass the default method
|
// Bypass the default method
|
||||||
@ -8624,6 +8622,7 @@ class Form
|
|||||||
|
|
||||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||||
$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
|
$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
|
||||||
|
|
||||||
foreach ($dirtpls as $reldir) {
|
foreach ($dirtpls as $reldir) {
|
||||||
if ($nboftypesoutput == ($nbofdifferenttypes - 1)) { // No more type to show after
|
if ($nboftypesoutput == ($nbofdifferenttypes - 1)) { // No more type to show after
|
||||||
global $noMoreLinkedObjectBlockAfter;
|
global $noMoreLinkedObjectBlockAfter;
|
||||||
|
|||||||
@ -39,10 +39,13 @@ $langs->load("bom");
|
|||||||
$total = 0;
|
$total = 0;
|
||||||
$ilink = 0;
|
$ilink = 0;
|
||||||
|
|
||||||
|
if($object->element == 'mo') {
|
||||||
|
|
||||||
$mo_static = new Mo($db);
|
$mo_static = new Mo($db);
|
||||||
$res = $mo_static->fetch($object->id);
|
$res = $mo_static->fetch($object->id);
|
||||||
$TMoChilds = $mo_static->getMoChilds();
|
$TMoChilds = $mo_static->getMoChilds();
|
||||||
|
|
||||||
|
|
||||||
foreach ($TMoChilds as $key => $objectlink) {
|
foreach ($TMoChilds as $key => $objectlink) {
|
||||||
$ilink++;
|
$ilink++;
|
||||||
|
|
||||||
@ -78,5 +81,34 @@ foreach ($TMoChilds as $key => $objectlink) {
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
|
||||||
|
|
||||||
|
$total = 0;
|
||||||
|
$ilink = 0;
|
||||||
|
foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||||
|
$ilink++;
|
||||||
|
|
||||||
|
$trclass = 'oddeven';
|
||||||
|
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
|
||||||
|
$trclass .= ' liste_sub_total';
|
||||||
|
}
|
||||||
|
print '<tr class="'.$trclass.'" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" >';
|
||||||
|
print '<td class="linkedcol-element" >'.$langs->trans("ManufacturingOrder");
|
||||||
|
if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
|
||||||
|
$url = DOL_URL_ROOT.'/mrp/mo_card.php?id='.$objectlink->id;
|
||||||
|
print '<a class="objectlinked_importbtn" href="'.$url.'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
|
||||||
|
print '<td class="linkedcol-ref" >'.$objectlink->ref_client.'</td>';
|
||||||
|
print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date_start_planned, 'day').'</td>';
|
||||||
|
print '<td class="linkedcol-amount right">-</td>';
|
||||||
|
print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
|
||||||
|
print '<td class="linkedcol-action right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&token='.newToken().'&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
echo "<!-- END PHP TEMPLATE -->\n";
|
echo "<!-- END PHP TEMPLATE -->\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user