Unable to save modifications on calendar events in Roundcube

Hi Guys,

I’m here again towards the end of my project asking for some help on the following issue.

As suggested in Roundcube webmail project web page I followed the instructions to install kolab/calendar from packagist.org (this link). Obviously I installed its dependencies: php >= 5.4.0 and roundcube/plugin-installer > 0.1.3 came already with HestiaCP therefore I installed:

In doing so I followed the instructions in the related README documentation and the “Calendar” plugin appears successfully in my Roundcube (under HestiaCP).

I’m able to create events by filling every single field and also attaching any file. I’m able to create calendars and I’m also able to receive messages a specific amount of minutes before the event happens.

However, the minute I try to make any type of modification to an existing event (it could be anything, even just renaming the even name from event1 to event2) I receive the following message:

Failed to save changes.

In the example below I have been trying, for instance, to modify just the name of the event scheduled on Thursday the 24th November 2022 at 11:00 AM from work1 to work2:

image

image

This is what is printed inside the /var/log/roundcube/errors.log file the minute I click on SAVE:

[23-Nov-2022 00:25:26 Europe/Rome] PHP Warning:  Undefined array key "action" in /var/lib/roundcube/plugins/libcalendaring/libcalendaring.php on line 782
[23-Nov-2022 00:25:28 Europe/Rome] PHP Warning:  Undefined array key "success" in /var/lib/roundcube/plugins/calendar/calendar.php on line 1694
[23-Nov-2022 00:25:59 +0100]: <gime5187> DB Error: [1048] Column 'sensitivity' cannot be null (SQL Query: UPDATE `events` SET `changed` = now(), `start` = '2022-11-24 12:00:00', `end` = '2022-11-24 12:30:00', `all_day` = '0', `title` = 'work2', `description` = '', `location` = '', `categories` = '', `url` = '', `free_busy` = '1', `priority` = '0', `sensitivity` = NULL, `status` = '', `attendees` = '', `alarms` = '[{\"action\":\"DISPLAY\",\"related\":\"start\",\"trigger\":\"-PT15M\"}]', `notifyat` = '2022-11-24 11:45:00' WHERE `event_id` = '1005' AND `calendar_id` IN ('1','2')) in /var/lib/roundcube/program/lib/Roundcube/rcube_db.php on line 564 (POST /?_task=calendar&_action=event)

I’m not sure if you guys can assist on this since it’s clearly a vendor related issue but I hope someone can.

Appreciate any help in advance.

Regards.

Ivano

It makes more sense to ask the developers of the plugin than here. Hestia doesn’t has any support for cardav currently

Do you mean the HestiaCP developers or the Roundcube developers?

we’re the hestia devs :slight_smile:

1 Like

The developers of

and

But it looks like there are no updates for over 2 years.

I really don’t know what is going on and we don’t develop roundcube our self we just download it from source…

1 Like

But we don’t develop Roundcube or even Kolab plugins so it is hard to know the answer…

Thank you eris. Appreciate it! I wonder whether there’s another plugin to install a decent good looking calendar in roundcube.

All right. I figured it out everything by myself thankfully. Although this is NOT an HestiaCP related issue, I decided to post the solution (detailed stepsbelow) as I believe this will increased the value of the solution offered by HestiaCP (not to mention the user’s experience which will also be better).

So here we go (again it worked for me on Ubuntu 22.04 and HestiaCP 1.6.11 but I don’t assume any responsibility). It might be a bit long. If you just want the solution to the issue to this post just jump to step 6.


TWEAK: INSTALL CALENDAR FOR ROUNDCUBE


1. Make a backup of the DB

  • Rrefer to this official page

2. Install PHP “Composer” on Ubuntu 22.04

  • Ensure the OS is fully updated:
    # apt update
    # apt dist-upgrade
    # reboot
    
  • Issue this command:
    # apt install php-cli unzip
    
  • Download the PHP Composer installer script in the /tmp folder by utilizing the following “curl” command:
    # curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
    
  • Verify the hash of the downloaded PHP composer script with the signatures present at the official page (https://composer.github.io/pubkeys.html):
    # sha384sum /tmp/composer-setup.php
    
  • You should get this:
    55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae
    
  • Validate if the PHP Composer installer can be safely executed or not:
    # HASH=`curl -sS https://composer.github.io/installer.sig`
    # php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    
  • You should obtain the Installed verified message. If so keep following the instructions below
  • Install PHP Composer:
    # php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
    
  • Test PHP Composer installation by simply issuing this command (as a non root user):
    $ composer 
    
  • You should get something like that:
        ______
      / ____/___  ____ ___  ____  ____  ________  _____
     / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
    / /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
    \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                     /_/
    Composer version 2.4.4 2022-10-27 14:39:29
    

3. Install the Kolab/libcalendaring library

  • This library provides utility functions for calendar-related modules such as:

    • alarms display and dismissal
    • attachment handling
    • iCal parsing and exporting
    • iTip invitations handling
  • iCal parsing and exporting is done with the help of the Sabre VObject library. It needs to be insalled with Roundcube using composer:Install version 3.3.5 of sabre/vobject. Issue this command as a non root user:

    $ composer require "sabre/vobject" "~3.3.3"
    
  • Install version 4.1 of sabre/vobject (this ensures that you install the latest VObject package in the 3.4 range of packages, but it does not install 3.5 or higher, which could result in a backwards compatibility break. That’s why I issued the previous command as well). Issue this command as a non root user:

    $ composer require sabre/vobject ~4.1
    
  • After running this, sabre/vobject should be installed, and you can load it in by including the autoloader

4. Install the Kolab/libkolab library

  • This package requires:

    • php:>= 5.3.0
    • caxy/php-htmldiff: ~0.1.7
    • pear/http_request2: ~2.3.0
    • roundcube/plugin-installer: >=0.1.3
  • “php” and “roundcube/plugin-installer” are ok, therefore proceed with the installation of “caxy/php-htmldiff” and “pear/http_request2”. So issue these commands as a non root user:

    $ composer require caxy/php-htmldiff
    $ composer require pear/http_request2
    
  • Proceed installing the kolab/libkolab library in the next section as it’s part of the Kolab/calendar plugin set

5. Install Kolab/calendar library:

  • This is a library which provides common functions for calendaring plugins. Keep in mind that it requires the following libraries:

    1. php: >=5.4.0
    2. roundcube/plugin-installer: >=0.1.3
    3. kolab/libcalendaring: >=3.4.0
    4. kolab/libkolab: >=3.4.0
  • Issue these commands:

    # cd /tmp
    # git clone https://git.kolab.org/diffusion/RPK/roundcubemail-plugins-kolab.git
    # cd /var/lib/roundcube/plugins
    # cp -r /tmp/roundcubemail-plugins-kolab/plugins/calendar .
    # cp -r /tmp/roundcubemail-plugins-kolab/plugins/libcalendaring .
    # cp -r /tmp/roundcubemail-plugins-kolab/plugins/libkolab .
    
  • Set “group” permissions correctly for Kolab/calendar, Kolab/libcalendaring and Kolab/libkolab:

    # chown -R root:www-data calendar/ libcalendaring/ libkolab/
    
  • Create calendar plugin configuration:

    $ cd calendar/
    $ cp config.inc.php.dist config.inc.php
    $ vi config.inc.php
    
  • Change what you like. I enablede the “birthday” calendar by replacing the “false” value below with “true”:

    $config['calendar_contact_birthdays'] = false;
    
  • Initialize the calendar database tables:

    $ cd ../../
    $ bin/initdb.sh --dir=plugins/calendar/drivers/database/SQL
    
  • Ensure lessc is installed:

    # apt install node-less
    
  • Build css styles for the Elastic skin:

    $ lessc --relative-urls -x plugins/libkolab/skins/elastic/libkolab.less > plugins/libkolab/skins/elastic/libkolab.min.css
    

    Note: You might get a warning message letting you know that the above option is deprecated. I didn’t care about it as it’s deprecated only but still active!

  • Create libkolab plugin configuration:

    $ cd /var/lib/roundcube/plugins/libkolab
    $ cp config.inc.php.dist config.inc.php
    $ vi config.inc.php
    

    Note: modifying the config.inc.php file is up to you as it’s optional. Just check its content and decide what to do

  • Enable the calendar and the libkolab plugins:

    $ vi config/config.inc.php
    

    Note: the “config” subfolder above is just a symlink to the following folder: “/etc/roundcube/”

  • Add ‘calendar’ and “libkolab” to the list of active plugins:

    $config['plugins'] = array(
      (...)
      'calendar',
      'libkolab'
    );
    
  • Reboot your machine/VM (optional):

    # reboot
    

6. Modify the “database_driver.php” script to avoid failures while modifying events

  • Copy the file “/var/lib/roundcube/plugins/calendar/drivers/database/database_driver.php”:

    # cp /var/lib/roundcube/plugins/calendar/drivers/database/database_driver.php /var/lib/roundcube/plugins/calendar/drivers/database/database_driver.php.bak
    
  • Search for this row (usually row number 665):

    $event['sensitivity'] = isset($this->sensitivity_map[$sensitivity]) ? $this->sensitivity_map[$sensitivity] : null;
    
  • Replace NULL with 0. After that the new line will be like this:

    $event['sensitivity'] = isset($this->sensitivity_map[$sensitivity]) ? $this->sensitivity_map[$sensitivity] : 0;
    
  • Save and exit

    ATTENTION: Keep in mind that if there’s an update on this plugin, you have to apply this last modification/tweak again!


REFERENCED ARTICLES


2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.