Hi Marcos,

 

I started to review all trigger.

As far as I see, all your bug report fall in 2 categories :

-          Wrong handling of error for bug display

-          Object doesn’t rollback action if trigger fail

 

My last commit in develop create a new method in commonobject class for trigger 
call.

You just have to call : $result=$this->call_trigger(tigger_name, $user); 

And treat error.

This permit to avoid duplicate same 5 lines of code everywhere.

 

Cedric

 

De : dolibarr-dev-bounces+c.gross=kreiz-it...@nongnu.org 
[mailto:dolibarr-dev-bounces+c.gross=kreiz-it...@nongnu.org] De la part de 
Marcos García
Envoyé : jeudi 3 juillet 2014 10:39
À : Posts about Dolibarr ERP & CRM development and coding
Objet : [Dolibarr-dev] Trigger refactor

 

Hi all:

 

I was thinking of refactoring things related to triggers. The first step I 
thought was moving all the common functions to an abstract class.

 

I've made a GIST so that you can take a look: 
https://gist.github.com/marcosgdf/2aacea869efe67c0d1cf

 

And so the triggers will extend from it resulting in: 
https://gist.github.com/marcosgdf/64464f14f32ce3667dad

 

This is the first step to improve triggers handling.

 

What do you think about it?

 

Regards,

 

Marcos García

marcos...@gmail.com

_______________________________________________
Dolibarr-dev mailing list
Dolibarr-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev

Répondre à