Inhaltsverzeichnis Development System Set-Up...... 1 Required...... 1 Optional...... 2 Next steps...... 3 Known problems...... 3 Exceptions when starting Gnuaccounting from ...... 3 Ant Exceptions ...... 3 Conflicts with previous data/Re-”installing” gnuaccounting...... 3 Videos for Gnuaccounting developers...... 3 How the source code is organized...... 4 How to develop the GUI...... 5 Superglobals, Important classes...... 5 Code Examples...... 6 Helpful commands...... 6 Using the database view...... 6 Print the linecount...... 6 Linux support...... 6 Mac OS X support...... 6 Libraries used...... 6 OpenTRANS...... 8 osCommerce OpenTRANS connector...... 8 Tests...... 10 Mandatory (Smoke test)...... 10 Optional...... 10 Extended...... 11 Release checklist...... 12

Development System Set-Up Please note that on linux systems it might be possible to compile small changes without eclipse using ant. Otherwise

Required 1. Get Eclipse 4.3 (Kepler) or higher. If you get the 64bit version please additionally install and select a 32bit JDK. 2. Get subversive via Help|Eclipse Marketplace. Restart Eclipse. 3. Check out gnuaccounting from subversion: File|New|Other|SVN|Checkout projects from SVN. Repository location: http://svn.code.sf.net/p/gnuaccounting/code/trunk (suggested manual SVN command would be “svn checkout http://svn.code.sf.net/p/gnuaccounting/code/trunk gnuaccounting-code”). The download is around 38mb. 4. Create a new Run configuration (Run|Run Configurations), click on Application in the left pane and then on the blank-page icon for new configuration on the top of the left pane. Search for the main class -- it's GUILayer.MainWindow

1 / 12 5. On a 64 bit windows please make sure you install and use a 32-bit SDK (Window| Preferences|Java|Installed JREs and Run|Run configurations|JRE) Optional 6. It is advisable to have "always launch the previously launched application" selected in Window|Preferences>Run/Debug>Launching, otherwise Eclipse might try to launch the individual windows instead of the generic project. 7. Should you have write access to the repository: please do not check in files related to compiling the project in Windows (=the new .classpath) 8. If you want to translate, the Resource Bundle Editor might help (web page http://sourceforge.net/projects/eclipse-rbe/, update site http://www.nightlabs.de/updatesites/development/), Development tools/ResourceBundle Editor Plug-in 9. if you want to run an ant build in the eclipse standard installation you will receive a BUILD FAILED C:\Users\jstaerk\workspace\gnuaccounting\build.xml:24: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK. It is currently set to "C:\Program Files\Java\jre6" Error. Download and install a Java JDK and back in eclipse click Window|Preferences|Java|Installed JREs . Click “Add”, select “standard VM” and select the “bin” subdirectory of your JDK Installation, e.g. C:\Program Files\Java\jdk1.6.0_21 . Afterwards click the checkbox next to the new entry to activate the new JRE/JDK. Ant builds will now be possible (by right-clicking build.xml and selecting “Run as Ant build”). An ant build is required to release an installer package. 10.If you want to release the windows installer version you will need NSIS http://nsis.sourceforge.net/ and the Shelllink plugin http://nsis.sourceforge.net/ShellLink_plug-in 11.To edit the documentation or run the software please download OpenOffice.org. You can also install the Eclipse integration NOA4E (update site http://ubion.ion.ag/update/noa4e ) 12.Most windows were created with a Guibuilder, Windowbuilder/SWT Designer. I did not get http://www.eclipse.org/downloads/packages/eclipse-rcp-and-rap- developers/keplerr, neither by installing it with Help > Install New Software... Select - Work With: Kepler, The WindowBuilder items are under "General Purpose Tools", Select SWT Designer, Install dependencies nor with the update site at http://download.eclipse.org/windowbuilder/WB/release/R201306261200/4.3/. The only solution was to install the all-in-one RCP developer from http://www.eclipse.org/downloads/packages/eclipse-rcp-and-rap-developers/keplerr. 13.Window|Preferences General>Workspace, select “Unix” in “new text file line delimters” and “UTF-8” in text file encoding.

2 / 12 Next steps 1. In Run|Run Configurations, click on “Java application” and click on the “New launch configuration” icon over “type filter text”. Enter GUILayer.MainWindow as main class. 2. If you are working under Linux, right-click the project in the package explorer, click “properties” and select the tab “Libraries” in “Java Build Path”. Edit org.eclipse.swt.win32.win32.x86_3.7.0.v3735b.jar and change it to org.eclipse.swt.gtk.linux.x86_3.7.0.v3735b.jar or org.eclipse.swt.gtk.linux.x86_64_3.7.0.v3735b.jar if you are compiling in a 64 bit JVM. Known problems

Exceptions when starting Gnuaccounting from Eclipse 1. Please confirm you are using a 32bit JVM 2. Please confirm you are trying to start MainWindow 3. Please rename or delete your ~/.gnuaccounting in particular if you started the stable gnuaccounting version in between: the head development version may not always necessarily have a migration path, i.e. it might crash on not being able to migrate existing data

Ant Exceptions 1. If you installed and seleced a Java 1.6 JDK as described in the optional set up section, you may receive a “com/sun/tools/javac/Main : Unsupported major.minor version 51.0” if you additionally have a 1.7 installed. In this case make sure Window|Preferences Ant Runtime in the classpath's Global Entries you have the lib/tools.jar of the JDK 1.6 selected.

Conflicts with previous data/Re-”installing” gnuaccounting If you have run gnuaccounting (development or production version) before and you want to start with a clean installation and all data removed just delete or rename your ~/.gnuaccounting directory, which will be re-created. You can also refer to the user manual and the portable version for instructions how to save in a different directory to e.g. have a production and test system on the same computer.

Videos for Gnuaccounting developers There are four introductory videos 1) How to use Gnuaccounting (general introduction, also for users) http://www.gnuaccounting.org/screencasts/videos/Gnuaccounting-20131223-1.mp4 8,25mb 31:26min 2) Gnuaccounting development for beginners incl. Architecture and so on: http://www.gnuaccounting.org/screencasts/videos/Gnuaccounting-20131223-2.mp4 16MB 28:58 min

3 / 12 3) Intermediate development: Including e.g. how to add attributes also in the database: http://www.gnuaccounting.org/screencasts/videos/Gnuaccounting-20140107.mp4 37,8MB 1:21:01 h Additionally, there is also the video of Jochen's Speech on the Libocon regarding the introduction into NOA-Libre, the library used to embed OpenOffice.org: http://www.gnuaccounting.org/screencasts/videos/LibreOfficeStream_2_27.flv 453 MB 37:49 min

How the source code is organized There are three packages (i.e. directories), appLayer, dataLayer and GUILayer. While appLayer is responsible for the application logic and e.g. the classes representing accounts, customers or products, dataLayer provides everything necessary for persistency and GUILayer implements the windows and optical lay-out of the software.

4 / 12 A appTransaction is a business transaction. Some transactions, e.g. invoices, have a number of items which consist of e.g. quantity and product. One product has always one tax rate (tax rate can be 0 and of course many products can share the same tax). A transaction usually has a recipient (or sender). When a transaction is booked one at least one entry (for the net amount) will be saved, usually additionally one entry per tax rate. An entry refers to a debit account and credit account which belong to a account chart.

How to develop the GUI

A great source for SWT and Jface are the tutorials at the University of Manitoba. In particular after you managed the creation of a SWT application http://www.cs.umanitoba.ca/~eclipse/1-Install.pdf you will soon master basic widgets http://www.cs.umanitoba.ca/~eclipse/2-Basic.pdf , advanced Widgets (these widgets are still „simple“ in terms they do not allow a build-in mapping of objects) http://www.cs.umanitoba.ca/~eclipse/3-Advanced.pdf , the tutorial on the arrangement and resize behaviour of widgets in different layout manager http://www.cs.umanitoba.ca/~eclipse/4-Layouts.pdf and building custom widgets http://www.cs.umanitoba.ca/~eclipse/9-Custom.pdf as well as the very important Jface chapter http://www.cs.umanitoba.ca/~eclipse/11-JFace.pdf. Many Windows within Gnuaccounting were created with Google's (formerly Instantions) now freeware WindowBuilder Pro which is also described in http://www.cs.umanitoba.ca/~eclipse/12- Designer.pdf . The installation of WindowBuilder is also shortly recommended in Gnuaccountings Developer Documentation (see optional step 11 in the development system set up chapter).

Currently, the recommended layout manager is the GridLayout using factories, e.g. to have a three-column layout use GridLayoutFactory.swtDefaults().numColumns(3).margins(10, 5) .applyTo(compConfig); and on each element, operate GridDataFactory.fillDefaults().hint(200, 20).grab(true, false) .applyTo(txtFldOOoPath);

For a 200x20 element. If you don't need the widget to resize with the column use swtDefaults instead of fillDefaults, use .span(2, 1) to span over 2 columns and one row. To have blank cells I used a dummy container.

Superglobals, Important classes The most important static classes are • client • configs and • application

5 / 12 Most of the entities in the class diagram can be obtained via client, i.e. client.getContacts() allows access to suppliers and customers client.getEntries() client.getAccounts()

Code Examples

Helpful commands

Using the database view While there was a GUI for HSQLDB this is no longer possible for Apache Derby. Switch to MySQL as described in the user documentation and use phpMyAdmin to see the contents of the database.

Print the linecount Although cloc (http://cloc.sourceforge.net/) should be recommended in unixoid environments you can use to get a rough overview on the number of lines find . -name *.java -print0 | xargs -0 wc -l

Linux support The application was originally developed for 32 bit Linux. Christian Mandery has written a port to 64 bit Linux. A bug currently prevents Openoffice.org to receive keyboard focus in GTK2 (Gnome) based systems in more than 95% of the cases. Workarounds are described in the user manual.

Mac OS X support Gerd Bartelt has provided an experimental Mac support: Due to the unavailability of the Openoffice Bean for Mac, Openoffice is not embedded but automatically opens a separate window where it is remote controlled. However, printing does not yet work.

Libraries used In libs/ you will find

• barbecue-1.5-beta1.jar : to write barcodes • barcode-zxing-core.jar : Google library to read barcodes • jargs.jar : command line options parsing • mail.jar : apache class to send mail over smtp server with custom certificate manager • PDFRenderer.jar : draw pdfs • uk.co.mmscomputing.device.sane.jar: linux...

6 / 12 • uk.co.mmscomputing.device.twain.jar: and windows part of the scanner access library • hbci/ : hbci4java to access online banking (e.g. chipcard based online banking) • ical/ : to export and import vcard files • noa/ : noa-libre to embed openoffice • persistence/ : JPA, Eclipselink and derby • swt/ : UI libraries, SWT, JFace and some RCP libs

7 / 12 OpenTRANS

Additionally to .pdf, gnuaccounting will attach an according openTRANS e-mail attachment as .xml file when sending mail is enabled as described in the user documentation.

OpenTRANS is documented on http://www.opentrans.org/

Even when no mails are being sent the openTRANS file is saved where also the PDF and ODT files are stored, i.e. in ~/.gnuaccounting/0000/.xml .

The OBDX file for a transaction contains your bank details, the due date, the total amount and the VAT amount.

OpenTRANS files can be imported via Interfaces|Import from OpenTrans. osCommerce OpenTRANS connector osCommerce: This version was tested with osCommerce 2.2 RC2a

INSTALL: copy samples/osCommerce/opentrans.php into the admin folder of your osCommerce installation. For example to: http://www.yourwebshop.com/catalog/admin/

In osCommerce: add a new admin account, or use an existing one. Set the URL of the opentrans.php in Gnuaccounting. e.g.: http://www.yourwebshop.com/catalog/admin/opentrans.php

Set the oscommerce admin username and password in Gnuaccounting as described in the user manual.

POST-PARAMETERS: action Must be set to "getorders" e.g.: action=getorders orderstosync List with orders (orderid) and a new value of the orders status. Possible values are: - 'pending' - 'processing' - 'shipped' The values are separated by a "," and embedded in {} brackets.

8 / 12 e.g.: orderstosync={10=processing,7=shipped}

getshipped Set the time interval, which orders with status 'shipped' should be displayed. Possible values are: - 'day' (all shipped orders in the last days) - 'week' (all shipped orders in the last week) - 'month' (all shipped orders in the last month) - 'year'(all shipped orders in the last year) - 'ever'(all shipped orders)

e.g.: getshipped=3 week

customer_notified Specify, if a customer should be notified via eMail. 0: do not notify the customer 1: send email notification

customer_notified=1 comments Message for customer notification.

e.g.: comments=have fun

Install osCommerce and the connector and access http://127.0.0.1/oscommerce2/catalog/admin/opentrans.php?username =&password=&action=getorders with your browser to obtain a sample. Keep in mind you are viewing XML data and the tags might be invisible in the HTML rendered view so it might be necessary to switch to source view. The file format is basically a openTRANS order with a OPENTRANS root element to allow multiple orders to be parsed.

9 / 12 Tests

Mandatory (Smoke test) 1. Delete ~/.gnuaccounting 2. start ga 3. create a product called test, 100Eur, no VAT 4. create an invoice 1 to sample customer with 123 sample products 5. create an invoice 2 to sample customer with 1 test 6. book invoice 2 via todo window book payment 7. book invoice 1 via interfaces/bank account import (e.g. import from samples/toimport-moneyplex-sample.xml, choose a black payment, select INxxxxx/0 in the dropdown box and drag&drop the entr to standard booking) 8. in bookkeeping, add an entry manually

Optional 1. Check out accounting data from svn 2. Start ga 3. Create an invoice, check if there is any 4. data in accounting 5. check if the wizards create the following entries correctly

Creating invoice Sollbesteuerung 1400 Forderungen(debit) an 8400 Erlöse 100 1400 Forderungen(debit) an 1776 Ust 19 Istbesteuerung 1400 Forderungen(debit) an 8400 Erlöse 100 1400 Forderungen(debit) an 1766 Ust nicht fällig 19

Balancing invoice Sollbesteuerung 1200 bank(debit) an 1400 Forderungen 119 Istbesteuerung 1200 bank(debit) an 1400 Forderungen 119 1766 USt(debit) an 1776 Ust 19

Quick 1200 Bank(debit) an Erlöse 100

10 / 12 1200 Bank(debit) an 1776 USt 19 spending money 3100 (debit) an 1200 Bank 1576 Vorsteuer(debit) an Bank

Extended contact, product, tax, asset, document, account: create, edit, delete one each invoice 1 with 3 items invoice 2 with 2 items created one week ago. Check due date. Invoice 3 receipt 1 receipt 2 (nr correct?) restart book invoice 1 cancel invoice 2 remind invoice 3 create a doc import from webshop manually create entry export spread sheets with limited period change period export spread sheet again create credit note get bank account from HBCI smoke test in english smoke test w/SKR04 smoke test w/tax on payments smoke test in linux smoke test in linux/64 smoke test in xp import bank account, detail booking

One invoice with 1 item to A, one private drawing with 3 items to B

11 / 12 Release checklist

1. add all changes to application history 2. externalize all strings 3. change RELEASE_NOTES 4. update Spec file 5. run ant 6. rename exe/zip to include version number 7. Eclipse refresh project 8. SVN commit 9. SVN tag 10.Upload to sourceforge 11. finish file release on www.sf.net/projects/gnuaccounting 12.announce on sf.net/projects news 13.announce on gnuaccounting.org 14.announce on usegroup.de 15.announce on gnomefiles.org 16.announce on freshmeat.net 17.announce on pro-linux.de 18.announce on heise 19.announce to softpedia, http://www.softpedia.com/get/Others/Finances- Business/GnuAccounting.shtml 20.mail to [email protected] (updates cia.vc) News only 21.mail to [email protected] 22.mail to [email protected] 23.mail to presse@ computerbase.de 24.mail to [email protected] 25.mail to [email protected] 26.cc mail to mid 27.mail to [email protected] 28.mail to [email protected] 29.http://www.pro-linux.de/news/10/1/news-mitteilen.html (link to PR) 30.http://www.pr-inside.com/de/release_new.htm 31.http://www.online-artikel.de/category/it-hardware-software-14-1.html 20-80,40-200 chars, needs 200-400chars summary 32.http://www.inar.de 33.http://www.openpr.com jpg, gif, 1000x1000 34.http://www.openpr.de/news/kategorien2-1-IT-New-Media-Software.html 35.http://www.prcenter.de/pressemitteilungen-it-computer-software.php 36.http://www.news4press.com/News/Rubrik.asp?rubrik=Computer max 50k image 37.http://www.presseanzeiger.de/meldungen/it-computer-internet/ 38.http://www.osnews.com/submit 39.http://www.firmenpresse.de/pressemitteilung-veroeffentlichen.html 40.http://www.fair-news.de 41.http://www.1888PressRelease.com 42.http://www.pr9.net/press/

12 / 12