[Top][All Lists]

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

Re: [Dolibarr-dev] extrafields label

From: Doursenaud , Raphaël
Subject: Re: [Dolibarr-dev] extrafields label
Date: Fri, 23 May 2014 15:17:05 +0200

Wow, what a hack !
I can't figure why in the world you need _javascript_ for that.
I understand you want to use a quick and dirty fix like that to get the feature right now, but please try to fix the root problem so we can all benefit from this.
If you don't want to do it right now, fine, just open a task in Doliforge ;)

@fhenry, the extrafield usage from module descriptor looks like a legit use to me. Would you mind opening a task on Doliforge?

2014-05-23 14:39 GMT+02:00 Christophe Battarel <address@hidden>:
Finally , i have found a way to skirt the problem with some jquery and a hook; i give you the code below if you face the same problem :

    function formObjectOptions($parameters, $object, $action)

        // translate extrafields labels
        print '<script type="text/_javascript_">

            $(document).ready(function() {
                $("input[name^=options_").each(function() {
                    var labelCell = $(this).parent("td").prev("td");
                    // get the translation with an ajax call
$.get("'.dol_buildpath('/mymodule/',1).'ajax/translate.php", {text: $(labelCell).text(), langfile: "address@hidden"}, function(data) { $(labelCell).html(data); }, "html");

and here is the ajax translate.php program :


address@hidden("../../");                    // For root directory
if (! $res) address@hidden("../../../");        // For "custom" directory

$langfile = GETPOST('langfile');
$text = GETPOST('text');

print $langs->trans($text);

Le 23/05/2014 14:39, Philippe Grand a écrit :

Le 23/05/2014 14:35, Florian HENRY a écrit :
About that extrafield define and use by extranal module it can be nice to be able to define them into module descriptor rather than play with SQL request to create them, but it's another story.
I rather see what you mean ;-)
and agree one hundred times with you

Dolibarr-dev mailing list

Raphaël Doursenaud
Directeur technique (CTO)
Expert certifié en déploiement Google Apps
+33 (0)5 35 53 97 13 - +33 (0)6 68 48 20 10
Technopole Hélioparc
2 avenue du Président Pierre Angot
64053 PAU CEDEX 9
SARL au capital de 7 500 € - R.C.S. PAU 528 995 921

reply via email to

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