diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php
index 6454c6e814b..92da1604dca 100644
--- a/htdocs/core/class/coreobject.class.php
+++ b/htdocs/core/class/coreobject.class.php
@@ -642,7 +642,7 @@ class CoreObject extends CommonObject
* @param array $Tab Array of values
* @return int
*/
- public function set_values(&$Tab)
+ public function setValues(&$Tab)
{
foreach ($Tab as $key => $value)
{
diff --git a/htdocs/core/js/listview.js b/htdocs/core/js/listview.js
index 0affb264474..d68a7993218 100644
--- a/htdocs/core/js/listview.js
+++ b/htdocs/core/js/listview.js
@@ -90,11 +90,6 @@ function Listview_submitSearch(obj) {
if($form.length>0){
$form.submit();
}
- else{
- //There is no form for search action
- null;
- }
-
}
function Listview_launch_downloadAs(mode,url,token,session_name) {
$('#listviewdAS_export_form').remove();
@@ -145,7 +140,7 @@ $(document).ready(function() {
});
if(typeof $_GET["get-all-for-export"] != "undefined") {
- Listview_launch_downloadAs($_GET["mode"],$_GET["url"],$_GET["token"],$_GET["session_name"]);
+ Listview_launch_downloadAs($_GET['mode'],$_GET['url'],$_GET['token'],$_GET['session_name']);
}
});
diff --git a/htdocs/inventory/class/inventory.class.php b/htdocs/inventory/class/inventory.class.php
index 46f27906cc9..5f172c7c697 100644
--- a/htdocs/inventory/class/inventory.class.php
+++ b/htdocs/inventory/class/inventory.class.php
@@ -93,7 +93,7 @@ class Inventory extends CoreObject
/**
* Function to sort children object
*/
- public function sort_det()
+ public function sortDet()
{
if(!empty($this->Inventorydet)) usort($this->Inventorydet, array('Inventory', 'customSort'));
}
@@ -112,7 +112,7 @@ class Inventory extends CoreObject
$res = parent::fetch($id, $loadChild);
if($res > 0)
{
- $this->sort_det();
+ $this->sortDet();
$this->amount = 0;
if(!empty($this->Inventorydet ))
{
@@ -243,7 +243,7 @@ class Inventory extends CoreObject
* @param array $Tab Array of values
* @return int
*/
- public function set_values(&$Tab)
+ public function setValues(&$Tab)
{
global $langs;
@@ -267,7 +267,7 @@ class Inventory extends CoreObject
}
}
- return parent::set_values($Tab);
+ return parent::setValues($Tab);
}
/**
@@ -296,7 +296,7 @@ class Inventory extends CoreObject
* @param int $fk_warehouse fk_warehouse target
* @return bool
*/
- public function add_product($fk_product, $fk_warehouse=0)
+ public function addProduct($fk_product, $fk_warehouse=0)
{
$k = $this->addChild('Inventorydet');
$det = &$this->Inventorydet[$k];
@@ -309,7 +309,7 @@ class Inventory extends CoreObject
$date = $this->get_date('date_inventory', 'Y-m-d');
if(empty($date)) $date = $this->get_date('datec', 'Y-m-d');
- $det->setStockDate( $date , $fk_warehouse);
+ $det->setStockDate($date, $fk_warehouse);
return true;
}
@@ -327,7 +327,7 @@ class Inventory extends CoreObject
* @param string $inventorycode Inventory code
* @return int <0 if KO, >0 if OK
*/
- public function correct_stock($fk_product, $fk_warehouse, $nbpiece, $movement, $label='', $price=0, $inventorycode='')
+ public function correctStock($fk_product, $fk_warehouse, $nbpiece, $movement, $label='', $price=0, $inventorycode='')
{
global $conf, $user;
@@ -397,7 +397,7 @@ class Inventory extends CoreObject
//$href = dol_buildpath('/inventory/inventory.php?id='.$this->id.'&action=view', 1);
- $res = $this->correct_stock($product->id, $Inventorydet->fk_warehouse, $nbpiece, $movement, $langs->trans('inventoryMvtStock'));
+ $res = $this->correctStock($product->id, $Inventorydet->fk_warehouse, $nbpiece, $movement, $langs->trans('inventoryMvtStock'));
if ($res < 0) return -1;
}
}
@@ -437,14 +437,14 @@ class Inventory extends CoreObject
/**
* Function to add products by default from warehouse and children
*
- * @param $fk_warehouse
- * @param int $fk_category
- * @param int $fk_supplier
- * @param int $only_prods_in_stock
+ * @param int $fk_warehouse id of warehouse
+ * @param int $fk_category id of category
+ * @param int $fk_supplier id of supplier
+ * @param int $only_prods_in_stock only product with stock
*
* @return int
*/
- public function add_products_for($fk_warehouse,$fk_category=0,$fk_supplier=0,$only_prods_in_stock=0)
+ public function addProductsFor($fk_warehouse,$fk_category=0,$fk_supplier=0,$only_prods_in_stock=0)
{
$warehouse = new Entrepot($this->db);
$warehouse->fetch($fk_warehouse);
@@ -469,7 +469,7 @@ class Inventory extends CoreObject
{
while($obj = $this->db->fetch_object($res))
{
- $this->add_product($obj->fk_product, $obj->fk_entrepot);
+ $this->addProduct($obj->fk_product, $obj->fk_entrepot);
}
return 1;
@@ -500,7 +500,7 @@ class Inventory extends CoreObject
/**
* Function to get the sql select of inventory
- * @param string $type
+ * @param string $type 'All' to get all data
* @return string
*/
static function getSQL($type)
diff --git a/htdocs/inventory/inventory.php b/htdocs/inventory/inventory.php
index 403b148ec2c..f9297951c22 100644
--- a/htdocs/inventory/inventory.php
+++ b/htdocs/inventory/inventory.php
@@ -33,8 +33,8 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
-$langs->load("stock");
-$langs->load("inventory");
+$langs->load('stock');
+$langs->load('inventory');
if(empty($user->rights->inventory->read)) accessforbidden();
@@ -58,7 +58,7 @@ function _action()
$inventory = new Inventory($db);
- _card_warehouse( $inventory);
+ card_warehouse( $inventory);
break;
@@ -66,17 +66,17 @@ function _action()
if (empty($user->rights->inventory->create)) accessforbidden();
$inventory = new Inventory($db);
- $inventory->set_values($_POST);
+ $inventory->setValues($_POST);
$fk_inventory = $inventory->create($user);
if($fk_inventory>0) {
- $fk_category = (int)GETPOST('fk_category');
- $fk_supplier = (int)GETPOST('fk_supplier');
- $fk_warehouse = (int)GETPOST('fk_warehouse');
- $only_prods_in_stock = (int)GETPOST('OnlyProdsInStock');
+ $fk_category = (int) GETPOST('fk_category');
+ $fk_supplier = (int) GETPOST('fk_supplier');
+ $fk_warehouse = (int) GETPOST('fk_warehouse');
+ $only_prods_in_stock = (int) GETPOST('OnlyProdsInStock');
- $inventory->add_products_for($fk_warehouse,$fk_category,$fk_supplier,$only_prods_in_stock);
+ $inventory->addProductsFor($fk_warehouse,$fk_category,$fk_supplier,$only_prods_in_stock);
$inventory->update($user);
header('Location: '.dol_buildpath('/inventory/inventory.php?id='.$inventory->id.'&action=edit', 1));
@@ -97,7 +97,7 @@ function _action()
$inventory = new Inventory($db);
$inventory->fetch(GETPOST('id'));
- _card($inventory, GETPOST('action'));
+ card($inventory, GETPOST('action'));
break;
@@ -110,12 +110,12 @@ function _action()
$inventory = new Inventory($db);
$inventory->fetch($id);
- $inventory->set_values($_REQUEST);
+ $inventory->setValues($_REQUEST);
if ($inventory->errors)
{
setEventMessage($inventory->errors, 'errors');
- _card( $inventory, 'edit');
+ card( $inventory, 'edit');
}
else
{
@@ -136,12 +136,12 @@ function _action()
$inventory->status = 1;
$inventory->update($user);
- _card( $inventory, 'view');
+ card( $inventory, 'view');
}
else {
- _card( $inventory, 'view');
+ card( $inventory, 'view');
}
break;
@@ -155,7 +155,7 @@ function _action()
$inventory->changePMP($user);
- _card( $inventory, 'view');
+ card( $inventory, 'view');
break;
@@ -192,7 +192,7 @@ function _action()
}
if (!$alreadyExists)
{
- if($inventory->add_product($product->id, $fk_warehouse)) {
+ if($inventory->addProduct($product->id, $fk_warehouse)) {
setEventMessage($langs->trans('ProductAdded'));
}
}
@@ -204,10 +204,10 @@ function _action()
}
$inventory->update($user);
- $inventory->sort_det();
+ $inventory->sortDet();
}
- _card( $inventory, 'edit');
+ card( $inventory, 'edit');
break;
@@ -226,7 +226,7 @@ function _action()
$inventory = new Inventory($db);
$inventory->fetch( $id);
- _card($inventory, 'edit');
+ card($inventory, 'edit');
break;
case 'confirm_flush':
@@ -242,7 +242,7 @@ function _action()
setEventMessage($langs->trans('InventoryFlushed'));
- _card( $inventory, 'edit');
+ card( $inventory, 'edit');
break;
@@ -283,7 +283,7 @@ function _action()
$inventory = new Inventory($db);
$inventory->fetch($id);
- _card($inventory, $action );
+ card($inventory, $action );
break;
@@ -291,7 +291,7 @@ function _action()
}
-function _card_warehouse(&$inventory)
+function card_warehouse(&$inventory)
{
global $langs,$conf,$db, $user, $form;
@@ -346,44 +346,31 @@ function _card_warehouse(&$inventory)
llxFooter('');
}
-function _card(&$inventory, $action='edit')
+function card(&$inventory, $action='edit')
{
global $langs, $conf, $db, $user,$form;
llxHeader('',$langs->trans('inventoryEdit'),'','');
- if($action == 'changePMP') {
-
- print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$inventory->id,$langs->trans('ApplyNewPMP')
- ,$langs->trans('ConfirmApplyNewPMP',$inventory->getTitle()),'confirm_changePMP'
- ,array(),'no',1);
-
+ if($action == 'changePMP')
+ {
+ print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$inventory->id, $langs->trans('ApplyNewPMP'), $langs->trans('ConfirmApplyNewPMP', $inventory->getTitle()), 'confirm_changePMP', array(),'no',1);
}
- else if($action == 'flush') {
-
- print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$inventory->id,$langs->trans('FlushInventory')
- ,$langs->trans('ConfirmFlushInventory',$inventory->getTitle()),'confirm_flush'
- ,array(),'no',1);
-
+ else if($action == 'flush')
+ {
+ print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$inventory->id,$langs->trans('FlushInventory'),$langs->trans('ConfirmFlushInventory',$inventory->getTitle()),'confirm_flush',array(),'no',1);
}
- else if($action == 'delete') {
-
- print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$inventory->id,$langs->trans('Delete')
- ,$langs->trans('ConfirmDelete',$inventory->getTitle()),'confirm_delete'
- ,array(),'no',1);
-
+ else if($action == 'delete')
+ {
+ print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$inventory->id,$langs->trans('Delete'),$langs->trans('ConfirmDelete',$inventory->getTitle()),'confirm_delete',array(),'no',1);
}
- else if($action == 'delete_line') {
- print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$inventory->id.'&rowid='.GETPOST('rowid'),$langs->trans('DeleteLine')
- ,$langs->trans('ConfirmDeleteLine',$inventory->getTitle()),'confirm_delete_line'
- ,array(),'no',1);
-
+ else if($action == 'delete_line')
+ {
+ print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$inventory->id.'&rowid='.GETPOST('rowid'),$langs->trans('DeleteLine'),$langs->trans('ConfirmDeleteLine',$inventory->getTitle()),'confirm_delete_line',array(),'no',1);
}
- else if($action == 'regulate') {
- print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$inventory->id,$langs->trans('RegulateStock')
- ,$langs->trans('ConfirmRegulateStock',$inventory->getTitle()),'confirm_regulate'
- ,array(),'no',1);
-
+ else if($action == 'regulate')
+ {
+ print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$inventory->id,$langs->trans('RegulateStock'),$langs->trans('ConfirmRegulateStock',$inventory->getTitle()),'confirm_regulate',array(),'no',1);
}
$warehouse = new Entrepot($db);
@@ -392,7 +379,7 @@ function _card(&$inventory, $action='edit')
print dol_get_fiche_head(inventoryPrepareHead($inventory, $langs->trans('inventoryOfWarehouse', $warehouse->libelle), empty($action) ? '': '&action='.$action));
$lines = array();
- _card_line($inventory, $lines, $action);
+ card_line($inventory, $lines, $action);
print ''.$langs->trans('inventoryOnDate')." ".$inventory->get_date('date_inventory').'
';
@@ -425,7 +412,7 @@ function _card(&$inventory, $action='edit')
}
-function _card_line(&$inventory, &$lines, $mode)
+function card_line(&$inventory, &$lines, $mode)
{
global $db,$langs,$user,$conf;
$inventory->amount_actual = 0;
@@ -452,25 +439,23 @@ function _card_line(&$inventory, &$lines, $mode)
$qty = (float)GETPOST('qty_to_add')[$k];
$lines[]=array(
- 'produit' => $product->getNomUrl(1).' - '.$product->label
- ,'entrepot'=>$e->getNomUrl(1)
- ,'barcode' => $product->barcode
- ,'qty' =>($mode == 'edit' ? ' '.img_picto($langs->trans('Add'), 'plus16@inventory').'' : '' )
- ,'qty_view' => $Inventorydet->qty_view ? $Inventorydet->qty_view : 0
- ,'qty_stock' => $stock
- ,'qty_regulated' => $Inventorydet->qty_regulated ? $Inventorydet->qty_regulated : 0
- ,'action' => ($user->rights->inventory->write && $mode=='edit' ? ''.img_picto($langs->trans('inventoryDeleteLine'), 'delete').'' : '')
- ,'pmp_stock'=>round($pmp_actual,2)
- ,'pmp_actual'=> round($pmp * $Inventorydet->qty_view,2)
- ,'pmp_new'=>(!empty($user->rights->inventory->changePMP && $mode =='edit') ? ' '.img_picto($langs->trans('Save'), 'bt-save.png@inventory').'' : price($Inventorydet->new_pmp))
- ,'pa_stock'=>round($last_pa * $stock,2)
- ,'pa_actual'=>round($last_pa * $Inventorydet->qty_view,2)
- ,'current_pa_stock'=>round($current_pa * $stock,2)
- ,'current_pa_actual'=>round($current_pa * $Inventorydet->qty_view,2)
-
- ,'k'=>$k
- ,'id'=>$Inventorydet->id
-
+ 'produit' => $product->getNomUrl(1).' - '.$product->label,
+ 'entrepot'=>$e->getNomUrl(1),
+ 'barcode' => $product->barcode,
+ 'qty' =>($mode == 'edit' ? ' '.img_picto($langs->trans('Add'), 'plus16@inventory').'' : '' ),
+ 'qty_view' => ($Inventorydet->qty_view ? $Inventorydet->qty_view : 0),
+ 'qty_stock' => $stock,
+ 'qty_regulated' => ($Inventorydet->qty_regulated ? $Inventorydet->qty_regulated : 0),
+ 'action' => ($user->rights->inventory->write && $mode=='edit' ? ''.img_picto($langs->trans('inventoryDeleteLine'), 'delete').'' : ''),
+ 'pmp_stock'=>round($pmp_actual,2),
+ 'pmp_actual'=> round($pmp * $Inventorydet->qty_view,2),
+ 'pmp_new'=>(!empty($user->rights->inventory->changePMP) && $mode == 'edit' ? ' '.img_picto($langs->trans('Save'), 'bt-save.png@inventory').'' : price($Inventorydet->new_pmp)),
+ 'pa_stock'=>round($last_pa * $stock,2),
+ 'pa_actual'=>round($last_pa * $Inventorydet->qty_view,2),
+ 'current_pa_stock'=>round($current_pa * $stock,2),
+ 'current_pa_actual'=>round($current_pa * $Inventorydet->qty_view,2),
+ 'k'=>$k,
+ 'id'=>$Inventorydet->id
);
}
diff --git a/htdocs/inventory/lib/inventory.lib.php b/htdocs/inventory/lib/inventory.lib.php
index 3cbf03a67c7..767d7416fc7 100644
--- a/htdocs/inventory/lib/inventory.lib.php
+++ b/htdocs/inventory/lib/inventory.lib.php
@@ -20,7 +20,6 @@
* \file lib/inventory.lib.php
* \ingroup inventory
* \brief This file is an example module library
- * Put some comments here
*/
function inventoryAdminPrepareHead()