74 global $user, $langs, $conf;
78 include_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
79 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
81 $bomstatic =
new BOM($this->db);
82 $productstatic =
new Product($this->db);
83 $userstatic =
new User($this->db);
85 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleLatestModifiedBoms", $max));
87 if ($user->rights->bom->read) {
88 $sql =
"SELECT p.ref as product_ref";
89 $sql .=
", p.rowid as productid";
92 $sql .=
", p.tobatch";
94 $sql .=
", c.date_creation";
98 $sql .=
", c.fk_user_valid";
99 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p";
100 $sql .=
", ".MAIN_DB_PREFIX.
"bom_bom as c";
101 $sql .=
" WHERE c.fk_product = p.rowid";
102 $sql .=
" AND c.entity = ".$conf->entity;
103 $sql .=
" ORDER BY c.tms DESC, c.ref DESC";
104 $sql .= $this->db->plimit($max, 0);
106 $result = $this->db->query($sql);
108 $num = $this->db->num_rows($result);
112 while ($line < $num) {
113 $objp = $this->db->fetch_object($result);
114 $datem = $this->db->jdate($objp->tms);
116 $bomstatic->id = $objp->rowid;
117 $bomstatic->ref = $objp->ref;
118 $bomstatic->status = $objp->status;
120 $productstatic->id = $objp->productid;
121 $productstatic->ref = $objp->product_ref;
122 $productstatic->status = $objp->tosell;
123 $productstatic->status_buy = $objp->tobuy;
124 $productstatic->status_batch = $objp->tobatch;
126 $this->info_box_contents[$line][] = array(
127 'td' =>
'class="nowraponall"',
128 'text' => $bomstatic->getNomUrl(1),
132 $this->info_box_contents[$line][] = array(
133 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
134 'text' => $productstatic->getNomUrl(1),
138 if (!empty($conf->global->BOM_BOX_LAST_BOMS_SHOW_VALIDATE_USER)) {
139 if ($objp->fk_user_valid > 0) {
140 $userstatic->fetch($objp->fk_user_valid);
142 $this->info_box_contents[$line][] = array(
143 'td' =>
'class="right"',
144 'text' => (($objp->fk_user_valid > 0) ? $userstatic->getNomUrl(1) :
''),
149 $this->info_box_contents[$line][] = array(
154 $this->info_box_contents[$line][] = array(
155 'td' =>
'class="right" width="18"',
156 'text' => $bomstatic->LibStatut($objp->status, 3),
163 $this->info_box_contents[$line][0] = array(
164 'td' =>
'class="center opacitymedium"',
165 'text'=>$langs->trans(
"NoRecordedOrders")
169 $this->db->free($result);
171 $this->info_box_contents[0][0] = array(
174 'text' => ($this->db->error().
' sql='.$sql),
178 $this->info_box_contents[0][0] = array(
179 'td' =>
'class="nohover opacitymedium left"',
180 'text' => $langs->trans(
"ReadPermissionNotAllowed")