⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

two fields .. two users .. a view



Roberto Fabian Rosero Diaz
  • profile picture
  • Member

Posted 01 August 2013 - 16:07 PM

good morning
 
I have a question please help:
 
I have three tables that are:
invoices, cities, departments
 
in the table "invoices" I have these fields:
 
id (pk)
description
value
id_city (Table cities fk)
 
and Table "city" I have these fields:
 
id (pk)
NameCity
id_dpt (fk departments table)
 
and Table "departments":
 
id (pk)
NameDepartament
 
however, in the grocery crud controller, I'm standing on the table "invoices", I have two users: "admin" and "mauro" then the admin user will be entering fields in the table "invoices", including the "NameCity "that I bring to the table" cities ", I want the user" mauro "can see the records that I put the admin user, but this Signature: User, rather than viewing the" NameCity "I want to see the field "NameDepartament" departments table with the name of the respective department of the city to put the user "admin".
 
 
I would like you please explain how I could do this
 
sorry as I wrote the English, is to use a translator because I speak Spanish
 
thank you very much in advance

 


davidoster
  • profile picture
  • Member

Posted 01 August 2013 - 22:56 PM

Hello and welcome to the forums [member=roberto fabian rosero diaz].

 

Can you please separate this:

"however, in the grocery crud controller, I'm standing on the table "invoices", I have two users: "admin" and "mauro" then the admin user will be entering fields in the table "invoices", including the "NameCity "that I bring to the table" cities ", I want the user" mauro "can see the records that I put the admin user, but this Signature: User, rather than viewing the" NameCity "I want to see the field "NameDepartament" departments table with the name of the respective department of the city to put the user "admin"."

 

to simple questions one by one because like this we can't understand exactly what you need to do. Just right it like this,

1. I want the mauro user to see this

2. I want the admin user to do that

3. ...

 

thank you.


Roberto Fabian Rosero Diaz
  • profile picture
  • Member

Posted 02 August 2013 - 13:17 PM

1. I want the user "admin" enter records with the "NameCity" and not by "NameDepartament".
 
2. and I want the user "mauro" see the records by "NameDepartament" and not by "NameCity" meaning that records the "NameDepartament" you see here are relevant to cities that income the user "admin".
 
 
por favor de nuevo perdonen el ingles, uso un traductor por que no lo se hablar

 

 

 


davidoster
  • profile picture
  • Member

Posted 05 August 2013 - 11:59 AM

1. $crud->set_relation('id_city', 'city','NameCity');

2. $crud->where...


Roberto Fabian Rosero Diaz
  • profile picture
  • Member

Posted 05 August 2013 - 21:11 PM

good afternoon davidoster, thanks for your reply, but the problem is as follows:
 
the way you put it, the user "fabian" if you let him enter records with the "NameCity", but the user "mauro" not "NameDepartament", the field appear empty
 

as make I do that the user "mauro" will display "NameDepartament" corresponding to "NameCity" I enter the user "fabian", that's what I want to know

 

from already thank you very much
 
again sorry for the English, I'm using the google translator

davidoster
  • profile picture
  • Member

Posted 05 August 2013 - 22:40 PM

Sorry I am confused! I can't understand what you need to do.


Roberto Fabian Rosero Diaz
  • profile picture
  • Member

Posted 06 August 2013 - 13:16 PM

davidoster hello thanks for following this topic.
 
I'll post an example of what I want:
 
in the table "city" I have the following record:
 
id: 001 (pk)
NameCity: Cali
id_dpto: 33 (table fk departments)
 
in the table "departments" I have this other record:
 
id: 33 (pk, which is related to the table "city")
NameDepartament: Valle del Cauca
 
 
then the user "fabian" enters the table "invoices" track, including the "NameCity" field, that would be the city "Cali", but the user "mauro" will never look at the "NameCity" field but vera the "NameDepartament" corresponding field, that is, instead of looking in the "Cali", which will see is "Valle del Cauca", since it corresponds to the city "Cali".
 
that's what I want to know
 
friend please help me with this as it is the only thing I needed to finish my project, and depend only on your answers to finish, and I can not find anything on google that I may have
 
sorry again for the bad translation
 
from already thank you very much

davidoster
  • profile picture
  • Member

Posted 07 August 2013 - 04:47 AM

I still believe that the answer on /topic/1920-two-fields-two-users-a-view/#entry8792

is the answer to your problem. I can't help you any more. This is not a Grocery CRUD problem, this is a logical(programming) problem that you need to solve yourself.

Sorry.


Roberto Fabian Rosero Diaz
  • profile picture
  • Member

Posted 08 August 2013 - 13:23 PM

davidoster, thanks for replying, I am aware that my problem is the same thing you're saying, but the reason that I put it is that, I've tried everything to solve this problem, (relationship one by one, which is what you're putting up, relationship of one to many, many to many relationship) and none works, I tried to combine them, well, a myriad of things and nothing has worked, I think I came to the conclusion that what this problem is not be performed in grocery crud
 
 
anyway, thank you very much for your help davidoster.