Use the right list of properties relevenat for scheduling (follow-up of commit 12591358
). Static vars don't work here as intended
This commit is contained in:
parent
12591358e6
commit
d564e23aa3
4 changed files with 24 additions and 24 deletions
|
@ -1041,7 +1041,8 @@ class kolab_driver extends calendar_driver
|
|||
}
|
||||
|
||||
// iterate through the list of properties considered 'significant' for scheduling
|
||||
$reschedule = kolab_format_event::check_rescheduling($event, $old);
|
||||
$kolab_event = $old['_formatobj'] ?: new kolab_format_event();
|
||||
$reschedule = $kolab_event->check_rescheduling($event, $old);
|
||||
|
||||
// reset all attendee status to needs-action (#4360)
|
||||
if ($update && $reschedule && is_array($event['attendees'])) {
|
||||
|
|
|
@ -44,6 +44,9 @@ class kolab_format_event extends kolab_format_xcal
|
|||
$this->obj = $data;
|
||||
$this->loaded = true;
|
||||
}
|
||||
|
||||
// copy static property overriden by this class
|
||||
$this->_scheduling_properties = self::$scheduling_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -275,13 +278,4 @@ class kolab_format_event extends kolab_format_xcal
|
|||
return $exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify changes considered relevant for scheduling
|
||||
*
|
||||
* @see kolab_format_xcal::check_rescheduling()
|
||||
*/
|
||||
public static function check_rescheduling($object, $old, $checks = null)
|
||||
{
|
||||
return parent::check_rescheduling($object, $old, $checks ?: self::$scheduling_properties);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,16 @@ class kolab_format_task extends kolab_format_xcal
|
|||
protected $read_func = 'readTodo';
|
||||
protected $write_func = 'writeTodo';
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
function __construct($data = null, $version = 3.0)
|
||||
{
|
||||
parent::__construct(is_string($data) ? $data : null, $version);
|
||||
|
||||
// copy static property overriden by this class
|
||||
$this->_scheduling_properties = self::$scheduling_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set properties to the kolabformat object
|
||||
|
@ -127,13 +137,4 @@ class kolab_format_task extends kolab_format_xcal
|
|||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify changes considered relevant for scheduling
|
||||
*
|
||||
* @see kolab_format_xcal::check_rescheduling()
|
||||
*/
|
||||
public static function check_rescheduling($object, $old, $checks = null)
|
||||
{
|
||||
return parent::check_rescheduling($object, $old, $checks ?: self::$scheduling_properties);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@ abstract class kolab_format_xcal extends kolab_format
|
|||
|
||||
public static $scheduling_properties = array('start', 'end', 'location');
|
||||
|
||||
protected $_scheduling_properties = null;
|
||||
|
||||
protected $sensitivity_map = array(
|
||||
'public' => kolabformat::ClassPublic,
|
||||
'private' => kolabformat::ClassPrivate,
|
||||
|
@ -317,11 +319,10 @@ abstract class kolab_format_xcal extends kolab_format
|
|||
}
|
||||
else {
|
||||
$object['sequence'] = $old_sequence;
|
||||
$old = $this->data['uid'] ? $this->data : $this->to_array();
|
||||
|
||||
// increment sequence when updating properties relevant for scheduling.
|
||||
// RFC 5545: "It is incremented [...] each time the Organizer makes a significant revision to the calendar component."
|
||||
if (self::check_rescheduling($object, $old)) {
|
||||
if ($this->check_rescheduling($object)) {
|
||||
$object['sequence']++;
|
||||
}
|
||||
}
|
||||
|
@ -634,15 +635,18 @@ abstract class kolab_format_xcal extends kolab_format
|
|||
*
|
||||
* @param array Hash array with NEW object properties
|
||||
* @param array Hash array with OLD object properties
|
||||
* @param array List of object properties to check for changes
|
||||
*
|
||||
* @return boolean True if changes affect scheduling, False otherwise
|
||||
*/
|
||||
public static function check_rescheduling($object, $old, $checks = null)
|
||||
public function check_rescheduling($object, $old = null)
|
||||
{
|
||||
$reschedule = false;
|
||||
|
||||
foreach ($checks ?: self::$scheduling_properties as $prop) {
|
||||
if (!is_array($old)) {
|
||||
$old = $this->data['uid'] ? $this->data : $this->to_array();
|
||||
}
|
||||
|
||||
foreach ($this->_scheduling_properties ?: self::$scheduling_properties as $prop) {
|
||||
$a = $old[$prop];
|
||||
$b = $object[$prop];
|
||||
if ($object['allday'] && ($prop == 'start' || $prop == 'end') && $a instanceof DateTime && $b instanceof DateTime) {
|
||||
|
|
Loading…
Add table
Reference in a new issue