Monday, November 6, 2017

The Group-Office roadmap 2018

In this post we want to give you an update about the roadmap for Group-Office. Some time ago we announced the development of version 7.0. Version 7.0 was going to be a full rewrite with a completely new PHP backend and a new responsive web interface to replace the current ExtJS interface. We we’re working on this for about 3 years aside the regular Group-Office 6 development and tailor made modules we produce.

Despite that the development resulted in a very nice piece of software, we’re not going ahead with it. The current Group-Office is so feature rich that it was probably going to take another 3 years to completely replace it. Mainly because we’re a small team that’s also doing lots of tailor made modules 50% of the time.
So we decided to make a big change in the path that lies ahead. Group-Office 7.0 was a great learning experience and was packed with very good ideas. We’re going to take these ideas and incorporate them into Group-Office 6 more gradually. So it will slowly transition into what Group-Office 7 was meant to be. A responsive Group-Office with a more intuitive interface.

We think it will be better for our existing customers that can be migrated gradually and they will see new features coming in real soon!

We will start with rewriting the backend. We’ll use a standard protocol called JMAP (http://jmap.io) to support new clients in the future. That’s actually already near completion.
We will then start improving the current ExtJS based interface to work better on mobile devices and also make it more intuitive on the desktop.
Then we will start with redesigning each module one by one. You can keep track of our progress on our roadmap page:

Thursday, April 13, 2017

Get sales info with API call.

A customer asked how they could get all sales data from Group-Office on to a television screen. I've written this little script to get this info. Group-Office has no real API (yet) but it is possible to get this data.

The client class is used to connect to Group-Office and get's the year report data which they can use to display.

Because this might be useful to others I've written this tiny blog post:


<?php

class Client {

 private $host;
 private $curl;

 public function __construct($host, $username, $password) {
  $this->curl = curl_init();

  $this->host = rtrim($host, '/');

  curl_setopt($this->curl, CURLOPT_USERPWD, $username . ":" . $password);
  curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, TRUE);
 }

 public function request($route, array $data = array()) {

  curl_setopt($this->curl, CURLOPT_URL, $this->host . '/index.php?r=' . $route);
  curl_setopt($this->curl, CURLOPT_POST, 1);
  curl_setopt($this->curl, CURLOPT_POSTFIELDS, http_build_query($data));

  $json = curl_exec($this->curl);

  return json_decode($json);
 }

 public function __destruct() {
  curl_close($this->curl);
 }

}

$client = new Client('https://example.group-office.com', 'apiuser', 'SECRET');

$data = $client->request('billing/report/yearReport', array(
  'start_date' => '01-01-2017',
  'end_date' => '31-12-2017',
  'books' => json_encode(array('2'))
    )
);

var_dump($data);


Thursday, November 3, 2016

Change the Group-Office database collation and character set

Recently we converted the Group-Office database to the collation "utf8mb4_unicode_ci". We did this to support 4 byte unicode characters. Some customers may want to use another collation because of sorting in the database. For example Danish users want to use "utf8mb4_danish_ci". You can choose any collation as long as it starts with "utf8mb4".
You can use this bash script to convert all tables in the database.
Make a backup first!
#!/bin/bash
DB="go61mb4"
COLLATE="utf8mb4_unicode_ci"
USER="root"
PASSWORD="SECRET"

(
  echo 'set foreign_key_checks=0;ALTER DATABASE `'"$DB"'` \
  CHARACTER SET utf8mb4 COLLATE '"$COLLATE"';'
  mysql -u "$USER" -p"$PASSWORD"  "$DB" -e "SHOW TABLES" --batch --skip-column-names \
  | xargs -I{} echo 'ALTER TABLE `'{}'` \
  CONVERT TO CHARACTER SET utf8mb4 COLLATE '"$COLLATE"';'
) \
| mysql -u "$USER" -p"$PASSWORD" "$DB"

Change the Group-Office database collation and character set

Recently we converted the Group-Office database to the collation "utf8mb4_unicode_ci". We did this to support 4 byte unicode characters. Some customers may want to use another collation because of sorting in the database. For example Danish users want to use "utf8mb4_danish_ci". You can choose any collation as long as it starts with "utf8mb4".
You can use this bash script to convert all tables in the database.
Make a backup first!
#!/bin/bash
DB="go61mb4"
COLLATE="utf8mb4_unicode_ci"
USER="admin"
PASSWORD="mks14785"

(
  echo 'set foreign_key_checks=0;ALTER DATABASE `'"$DB"'` \
  CHARACTER SET utf8mb4 COLLATE '"$COLLATE"';'
  mysql -u "$USER" -p"$PASSWORD"  "$DB" -e "SHOW TABLES" --batch --skip-column-names \
  | xargs -I{} echo 'ALTER TABLE `'{}'` \
  CONVERT TO CHARACTER SET utf8mb4 COLLATE '"$COLLATE"';'
) \
| mysql -u "$USER" -p"$PASSWORD" "$DB"

Thursday, April 7, 2016

Simple monitoring

I was searhing for a simple monitoring tool but most tools out there are very complex. We use 3rd party virtual private servers now so hardware monitoring is not our business. We're interested in monitoring two things:
  1. Free disk space
  2. CPU load
So I use two simple scripts that send out an e-mail alert when the diskspace is low or the CPU load it too high.

You can create the two scripts below and edit the MAILTO and TRIGGER variables to suit your needs /usr/local/bin/monitor-load.sh:

#!/bin/bash
TRIGGER=2.00
MAILTO=mail@somedomain.com


host=`hostname -f`
load=`cat /proc/loadavg | awk '{print $2}'`
response=`echo | awk -v T=$TRIGGER -v L=$load 'BEGIN{if ( L > T){ print "greater"}}'`
if [[ $response = "greater" ]]
then
        #capture top command output for the mail body
        body=`top -n 1 -b`

        echo "$body\n."|mail -s "High load on $host - [ $load ]" $MAILTO
fi
/usr/local/bin/monitor-disk-usage.sh:

#!/bin/bash
MAILTO=mail@somedomain.com
TRIGGER=80

HOST=`hostname -f`
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')

if [ "$CURRENT" -gt "$TRIGGER" ] ; then

    mail -s "Disk Space Alert for $HOST" $MAILTO << EOF
The root partition of '$HOST' remaining free space is critically low. Used: $CURRENT%
EOF
fi

Make these two scripts executable:
chmod +x /usr/local/bin/monitor-load.sh 
chmod +x /usr/local/bin/monitor-disk-usage.sh
Now schedule these script in system cron jobs:
/etc/cron.d/monitor:
# Check server load and diskspace
* * * * * root /usr/local/bin/monitor-load.sh
0 7,16 * * * root /usr/local/bin/monitor-disk-usage.sh
This will check the server load every minute and disk space at 7am and 4pm. Finally it's wise to test if mails sent from console arrive. Change the e-mail address in this command and run it:
echo "."|mail -s "Test mail from console" mail@somedomain.com

Wednesday, May 13, 2015

DAVDroid calendar and contact sync

There's a very nice Android synchronization client called DAVDroid.
The beauty of this app is that the setup is extremely simple and sets up contact and calendar sync in one step. Here's a quick run through the setup:

1. Install the DAVDroid app and open it.
2. Select URL and user name:
3. Fill in your details:
4. Select the auto detected your address books and calendars you'd like to sync:

Now it's done and you can view the new calendars and address books in the calendar and contacts app!



Connect your website to Group-Office

Often it's desired to connect a website to Group-Office. For example you might want to have a sign up form that adds a contact to Group-Office.
Group-Office has a powerful JSON API to do this. Here's an example script that add's a contact using cURL. With cURL you can do HTTP requests in your own PHP script that you can run on your own CMS like Wordpress or Drupal for example.



<?php
//URL to Group-Office. You must use SSL because we use basic auth!
$groupoffice_url = "https://localhost/groupoffice-6.1/www/";

//Group-Office username and password. You should create a restricted user that 
//can only add contacts to this addressbook.
$username = 'website';
$password = 'secret';

//The contact properties to POST
$post = array(
  'addressbook_id' => 1, //required
  'company_id' => 0,
  'first_name' => 'Curl',
  'last_name' => 'Tester',
  'initials' => '',
  'title' => '',
  'suffix' => '',
  'sex' => 'M', // or 'F"
  'birthday' => '', //local format
   'email' => '',
  'email2' => '',
  'email3' => '',
  'department' => '',
  'function' => '',
  'home_phone' => '',
  'work_phone' => '',
  'fax' => '',
  'work_fax' => '',
  'cellular' => '',
  'cellular2' => '',
  'homepage' => '',
  'country' => 'NL', //2 character ISO code 
  'state' => '',
  'city' => '',
  'zip' => '',
  'address' => '',
  'address_no' => '',
  'comment' => ''
);

$process = curl_init($groupoffice_url . '?r=addressbook/contact/submit');
curl_setopt($process, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, $post);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);

$return = curl_exec($process);
curl_close($process);

//JSON decode the response
$json = json_decode($return, true);


//Handle success or error here.
if ($json['success']) {
 echo "Contact saved!\n";
} else {
 echo "Failed to save contact: " . $json['feedback'] . "\n";
}