74 global $user, $langs, $conf;
78 include_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
79 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
81 $mostatic =
new Mo($this->db);
82 $productstatic =
new Product($this->db);
83 $userstatic =
new User($this->db);
85 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleLatestModifiedMos", $max));
87 if ($user->hasRight(
'mrp',
'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 .=
" FROM ".MAIN_DB_PREFIX.
"product as p";
99 $sql .=
", ".MAIN_DB_PREFIX.
"mrp_mo as c";
100 $sql .=
" WHERE c.fk_product = p.rowid";
101 $sql .=
" AND c.entity = ".$conf->entity;
102 $sql .=
" ORDER BY c.tms DESC, c.ref DESC";
103 $sql .= $this->db->plimit($max, 0);
105 $result = $this->db->query($sql);
107 $num = $this->db->num_rows($result);
111 while ($line < $num) {
112 $objp = $this->db->fetch_object($result);
113 $datem = $this->db->jdate($objp->tms);
114 $mostatic->id = $objp->rowid;
115 $mostatic->ref = $objp->ref;
116 $mostatic->status = $objp->status;
117 $productstatic->id = $objp->productid;
118 $productstatic->ref = $objp->product_ref;
119 $productstatic->status = $objp->tosell;
120 $productstatic->status_buy = $objp->tobuy;
121 $productstatic->status_batch = $objp->tobatch;
123 $this->info_box_contents[$line][] = array(
124 'td' =>
'class="nowraponall"',
125 'text' => $mostatic->getNomUrl(1),
129 $this->info_box_contents[$line][] = array(
130 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
131 'text' => $productstatic->getNomUrl(1),
136 if ($objp->fk_user_valid > 0) {
137 $userstatic->fetch($objp->fk_user_valid);
139 $this->info_box_contents[$line][] = array(
140 'td' =>
'class="right"',
141 'text' => (($objp->fk_user_valid > 0) ? $userstatic->getNomUrl(1) :
''),
146 $this->info_box_contents[$line][] = array(
151 $this->info_box_contents[$line][] = array(
152 'td' =>
'class="right" width="18"',
153 'text' => $mostatic->LibStatut($objp->status, 3),
160 $this->info_box_contents[$line][0] = array(
161 'td' =>
'class="center"',
162 'text'=>
'<span class="opacitymedium">'.$langs->trans(
"NoRecordedOrders").
'</span>'
166 $this->db->free($result);
168 $this->info_box_contents[0][0] = array(
171 'text' => ($this->db->error().
' sql='.$sql),
175 $this->info_box_contents[0][0] = array(
176 'td' =>
'class="nohover left"',
177 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'