Merge request reports
Activity
mentioned in issue #1561 (closed)
Hi @ruben.estrada I've noticed your merge request , and I want to add that you can apply the same principle to modify a quote using vtiger record model and adding $_REQUEST['ajxaction'] = 'DETAILVIEW';
you mean something like:
$record = Vtiger_Record_Model::getInstanceById($id); $record->set('subject', 'test'); $_REQUEST['ajxaction'] = 'DETAILVIEW'; $record->save();
If yes, I agree editing via Vtiger_Record_Model should work too without deleting line items. The problem is that the edition of Inventory modules is coupled to the $_REQUEST variable. I guess that should be addressed.
I think there should be a check in the saving process of inventory modules to see if the lineitems variables are present. If, for example, the lineitems array is empty, then lineitems should not be touched. That way we could avoid using hacks like having to set the
ajaxaction
. Then the above code snippet can be used like this:$record = Vtiger_Record_Model::getInstanceById($id); $record->set('subject', 'test'); $record->save();
@prasad could you review this and merge it?
mentioned in commit 0d706035
@angelo.paglialonga did you have a chance to test this using line items? I will be honest here: I did not test editing line items.
Hi @ruben.estrada tomorrow I'll make a test and let you know what happens!
Hi @ruben.estrada yes it works, you have still to provide one full line item not just a field like 'quantity', you don't need to recalculate taxes and total though, it auto updates!
$lineitem=array( 'parent_id' => '6x48' ,'productid' => '14x33' ,'sequence_no' => '1' ,'quantity' => '2.000' ,'listprice' => '50.00000000' ,'discount_percent' => '0.000' ,'discount_amount' => '0.00000000' ,'comment' => 'VARIANTI: Taglia: Taglia L Scuola: ' ,'description' => '' ,'incrementondel' => '0' ,'tax1' => '0.000' ,'tax2' => '0.000' ,'tax3' => '0.000' ,'image' => '' ,'purchase_cost' => '0.00000000' ,'margin' => '0.00000000' ,'id' => '33x30' ,'product_name' => 'Felpa grigia - Taglia L' ,'entity_type' => 'Products' ,'deleted' => '0');```
order2 = vtws_revise(array('id'=>'6x48','LineItems'=>array('0'=>lineitem)), $current_user);```