Jump to content


Member Since 27 Feb 2013
Offline Last Active Jul 31 2013 02:22 PM

Posts I've Made

In Topic: GC Multi Pourpuse Extension - Stackable Callbacks + field types + Extensible...

28 April 2013 - 04:09 PM

Hello Everyone!

The project is now on GitHub too! (Link on the first post) Thanks to davidoster for helping me with this!

This should make easier for anyone who wants to collaborate, but keep in mind that it's just another option. I am still available by pm, email or this thread for any questions, suggestions, ideas or code you may want to help us with! 


On other news, I have some new features in my head so as soon as I get some free time, I'll implement them and upload the new version.

I'll keep you posted!


Edit: Quick update on the set_soft_delete function. Now you can set the field and the field value. Documentation updated accordingly.


Edit 2: Added some new functions. They allow you to create "callback stacks" so you can run more than one callback function (useful for example if you want to add a callback after insert for tags, another for an image gallery and one more to create a log.)

Also created a post_render callback that let's you set a callback to edit the return of the render function.

In Topic: GC Multi Pourpuse Extension - Stackable Callbacks + field types + Extensible...

26 April 2013 - 04:04 AM

Yeah, I know but (and this is a little embarrassing   :( ) I don't actually know how to manage a github project...

I have to search for a good tutorial but I really won't have time until next week (with luck) so...

In Topic: GC Multi Pourpuse Extension - Stackable Callbacks + field types + Extensible...

24 April 2013 - 07:25 AM

Thank you very much web-johnny! It's really nice to hear that I did a good job! :D


----  To the community:  ----


Guys... Right now, this library has just a few functions to use in the traditional way (like set_soft_delete, or field_type_ext) and it's more focused on letting you reuse your GC-configurations.

But it's just the tip of the ice.  

I would love to turn this into something like a "community" extension. I mean, everyone can contribute... either ideas, code, whatever you want/can. I really want no credit whatsoever (you'll see that there is no credit/license info in the uploaded file), I just want to help the GroceryCrud project and it's community since it's been a real life saver for me in more than one project.

It would be awesome to include more field types, more functions, even some standard GC-configurations.

We have lots of skilled programmers, so we should be able to make this a pretty complete extension.


So, if anyone wants to contribute, you can either post here, send me a pm or an e-mail (it's in the first post).


That also goes to all the people that already made extensions and may want to include them here (so it's all in just one file). Just let me know that you are interested and you give me your authorization to include your code.


I hope this extension helps!

In Topic: GC Multi Pourpuse Extension - Stackable Callbacks + field types + Extensible...

24 April 2013 - 06:23 AM

He already did! :P

I wanted his authorization before posting it so...

This goes without saying but if someone has any doubt about the documentation, functions or whatever, just ask!

In Topic: Insertar en 3 tablas

23 April 2013 - 05:23 AM

Te lo respondo en castellano y posteriormente lo copio abajo en ingles para el resto del mundo:

La manera de hacer lo que estas mencionando es con los callbacks de insert y update. Tenes 3 opciones:

1)Con callback_insert/update reemplazas la funcion de insert/update por defecto por una que definis vos... en esta simplemente haces los inserts que necesitas. (tenes la variable $post que te devuelve todos los campos del formulario).


2) Tambien podes dejar que una tabla la llene el GC con la funcion por defecto y llenar las otras dos con un callback_after_insert/update que corre despues del insert/update por defecto.


3) La tercer opcion es MUY parecida a la segunda, y es un callback_before_insert/update. Es basicamente lo mismo pero corre ANTES del insert/update (esto es util si la tabla que vas a dejar que se llene por defecto es la de union).


Ahora... esto es asumiendo que queres/necesitas insertar todos los datos dentro de un mismo formulario... si pudieras "dividirlos" lo mas practico seria que hagas un formulario para la empresa, uno para persona y en alguno de los 2 (o ambos) uses la funcion  set_relation_n_n que basicamente lo que hace es llenar la tercer tabla (aunque la utilidad de esto depende de que vaya dentro de state).


Documentacion (para las funciones q menciono): http://www.grocerycr...tions_functions


Now in English:


This is the same as before (or at least tries to be...) , but in English:


There are 3 ways of doing what you are asking:



1)You have the callback_insert/update functions that replace the default GC insert/update with a user defined one. In this new function you just create the inserts that you need for your tables. (You have a $post variable with all the fields from the form).


2) You may also let GC handle the insert/update of one table and use callback_after_insert/update to fill the other 2. This callback runs AFTER the default GC insert.


3) The other way is very similar to the second one and it uses callbac_before_insert/update. This callback is basically the same as the previous one but it runs BEFORE the default GC insert/update (this is useful if you want to let GC handle the joining table).


Now... this is assuming that you want/need to insert all the info in just one form... If you could split them the easiest way to go would be to have 1 form for the enterprise (empresa), one for the person (persona) and then use set_relation_n_n in one (or both) of them. This last function basically handles the join table (3rd one). (Keep in mind that this might or might not be a possible solution depending on the values of the state field).


Documentation: http://www.grocerycr...tions_functions



There... Spanish and English, everybody happy :D