Module CustomFields Dev: Difference between revisions

Jump to navigation Jump to search
→‎Preliminary test: added an example output
(→‎Preliminary test: added an example output)
Line 178: Line 178:
* If there is a list of '''contexts''' but the module cannot be found in the list: the hookmanager is defined but the module has not defined a context, you still have to implement the hooks. Jump to [[Module_CustomFields_Dev#Hooks]].
* If there is a list of '''contexts''' but the module cannot be found in the list: the hookmanager is defined but the module has not defined a context, you still have to implement the hooks. Jump to [[Module_CustomFields_Dev#Hooks]].


* If there's no '''conf hooks_modules''': this variable is not necessary, empty or not it doesn't matter.
* If there's no '''conf hooks_modules''': this variable is not necessary, empty or not it doesn't matter. But if you see customfields and/or customfieldspdftest inside the list, it is a confirmation that CustomFields indeed is hooking the module correctly.


* If there's no '''hooks attached''', or CustomFields cannot be found in the list: CustomFields has not been properly configured to hook to this module, or you forgot to disable then re enable CustomFields in order to update the CustomFields's hooks. Jump to [[Module_CustomFields_Dev#Configuring_CustomFields_to_support_the_module]].
* If there's no '''hooks attached''', or CustomFields cannot be found in the list: CustomFields has not been properly configured to hook to this module, or you forgot to disable then re enable CustomFields in order to update the CustomFields's hooks. Jump to [[Module_CustomFields_Dev#Configuring_CustomFields_to_support_the_module]].
Line 185: Line 185:


* If there is '''$user->rights''' but the module can't be found in the list: either the name for the rights is different (this often happens, the rights array is not yet standardized), or either the rights are hardcoded into the module's code (rights should be announced to the $user->rights array, but sometimes it happens that the dev forgot to do so, and thus the right is entirely hardcoded and you can't find it in the dynamic rights array). In any of these two cases, you will have to manually read the module's code to find the right. Also, maybe there is no security implemented, but since $user->rights is declared this is less probable.
* If there is '''$user->rights''' but the module can't be found in the list: either the name for the rights is different (this often happens, the rights array is not yet standardized), or either the rights are hardcoded into the module's code (rights should be announced to the $user->rights array, but sometimes it happens that the dev forgot to do so, and thus the right is entirely hardcoded and you can't find it in the dynamic rights array). In any of these two cases, you will have to manually read the module's code to find the right. Also, maybe there is no security implemented, but since $user->rights is declared this is less probable.
Here is an example of output on a correctly hooked module (invoice):
<pre>
table_element: facture - table_element_line: facturedet - contexts: Array
(
    [0] => searchform
    [1] => leftblock
    [2] => toprightmenu
    [3] => invoicecard
)
- conf hooks_modules: Array
(
    [customfields] => invoicecard:propalcard:productcard:ordercard:thirdpartycard:contactcard:ordersuppliercard:invoicesuppliercard:membercard:actioncard:projectcard:projecttaskcard:contractcard:interventioncard:doncard:tripsandexpensescard:taxvatcard:expeditioncard:invoicecard:propalcard:ordercard:ordersuppliercard:invoicesuppliercard
    [customfieldspdftest] => Array
        (
            [0] => pdfgeneration
            [1] => ordersuppliercard
        )
)
- hooks attached: Array
(
    [invoicecard] => Array
        (
            [customfields] => ActionsCustomFields Object
                (
                )
        )
)
- user rights: stdClass Object
(
    [user] => stdClass Object
        (
            [user] => stdClass Object
                (
                    [lire] => 1
                    [creer] => 1
                    [password] => 1
                    [supprimer] => 1
                    [export] => 1
                )
            [self] => stdClass Object
                (
                    [creer] => 1
                    [password] => 1
                )
            [user_advance] => stdClass Object
                (
                    [readperms] => 1
                    [write] => 1
                )
            [self_advance] => stdClass Object
                (
                    [readperms] => 1
                    [writeperms] => 1
                )
            [group_advance] => stdClass Object
                (
                    [read] => 1
                    [readperms] => 1
                    [write] => 1
                    [delete] => 1
                )
        )
    [facture] => stdClass Object
        (
            [lire] => 1
            [creer] => 1
            [invoice_advance] => stdClass Object
                (
                    [unvalidate] => 1
                    [send] => 1
                )
            [valider] => 1
            [paiement] => 1
            [supprimer] => 1
            [facture] => stdClass Object
                (
                    [export] => 1
                )
        )
    [propale] => stdClass Object
        (
            [lire] => 1
            [creer] => 1
            [valider] => 1
            [propal_advance] => stdClass Object
                (
                    [send] => 1
                )
            [cloturer] => 1
            [supprimer] => 1
            [export] => 1
        )
    [produit] => stdClass Object
        (
            [lire] => 1
            [creer] => 1
            [supprimer] => 1
            [export] => 1
        )
    etc... a lot of other rights...
)
</pre>


When you are finished with implementing the support of CustomFields in the module, you should delete these debug lines.
When you are finished with implementing the support of CustomFields in the module, you should delete these debug lines.
439

edits

Navigation menu