Fix empty div when no address

Fix deletion of MO
This commit is contained in:
Laurent Destailleur 2019-12-09 00:54:42 +01:00
parent d0f90de33c
commit 2ca5a4378b
5 changed files with 32 additions and 23 deletions

View File

@ -621,7 +621,7 @@ abstract class CommonObject
$thirdpartyid = $object->fk_soc;
}
$out = '<!-- BEGIN part to show address block -->';
$out = '';
$outdone = 0;
$coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT);
@ -682,7 +682,7 @@ abstract class CommonObject
$out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', '&nbsp;', 'fax', $langs->trans("Fax")); $outdone++;
}
$out .= '<div style="clear: both;"></div>';
if ($out) $out .= '<div style="clear: both;"></div>';
$outdone = 0;
if (!empty($this->email))
{
@ -695,32 +695,36 @@ abstract class CommonObject
$out .= dol_print_url($this->url, '_blank', 0, 1);
$outdone++;
}
$out .= '<div style="clear: both;">';
if (!empty($conf->socialnetworks->enabled))
{
$outsocialnetwork = '';
if (is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
foreach ($this->socialnetworks as $key => $value) {
$out .= dol_print_socialnetworks($value, $this->id, $object->id, $key);
$outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key);
$outdone++;
}
} else {
if ($this->skype) $out .= dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
if ($this->skype) $outsocialnetwork .= dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
$outdone++;
if ($this->jabberid) $out .= dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
if ($this->jabberid) $outsocialnetwork .= dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
$outdone++;
if ($this->twitter) $out .= dol_print_socialnetworks($this->twitter, $this->id, $object->id, 'twitter');
if ($this->twitter) $outsocialnetwork .= dol_print_socialnetworks($this->twitter, $this->id, $object->id, 'twitter');
$outdone++;
if ($this->facebook) $out .= dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook');
if ($this->facebook) $outsocialnetwork .= dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook');
$outdone++;
if ($this->linkedin) $out .= dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin');
if ($this->linkedin) $outsocialnetwork .= dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin');
$outdone++;
}
if ($outsocialnetwork) {
$out .= '<div style="clear: both;">'.$outsocialnetwork.'</div>';
}
}
$out .= '</div>';
$out .= '<!-- END Part to show address block -->';
return $out;
if ($out) return '<!-- BEGIN part to show address block -->'."\n".$out.'<!-- END Part to show address block -->'."\n";
else return '';
}
/**

View File

@ -1582,9 +1582,12 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files')
{
$morehtmlref .= '<div class="refidno">';
$morehtmlref .= $object->getBannerAddress('refaddress', $object);
$morehtmlref .= '</div>';
$moreaddress = $object->getBannerAddress('refaddress', $object);
if ($moreaddress) {
$morehtmlref .= '<div class="refidno">';
$morehtmlref .= $moreaddress;
$morehtmlref .= '</div>';
}
}
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product')))
{

View File

@ -172,7 +172,7 @@ class Mo extends CommonObject
/**
* @var array List of child tables. To test if we can delete object.
*/
protected $childtables=array('mrp_production');
protected $childtables=array();
/**
* @var array List of child tables. To know object to delete on cascade.

View File

@ -136,8 +136,9 @@ if ($object->id > 0)
// ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/mrp/mo_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
$morehtmlref = '';
/*
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
@ -175,9 +176,9 @@ if ($object->id > 0)
$morehtmlref.='';
}
}
}*/
}
$morehtmlref .= '</div>';
*/
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -89,8 +89,9 @@ if ($id > 0 || ! empty($ref))
// ------------------------------------------------------------
$linkback = '<a href="' .dol_buildpath('/mrp/mo_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
$morehtmlref = '';
/*
$morehtmlref='<div class="refidno">';
// Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
@ -128,9 +129,9 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.='';
}
}
}*/
}
$morehtmlref.='</div>';
*/
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);