dolibarr-dev
[Top][All Lists]
Advanced

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

Re: [Dolibarr-dev] Systeme Hook pour la facture dolibarr (invoice et pro


From: Régis Houssin
Subject: Re: [Dolibarr-dev] Systeme Hook pour la facture dolibarr (invoice et propale)
Date: Fri, 30 Nov 2012 09:38:17 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0

yes you are right Manuel, sorry ;-)


Le 30/11/12 09:30, Mapluz Dev a écrit :
Merci de votre aides, je pense avoir bien compris.

A+
Le 29/11/2012 17:23, Manuel Muñoz a écrit :
here's an example on how to add columns to a table with jquery

http://stackoverflow.com/questions/1655319/inserting-a-table-column-with-jquery

if you inspect the html code of a proposition you will notice you can reference the main table with the id "tablelines".

as Regis wrote there's no other way but modifiing the core or overloading the whole code
in the doActions you could place the html code (a "copy paste" of the view code in propal.php) , print it when the corresponding $action is ocurring and then cancel the rest of "core code" by setting $action = '' . ($action should be declared as a global in doActions context)

From: Mapluz Dev <address@hidden>
To: Manuel Muñoz <address@hidden>; Posts about Dolibarr ERP & CRM development and coding <address@hidden>
Sent: Thursday, November 29, 2012 3:38 AM
Subject: Re: [Dolibarr-dev] Systeme Hook pour la facture dolibarr (invoice et propale)

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 <address@hidden>
To: Manuel Muñoz <address@hidden>
Cc: Posts about Dolibarr ERP & CRM development and coding <address@hidden>
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 <address@hidden>
To: address@hidden
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
address@hidden
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev










Cordialement,
-- 
Régis Houssin
---------------------------------------------------------
Cap-Networks
Cidex 1130
34, route de Gigny
71240 MARNAY
FRANCE
VoIP: +33 1 83 62 40 03
GSM: +33 6 33 02 07 97
Web: http://www.cap-networks.com/
Email: address@hidden

Dolibarr developer: address@hidden
Web Portal: http://www.dolibarr.fr/
SaaS offers: http://www.dolibox.fr/
Shop: http://www.dolistore.com/
Development platform: https://doliforge.org/
---------------------------------------------------------

reply via email to

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