Skip to content

Commit

Permalink
Move new feature inventory into module stock.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Apr 29, 2017
1 parent f5bdfc4 commit 92b5f8d
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 413 deletions.
4 changes: 2 additions & 2 deletions htdocs/core/class/coreobject.class.php
Expand Up @@ -18,7 +18,7 @@
*/

/**
* \file htdocs/core/class/coreobject.inventory.php
* \file htdocs/core/class/coreobject.class.php
* \ingroup core
* \brief File of class to manage all object. Might be replace or merge into commonobject
*/
Expand Down Expand Up @@ -663,7 +663,7 @@ public function setValues(&$Tab)
}
else
{
$this->{$key} = @stripslashes($value);
$this->{$key} = $value;
}
}

Expand Down
9 changes: 9 additions & 0 deletions htdocs/core/menus/standard/eldy.lib.php
Expand Up @@ -1252,6 +1252,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($conf->supplier_order->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire);
}

// Inventory
if (! empty($conf->stock->enabled))
{
$langs->load("stocks");
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->creer);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->lire);
}

// Expeditions
if (! empty($conf->expedition->enabled))
{
Expand Down
316 changes: 0 additions & 316 deletions htdocs/core/modules/modInventory.class.php

This file was deleted.

84 changes: 84 additions & 0 deletions htdocs/core/modules/modStock.class.php
Expand Up @@ -117,6 +117,90 @@ function __construct($db)
$this->rights[4][4] = 'mouvement';
$this->rights[4][5] = 'creer';

/*
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'inventoryReadPermission'; // Permission label
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'inventoryCreatePermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'create'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'inventoryWritePermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'inventoryValidatePermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'inventoryChangePMPPermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
*/

// Main menu entries
$this->menu = array(); // List of menus to add
$r=0;

/*
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=products', // Put 0 if this is a top menu
'type'=>'left', // This is a Top menu entry
'titre'=>'Inventory',
'mainmenu'=>'products',
'leftmenu'=>'inventory_left',
'url'=>'/inventory/list.php',
'langs'=>'inventory', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>100+$r,
'enabled'=>'$conf->inventory->enabled', // Define condition to show or hide menu entry. Use '$conf->inventory->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->inventory->read', // Use 'perms'=>'$user->rights->inventory->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2
); // 0=Menu for internal users, 1=external users, 2=both
$r++;
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=products,fk_leftmenu=inventory_left', // Put 0 if this is a top menu
'type'=>'left', // This is a Top menu entry
'titre'=>'NewInventory',
'mainmenu'=>'products',
'leftmenu'=>'inventory_left_create',
'url'=>'/inventory/inventory.php?action=create',
'position'=>100+$r,
'enabled'=>'$conf->inventory->enabled', // Define condition to show or hide menu entry. Use '$conf->inventory->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->inventory->create', // Use 'perms'=>'$user->rights->inventory->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2
); // 0=Menu for internal users, 1=external users, 2=both
$r++;
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=products,fk_leftmenu=inventory_left', // Put 0 if this is a top menu
'type'=>'left', // This is a Top menu entry
'titre'=>'ListInventory',
'mainmenu'=>'products',
'leftmenu'=>'inventory_left_list',
'url'=>'/inventory/list.php',
'langs'=>'inventory', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>100+$r,
'enabled'=>'$conf->inventory->enabled', // Define condition to show or hide menu entry. Use '$conf->inventory->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->inventory->read', // Use 'perms'=>'$user->rights->inventory->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2
); // 0=Menu for internal users, 1=external users, 2=both
$r++;
*/

// Menus
//-------
Expand Down
54 changes: 0 additions & 54 deletions htdocs/langs/en_US/inventory.lang

This file was deleted.

49 changes: 49 additions & 0 deletions htdocs/langs/en_US/stocks.lang
Expand Up @@ -146,3 +146,52 @@ ProductStockWarehouseUpdated=Stock limit for alert and desired optimal stock cor
ProductStockWarehouseDeleted=Stock limit for alert and desired optimal stock correctly deleted
AddNewProductStockWarehouse=Set new limit for alert and desired optimal stock
AddStockLocationLine=Decrease quantity then click to add another warehouse for this product

Module104420Name = Inventory
Module104420Desc = Create and manage your inventory
NewInventory=New inventory
inventorySetup = Inventory Setup
inventoryCreatePermission=Create new inventory
inventoryReadPermission=View inventories
inventoryWritePermission=Update inventories
inventoryValidatePermission=Validate inventory
inventoryTitle=Inventory
inventoryListTitle=Inventories
inventoryListEmpty=No inventory in progress
inventoryCreateDelete=Create/Delete inventory
inventoryCreate=Create new
inventoryEdit=Edit
inventoryValidate=Validated
inventoryDraft=Running
inventorySelectWarehouse=Warehouse choice
inventoryConfirmCreate=Create
inventoryOfWarehouse=Inventory for warehouse : %s
inventoryErrorQtyAdd=Error : one quantity is leaser than zero
inventoryMvtStock=By inventory
inventoryWarningProductAlreadyExists=This product is already into list
SelectCategory=Category filter
SelectFournisseur=Supplier filter
inventoryOnDate=Inventory
INVENTORY_DISABLE_VIRTUAL=Allow to not destock child product from a kit on inventory
INVENTORY_USE_MIN_PA_IF_NO_LAST_PA=Use the buy price if no last buy price can be found
INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT=Stock mouvment have date of inventory
inventoryChangePMPPermission=Allow to change PMP value for a product
ColumnNewPMP=New unit PMP
OnlyProdsInStock=Do not add product without stock
TheoricalQty=Theorique qty
TheoricalValue=Theorique qty
LastPA=Last BP
CurrentPA=Curent BP
RealQty=Real Qty
RealValue=Real Value
RegulatedQty=Regulated Qty
AddInventoryProduct=Add product to inventory
AddProduct=Add
ApplyPMP=Apply PMP
FlushInventory=Flush inventory
ConfirmFlushInventory=Do you confirm this action ?
InventoryFlushed=Inventory flushed
ExitEditMode=Exit edition
inventoryDeleteLine=Delete line
RegulateStock=Regulate Stock
ListInventory=List
Expand Up @@ -9,7 +9,7 @@
switch ($put)
{
case 'qty':
if (empty($user->rights->inventory->write)) { echo -1; exit; }
if (empty($user->rights->stock->write)) { echo -1; exit; }

$fk_det_inventory = GETPOST('fk_det_inventory');

Expand All @@ -29,7 +29,7 @@
break;

case 'pmp':
if (!$user->rights->inventory->write || !$user->rights->inventory->changePMP) { echo -1; exit; }
if (!$user->rights->stock->write || !$user->rights->stock->changePMP) { echo -1; exit; }

$fk_det_inventory = GETPOST('fk_det_inventory');

Expand Down

0 comments on commit 92b5f8d

Please sign in to comment.