Debug attendee registration

This commit is contained in:
Laurent Destailleur 2022-10-19 00:01:18 +02:00
parent 0db1863429
commit 4cbd19e6bd
2 changed files with 14 additions and 5 deletions

View File

@ -103,12 +103,13 @@ class ConferenceOrBoothAttendee extends CommonObject
public $fields = array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1),
'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1),
'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
'email_company' => array('type'=>'mail', 'label'=>'EmailCompany', 'enabled'=>'1', 'position'=>41, 'notnull'=>0, 'visible'=>-2, 'searchall'=>1),
'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',),
'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'$conf->facture->enabled', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'),
'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",),
@ -125,11 +126,13 @@ class ConferenceOrBoothAttendee extends CommonObject
);
public $rowid;
public $ref;
public $fk_soc;
public $fk_actioncomm;
public $fk_project;
public $email;
public $firstname;
public $lastname;
public $fk_soc;
public $email_company;
public $date_subscription;
public $fk_invoice;
public $amount;

View File

@ -1266,7 +1266,7 @@ if ($ispaymentok) {
$thirdparty = new Societe($db);
$resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc);
if ($resultthirdparty < 0) {
setEventMessages(null, $attendeetovalidate->errors, "errors");
setEventMessages($resultthirdparty->error, $resultthirdparty->errors, "errors");
} else {
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
@ -1293,7 +1293,6 @@ if ($ispaymentok) {
$msg = $outputlangs->trans("OrganizationEventPaymentOfRegistrationWasReceived");
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
@ -1301,6 +1300,13 @@ if ($ispaymentok) {
$texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
$sendto = $attendeetovalidate->email;
$cc = '';
if ($thirdparty->email) {
$cc = $thirdparty->email;
}
if ($attendeetovalidate->email_company && $attendeetovalidate->email_company != $thirdparty->email) {
$cc = ($cc ? ', ' : '').$attendeetovalidate->email_company;
}
$from = $conf->global->MAILING_EMAIL_FROM;
$urlback = $_SERVER["REQUEST_URI"];
@ -1321,7 +1327,7 @@ if ($ispaymentok) {
$listofmimes = array(dol_mimetype($file));
}
$mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, '', '', 0, $ishtml);
$mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, $cc, '', 0, $ishtml);
$result = $mailfile->sendfile();
if ($result) {