diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php
index 40c86d79e13..cc9b8d7bca8 100644
--- a/htdocs/admin/eventorganization.php
+++ b/htdocs/admin/eventorganization.php
@@ -220,7 +220,7 @@ if ($action == 'edit') {
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
- print '
| ';
diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php
index db48c0e7fce..8f4b32ae502 100644
--- a/htdocs/cron/class/cronjob.class.php
+++ b/htdocs/cron/class/cronjob.class.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2007-2022 Laurent Destailleur
* Copyright (C) 2013 Florian Henry
*
* This program is free software; you can redistribute it and/or modify
@@ -23,6 +23,7 @@
// Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php";
+require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
/**
@@ -1408,21 +1409,30 @@ class Cronjob extends CommonObject
if (empty($this->datenextrun)) {
if (empty($this->datestart)) {
- $this->datenextrun = $now + ($this->frequency * $this->unitfrequency);
+ if ($this->unitfrequency == 2678400) {
+ $this->datenextrun = dol_time_plus_duree($now, $this->frequency, 'm');
+ } else {
+ $this->datenextrun = $now + ($this->frequency * $this->unitfrequency);
+ }
} else {
- $this->datenextrun = $this->datestart + ($this->frequency * $this->unitfrequency);
+ if ($this->unitfrequency == 2678400) {
+ $this->datenextrun = dol_time_plus_duree($this->datestart, $this->frequency, 'm');
+ } else {
+ $this->datenextrun = $this->datestart + ($this->frequency * $this->unitfrequency);
+ }
}
}
if ($this->datenextrun < $now && $this->frequency > 0 && $this->unitfrequency > 0) {
// Loop until date is after future
while ($this->datenextrun < $now) {
- $this->datenextrun += ($this->frequency * $this->unitfrequency);
-
- // TODO For exact frequency (every month, every year, ...), use instead a dol_time_plus_duree($time, $duration_value, $duration_unit)
+ if ($this->unitfrequency == 2678400) {
+ $this->datenextrun = dol_time_plus_duree($this->datenextrun, $this->frequency, 'm');
+ } else {
+ $this->datenextrun += ($this->frequency * $this->unitfrequency);
+ }
}
} else {
- //$this->datenextrun=$this->datenextrun + ($this->frequency * $this->unitfrequency);
dol_syslog(get_class($this)."::reprogram_jobs datenextrun is already in future, we do not change it");
}
diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php
index 222a0c78946..909758ca3f2 100644
--- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php
+++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php
@@ -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;
diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php
index 29adb2947d0..2504260cbc5 100644
--- a/htdocs/public/payment/paymentko.php
+++ b/htdocs/public/payment/paymentko.php
@@ -136,6 +136,10 @@ foreach ($_POST as $k => $v) {
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
+// Set $appli for emails title
+$appli = $mysoc->name;
+
+
if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice
// Get on url call
$fulltag = $FULLTAG;
@@ -173,21 +177,6 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice
$from = $conf->global->MAILING_EMAIL_FROM;
$sendto = $sendemail;
- // Define link to login card
- $appli = constant('DOL_APPLICATION_TITLE');
- if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
- $appli = $conf->global->MAIN_APPLICATION_TITLE;
- if (preg_match('/\d\.\d/', $appli)) {
- if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
- $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
- }
- } else {
- $appli .= " ".DOL_VERSION;
- }
- } else {
- $appli .= " ".DOL_VERSION;
- }
-
$urlback = $_SERVER["REQUEST_URI"];
$topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentFailed");
$content = "";
diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php
index 4d1336351b3..c56732f5938 100644
--- a/htdocs/public/payment/paymentok.php
+++ b/htdocs/public/payment/paymentok.php
@@ -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';
@@ -1289,11 +1289,10 @@ if ($ispaymentok) {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
} else {
- $subject = '['.$object->ref.' - '.$outputlangs->trans("NewRegistration").']';
+ $subject = '['.$appli.'] '.$object->ref.' - '.$outputlangs->trans("NewRegistration").']';
$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) {
@@ -1493,7 +1499,7 @@ if ($ispaymentok) {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
} else {
- $subject = '['.$booth->ref.' - '.$outputlangs->trans("NewRegistration").']';
+ $subject = '['.$appli.'] '.$booth->ref.' - '.$outputlangs->trans("NewRegistration").']';
$msg = $outputlangs->trans("OrganizationEventPaymentOfBoothWasReceived");
}
@@ -1542,6 +1548,11 @@ if ($ispaymentok) {
}
}
+
+// Set $appli for emails title
+$appli = $mysoc->name;
+
+
if ($ispaymentok) {
// Get on url call
$onlinetoken = empty($PAYPALTOKEN) ? $_SESSION['onlinetoken'] : $PAYPALTOKEN;
@@ -1600,19 +1611,6 @@ if ($ispaymentok) {
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
// Define link to login card
- $appli = constant('DOL_APPLICATION_TITLE');
- if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
- $appli = $conf->global->MAIN_APPLICATION_TITLE;
- if (preg_match('/\d\.\d/', $appli)) {
- if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
- $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
- }
- } else {
- $appli .= " ".DOL_VERSION;
- }
- } else {
- $appli .= " ".DOL_VERSION;
- }
$urlback = $_SERVER["REQUEST_URI"];
$topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentReceived");
@@ -1740,21 +1738,6 @@ if ($ispaymentok) {
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
- // Define link to login card
- $appli = constant('DOL_APPLICATION_TITLE');
- if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
- $appli = $conf->global->MAIN_APPLICATION_TITLE;
- if (preg_match('/\d\.\d/', $appli)) {
- if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
- $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
- }
- } else {
- $appli .= " ".DOL_VERSION;
- }
- } else {
- $appli .= " ".DOL_VERSION;
- }
-
$urlback = $_SERVER["REQUEST_URI"];
$topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("ValidationOfPaymentFailed");
$content = "";
|