Debug v17
This commit is contained in:
parent
ddf60b399e
commit
f371bf96db
@ -430,7 +430,36 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
$db->begin();
|
$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
|
// Creation of action/event
|
||||||
$idaction = $object->create($user);
|
$idaction = $object->create($user);
|
||||||
@ -517,26 +546,7 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$action = 'create'; $donotclearsession = 1;
|
$action = 'create'; $donotclearsession = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$selectedrecurrulefreq = 'no';
|
if ($eventisrecurring) {
|
||||||
$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') {
|
|
||||||
// We set first date of recurrence and offsets
|
// We set first date of recurrence and offsets
|
||||||
if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) {
|
if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) {
|
||||||
$firstdatearray = dol_get_first_day_week(GETPOST("apday", 'int'), GETPOST("apmonth", 'int'), GETPOST("apyear", 'int'));
|
$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') {
|
if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes') {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_optionals();
|
$object->fetch_optionals();
|
||||||
@ -2205,11 +2213,18 @@ if ($id > 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
if ($object->elementtype == 'ticket') print '<tr><td class="titlefield">'.$langs->trans("PrivateEventMessage").'</td><td>'.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).'</td></tr>';
|
if ($object->elementtype == 'ticket') {
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("PrivateEventMessage").'</td><td>'.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Full day event
|
// Full day event
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';
|
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';
|
||||||
|
|
||||||
|
// Event into a serie
|
||||||
|
if ($object->recurid) {
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("EventIntoASerie").'</td><td>'.dol_escape_htmltag($object->recurid).'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
$rowspan = 4;
|
$rowspan = 4;
|
||||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
||||||
$rowspan++;
|
$rowspan++;
|
||||||
|
|||||||
@ -269,6 +269,7 @@ class ActionComm extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $contact_id;
|
public $contact_id;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Societe|null Company linked to action (optional)
|
* @var Societe|null Company linked to action (optional)
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -376,9 +377,9 @@ class ActionComm extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Properties to manage the recurring events
|
* Properties to manage the recurring events
|
||||||
*/
|
*/
|
||||||
public $recurid;
|
public $recurid; /* A string YYYYMMDDHHMMSS shared by allevent of same serie */
|
||||||
public $recurrule;
|
public $recurrule; /* Rule of recurring */
|
||||||
public $recurdateend;
|
public $recurdateend; /* Repeat until this date */
|
||||||
|
|
||||||
public $calling_duration;
|
public $calling_duration;
|
||||||
|
|
||||||
@ -549,6 +550,9 @@ class ActionComm extends CommonObject
|
|||||||
$sql .= "email_tobcc,";
|
$sql .= "email_tobcc,";
|
||||||
$sql .= "email_subject,";
|
$sql .= "email_subject,";
|
||||||
$sql .= "errors_to,";
|
$sql .= "errors_to,";
|
||||||
|
$sql .= "recurid,";
|
||||||
|
$sql .= "recurrule,";
|
||||||
|
$sql .= "recurdateend,";
|
||||||
$sql .= "num_vote,";
|
$sql .= "num_vote,";
|
||||||
$sql .= "event_paid,";
|
$sql .= "event_paid,";
|
||||||
$sql .= "status";
|
$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_tobcc) ? "'".$this->db->escape($this->email_tobcc)."'" : "null").", ";
|
||||||
$sql .= (!empty($this->email_subject) ? "'".$this->db->escape($this->email_subject)."'" : "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->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->num_vote) ? (int) $this->num_vote : "null").", ";
|
||||||
$sql .= (!empty($this->event_paid) ? (int) $this->event_paid : 0).", ";
|
$sql .= (!empty($this->event_paid) ? (int) $this->event_paid : 0).", ";
|
||||||
$sql .= (!empty($this->status) ? (int) $this->status : "0");
|
$sql .= (!empty($this->status) ? (int) $this->status : "0");
|
||||||
@ -716,6 +723,9 @@ class ActionComm extends CommonObject
|
|||||||
$this->fetchResources();
|
$this->fetchResources();
|
||||||
|
|
||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
|
$this->recurid = '';
|
||||||
|
$this->recurrule = '';
|
||||||
|
$this->recurdateend = '';
|
||||||
|
|
||||||
// Create clone
|
// Create clone
|
||||||
$this->context['createfromclone'] = 'createfromclone';
|
$this->context['createfromclone'] = 'createfromclone';
|
||||||
|
|||||||
@ -1010,7 +1010,7 @@ if (!empty($arrayfields['p.tms']['checked'])) {
|
|||||||
// Status
|
// Status
|
||||||
if (!empty($arrayfields['p.statut']['checked'])) {
|
if (!empty($arrayfields['p.statut']['checked'])) {
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
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 '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['p.import_key']['checked'])) {
|
if (!empty($arrayfields['p.import_key']['checked'])) {
|
||||||
|
|||||||
@ -8097,7 +8097,7 @@ class Form
|
|||||||
if ($addjscombo && $jsbeautify) {
|
if ($addjscombo && $jsbeautify) {
|
||||||
// Enhance with select2
|
// Enhance with select2
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
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;
|
return $out;
|
||||||
|
|||||||
@ -434,10 +434,11 @@ function ajax_dialog($title, $message, $w = 350, $h = 150)
|
|||||||
* @param int $forcefocus Force focus on field
|
* @param int $forcefocus Force focus on field
|
||||||
* @param string $widthTypeOfAutocomplete 'resolve' or 'off'
|
* @param string $widthTypeOfAutocomplete 'resolve' or 'off'
|
||||||
* @param string $idforemptyvalue '-1'
|
* @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.
|
* @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
|
* @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;
|
global $conf;
|
||||||
|
|
||||||
@ -463,14 +464,17 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
|||||||
$minLengthToAutocomplete = 0;
|
$minLengthToAutocomplete = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$moreselect2theme = ($morecss ? dol_escape_js(' '.$morecss) : '');
|
||||||
|
$moreselect2theme = preg_replace('/widthcentpercentminus[^\s]*/', '', $moreselect2theme);
|
||||||
|
|
||||||
$tmpplugin = 'select2';
|
$tmpplugin = 'select2';
|
||||||
$msg = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
|
$msg = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$(\''.(preg_match('/^\./', $htmlname) ? $htmlname : '#'.$htmlname).'\').'.$tmpplugin.'({
|
$(\''.(preg_match('/^\./', $htmlname) ? $htmlname : '#'.$htmlname).'\').'.$tmpplugin.'({
|
||||||
dir: \'ltr\',
|
dir: \'ltr\',
|
||||||
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
|
width: \''.dol_escape_js($widthTypeOfAutocomplete).'\', /* off or resolve */
|
||||||
minimumInputLength: '.$minLengthToAutocomplete.',
|
minimumInputLength: '.((int) $minLengthToAutocomplete).',
|
||||||
language: select2arrayoflanguage,
|
language: select2arrayoflanguage,
|
||||||
matcher: function (params, data) {
|
matcher: function (params, data) {
|
||||||
if ($.trim(params.term) === "") {
|
if ($.trim(params.term) === "") {
|
||||||
@ -484,6 +488,7 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
|||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
theme: \'default'.$moreselect2theme.'\', /* to add css on generated html components */
|
||||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||||
selectionCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
selectionCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||||
templateResult: function (data, container) { /* Format visible output into combo list */
|
templateResult: function (data, container) { /* Format visible output into combo list */
|
||||||
|
|||||||
@ -6453,6 +6453,9 @@ ul.select2-results__options li {
|
|||||||
.select2-container.select2-container--open .select2-dropdown--below {
|
.select2-container.select2-container--open .select2-dropdown--below {
|
||||||
min-width: 220px !important;
|
min-width: 220px !important;
|
||||||
}
|
}
|
||||||
|
.onrightofpage span.select2-dropdown.ui-dialog.select2-dropdown--below {
|
||||||
|
min-width: 140px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.select2-container--open .select2-dropdown--below {
|
.select2-container--open .select2-dropdown--below {
|
||||||
border-top: 1px solid var(--inputbordercolor);
|
border-top: 1px solid var(--inputbordercolor);
|
||||||
|
|||||||
@ -6221,6 +6221,9 @@ ul.select2-results__options li {
|
|||||||
.select2-container.select2-container--open .select2-dropdown--below {
|
.select2-container.select2-container--open .select2-dropdown--below {
|
||||||
min-width: 220px !important;
|
min-width: 220px !important;
|
||||||
}
|
}
|
||||||
|
.onrightofpage span.select2-dropdown.ui-dialog.select2-dropdown--below {
|
||||||
|
min-width: 140px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.select2-container--open .select2-dropdown--below {
|
.select2-container--open .select2-dropdown--below {
|
||||||
border-top: 1px solid var(--inputbordercolor);
|
border-top: 1px solid var(--inputbordercolor);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user