Loading...
 
Skip to main content

Allow Copy / Duplicate Calendar event

Status
Open
Subject
Allow Copy / Duplicate Calendar event
Version
5.x
Category
  • Patch
Feature
Calendar
Resolution status
New
Submitted by
AlanE
Lastmod by
AlanE
Rating
(0)
Description

Our users have requested the facility to "copy" a calendar event.

This would be via the means of a "Copy" button when previewing an event, on clicking the button you would then see the event details and be able to change any of them before clicking "Save".

Where upon a new event will be created with these details.

Solution

Edit: templates/tiki-calendar_edit_item.tpl

Add the following line directly after the line for the "Edit/Delete event" this ensures the button is only shown at the correct time

tiki-calendar_edit_item.tpl
Copy to clipboard
{button href="tiki-calendar_edit_item.php?calitemId=$id&duplicate=y" _text="{tr}Copy event{/tr}"}


It appears a $_REQUEST function already exists for duplicating calendar events, and I cant see this called from anywhere else. However the function does have an interesting bug where it copies the event before allowing you to edit, so when you do click "SAVE" then two events are created.

To resolve this bug, Edit: tiki-calendar_edit_item.php

Find the following code (within the "duplicate" section) and comment it out.

tiki-calendar_edit_item.php
Copy to clipboard
// $calendarlib->set_item($user,0,$calitem);


Our site also has a modification to allow participants to sign up to calendar events, it is also usefull to blank out the participants on a duplicated event.

Adding the following code within the "duplicate" section after the commented line above removes any existing participants from the copied event.

tiki-calendar_edit_item.php
Copy to clipboard
$calitem['participants'] = array();

Importance
1 low
Priority
5
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
3461
Created
Wednesday 30 June, 2010 19:55:37 UTC
by AlanE
LastModif
Wednesday 30 June, 2010 19:55:37 UTC


Show PHP error messages