From 4ed0049b1c1bead979de48dbc117740f5b47d4b9 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Fri, 6 Feb 2015 10:48:36 +0100 Subject: 0.1 Assign float values to nr. of working hours of assignments --- README.md | 14 ++++++++++++ classes/constants.class.php | 3 +++ include/about.php | 2 +- install/index.php | 2 +- install/upgrade.php | 53 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 install/upgrade.php diff --git a/README.md b/README.md index 6ebefa2..b223295 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,14 @@ The files folder will be used to put generated invoices in. Make your server use If you add a file logo-correspondence.png in the files folder, this image will be used as your logo in generated invoices. +# Upgrading + +1. Always make a backup of your current files! +1. First note down your current version number from the About page in BusinessAdmin. +1. Update the directory. +1. Make sure you restore your personal settings in /conf.php and /classes/constants.php, if these files were updated. +1. Go to /install/upgrade.php and fill in your old version number. This will alter database tables, if necessary. + # Usage ## Abstract @@ -118,3 +126,9 @@ When you delete an invoice file, it's not actually deleted. Instead, it's placed * Different languages for different contacts * Add a calendar plugin to the date fields * Appendices feature: upload custom documents and link them to assignments (for functional designs, specifications, etc.) + +# Changelog + +## 0.1 (Feb 6, 2015) + +It's now possible to assign float values to the amount of hours you work on an assignment (as opposed to integer values). \ No newline at end of file diff --git a/classes/constants.class.php b/classes/constants.class.php index 7afcf50..4bb8dbf 100644 --- a/classes/constants.class.php +++ b/classes/constants.class.php @@ -65,4 +65,7 @@ class constants { const invoice_tel_nr = '+31 6 1234 5678'; const invoice_email = 'my-email@domain.tld'; const invoice_valuta = '$'; // chr(128) for euro + + /** @const version Version of BusinessAdmin. Don't change this yourself! */ + const version = '0.1'; } \ No newline at end of file diff --git a/include/about.php b/include/about.php index b94bfce..bc93e14 100644 --- a/include/about.php +++ b/include/about.php @@ -39,7 +39,7 @@ require('./header.php');
BusinessAdmin is open source software under the GPL 3.0 license.
+BusinessAdmin =constants::version?> is open source software under the GPL 3.0 license.
A full version of the license is available here. An excerpt is shown below:
BusinessAdmin: administrative software for small companies Copyright (C) 2015 Camil Staps (ViviSoft) diff --git a/install/index.php b/install/index.php index 3921161..5d6b7fa 100644 --- a/install/index.php +++ b/install/index.php @@ -26,7 +26,7 @@ if (isset($_GET['create_tables'])) { `offerId` smallint(5) unsigned NOT NULL, `title` tinytext NOT NULL, `description` text NOT NULL, - `hours` smallint(5) unsigned NOT NULL, + `hours` float NOT NULL, `price_per_hour` float NOT NULL, `VAT_percentage` float NOT NULL, PRIMARY KEY (`id`), diff --git a/install/upgrade.php b/install/upgrade.php new file mode 100644 index 0000000..dd2f6b9 --- /dev/null +++ b/install/upgrade.php @@ -0,0 +1,53 @@ +. + */ + +require('../conf.php'); + +function lower_version($that, $this) { + $that = explode('.', $that); + $this = explode('.', $this); + while (count($that) < count($this)) $that[] = 0; + while (count($this) < count($that)) $this[] = 0; + + for ($i = 0; $i < count($this); $i++) { + if ($this[$i] > $that[$i]) { + return true; + } + } + return false; +} + +if (isset($_GET['upgrade']) && lower_version($_GET['upgrade'], '0.1')) { + try { + $_pdo->query("ALTER TABLE `assignment` CHANGE `hours` `hours` FLOAT UNSIGNED NOT NULL"); + } catch (PDOException $e) { + echo "Altering the database structure failed with a PDOException ({$e->getCode()}): {$e->getMessage()}\ No newline at end of file -- cgit v1.2.3
" . $e->getTraceAsString(); + } +} + +if (isset($_GET['upgrade'])) { + echo "
All done."; +} +?> + +You're going to upgrade to version =constants::version?>. What was your old version number?
+