Topic: tab dissapears when enter a link

Hi there! I'm working with FA 2.3.1 and I have found a strange behavior with extensions.

When I enter to one tab or login my created tab is visible without a problem.
If I enter to a link (Setup/Company Setup) then the tab dissapears (there is no text) and links to nothing, like this:

<li ><a href='./index.php?application=orders'><b>Ventas</b></a></li>
<li ><a href='./index.php?application=AP'><b>Compras</b></a></li>
<li ><a href='./index.php?application=stock'><b>Productos e Inventarios</b></a></li>
<li ><a href='./index.php?application=manuf'><b>Manufactura</b></a></li>
<li ><a href='./index.php?application=GL'><b>Contabilidad y Bancos</b></a></li>
<li ><a href='./index.php?application='><b></b></a></li>
<li class='active'><a href='./index.php?application=system'><b>Configuración</b></a></li>

I had review the code and I can see that when you enter a tab install_tabs is called,
on the other hand, If you enter a link install_tabs is not called even the hook object is created.

To solve this issue I have to add these lines to the file session.inc line 300

    if (!isset($_SESSION['App'])) {
        $_SESSION['App'] = new front_accounting();
        $_SESSION['App']->init();
    } else { // line added
        $_SESSION['App']->init(); // line added
    }

In this way the method install_tabs of my hook is called when I enter a link and when I enter a tab.

I hope this could help others.

Re: tab dissapears when enter a link

Oh, please dismiss the spanish translation, this is not a problem about languages or locales.

Re: tab dissapears when enter a link

I have been working with new extension/add-on on FA for few weeks now. Takes me a while since I'm not that good with PHP. I'm still learning.

I can see that you have added new lines into sessions.php which is not something that should be done in the first place. For me, I'm trying not to touch/modified anything in core script especially session.php file.

1. Create new directory in modules directory. Give it a name of course.
2. Create hooks.php file in that new directory. This file will be the bridge that connect your extension with FA core script. So, it's an important file that must be created.
3. In this file :
    If you want to add new tab --> add install_tabs function into this file.
    If you want to add new access level --> add install_access function into this file.
    ... and so on.

Go and take a look on hooks.inc file for more information.

Re: tab dissapears when enter a link

I already did it. And I had found this behavior.
I had put error_log() calls in my hooks.php file and this is how I notice that the init funtion was not called when you enter a link inside a tab (it does when you click on a tab).

Do you have this behavior also or this does not happend to you ?
Are you using 2.3.1 ?

Re: tab dissapears when enter a link

I'm not sure where the problem arise on your installation, but extension tabs mechanism works properly without patch suggested. When you look into renderer.php code found in any theme folder you will see that tabs are retrieved from $_SESSION['App'] object  created during main index.php request.

Janusz

Re: tab dissapears when enter a link

Oh, that must be !!! I'm using a customized theme, maybe my render file is not working properly according to the new version, I'll trace this issue in this way. Thanks a lo Janusz!