Fix attachment loading of recurring events
This commit is contained in:
parent
325bae250d
commit
8c6e9286c2
2 changed files with 8 additions and 7 deletions
|
@ -116,7 +116,7 @@ function rcube_calendar_ui(settings)
|
|||
|
||||
var load_attachment = function(event, att)
|
||||
{
|
||||
var qstring = '_id='+urlencode(att.id)+'&_event='+urlencode(event.id)+'&_cal='+urlencode(event.calendar);
|
||||
var qstring = '_id='+urlencode(att.id)+'&_event='+urlencode(event.recurrence_id||event.id)+'&_cal='+urlencode(event.calendar);
|
||||
|
||||
// open attachment in frame if it's of a supported mimetype
|
||||
if (id && att.mimetype && $.inArray(att.mimetype, rcmail.mimetypes)>=0) {
|
||||
|
|
|
@ -632,7 +632,7 @@ class database_driver extends calendar_driver
|
|||
if (!empty($calendar_ids)) {
|
||||
$result = $this->rc->db->query(sprintf(
|
||||
"SELECT e.*, COUNT(a.attachment_id) AS _attachments FROM " . $this->db_events . " AS e
|
||||
LEFT JOIN " . $this->db_attachments . " AS a ON (a.event_id = e.event_id)
|
||||
LEFT JOIN " . $this->db_attachments . " AS a ON (a.event_id = e.event_id OR a.event_id = e.recurrence_id)
|
||||
WHERE e.calendar_id IN (%s)
|
||||
AND e.start <= %s AND e.end >= %s
|
||||
%s
|
||||
|
@ -803,8 +803,9 @@ class database_driver extends calendar_driver
|
|||
public function list_attachments($event)
|
||||
{
|
||||
$attachments = array();
|
||||
$event_id = $event['recurrence_id'] ? $event['recurrence_id'] : $event['event_id'];
|
||||
|
||||
if (!empty($this->rc->user->ID)) {
|
||||
if (!empty($this->calendar_ids)) {
|
||||
$result = $this->rc->db->query(
|
||||
"SELECT attachment_id AS id, filename AS name, mimetype, size " .
|
||||
" FROM " . $this->db_attachments .
|
||||
|
@ -812,7 +813,7 @@ class database_driver extends calendar_driver
|
|||
" WHERE event_id=?" .
|
||||
" AND calendar_id IN (" . $this->calendar_ids . "))".
|
||||
" ORDER BY filename",
|
||||
$event['id']
|
||||
$event['recurrence_id'] ? $event['recurrence_id'] : $event['event_id']
|
||||
);
|
||||
|
||||
while ($result && ($arr = $this->rc->db->fetch_assoc($result))) {
|
||||
|
@ -828,14 +829,14 @@ class database_driver extends calendar_driver
|
|||
*/
|
||||
public function get_attachment($id, $event)
|
||||
{
|
||||
if (!empty($this->rc->user->ID)) {
|
||||
if (!empty($this->calendar_ids)) {
|
||||
$result = $this->rc->db->query(
|
||||
"SELECT attachment_id AS id, filename AS name, mimetype, size " .
|
||||
" FROM " . $this->db_attachments .
|
||||
" WHERE attachment_id=?".
|
||||
" AND event_id=?",
|
||||
$id,
|
||||
$event['id']
|
||||
$event['recurrence_id'] ? $event['recurrence_id'] : $event['id']
|
||||
);
|
||||
|
||||
if ($result && ($arr = $this->rc->db->fetch_assoc($result))) {
|
||||
|
@ -851,7 +852,7 @@ class database_driver extends calendar_driver
|
|||
*/
|
||||
public function get_attachment_body($id, $event)
|
||||
{
|
||||
if (!empty($this->rc->user->ID)) {
|
||||
if (!empty($this->calendar_ids)) {
|
||||
$result = $this->rc->db->query(
|
||||
"SELECT data " .
|
||||
" FROM " . $this->db_attachments .
|
||||
|
|
Loading…
Add table
Reference in a new issue