dolibarr  16.0.1
linkedobjectblock.tpl.php
1 <?php
2 /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
3  * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
4  * Copyright (C) 2014 Marcos GarcĂ­a <marcosgdf@gmail.com>
5  * Copyright (C) 2013-2020 Charlene BENKE <charlie@patas-monkey.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
21 // Protection to avoid direct call of template
22 if (empty($conf) || !is_object($conf)) {
23  print "Error, template page can't be called as URL";
24  exit;
25 }
26 
27 print "<!-- BEGIN PHP TEMPLATE mrp/tpl/linkedobjectblock.tpl.php -->\n";
28 
29 global $user, $db;
30 global $noMoreLinkedObjectBlockAfter;
31 
32 $langs = $GLOBALS['langs'];
33 $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
34 $object = $GLOBALS['object'];
35 
36 // Load translation files required by the page
37 $langs->load("bom");
38 
39 $total = 0;
40 $ilink = 0;
41 
42 $mo_static = new Mo($db);
43 $res = $mo_static->fetch($object->id);
44 $TMoChilds = $mo_static->getMoChilds();
45 
46 foreach ($TMoChilds as $key => $objectlink) {
47  $ilink++;
48 
49  $trclass = 'oddeven';
50 
51  echo '<tr class="'.$trclass.'" >';
52  echo '<td class="linkedcol-element" >'.$langs->trans("ManufacturingOrder");
53  if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
54  print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a';
55  }
56  echo '</td>';
57  echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
58 
59  echo '<td class="linkedcol-ref" align="center">';
60  // $result = $product_static->fetch($objectlink->fk_product);
61  print '</td>';
62  echo '<td class="linkedcol-date" align="center">'.dol_print_date($objectlink->date_creation, 'day').'</td>';
63  echo '<td class="linkedcol-amount right">-</td>';
64  echo '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
65  echo '<td class="linkedcol-action right">';
66 
67  // we want to make the link via element_element for delete action
68  $sql = " Select rowid from " . MAIN_DB_PREFIX . "element_element";
69  $sql .= " WHERE fk_source = ". (int) $object->id . " and fk_target = '" . dol_escape_htmltag($key) ."'";
70 
71  $resql = $db->query($sql);
72  $k = 0;
73  if ($resql) {
74  $obj = $db->fetch_object($resql);
75  if ($obj->rowid && $obj->rowid > 0 ) $k = $obj->rowid;
76  }
77  echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=dellink&token=' . newToken() . '&dellinkid=' . $k . '">' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . '</a>';
78  echo '</td>';
79  echo "</tr>\n";
80 }
81 
82 echo "<!-- END PHP TEMPLATE -->\n";
Class for Mo.
Definition: mo.class.php:35
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
newToken()
Return the value of token currently saved into session with name &#39;newtoken&#39;.