Timesheets

From Newroco Tech Docs
Jump to navigationJump to search

Prerequisites

Install the following packages

apt-get install apache2 libapache2-mod-php7.0
apt-get install php php-pgsql php-curl php-pear
apt-get install postgresql postgresql-plpython python-psycopg2
apt-get install mailutils
pear install PEAR
pear install MDB2-2.5.0b5
pear install MDB2_Driver_pgsql-1.5.0b4
wget https://github.com/apereo/phpCAS/archive/1.3.6.tar.gz
apt-get install gettext

Change this value in /etc/php/7.0/apache2/php.ini

session.gc_maxlifetime = 48480

If you want French language to work you'll have to install the locales

locale-gen fr_FR
locale-gen fr_FR.UTF-8
update-locale
dpkg-reconfigure locales

Install Timesheets

tar xzvf 1.3.6.tar.gz
mv phpCAS-1.3.6/ /var/www/timesheets/
vi /var/www/timesheets/header.php 

Take a postgresql schema dump from an existing timesheets DB like this

su postgres
pg_dump -s database_name > timesheets-dump.sql
exit

Add or edit the following line:

include_once('phpCAS-1.3.6/CAS.php')

And copy it to the server you want to install timesheets.

In postgresql create the database, the users, and load the dump you took earlier

su postgres
psql
CREATE USER timesheetadministrator WITH PASSWORD 'password';
CREATE USER timesheetwebentry WITH PASSWORD 'password';
CREATE DATABASE timesheetsystem OWNER timesheetadministrator;
GRANT ALL PRIVILEGES ON DATABASE timesheetsystem to timesheetwebentry;
\q
psql -d timesheetsystem < timesheets-dump.sql
exit

Copy the application source to /var/www/html.

Change values in /var/www/html/config.php for passwords, CAS link and email addresses to fit your needs.

if you want to change the logo you can do it in file /var/www/html/timesheets.css around line 17. You can also change the browser tab logo and the footer organization name and link in file /var/www/html/classes/Template.php around lines 128 and 80.

Add users

To add a new user you first have to add it to the backend that CAS is using for authenticating (probably samba/LDAP) and then add it to the database timesheetsystem, table tbl_staff_lookup

su postgres
psql
\connect timesheetsystem
INSERT INTO tbl_staff_lookup(refid, fname, lname, linemanager, username, email, employed, minhours, variable, cost_centre, location) VALUES ('id', 'first-name', 'last-name', manager-id, 'user.name', 'email@example.com', true, 8.0, true, 'IS', 'Iasi');
\q
exit