[Vtigercrm-developers] accessing line items in the save events

Alan Bell alan.bell at libertus.co.uk
Tue Apr 10 06:30:26 PDT 2012


Hi all,

I have a scenario where we want to set a field on a sales order based on 
some complicated rules about what the line items are (it is rules like 
"if there are more than three products with the word 'big' in the 
description, but nothing containing the word 'box' and a total number of 
items greater than 7 then set the field to 'delivery type 2' ")
there are 4 event types, the first three 
(beforesave,beforesave.modifiable,beforesave.final)don't appear to give 
me access to the values in the line items that are about to be saved as 
these are not really normal fields. I can go find the line items that 
are already on disk if the entity has been previously saved, but I can't 
see the ones of the object that is about to be written.
the last saving event is the aftersave event, which is a bit too late, I 
don't want to update the object here or it will cause a second save and 
I don't want it getting into a save loop.

Is it possible to get access to the $_REQUEST or some other way to see 
the line items on a sales order that is being saved?


Alan.

-- 
Libertus Solutions http://libertus.co.uk



More information about the vtigercrm-developers mailing list