Example #1
0
 $formmail->substit['__SIGNATURE__'] = $user->signature;
 $formmail->substit['__PERSONALIZED__'] = '';
 $formmail->substit['__CONTACTCIVNAME__'] = '';
 //Find the good contact adress
 //Find the good contact adress
 if ($typeobject == 'commande' && $object->{$typeobject}->id && !empty($conf->commande->enabled)) {
     $objectsrc = new Commande($db);
     $objectsrc->fetch($object->{$typeobject}->id);
 }
 if ($typeobject == 'propal' && $object->{$typeobject}->id && !empty($conf->propal->enabled)) {
     $objectsrc = new Propal($db);
     $objectsrc->fetch($object->{$typeobject}->id);
 }
 $custcontact = '';
 $contactarr = array();
 $contactarr = $objectsrc->liste_contact(-1, 'external');
 if (is_array($contactarr) && count($contactarr) > 0) {
     foreach ($contactarr as $contact) {
         if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) {
             require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
             $contactstatic = new Contact($db);
             $contactstatic->fetch($contact['id']);
             $custcontact = $contactstatic->getFullName($langs, 1);
         }
     }
     if (!empty($custcontact)) {
         $formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
     }
 }
 // Tableau des parametres complementaires
 $formmail->param['action'] = 'send';
     $newUser =& $user;
 }
 $filename_list = array();
 $mimetype_list = array();
 $mimefilename_list = array();
 if (!empty($conf->global->PROPALAUTOSEND_JOIN_PDF)) {
     $ref = dol_sanitizeFileName($propal->ref);
     $file = $conf->propal->dir_output . '/' . $ref . '/' . $ref . '.pdf';
     $filename = basename($file);
     $mimefile = dol_mimetype($file);
     $filename_list[] = $file;
     $mimetype_list[] = $mimefile;
     $mimefilename_list[] = $filename;
 }
 if ($propal->id > 0) {
     $TContact = $propal->liste_contact(-1, 'external');
     foreach ($TContact as $TInfo) {
         //Contact client suivi proposition => fk_c_type_contact = 41
         if ($TInfo['code'] == 'CUSTOMER') {
             $contact = new Contact($db);
             $contact->fetch($TInfo['id']);
             $contactFound = true;
             $mail = $TInfo['email'];
             if (isValidEmail($mail)) {
                 $msg = $conf->global->PROPALAUTOSEND_MSG_CONTACT;
                 if (empty($msg)) {
                     exit("errorContentMailContactIsEmpty");
                 }
                 $prefix = '__CONTACT_';
                 $TSearch = $TVal = array();
                 foreach ($contact as $attr => $val) {