diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 271b6eb463c..105e70e18bc 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -430,7 +430,36 @@ if (empty($reshook) && $action == 'add') {
if (!$error) {
$db->begin();
+ $selectedrecurrulefreq = 'no';
+ $selectedrecurrulebymonthday = '';
+ $selectedrecurrulebyday = '';
+ $object->recurrule = GETPOSTISSET('recurrulefreq') ? "FREQ=".GETPOST('recurrulefreq', 'alpha') : "";
+ $object->recurrule .= (GETPOST('recurrulefreq', 'alpha') == 'MONTHLY' && GETPOSTISSET('BYMONTHDAY')) ? "_BYMONTHDAY".GETPOST('BYMONTHDAY', 'alpha') : "";
+ $object->recurrule .= (GETPOST('recurrulefreq', 'alpha') == 'WEEKLY' && GETPOSTISSET('BYDAY')) ? "_BYDAY".GETPOST('BYDAY', 'alpha') : "";
+ $reg1 = array(); $reg2 = array(); $reg3 = array();
+ if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i', $object->recurrule, $reg1)) {
+ $selectedrecurrulefreq = $reg1[1];
+ }
+ if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY(\d+)/i', $object->recurrule, $reg2)) {
+ $selectedrecurrulebymonthday = $reg2[1];
+ }
+ if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i', $object->recurrule, $reg3)) {
+ $selectedrecurrulebyday = $reg3[1];
+ }
+
+ // Is event recurrent ?
+ $eventisrecurring = 0;
+ $userepeatevent = (getDolGlobalInt('MAIN_FEATURES_LEVEL') == 2 ? 1 : 0);
+ if ($userepeatevent && !empty($selectedrecurrulefreq) && $selectedrecurrulefreq != 'no') {
+ $eventisrecurring = 1;
+ $object->recurid = dol_print_date(dol_now('gmt'), 'dayhourlog', 'gmt');
+ $object->recurdateend = dol_mktime(0, 0, 0, GETPOST('limitmonth', 'int'), GETPOST('limitday', 'int'), GETPOST('limityear', 'int'));
+ } else {
+ unset($object->recurid);
+ unset($object->recurrule);
+ unset($object->recurdateend);
+ }
// Creation of action/event
$idaction = $object->create($user);
@@ -517,26 +546,7 @@ if (empty($reshook) && $action == 'add') {
$action = 'create'; $donotclearsession = 1;
}
- $selectedrecurrulefreq = 'no';
- $selectedrecurrulebymonthday = '';
- $selectedrecurrulebyday = '';
- $object->recurrule = GETPOSTISSET('recurrulefreq') ? "FREQ=".GETPOST('recurrulefreq', 'alpha') : "";
- $object->recurrule .= GETPOSTISSET('BYMONTHDAY') ? "_BYMONTHDAY".GETPOST('BYMONTHDAY', 'alpha') : "";
- $object->recurrule .= GETPOSTISSET('BYDAY') ? "_BYDAY".GETPOST('BYDAY', 'alpha') : "";
-
- if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i', $object->recurrule, $reg1)) {
- $selectedrecurrulefreq = $reg1[1];
- }
- if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY(\d+)/i', $object->recurrule, $reg2)) {
- $selectedrecurrulebymonthday = $reg2[1];
- }
- if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i', $object->recurrule, $reg3)) {
- $selectedrecurrulebyday = $reg3[1];
- }
-
- // If event is recurrent
- $userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
- if ($userepeatevent && !empty($selectedrecurrulefreq) && $selectedrecurrulefreq != 'no') {
+ if ($eventisrecurring) {
// We set first date of recurrence and offsets
if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) {
$firstdatearray = dol_get_first_day_week(GETPOST("apday", 'int'), GETPOST("apmonth", 'int'), GETPOST("apyear", 'int'));
@@ -944,9 +954,7 @@ if (empty($reshook) && $action == 'update') {
}
}
-/*
- * delete event
- */
+// Delete event
if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes') {
$object->fetch($id);
$object->fetch_optionals();
@@ -2205,11 +2213,18 @@ if ($id > 0) {
}
// Private
- if ($object->elementtype == 'ticket') print '
| '.$langs->trans("PrivateEventMessage").' | '.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).' |
';
+ if ($object->elementtype == 'ticket') {
+ print '| '.$langs->trans("PrivateEventMessage").' | '.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).' |
';
+ }
// Full day event
print '| '.$langs->trans("EventOnFullDay").' | '.yn($object->fulldayevent ? 1 : 0, 3).' |
';
+ // Event into a serie
+ if ($object->recurid) {
+ print '| '.$langs->trans("EventIntoASerie").' | '.dol_escape_htmltag($object->recurid).' |
';
+ }
+
$rowspan = 4;
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
$rowspan++;
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index aa14ba6e696..f4b7f1b2bfb 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -269,6 +269,7 @@ class ActionComm extends CommonObject
*/
public $contact_id;
+
/**
* @var Societe|null Company linked to action (optional)
* @deprecated
@@ -376,9 +377,9 @@ class ActionComm extends CommonObject
/**
* Properties to manage the recurring events
*/
- public $recurid;
- public $recurrule;
- public $recurdateend;
+ public $recurid; /* A string YYYYMMDDHHMMSS shared by allevent of same serie */
+ public $recurrule; /* Rule of recurring */
+ public $recurdateend; /* Repeat until this date */
public $calling_duration;
@@ -549,6 +550,9 @@ class ActionComm extends CommonObject
$sql .= "email_tobcc,";
$sql .= "email_subject,";
$sql .= "errors_to,";
+ $sql .= "recurid,";
+ $sql .= "recurrule,";
+ $sql .= "recurdateend,";
$sql .= "num_vote,";
$sql .= "event_paid,";
$sql .= "status";
@@ -587,6 +591,9 @@ class ActionComm extends CommonObject
$sql .= (!empty($this->email_tobcc) ? "'".$this->db->escape($this->email_tobcc)."'" : "null").", ";
$sql .= (!empty($this->email_subject) ? "'".$this->db->escape($this->email_subject)."'" : "null").", ";
$sql .= (!empty($this->errors_to) ? "'".$this->db->escape($this->errors_to)."'" : "null").", ";
+ $sql .= (!empty($this->recurid) ? "'".$this->db->escape($this->recurid)."'" : "null").", ";
+ $sql .= (!empty($this->recurrule) ? "'".$this->db->escape($this->recurrule)."'" : "null").", ";
+ $sql .= (!empty($this->recurdateend) ? "'".$this->db->idate($this->recurdateend)."'" : "null").", ";
$sql .= (!empty($this->num_vote) ? (int) $this->num_vote : "null").", ";
$sql .= (!empty($this->event_paid) ? (int) $this->event_paid : 0).", ";
$sql .= (!empty($this->status) ? (int) $this->status : "0");
@@ -716,6 +723,9 @@ class ActionComm extends CommonObject
$this->fetchResources();
$this->id = 0;
+ $this->recurid = '';
+ $this->recurrule = '';
+ $this->recurdateend = '';
// Create clone
$this->context['createfromclone'] = 'createfromclone';
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index ae5deba98f1..2bfdf9d1f66 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -1010,7 +1010,7 @@ if (!empty($arrayfields['p.tms']['checked'])) {
// Status
if (!empty($arrayfields['p.statut']['checked'])) {
print '';
- print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75');
+ print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75 onrightofpage');
print ' | ';
}
if (!empty($arrayfields['p.import_key']['checked'])) {
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index a82aadb7363..13c99dea052 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -8097,7 +8097,7 @@ class Form
if ($addjscombo && $jsbeautify) {
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
- $out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', $show_empty < 0 ? (string) $show_empty : '-1');
+ $out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($show_empty < 0 ? (string) $show_empty : '-1'), $morecss);
}
return $out;
diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php
index 35e67f19e80..6cd7a0f0381 100644
--- a/htdocs/core/lib/ajax.lib.php
+++ b/htdocs/core/lib/ajax.lib.php
@@ -434,10 +434,11 @@ function ajax_dialog($title, $message, $w = 350, $h = 150)
* @param int $forcefocus Force focus on field
* @param string $widthTypeOfAutocomplete 'resolve' or 'off'
* @param string $idforemptyvalue '-1'
+ * @param string $morecss More css
* @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason.
* @see selectArrayAjax() of html.form.class
*/
-function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = 0, $forcefocus = 0, $widthTypeOfAutocomplete = 'resolve', $idforemptyvalue = '-1')
+function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = 0, $forcefocus = 0, $widthTypeOfAutocomplete = 'resolve', $idforemptyvalue = '-1', $morecss = '')
{
global $conf;
@@ -463,14 +464,17 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
$minLengthToAutocomplete = 0;
}
+ $moreselect2theme = ($morecss ? dol_escape_js(' '.$morecss) : '');
+ $moreselect2theme = preg_replace('/widthcentpercentminus[^\s]*/', '', $moreselect2theme);
+
$tmpplugin = 'select2';
$msg = "\n".'