link forms by province

Code:
$company='{$my->id}';
$db = \Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->select('province');
$query ->from('company');
$query -> where('companyid =' . $company)  ;
$db->setQuery($query);
$result = $db->loadResult();
return $result;
 
Gracias por la ayuda pero sigue pasando lo mismo, no filtra provincias ni profesiones. Todo está en la misma lista que la imagen anterior. También recibo este error al seleccionar "Registrador o Público", al aplicar en el prefiltro
error in public and registred.png
 
{$my->id} will only be replaced it there's a "my", i.e. if you are logged in.
If you calling the list as guest it will keep the unreplaced string and this will create a SQL error because it's not quoted in the query.

So to fix the SQL error do
$query -> where('companyid =' . $db->quote($company) ) ;

This will give you the syntactically correct query ...WHERE companyid ='{$my->id}' ...
but I assume this is not what you want in case of a guest.

So if company should be 0 in this case you can do
$company='{$my->id}';
$company=!is_int($company) ? 0 : $company;
...
 
My base assumption for the code was, that anybody can create a request, but the (filtered) request list is only visible for registered / logged in companies and therefore there is always a valid ID available.

Else probably private contact information of the requestors would be visible to the world (except those would be handled with element access levels). But the question would be: what is the sense for showing guests a list of anonymous requests?
 
{$my->id} will only be replaced it there's a "my", i.e. if you are logged in.
If you calling the list as guest it will keep the unreplaced string and this will create a SQL error because it's not quoted in the query.

So to fix the SQL error do
$query -> where('companyid =' . $db->quote($company) ) ;

This will give you the syntactically correct query ...WHERE companyid ='{$my->id}' ...
but I assume this is not what you want in case of a guest.

So if company should be 0 in this case you can do
$company='{$my->id}';
$company=!is_int($company) ? 0 : $company;
...
Thank you very much for your interest in helping me. Now I understand a little better how it works, although the error is not identified from what it tells me, what is not clear to me is:"So if company should be 0 in this case you can do$company='{$my->id}';$company=!is_int($company) ? 0 : $company;"Furthermore, the form does not reach the company that has registered with the same province and profession. Thank you
 
My base assumption for the code was, that anybody can create a request, but the (filtered) request list is only visible for registered / logged in companies and therefore there is always a valid ID available.

Else probably private contact information of the requestors would be visible to the world (except those would be handled with element access levels). But the question would be: what is the sense for showing guests a list of anonymous requests?
Sorry for the language mix. It is not an automatic translator.What you indicate is precisely what I want, but the filtering does not work for me. When creating a new user with the same province and profession, that request does not appear in the list. What I need is for the user to register in their private panel to have the requests that match their province and profession.
 
Are you developing on a local server or is there the possibilty to check online. Maybe you can send me access details via PM
 
If you click on my picture a small popup appears, where at the bottom a button 'start conversation' appears
 
This form works perfectly. The question I have is if I want to give direct access to several tabs in the frontend. Do I need to create a new list for each form?
 
Can you please explain a bit more. In general you have two forms: Company and requests. But there are no tabs.
Basically you can always create a (fabrik list) menu item with specific pre-filters, so there is no need for a new (copied) list.
But if you can give more information, what you want to achive, more specific help can be provided
 
Can you please explain a bit more. In general you have two forms: Company and requests. But there are no tabs.
Basically you can always create a (fabrik list) menu item with specific pre-filters, so there is no need for a new (copied) list.
But if you can give more information, what you want to achive, more specific help can be provided
Thanks for the help. I need to create a form with direct links, some of these forms have only one filter (province), and not two like the previous ones, although the operation would be the same, the end is the same, it must reach the company registered with that province.Example form with direct link (only for electricians), with the only province filter.Just as you say, Fabrik, do you have a simpler option to achieve this?
 

Attachments

  • Sin título.png
    Sin título.png
    109.9 KB · Views: 3
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top