diff --git a/htdocs/adherents/type_ldap.php b/htdocs/adherents/type_ldap.php
index 5658bf8ad0a..bfb81e8d5c4 100644
--- a/htdocs/adherents/type_ldap.php
+++ b/htdocs/adherents/type_ldap.php
@@ -30,27 +30,27 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
// Load translation files required by the page
-$langs->loadLangs(array("admin","members","ldap"));
+$langs->loadLangs(array("admin", "members", "ldap"));
$id = GETPOST('rowid', 'int');
$action = GETPOST('action', 'alpha');
// Security check
-$result=restrictedArea($user, 'adherent', $id, 'adherent_type');
+$result = restrictedArea($user, 'adherent', $id, 'adherent_type');
$object = new AdherentType($db);
$object->fetch($id);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('membertypeldapcard','globalcard'));
+$hookmanager->initHooks(array('membertypeldapcard', 'globalcard'));
/*
* Actions
*/
-$parameters=array();
-$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
@@ -66,7 +66,7 @@ if (empty($reshook))
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
- $olddn = $dn; // We can say that old dn = dn as we force synchro
+ $olddn = $dn; // We can say that old dn = dn as we force synchro
$result = $ldap->update($dn, $info, $user, $olddn);
}
@@ -148,12 +148,12 @@ print '
';
}
else
{
- $result=show_ldap_content($records, 0, $records['count'], true);
+ $result = show_ldap_content($records, 0, $records['count'], true);
}
}
else
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 4e77cd09f39..4dce2533bdc 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -22,7 +22,7 @@
*/
// Put here all includes required by your class file
-require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
@@ -86,9 +86,9 @@ class BOM 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'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
- 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
+ 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
@@ -158,7 +158,7 @@ class BOM extends CommonObject
/**
* @var array List of child tables. To know object to delete on cascade.
*/
- protected $childtablesoncascade=array('bom_bomline');
+ protected $childtablesoncascade = array('bom_bomline');
/**
* @var BOMLine[] Array of subtable lines
@@ -178,11 +178,11 @@ class BOM extends CommonObject
$this->db = $db;
- if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0;
- if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0;
+ if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
+ if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
// Unset fields that are disabled
- foreach($this->fields as $key => $val)
+ foreach ($this->fields as $key => $val)
{
if (isset($val['enabled']) && empty($val['enabled']))
{
@@ -191,13 +191,13 @@ class BOM extends CommonObject
}
// Translate some data of arrayofkeyval
- foreach($this->fields as $key => $val)
+ foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
{
- foreach($val['arrayofkeyval'] as $key2 => $val2)
+ foreach ($val['arrayofkeyval'] as $key2 => $val2)
{
- $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2);
+ $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
}
}
}
@@ -237,7 +237,7 @@ class BOM extends CommonObject
// Load source object
$result = $object->fetchCommon($fromid);
- if ($result > 0 && ! empty($object->table_element_line)) $object->fetchLines();
+ if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
// Get lines so they will be clone
//foreach($object->lines as $line)
@@ -249,18 +249,18 @@ class BOM extends CommonObject
unset($object->import_key);
// Clear fields
- $object->ref = empty($this->fields['ref']['default']) ? $langs->trans("copy_of_").$object->ref: $this->fields['ref']['default'];
- $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label: $this->fields['label']['default'];
+ $object->ref = empty($this->fields['ref']['default']) ? $langs->trans("copy_of_").$object->ref : $this->fields['ref']['default'];
+ $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
$object->status = self::STATUS_DRAFT;
// ...
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0)
{
$extrafields->fetch_name_optionals_label($object->table_element);
- foreach($object->array_options as $key => $option)
+ foreach ($object->array_options as $key => $option)
{
$shortkey = preg_replace('/options_/', '', $key);
- if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
+ if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
{
//var_dump($key); var_dump($clonedObj->array_options[$key]); exit;
unset($object->array_options[$key]);
@@ -277,7 +277,7 @@ class BOM extends CommonObject
$this->errors = $object->errors;
}
- if (! $error)
+ if (!$error)
{
// copy internal contacts
if ($this->copy_linked_contact($object, 'internal') < 0)
@@ -286,7 +286,7 @@ class BOM extends CommonObject
}
}
- if (! $error)
+ if (!$error)
{
// copy external contacts if same company
if (property_exists($this, 'socid') && $this->socid == $object->socid)
@@ -322,7 +322,7 @@ class BOM extends CommonObject
public function fetch($id, $ref = null)
{
$result = $this->fetchCommon($id, $ref);
- if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
+ if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines();
return $result;
}
@@ -333,7 +333,7 @@ class BOM extends CommonObject
*/
public function fetchLines()
{
- $this->lines=array();
+ $this->lines = array();
$result = $this->fetchLinesCommon();
return $result;
@@ -356,40 +356,40 @@ class BOM extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
- $records=array();
+ $records = array();
$sql = 'SELECT ';
$sql .= $this->getFieldList();
- $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
if ($this->ismultientitymanaged) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
else $sql .= ' WHERE 1 = 1';
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
- if ($key=='t.rowid') {
- $sqlwhere[] = $key . '='. $value;
+ if ($key == 't.rowid') {
+ $sqlwhere[] = $key.'='.$value;
}
elseif (strpos($key, 'date') !== false) {
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
}
- elseif ($key=='customsql') {
+ elseif ($key == 'customsql') {
$sqlwhere[] = $value;
}
else {
- $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
+ $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
}
}
}
if (count($sqlwhere) > 0) {
- $sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')';
+ $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
}
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield, $sortorder);
}
if (!empty($limit)) {
- $sql .= ' ' . $this->db->plimit($limit, $offset);
+ $sql .= ' '.$this->db->plimit($limit, $offset);
}
$resql = $this->db->query($sql);
@@ -407,8 +407,8 @@ class BOM extends CommonObject
return $records;
} else {
- $this->errors[] = 'Error ' . $this->db->lasterror();
- dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
+ $this->errors[] = 'Error '.$this->db->lasterror();
+ dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
return -1;
}
@@ -472,21 +472,21 @@ class BOM extends CommonObject
global $langs, $conf;
$langs->load("mrp");
- if (! empty($conf->global->BOM_ADDON))
+ if (!empty($conf->global->BOM_ADDON))
{
- $mybool=false;
+ $mybool = false;
$file = $conf->global->BOM_ADDON.".php";
$classname = $conf->global->BOM_ADDON;
// Include file with class
- $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
+ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/bom/");
// Load file with numbering class (if found)
- $mybool|=@include_once $dir.$file;
+ $mybool |= @include_once $dir.$file;
}
if ($mybool === false)
@@ -504,7 +504,7 @@ class BOM extends CommonObject
}
else
{
- $this->error=$obj->error;
+ $this->error = $obj->error;
//dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
return "";
}
@@ -529,7 +529,7 @@ class BOM extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- $error=0;
+ $error = 0;
// Protection
if ($this->statut == self::STATUS_VALIDATED)
@@ -546,12 +546,12 @@ class BOM extends CommonObject
return -1;
}*/
- $now=dol_now();
+ $now = dol_now();
$this->db->begin();
// Define new ref
- if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
+ if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{
$this->fetch_product();
$num = $this->getNextNumRef($this->product);
@@ -564,30 +564,30 @@ class BOM extends CommonObject
// Validate
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
- $sql.= " SET ref = '".$this->db->escape($num)."',";
- $sql.= " status = ".self::STATUS_VALIDATED.",";
- $sql.= " date_valid='".$this->db->idate($now)."',";
- $sql.= " fk_user_valid = ".$user->id;
- $sql.= " WHERE rowid = ".$this->id;
+ $sql .= " SET ref = '".$this->db->escape($num)."',";
+ $sql .= " status = ".self::STATUS_VALIDATED.",";
+ $sql .= " date_valid='".$this->db->idate($now)."',";
+ $sql .= " fk_user_valid = ".$user->id;
+ $sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
- $resql=$this->db->query($sql);
- if (! $resql)
+ $resql = $this->db->query($sql);
+ if (!$resql)
{
dol_print_error($this->db);
- $this->error=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
$error++;
}
- if (! $error && ! $notrigger)
+ if (!$error && !$notrigger)
{
// Call trigger
- $result=$this->call_trigger('BOM_VALIDATE', $user);
+ $result = $this->call_trigger('BOM_VALIDATE', $user);
if ($result < 0) $error++;
// End call triggers
}
- if (! $error)
+ if (!$error)
{
$this->oldref = $this->ref;
@@ -595,17 +595,17 @@ class BOM extends CommonObject
if (preg_match('/^[\(]?PROV/i', $this->ref))
{
// Now we rename also files into index
- $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'bom/".$this->db->escape($this->newref)."'";
- $sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'bom/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'bom/".$this->db->escape($this->newref)."'";
+ $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'bom/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
- if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
+ if (!$resql) { $error++; $this->error = $this->db->lasterror(); }
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
$oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num);
$dirsource = $conf->bom->dir_output.'/'.$oldref;
$dirdest = $conf->bom->dir_output.'/'.$newref;
- if (! $error && file_exists($dirsource))
+ if (!$error && file_exists($dirsource))
{
dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest);
@@ -613,13 +613,13 @@ class BOM extends CommonObject
{
dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref
- $listoffiles=dol_dir_list($conf->bom->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
- foreach($listoffiles as $fileentry)
+ $listoffiles = dol_dir_list($conf->bom->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
+ foreach ($listoffiles as $fileentry)
{
- $dirsource=$fileentry['name'];
- $dirdest=preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
- $dirsource=$fileentry['path'].'/'.$dirsource;
- $dirdest=$fileentry['path'].'/'.$dirdest;
+ $dirsource = $fileentry['name'];
+ $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
+ $dirsource = $fileentry['path'].'/'.$dirsource;
+ $dirdest = $fileentry['path'].'/'.$dirdest;
@rename($dirsource, $dirdest);
}
}
@@ -628,13 +628,13 @@ class BOM extends CommonObject
}
// Set new ref and current status
- if (! $error)
+ if (!$error)
{
$this->ref = $num;
$this->status = self::STATUS_VALIDATED;
}
- if (! $error)
+ if (!$error)
{
$this->db->commit();
return 1;
@@ -738,34 +738,34 @@ class BOM extends CommonObject
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
- 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 = '';
- $label = '' . $langs->trans("BillOfMaterials") . '';
- $label.= ' ';
- $label.= '' . $langs->trans('Ref') . ': ' . $this->ref;
+ $label = ''.$langs->trans("BillOfMaterials").'';
+ $label .= ' ';
+ $label .= ''.$langs->trans('Ref').': '.$this->ref;
$url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id;
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
- $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
- if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
- if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
+ if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
}
- $linkclose='';
+ $linkclose = '';
if (empty($notooltip))
{
- if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
- $label=$langs->trans("ShowBillOfMaterials");
- $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
+ $label = $langs->trans("ShowBillOfMaterials");
+ $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
+ $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
/*
$hookmanager->initHooks(array('bomdao'));
@@ -774,22 +774,22 @@ class BOM extends CommonObject
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
*/
}
- else $linkclose = ($morecss?' class="'.$morecss.'"':'');
+ else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
$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.= $this->ref;
+ 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 .= $this->ref;
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
- global $action,$hookmanager;
+ global $action, $hookmanager;
$hookmanager->initHooks(array('bomdao'));
- $parameters=array('id'=>$this->id, 'getnomurl'=>$result);
- $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+ $parameters = array('id'=>$this->id, 'getnomurl'=>$result);
+ $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint;
@@ -842,10 +842,10 @@ class BOM extends CommonObject
public function info($id)
{
$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
- $sql.= ' fk_user_creat, fk_user_modif';
- $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
- $sql.= ' WHERE t.rowid = '.$id;
- $result=$this->db->query($sql);
+ $sql .= ' fk_user_creat, fk_user_modif';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
+ $sql .= ' WHERE t.rowid = '.$id;
+ $result = $this->db->query($sql);
if ($result)
{
if ($this->db->num_rows($result))
@@ -856,7 +856,7 @@ class BOM extends CommonObject
{
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
- $this->user_creation = $cuser;
+ $this->user_creation = $cuser;
}
if ($obj->fk_user_valid)
@@ -870,7 +870,7 @@ class BOM extends CommonObject
{
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
- $this->user_cloture = $cluser;
+ $this->user_cloture = $cluser;
}
$this->date_creation = $this->db->jdate($obj->datec);
@@ -893,7 +893,7 @@ class BOM extends CommonObject
*/
public function getLinesArray()
{
- $this->lines=array();
+ $this->lines = array();
$objectline = new BOMLine($this->db);
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.$this->id));
@@ -924,16 +924,16 @@ class BOM extends CommonObject
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
- global $conf,$langs;
+ global $conf, $langs;
$langs->load("mrp");
- if (! dol_strlen($modele)) {
+ if (!dol_strlen($modele)) {
$modele = 'standard';
if ($this->modelpdf) {
$modele = $this->modelpdf;
- } elseif (! empty($conf->global->BOM_ADDON_PDF)) {
+ } elseif (!empty($conf->global->BOM_ADDON_PDF)) {
$modele = $conf->global->BOM_ADDON_PDF;
}
}
@@ -972,7 +972,7 @@ class BOM extends CommonObject
$error = 0;
$this->output = '';
- $this->error='';
+ $this->error = '';
dol_syslog(__METHOD__, LOG_DEBUG);
@@ -1043,7 +1043,7 @@ class BOMLine 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'=>'LineID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1,),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
@@ -1079,11 +1079,11 @@ class BOMLine extends CommonObject
$this->db = $db;
- if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0;
- if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0;
+ if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
+ if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
// Unset fields that are disabled
- foreach($this->fields as $key => $val)
+ foreach ($this->fields as $key => $val)
{
if (isset($val['enabled']) && empty($val['enabled']))
{
@@ -1092,13 +1092,13 @@ class BOMLine extends CommonObject
}
// Translate some data of arrayofkeyval
- foreach($this->fields as $key => $val)
+ foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
{
- foreach($val['arrayofkeyval'] as $key2 => $val2)
+ foreach ($val['arrayofkeyval'] as $key2 => $val2)
{
- $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2);
+ $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
}
}
}
@@ -1149,40 +1149,40 @@ class BOMLine extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
- $records=array();
+ $records = array();
$sql = 'SELECT ';
$sql .= $this->getFieldList();
- $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
if ($this->ismultientitymanaged) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
else $sql .= ' WHERE 1 = 1';
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
- if ($key=='t.rowid') {
- $sqlwhere[] = $key . '='. $value;
+ if ($key == 't.rowid') {
+ $sqlwhere[] = $key.'='.$value;
}
elseif (strpos($key, 'date') !== false) {
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
}
- elseif ($key=='customsql') {
+ elseif ($key == 'customsql') {
$sqlwhere[] = $value;
}
else {
- $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
+ $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
}
}
}
if (count($sqlwhere) > 0) {
- $sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')';
+ $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
}
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield, $sortorder);
}
if (!empty($limit)) {
- $sql .= ' ' . $this->db->plimit($limit, $offset);
+ $sql .= ' '.$this->db->plimit($limit, $offset);
}
$resql = $this->db->query($sql);
@@ -1200,8 +1200,8 @@ class BOMLine extends CommonObject
return $records;
} else {
- $this->errors[] = 'Error ' . $this->db->lasterror();
- dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
+ $this->errors[] = 'Error '.$this->db->lasterror();
+ dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
return -1;
}
@@ -1248,34 +1248,34 @@ class BOMLine extends CommonObject
{
global $db, $conf, $langs, $hookmanager;
- 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 = '';
- $label = '' . $langs->trans("BillOfMaterialsLine") . '';
- $label.= ' ';
- $label.= '' . $langs->trans('Ref') . ': ' . $this->ref;
+ $label = ''.$langs->trans("BillOfMaterialsLine").'';
+ $label .= ' ';
+ $label .= ''.$langs->trans('Ref').': '.$this->ref;
$url = dol_buildpath('/bom/bomline_card.php', 1).'?id='.$this->id;
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
- $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
- if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
- if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
+ if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
}
- $linkclose='';
+ $linkclose = '';
if (empty($notooltip))
{
- if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
- $label=$langs->trans("ShowBillOfMaterialsLine");
- $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
+ $label = $langs->trans("ShowBillOfMaterialsLine");
+ $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
+ $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
/*
$hookmanager->initHooks(array('bomlinedao'));
@@ -1284,22 +1284,22 @@ class BOMLine extends CommonObject
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
*/
}
- else $linkclose = ($morecss?' class="'.$morecss.'"':'');
+ else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
$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.= $this->ref;
+ 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 .= $this->ref;
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
- global $action,$hookmanager;
+ global $action, $hookmanager;
$hookmanager->initHooks(array('bomlinedao'));
- $parameters=array('id'=>$this->id, 'getnomurl'=>$result);
- $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+ $parameters = array('id'=>$this->id, 'getnomurl'=>$result);
+ $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint;
@@ -1340,10 +1340,10 @@ class BOMLine extends CommonObject
public function info($id)
{
$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
- $sql.= ' fk_user_creat, fk_user_modif';
- $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
- $sql.= ' WHERE t.rowid = '.$id;
- $result=$this->db->query($sql);
+ $sql .= ' fk_user_creat, fk_user_modif';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
+ $sql .= ' WHERE t.rowid = '.$id;
+ $result = $this->db->query($sql);
if ($result)
{
if ($this->db->num_rows($result))
@@ -1354,7 +1354,7 @@ class BOMLine extends CommonObject
{
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
- $this->user_creation = $cuser;
+ $this->user_creation = $cuser;
}
if ($obj->fk_user_valid)
@@ -1368,7 +1368,7 @@ class BOMLine extends CommonObject
{
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
- $this->user_cloture = $cluser;
+ $this->user_cloture = $cluser;
}
$this->date_creation = $this->db->jdate($obj->datec);
diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php
index ed981d9488b..459b6637230 100644
--- a/htdocs/comm/propal/index.php
+++ b/htdocs/comm/propal/index.php
@@ -68,12 +68,13 @@ print '
';
if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo
{
print ' \n";
}
@@ -118,6 +119,7 @@ if ($resql)
}
$db->free($resql);
+ print '
";
}
else
{
diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php
index 6c5fb4701dd..79e7c11001c 100644
--- a/htdocs/commande/index.php
+++ b/htdocs/commande/index.php
@@ -3,6 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2019 Nicolas ZABOURI
+ * Copyright (C) 2019 Frédéric France
*
* 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
@@ -74,11 +75,12 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
$var=false;
print ' \n";
}
@@ -123,6 +125,7 @@ if ($resql)
$i++;
}
$db->free($resql);
+ print '
'."\n";
- $parameters=array('tabname' => $active, 'out' => $out);
- $reshook=$hookmanager->executeHooks('printTabsHead', $parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead"
+ $parameters = array('tabname' => $active, 'out' => $out);
+ $reshook = $hookmanager->executeHooks('printTabsHead', $parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead"
if ($reshook > 0)
{
$out = $hookmanager->resPrint;
@@ -1298,7 +1298,7 @@ function dol_fiche_end($notab = 0)
*/
function dol_get_fiche_end($notab = 0)
{
- if (! $notab || $notab == -1) return "\n
\n";
+ if (!$notab || $notab == -1) return "\n
\n";
else return '';
}
@@ -1327,79 +1327,79 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$error = 0;
- $maxvisiblephotos=1;
- $showimage=1;
- $entity=(empty($object->entity)?$conf->entity:$object->entity);
- $showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0);
- if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
- $modulepart='unknown';
+ $maxvisiblephotos = 1;
+ $showimage = 1;
+ $entity = (empty($object->entity) ? $conf->entity : $object->entity);
+ $showbarcode = empty($conf->barcode->enabled) ? 0 : ($object->barcode ? 1 : 0);
+ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode = 0;
+ $modulepart = 'unknown';
- if ($object->element == 'societe') $modulepart='societe';
- if ($object->element == 'contact') $modulepart='contact';
- if ($object->element == 'member') $modulepart='memberphoto';
- if ($object->element == 'user') $modulepart='userphoto';
- if ($object->element == 'product') $modulepart='product';
- if ($object->element == 'ticket') $modulepart='ticket';
+ if ($object->element == 'societe') $modulepart = 'societe';
+ if ($object->element == 'contact') $modulepart = 'contact';
+ if ($object->element == 'member') $modulepart = 'memberphoto';
+ if ($object->element == 'user') $modulepart = 'userphoto';
+ if ($object->element == 'product') $modulepart = 'product';
+ if ($object->element == 'ticket') $modulepart = 'ticket';
if (class_exists("Imagick"))
{
- if ($object->element == 'propal') $modulepart='propal';
- if ($object->element == 'commande') $modulepart='commande';
- if ($object->element == 'facture') $modulepart='facture';
- if ($object->element == 'fichinter') $modulepart='ficheinter';
- if ($object->element == 'contrat') $modulepart='contract';
- if ($object->element == 'supplier_proposal') $modulepart='supplier_proposal';
- if ($object->element == 'order_supplier') $modulepart='supplier_order';
- if ($object->element == 'invoice_supplier') $modulepart='supplier_invoice';
- if ($object->element == 'expensereport') $modulepart='expensereport';
+ if ($object->element == 'propal') $modulepart = 'propal';
+ if ($object->element == 'commande') $modulepart = 'commande';
+ if ($object->element == 'facture') $modulepart = 'facture';
+ if ($object->element == 'fichinter') $modulepart = 'ficheinter';
+ if ($object->element == 'contrat') $modulepart = 'contract';
+ if ($object->element == 'supplier_proposal') $modulepart = 'supplier_proposal';
+ if ($object->element == 'order_supplier') $modulepart = 'supplier_order';
+ if ($object->element == 'invoice_supplier') $modulepart = 'supplier_invoice';
+ if ($object->element == 'expensereport') $modulepart = 'expensereport';
}
if ($object->element == 'product')
{
- $width=80; $cssclass='photoref';
- $showimage=$object->is_photo_available($conf->product->multidir_output[$entity]);
- $maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
- if ($conf->browser->layout == 'phone') $maxvisiblephotos=1;
- if ($showimage) $morehtmlleft.='
';
}
}
}
@@ -1409,26 +1409,26 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
{
if ($modulepart != 'unknown')
{
- $phototoshow='';
+ $phototoshow = '';
// Check if a preview file is available
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice', 'expensereport')) && class_exists("Imagick"))
{
$objectref = dol_sanitizeFileName($object->ref);
- $dir_output = (empty($conf->$modulepart->multidir_output[$entity]) ? $conf->$modulepart->dir_output : $conf->$modulepart->multidir_output[$entity]) . "/";
+ $dir_output = (empty($conf->$modulepart->multidir_output[$entity]) ? $conf->$modulepart->dir_output : $conf->$modulepart->multidir_output[$entity])."/";
if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice')))
{
$subdir = get_exdir($object->id, 2, 0, 1, $object, $modulepart);
- $subdir.= ((! empty($subdir) && ! preg_match('/\/$/', $subdir))?'/':'').$objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it at end
+ $subdir .= ((!empty($subdir) && !preg_match('/\/$/', $subdir)) ? '/' : '').$objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it at end
}
else
{
$subdir = get_exdir($object->id, 0, 0, 1, $object, $modulepart);
}
- if (empty($subdir)) $subdir = 'errorgettingsubdirofobject'; // Protection to avoid to return empty path
+ if (empty($subdir)) $subdir = 'errorgettingsubdirofobject'; // Protection to avoid to return empty path
- $filepath = $dir_output . $subdir . "/";
+ $filepath = $dir_output.$subdir."/";
- $filepdf = $filepath . $objectref . ".pdf";
+ $filepdf = $filepath.$objectref.".pdf";
$relativepath = $subdir.'/'.$objectref.'.pdf';
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
@@ -1441,159 +1441,159 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
if ($pdfexists)
{
// Conversion du PDF en image png si fichier png non existant
- if (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf)))
+ if (!file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf)))
{
if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here.
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- $ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png
+ $ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png
if ($ret < 0) $error++;
}
}
}
- if ($pdfexists && ! $error)
+ if ($pdfexists && !$error)
{
- $heightforphotref=70;
- if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60;
+ $heightforphotref = 70;
+ if (!empty($conf->dol_optimize_smallscreen)) $heightforphotref = 60;
// If the preview file is found
if (file_exists($fileimage))
{
$phototoshow = '
";
}
}
- print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist
+ print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist
print '