Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Save the information on custom blocks
#1
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?
Reply
#2
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)....
Joe
TSolucio
Reply
#3
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?
Reply
#4
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
Joe
TSolucio
Reply
#5
Nice! This is perfect for what I have in mind.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)