Work on inventory module debug
This commit is contained in:
parent
f4447f9c87
commit
46ff62fc87
@ -434,7 +434,7 @@ if ($virtualdiffersfromphysical)
|
|||||||
|
|
||||||
|
|
||||||
print '<br />';
|
print '<br />';
|
||||||
if ($conf->global->MAIN_LEVEL_FEATURES >= 2)
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||||
{
|
{
|
||||||
$var=false;
|
$var=false;
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|||||||
@ -4940,23 +4940,31 @@ abstract class CommonObject
|
|||||||
else $sql.= ' WHERE ref = \''.$this->quote($ref).'\'';
|
else $sql.= ' WHERE ref = \''.$this->quote($ref).'\'';
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if($obj = $this->db->fetch_object($res))
|
if ($res)
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
if ($obj = $this->db->fetch_object($res))
|
||||||
$this->set_vars_by_db($obj);
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
$this->set_vars_by_db($obj);
|
||||||
|
|
||||||
$this->datec = $this->db->idate($obj->datec);
|
$this->datec = $this->db->idate($obj->datec);
|
||||||
$this->tms = $this->db->idate($obj->tms);
|
$this->tms = $this->db->idate($obj->tms);
|
||||||
|
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
|
$this->errors[] = $this->error;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$this->errors[] = $this->error;
|
$this->errors[] = $this->error;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -106,14 +106,12 @@ class CoreObject extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function fetch($id, $loadChild = true)
|
public function fetch($id, $loadChild = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
$res = $this->fetchCommon($id);
|
$res = $this->fetchCommon($id);
|
||||||
if($res>0) {
|
if($res>0) {
|
||||||
if ($loadChild) $this->fetchChild();
|
if ($loadChild) $this->fetchChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1265,7 +1265,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inventory
|
// Inventory
|
||||||
if ($conf->global->MAIN_LEVEL_FEATURES >= 2)
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||||
{
|
{
|
||||||
if (! empty($conf->stock->enabled))
|
if (! empty($conf->stock->enabled))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -117,32 +117,37 @@ class modStock extends DolibarrModules
|
|||||||
$this->rights[4][4] = 'mouvement';
|
$this->rights[4][4] = 'mouvement';
|
||||||
$this->rights[4][5] = 'creer';
|
$this->rights[4][5] = 'creer';
|
||||||
|
|
||||||
if ($conf->global->MAIN_LEVEL_FEATURES >= 2) {
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||||
|
|
||||||
$this->rights[5][0] = 1006;
|
$this->rights[5][0] = 1011;
|
||||||
$this->rights[5][1] = 'inventoryReadPermission'; // Permission label
|
$this->rights[5][1] = 'inventoryReadPermission'; // Permission label
|
||||||
$this->rights[5][3] = 0; // Permission by default for new user (0/1)
|
$this->rights[5][3] = 0; // Permission by default for new user (0/1)
|
||||||
$this->rights[5][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[5][4] = 'advance_inventory'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
|
$this->rights[5][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
|
|
||||||
$this->rights[6][0] = 1007;
|
$this->rights[6][0] = 1012;
|
||||||
$this->rights[6][1] = 'inventoryCreatePermission'; // Permission label
|
$this->rights[6][1] = 'inventoryCreatePermission'; // Permission label
|
||||||
$this->rights[6][3] = 0; // Permission by default for new user (0/1)
|
$this->rights[6][3] = 0; // Permission by default for new user (0/1)
|
||||||
$this->rights[6][4] = 'create'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[6][4] = 'advance_inventory'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
|
$this->rights[6][5] = 'create'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
|
|
||||||
$this->rights[7][0] = 1008;
|
$this->rights[7][0] = 1013;
|
||||||
$this->rights[7][1] = 'inventoryWritePermission'; // Permission label
|
$this->rights[7][1] = 'inventoryWritePermission'; // Permission label
|
||||||
$this->rights[7][3] = 0; // Permission by default for new user (0/1)
|
$this->rights[7][3] = 0; // Permission by default for new user (0/1)
|
||||||
$this->rights[7][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[7][4] = 'advance_inventory'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
|
$this->rights[7][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
|
|
||||||
$this->rights[7][0] = 1009;
|
$this->rights[8][0] = 1014;
|
||||||
$this->rights[7][1] = 'inventoryValidatePermission'; // Permission label
|
$this->rights[8][1] = 'inventoryValidatePermission'; // Permission label
|
||||||
$this->rights[7][3] = 0; // Permission by default for new user (0/1)
|
$this->rights[8][3] = 0; // Permission by default for new user (0/1)
|
||||||
$this->rights[7][4] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[8][4] = 'advance_inventory'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
|
$this->rights[8][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
|
|
||||||
$this->rights[7][0] = 1010;
|
$this->rights[9][0] = 1015;
|
||||||
$this->rights[7][1] = 'inventoryChangePMPPermission'; // Permission label
|
$this->rights[9][1] = 'inventoryChangePMPPermission'; // Permission label
|
||||||
$this->rights[7][3] = 0; // Permission by default for new user (0/1)
|
$this->rights[9][3] = 0; // Permission by default for new user (0/1)
|
||||||
$this->rights[7][4] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[9][4] = 'advance_inventory'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
|
$this->rights[9][5] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,5 +43,4 @@ create table llx_fichinter
|
|||||||
note_public text,
|
note_public text,
|
||||||
model_pdf varchar(255),
|
model_pdf varchar(255),
|
||||||
extraparams varchar(255) -- for stock other parameters with json format
|
extraparams varchar(255) -- for stock other parameters with json format
|
||||||
|
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
-- Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
|
-- Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
|
||||||
--
|
--
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
-- it under the terms of the GNU General Public License as published by
|
-- it under the terms of the GNU General Public License as published by
|
||||||
@ -19,13 +19,18 @@
|
|||||||
|
|
||||||
CREATE TABLE llx_inventory
|
CREATE TABLE llx_inventory
|
||||||
(
|
(
|
||||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
datec datetime DEFAULT NULL,
|
entity integer DEFAULT 0,
|
||||||
tms timestamp,
|
ref varchar(48),
|
||||||
fk_warehouse integer DEFAULT 0,
|
datec datetime DEFAULT NULL,
|
||||||
entity integer DEFAULT 0,
|
tms timestamp,
|
||||||
status integer DEFAULT 0,
|
fk_user_author integer, -- user making creation
|
||||||
title varchar(255) NOT NULL,
|
fk_user_modif integer, -- user making last change
|
||||||
date_inventory datetime DEFAULT NULL
|
fk_user_valid integer, -- valideur de la fiche
|
||||||
|
fk_warehouse integer DEFAULT 0,
|
||||||
|
status integer DEFAULT 0,
|
||||||
|
title varchar(255) NOT NULL,
|
||||||
|
date_inventory datetime DEFAULT NULL,
|
||||||
|
import_key varchar(14) -- import key
|
||||||
)
|
)
|
||||||
ENGINE=InnoDB;
|
ENGINE=InnoDB;
|
||||||
|
|||||||
@ -361,9 +361,9 @@ if ($action == 'create')
|
|||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans('inventoryConfirmCreate').'" />';
|
print '<input type="submit" class="button" name="create" value="'.$langs->trans('inventoryConfirmCreate').'" />';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans('inventoryConfirmCreate').'" />';
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
@ -373,7 +373,13 @@ if ($action == 'create')
|
|||||||
if ($action == 'view' || $action == 'edit' || empty($action))
|
if ($action == 'view' || $action == 'edit' || empty($action))
|
||||||
{
|
{
|
||||||
$object = new Inventory($db);
|
$object = new Inventory($db);
|
||||||
$object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
if ($result < 0) dol_print_error($db, $object->error, $object->errors);
|
||||||
|
|
||||||
|
$warehouse = new Entrepot($db);
|
||||||
|
$warehouse->fetch($object->fk_warehouse);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($action == 'changePMP')
|
if($action == 'changePMP')
|
||||||
{
|
{
|
||||||
@ -396,18 +402,17 @@ if ($action == 'view' || $action == 'edit' || empty($action))
|
|||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('RegulateStock'),$langs->trans('ConfirmRegulateStock',$object->getTitle()),'confirm_regulate',array(),'no',1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('RegulateStock'),$langs->trans('ConfirmRegulateStock',$object->getTitle()),'confirm_regulate',array(),'no',1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$warehouse = new Entrepot($db);
|
|
||||||
$warehouse->fetch($object->fk_warehouse);
|
|
||||||
|
|
||||||
print dol_get_fiche_head(inventoryPrepareHead($object, $langs->trans('inventoryOfWarehouse', $warehouse->libelle), empty($action) ? '': '&action='.$action));
|
print dol_get_fiche_head(inventoryPrepareHead($object, $langs->trans('inventoryOfWarehouse', $warehouse->libelle), empty($action) ? '': '&action='.$action));
|
||||||
|
|
||||||
$lines = array();
|
$lines = array();
|
||||||
card_line($object, $lines, $action);
|
card_line($object, $lines, $action);
|
||||||
|
|
||||||
print '<b>'.$langs->trans('inventoryOnDate')." ".$object->getDate('date_inventory').'</b><br><br>';
|
print $langs->trans('Ref')." ".$object->ref.'<br>';
|
||||||
|
print $langs->trans('Date')." ".$object->getDate('date_inventory').'<br><br>';
|
||||||
|
|
||||||
$objectTPL = array(
|
$objectTPL = array(
|
||||||
'id'=> $object->id
|
'id'=> $object->id
|
||||||
|
,'ref'=> $object->ref
|
||||||
,'date_cre' => $object->getDate('date_cre', 'd/m/Y')
|
,'date_cre' => $object->getDate('date_cre', 'd/m/Y')
|
||||||
,'date_maj' => $object->getDate('date_maj', 'd/m/Y H:i')
|
,'date_maj' => $object->getDate('date_maj', 'd/m/Y H:i')
|
||||||
,'fk_warehouse' => $object->fk_warehouse
|
,'fk_warehouse' => $object->fk_warehouse
|
||||||
@ -608,8 +613,8 @@ function _headerList($view)
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<tr style="background-color:#dedede;">
|
<tr style="background-color:#dedede;">
|
||||||
<th align="left" width="20%"> Produit</th>
|
<th class="titlefield"><?php echo $langs->trans('Product'); ?></th>
|
||||||
<th align="center"><?php echo $langs->trans('Warehouse'); ?></th>
|
<th><?php echo $langs->trans('Warehouse'); ?></th>
|
||||||
<?php if (! empty($conf->barcode->enabled)) { ?>
|
<?php if (! empty($conf->barcode->enabled)) { ?>
|
||||||
<th align="center"><?php echo $langs->trans('Barcode'); ?></th>
|
<th align="center"><?php echo $langs->trans('Barcode'); ?></th>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|||||||
@ -69,6 +69,7 @@ class Inventory extends CoreObject
|
|||||||
*/
|
*/
|
||||||
protected $fields=array(
|
protected $fields=array(
|
||||||
'fk_warehouse'=>array('type'=>'integer','index'=>true)
|
'fk_warehouse'=>array('type'=>'integer','index'=>true)
|
||||||
|
,'ref'=>array('type'=>'string','index'=>true)
|
||||||
,'entity'=>array('type'=>'integer','index'=>true)
|
,'entity'=>array('type'=>'integer','index'=>true)
|
||||||
,'status'=>array('type'=>'integer','index'=>true)
|
,'status'=>array('type'=>'integer','index'=>true)
|
||||||
,'date_inventory'=>array('type'=>'date')
|
,'date_inventory'=>array('type'=>'date')
|
||||||
@ -113,7 +114,8 @@ class Inventory extends CoreObject
|
|||||||
if(!$loadChild) $this->withChild = false;
|
if(!$loadChild) $this->withChild = false;
|
||||||
|
|
||||||
$res = parent::fetch($id, $loadChild);
|
$res = parent::fetch($id, $loadChild);
|
||||||
if($res > 0)
|
|
||||||
|
if ($res > 0)
|
||||||
{
|
{
|
||||||
$this->sortDet();
|
$this->sortDet();
|
||||||
$this->amount = 0;
|
$this->amount = 0;
|
||||||
|
|||||||
@ -80,7 +80,7 @@
|
|||||||
<?php echo inventorySelectProducts($object); ?>
|
<?php echo inventorySelectProducts($object); ?>
|
||||||
|
|
||||||
<input class="button" type="submit" value="<?php echo $langs->trans('AddProduct'); ?>" />
|
<input class="button" type="submit" value="<?php echo $langs->trans('AddProduct'); ?>" />
|
||||||
</form>
|
</form><br>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
|
||||||
@ -92,7 +92,7 @@
|
|||||||
<input type="hidden" name="action" value="save" />
|
<input type="hidden" name="action" value="save" />
|
||||||
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
|
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
|
||||||
|
|
||||||
<table width="100%" class="border workstation">
|
<table width="100%" class="noborder workstation">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
_headerList($view);
|
_headerList($view);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user