PlaySMS and integrating users from an AD, adding contacts through .csv and group management

Cool, that worked, thanks!

I’ll let you know if I solve the contact and group id.

Regarding the translation I only have a few folders left in features, ill update the other thread when I’m done!

One more quick question, where do you set the size of the groupcode? Some of the schools have very long names, so I need a slightly bigger cap than 16.

Longest school name at the moment is 21 without the @.

1 place is in the table, field code has length 20.

anton

Alright, I’ll look into it, I’m fairly sure I counted to 16 though.

EDIT: Should be this simple then: ALTER TABLE playsms_featurePhonebook_group MODIFY code-column-name VARCHAR(30)

Currently at home, but it should work.

Cheers

Alright, regarding the sync of the contacts and their groups I’m really struggling to wrap my head around it.

As far as I’ve understood I write to the contact table with the contact information, thats fine, but I cant figure out how you translate the groupcode to groupid when you upload from the built-in solution. Is it in the code in /phonebook/fn.php? Or maybe phonebook/phonebook.php?

Im guessing you write to the database with the contacts, then check if the group code column of the csv file is in the group table, then if it is, take the ids from the contact and group tables and insert it into the pid and gpid as you go through the file, with the id of the id-table to autoincrement?

starts here:

anton

Some more feedback regarding the sanitizing of characters, you are also sanitizing the Tags, along with the Group codes, I should be able to find this myself manually, but you should consider doing that change as well on your end if you wish for people to have the opportunity to have ‘special’ chars in the tags.

can’t do it right now, but I might, so please post an issue in github as a reminder

thanks,
anton

1 Like

Ok, got a big problems regarding adding contacts to the system.

Since my project revovles around contacting parents of children at school the same number will occur multiple times if that parent has more than one child at the schools we support. Is there an easy way to fix this? Maybe removing the demand for a unique number among contacts? (Only the first child registerd will actually show, then it will show all the groups that number is registered to, aka the group of the named child and all the other groups the other childs are a member of.

Reason we want to have the same occurence of number multiple times is the fact that it’d be a bit weird to send a message regarding child ‘x’ when it was meant for child ‘y’.

EDIT: Also when adding contacts I’ve noticed that letters like æøå/ÆØÅ isnt supported in the tags of the contact, I cant find any sanitizing in the phonebook.php, you know where this is done?

tags sanitized in phonebook_tags_clean() on fn.php:
https://github.com/antonraharja/playSMS/blob/master/web/plugin/feature/phonebook/fn.php#L27

Hi,

This one currently not available, I mean you can always customize the code, its in phonebook.php, but I have no plan to do this unless someone working on this (meaning that guy will check and double check the result of multiple mobile phones occurrences everywhere, on phonebook lookup etc…)

anton

Take a look here:

I suppose if you make that if line set to FALSE, it will always add new contact regardless of its in there already

anton

Cool, I’ll test that when I get to work tomorrow. I understand that this is not relevant for most cases, but you probably understand why this is relevant for me?

Would for example be very weird to have like the name of a son when it was meant for the daughter of the family in the SMS.

EDIT: Just read what you wrote, so that will add contacts no matter what over and over? So if I need to update all the contacts Ill need to delete all rows in the contact-database then? Like next semester, when the students will go one year up so they change classes, I cant just import contacts from the import-function again to update?

You said you want to remove the uniqueness of mobile phone number, that means you can add multiple contacts with different name or same name with the same phone number

anton

Yes, but it’d still be nice to be able to update information as well, through some other form of the id, probably the name string would be the best way to differentiate between them.

If this isnt possible its not the biggest of deals, we’d just have to delete contacts through a sql command that arent a part of certains groups. (As in delete all school classes contacts, but not teachers and other contacts that won’t really change, shouldnt --> groups from other sources than the children-CSV)

EDIT: explained a bit better of what I meant with “certain groups”

Tried running the code, with the save_to_group set to FALSE, it makes no difference.

I still have the same problem with the first child registered to that number being a part of all the groups of the children that got registered later on in the same family. In other words, I still only get one contact per number.

Tried importing the .csv file again, I did not getting any more contacts, which is a good thing atleast, but I guess those are related together. If I can get all the children registered to the same number seperated, but contacts with the same name will be duplicated if added again through the csv-file, its fine, as we won’t add the children that often, so we can simply empty the groups through SQL when we need to. (Maybe like once each semester, if theres some ppl changing school or w/e we can manually change that, as that doesnt happen often)

The IF line not save_to_group line, I was highlighting the IF line

if ($c_pid = $list[0]['id']) {

replace with

if (FALSE) {

anton

Ah, of course, I’m braindead. I’ll blame the fact it was 09.00 when I asked it. :stuck_out_tongue:

EDIT: It still seems to do the same thing though, I’ll try to restart the server to if it works then, but don’t see a reason why that would make a difference.

by making it FALSE it will add contacts (run the “else” block) no matter if its already in the phonebook or not

anton

Yeah, but for some reason it’s still adding multiple groups to the same number. So the problem persists. Can it be due to the CSV-file having an extra comma on each line?

As in: Name, Mobile, Email, Group code, Tags, ,