Debug v21

This commit is contained in:
Laurent Destailleur (aka Eldy) 2025-01-23 23:26:59 +01:00
parent b6390f959c
commit 48190b39de
3 changed files with 35 additions and 19 deletions

View File

@ -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);
}

View File

@ -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, '');
}

View File

@ -901,25 +901,31 @@ class Website extends CommonObject
$result = '';
$label = '<u>'.$langs->trans("WebSite").'</u>';
$label = '<u>'.img_picto('', 'website', 'class="pictofixedwidth"').$langs->trans("WebSite").'</u>';
$label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref.'<br>';
$label .= '<b>'.$langs->trans('MainLanguage').':</b> '.$this->lang;
$linkstart = '<a href="'.DOL_URL_ROOT.'/website/card.php?id='.$this->id.'"';
// Links for internal access
/*
$linkstart = '<a href="'.DOL_URL_ROOT.'/website/index.php?website='.urlencode($this->ref).'"';
$linkstart .= ($notooltip ? '' : ' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss ? ' '.$morecss : '').'"');
$linkstart .= '>';
$linkend = '</a>';
$linkstart = $linkend = '';
if ($withpicto) {
$result .= ($linkstart.img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? '' : 'class="classfortooltip"')).$linkend);
if ($withpicto != 2) {
$result .= ' ';
}
*/
if (!empty($this->virtualhost)) {
$linkstart = '<a target="_blank" rel="noopener" href="'.$this->virtualhost.'">';
$linkend = '</a>';
} 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;
}