Add llx_entity for better management entities
This commit is contained in:
parent
421d0fcd5d
commit
1383e9c2e1
@ -42,6 +42,7 @@ $mc = new Multicompany($db);
|
|||||||
if ($_GET["action"] == 'setactive')
|
if ($_GET["action"] == 'setactive')
|
||||||
{
|
{
|
||||||
$mc->setEntity($_GET['id'],'active',$_GET["value"]);
|
$mc->setEntity($_GET['id'],'active',$_GET["value"]);
|
||||||
|
if ($_GET["value"] == 0) $mc->setEntity($_GET['id'],'visible',$_GET["value"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'setvisible')
|
if ($_GET["action"] == 'setvisible')
|
||||||
|
|||||||
@ -158,7 +158,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
|||||||
require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
|
||||||
|
|
||||||
$mc = new Multicompany($db);
|
$mc = new Multicompany($db);
|
||||||
$mc->getEntities();
|
$mc->getEntities(0,1);
|
||||||
|
|
||||||
$select_entity=$mc->select_entities($mc->entities,$lastentity,'tabindex="3"');
|
$select_entity=$mc->select_entities($mc->entities,$lastentity,'tabindex="3"');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,12 +131,13 @@ class Multicompany
|
|||||||
/**
|
/**
|
||||||
* \brief List of entities
|
* \brief List of entities
|
||||||
*/
|
*/
|
||||||
function getEntities($details=0)
|
function getEntities($details=0,$visible=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT rowid, label, description, visible, active";
|
$sql = "SELECT rowid, label, description, visible, active";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."entity";
|
$sql.= " FROM ".MAIN_DB_PREFIX."entity";
|
||||||
|
if ($visible) $sql.= " WHERE visible = 1";
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|||||||
@ -44,7 +44,11 @@
|
|||||||
{if $entities[mc].visible}
|
{if $entities[mc].visible}
|
||||||
<a href="{$smarty.server.SCRIPT_NAME}?id={$entities[mc].id}&action=setvisible&value=0">{$img_on}</a>
|
<a href="{$smarty.server.SCRIPT_NAME}?id={$entities[mc].id}&action=setvisible&value=0">{$img_on}</a>
|
||||||
{else}
|
{else}
|
||||||
<a href="{$smarty.server.SCRIPT_NAME}?id={$entities[mc].id}&action=setvisible&value=1">{$img_off}</a>
|
{if $entities[mc].active}
|
||||||
|
<a href="{$smarty.server.SCRIPT_NAME}?id={$entities[mc].id}&action=setvisible&value=1">{$img_off}</a>
|
||||||
|
{else}
|
||||||
|
{$img_off}
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user