For information we already have code for units management but not based on
hooks here: https://github.com/GPCsolutions/dolibarr/tree/3.2-units
This code is not necessarily clean or "production ready" that's why it
hasn't been submitted to the community yet but may be useful for you.
--
Pour information nous avons déjà du code correspondant à la gestion des
unités mais pas à base de hooks ici :
https://github.com/GPCsolutions/dolibarr/tree/3.2-units
Ce code n'est pas forcément nettoyé ou "production ready" d'où la non
proposition à la communauté pour le moment mais peut être utile dans ton
cas.


2012/11/29 Mapluz Dev <[email protected]>

>  Hi,
> Thanks for your responses :
>
> 1 -> I understood how to use the function *formCreateProductOptions *but
> this is not exactly what I wanted : see the picture here : *
> http://www.mapluz.fr/public/img1.jpg* : red circles show what I want to
> add to the proposal
>
> 2 -> thanks, i try your sample.
>
> 3-> my question was not very clear : here is what i wanted : *
> http://www.mapluz.fr/public/img2.jpg* : when you click on the button to
> add a row (product or service) area description is updated: Unit must
> appear (see the red circle on the bitmap)
>
> Le 28/11/2012 21:43, Manuel Muñoz a écrit :
>
>
>
>    ------------------------------
> *From:* Mapluz Dev <[email protected]> <[email protected]>
> *To:* Manuel Muñoz <[email protected]> <[email protected]>
> *Cc:* Posts about Dolibarr ERP & CRM development and coding
> <[email protected]> <[email protected]>
> *Sent:* Tuesday, November 27, 2012 6:55 PM
> *Subject:* Re: [Dolibarr-dev] Systeme Hook pour la facture dolibarr
> (invoice et propale)
>
>  avez-vous un exemple ?
> je ne comprends pas bien la solution jquery ?
> 1 - comment rajouter la nouvelle colonne UNITES avant  TVA ? Le jquery ne
> fait que modifier le DOM de maniere statique,non ?
>
> you must investigate about the jquery methods i mentioned  before so you
> can alter the DOM.
> (Methods: before, after, apend, prepend, closest) and write a script which
> alters the DOM (adding a column and a "ficticial" select box)
> the same script will store the selected value in a hidden input printed by
> formCreateProductOptions 's hook
>
> example
>
>  function formCreateProductOptions($parameters, $object, $action) {
>         global $db, $conf, $langs, $action, $mesg;
>
>
>             $str = '<input name="UNITES" id="UNITES" value="' .
> $_POST['UNITES'] . '">';
>             print $str;
>
> }
>
>
> 2 - comment hooker la fonction formObjectOptions pour lier mon nouveau
> controle UNITES à la BD ? Je ne trouve pas d'exemple dans dolibarr sur le
> hook de la propale !
> you have then to hook function
>
> doActions($parameters, $object, $action) {
>         global $conf, $langs, $action;
>         if (strstr($parameters['context'], 'propalcard')) {
>
>             switch ($action) {
>                 case 'addlines':
>
>                    // here you can add the code to store the "hidden"
> post value you want to store( $_POST['UNITES'])
>
>                     break;
>
>                .........
>
>
>
> 3 - comment faire pour que la colonne UNITES s'afficher dans 'Description'
> quand on clique sur le bouton 'Ajouter' ?
>
> merci encore de votre aide.
>
> je ne comprend pas ce que tu veux faire ici...
>
> tu pex dans le hook faire
> $object->description = $_POST['UNITES'] ." ".$object->description
>
> =========================================================
> ===========================
> Have you an example?
> I do not understand the solution jquery?
> 1 - how to add the new column UNITS before VAT? The jquery only modify
> the DOM statically, right?
> 2 - how to' hook' the function formObjectOptions to link my new control
> units in the database? I can not find an example in the dolibarr propale
> the hook!
> 3 - how to make column UNITS appear in 'Description' when you click on the 
> 'Add'
> button?
>
> thank you again for your help.
> ======================================================
> ===========================
>
> Le 27/11/2012 18:02, Manuel Muñoz a écrit :
>
>
>  You can use jquery's append prepend, before and after to add a <select>
> to the DOM, but this won't travel in the POST request.
> in my experience, What i've done is using a script that stores any value
> in a hidden input hook into by *formCreateProductOptions*.
> i placed the script in another function:  formObjectOptions
>    ------------------------------
> *From:* Mapluz Dev <[email protected]> <[email protected]>
> *To:* [email protected]
> *Sent:* Tuesday, November 27, 2012 4:51 AM
> *Subject:* [Dolibarr-dev] Systeme Hook pour la facture dolibarr (invoice
> et propale)
>
>  Bonjour,
>
> J'ai crée un module pour rajouter des informations à la facture dolibarr
> avec la méthode du hook, c'est à dire sans toucher au code de dolibarr.
> Je suis par exemple arrivé à rajouter une liste déroulante dans la partie '
> *Ajouter nouvelle ligne - zone libre*' en surchargeant la fonction *
> formCreateProductOptions*.
> Mais je n'arrive pas à rajouter de colonne dans le tableau : il y a 'TVA',
> 'PU HT', 'Qté', 'Réduc' et je voudrais mette avant 'TVA' une colonne
> 'Unité' et évidement pour chaque ligne je dois rajouter une liste
> déroulante avec la valeur des unités : exactement comme dolibarr fait avec
> TVA.
>
> Je n'arrive à 'hooker' le template !
>
> Avez-vous une idée
>
> Merci
>
> _______________________________________________
> Dolibarr-dev mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/dolibarr-dev
>
>
>
>
>
>
>
> _______________________________________________
> Dolibarr-dev mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/dolibarr-dev
>
>


-- 
*Raphaël Doursenaud*
05 35 53 97 13 - 06 68 48 20 10
[email protected]

-- 
 <http://gpcsolutions.fr>
http://gpcsolutions.fr
Technopole Hélioparc
2 avenue du Président Pierre Angot
64053 PAU CEDEX 9
SARL GPC.solutions au capital de 7 500 € - R.C.S. PAU 528 995 921
_______________________________________________
Dolibarr-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev

Répondre à