diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php
index ec6442c2302..6454c6e814b 100644
--- a/htdocs/core/class/coreobject.class.php
+++ b/htdocs/core/class/coreobject.class.php
@@ -517,7 +517,7 @@ class CoreObject extends CommonObject
$this->db->begin();
$query = $this->set_save_query();
- $query['datec'] = date("Y-m-d H:i:s", $this->datec);
+ $query['datec'] = date("Y-m-d H:i:s", dol_now());
$res = $this->db->insert($this->table_element, $query);
if($res)
diff --git a/htdocs/core/class/listview.class.php b/htdocs/core/class/listview.class.php
index 46a766a1206..c0579a47850 100644
--- a/htdocs/core/class/listview.class.php
+++ b/htdocs/core/class/listview.class.php
@@ -19,21 +19,19 @@
along with this program. If not, see .
*/
-class Listview {
+class Listview
+{
- function __construct(&$db, $id ) {
-
+ function __construct(&$db, $id)
+ {
$this->db = &$db;
-
$this->id = $id;
-
$this->TTotalTmp=array();
-
$this->sql = '';
-
}
- private function init(&$TParam) {
-
+
+ private function init(&$TParam)
+ {
global $conf, $langs;
if(!isset($TParam['hide']))$TParam['hide']=array();
@@ -574,7 +572,7 @@ class Listview {
$this->init($TParam);
- $this->parse_array($THeader, $TField, $TParam,$TField);
+ $this->parse_array($THeader, $TField, $TParam);
list($TTotal, $TTotalGroup)=$this->get_total($TField, $TParam);
$this->renderList($THeader, $TField,$TTotal,$TTotalGroup, $TParam);
@@ -610,13 +608,14 @@ class Listview {
return $sql;
}
- private function parse_array(&$THeader, &$TField, &$TParam, $TField) {
- $first=true;
-
- $this->THideFlip = array_flip($TParam['hide']);
+ private function parse_array(&$THeader, &$TField, &$TParam)
+ {
+ $first = true;
+
+ $this->THideFlip = array_flip($TParam['hide']);
$this->TTotalTmp=array();
- if(empty($TField)) return false;
+ if (empty($TField)) return false;
foreach($TField as $row) {
if($first) {
@@ -844,7 +843,7 @@ class Listview {
$this->TTotalTmp=array();
$this->THideFlip = array_flip($TParam['hide']);
-var_dump($this->sql);
+
$res = $this->db->query($this->sql);
if($res!==false) {
diff --git a/htdocs/inventory/ajax/ajax.inventory.php b/htdocs/inventory/ajax/ajax.inventory.php
index f2f5ef54903..c1f372806c8 100644
--- a/htdocs/inventory/ajax/ajax.inventory.php
+++ b/htdocs/inventory/ajax/ajax.inventory.php
@@ -6,20 +6,23 @@
$get = GETPOST('get');
$put = GETPOST('put');
- switch ($put) {
+ switch ($put)
+ {
case 'qty':
- if (!$user->rights->inventory->write) { echo -1; exit; }
+ if (empty($user->rights->inventory->write)) { echo -1; exit; }
$fk_det_inventory = GETPOST('fk_det_inventory');
$det = new Inventorydet($db);
- if( $det->fetch( $fk_det_inventory)) {
+ if( $det->fetch( $fk_det_inventory))
+ {
$det->qty_view+=GETPOST('qty');
$det->update($user);
echo $det->qty_view;
}
- else {
+ else
+ {
echo -2;
}
@@ -31,17 +34,18 @@
$fk_det_inventory = GETPOST('fk_det_inventory');
$det = new Inventorydet($db);
- if( $det->fetch( $fk_det_inventory)) {
+ if( $det->fetch( $fk_det_inventory))
+ {
$det->new_pmp=price2num(GETPOST('pmp'));
$det->update($user);
echo $det->new_pmp;
}
- else {
+ else
+ {
echo -2;
}
break;
-
}
diff --git a/htdocs/inventory/class/inventory.class.php b/htdocs/inventory/class/inventory.class.php
index 05996d02489..46f27906cc9 100644
--- a/htdocs/inventory/class/inventory.class.php
+++ b/htdocs/inventory/class/inventory.class.php
@@ -573,10 +573,11 @@ class Inventorydet extends CoreObject
/**
* Get object and children from database
*
- * @param int $id id of inventorydet object
+ * @param int $id id of inventorydet object
+ * @param bool $loadChild load children
* @return int
*/
- function fetch($id)
+ function fetch($id, $loadChild = true)
{
$res = parent::fetch($id);
$this->load_product();
diff --git a/htdocs/inventory/inventory.php b/htdocs/inventory/inventory.php
index 7e43c3ce44e..403b148ec2c 100644
--- a/htdocs/inventory/inventory.php
+++ b/htdocs/inventory/inventory.php
@@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$langs->load("stock");
$langs->load("inventory");
-if(!$user->rights->inventory->read) accessforbidden();
+if(empty($user->rights->inventory->read)) accessforbidden();
_action();
@@ -54,7 +54,7 @@ function _action()
switch($action) {
case 'create':
- if (!$user->rights->inventory->create) accessforbidden();
+ if (empty($user->rights->inventory->create)) accessforbidden();
$inventory = new Inventory($db);
@@ -63,7 +63,7 @@ function _action()
break;
case 'confirmCreate':
- if (!$user->rights->inventory->create) accessforbidden();
+ if (empty($user->rights->inventory->create)) accessforbidden();
$inventory = new Inventory($db);
$inventory->set_values($_POST);
diff --git a/htdocs/inventory/list.php b/htdocs/inventory/list.php
index c6846cfc618..2fb1a2b7f31 100644
--- a/htdocs/inventory/list.php
+++ b/htdocs/inventory/list.php
@@ -36,67 +36,59 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$langs->load("stock");
$langs->load("inventory");
-if(!$user->rights->inventory->read) accessforbidden();
-
-_list();
-
-
-function _list()
-{
-
- global $db, $conf, $langs, $user;
+if (empty($user->rights->inventory->read)) accessforbidden();
- llxHeader('',$langs->trans('inventoryListTitle'),'','');
-
- echo '
';
-
- llxFooter('');
-}
\ No newline at end of file
+echo '';
+
+llxFooter('');
+$db->close();
\ No newline at end of file