⚠ 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

Using different "where clauses" between add and edit



Min's

Min's
  • profile picture
  • Member

Posted 11 April 2017 - 12:40 PM

Hi all. 

 

Pretty new to CI and to GC, but I already did a goodjob just using this combination.

 

I'm currently stuck and need some help. I have a table containing books, that belong to 1 and only 1 person. When I add a new book, I want to be able to give an active person as the owner. I don't have problem, I use 

$crud->set_relation('id_controleur', 't_users', '{user_name} {user_firstname}', array('b_is_active' => 1, 'id_function' => 2, 'id_category' => 4));

and it works fine. I only see active people that are on a certain category and function.

 

The problem is using the edit button. Sometimes, the owner is already b_is_active = 0 when the book comes back, and if I edit, I just can't keep the same owner. 

 

So I'd like to know if it's possible to have un set_relation for the edit action, and another for the add action.

 

Thanks in advance.

 

Claude


Amber

Amber
  • profile picture
  • Member

Posted 11 April 2017 - 13:14 PM

So I'd like to know if it's possible to have un set_relation for the edit action, and another for the add action.

 

I searched this for you:

 

http://www.grocerycrud.com/documentation/options_functions/getState

 

This should help you.


Min's

Min's
  • profile picture
  • Member

Posted 11 April 2017 - 13:21 PM

Facepalm... 

 

So obvious that I didn't find it. 

 

Thanks :)