|
@@ -27,6 +27,7 @@ use App\Service\Rest\Operation\CreateOperation;
|
|
|
use App\Service\Rest\Operation\DeleteOperation;
|
|
use App\Service\Rest\Operation\DeleteOperation;
|
|
|
use App\Service\Rest\Operation\UpdateOperation;
|
|
use App\Service\Rest\Operation\UpdateOperation;
|
|
|
use App\Service\Utils\ArrayUtils;
|
|
use App\Service\Utils\ArrayUtils;
|
|
|
|
|
+use App\Service\Utils\DatesUtils;
|
|
|
use libphonenumber\PhoneNumber;
|
|
use libphonenumber\PhoneNumber;
|
|
|
use libphonenumber\PhoneNumberFormat;
|
|
use libphonenumber\PhoneNumberFormat;
|
|
|
use libphonenumber\PhoneNumberUtil;
|
|
use libphonenumber\PhoneNumberUtil;
|
|
@@ -214,6 +215,8 @@ class DolibarrSyncService
|
|
|
|
|
|
|
|
// Add an update operation if some data has to be updated
|
|
// Add an update operation if some data has to be updated
|
|
|
if (!empty($newSocietyData)) {
|
|
if (!empty($newSocietyData)) {
|
|
|
|
|
+ $newSocietyData['array_options']['options_2iopen_last_sync_date'] = DatesUtils::new()->format('c');
|
|
|
|
|
+
|
|
|
$operations[] = new UpdateOperation(
|
|
$operations[] = new UpdateOperation(
|
|
|
'Update society : '.$organization->getName().' ('.$organization->getId().')',
|
|
'Update society : '.$organization->getName().' ('.$organization->getId().')',
|
|
|
'thirdparties',
|
|
'thirdparties',
|
|
@@ -274,6 +277,7 @@ class DolibarrSyncService
|
|
|
if (null === $dolibarrContact) {
|
|
if (null === $dolibarrContact) {
|
|
|
// New contact
|
|
// New contact
|
|
|
$newContactData['socid'] = $dolibarrSocietyId;
|
|
$newContactData['socid'] = $dolibarrSocietyId;
|
|
|
|
|
+ $newContactData['array_options']['options_2iopen_last_sync_date'] = DatesUtils::new()->format('c');
|
|
|
|
|
|
|
|
$operations[] = new CreateOperation(
|
|
$operations[] = new CreateOperation(
|
|
|
'New contact: '.$person->getName().' '.$person->getGivenName().' ('.$person->getId().')',
|
|
'New contact: '.$person->getName().' '.$person->getGivenName().' ('.$person->getId().')',
|
|
@@ -291,6 +295,8 @@ class DolibarrSyncService
|
|
|
|
|
|
|
|
// add an update operation if some data has to be updated
|
|
// add an update operation if some data has to be updated
|
|
|
if (!empty($newContactData)) {
|
|
if (!empty($newContactData)) {
|
|
|
|
|
+ $newContactData['array_options']['options_2iopen_last_sync_date'] = DatesUtils::new()->format('c');
|
|
|
|
|
+
|
|
|
$operations[] = new UpdateOperation(
|
|
$operations[] = new UpdateOperation(
|
|
|
'Update contact: '.$person->getName().' '.$person->getGivenName().' ('.$person->getId().')'.
|
|
'Update contact: '.$person->getName().' '.$person->getGivenName().' ('.$person->getId().')'.
|
|
|
' in '.$organization->getName().' ('.$organization->getId().')',
|
|
' in '.$organization->getName().' ('.$organization->getId().')',
|
|
@@ -314,12 +320,17 @@ class DolibarrSyncService
|
|
|
}
|
|
}
|
|
|
if (!in_array($personId, $contactsProcessed, true)) {
|
|
if (!in_array($personId, $contactsProcessed, true)) {
|
|
|
// Ce personId n'existe plus dans les membres Opentalent de cette société, on delete
|
|
// Ce personId n'existe plus dans les membres Opentalent de cette société, on delete
|
|
|
|
|
+ $newContactData = [
|
|
|
|
|
+ 'statut' => '0',
|
|
|
|
|
+ 'array_options' => ['options_2iopen_last_sync_date' => DatesUtils::new()->format('c')],
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
$operations[] = new UpdateOperation(
|
|
$operations[] = new UpdateOperation(
|
|
|
'Disable contact: '.$contactData['lastname'].' '.$contactData['firstname'].' ('.$personId.')'.
|
|
'Disable contact: '.$contactData['lastname'].' '.$contactData['firstname'].' ('.$personId.')'.
|
|
|
' from '.$organization->getName().' ('.$organization->getId().')',
|
|
' from '.$organization->getName().' ('.$organization->getId().')',
|
|
|
'contacts',
|
|
'contacts',
|
|
|
(int) $contactData['id'],
|
|
(int) $contactData['id'],
|
|
|
- ['statut' => '0'],
|
|
|
|
|
|
|
+ $newContactData,
|
|
|
$contactData
|
|
$contactData
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|