64 global $user, $langs, $conf;
68 include_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
69 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
71 $bomstatic =
new BOM($this->db);
72 $productstatic =
new Product($this->db);
73 $userstatic =
new User($this->db);
75 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleLatestModifiedBoms", $max));
77 if ($user->hasRight(
'bom',
'read')) {
78 $sql =
"SELECT p.ref as product_ref";
79 $sql .=
", p.rowid as productid";
82 $sql .=
", p.tobatch";
84 $sql .=
", c.date_creation";
88 $sql .=
", c.fk_user_valid";
89 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p";
90 $sql .=
", ".MAIN_DB_PREFIX.
"bom_bom as c";
91 $sql .=
" WHERE c.fk_product = p.rowid";
92 $sql .=
" AND c.entity = ".$conf->entity;
93 $sql .=
" ORDER BY c.tms DESC, c.ref DESC";
94 $sql .= $this->db->plimit($max, 0);
96 $result = $this->db->query($sql);
98 $num = $this->db->num_rows($result);
102 while ($line < $num) {
103 $objp = $this->db->fetch_object($result);
104 $datem = $this->db->jdate($objp->tms);
106 $bomstatic->id = $objp->rowid;
107 $bomstatic->ref = $objp->ref;
108 $bomstatic->status = $objp->status;
110 $productstatic->id = $objp->productid;
111 $productstatic->ref = $objp->product_ref;
112 $productstatic->status = $objp->tosell;
113 $productstatic->status_buy = $objp->tobuy;
114 $productstatic->status_batch = $objp->tobatch;
116 $this->info_box_contents[$line][] = array(
117 'td' =>
'class="nowraponall"',
118 'text' => $bomstatic->getNomUrl(1),
122 $this->info_box_contents[$line][] = array(
123 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
124 'text' => $productstatic->getNomUrl(1),
129 if ($objp->fk_user_valid > 0) {
130 $userstatic->fetch($objp->fk_user_valid);
132 $this->info_box_contents[$line][] = array(
133 'td' =>
'class="right"',
134 'text' => (($objp->fk_user_valid > 0) ? $userstatic->getNomUrl(1) :
''),
139 $this->info_box_contents[$line][] = array(
144 $this->info_box_contents[$line][] = array(
145 'td' =>
'class="right" width="18"',
146 'text' => $bomstatic->LibStatut($objp->status, 3),
153 $this->info_box_contents[$line][0] = array(
154 'td' =>
'class="center"',
155 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"NoRecordedOrders").
'</span>'
159 $this->db->free($result);
161 $this->info_box_contents[0][0] = array(
164 'text' => ($this->db->error().
' sql='.$sql),
168 $this->info_box_contents[0][0] = array(
169 'td' =>
'class="nohover left"',
170 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'