';
@@ -376,7 +376,7 @@ if ($resql)
// Label
print '| '.$objp->label.' | ';
- if (! empty($conf->service->enabled) && $type == 1)
+ if (!empty($conf->service->enabled) && $type == 1)
{
print '';
if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) print $regs[1].' '.$langs->trans("DurationYear");
diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php
index 1c18627f2cf..0c61ae605c0 100644
--- a/htdocs/product/stock/class/api_stockmovements.class.php
+++ b/htdocs/product/stock/class/api_stockmovements.class.php
@@ -99,47 +99,47 @@ class StockMovements extends DolibarrApi
$obj_ret = array();
- if(! DolibarrApiAccess::$user->rights->stock->lire) {
+ if (!DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
}
$sql = "SELECT t.rowid";
- $sql.= " FROM ".MAIN_DB_PREFIX."stock_mouvement as t";
+ $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as t";
//$sql.= ' WHERE t.entity IN ('.getEntity('stock').')';
- $sql.= ' WHERE 1 = 1';
+ $sql .= ' WHERE 1 = 1';
// Add sql filters
if ($sqlfilters)
{
- if (! DolibarrApi::_checkFilters($sqlfilters))
+ if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
- $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
- $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
+ $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
- $sql.= $db->order($sortfield, $sortorder);
- if ($limit) {
+ $sql .= $db->order($sortfield, $sortorder);
+ if ($limit) {
if ($page < 0)
{
$page = 0;
}
$offset = $limit * $page;
- $sql.= $db->plimit($limit + 1, $offset);
+ $sql .= $db->plimit($limit + 1, $offset);
}
$result = $db->query($sql);
if ($result)
{
- $i=0;
+ $i = 0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
{
$obj = $db->fetch_object($result);
$stockmovement_static = new MouvementStock($db);
- if($stockmovement_static->fetch($obj->rowid)) {
+ if ($stockmovement_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($stockmovement_static);
}
$i++;
@@ -148,7 +148,7 @@ class StockMovements extends DolibarrApi
else {
throw new RestException(503, 'Error when retrieve stock movement list : '.$db->lasterror());
}
- if( ! count($obj_ret)) {
+ if (!count($obj_ret)) {
throw new RestException(404, 'No stock movement found');
}
return $obj_ret;
@@ -177,7 +177,7 @@ class StockMovements extends DolibarrApi
*/
public function post($product_id, $warehouse_id, $qty, $lot = '', $movementcode = '', $movementlabel = '', $price = '', $dlc = '', $dluo = '')
{
- if(! DolibarrApiAccess::$user->rights->stock->creer) {
+ if (!DolibarrApiAccess::$user->rights->stock->creer) {
throw new RestException(401);
}
@@ -187,7 +187,7 @@ class StockMovements extends DolibarrApi
// Type increase or decrease
$type = 2;
- if ($qty >= 0){
+ if ($qty >= 0) {
$type = 3;
}
@@ -195,7 +195,7 @@ class StockMovements extends DolibarrApi
$eatBy = empty($dluo) ? '' : dol_stringtotime($dluo);
$sellBy = empty($dlc) ? '' : dol_stringtotime($dlc);
- if($this->stockmovement->_create(DolibarrApiAccess::$user, $product_id, $warehouse_id, $qty, $type, $price, $movementlabel, $movementcode, '', $eatBy, $sellBy, $lot) <= 0) {
+ if ($this->stockmovement->_create(DolibarrApiAccess::$user, $product_id, $warehouse_id, $qty, $type, $price, $movementlabel, $movementcode, '', $eatBy, $sellBy, $lot) <= 0) {
$errormessage = $this->stockmovement->error;
if (empty($errormessage)) $errormessage = join(',', $this->stockmovement->errors);
throw new RestException(503, 'Error when create stock movement : '.$errormessage);
diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php
index ab3dfde9bf0..40c358967ce 100644
--- a/htdocs/product/stock/class/entrepot.class.php
+++ b/htdocs/product/stock/class/entrepot.class.php
@@ -37,18 +37,18 @@ class Entrepot extends CommonObject
/**
* @var string ID to identify managed object
*/
- public $element='stock';
+ public $element = 'stock';
/**
* @var string Name of table without prefix where object is stored
*/
- public $table_element='entrepot';
+ public $table_element = 'entrepot';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
- public $picto='stock';
- public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
+ public $picto = 'stock';
+ public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
/**
* @var string Label
@@ -102,7 +102,7 @@ class Entrepot extends CommonObject
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
- public $fields=array(
+ public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>10),
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-2, 'showoncombobox'=>1, 'position'=>25),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30),
@@ -181,7 +181,7 @@ class Entrepot extends CommonObject
return 0;
}
- $now=dol_now();
+ $now = dol_now();
$this->db->begin();
@@ -189,7 +189,7 @@ class Entrepot extends CommonObject
$sql .= " VALUES ('".$this->db->escape($this->libelle)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
- $result=$this->db->query($sql);
+ $result = $this->db->query($sql);
if ($result)
{
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."entrepot");
@@ -197,7 +197,7 @@ class Entrepot extends CommonObject
{
$this->id = $id;
- if (! $error)
+ if (!$error)
{
$result = $this->update($id, $user);
if ($result <= 0)
@@ -207,11 +207,11 @@ class Entrepot extends CommonObject
}
// Actions on extra fields
- if (! $error)
+ if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
- $result=$this->insertExtraFields();
+ $result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
@@ -219,7 +219,7 @@ class Entrepot extends CommonObject
}
}
- if (! $error)
+ if (!$error)
{
$this->db->commit();
return $id;
@@ -232,14 +232,14 @@ class Entrepot extends CommonObject
}
}
else {
- $this->error="Failed to get insert id";
+ $this->error = "Failed to get insert id";
dol_syslog(get_class($this)."::create return -2");
return -2;
}
}
else
{
- $this->error=$this->db->error();
+ $this->error = $this->db->error();
dol_syslog(get_class($this)."::create Error ".$this->db->error());
$this->db->rollback();
return -1;
@@ -257,56 +257,56 @@ class Entrepot extends CommonObject
{
global $conf;
- $error=0;
+ $error = 0;
if (empty($id)) $id = $this->id;
// Check if new parent is already a child of current warehouse
- if(!empty($this->fk_parent))
+ if (!empty($this->fk_parent))
{
$TChildWarehouses = array($id);
$TChildWarehouses = $this->get_children_warehouses($this->id, $TChildWarehouses);
- if(in_array($this->fk_parent, $TChildWarehouses))
+ if (in_array($this->fk_parent, $TChildWarehouses))
{
$this->error = 'ErrorCannotAddThisParentWarehouse';
return -2;
}
}
- $this->libelle=trim($this->libelle);
- $this->description=trim($this->description);
+ $this->libelle = trim($this->libelle);
+ $this->description = trim($this->description);
- $this->lieu=trim($this->lieu);
+ $this->lieu = trim($this->lieu);
- $this->address=trim($this->address);
- $this->zip=trim($this->zip);
- $this->town=trim($this->town);
- $this->country_id=($this->country_id > 0 ? $this->country_id : 0);
+ $this->address = trim($this->address);
+ $this->zip = trim($this->zip);
+ $this->town = trim($this->town);
+ $this->country_id = ($this->country_id > 0 ? $this->country_id : 0);
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";
- $sql .= " SET ref = '" . $this->db->escape($this->libelle) ."'";
- $sql .= ", fk_parent = " . (($this->fk_parent > 0) ? $this->fk_parent : "NULL");
- $sql .= ", description = '" . $this->db->escape($this->description) ."'";
- $sql .= ", statut = " . $this->statut;
- $sql .= ", lieu = '" . $this->db->escape($this->lieu) ."'";
- $sql .= ", address = '" . $this->db->escape($this->address) ."'";
- $sql .= ", zip = '" . $this->db->escape($this->zip) ."'";
- $sql .= ", town = '" . $this->db->escape($this->town) ."'";
- $sql .= ", fk_pays = " . $this->country_id;
- $sql .= " WHERE rowid = " . $id;
+ $sql .= " SET ref = '".$this->db->escape($this->libelle)."'";
+ $sql .= ", fk_parent = ".(($this->fk_parent > 0) ? $this->fk_parent : "NULL");
+ $sql .= ", description = '".$this->db->escape($this->description)."'";
+ $sql .= ", statut = ".$this->statut;
+ $sql .= ", lieu = '".$this->db->escape($this->lieu)."'";
+ $sql .= ", address = '".$this->db->escape($this->address)."'";
+ $sql .= ", zip = '".$this->db->escape($this->zip)."'";
+ $sql .= ", town = '".$this->db->escape($this->town)."'";
+ $sql .= ", fk_pays = ".$this->country_id;
+ $sql .= " WHERE rowid = ".$id;
$this->db->begin();
dol_syslog(get_class($this)."::update", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
- if (! $resql) {
+ if (!$resql) {
$error++;
- $this->errors[]="Error ".$this->db->lasterror();
+ $this->errors[] = "Error ".$this->db->lasterror();
}
- if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) {
- $result=$this->insertExtraFields();
+ if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) {
+ $result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
@@ -318,7 +318,7 @@ class Entrepot extends CommonObject
return 1;
} else {
$this->db->rollback();
- $this->error=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
return -1;
}
}
@@ -341,24 +341,24 @@ class Entrepot extends CommonObject
$this->db->begin();
- if (! $error && empty($notrigger))
+ if (!$error && empty($notrigger))
{
// Call trigger
- $result=$this->call_trigger('WAREHOUSE_DELETE', $user);
+ $result = $this->call_trigger('WAREHOUSE_DELETE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
- $elements = array('stock_mouvement','product_stock','product_warehouse_properties');
- foreach($elements as $table)
+ $elements = array('stock_mouvement', 'product_stock', 'product_warehouse_properties');
+ foreach ($elements as $table)
{
- if (! $error)
+ if (!$error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$table;
- $sql.= " WHERE fk_entrepot = " . $this->id;
+ $sql .= " WHERE fk_entrepot = ".$this->id;
- $result=$this->db->query($sql);
- if (! $result)
+ $result = $this->db->query($sql);
+ if (!$result)
{
$error++;
$this->errors[] = $this->db->lasterror();
@@ -367,11 +367,11 @@ class Entrepot extends CommonObject
}
// Removed extrafields
- if (! $error)
+ if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
- $result=$this->deleteExtraFields();
+ $result = $this->deleteExtraFields();
if ($result < 0)
{
$error++;
@@ -380,12 +380,12 @@ class Entrepot extends CommonObject
}
}
- if (! $error)
+ if (!$error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."entrepot";
- $sql.= " WHERE rowid = " . $this->id;
- $resql1=$this->db->query($sql);
- if (! $resql1)
+ $sql .= " WHERE rowid = ".$this->id;
+ $resql1 = $this->db->query($sql);
+ if (!$resql1)
{
$error++;
$this->errors[] = $this->db->lasterror();
@@ -393,12 +393,12 @@ class Entrepot extends CommonObject
}
}
- if (! $error)
+ if (!$error)
{
// Update denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql
$sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET stock = (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)";
- $resql2=$this->db->query($sql);
- if (! $resql2)
+ $resql2 = $this->db->query($sql);
+ if (!$resql2)
{
$error++;
$this->errors[] = $this->db->lasterror();
@@ -406,7 +406,7 @@ class Entrepot extends CommonObject
}
}
- if (! $error)
+ if (!$error)
{
$this->db->commit();
return 1;
@@ -433,9 +433,9 @@ class Entrepot extends CommonObject
dol_syslog(get_class($this)."::fetch id=".$id." ref=".$ref);
// Check parameters
- if (! $id && ! $ref)
+ if (!$id && !$ref)
{
- $this->error='ErrorWrongParameters';
+ $this->error = 'ErrorWrongParameters';
dol_syslog(get_class($this)."::fetch ".$this->error);
return -1;
}
@@ -444,12 +444,12 @@ class Entrepot extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
if ($id)
{
- $sql.= " WHERE rowid = '".$id."'";
+ $sql .= " WHERE rowid = '".$id."'";
}
else
{
- $sql.= " WHERE entity = " .$conf->entity;
- if ($ref) $sql.= " AND ref = '".$this->db->escape($ref)."'";
+ $sql .= " WHERE entity = ".$conf->entity;
+ if ($ref) $sql .= " AND ref = '".$this->db->escape($ref)."'";
}
$result = $this->db->query($sql);
@@ -457,13 +457,13 @@ class Entrepot extends CommonObject
{
if ($this->db->num_rows($result) > 0)
{
- $obj=$this->db->fetch_object($result);
+ $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->fk_parent = $obj->fk_parent;
$this->ref = $obj->label;
$this->label = $obj->label;
- $this->libelle = $obj->label; // deprecated
+ $this->libelle = $obj->label; // deprecated
$this->description = $obj->description;
$this->statut = $obj->statut;
$this->lieu = $obj->lieu;
@@ -477,21 +477,21 @@ class Entrepot extends CommonObject
$this->fetch_optionals();
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
- $tmp=getCountry($this->country_id, 'all');
- $this->country=$tmp['label'];
- $this->country_code=$tmp['code'];
+ $tmp = getCountry($this->country_id, 'all');
+ $this->country = $tmp['label'];
+ $this->country_code = $tmp['code'];
return 1;
}
else
{
- $this->error="Record Not Found";
+ $this->error = "Record Not Found";
return 0;
}
}
else
{
- $this->error=$this->db->error();
+ $this->error = $this->db->error();
return -1;
}
}
@@ -506,11 +506,11 @@ class Entrepot extends CommonObject
public function info($id)
{
$sql = "SELECT e.rowid, e.datec, e.tms as datem, e.fk_user_author";
- $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
- $sql.= " WHERE e.rowid = ".$id;
+ $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
+ $sql .= " WHERE e.rowid = ".$id;
dol_syslog(get_class($this)."::info", LOG_DEBUG);
- $result=$this->db->query($sql);
+ $result = $this->db->query($sql);
if ($result)
{
if ($this->db->num_rows($result))
@@ -522,7 +522,7 @@ class Entrepot extends CommonObject
if ($obj->fk_user_author) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
- $this->user_creation = $cuser;
+ $this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
@@ -557,14 +557,14 @@ class Entrepot extends CommonObject
$liste = array();
$sql = "SELECT rowid, ref as label";
- $sql.= " FROM ".MAIN_DB_PREFIX."entrepot";
- $sql.= " WHERE entity IN (".getEntity('stock').")";
- $sql.= " AND statut = ".$status;
+ $sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
+ $sql .= " WHERE entity IN (".getEntity('stock').")";
+ $sql .= " AND statut = ".$status;
$result = $this->db->query($sql);
$i = 0;
$num = $this->db->num_rows($result);
- if ( $result )
+ if ($result)
{
while ($i < $num)
{
@@ -586,25 +586,25 @@ class Entrepot extends CommonObject
public function nb_different_products()
{
// phpcs:enable
- $ret=array();
+ $ret = array();
$sql = "SELECT count(distinct p.rowid) as nb";
- $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
- $sql.= ", ".MAIN_DB_PREFIX."product as p";
- $sql.= " WHERE ps.fk_entrepot = ".$this->id;
- $sql.= " AND ps.fk_product = p.rowid";
+ $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
+ $sql .= ", ".MAIN_DB_PREFIX."product as p";
+ $sql .= " WHERE ps.fk_entrepot = ".$this->id;
+ $sql .= " AND ps.fk_product = p.rowid";
//print $sql;
$result = $this->db->query($sql);
if ($result)
{
$obj = $this->db->fetch_object($result);
- $ret['nb']=$obj->nb;
+ $ret['nb'] = $obj->nb;
$this->db->free($result);
}
else
{
- $this->error=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
return -1;
}
@@ -620,26 +620,26 @@ class Entrepot extends CommonObject
public function nb_products()
{
// phpcs:enable
- $ret=array();
+ $ret = array();
$sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value";
- $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
- $sql.= ", ".MAIN_DB_PREFIX."product as p";
- $sql.= " WHERE ps.fk_entrepot = ".$this->id;
- $sql.= " AND ps.fk_product = p.rowid";
+ $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
+ $sql .= ", ".MAIN_DB_PREFIX."product as p";
+ $sql .= " WHERE ps.fk_entrepot = ".$this->id;
+ $sql .= " AND ps.fk_product = p.rowid";
//print $sql;
$result = $this->db->query($sql);
if ($result)
{
$obj = $this->db->fetch_object($result);
- $ret['nb']=$obj->nb;
- $ret['value']=$obj->value;
+ $ret['nb'] = $obj->nb;
+ $ret['value'] = $obj->value;
$this->db->free($result);
}
else
{
- $this->error=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
return -1;
}
@@ -695,40 +695,40 @@ class Entrepot extends CommonObject
global $conf, $langs;
$langs->load("stocks");
- if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
+ if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
- $result='';
+ $result = '';
- $label = '' . $langs->trans("ShowWarehouse").'';
- $label.= ' ' . $langs->trans('Ref') . ': ' . (empty($this->ref)?(empty($this->label)?$this->libelle:$this->label):$this->ref);
- if (! empty($this->lieu)) {
- $label.= ' ' . $langs->trans('LocationSummary').': '.$this->lieu;
+ $label = ''.$langs->trans("ShowWarehouse").'';
+ $label .= ' '.$langs->trans('Ref').': '.(empty($this->ref) ? (empty($this->label) ? $this->libelle : $this->label) : $this->ref);
+ if (!empty($this->lieu)) {
+ $label .= ' '.$langs->trans('LocationSummary').': '.$this->lieu;
}
if (isset($this->statut)) {
- $label.= ' ' . $langs->trans("Status").": ".$this->getLibStatut(5);
+ $label .= ' '.$langs->trans("Status").": ".$this->getLibStatut(5);
}
$url = DOL_URL_ROOT.'/product/stock/card.php?id='.$this->id;
- $linkclose='';
+ $linkclose = '';
if (empty($notooltip))
{
- if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
- $label=$langs->trans("ShowWarehouse");
- $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
+ $label = $langs->trans("ShowWarehouse");
+ $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose.=' class="classfortooltip"';
+ $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="classfortooltip"';
}
$linkstart = '';
- $linkend='';
+ $linkstart .= $linkclose.'>';
+ $linkend = '';
$result .= $linkstart;
- if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
- if ($withpicto != 2) $result.= ($showfullpath ? $this->get_full_arbo() : (empty($this->label)?$this->libelle:$this->label));
+ if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ if ($withpicto != 2) $result .= ($showfullpath ? $this->get_full_arbo() : (empty($this->label) ? $this->libelle : $this->label));
$result .= $linkend;
return $result;
@@ -743,23 +743,23 @@ class Entrepot extends CommonObject
*/
public function initAsSpecimen()
{
- global $user,$langs,$conf,$mysoc;
+ global $user, $langs, $conf, $mysoc;
- $now=dol_now();
+ $now = dol_now();
// Initialize parameters
- $this->id=0;
+ $this->id = 0;
$this->libelle = 'WAREHOUSE SPECIMEN';
$this->description = 'WAREHOUSE SPECIMEN '.dol_print_date($now, 'dayhourlog');
- $this->statut=1;
- $this->specimen=1;
+ $this->statut = 1;
+ $this->specimen = 1;
- $this->lieu='Location test';
- $this->address='21 jump street';
- $this->zip='99999';
- $this->town='MyTown';
- $this->country_id=1;
- $this->country_code='FR';
+ $this->lieu = 'Location test';
+ $this->address = '21 jump street';
+ $this->zip = '99999';
+ $this->town = 'MyTown';
+ $this->country_id = 1;
+ $this->country_code = 'FR';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -771,16 +771,16 @@ class Entrepot extends CommonObject
public function get_full_arbo()
{
// phpcs:enable
- global $user,$langs,$conf;
+ global $user, $langs, $conf;
- $TArbo = array(empty($this->label)?$this->libelle:$this->label);
+ $TArbo = array(empty($this->label) ? $this->libelle : $this->label);
- $protection=100; // We limit depth of warehouses to 100
+ $protection = 100; // We limit depth of warehouses to 100
$warehousetmp = new Entrepot($this->db);
- $parentid = $this->fk_parent; // If parent_id not defined on current object, we do not start consecutive searches of parents
- $i=0;
+ $parentid = $this->fk_parent; // If parent_id not defined on current object, we do not start consecutive searches of parents
+ $i = 0;
while ($parentid > 0 && $i < $protection)
{
$sql = 'SELECT fk_parent FROM '.MAIN_DB_PREFIX.'entrepot WHERE rowid = '.$parentid;
@@ -821,8 +821,8 @@ class Entrepot extends CommonObject
WHERE fk_parent = '.$id;
$resql = $this->db->query($sql);
- if($resql) {
- while($res = $this->db->fetch_object($resql)) {
+ if ($resql) {
+ while ($res = $this->db->fetch_object($resql)) {
$TChildWarehouses[] = $res->rowid;
$this->get_children_warehouses($res->rowid, $TChildWarehouses);
}
@@ -843,16 +843,16 @@ class Entrepot extends CommonObject
*/
public function generateDocument($modele, $outputlangs = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
- global $conf,$user,$langs;
+ global $conf, $user, $langs;
$langs->load("stocks");
- if (! dol_strlen($modele)) {
+ if (!dol_strlen($modele)) {
$modele = 'standard';
if ($this->modelpdf) {
$modele = $this->modelpdf;
- } elseif (! empty($conf->global->STOCK_ADDON_PDF)) {
+ } elseif (!empty($conf->global->STOCK_ADDON_PDF)) {
$modele = $conf->global->STOCK_ADDON_PDF;
}
}
@@ -877,12 +877,12 @@ class Entrepot extends CommonObject
$type_categ = Categorie::TYPE_WAREHOUSE;
// Handle single category
- if (! is_array($categories)) {
+ if (!is_array($categories)) {
$categories = array($categories);
}
// Get current categories
- require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$c = new Categorie($this->db);
$existing = $c->containing($this->id, $type_categ, 'id');
@@ -896,7 +896,7 @@ class Entrepot extends CommonObject
}
// Process
- foreach($to_del as $del) {
+ foreach ($to_del as $del) {
if ($c->fetch($del) > 0) {
$c->del_type($this, $type_categ);
}
diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php
index 527afee2607..4b36fda5ccb 100644
--- a/htdocs/product/stock/productlot_list.php
+++ b/htdocs/product/stock/productlot_list.php
@@ -200,52 +200,52 @@ jQuery(document).ready(function() {
$sql = "SELECT";
-$sql.= " t.rowid,";
-$sql.= " t.entity,";
-$sql.= " t.fk_product,";
-$sql.= " t.batch,";
-$sql.= " t.sellby,";
-$sql.= " t.eatby,";
-$sql.= " t.datec as date_creation,";
-$sql.= " t.tms as date_update,";
-$sql.= " t.fk_user_creat,";
-$sql.= " t.fk_user_modif,";
-$sql.= " t.import_key,";
-$sql.= " p.fk_product_type as product_type,";
-$sql.= " p.ref as product_ref,";
-$sql.= " p.label as product_label,";
-$sql.= " p.tosell,";
-$sql.= " p.tobuy,";
-$sql.= " p.tobatch";
+$sql .= " t.rowid,";
+$sql .= " t.entity,";
+$sql .= " t.fk_product,";
+$sql .= " t.batch,";
+$sql .= " t.sellby,";
+$sql .= " t.eatby,";
+$sql .= " t.datec as date_creation,";
+$sql .= " t.tms as date_update,";
+$sql .= " t.fk_user_creat,";
+$sql .= " t.fk_user_modif,";
+$sql .= " t.import_key,";
+$sql .= " p.fk_product_type as product_type,";
+$sql .= " p.ref as product_ref,";
+$sql .= " p.label as product_label,";
+$sql .= " p.tosell,";
+$sql .= " p.tobuy,";
+$sql .= " p.tobatch";
// Add fields for extrafields
-if (! empty($extrafields->attributes[$object->table_element]['label'])) {
- foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
+if (!empty($extrafields->attributes[$object->table_element]['label'])) {
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
// Add fields from hooks
-$parameters=array();
-$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
-$sql.=$hookmanager->resPrint;
-$sql.= " FROM ".MAIN_DB_PREFIX."product_lot as t";
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
-$sql.= ", ".MAIN_DB_PREFIX."product as p";
-$sql.= " WHERE p.rowid = t.fk_product";
-$sql.= " AND p.entity IN (".getEntity('product').")";
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
+$sql .= $hookmanager->resPrint;
+$sql .= " FROM ".MAIN_DB_PREFIX."product_lot as t";
+if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
+$sql .= ", ".MAIN_DB_PREFIX."product as p";
+$sql .= " WHERE p.rowid = t.fk_product";
+$sql .= " AND p.entity IN (".getEntity('product').")";
-if ($search_entity) $sql.= natural_search("entity", $search_entity);
-if ($search_product) $sql.= natural_search("p.ref", $search_product);
-if ($search_batch) $sql.= natural_search("batch", $search_batch);
-if ($search_fk_user_creat) $sql.= natural_search("fk_user_creat", $search_fk_user_creat);
-if ($search_fk_user_modif) $sql.= natural_search("fk_user_modif", $search_fk_user_modif);
-if ($search_import_key) $sql.= natural_search("import_key", $search_import_key);
+if ($search_entity) $sql .= natural_search("entity", $search_entity);
+if ($search_product) $sql .= natural_search("p.ref", $search_product);
+if ($search_batch) $sql .= natural_search("batch", $search_batch);
+if ($search_fk_user_creat) $sql .= natural_search("fk_user_creat", $search_fk_user_creat);
+if ($search_fk_user_modif) $sql .= natural_search("fk_user_modif", $search_fk_user_modif);
+if ($search_import_key) $sql .= natural_search("import_key", $search_import_key);
-if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
+if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
-$parameters=array();
-$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
-$sql.=$hookmanager->resPrint;
-$sql.=$db->order($sortfield, $sortorder);
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
+$sql .= $hookmanager->resPrint;
+$sql .= $db->order($sortfield, $sortorder);
//$sql.= $db->plimit($conf->liste_limit+1, $offset);
// Count total nb of records
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 2fcb012f3c4..613daa18ab0 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -156,7 +156,7 @@ class Task extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task (";
$sql .= "fk_projet";
$sql .= ", ref";
- $sql.= ", entity";
+ $sql .= ", entity";
$sql .= ", fk_task_parent";
$sql .= ", label";
$sql .= ", description";
@@ -169,7 +169,7 @@ class Task extends CommonObject
$sql .= ") VALUES (";
$sql .= $this->fk_project;
$sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null');
- $sql.= ", ".$conf->entity;
+ $sql .= ", ".$conf->entity;
$sql .= ", ".$this->fk_task_parent;
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", '".$this->db->escape($this->description)."'";
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index efaaa5b75ca..291ab4ab949 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -43,7 +43,7 @@ $action = GETPOST('action', 'alpha');
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
-$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
+$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'alpha');
@@ -237,8 +237,8 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel
$object->fetch($id, $ref);
$object->timespent_note = $_POST["timespent_note_line"];
$object->timespent_old_duration = $_POST["old_duration"];
- $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds
- $object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds
+ $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds
+ $object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds
if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered
{
$object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear"));
@@ -387,18 +387,18 @@ if ($action == 'confirm_generateinvoice')
if ($idprod > 0)
{
$tmpproduct->fetch($idprod);
- if ($tmpproduct->duration_unit=='i')
- $prodDurationHours = 1./60;
- if ($tmpproduct->duration_unit=='h')
+ if ($tmpproduct->duration_unit == 'i')
+ $prodDurationHours = 1. / 60;
+ if ($tmpproduct->duration_unit == 'h')
$prodDurationHours = 1.;
- if ($tmpproduct->duration_unit=='d')
+ if ($tmpproduct->duration_unit == 'd')
$prodDurationHours = 24.;
- if ($tmpproduct->duration_unit=='w')
- $prodDurationHours = 24.*7;
- if ($tmpproduct->duration_unit=='m')
- $prodDurationHours = 24.*30;
- if ($tmpproduct->duration_unit=='y')
- $prodDurationHours = 24.*365;
+ if ($tmpproduct->duration_unit == 'w')
+ $prodDurationHours = 24. * 7;
+ if ($tmpproduct->duration_unit == 'm')
+ $prodDurationHours = 24. * 30;
+ if ($tmpproduct->duration_unit == 'y')
+ $prodDurationHours = 24. * 365;
$prodDurationHours *= $tmpproduct->duration_value;
$dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0);
@@ -433,7 +433,7 @@ if ($action == 'confirm_generateinvoice')
if (!$error)
{
- if ($generateinvoicemode=='onelineperuser') {
+ if ($generateinvoicemode == 'onelineperuser') {
$arrayoftasks = array();
foreach ($toselect as $key => $value)
{
@@ -460,7 +460,7 @@ if ($action == 'confirm_generateinvoice')
}
// Add lines
- $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0));
+ $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, round($qtyhour / $prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0));
// Update lineid into line of timespent
$sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id;
@@ -474,7 +474,7 @@ if ($action == 'confirm_generateinvoice')
}
}
}
- elseif ($generateinvoicemode=='onelineperperiod') {
+ elseif ($generateinvoicemode == 'onelineperperiod') {
$arrayoftasks = array();
foreach ($toselect as $key => $value)
{
@@ -504,7 +504,7 @@ if ($action == 'confirm_generateinvoice')
}
// Add lines
- $lineid = $tmpinvoice->addline($value['note'], $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0));
+ $lineid = $tmpinvoice->addline($value['note'], $pu_ht, round($qtyhour / $prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0));
// Update lineid into line of timespent
$sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id;
@@ -518,7 +518,7 @@ if ($action == 'confirm_generateinvoice')
}
}
}
- elseif ($generateinvoicemode=='onelinepertask') {
+ elseif ($generateinvoicemode == 'onelinepertask') {
$arrayoftasks = array();
foreach ($toselect as $key => $value)
{
@@ -545,7 +545,7 @@ if ($action == 'confirm_generateinvoice')
// Add lines
$lineName = $ftask->ref.' - '.$ftask->label;
- $lineid = $tmpinvoice->addline($lineName, $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0));
+ $lineid = $tmpinvoice->addline($lineName, $pu_ht, round($qtyhour / $prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0));
// Update lineid into line of timespent
$sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id;
@@ -1346,7 +1346,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print ' | ';
if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid)
{
- $formproject->selectTasks(-1, GETPOST('taskid', 'int')?GETPOST('taskid', 'int'):$task_time->fk_task, 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, '');
+ $formproject->selectTasks(-1, GETPOST('taskid', 'int') ?GETPOST('taskid', 'int') : $task_time->fk_task, 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, '');
}
else
{
@@ -1392,11 +1392,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
}
else
{
- $userstatic->id = $task_time->fk_user;
+ $userstatic->id = $task_time->fk_user;
$userstatic->lastname = $task_time->lastname;
- $userstatic->firstname = $task_time->firstname;
- $userstatic->photo = $task_time->photo;
- $userstatic->statut = $task_time->user_status;
+ $userstatic->firstname = $task_time->firstname;
+ $userstatic->photo = $task_time->photo;
+ $userstatic->statut = $task_time->user_status;
print $userstatic->getNomUrl(-1);
}
print ' | ';
@@ -1615,11 +1615,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
}
else
{
- $userstatic->id = $task_time->fk_user;
+ $userstatic->id = $task_time->fk_user;
$userstatic->lastname = $task_time->lastname;
- $userstatic->firstname = $task_time->firstname;
- $userstatic->photo = $task_time->photo;
- $userstatic->statut = $task_time->user_status;
+ $userstatic->firstname = $task_time->firstname;
+ $userstatic->photo = $task_time->photo;
+ $userstatic->statut = $task_time->user_status;
print $userstatic->getNomUrl(-1);
}
print '';
@@ -1763,11 +1763,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
}
else
{
- $userstatic->id = $task_time->fk_user;
+ $userstatic->id = $task_time->fk_user;
$userstatic->lastname = $task_time->lastname;
- $userstatic->firstname = $task_time->firstname;
- $userstatic->photo = $task_time->photo;
- $userstatic->statut = $task_time->user_status;
+ $userstatic->firstname = $task_time->firstname;
+ $userstatic->photo = $task_time->photo;
+ $userstatic->statut = $task_time->user_status;
print $userstatic->getNomUrl(-1);
}
print '';
diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php
index 7a962a15b79..c470055dbce 100644
--- a/htdocs/public/demo/index.php
+++ b/htdocs/public/demo/index.php
@@ -24,74 +24,74 @@
* \brief Entry page to access demo
*/
-define("NOLOGIN", 1); // This means this output page does not require to be logged.
-define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
+define("NOLOGIN", 1); // This means this output page does not require to be logged.
+define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
require '../../main.inc.php';
require_once '../../core/lib/functions2.lib.php';
$langs->loadLangs(array("main", "install", "other"));
-$conf->dol_hide_topmenu=GETPOST('dol_hide_topmenu', 'int');
-$conf->dol_hide_leftmenu=GETPOST('dol_hide_leftmenu', 'int');
-$conf->dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen', 'int');
-$conf->dol_no_mouse_hover=GETPOST('dol_no_mouse_hover', 'int');
-$conf->dol_use_jmobile=GETPOST('dol_use_jmobile', 'int');
+$conf->dol_hide_topmenu = GETPOST('dol_hide_topmenu', 'int');
+$conf->dol_hide_leftmenu = GETPOST('dol_hide_leftmenu', 'int');
+$conf->dol_optimize_smallscreen = GETPOST('dol_optimize_smallscreen', 'int');
+$conf->dol_no_mouse_hover = GETPOST('dol_no_mouse_hover', 'int');
+$conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int');
// Security check
global $dolibarr_main_demo;
if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page', 0, 0, 1);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$res=$hookmanager->initHooks(array('demo'));
+$res = $hookmanager->initHooks(array('demo'));
-$demoprofiles=array();
-$alwayscheckedmodules=array();
-$alwaysuncheckedmodules=array();
-$alwayshiddencheckedmodules=array();
-$alwayshiddenuncheckedmodules=array();
+$demoprofiles = array();
+$alwayscheckedmodules = array();
+$alwaysuncheckedmodules = array();
+$alwayshiddencheckedmodules = array();
+$alwayshiddenuncheckedmodules = array();
-$url='';
-$url.=($url?'&':'').($conf->dol_hide_topmenu?'dol_hide_topmenu='.$conf->dol_hide_topmenu:'');
-$url.=($url?'&':'').($conf->dol_hide_leftmenu?'dol_hide_leftmenu='.$conf->dol_hide_leftmenu:'');
-$url.=($url?'&':'').($conf->dol_optimize_smallscreen?'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen:'');
-$url.=($url?'&':'').($conf->dol_no_mouse_hover?'dol_no_mouse_hover='.$conf->dol_no_mouse_hover:'');
-$url.=($url?'&':'').($conf->dol_use_jmobile?'dol_use_jmobile='.$conf->dol_use_jmobile:'');
-$url=DOL_URL_ROOT.'/index.php'.($url?'?'.$url:'');
+$url = '';
+$url .= ($url ? '&' : '').($conf->dol_hide_topmenu ? 'dol_hide_topmenu='.$conf->dol_hide_topmenu : '');
+$url .= ($url ? '&' : '').($conf->dol_hide_leftmenu ? 'dol_hide_leftmenu='.$conf->dol_hide_leftmenu : '');
+$url .= ($url ? '&' : '').($conf->dol_optimize_smallscreen ? 'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen : '');
+$url .= ($url ? '&' : '').($conf->dol_no_mouse_hover ? 'dol_no_mouse_hover='.$conf->dol_no_mouse_hover : '');
+$url .= ($url ? '&' : '').($conf->dol_use_jmobile ? 'dol_use_jmobile='.$conf->dol_use_jmobile : '');
+$url = DOL_URL_ROOT.'/index.php'.($url ? '?'.$url : '');
$tmpaction = 'view';
-$parameters=array();
-$object=new stdClass();
-$reshook=$hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks
-$error=$hookmanager->error; $errors=$hookmanager->errors;
+$parameters = array();
+$object = new stdClass();
+$reshook = $hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks
+$error = $hookmanager->error; $errors = $hookmanager->errors;
if (empty($reshook))
{
- $demoprofiles=array(
- array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly',
+ $demoprofiles = array(
+ array('default'=>'1', 'key'=>'profdemoservonly', 'label'=>'DemoCompanyServiceOnly',
'disablemodules'=>'adherent,barcode,bom,cashdesk,don,expedition,externalsite,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,stock,takepos',
//'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png',
'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-service.jpg',
'url'=>$url
),
- array('default'=>'0', 'key'=>'profmanufacture','label'=>'DemoCompanyManufacturing',
+ array('default'=>'0', 'key'=>'profmanufacture', 'label'=>'DemoCompanyManufacturing',
'disablemodules'=>'adherent,contrat,don,externalsite,ficheinter,ftp,mailmanspip,prelevement,service',
'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-manufacturing.jpg',
'url'=>$url
),
- array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks',
+ array('default'=>'0', 'key'=>'profdemoprodstock', 'label'=>'DemoCompanyProductAndStocks',
'disablemodules'=>'adherent,bom,contrat,don,externalsite,ficheinter,ftp,mailmanspip,mrp,prelevement,service',
//'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png',
'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-product.jpg',
'url'=>$url
),
- array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2',
+ array('default'=>'0', 'key'=>'profdemofun2', 'label'=>'DemoFundation2',
'disablemodules'=>'barcode,cashdesk,bom,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,ficheinter,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,projet,propal,propale,service,societe,stock,tax,takepos',
//'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png',
'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-foundation.jpg',
'url'=>$url
),
// All demo profile
- array('default'=>'0', 'key'=>'profdemoall','label'=>'ChooseYourDemoProfilMore',
+ array('default'=>'0', 'key'=>'profdemoall', 'label'=>'ChooseYourDemoProfilMore',
'disablemodules'=>'adherent,cashdesk,don,externalsite,mailmanspip',
//'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png'
'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-all.jpg'
@@ -100,21 +100,21 @@ if (empty($reshook))
// Visible
- $alwayscheckedmodules=array('barcode','bookmark','categorie','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want
- $alwaysuncheckedmodules=array('dav','dynamicprices','incoterm','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','skype','website'); // Module we dont want by default
+ $alwayscheckedmodules = array('barcode', 'bookmark', 'categorie', 'externalrss', 'fckeditor', 'geoipmaxmind', 'gravatar', 'memcached', 'syslog', 'user', 'webservices'); // Technical module we always want
+ $alwaysuncheckedmodules = array('dav', 'dynamicprices', 'incoterm', 'loan', 'multicurrency', 'paybox', 'paypal', 'stripe', 'google', 'printing', 'scanner', 'skype', 'website'); // Module we dont want by default
// Not visible
- $alwayshiddencheckedmodules=array('accounting','api','barcode','blockedlog','bookmark','clicktodial','comptabilite','cron','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap',
- 'mailmanspip','notification','oauth','syslog','user','webservices','workflow',
+ $alwayshiddencheckedmodules = array('accounting', 'api', 'barcode', 'blockedlog', 'bookmark', 'clicktodial', 'comptabilite', 'cron', 'document', 'domain', 'externalrss', 'externalsite', 'fckeditor', 'geoipmaxmind', 'gravatar', 'label', 'ldap',
+ 'mailmanspip', 'notification', 'oauth', 'syslog', 'user', 'webservices', 'workflow',
// Extended modules
- 'memcached','numberwords','zipautofillfr');
- $alwayshiddenuncheckedmodules=array('dav','debugbar','emailcollector','ftp','hrm','modulebuilder','printing','webservicesclient',
+ 'memcached', 'numberwords', 'zipautofillfr');
+ $alwayshiddenuncheckedmodules = array('dav', 'debugbar', 'emailcollector', 'ftp', 'hrm', 'modulebuilder', 'printing', 'webservicesclient',
// Extended modules
- 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','deplacement','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap',
- 'ovh','phenix','phpsysinfo','pibarcode','postnuke','selectbank','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail');
+ 'awstats', 'bittorrent', 'bootstrap', 'cabinetmed', 'cmcic', 'concatpdf', 'customfield', 'deplacement', 'dolicloud', 'filemanager', 'lightbox', 'mantis', 'monitoring', 'moretemplates', 'multicompany', 'nltechno', 'numberingpack', 'openstreetmap',
+ 'ovh', 'phenix', 'phpsysinfo', 'pibarcode', 'postnuke', 'selectbank', 'skincoloreditor', 'submiteverywhere', 'survey', 'thomsonphonebook', 'topten', 'tvacerfa', 'voyage', 'webcalendar', 'webmail');
}
// Search modules
-$dirlist=$conf->file->dol_document_root;
+$dirlist = $conf->file->dol_document_root;
// Search modules dirs
@@ -132,13 +132,13 @@ $j = 0; // j is module number. Automatically affected if module number not defin
foreach ($modulesdir as $dir)
{
// Charge tableaux modules, nom, numero, orders depuis repertoire dir
- $handle=@opendir($dir);
+ $handle = @opendir($dir);
if (is_resource($handle))
{
- while (($file = readdir($handle))!==false)
+ while (($file = readdir($handle)) !== false)
{
//print "$i ".$file."\n
";
- if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
+ if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10);
@@ -158,25 +158,25 @@ foreach ($modulesdir as $dir)
$j = 1000 + $i;
}
- $modulequalified=1;
+ $modulequalified = 1;
// We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
- if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified=0;
- if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified=0;
+ if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified = 0;
+ if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified = 0;
if ($modulequalified)
{
$modules[$i] = $objMod;
- $filename[$i]= $modName;
- $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module
+ $filename[$i] = $modName;
+ $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module
//print "x".$modName." ".$orders[$i]."\n
";
$dirmod[$i] = $dirroot;
$j++;
$i++;
}
}
- catch(Exception $e)
+ catch (Exception $e)
{
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
}
@@ -197,7 +197,7 @@ asort($orders);
if (GETPOST('action', 'aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules
{
//print 'ee'.GETPOST("demochoice");
- $disablestring='';
+ $disablestring = '';
// If we disable modules using a profile choice
if (GETPOST("demochoice"))
{
@@ -205,27 +205,27 @@ if (GETPOST('action', 'aZ09') == 'gotodemo') // Action run when we click on
{
if ($profilearray['key'] == GETPOST("demochoice"))
{
- $disablestring=$profilearray['disablemodules'];
+ $disablestring = $profilearray['disablemodules'];
break;
}
}
}
// If we disable modules using personalized list
- foreach($modules as $val)
+ foreach ($modules as $val)
{
- $modulekeyname=strtolower($val->name);
- if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname, $alwayscheckedmodules))
+ $modulekeyname = strtolower($val->name);
+ if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules))
{
- $disablestring.=$modulekeyname.',';
- if ($modulekeyname=='propale') $disablestring.='propal,';
+ $disablestring .= $modulekeyname.',';
+ if ($modulekeyname == 'propale') $disablestring .= 'propal,';
}
}
// Do redirect to login page
if ($disablestring)
{
- if (GETPOST('urlfrom')) $url.=(preg_match('/\?/', $url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom', 'alpha'));
- $url.=(preg_match('/\?/', $url)?'&':'?').'disablemodules='.$disablestring;
+ if (GETPOST('urlfrom')) $url .= (preg_match('/\?/', $url) ? '&' : '?').'urlfrom='.urlencode(GETPOST('urlfrom', 'alpha'));
+ $url .= (preg_match('/\?/', $url) ? '&' : '?').'disablemodules='.$disablestring;
//var_dump($url);exit;
header("Location: ".$url);
exit;
@@ -237,11 +237,11 @@ if (GETPOST('action', 'aZ09') == 'gotodemo') // Action run when we click on
* View
*/
-$head='';
-$head.=''."\n";
-$head.=''."\n";
+$head = '';
+$head .= ''."\n";
+$head .= ''."\n";
-$head.='
+$head .= '
' . "\n";
+ print ''."\n";
print '';
print '
';
- print $langs->trans("ThirdPartyType") . ': ';
+ print $langs->trans("ThirdPartyType").': ';
print '
';
print '
';
print ' ';
print '