Upgrading from 0.3 to 0.4

JpGraph / eZ Components

JpGraph is no longer used; graphs are now created with ezComponents. See above about eZ Components installation.

PEAR replaced

PEAR is no longer required. All dependencies on PEAR packages have been replaced by phpaga's own code.

Billing plugins

Filed (tracked) expenses can now be added to invoices. If you have written your own billing plugin you need to apply a few little changes. First, and most important, a new parameter needs to be added to the function parameter. Then, the invoice calculation details need to be extended. Also, billing plugins are no longer supposed to return an error code. Refer to one of the billing plugins that come shipped with phpaga to see what needs to be changed.

File upload and pictures

Files can now be associated to persons. The script tools/migrate_personpictures.php can be used to migrate the existing pictures (from persons.pe_fotoname to files).

UTF-8: Locales and database

UTF-8 is now used as the encoding for all supported locales. Unfortunately, in previous releases phpaga used to store data in a different format (depending on your locale, most likely LATIN1). Therefore you need to convert the database to UFT-8 before using phpaga 0.4. You will also need to make sure that the desired locales are available in UTF-8.

If you have been storing data with different encodings in the same database, the conversion will most likely produce garbled data, no matter what database system you are using.

iconv is a tool to convert the encoding of given files from one encoding to another; it should be available on most *nix-like systems. If it is not already installed, consult your package management system. A Win32 port of iconv is available at gettext (& libiconv) for Win32 with downloads at http://sourceforge.net/project/showfiles.php?group_id=25167 (fetch the libiconv-*-bin.woe32.zip package).

PostgreSQL

If for some technical reason you are not able to perform the steps below (for example because you do not have administrative rights to drop and create a database) you can enable the setting PHPAGA_PGSQL_ENCODING in etc/config.local.php. Read more about this setting in its description directly in the file. It is highly recommended, though, that you perform the steps below and migrate the existing data and structure to UTF-8.

The following steps need to be taken to convert the existing database (and data) to use UTF-8:

  • Create a database dump

     
      % pg_dump -Fp -U phpaga phpaga >| /tmp/phpagadump.sql
  • Convert the database dump to UTF-8

     
      % iconv -f LATIN1 -t UTF-8 phpagadump.sql -o phpagadump.sql.utf8 

    Replace LATIN1 with the appropriate encoding for your data. Most likely this is will be LATIN2 if you were using the Hungarian locale, KOI8-R if you were using the Russian locale, and LATIN1 for most other languages supported by phpaga in versions <= 0.4.

  • Edit phpagadump.sql.utf8 and make sure that the line

      SET client_encoding = 'LATIN1'; 

    is changed to

      SET client_encoding = 'UTF8'; 

  • Connect to the database server from the terminal (psql)

  • Drop the existing database

      template1=> drop database phpaga;

  • Create the database with the proper encoding ('UTF8' for PostgreSQL 8.x, 'UNICODE' for PostgreSQL 7.x)

      template1=> create database phpaga with encoding 'UTF8';

  • Connect to the database

      template1=> \c phpaga

  • Restore the database from the converted dump

      phpaga=> \i phpagadump.sql.utf8

MySQL

The following steps need to be taken to convert the existing database (and data) to use UTF-8. Replace "latin1" in the following example with the encoding currently used by your database. The procedure described below is not guaranteed to work - while it can work for certain data and encodings, it can also produce garbled data under certain circumstances.

  • Create a database dump

     
      % mysqldump --default-character-set=latin1 -p -u username phpaga > phpagadump.sql
  • Edit phpagadump.sql and change the statement

      SET NAMES latin1 

    to

      SET NAMES utf8 

    Then replace all occurences of

      DEFAULT CHARSET=latin1 

    with

      DEFAULT CHARSET=utf8 

  • Connect to the database server from the terminal (mysql)

  • Drop the existing database

      mysql=> drop database phpaga;

  • Create the database with the proper encoding ('UTF8')

      mysql=> create database phpaga default character set utf8 collate utf8_general_ci;

  • Exit from the database terminal

  • Restore the database from the dump

      mysql --default-character-set=utf8 -p -u username phpaga < phpagadump.sql