22if (empty($conf) || !is_object($conf)) {
23 print
"Error, template page can't be called as URL";
27print
"<!-- BEGIN PHP TEMPLATE mrp/tpl/linkedobjectblock.tpl.php -->\n";
29global $user, $db, $hookmanager;
30global $noMoreLinkedObjectBlockAfter;
32$langs = $GLOBALS[
'langs'];
33$linkedObjectBlock = $GLOBALS[
'linkedObjectBlock'];
34$object = $GLOBALS[
'object'];
42if ($object->element ==
'mo') {
43 $mo_static =
new Mo($db);
44 $res = $mo_static->fetch($object->id);
45 $TMoChilds = $mo_static->getMoChilds();
47 $hookmanager->initHooks(
'LinesLinkedObjectBlock');
48 $parameters = array(
'TMoChilds' => $TMoChilds);
49 $reshook = $hookmanager->executeHooks(
'LinesLinkedObjectBlock', $parameters, $object, $action);
50 if (empty($reshook)) {
51 foreach ($TMoChilds as $key => $objectlink) {
56 echo
'<tr class="' . $trclass .
'" >';
57 echo
'<td class="linkedcol-element tdoverflowmax100">' . $langs->trans(
"ManufacturingOrder");
58 if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
59 print
'<a class="objectlinked_importbtn" href="' . $objectlink->getNomUrl(0,
'', 0, 1) .
'&action=selectlines" data-element="' . $objectlink->element .
'" data-id="' . $objectlink->id .
'" > <i class="fa fa-indent"></i> </a';
62 echo
'<td class="linkedcol-name nowraponall" >' . $objectlink->getNomUrl(1) .
'</td>';
64 echo
'<td class="linkedcol-ref center">';
67 echo
'<td class="linkedcol-date center">' .
dol_print_date($objectlink->date_creation,
'day') .
'</td>';
68 echo
'<td class="linkedcol-amount right">-</td>';
69 echo
'<td class="linkedcol-statut right">' . $objectlink->getLibStatut(3) .
'</td>';
70 echo
'<td class="linkedcol-action right">';
73 $sql =
" Select rowid from " . MAIN_DB_PREFIX .
"element_element";
74 $sql .=
" WHERE fk_source = " . (int) $object->id .
" and fk_target = '" .
dol_escape_htmltag($key) .
"'";
76 $resql = $db->query($sql);
79 $obj = $db->fetch_object($resql);
80 if ($obj->rowid && $obj->rowid > 0) {
84 echo
'<a class="reposition" href="' . $_SERVER[
"PHP_SELF"] .
'?id=' . $object->id .
'&action=dellink&token=' . newToken() .
'&dellinkid=' . $k .
'">' .
img_picto($langs->transnoentitiesnoconv(
"RemoveLink"),
'unlink') .
'</a>';
90 $linkedObjectBlock =
dol_sort_array($linkedObjectBlock,
'date',
'desc', 0, 0, 1);
94 foreach ($linkedObjectBlock as $key => $objectlink) {
98 if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
99 $trclass .=
' liste_sub_total';
101 print
'<tr class="'.$trclass.
'" data-element="'.$objectlink->element.
'" data-id="'.$objectlink->id.
'" >';
102 print
'<td class="linkedcol-element tdoverflowmax100">'.$langs->trans(
"ManufacturingOrder");
103 if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
104 $url = DOL_URL_ROOT.
'/mrp/mo_card.php?id='.$objectlink->id;
105 print
'<a class="objectlinked_importbtn" href="'.$url.
'&action=selectlines" data-element="'.$objectlink->element.
'" data-id="'.$objectlink->id.
'" > <i class="fa fa-indent"></i> </a>';
109 print
'<td class="linkedcol-name tdoverflowmax150">'.$objectlink->getNomUrl(1).
'</td>';
110 print
'<td class="linkedcol-ref" >'.$objectlink->ref_client.
'</td>';
111 print
'<td class="linkedcol-date center">'.dol_print_date($objectlink->date_start_planned,
'day').
'</td>';
112 print
'<td class="linkedcol-amount right">-</td>';
113 print
'<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).
'</td>';
114 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>';
119echo
"<!-- END PHP TEMPLATE -->\n";
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...