Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
bb3b0c552f
17 changed files with 334 additions and 98 deletions
|
|
@ -3612,24 +3612,6 @@ parameters:
|
|||
count: 4
|
||||
path: ../../../htdocs/comm/propal/class/propal.class.php
|
||||
|
||||
-
|
||||
message: '#^Property CommonObject\:\:\$cond_reglement_id \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/comm/propal/class/propal.class.php
|
||||
|
||||
-
|
||||
message: '#^Property CommonObject\:\:\$fk_project \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/comm/propal/class/propal.class.php
|
||||
|
||||
-
|
||||
message: '#^Property CommonObject\:\:\$mode_reglement_id \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/comm/propal/class/propal.class.php
|
||||
|
||||
-
|
||||
message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
|
|
@ -3678,36 +3660,18 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/comm/propal/class/propal.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Propal\:\:\$demand_reason_id \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/comm/propal/class/propal.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Propal\:\:\$ref_client \(string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/comm/propal/class/propal.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Propal\:\:\$socid \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/comm/propal/class/propal.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Propal\:\:\$status \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/comm/propal/class/propal.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Propal\:\:\$user_author_id \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/comm/propal/class/propal.class.php
|
||||
|
||||
-
|
||||
message: '#^Right side of && is always true\.$#'
|
||||
identifier: booleanAnd.rightAlwaysTrue
|
||||
|
|
|
|||
|
|
@ -134,9 +134,11 @@ $documentation->showSidebar(); ?>
|
|||
</div><!-- /.info-box-content -->
|
||||
</div>';
|
||||
} else {
|
||||
$tooltip = $iconName.'<br>img_picto(\''.$labelAlt.'\', \''.$iconName.'\')';
|
||||
$iconCode = img_picto($tooltip, $iconName, '', 0, 0, 0, '', 'classfortooltip');
|
||||
print '<span class="doc-icon-list-item">'.$iconCode.'<span class="doc-icon-hidden-name-for-search">'.$iconName.'</span></span>';
|
||||
$tooltip = '<u>'.$langs->trans("DocCodeForMenuOrModuleBuilder").':</u><br>'.$iconName;
|
||||
$tooltip .= '<br><u>'.$langs->trans("DocExampleForPHPCode").':</u><br>img_picto(\''.$labelAlt.'\', \''.$iconName.'\')';
|
||||
$iconCode = img_picto($tooltip, $iconName, '', 0, 0, 0, '', 'classfortooltip');
|
||||
print '<span class="doc-icon-list-item">'.$iconCode;
|
||||
print '<span class="doc-icon-hidden-name-for-search">'.$iconName.'</span></span>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -220,7 +222,7 @@ $documentation->showSidebar(); ?>
|
|||
</div><!-- /.info-box-content -->
|
||||
</div>';
|
||||
} else {
|
||||
$tooltip = $class;
|
||||
$tooltip = '<u>'.$langs->trans("DocCodeForMenuOrModuleBuilder").':</u><br>'.$class;
|
||||
print '<span class="doc-icon-list-item classfortooltip" title="'.dol_escape_htmltag($tooltip).'">'.$iconCode.'<span class="doc-icon-hidden-name-for-search">'.$class.'</span></span>';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,6 +351,9 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
|||
if ($moduleobject == 'interventions') {
|
||||
$classfile = 'interventions';
|
||||
}
|
||||
if ($moduleobject == 'eventattendees') {
|
||||
$moduledirforclass = 'eventorganization';
|
||||
}
|
||||
|
||||
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php', 0, 2);
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,8 @@ if (empty($action) && empty($object->id)) {
|
|||
|
||||
$permissiontoread = $user->hasRight('mailing', 'lire');
|
||||
$permissiontoadd = $user->hasRight('mailing', 'creer');
|
||||
$permissiontovalidatesend = $user->hasRight('mailing', 'valider');
|
||||
$permissiontodelete = $user->hasRight('mailing', 'supprimer');
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -434,14 +436,15 @@ if (GETPOST("button_removefilter")) {
|
|||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("MailAdvTargetRecipients"), 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing');
|
||||
|
||||
$form = new Form($db);
|
||||
$formmailing = new FormMailing($db);
|
||||
$formadvtargetemaling = new FormAdvTargetEmailing($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
|
||||
llxHeader('', $langs->trans("MailAdvTargetRecipients"), $help_url);
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
$totalarray = [
|
||||
'nbfield' => 0,
|
||||
|
|
@ -480,10 +483,11 @@ if ($object->fetch($id) >= 0) {
|
|||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
// From
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td>';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("MailFrom").'</td><td>';
|
||||
$emailarray = CMailFile::getArrayAddress($object->email_from);
|
||||
foreach ($emailarray as $email => $name) {
|
||||
if ($name && $name != $email) {
|
||||
|
|
@ -556,20 +560,19 @@ if ($object->fetch($id) >= 0) {
|
|||
print '</td><td>';
|
||||
$nbemail = ($object->nbemail ? $object->nbemail : 0);
|
||||
if (is_numeric($nbemail)) {
|
||||
$text = '';
|
||||
$htmltooltip = '';
|
||||
if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < $nbemail) && ($object->status == 1 || ($object->status == 2 && $nbtry < $nbemail))) {
|
||||
if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) {
|
||||
$text .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB'));
|
||||
$htmltooltip .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB'));
|
||||
} else {
|
||||
$text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed');
|
||||
$htmltooltip .= $langs->trans('SendingFromWebInterfaceIsNotAllowed');
|
||||
}
|
||||
}
|
||||
if (empty($nbemail)) {
|
||||
$nbemail .= ' '.img_warning($langs->trans('ToAddRecipientsChooseHere'));//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
|
||||
}
|
||||
if ($text) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print $form->textwithpicto($nbemail, $text, 1, 'warning');
|
||||
if ($htmltooltip) {
|
||||
print $form->textwithpicto($nbemail, $htmltooltip, 1, 'warning');
|
||||
} else {
|
||||
print $nbemail;
|
||||
}
|
||||
|
|
@ -589,7 +592,7 @@ if ($object->fetch($id) >= 0) {
|
|||
}
|
||||
print $text;
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') {
|
||||
print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING', getDolGlobalString('MAIN_MAIL_SMTP_SERVER')).')</span>';
|
||||
}
|
||||
} elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) {
|
||||
|
|
@ -668,7 +671,7 @@ if ($object->fetch($id) >= 0) {
|
|||
print '<input type="hidden" name="action" value="">'."\n";
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
print '<tr><td>'.$langs->trans('AdvTgtNameTemplate').'</td><td class="valignmiddle">';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans('AdvTgtNameTemplate').'</td><td class="valignmiddle">';
|
||||
if (!empty($template_id)) {
|
||||
$default_template = $template_id;
|
||||
} else {
|
||||
|
|
@ -687,7 +690,7 @@ if ($object->fetch($id) >= 0) {
|
|||
print '</td><td>'."\n";
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '<tr><td colspan="2"><hr></td></tr>';
|
||||
print '<tr><td colspan="3"><hr></td></tr>';
|
||||
|
||||
print '<tr>'."\n";
|
||||
print '<td colspan="3" class="center">'."\n";
|
||||
|
|
@ -810,7 +813,7 @@ if ($object->fetch($id) >= 0) {
|
|||
1 => $langs->trans('Customer'),
|
||||
0 => $langs->trans('NorProspectNorCustomer')
|
||||
);
|
||||
print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $array_query['cust_typecust']);
|
||||
print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $selected);
|
||||
print '</td><td>'."\n";
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
|
@ -989,7 +992,7 @@ if ($object->fetch($id) >= 0) {
|
|||
print '</td></tr>'."\n";
|
||||
|
||||
// Civility
|
||||
print '<tr><td width="15%">'.$langs->trans("UserTitle");
|
||||
print '<tr><td>'.$langs->trans("UserTitle");
|
||||
if (!empty($array_query['contact_civility'])) {
|
||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1013,7 +1013,7 @@ if ($action == 'create') { // aaa
|
|||
|
||||
$morehtmlstatus = '';
|
||||
$nbtry = $nbok = 0;
|
||||
if ($object->status == 2 || $object->status == 3) {
|
||||
if ($object->status == $object::STATUS_SENTPARTIALY || $object->status == $object::STATUS_SENTCOMPLETELY) {
|
||||
$nbtry = $object->countNbOfTargets('alreadysent');
|
||||
$nbko = $object->countNbOfTargets('alreadysentko');
|
||||
|
||||
|
|
@ -1029,6 +1029,7 @@ if ($action == 'create') { // aaa
|
|||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
// From
|
||||
|
|
@ -1137,7 +1138,7 @@ if ($action == 'create') { // aaa
|
|||
}
|
||||
print $text;
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') {
|
||||
print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING', getDolGlobalString('MAIN_MAIL_SMTP_SERVER')).')</span>';
|
||||
}
|
||||
} elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) {
|
||||
|
|
@ -1414,7 +1415,8 @@ if ($action == 'create') { // aaa
|
|||
$nbemail = ($object->nbemail ? $object->nbemail : 0);
|
||||
if (is_numeric($nbemail)) {
|
||||
$htmltooltip = '';
|
||||
if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->status == 1 || $object->status == 2)) {
|
||||
// MAILING_LIMIT_SENDBYWEB can be 'default'
|
||||
if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < $nbemail) && ($object->status == 1 || $object->status == 2)) {
|
||||
if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) {
|
||||
$htmltooltip .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB'));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -321,11 +321,12 @@ if (($action == 'settitle' || $action == 'setemail_from' || $action == 'setreply
|
|||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing');
|
||||
|
||||
$form = new Form($db);
|
||||
$formmailing = new FormMailing($db);
|
||||
|
||||
$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
|
||||
llxHeader('', $langs->trans("Mailing"), $help_url);
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
$totalarray = [
|
||||
'nbfield' => 0,
|
||||
|
|
@ -364,10 +365,11 @@ if ($object->fetch($id) >= 0) {
|
|||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
// From
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td>';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("MailFrom").'</td><td>';
|
||||
$emailarray = CMailFile::getArrayAddress($object->email_from);
|
||||
foreach ($emailarray as $email => $name) {
|
||||
if ($name && $name != $email) {
|
||||
|
|
@ -440,20 +442,19 @@ if ($object->fetch($id) >= 0) {
|
|||
print '</td><td>';
|
||||
$nbemail = ($object->nbemail ? $object->nbemail : 0);
|
||||
if (is_numeric($nbemail)) {
|
||||
$text = '';
|
||||
$htmltooltip = '';
|
||||
if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < $nbemail) && ($object->status == 1 || ($object->status == 2 && $nbtry < $nbemail))) {
|
||||
if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) {
|
||||
$text .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB'));
|
||||
$htmltooltip .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB'));
|
||||
} else {
|
||||
$text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed');
|
||||
$htmltooltip .= $langs->trans('SendingFromWebInterfaceIsNotAllowed');
|
||||
}
|
||||
}
|
||||
if (empty($nbemail)) {
|
||||
$nbemail .= ' '.img_warning($langs->trans('ToAddRecipientsChooseHere'));//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
|
||||
}
|
||||
if ($text) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print $form->textwithpicto($nbemail, $text, 1, 'warning');
|
||||
if ($htmltooltip) {
|
||||
print $form->textwithpicto($nbemail, $htmltooltip, 1, 'warning');
|
||||
} else {
|
||||
print $nbemail;
|
||||
}
|
||||
|
|
@ -473,7 +474,7 @@ if ($object->fetch($id) >= 0) {
|
|||
}
|
||||
print $text;
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') {
|
||||
print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING', getDolGlobalString('MAIN_MAIL_SMTP_SERVER')).')</span>';
|
||||
}
|
||||
} elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) {
|
||||
|
|
|
|||
|
|
@ -1562,8 +1562,13 @@ class Contrat extends CommonObject
|
|||
$total_localtax1 = $tabprice[9];
|
||||
$total_localtax2 = $tabprice[10];
|
||||
|
||||
$localtax1_type = $localtaxes_type[0];
|
||||
$localtax2_type = $localtaxes_type[2];
|
||||
if (count($localtaxes_type) > 0) {
|
||||
$localtax1_type = $localtaxes_type[0];
|
||||
$localtax2_type = $localtaxes_type[2];
|
||||
} else {
|
||||
$localtax1_type = "";
|
||||
$localtax2_type = "";
|
||||
}
|
||||
|
||||
if (empty($pa_ht)) {
|
||||
$pa_ht = 0;
|
||||
|
|
|
|||
|
|
@ -1217,7 +1217,7 @@ class CMailFile
|
|||
$result = $this->smtps->sendMsg();
|
||||
|
||||
if (getDolGlobalString('MAIN_MAIL_DEBUG')) {
|
||||
$this->dump_mail();
|
||||
$this->dump_mail(); // Create file dolibarr_mail.log or dolibarr_mail.log.vXXX if option for archive is on
|
||||
}
|
||||
|
||||
$smtperrorcode = 0;
|
||||
|
|
@ -1238,9 +1238,12 @@ class CMailFile
|
|||
}
|
||||
*/
|
||||
}
|
||||
} else {
|
||||
dol_syslog("CMailFile::sendfile: mail SMTP sendMsg is success", LOG_DEBUG);
|
||||
}
|
||||
|
||||
$result = $this->smtps->getErrors(); // applicative error code (not SMTP error code)
|
||||
|
||||
if (empty($this->error) && empty($result)) {
|
||||
dol_syslog("CMailFile::sendfile: mail end success", LOG_DEBUG);
|
||||
$res = true;
|
||||
|
|
|
|||
|
|
@ -325,6 +325,27 @@ class SMTPs
|
|||
return $this->_deliveryReceipt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set socket timeout. May be increase when email sent after a long time and with a large file for the wake up of SMTP server.
|
||||
*
|
||||
* @param int $timeout Delay in second for socket timeout (default is 10s)
|
||||
* @return void
|
||||
*/
|
||||
public function setSMTPTimeout($timeout)
|
||||
{
|
||||
$this->_smtpTimeout = $timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get socket timeout
|
||||
*
|
||||
* @return int Delay in second for socket timeout
|
||||
*/
|
||||
public function getSMTPTimeout()
|
||||
{
|
||||
return $this->_smtpTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set trackid
|
||||
*
|
||||
|
|
@ -489,7 +510,7 @@ class SMTPs
|
|||
// This connection attempt failed.
|
||||
// @CHANGE LDR
|
||||
if (empty($this->errstr)) {
|
||||
$this->errstr = 'Failed to connect with fsockopen host='.$this->getHost().' port='.$this->getPort();
|
||||
$this->errstr = 'Failed to connect with stream_context_create or fsockopen host='.$this->getHost().' port='.$this->getPort();
|
||||
}
|
||||
$this->_setErr($this->errno, $this->errstr);
|
||||
$_retVal = false;
|
||||
|
|
|
|||
|
|
@ -14857,10 +14857,11 @@ function getActionCommEcmList($object)
|
|||
|
||||
$documents = array();
|
||||
|
||||
$sql = 'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id, ecm.filepath, ecm.filename';
|
||||
$sql = 'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id, ecm.filepath, ecm.filename, ecm.agenda_id';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'ecm_files ecm';
|
||||
$sql .= " WHERE ecm.filepath = 'agenda/".((int) $object->id)."'";
|
||||
//$sql.= " ecm.src_object_type = '".$db->escape($object->element)."' AND ecm.src_object_id = ".((int) $object->id); // Old version didn't add object_type during upload
|
||||
$sql.= ' OR ecm.agenda_id = '.(int) $object->id;
|
||||
$sql .= ' ORDER BY ecm.position ASC';
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
|
@ -15580,10 +15581,21 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null,
|
|||
|
||||
$filePath = DOL_DATA_ROOT.'/'.$doc->filepath.'/'.$doc->filename;
|
||||
$mime = dol_mimetype($filePath);
|
||||
$file = $actionstatic->id.'/'.$doc->filename;
|
||||
$thumb = $actionstatic->id.'/thumbs/'.substr($doc->filename, 0, strrpos($doc->filename, '.')).'_mini'.substr($doc->filename, strrpos($doc->filename, '.'));
|
||||
$doclink = dol_buildpath('document.php', 1).'?modulepart=actions&attachment=0&file='.urlencode($file).'&entity='.$conf->entity;
|
||||
$viewlink = dol_buildpath('viewimage.php', 1).'?modulepart=actions&file='.urlencode($thumb).'&entity='.$conf->entity;
|
||||
if (empty($doc->agenda_id)) {
|
||||
$dir_ref = $actionstatic->id;
|
||||
$modulepart = 'actions';
|
||||
} else {
|
||||
$split_dir = explode('/', $doc->filepath);
|
||||
$modulepart = array_shift($split_dir);
|
||||
$dir_ref = implode('/', $split_dir);
|
||||
}
|
||||
|
||||
$file = $dir_ref.'/'.$doc->filename;
|
||||
$thumb = $dir_ref.'/thumbs/'.substr($doc->filename, 0, strrpos($doc->filename, '.')).'_mini'.substr($doc->filename, strrpos($doc->filename, '.'));
|
||||
$doclink = dol_buildpath('document.php', 1).'?modulepart='.$modulepart.'&attachment=0&file='.urlencode($file).'&entity='.$conf->entity;
|
||||
$viewlink = dol_buildpath('viewimage.php', 1).'?modulepart='.$modulepart.'&file='.urlencode($thumb).'&entity='.$conf->entity;
|
||||
|
||||
|
||||
|
||||
$mimeAttr = ' mime="'.$mime.'" ';
|
||||
$class = '';
|
||||
|
|
|
|||
|
|
@ -157,6 +157,11 @@ class EcmFiles extends CommonObject
|
|||
*/
|
||||
public $src_object_id;
|
||||
|
||||
/**
|
||||
* @var int ID of linked agenda event
|
||||
*/
|
||||
public $agenda_id;
|
||||
|
||||
/**
|
||||
* @var int section_id ID of section = ID of EcmDirectory, directory of manual ECM (not stored into database)
|
||||
*/
|
||||
|
|
@ -187,6 +192,7 @@ class EcmFiles extends CommonObject
|
|||
'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155),
|
||||
'note_private' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160),
|
||||
'acl' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160, 'comment' => "for future permission 'per file'"),
|
||||
'agenda_id' => array('type' => 'integer', 'label' => 'IdAgenda', 'enabled' => 1, 'visible' => 0, 'position' => 180, 'comment' => "Link to an actioncomm"),
|
||||
);
|
||||
|
||||
|
||||
|
|
@ -307,6 +313,9 @@ class EcmFiles extends CommonObject
|
|||
$extraparams = dol_trunc($extraparams, 250);
|
||||
|
||||
// Put here code to add control on parameters values
|
||||
if (!empty($this->agenda_id)) {
|
||||
$this->agenda_id = (int) $this->agenda_id;
|
||||
}
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
|
||||
|
|
@ -332,7 +341,8 @@ class EcmFiles extends CommonObject
|
|||
$sql .= 'fk_user_m,';
|
||||
$sql .= 'acl,';
|
||||
$sql .= 'src_object_type,';
|
||||
$sql .= 'src_object_id';
|
||||
$sql .= 'src_object_id,';
|
||||
$sql .= 'agenda_id';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= " '".$this->db->escape($this->ref)."', ";
|
||||
$sql .= ' '.(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").',';
|
||||
|
|
@ -356,7 +366,8 @@ class EcmFiles extends CommonObject
|
|||
$sql .= ' '.(!isset($this->fk_user_m) ? 'NULL' : $this->fk_user_m).',';
|
||||
$sql .= ' '.(!isset($this->acl) ? 'NULL' : "'".$this->db->escape($this->acl)."'").',';
|
||||
$sql .= ' '.(!isset($this->src_object_type) ? 'NULL' : "'".$this->db->escape($this->src_object_type)."'").',';
|
||||
$sql .= ' '.(!isset($this->src_object_id) ? 'NULL' : $this->src_object_id);
|
||||
$sql .= ' '.(!isset($this->src_object_id) ? 'NULL' : $this->src_object_id).',';
|
||||
$sql .= ' '.(empty($this->agenda_id) ? 'NULL' : (int) $this->agenda_id);
|
||||
$sql .= ')';
|
||||
|
||||
$this->db->begin();
|
||||
|
|
@ -443,7 +454,8 @@ class EcmFiles extends CommonObject
|
|||
$sql .= ' t.note_public,';
|
||||
$sql .= " t.acl,";
|
||||
$sql .= " t.src_object_type,";
|
||||
$sql .= " t.src_object_id";
|
||||
$sql .= " t.src_object_id,";
|
||||
$sql .= " t.agenda_id";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
/* Fetching this table depends on filepath+filename, it must not depends on entity because filesystem on disk does not know what is Dolibarr entities
|
||||
|
|
@ -524,7 +536,7 @@ class EcmFiles extends CommonObject
|
|||
$this->acl = $obj->acl;
|
||||
$this->src_object_type = $obj->src_object_type;
|
||||
$this->src_object_id = $obj->src_object_id;
|
||||
|
||||
$this->agenda_id = $obj->agenda_id;
|
||||
$this->extraparams = (isset($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : null);
|
||||
}
|
||||
|
||||
|
|
@ -587,7 +599,8 @@ class EcmFiles extends CommonObject
|
|||
$sql .= " t.fk_user_m,";
|
||||
$sql .= " t.acl,";
|
||||
$sql .= " t.src_object_type,";
|
||||
$sql .= " t.src_object_id";
|
||||
$sql .= " t.src_object_id,";
|
||||
$sql .= " t.agenda_id";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
|
||||
|
|
@ -663,6 +676,7 @@ class EcmFiles extends CommonObject
|
|||
$line->acl = $obj->acl;
|
||||
$line->src_object_type = $obj->src_object_type;
|
||||
$line->src_object_id = $obj->src_object_id;
|
||||
$line->agenda_id = $obj->agenda_id;
|
||||
$this->lines[] = $line;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
|
@ -736,8 +750,9 @@ class EcmFiles extends CommonObject
|
|||
if (isset($this->src_object_type)) {
|
||||
$this->src_object_type = trim($this->src_object_type);
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if (!empty($this->agenda_id)) {
|
||||
$this->agenda_id = (int) $this->agenda_id;
|
||||
}
|
||||
$extraparams = (!empty($this->extraparams) ? json_encode($this->extraparams) : null);
|
||||
$extraparams = dol_trunc($extraparams, 250);
|
||||
|
||||
|
|
@ -764,7 +779,8 @@ class EcmFiles extends CommonObject
|
|||
$sql .= ' fk_user_m = '.($this->fk_user_m > 0 ? $this->fk_user_m : $user->id).',';
|
||||
$sql .= ' acl = '.(isset($this->acl) ? "'".$this->db->escape($this->acl)."'" : "null").',';
|
||||
$sql .= ' src_object_id = '.($this->src_object_id > 0 ? $this->src_object_id : "null").',';
|
||||
$sql .= ' src_object_type = '.(isset($this->src_object_type) ? "'".$this->db->escape($this->src_object_type)."'" : "null");
|
||||
$sql .= ' src_object_type = '.(isset($this->src_object_type) ? "'".$this->db->escape($this->src_object_type)."'" : "null").',';
|
||||
$sql .= ' agenda_id = '.($this->agenda_id > 0 ? (int) $this->agenda_id : null);
|
||||
$sql .= ' WHERE rowid='.((int) $this->id);
|
||||
|
||||
$this->db->begin();
|
||||
|
|
|
|||
203
htdocs/eventorganization/class/api_eventattendees.class.php
Normal file
203
htdocs/eventorganization/class/api_eventattendees.class.php
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
<?php
|
||||
/*
|
||||
/* Copyright (C) 2025 Jon Bendtsen <jon.bendtsen.github@jonb.dk>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Luracast\Restler\RestException;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
|
||||
|
||||
/**
|
||||
* API for handling Object of table llx_eventorganization_conferenceorboothattendee
|
||||
*
|
||||
* @access protected
|
||||
* @class DolibarrApiAccess {@requires user,external}
|
||||
*/
|
||||
class EventAttendees extends DolibarrApi
|
||||
{
|
||||
/**
|
||||
* @var string[] Mandatory fields, checked when create and update object
|
||||
*/
|
||||
public static $FIELDS = array(
|
||||
'fk_project'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string[] Mandatory fields which needs to be an integer, checked when create and update object
|
||||
*/
|
||||
public static $INTFIELDS = array(
|
||||
'fk_soc',
|
||||
'fk_actioncomm',
|
||||
'fk_project',
|
||||
'fk_invoice',
|
||||
'status'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var ConferenceOrBoothAttendee {@type ConferenceOrBoothAttendee}
|
||||
*/
|
||||
public $event_attendees;
|
||||
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored. This is also the key used for extrafields management (so extrafields know the link to the parent table).
|
||||
*/
|
||||
public $table_element = 'eventorganization_conferenceorboothattendee';
|
||||
|
||||
/**
|
||||
* Constructor of the class
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $db;
|
||||
$this->db = $db;
|
||||
$this->event_attendees = new ConferenceOrBoothAttendee($this->db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an event attendee
|
||||
*
|
||||
* Example: {"module":"adherent","type_template":"member","active": 1,"ref":"(SendingEmailOnAutoSubscription)","fk_user":0,"joinfiles": "0", ... }
|
||||
* Required: {"ref":"myBestTemplate","topic":"myBestOffer","type_template":"propal_send"}
|
||||
*
|
||||
* @param array $request_data Request data
|
||||
* @phan-param ?array<string,string> $request_data
|
||||
* @phpstan-param ?array<string,string> $request_data
|
||||
*
|
||||
* @url POST
|
||||
*
|
||||
* @return int ID of event attendee
|
||||
*
|
||||
* @throws RestException 304
|
||||
* @throws RestException 403
|
||||
* @throws RestException 500
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
$allowaccess = $this->_checkAccessRights('write', 0);
|
||||
if (!$allowaccess) {
|
||||
throw new RestException(403, 'denied create access to Event attendees');
|
||||
}
|
||||
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
|
||||
$this->event_attendees->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->event_attendees->$field = $this->_checkValForAPI($field, $value, $this->event_attendees);
|
||||
}
|
||||
|
||||
if ($this->event_attendees->create(DolibarrApiAccess::$user) < 0) {
|
||||
throw new RestException(500, "Error creating event attendee", array_merge(array($this->event_attendees->error), $this->event_attendees->errors));
|
||||
}
|
||||
|
||||
return ((int) $this->event_attendees->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate fields before create or update object
|
||||
*
|
||||
* @param ?array<string,null|int|string> $data Data to validate
|
||||
* @return array<string,null|int|string> Return array with validated mandatory fields and their value
|
||||
* @phan-return array<string,?int|?string> Return array with validated mandatory fields and their value
|
||||
*
|
||||
* @throws RestException 400
|
||||
*/
|
||||
private function _validate($data)
|
||||
{
|
||||
$event_attendees = array();
|
||||
foreach (EventAttendees::$FIELDS as $field) {
|
||||
if (!isset($data[$field])) {
|
||||
throw new RestException(400, $field." field missing");
|
||||
}
|
||||
$event_attendees[$field] = $data[$field];
|
||||
}
|
||||
return $event_attendees;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to check for access rights - should probably have 1. parameter which is read/write/delete/...
|
||||
* Why a separate function? because we probably needs to check so many many different kinds of objects
|
||||
*
|
||||
* @param string $accesstype accesstype: read, write, delete, ...
|
||||
* @param int $project_id which project do we need to check for access to, 0 means don't check
|
||||
* @return bool Return true if access is granted else false
|
||||
*
|
||||
* @throws RestException 403
|
||||
* @throws RestException 500
|
||||
*/
|
||||
private function _checkAccessRights($accesstype, $project_id = 0)
|
||||
{
|
||||
// what kind of access management do we need?
|
||||
$moduleaccess = false;
|
||||
if (isModEnabled("eventorganization") && DolibarrApiAccess::$user->hasRight('eventorganization', $accesstype)) {
|
||||
$moduleaccess = true;
|
||||
}
|
||||
$fullprojectaccess = false;
|
||||
if (DolibarrApiAccess::$user->hasRight('projet', 'all', $accesstype)) {
|
||||
$fullprojectaccess = true;
|
||||
}
|
||||
|
||||
if ($moduleaccess && $fullprojectaccess) {
|
||||
return true;
|
||||
} else {
|
||||
$singleprojectaccess = false;
|
||||
if (0 < $project_id) {
|
||||
// we should also check project visibility and if set to assigned contacts it should be only those contacts.
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
$event_project = new Project($this->db);
|
||||
$result = $event_project->fetch($project_id);
|
||||
if (0 < $result) {
|
||||
$public = $event_project->public;
|
||||
if ( 1 == $public) {
|
||||
$singleprojectaccess = true;
|
||||
} else {
|
||||
$userProjectAccessListId = $event_project->getProjectsAuthorizedForUser(DolibarrApiAccess::$user, 0, 0);
|
||||
$project_title = $event_project->title;
|
||||
if (in_array($project_title, $userProjectAccessListId)) {
|
||||
$singleprojectaccess = true;
|
||||
} else {
|
||||
dol_syslog("project_title ".$project_title." is NOT in array from getProjectsAuthorizedForUser()", LOG_DEBUG);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} elseif (0 == $result) {
|
||||
throw new RestException(500, 'Project id '.$project_id.' not found');
|
||||
} else {
|
||||
throw new RestException(500, 'Error during fetch project '.$project_id.': '.$this->db->lasterror());
|
||||
}
|
||||
} elseif ($moduleaccess && ($project_id == 0)) {
|
||||
return true;
|
||||
// because we assume that the caller will know to check for each fk_projekt
|
||||
}
|
||||
if ($moduleaccess && $singleprojectaccess) {
|
||||
return true;
|
||||
} elseif ($moduleaccess) {
|
||||
throw new RestException(403, 'Event attendees access granted, but denied access to the project');
|
||||
} elseif ($singleprojectaccess) {
|
||||
throw new RestException(403, 'project access granted, but denied access to Event attendees');
|
||||
} else {
|
||||
throw new RestException(403, 'denied access both Event attendees and the project');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,8 @@ DocHowContribute=How to contribute ?
|
|||
DocHowContributeDescription=This documentation is currently being written. Learn how to contribute and enrich this documentation
|
||||
DocListLinks=List of links - %s
|
||||
DocGroupIndexDescription= This page brings together all the links from the "%s" section.
|
||||
DocCodeForMenuOrModuleBuilder=Image code to use for menu setup or fields in modulebuilder
|
||||
DocExampleForPHPCode=Example of code to use in PHP
|
||||
|
||||
# Components
|
||||
DocComponentsTitle=Components
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ div.quickaddblock:focus {
|
|||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
z-index: 5;
|
||||
width: 300px;
|
||||
right:0; /* will be set with js */
|
||||
bottom: 0;
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ div.quickaddblock:focus {
|
|||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
z-index: 5;
|
||||
width: 300px;
|
||||
right:0;
|
||||
bottom: 0;
|
||||
|
|
|
|||
|
|
@ -346,7 +346,8 @@ class ActionsTicket extends CommonHookActions
|
|||
$sql = 'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id';
|
||||
$sql .= ', ecm.filepath, ecm.filename, ecm.share';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'ecm_files ecm';
|
||||
$sql .= " WHERE ecm.filepath = 'agenda/".$arraymsgs['id']."'";
|
||||
$sql .= " WHERE ecm.filepath = 'agenda/".(int) $arraymsgs['id']."'";
|
||||
$sql .= " OR (ecm.agenda_id = ".(int) $arraymsgs['id']." AND ecm.src_object_type = 'ticket' AND ecm.src_object_id = ".(int) $this->dao->id.")";
|
||||
$sql .= ' ORDER BY ecm.position ASC';
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2023 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2023-2025 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2023-2024 Benjamin Falière <benjamin.faliere@altairis.fr>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
|
|
@ -494,7 +494,9 @@ class Ticket extends CommonObject
|
|||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
$this->datec = dol_now();
|
||||
if (empty($this->datec)) {
|
||||
$this->datec = dol_now();
|
||||
}
|
||||
if (empty($this->track_id)) {
|
||||
$this->track_id = generate_random_id(16);
|
||||
}
|
||||
|
|
@ -1898,7 +1900,7 @@ class Ticket extends CommonObject
|
|||
//if (dol_mkdir($destdir) >= 0) {
|
||||
//require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
//dol_move($filespath, $destfile); // Disabled, a file for a ticket should be stored into ticket directory. It generates big trouble.
|
||||
if (in_array($actioncomm->code, array('TICKET_MSG', 'TICKET_MSG_SENTBYMAIL'))) {
|
||||
if (in_array($actioncomm->code, array('TICKET_MSG', 'TICKET_MSG_SENTBYMAIL', 'TICKET_MSG_PRIVATE'))) {
|
||||
$ecmfile = new EcmFiles($this->db);
|
||||
$destdir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $destdir);
|
||||
$destdir = preg_replace('/[\\/]$/', '', $destdir);
|
||||
|
|
@ -1906,12 +1908,8 @@ class Ticket extends CommonObject
|
|||
|
||||
$result = $ecmfile->fetch(0, '', $destdir.'/'.$attachedfiles['names'][$key]);
|
||||
|
||||
// TODO We must add a column into ecm_files table agenda_id to store the ID of event.
|
||||
// $ecmfile->agenda_id = $actionid;
|
||||
|
||||
// Disabled, serious security hole. A file published into the ERP should not become public for everybody.
|
||||
//require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
//$ecmfile->share = getRandomPassword(true);
|
||||
// We also store the ID of event.
|
||||
$ecmfile->agenda_id = $actionid;
|
||||
|
||||
if ($result > 0) {
|
||||
$result = $ecmfile->update($user);
|
||||
|
|
|
|||
Loading…
Reference in a new issue