CoreBOSBB
Save the information on custom blocks - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18)
+--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4)
+--- Thread: Save the information on custom blocks (/showthread.php?tid=511)



Save the information on custom blocks - Guido1982 - 12-03-2016

I know we can define custom blocks (not exactly how but I think it is in the docs). But can I register an event during the installation of one module, that handles a special save action when a record of another module (where the custom block is in) is saved? So basically catch the $_REQUEST global and pick out the fields from my custom block?


RE: Save the information on custom blocks - joebordes - 12-03-2016

all events are global, they get called everytime the event happens.
that means that if you register an aftersave event, your handler will be called on ALL the saves in the application. that is why you normally "protect" your handler with something like:

if (module is my module)....

in this case your condition will check for both conditions:

if (module is the one that has the custom block and I have information to do something with my module)....


RE: Save the information on custom blocks - Guido1982 - 12-03-2016

Nice! So in my case (I want to make a block in salesorders), I would check for the aftersave event, make sure it was a salesorder and as long as I use named, hidden input fields I can use the $_REQUEST global right? Only thing is, will I also have the CRM ID of the salesorder that just saved?


RE: Save the information on custom blocks - joebordes - 12-03-2016

Correct.
Yes, you have all the information of the record being saved and the $_REQUEST array. It is the parameter

https://github.com/tsolucio/corebos/blob/master/modules/HelpDesk/HelpDeskHandler.php#L31


RE: Save the information on custom blocks - Guido1982 - 12-03-2016

Nice! This is perfect for what I have in mind.