AnsweredAssumed Answered

Automatic save-job for contacts

Question asked by community-support on Jan 13, 2014
Latest reply on Jan 13, 2014 by community-support
Hi everyone,

I'm creating a job, which should just save all contacts from my array once. But I have no idea how to get in each contact and save it. I'm just a trainee ;) It's needed because after saving the contact, it gets synchronized to SAP.

My code so far:

function setSAPcontactnumber(){

global $db;

global $contacts;

global $list;

//Here I fill my array with the IDs

  $sql= 'SELECT DISTINCT c.id FROM contacts c

   JOIN accounts_contacts ac ON ac.contact_id=c.id

   JOIN accounts a ON a.id=ac.account_id

   WHERE a.deleted=0 AND c.deleted=0 AND (c.sap_partnernummer IS NULL OR c.sap_partnernummer='') AND (a.sap_kundennummer !='')';

  $result = $db->query($

  $i = 0;           

  while  ($row = mysql_fetch_assoc($result)){

   $res[$i] = $row;

   $i++;

  }

return true;

}

Tanks in advance for you help!

nlaan

(from nlaan)

Outcomes