dolibarr-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dolibarr-dev] Hooks for ordercard


From: Laurent Destailleur (eldy)
Subject: Re: [Dolibarr-dev] Hooks for ordercard
Date: Tue, 17 Jul 2012 01:50:34 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

I think doc is not up to date.

You can try this

        if (in_array('somecontext',explode(':',$parameters['context'])))

instead of

        if ($parameters->context == 'somecontext') 



Le 17/07/2012 01:37, Manuel Muñoz a écrit :
Dear Eldy:
Thanks for your fast reply. I'm actually working in the 3.2 version.

After reading this on the wiki it got me confused:

 class ActionsYourModuleName // extends CommonObject 
{ 
 
    /** Overloading the doActions function : replacing the parent's function with the one below 
     *  @param      parameters  meta datas of the hook (context, etc...) 
     *  @param      object             the object you want to process (an invoice if you are in invoice module, a propale in propale's module, etc...) 
     *  @param      action             current action (if set). Generally create or edit or null 
     *  @return       void 
     */ 
    function doActions($parameters, $object, $action) 
    { 
        print_r($parameters); 
        echo "action: ".$action; 
        print_r($object); 
 
        if ($parameters->context == 'somecontext') 
        { 
          // do something only for the context 'somecontext'
        }
    }
}
In the case mentioned in the previous post $parameters is not an object but an array (as you are replying). So is the example what got me confused
Thank you very much!



From: Laurent Destailleur (eldy) <address@hidden>
To: address@hidden
Sent: Monday, July 16, 2012 4:25 PM
Subject: Re: [Dolibarr-dev] Hooks for ordercard

You should receive into the key context of the array $parameters the list of context you are inside. So you should have "ordercard" inside this array.
If not, can you check you use version 3.2 (may be this as fixed with 3.2) ?


Le 14/07/2012 23:27, Manuel Muñoz a écrit :
Dear Developevelopment and coding <address@hidden>



i'm trying to implement a hook for the ordercard context overloading "formObjectOptions" function

this is the print_f for the $parameters object
array ( [colspan] => colspan="2" [context] => searchform:leftblock:toprightmenu:ordercard ).

the question is: how can i validate that the context es actually "ordercard"? what type of data i the element context in this case?

already tried with ststr and substr function, but i don't seem to get a match.

Thanks in advance for all your comments


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



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




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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]