Línea 23... |
Línea 23... |
23 |
use PhpOffice\PhpSpreadsheet\IOFactory;
|
23 |
use PhpOffice\PhpSpreadsheet\IOFactory;
|
24 |
use LeadersLinked\Form\DiscoveryContact\ContactUploadForm;
|
24 |
use LeadersLinked\Form\DiscoveryContact\ContactUploadForm;
|
25 |
use LeadersLinked\Mapper\DiscoveryContactInteractionMapper;
|
25 |
use LeadersLinked\Mapper\DiscoveryContactInteractionMapper;
|
26 |
use LeadersLinked\Mapper\DiscoveryContactInteractionTypeMapper;
|
26 |
use LeadersLinked\Mapper\DiscoveryContactInteractionTypeMapper;
|
27 |
use LeadersLinked\Model\DiscoveryContactInteraction;
|
27 |
use LeadersLinked\Model\DiscoveryContactInteraction;
|
- |
|
28 |
use LeadersLinked\Model\DiscoveryContactInteractionType;
|
Línea 28... |
Línea 29... |
28 |
|
29 |
|
29 |
|
30 |
|
30 |
class DiscoveryContactController extends AbstractActionController
|
31 |
class DiscoveryContactController extends AbstractActionController
|
Línea 197... |
Línea 198... |
197 |
|
198 |
|
Línea -... |
Línea 199... |
- |
|
199 |
|
- |
|
200 |
$discoveryContact->company_id = $currentCompany->id;
|
- |
|
201 |
|
- |
|
202 |
|
- |
|
203 |
$discoveryContactInteractionTypeMapper = DiscoveryContactInteractionTypeMapper::getInstance($this->adapter);
|
- |
|
204 |
$discoveryContactInteractionTypeDefault = $discoveryContactInteractionTypeMapper->fetchOneDefaultByCompanyId($currentCompany->id);
|
- |
|
205 |
if(!$discoveryContactInteractionTypeDefault) {
|
198 |
|
206 |
$discoveryContactInteractionTypeDefault = $discoveryContactInteractionTypeMapper->fetchOneFirstActiveByCompanyId($currentCompany->id);
|
- |
|
207 |
$discoveryContactInteractionTypeDefault->default = DiscoveryContactInteractionType::DEFAULT_YES;
|
199 |
$discoveryContact->company_id = $currentCompany->id;
|
208 |
$discoveryContactInteractionTypeMapper->update($discoveryContactInteractionTypeDefault);
|
200 |
|
209 |
}
|
Línea 201... |
Línea 210... |
201 |
|
210 |
|
202 |
|
211 |
|
Línea -... |
Línea 212... |
- |
|
212 |
$discoveryContactMapper = DiscoveryContactMapper::getInstance($this->adapter);
|
- |
|
213 |
$result = $discoveryContactMapper->insert($discoveryContact);
|
- |
|
214 |
|
- |
|
215 |
if ($result) {
|
- |
|
216 |
$this->logger->info('Se agrego el Contacto : ' . $discoveryContact->first_name . ' ' . $discoveryContact->last_name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
|
- |
|
217 |
|
- |
|
218 |
if($discoveryContactInteractionTypeDefault) {
|
- |
|
219 |
$discoveryContactInteraction = new DiscoveryContactInteraction();
|
- |
|
220 |
$discoveryContactInteraction->company_id = $currentCompany->id;
|
- |
|
221 |
$discoveryContactInteraction->user_id = $currentUser->id;
|
203 |
$discoveryContactMapper = DiscoveryContactMapper::getInstance($this->adapter);
|
222 |
$discoveryContactInteraction->interaction_type_id = $discoveryContactInteractionTypeDefault->id;
|
204 |
$result = $discoveryContactMapper->insert($discoveryContact);
|
223 |
|
205 |
|
224 |
$discoveryContactInteractionMapper = DiscoveryContactInteractionMapper::getInstance($this->adapter);
|
206 |
if ($result) {
|
225 |
$discoveryContactInteractionMapper->insert($discoveryContactInteraction);
|
207 |
$this->logger->info('Se agrego el Contacto : ' . $discoveryContact->first_name . ' ' . $discoveryContact->last_name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
|
226 |
}
|
Línea 768... |
Línea 787... |
768 |
}
|
787 |
}
|
Línea 769... |
Línea 788... |
769 |
|
788 |
|
770 |
|
789 |
|
771 |
$discoveryContactMapper = DiscoveryContactMapper::getInstance($this->adapter);
|
- |
|
Línea -... |
Línea 790... |
- |
|
790 |
$discoveryContactMapper = DiscoveryContactMapper::getInstance($this->adapter);
|
- |
|
791 |
$discoveryContactInteractionTypeMapper = DiscoveryContactInteractionTypeMapper::getInstance($this->adapter);
|
- |
|
792 |
|
- |
|
793 |
$discoveryContactInteractionTypeMapper = DiscoveryContactInteractionTypeMapper::getInstance($this->adapter);
|
- |
|
794 |
$discoveryContactInteractionTypeDefault = $discoveryContactInteractionTypeMapper->fetchOneDefaultByCompanyId($currentCompany->id);
|
- |
|
795 |
if(!$discoveryContactInteractionTypeDefault) {
|
- |
|
796 |
$discoveryContactInteractionTypeDefault = $discoveryContactInteractionTypeMapper->fetchOneFirstActiveByCompanyId($currentCompany->id);
|
- |
|
797 |
$discoveryContactInteractionTypeDefault->default = DiscoveryContactInteractionType::DEFAULT_YES;
|
- |
|
798 |
$discoveryContactInteractionTypeMapper->update($discoveryContactInteractionTypeDefault);
|
- |
|
799 |
}
|
772 |
$discoveryContactInteractionTypeMapper = DiscoveryContactInteractionTypeMapper::getInstance($this->adapter);
|
800 |
|
773 |
$discoveryContactInteractionType = $discoveryContactInteractionTypeMapper->fetchOneFirstActiveByCompanyId($currentCompany->id);
|
- |
|
- |
|
801 |
|
Línea 774... |
Línea 802... |
774 |
|
802 |
|
775 |
$discoveryContactInteractionMapper = DiscoveryContactInteractionMapper::getInstance($this->adapter);
|
803 |
$discoveryContactInteractionMapper = DiscoveryContactInteractionMapper::getInstance($this->adapter);
|
776 |
|
804 |
$discoveryContactLogMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
|
Línea 822... |
Línea 850... |
822 |
|
850 |
|
823 |
|
851 |
|
Línea 824... |
Línea 852... |
824 |
if($discoveryContactMapper->insert($discoveryContact)) {
|
852 |
if($discoveryContactMapper->insert($discoveryContact)) {
|
Línea 825... |
Línea 853... |
825 |
$new_contacts++;
|
853 |
$new_contacts++;
|
826 |
|
854 |
|
827 |
if($discoveryContactInteractionType) {
|
855 |
if($discoveryContactInteractionTypeDefault) {
|
828 |
|
856 |
|
829 |
$discoveryContactInteraction = new DiscoveryContactInteraction();
|
857 |
$discoveryContactInteraction = new DiscoveryContactInteraction();
|
Línea 830... |
Línea 858... |
830 |
$discoveryContactInteraction->company_id = $currentCompany->id;
|
858 |
$discoveryContactInteraction->company_id = $currentCompany->id;
|
831 |
$discoveryContactInteraction->contact_id = $discoveryContact->id;
|
859 |
$discoveryContactInteraction->contact_id = $discoveryContact->id;
|
- |
|
860 |
$discoveryContactInteraction->interaction_type_id = $discoveryContactInteractionTypeDefault->id;
|
- |
|
861 |
$discoveryContactInteraction->user_id = $currentUser->id;
|
- |
|
862 |
|
- |
|
863 |
$discoveryContactInteractionMapper->insert($discoveryContactInteraction);
|
- |
|
864 |
}
|
- |
|
865 |
|
- |
|
866 |
$discoveryContactLog = new DiscoveryContactLog();
|
- |
|
867 |
$discoveryContactLog->company_id = $currentCompany->id;
|
- |
|
868 |
$discoveryContactLog->contact_id = $discoveryContact->id;
|
- |
|
869 |
$discoveryContactLog->user_id = $currentUser->id;
|
- |
|
870 |
$discoveryContactLog->activity = 'LABEL_RECORD_CONTACT_ADDED';
|
- |
|
871 |
$discoveryContactLog->details = 'LABEL_FIRST_NAME : ' . $discoveryContact->first_name . PHP_EOL .
|
- |
|
872 |
'LABEL_LAST_NAME : ' . $discoveryContact->last_name . PHP_EOL .
|
- |
|
873 |
'LABEL_CORPORATE_EMAIL : ' . $discoveryContact->corporate_email . PHP_EOL .
|
- |
|
874 |
'LABEL_COMPANY : ' . $discoveryContact->company . PHP_EOL .
|
- |
|
875 |
'LABEL_POSITION : ' . $discoveryContact->position . PHP_EOL .
|
- |
|
876 |
'LABEL_COUNTRY : ' . $discoveryContact->country . PHP_EOL;
|
- |
|
877 |
|
- |
|
878 |
|
- |
|
879 |
if ($discoveryContact->state) {
|
- |
|
880 |
$discoveryContactLog->details .= 'LABEL_STATE : ' . $discoveryContact->state . PHP_EOL;
|
- |
|
881 |
}
|
- |
|
882 |
if ($discoveryContact->city) {
|
- |
|
883 |
$discoveryContactLog->details .= 'LABEL_CITY : ' . $discoveryContact->city . PHP_EOL;
|
- |
|
884 |
}
|
- |
|
885 |
if ($discoveryContact->phone) {
|
- |
|
886 |
$discoveryContactLog->details .= 'LABEL_PHONE : ' . $discoveryContact->phone . PHP_EOL;
|
- |
|
887 |
}
|
- |
|
888 |
if ($discoveryContact->phone_extension) {
|
- |
|
889 |
$discoveryContactLog->details .= 'LABEL_PHONE_EXTENSION : ' . $discoveryContact->phone_extension . PHP_EOL;
|
- |
|
890 |
}
|
- |
|
891 |
if ($discoveryContact->personal_email) {
|
- |
|
892 |
$discoveryContactLog->details .= 'LABEL_PERSONAL_EMAIL : ' . $discoveryContact->personal_email . PHP_EOL;
|
- |
|
893 |
}
|
- |
|
894 |
if ($discoveryContact->celular) {
|
- |
|
895 |
$discoveryContactLog->details .= 'LABEL_CELULAR : ' . $discoveryContact->celular . PHP_EOL;
|
- |
|
896 |
}
|
- |
|
897 |
if ($discoveryContact->whatsapp) {
|
- |
|
898 |
$discoveryContactLog->details .= 'LABEL_WHATSAPP : ' . $discoveryContact->whatsapp . PHP_EOL;
|
- |
|
899 |
}
|
- |
|
900 |
if ($discoveryContact->linkedin) {
|
- |
|
901 |
$discoveryContactLog->details .= 'LABEL_LINKEDIN : ' . $discoveryContact->linkedin . PHP_EOL;
|
- |
|
902 |
}
|
- |
|
903 |
|
832 |
$discoveryContactInteraction->interaction_type_id = $discoveryContactInteractionType->id;
|
904 |
|
833 |
$discoveryContactInteraction->user_id = $currentUser->id;
|
905 |
$discoveryContactLogMapper->insert($discoveryContactLog);
|
834 |
|
906 |
|
835 |
$discoveryContactInteractionMapper->insert($discoveryContactInteraction);
|
907 |
|
836 |
}
|
908 |
|