Giter Club home page Giter Club logo

Comments (8)

back2arie avatar back2arie commented on August 19, 2024

Hi

It's possible but not in the easy way, since the plugin is not ready yet.
All you have to do is modify the script a "little" bit, first you have to make 2 database connection, for kalkun (via MySQL) and the phonebook entries (via ODBC).

You must modify all phonebook activity to use the second connection (ODBC) instead of first connection (MySQL).

PS: Why don't just import all external database to Kalkun via CSV? Or just use Kalkun simple API to send SMS to external database.

from kalkun.

MarkoD avatar MarkoD commented on August 19, 2024

I could import all contacts from the external DB to Kalkun, but I'd have to do that on a scheduled basis (i.e. every 5 minutes) and it would take some time because we are talking about a lot of rows.

Let me explain the situation: We have all customers' data (email, phone, etc.) stored and maintained in another system (CRM-like) and I want Kalkun to access the data in that system every time it reads contacts. That way every change of a customer's data in the CRM system is immediately propagated to Kalkun.

A few questions regarding your post:

  1. Where and how do I define a second database (ODBC) connection in Kalkun? Do I add another record into database.php (e.g. $db['default2']...)?

  2. What PHP files do I need to modify so Kalkun reads all contacts from the other database? Are all contacts-related SQL scripts in a single PHP file or are they spread in multiple files?

Thanks for your reply!

from kalkun.

back2arie avatar back2arie commented on August 19, 2024

Before you starting, is it just "readonly" phonebook or "full access" one? Because you must maintain all phonebook database relationship, currently there are 4 related tables including pbk, user_group, pbk_groups, and user, see https://github.com/back2arie/Kalkun/wiki/Database-Schema. And you must have exact structure on both database. And frankly, maintaining this relationship and modifying the script is really not easy task.

Please re-calculate the effort implementing this function instead of just copy the phonebook from external database.

from kalkun.

MarkoD avatar MarkoD commented on August 19, 2024

Kalkun will have only read-only access to the phonebook, while the CRM-system will modify it. I'm planning to create views in the phonebook database that will present phone numbers exactly like Kalkun expects (i.e. I'll create a 'pbk' view in the contacts database).

Consequently, anyone trying to edit a contact entry in Kalkun will probably get a database error, which is okay with me, users will know that they should edit contacts in the CRM system and not in Kalkun...

from kalkun.

back2arie avatar back2arie commented on August 19, 2024

OK, for starting you need to figure how to join several tables from different database, because you need that for sure.
Next, you need to define the owner of the phonebook, by adding set value of user_id on pbk, or maybe you want special condition where all phonebook can readed by all user (which is easier). Basically all phonebook database activity is located on /application/models/phonebook_model.php.

Let me know if you need help.

from kalkun.

MarkoD avatar MarkoD commented on August 19, 2024

I've looked at the phonebook_model.php file and I have one question: How do I execute SQL queries to a different database other than $this->db?

If I add another record into database.php (e.g. $db['external'][...]), how do I access that database instead of the default one in phonebook_model.php? My guess is "$this->db['external']", am I right?

from kalkun.

back2arie avatar back2arie commented on August 19, 2024

Hi

You must load the database first:
$this->external = $this->load->database('external', TRUE);

Then, you can access active record class, like this:
$this->external->query();

For more information, see http://codeigniter.com/user_guide/database/connecting.html

from kalkun.

MarkoD avatar MarkoD commented on August 19, 2024

Thanks for the info, my situation has changed a little bit (see #14), I'm closing this issue for now.

from kalkun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.