Timesheets

From Newroco tech docs
Jump to: navigation, search

Prerequisites

Install the following packages

  1. apt-get install apache2 libapache2-mod-php7.0
  2. apt-get install php php-pgsql php-curl php-pear
  3. apt-get install postgresql postgresql-plpython python-psycopg2
  4. apt-get install mailutils
  5. pear install PEAR
  6. pear install MDB2-2.5.0b5
  7. pear install MDB2_Driver_pgsql-1.5.0b4
  8. wget developer.jasig.org/cas-clients/php/current.tgz && pear install current.tgz
  9. apt-get install gettext

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

  1. session.gc_maxlifetime = 48480

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

  1. locale-gen fr_FR
  2. locale-gen fr_FR.UTF-8
  3. update-locale
  4. dpkg-reconfigure locales


Install Timesheets

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

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

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

  1. su postgres
  2. psql
  3. CREATE USER timesheetadministrator WITH PASSWORD 'password';
  4. CREATE USER timesheetwebentry WITH PASSWORD 'password';
  5. CREATE DATABASE timesheetsystem OWNER timesheetadministrator;
  6. GRANT ALL PRIVILEGES ON DATABASE timesheetsystem to timesheetwebentry;
  7. \q
  8. psql -d timesheetsystem < timesheets-dump.sql
  9. 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

  1. su postgres
  2. psql
  3. \connect timesheetsystem
  4. 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');
  5. \q
  6. exit