2
0
forked from Wavyzz/dolibarr

WIP Recurring events

This commit is contained in:
ldestailleur
2025-04-03 13:59:46 +02:00
parent 18cc530d40
commit 10c0fba6b0
4 changed files with 22 additions and 9 deletions

View File

@@ -2597,11 +2597,6 @@ if ($id > 0) {
// Full day event
print '<tr><td class="titlefieldmiddle">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';
// Event into a series
if ($object->recurid) {
print '<tr><td class="titlefieldmiddle">'.$langs->trans("EventIntoASerie").'</td><td>'.dol_escape_htmltag($object->recurid).'</td></tr>';
}
$rowspan = 4;
if (!getDolGlobalString('AGENDA_DISABLE_LOCATION')) {
$rowspan++;
@@ -2638,6 +2633,17 @@ if ($id > 0) {
}
print '</td></tr>';
// Recurring event (into a series)
if ($object->recurid) {
print '<tr><td class="titlefieldmiddle">'.$langs->trans("RecurringEvent").'</td><td>';
print img_picto($langs->trans("EventPartOfARecurringSerie", $object->recurid), 'recurring', 'class="pictofixedwidth"');
$reg = array();
if (preg_match('/FREQ=MONTHLY_BYMONTHDAY(\d+)/', $object->recurrule, $reg)) {
print $langs->trans("EveryMonth").' <span class="opacitymedium small">('.$langs->trans("DayOfMonth").' '.$reg[1].' - '.$langs->trans("Until").' '.dol_print_date($object->recurdateend, 'day').')</span>';
}
print '</td></tr>';
}
// Location
if (!getDolGlobalString('AGENDA_DISABLE_LOCATION')) {
print '<tr><td>'.$langs->trans("Location").'</td><td>'.$object->location.'</td></tr>';
@@ -2751,10 +2757,10 @@ if ($id > 0) {
// Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
// for such objects because there is already a dedicated field into table llx_actioncomm.
if (!empty($object->fk_element) && !empty($object->elementtype) && !in_array($object->elementtype, array('societe', 'contact', 'project'))) {
if (!empty($object->elementid) && !empty($object->elementtype) && !in_array($object->elementtype, array('societe', 'contact', 'project'))) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print '<tr><td>'.$langs->trans("LinkedObject").'</td>';
$link = dolGetElementUrl($object->fk_element, $object->elementtype, 1);
$link = dolGetElementUrl($object->elementid, $object->elementtype, ($object->elementtype == 'user' ? -1 : 1));
print '<td>';
if (empty($link)) {
print '<span class="opacitymedium">'.$langs->trans("ObjectDeleted").'</span>';

View File

@@ -820,6 +820,7 @@ class ActionComm extends CommonObject
$sql .= " a.fk_element as elementid, a.elementtype,";
$sql .= " a.priority, a.fulldayevent, a.location, a.transparency,";
$sql .= " a.email_msgid, a.email_subject, a.email_from, a.email_sender, a.email_to, a.email_tocc, a.email_tobcc, a.errors_to,";
$sql .= " a.recurid, a.recurrule, a.recurdateend,";
$sql .= " c.id as type_id, c.type as type_type, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,";
$sql .= " s.nom as socname,";
$sql .= " u.firstname, u.lastname as lastname,";
@@ -902,6 +903,10 @@ class ActionComm extends CommonObject
$this->elementid = $obj->elementid;
$this->elementtype = $obj->elementtype;
$this->recurid = $obj->recurid;
$this->recurrule = $obj->recurrule;
$this->recurdateend = $this->db->jdate($obj->recurdateend);
$this->num_vote = $obj->num_vote;
$this->event_paid = $obj->event_paid;
$this->status = $obj->status;

View File

@@ -2109,14 +2109,14 @@ function getSoapParams()
* Return link url to an object
*
* @param int $objectid Id of record
* @param string $objecttype Type of object ('invoice', 'order', 'expedition_bon', 'myobject@mymodule', ...)
* @param string $objecttype Type of object ('invoice', 'order', 'expedition_bon', 'user', 'myobject@mymodule', ...)
* @param int $withpicto Picto to show
* @param string $option More options
* @return string URL of link to object id/type
*/
function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
{
global $db, $conf, $langs;
global $db, $langs;
$ret = '';
$regs = array();

View File

@@ -207,3 +207,5 @@ BookcalBookingTitle=Online appointment
Transparency = Transparency
ReadMore = Read more
ReadLess = Read less
RecurringEvent=Recurring event
EventPartOfARecurringSerie=Event is part of a recurring serie with ID %s