67 global $user, $langs,
$conf;
71 include_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
72 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
74 $mostatic =
new Mo($this->db);
75 $productstatic =
new Product($this->db);
76 $userstatic =
new User($this->db);
78 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleLatestModifiedMos", $max));
80 if ($user->hasRight(
'mrp',
'read')) {
81 $sql =
"SELECT p.ref as product_ref";
82 $sql .=
", p.rowid as productid";
85 $sql .=
", p.tobatch";
87 $sql .=
", c.date_creation";
91 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p";
92 $sql .=
", ".MAIN_DB_PREFIX.
"mrp_mo as c";
93 $sql .=
" WHERE c.fk_product = p.rowid";
94 $sql .=
" AND c.entity = ".$conf->entity;
95 $sql .=
" ORDER BY c.tms DESC, c.ref DESC";
96 $sql .= $this->db->plimit($max, 0);
98 $result = $this->db->query($sql);
100 $num = $this->db->num_rows($result);
104 while ($line < $num) {
105 $objp = $this->db->fetch_object($result);
106 $datem = $this->db->jdate($objp->tms);
107 $mostatic->id = $objp->rowid;
108 $mostatic->ref = $objp->ref;
109 $mostatic->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' => $mostatic->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' => $mostatic->LibStatut($objp->status, 3),
153 $this->db->free($result);
155 $this->info_box_contents[0][0] = array(
158 'text' => ($this->db->error().
' sql='.$sql),
162 $this->info_box_contents[0][0] = array(
163 'td' =>
'class="nohover left"',
164 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'