From 4993a43025467973b725f45320e577f4edfd75c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Apr 2017 02:15:13 +0200 Subject: [PATCH] Move new feature inventory into module stock. --- htdocs/core/class/coreobject.class.php | 16 +- htdocs/core/class/listview.class.php | 87 ++- htdocs/core/js/listview.js | 20 + htdocs/core/menus/standard/eldy.lib.php | 13 +- htdocs/langs/en_US/stocks.lang | 4 +- .../modulebuilder/skeletons/skeleton_card.php | 12 +- .../product/inventory/ajax/ajax.inventory.php | 4 +- htdocs/product/inventory/card.php | 576 ++++++++++-------- .../inventory/class/inventory.class.php | 7 +- htdocs/product/inventory/list.php | 44 +- .../product/inventory/tpl/inventory.tpl.php | 34 +- 11 files changed, 450 insertions(+), 367 deletions(-) diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php index 384374b1893..8aa0cfe2ad6 100644 --- a/htdocs/core/class/coreobject.class.php +++ b/htdocs/core/class/coreobject.class.php @@ -32,7 +32,7 @@ class CoreObject extends CommonObject /** * @var Array $_fields Fields to synchronize with Database */ - protected $__fields=array(); + protected $fields=array(); /** * Constructor @@ -55,9 +55,9 @@ class CoreObject extends CommonObject $this->datec = 0; $this->tms = 0; - if (!empty($this->__fields)) + if (!empty($this->fields)) { - foreach ($this->__fields as $field=>$info) + foreach ($this->fields as $field=>$info) { if ($this->is_date($info)) $this->{$field} = time(); elseif ($this->is_array($info)) $this->{$field} = array(); @@ -87,9 +87,9 @@ class CoreObject extends CommonObject */ private function checkFieldType($field, $type) { - if (isset($this->__fields[$field]) && method_exists($this, 'is_'.$type)) + if (isset($this->fields[$field]) && method_exists($this, 'is_'.$type)) { - return $this->{'is_'.$type}($this->__fields[$field]); + return $this->{'is_'.$type}($this->fields[$field]); } else { @@ -214,7 +214,7 @@ class CoreObject extends CommonObject private function set_save_query() { $query=array(); - foreach ($this->__fields as $field=>$info) + foreach ($this->fields as $field=>$info) { if($this->is_date($info)) { @@ -260,7 +260,7 @@ class CoreObject extends CommonObject */ private function get_field_list() { - $keys = array_keys($this->__fields); + $keys = array_keys($this->fields); return implode(',', $keys); } @@ -272,7 +272,7 @@ class CoreObject extends CommonObject */ private function set_vars_by_db(&$obj) { - foreach ($this->__fields as $field => $info) + foreach ($this->fields as $field => $info) { if($this->is_date($info)) { diff --git a/htdocs/core/class/listview.class.php b/htdocs/core/class/listview.class.php index dc2dbbcd161..91dd182fc56 100644 --- a/htdocs/core/class/listview.class.php +++ b/htdocs/core/class/listview.class.php @@ -294,15 +294,27 @@ class Listview */ public function render($sql, $TParam=array()) { + global $conf; + $TField=array(); $this->init($TParam); - $THeader = $this->initHeader($TParam); + + $THeader = $this->initHeader($TParam); $sql = $this->search($sql,$TParam); - $sql = $this->order_by($sql, $TParam); + $sql.= $this->db->order($TParam['param']['sortfield'], $TParam['param']['sortorder']); + + $nbtotalofrecords = ''; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $result = $this->db->query($sql); + $nbtotalofrecords = $this->db->num_rows($result); + } + $sql.= $this->db->plimit($TParam['param']['limit'] + 1, $TParam['param']['offset']); + + $this->parse_sql($THeader, $TField, $TParam, $sql); - $this->parse_sql($THeader, $TField, $TParam, $sql); list($TTotal, $TTotalGroup)=$this->get_total($TField, $TParam); return $this->renderList($THeader, $TField, $TTotal, $TTotalGroup, $TParam); @@ -468,6 +480,7 @@ class Listview /** * @return string */ + /* private function getJS() { $javaScript = ' -status != 1) { ?> +status != 1) { ?> trans('AddInventoryProduct'); ?> :
- + - + - +
@@ -90,7 +90,7 @@ - +
- status != 1) { ?> + status != 1) { ?>
- trans('ExportCSV') ?> - trans('Modify') ?> + + trans('Modify') ?> rights->stock->changePMP)) { - echo ''.$langs->trans('ApplyPMP').''; + echo ''.$langs->trans('ApplyPMP').''; } if ($can_validate == 1) { ?> - trans('RegulateStock') ?> + trans('RegulateStock') ?> - + - trans('Flush'); ?> + trans('Flush'); ?>     - trans('Delete') ?> + trans('Delete') ?>
- status == 1) { ?> + status == 1) { ?>
- trans('ExportCSV') ?> + trans('Delete') ?>
-

Date de création : getDate('datec') ?> -
Dernière mise à jour : getDate('tms') ?>

+

Date de création : getDate('datec') ?> +
Dernière mise à jour : getDate('tms') ?>