diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index d52a2edf73c..fcf6c913e27 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -5263,7 +5263,7 @@ abstract class CommonObject
* Return HTML string to show a field into a page
* Code very similar with showOutputField of extra fields
*
- * @param array $val Array of properties for field to show
+ * @param array $val Array of properties of field to show
* @param string $key Key of attribute
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
* @param string $moreparam To add more parametes on html input tag
@@ -5283,7 +5283,6 @@ abstract class CommonObject
}
$objectid = $this->id;
-
$label=$val['label'];
$type =$val['type'];
$size =$val['css'];
@@ -5307,8 +5306,8 @@ abstract class CommonObject
}
$langfile=$val['langfile'];
$list=$val['list'];
- $hidden=(abs($val['visible'])!=1 ? 1 : 0);
$help=$val['help'];
+ $hidden=(($val['visible'] == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
if ($hidden) return '';
@@ -5320,21 +5319,37 @@ abstract class CommonObject
$value = dol_eval($computed, 1, 0);
}
- $showsize=0;
- if ($type == 'date')
+ if (empty($showsize))
+ {
+ if ($type == 'date')
+ {
+ $showsize=10;
+ }
+ elseif ($type == 'datetime')
+ {
+ $showsize=19;
+ }
+ elseif ($type == 'int' || $type == 'integer')
+ {
+ $showsize=10;
+ }
+ else
+ {
+ $showsize=round($size);
+ if ($showsize > 48) $showsize=48;
+ }
+ }
+
+ if ($key == 'ref') $value=$this->getNomUrl(1, '', 0, '', 1);
+ elseif ($key == 'status') $value=$this->getLibStatut(3);
+ elseif ($type == 'date')
{
- $showsize=10;
$value=dol_print_date($value,'day');
}
elseif ($type == 'datetime')
{
- $showsize=19;
$value=dol_print_date($value,'dayhour');
}
- elseif ($type == 'int')
- {
- $showsize=10;
- }
elseif ($type == 'double')
{
if (!empty($value)) {
@@ -5569,11 +5584,6 @@ abstract class CommonObject
{
$value=preg_replace('/./i','*',$value);
}
- else
- {
- $showsize=round($size);
- if ($showsize > 48) $showsize=48;
- }
//print $type.'-'.$size;
$out=$value;
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index ae1cd2848be..ca7bed7ff4e 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1315,7 +1315,7 @@ class ExtraFields
*
* @param string $key Key of attribute
* @param string $value Value to show
- * @param string $moreparam To add more parametes on html input tag (only checkbox use html input for output rendering)
+ * @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering)
* @return string Formated value
*/
function showOutputField($key,$value,$moreparam='')
@@ -1334,7 +1334,7 @@ class ExtraFields
$perms=$this->attribute_perms[$key];
$langfile=$this->attribute_langfile[$key];
$list=$this->attribute_list[$key];
- $hidden=(abs($list)!=1 ? 1 : 0);
+ $hidden=(($list != 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method.
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index e2106051ce9..ac98fa599a9 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -209,10 +209,10 @@ function societe_prepare_head(Societe $object)
if (! empty($conf->website->enabled) && (!empty($user->rights->societe->lire) ))
{
$head[$h][0] = DOL_URL_ROOT.'/societe/website.php?id='.$object->id;
- $head[$h][1] = $langs->trans("WebSites");
+ $head[$h][1] = $langs->trans("WebSiteAccounts");
$nbNote = 0;
$sql = "SELECT COUNT(n.rowid) as nb";
- $sql.= " FROM ".MAIN_DB_PREFIX."websiteaccount as n";
+ $sql.= " FROM ".MAIN_DB_PREFIX."website_account as n";
$sql.= " WHERE fk_soc = ".$object->id;
$resql=$db->query($sql);
if ($resql)
diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php
index 4c0f23a5af2..ded3247f1dd 100644
--- a/htdocs/core/tpl/commonfields_view.tpl.php
+++ b/htdocs/core/tpl/commonfields_view.tpl.php
@@ -26,9 +26,11 @@
foreach($object->fields as $key => $val)
{
- if (abs($val['visible']) != 1) continue; // Discard such field from form
+ // Discard if extrafield is a hidden field on form
+ if (abs($val['visible']) != 1) continue;
+
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
- if ($key == 'status') continue; // Status is alreadt in dol_banner
+ if ($key == 'status') continue; // Status is already in dol_banner
$value=$object->$key;
diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php
index 15bfd51f83b..b57025e3dd6 100644
--- a/htdocs/core/tpl/extrafields_view.tpl.php
+++ b/htdocs/core/tpl/extrafields_view.tpl.php
@@ -42,7 +42,7 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
{
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
{
- // Discard if extrafield is a hidden field
+ // Discard if extrafield is a hidden field on form
if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1) continue;
// Load language if required
diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
index 84c248c3642..385d3830171 100644
--- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
+++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
@@ -63,6 +63,10 @@ ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer;
-- For 7.0
+UPDATE llx_website SET entity = 1 WHERE entity IS NULL;
+-- VMYSQL4.3 ALTER TABLE llx_website MODIFY COLUMN entity integer NOT NULL DEFAULT 1;
+-- VPGSQL8.2 ALTER TABLE llx_website ALTER COLUMN entity SET NOT NULL;
+
ALTER TABLE llx_user ADD COLUMN birth date;
-- VMYSQL4.1 ALTER TABLE llx_holiday_users DROP PRIMARY KEY;
diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website.sql
index 14afe19d0aa..6946b981c86 100644
--- a/htdocs/install/mysql/tables/llx_website.sql
+++ b/htdocs/install/mysql/tables/llx_website.sql
@@ -20,7 +20,7 @@
CREATE TABLE llx_website
(
rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
- entity integer DEFAULT 1,
+ entity integer NOT NULL DEFAULT 1,
ref varchar(128) NOT NULL,
description varchar(255),
status integer DEFAULT 1,
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 67705d2686d..7f89918e90a 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -815,6 +815,7 @@ BulkActions=Bulk actions
ClickToShowHelp=Click to show tooltip help
WebSite=Web site
WebSites=Web sites
+WebSiteAccounts=Web site accounts
ExpenseReport=Expense report
ExpenseReports=Expense reports
HR=HR
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index ab6a36b4d40..5716f88b4b1 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -488,12 +488,10 @@ while ($i < min($num, $limit))
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked']))
{
- print '
';
- if (in_array($val['type'], array('date'))) print dol_print_date($db->jdate($obj->$key), 'day', 'tzuser');
- elseif (in_array($val['type'], array('datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
- elseif ($key == 'ref') print $object->getNomUrl(1, '', 0, '', 1);
- elseif ($key == 'status') print $object->getLibStatut(3);
- else print $obj->$key;
+ print ' | ';
+ print $object->showOutputField($val, $key, $obj->$key, '');
print ' | ';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
@@ -510,12 +508,12 @@ while ($i < min($num, $limit))
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
- print 'getAlignFlag($key);
+ print ' | ';
$tmpkey='options_'.$key;
- print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
+ print $extrafields->showOutputField($key, $obj->$tmpkey, '');
print ' | ';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php
index 2b6349e36ae..c268f56922c 100644
--- a/htdocs/societe/website.php
+++ b/htdocs/societe/website.php
@@ -255,7 +255,7 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/, $/','', $sql);
-$sql.= " FROM ".MAIN_DB_PREFIX."websiteaccount as t";
+$sql.= " FROM ".MAIN_DB_PREFIX."website_account as t";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."websiteaccount_extrafields as ef on (t.rowid = ef.fk_object)";
if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('websiteaccount').")";
else $sql.=" WHERE 1 = 1";
@@ -488,12 +488,11 @@ while ($i < min($num, $limit))
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked']))
{
- print '';
- if (in_array($val['type'], array('date'))) print dol_print_date($db->jdate($obj->$key), 'day', 'tzuser');
- elseif (in_array($val['type'], array('datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
- elseif ($key == 'ref' || $key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
- elseif ($key == 'status') print $objectwebsiteaccount->getLibStatut(3);
- else print $obj->$key;
+ print ' | ';
+ if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
+ else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, '');
print ' | ';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
@@ -510,12 +509,12 @@ while ($i < min($num, $limit))
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
- print 'getAlignFlag($key);
+ print ' | ';
$tmpkey='options_'.$key;
- print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
+ print $extrafields->showOutputField($key, $obj->$tmpkey, '');
print ' | ';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php
index e99fc3fe31e..c63aee5b9b2 100644
--- a/htdocs/website/class/website.class.php
+++ b/htdocs/website/class/website.class.php
@@ -44,7 +44,11 @@ class Website extends CommonObject
*/
public $table_element = 'website';
/**
- * @var string String with name of icon for websiteaccount. Must be the part after the 'object_' into object_myobject.png
+ * @var array Does websiteaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
+ */
+ public $ismultientitymanaged = 1;
+ /**
+ * @var string String with name of icon for website. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'globe';
diff --git a/htdocs/website/class/websiteaccount.class.php b/htdocs/website/class/websiteaccount.class.php
index c5cd4ffe788..275b2491e49 100644
--- a/htdocs/website/class/websiteaccount.class.php
+++ b/htdocs/website/class/websiteaccount.class.php
@@ -77,7 +77,7 @@ class WebsiteAccount extends CommonObject
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Login',),
- 'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>-1, 'enabled'=>1, 'position'=>30),
+ 'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>-2, 'enabled'=>1, 'position'=>30),
'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>31, 'notnull'=>1),
'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>32, 'notnull'=>-1,),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'index'=>1),
@@ -117,11 +117,11 @@ class WebsiteAccount extends CommonObject
/**
* @var int Name of subtable line
*/
- //public $table_element_line = 'websiteaccountdet';
+ //public $table_element_line = 'website_accountdet';
/**
* @var int Field with ID of parent key if this field has a parent
*/
- //public $fk_element = 'fk_websiteaccount';
+ //public $fk_element = 'fk_website_account';
/**
* @var int Name of subtable class that manage subtable lines
*/
@@ -129,7 +129,7 @@ class WebsiteAccount extends CommonObject
/**
* @var array Array of child tables (child tables to delete before deleting a record)
*/
- //protected $childtables=array('websiteaccountdet');
+ //protected $childtables=array('website_accountdet');
/**
* @var WebsiteAccountLine[] Array of subtable lines
*/
@@ -319,12 +319,11 @@ class WebsiteAccount extends CommonObject
$linkstart.=$linkclose.'>';
$linkend='';
- if ($withpicto)
- {
- $result.=($linkstart.img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?'':'class="classfortooltip"')).$linkend);
- if ($withpicto != 2) $result.=' ';
- }
- $result.= $linkstart . $this->ref . $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;
+ $result .= $linkend;
+
return $result;
}
diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php
index 34a6f047874..15ffc7bed69 100644
--- a/htdocs/website/class/websitepage.class.php
+++ b/htdocs/website/class/websitepage.class.php
@@ -44,7 +44,7 @@ class WebsitePage extends CommonObject
*/
public $table_element = 'website_page';
/**
- * @var string String with name of icon for websiteaccount. Must be the part after the 'object_' into object_myobject.png
+ * @var string String with name of icon for websitepage. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'label';
diff --git a/htdocs/website/lib/websiteaccount.lib.php b/htdocs/website/lib/websiteaccount.lib.php
index b294b25f3b2..95ae071d971 100644
--- a/htdocs/website/lib/websiteaccount.lib.php
+++ b/htdocs/website/lib/websiteaccount.lib.php
@@ -41,7 +41,7 @@ function websiteaccountPrepareHead($object)
$head[$h][2] = 'card';
$h++;
- if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
+ /*if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
{
$nbNote = 0;
if(!empty($object->fields['note_private'])) $nbNote++;
@@ -51,7 +51,7 @@ function websiteaccountPrepareHead($object)
if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.'';
$head[$h][2] = 'note';
$h++;
- }
+ }*/
/*
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';