dolibarr-dev
[Top][All Lists]
Advanced

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

Re: [Dolibarr-dev] Question about llx_element_contact and multi contact


From: Destailleur Laurent
Subject: Re: [Dolibarr-dev] Question about llx_element_contact and multi contact management on Calendar event
Date: Sat, 19 Oct 2013 14:33:42 +0200

Using llx_element_contact is the good solution for doing what you want to do.
llx_element_contact is good to link a contact (thirdparty or user) to an element (invoice, proposal, order, ...)
But events into agenda are not "standard" element. There are transversal objects. Also linking to thirdparty and user is not enough. We will want also to link to a "location" (a room for example). 
Also into the calendar standard, we need to follow the status "busy" or not for each linked contact and "mandatory or guest".

For this reason (and other one), we need another table. I suggest
llx_actioncomm_resources  
This table will contains id of event, id of element and type of element (type may be user, thirdparty and later room). Table will also have field "busy" and "mandatory".

So, I am afraid you must forget to use the contact existing template. The need is more specific and can not be compliant with "contact" template used for common elements.





2013/10/19 Florian Henry <address@hidden>
Hi all,

    I'm going to "reactivate" the contact management on calendar event.

        Task DoliForge : https://doliforge.org/tracker/?func=detail&aid=1097&group_id=144

    Actually in dev branch there is a page htdocs/comm/action/contact.php.
    This page is display only withintab's  event card if hidden constant AGENDA_USE_SEVERAL_CONTACTS is enabled, but it's not working...

    I have change the page htdocs/comm/action/contact.php to use the htdocs/core/tpl/contact.tpl.php as it is done in other object (propal/invoice/order/...)

    I'm working on auto assign Guest and Manager to the table llx_element_contact when event is created/updated/deleted (only if option AGENDA_USE_SEVERAL_CONTACTS is enabled of course).

    Here I notice something in the table llx_element_contact, there is no element_type column...

    So if we have a proposal id=1 and affect a contact id =1 we cannot add the same contact on a order id=1 because of uk integrity violation.

    When delete order or proposal all line with element_id=1 will be delete even they are not the concern ones...


    Also, I add a column element_type into llx_element_contact, and upgrade the commonobject.class.php to take this column account when adding,update, or delete. (method delete_contact,update_contact,add_contact)

    My question is how can we do to migrate/upgrade properly the data for this table.

        Here option I can imagine :
        1- Into SQL request of these commonobject methods do something like
             (WHERE element_type='$this->element' OR element_type IS NULL)

            This option will not solve the problem at all, but at least will keep the feature working (and keeping the current problem) and allow the element_type column working as well

        2- Create table llx_actioncomm_contact and do spécific method into class ActionComm.
        More easy but missing uniformize and "factorisation" code goal.

           3- Create a specific migration/upgrade screen to ask to user with what rowid the elemnt_id of element_contact is link with (proposal/order/invoice/project/fiche inter/supplier order/supplier invoice/...), I let you imagine what will be the result of 100000 line in this table...

What is your point of view ??

I would like to put this feature into 3.5, so Laurent, what is the best option ?

Regards

--
Florian HENRY
address@hidden
+33 6 03 76 48 07
http://www.open-concept.pro
Twitter : @_Open_Concept_
Secretaire de l'association Dolibarr


_______________________________________________
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]