Author Topic: Using another component's profile as the source data for nbill  (Read 252 times)

Offline ozziemate

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
I do realise that it could be messy and probably tedious to set up.
I notice that the profile fields have numerous options for pre-filling and criteria and was wondering if any one could suggest the best way to replicate or "fetch" data from another components profile and return it in Nbills profile manager so that Nbills profile manager becomes a "slave" to the other components data.

As the dev site currently has three user profiles I intend to use only one, Sobi pro listing as the master data source for all components. Joomla ACL should not be effected.

Eventually upon success I will remove the submit button of the profile manager to prevent " reverse"data issues being accidentally created.
for example:
the field required to be fetched could be sobi_telephone to be returned in NBILL_ telephone
any help would be appreciated....

I am using joomla2.5 and Nbill latest download

I would hope the results of this thread maybe useful for others seeking to do similar

Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,954
    • View Profile
Re: Using another component's profile as the source data for nbill
« Reply #1 on: 05/April/2012, 09:02:25 AM »
If your master component allows you to hook into events when profile data is updated, you could use that to programatically update nBill's entity and contact tables (an entity represents a client or supplier, a contact represents an individual person - they are connected in a many to many relationship by the entity_contact table. Contacts do not have to be Joomla users but they can be, and if they are, they will have their Joomla user ID in the user_id column of the contact table).

If you wanted to use nBill as the master source, you can hook into the event folders to update other components' data sources when a client or administrator updates a profile. See http://www.nbill.co.uk/help/index.php?page=adding-your-own-integration.html

Offline ozziemate

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Re: Using another component's profile as the source data for nbill
« Reply #2 on: 06/April/2012, 01:43:44 AM »
Thanks for that! [ I appreciate you are very busy at this forum ]
Please excuse my far from adequate knowledge of data base function etc.. [learning all the time]

Intuitively it makes sense to me to include within the NBILL profile fields a statment/query that opens and calls upon another components profile field. Therefore replicating and prefilling data into NBILL and displayed whenever NBILL is used.
Is this easilly done using the NBIll profile fields provisions?
If so, what sort of query/call would I include in the NBILL field provisions?

refering to the "default value" of the field 

« Last Edit: 06/April/2012, 02:54:02 AM by ozziemate »

Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,954
    • View Profile
Re: Using another component's profile as the source data for nbill
« Reply #3 on: 06/April/2012, 08:01:42 AM »
That's not likely to work I'm afraid. The default value is just the value that is used if no other value has been specified. Whilst it might be theoretically possible to lookup that value from another location, not only would that be somewhat wasteful of resources (requiring a separate database lookup for each field), it would only work the first time the field was used. After that, the value that was pre-populated would be persisted in the database, and even if the person updated their profile in the other component, it would have no effect on nBill which would continue to use the original value.

Unless the components involved include mapping features specifically designed for the purpose (which nBill doesn't), synchronising the profile fields of 2 different components is not trivial and can only really be acheived by a programmer with a reasonable knowledge of PHP and database interaction, and even then, only if the component that is being used as the master provides some way of hooking in to profile update events (nBill does).

 

anything