63 global $user, $langs, $conf;
67 include_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
68 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
70 $bomstatic =
new BOM($this->db);
71 $productstatic =
new Product($this->db);
72 $userstatic =
new User($this->db);
74 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleLatestModifiedBoms", $max));
76 if ($user->hasRight(
'bom',
'read')) {
77 $sql =
"SELECT p.ref as product_ref";
78 $sql .=
", p.rowid as productid";
81 $sql .=
", p.tobatch";
83 $sql .=
", c.date_creation";
87 $sql .=
", c.fk_user_valid";
88 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p";
89 $sql .=
", ".MAIN_DB_PREFIX.
"bom_bom as c";
90 $sql .=
" WHERE c.fk_product = p.rowid";
91 $sql .=
" AND c.entity = ".$conf->entity;
92 $sql .=
" ORDER BY c.tms DESC, c.ref DESC";
93 $sql .= $this->db->plimit($max, 0);
95 $result = $this->db->query($sql);
97 $num = $this->db->num_rows($result);
101 while ($line < $num) {
102 $objp = $this->db->fetch_object($result);
103 $datem = $this->db->jdate($objp->tms);
105 $bomstatic->id = $objp->rowid;
106 $bomstatic->ref = $objp->ref;
107 $bomstatic->status = $objp->status;
109 $productstatic->id = $objp->productid;
110 $productstatic->ref = $objp->product_ref;
111 $productstatic->status = $objp->tosell;
112 $productstatic->status_buy = $objp->tobuy;
113 $productstatic->status_batch = $objp->tobatch;
115 $this->info_box_contents[$line][] = array(
116 'td' =>
'class="nowraponall"',
117 'text' => $bomstatic->getNomUrl(1),
121 $this->info_box_contents[$line][] = array(
122 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
123 'text' => $productstatic->getNomUrl(1),
128 if ($objp->fk_user_valid > 0) {
129 $userstatic->fetch($objp->fk_user_valid);
131 $this->info_box_contents[$line][] = array(
132 'td' =>
'class="right"',
133 'text' => (($objp->fk_user_valid > 0) ? $userstatic->getNomUrl(1) :
''),
138 $this->info_box_contents[$line][] = array(
143 $this->info_box_contents[$line][] = array(
144 'td' =>
'class="right" width="18"',
145 'text' => $bomstatic->LibStatut($objp->status, 3),
152 $this->info_box_contents[$line][0] = array(
153 'td' =>
'class="center"',
154 'text'=>
'<span class="opacitymedium">'.$langs->trans(
"NoRecordedOrders").
'</span>'
158 $this->db->free($result);
160 $this->info_box_contents[0][0] = array(
163 'text' => ($this->db->error().
' sql='.$sql),
167 $this->info_box_contents[0][0] = array(
168 'td' =>
'class="nohover left"',
169 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'