diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index e97ec89d8fa..47207ec2fda 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -31,6 +31,7 @@ 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'; + /** * Class for SocieteAccount */ @@ -257,6 +258,15 @@ class SocieteAccount extends CommonObject */ public function create(User $user, $notrigger = 0) { + global $langs; + + if ($this->site == 'dolibarr_website') { + if ((int) $this->fk_website <= 0) { + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Website")); + return -1; + } + } + return $this->createCommon($user, $notrigger); } diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 4ed8e18f7d6..1fa3b0678f7 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -35,6 +35,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -684,15 +685,14 @@ while ($i < $imaxinloop) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; - /*if ($key == 'status') { - print $objectwebsiteaccount->getLibStatut(5); - } elseif ($key == 'rowid') { - print $objectwebsiteaccount->showOutputField($val, $key, $object->id, ''); - } else { - print $objectwebsiteaccount->showOutputField($val, $key, $object->$key, ''); - }*/ if ($key == 'login') { print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); + } elseif ($key == 'fk_website') { + if ($obj->$key > 0) { + $tmpwebsite = new Website($db); + $tmpwebsite->fetch($obj->$key); + print $tmpwebsite->getNomUrl(1); + } } else { print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 98fe79aa763..a95a2d84463 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -901,25 +901,31 @@ class Website extends CommonObject $result = ''; - $label = ''.$langs->trans("WebSite").''; + $label = ''.img_picto('', 'website', 'class="pictofixedwidth"').$langs->trans("WebSite").''; $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref.'
'; $label .= ''.$langs->trans('MainLanguage').': '.$this->lang; - $linkstart = 'picto ? $this->picto : 'generic'), ($notooltip ? '' : 'class="classfortooltip"')).$linkend); - if ($withpicto != 2) { - $result .= ' '; - } + */ + if (!empty($this->virtualhost)) { + $linkstart = ''; + $linkend = ''; + } else { + $linkstart = $linkend = ''; } - $result .= $linkstart.$this->ref.$linkend; + + $result .= $linkstart; + if ($withpicto) { + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), 'class="pictofixedwidth'.($notooltip ? '' : ' classfortooltip').'"'); + } + $result .= $this->ref; + $result .= $linkend; + return $result; }