]> wagnertech.de Git - timetracker.git/commitdiff
A bit more progress on timesheet coding.
authorNik Okuntseff <support@anuko.com>
Thu, 28 Feb 2019 16:04:17 +0000 (16:04 +0000)
committerNik Okuntseff <support@anuko.com>
Thu, 28 Feb 2019 16:04:17 +0000 (16:04 +0000)
35 files changed:
WEB-INF/lib/ttTimesheetHelper.class.php
WEB-INF/resources/ca.lang.php
WEB-INF/resources/cs.lang.php
WEB-INF/resources/da.lang.php
WEB-INF/resources/de.lang.php
WEB-INF/resources/en.lang.php
WEB-INF/resources/es.lang.php
WEB-INF/resources/et.lang.php
WEB-INF/resources/fa.lang.php
WEB-INF/resources/fi.lang.php
WEB-INF/resources/fr.lang.php
WEB-INF/resources/gr.lang.php
WEB-INF/resources/he.lang.php
WEB-INF/resources/hu.lang.php
WEB-INF/resources/it.lang.php
WEB-INF/resources/ja.lang.php
WEB-INF/resources/ko.lang.php
WEB-INF/resources/nl.lang.php
WEB-INF/resources/no.lang.php
WEB-INF/resources/pl.lang.php
WEB-INF/resources/pt-br.lang.php
WEB-INF/resources/pt.lang.php
WEB-INF/resources/ro.lang.php
WEB-INF/resources/ru.lang.php
WEB-INF/resources/sk.lang.php
WEB-INF/resources/sl.lang.php
WEB-INF/resources/sr.lang.php
WEB-INF/resources/sv.lang.php
WEB-INF/resources/tr.lang.php
WEB-INF/resources/zh-cn.lang.php
WEB-INF/resources/zh-tw.lang.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/timesheet_add.tpl
WEB-INF/templates/timesheets.tpl
timesheet_add.php

index 636504e30b712637b33c2a2ff1a742cc7c7c5e18..e14bbd7bfbf11c358f63a342e134353bf41f2c24 100644 (file)
@@ -408,4 +408,78 @@ class ttTimesheetHelper {
     // TODO: send email to submitter here...
     return true;
   }
     // TODO: send email to submitter here...
     return true;
   }
+
+  // The timesheetItemsExist determines whether tt_log records exist in the specified period
+  // for inclusion in a new timesheet.
+  static function timesheetItemsExist($fields) {
+    global $user;
+    $mdb2 = getConnection();
+
+    $group_id = $user->getGroup();
+    $org_id = $user->org_id;
+
+    $client_id = (int) $fields['client_id'];
+
+    $start_date = new DateAndTime($user->date_format, $fields['start_date']);
+    $start = $start_date->toString(DB_DATEFORMAT);
+
+    $end_date = new DateAndTime($user->date_format, $fields['end_date']);
+    $end = $end_date->toString(DB_DATEFORMAT);
+
+    if (isset($fields['project_id'])) $project_id = (int) $fields['project_id'];
+
+    // Our query is different depending on tracking mode.
+    if (MODE_TIME == $user->getTrackingMode()) {
+      // In "time only" tracking mode there is a single user rate.
+      $sql = "select count(*) as num from tt_log l, tt_users u".
+        " where l.status = 1 and l.client_id = $client_id and l.invoice_id is null".
+        " and l.date >= ".$mdb2->quote($start)." and l.date <= ".$mdb2->quote($end).
+        " and l.user_id = u.id and l.group_id = $group_id and l.org_id = $org_id".
+        " and l.billable = 1"; // l.billable * u.rate * time_to_sec(l.duration)/3600 > 0 // See explanation below.
+    } else {
+      // sql part for project id.
+      if ($project_id) $project_part = " and l.project_id = $project_id";
+
+      // When we have projects, rates are defined for each project in tt_user_project_binds table.
+      $sql = "select count(*) as num from tt_log l, tt_user_project_binds upb".
+        " where l.status = 1 and l.client_id = $client_id $project_part and l.invoice_id is null".
+        " and l.date >= ".$mdb2->quote($start)." and l.date <= ".$mdb2->quote($end).
+        " and l.group_id = $group_id and l.org_id = $org_id".
+        " and upb.user_id = l.user_id and upb.project_id = l.project_id".
+        " and l.billable = 1"; // l.billable * upb.rate * time_to_sec(l.duration)/3600 > 0
+        // Users with a lot of clients and projects (Jaro) may forget to set user rates properly.
+        // Specifically, user rate may be set to 0 on a project, by mistake. This leads to error.no_invoiceable_items
+        // and increased support cost. Commenting out allows us to include 0 cost items in invoices so that
+        // the problem becomes obvious.
+
+        // TODO: If the above turns out useful, rework the query to simplify it by removing left join.
+    }
+    $res = $mdb2->query($sql);
+    if (!is_a($res, 'PEAR_Error')) {
+      $val = $res->fetchRow();
+      if ($val['num']) {
+        return true;
+      }
+    }
+
+    if ($user->isPluginEnabled('ex')) {
+      // sql part for project id.
+      if ($project_id) $project_part = " and ei.project_id = $project_id";
+
+      $sql = "select count(*) as num from tt_expense_items ei".
+        " where ei.client_id = $client_id $project_part and ei.invoice_id is null".
+        " and ei.date >= ".$mdb2->quote($start)." and ei.date <= ".$mdb2->quote($end).
+        " and ei.group_id = $group_id and ei.org_id = $org_id".
+        " and ei.cost <> 0 and ei.status = 1";
+      $res = $mdb2->query($sql);
+      if (!is_a($res, 'PEAR_Error')) {
+        $val = $res->fetchRow();
+        if ($val['num']) {
+          return true;
+        }
+      }
+    }
+
+    return false;
+  }
 }
 }
index d4d24c728bec1718da705278aa01aa1d0da181d0..34ba35f6ec03ecb91c27b5bd6abf3cdb3b515b3a 100644 (file)
@@ -103,6 +103,7 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 // 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'La seva base de dades està buida. Iniciï sessió com a administrador i creï un nou grup.',
 'error.upload' => 'Error pujant l\\\'arxiu.',
 // 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'La seva base de dades està buida. Iniciï sessió com a administrador i creï un nou grup.',
 'error.upload' => 'Error pujant l\\\'arxiu.',
index 2ca15cc9a84cdda455987e3aa409ba12efdd2968..e43d2cc0de6444777a78fc43b7ea68ffa46b4b6c 100644 (file)
@@ -105,6 +105,7 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 // 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'Vaše databáze je prázdná. Přihlašte se jako admin a vytvořte nový tým.', // TODO: replace "team" with "group".
 'error.upload' => 'Chyba přenosu souboru.',
 // 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'Vaše databáze je prázdná. Přihlašte se jako admin a vytvořte nový tým.', // TODO: replace "team" with "group".
 'error.upload' => 'Chyba přenosu souboru.',
index de4813f65f665b0ec85db0bf9ff29d8342a01d71..1247264e78f1a6d06cbd02d646a8427dfb0420bf 100644 (file)
@@ -96,6 +96,8 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Der er ingen fakturerbar emner.',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Der er ingen fakturerbar emner.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Der finde ingen bruger med dette brugernavn.',
 'error.no_groups' => 'Din database er tom, log ind som administrator og lav et nyt team.', // TODO: replace "team" with "group".
 'error.upload' => 'Fil upload problem.',
 'error.no_login' => 'Der finde ingen bruger med dette brugernavn.',
 'error.no_groups' => 'Din database er tom, log ind som administrator og lav et nyt team.', // TODO: replace "team" with "group".
 'error.upload' => 'Fil upload problem.',
index a14e345277a82f4f7eb695c1627519805cb6335b..72f4b5cb181ea375d9a51a4523d88648540d62b4 100644 (file)
@@ -90,6 +90,8 @@ $i18n_key_words = array(
 'error.invoice_exists' => 'Rechnung mit dieser Nummer existiert bereits.',
 'error.role_exists' => 'Rolle mit diesem Rang existiert bereits.',
 'error.no_invoiceable_items' => 'Keine Einträge zur Rechnungsstellung gefunden.',
 'error.invoice_exists' => 'Rechnung mit dieser Nummer existiert bereits.',
 'error.role_exists' => 'Rolle mit diesem Rang existiert bereits.',
 'error.no_invoiceable_items' => 'Keine Einträge zur Rechnungsstellung gefunden.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Benutzer mit diesen Anmeldedaten nicht vorhanden.',
 'error.no_groups' => 'Die Datenbank ist leer. Als Administrator anmelden und ein neues Gruppe erzeugen.',
 'error.upload' => 'Fehler beim hochladen einer Datei.',
 'error.no_login' => 'Benutzer mit diesen Anmeldedaten nicht vorhanden.',
 'error.no_groups' => 'Die Datenbank ist leer. Als Administrator anmelden und ein neues Gruppe erzeugen.',
 'error.upload' => 'Fehler beim hochladen einer Datei.',
index b6f0054b5a93c2200a6dbf8c879e39224ac8ba1c..6701a4c34022b03e606bcc611fc9ff9d7c36ac8b 100644 (file)
@@ -89,6 +89,7 @@ $i18n_key_words = array(
 'error.invoice_exists' => 'Invoice with this number already exists.',
 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 'error.invoice_exists' => 'Invoice with this number already exists.',
 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+'error.no_records' => 'There are no records.',
 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'Your database is empty. Login as admin and create a new group.',
 'error.upload' => 'File upload error.',
 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'Your database is empty. Login as admin and create a new group.',
 'error.upload' => 'File upload error.',
index 99c4431da9e8c7ca7582eab80f81e37ccfa2599e..7a2bf9a903e7d0a81359bd75b7194cac41b15078 100644 (file)
@@ -101,6 +101,7 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 // 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'Su base de datos esta vacía. Inicie sesión como administrador y cree un nuevo grupo.',
 'error.upload' => 'Error subiendo el archivo.',
 // 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'Su base de datos esta vacía. Inicie sesión como administrador y cree un nuevo grupo.',
 'error.upload' => 'Error subiendo el archivo.',
index 4f40c7e77b11fc5fc9f1d0711242c0ff25b4faab..6f37883eef4124379195742d37677e14adbd000d 100644 (file)
@@ -103,6 +103,8 @@ $i18n_key_words = array(
 // Google auto-translates below as "No billable invoices found." which seems wrong.
 // 'error.no_invoiceable_items' => 'Arveldatavaid arveid ei leitud.',
 
 // Google auto-translates below as "No billable invoices found." which seems wrong.
 // 'error.no_invoiceable_items' => 'Arveldatavaid arveid ei leitud.',
 
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Sellise tunnusega kasutajat ei ole.',
 
 // TODO: Improve translation of error.no_groups. Replace meeskond with grupp?
 'error.no_login' => 'Sellise tunnusega kasutajat ei ole.',
 
 // TODO: Improve translation of error.no_groups. Replace meeskond with grupp?
index 566b50811c5f993a7d147eeb494844c8fda621d6..5a6c6aa8cc0fa452c3a04c5d762d2c3f53ee1745 100644 (file)
@@ -101,6 +101,8 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'آیتمی جهت فاکتور کردن وجود ندارد.',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'آیتمی جهت فاکتور کردن وجود ندارد.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'کاربری با این نام کاربری موجود نیست.',
 'error.no_groups' => 'پایگاه داده شما خالی است با کاربر admin وارد شوید و تیم ایجاد کنید.',  // TODO: replace "team" with "group".
 'error.upload' => 'خطا در آپلود فایل.',
 'error.no_login' => 'کاربری با این نام کاربری موجود نیست.',
 'error.no_groups' => 'پایگاه داده شما خالی است با کاربر admin وارد شوید و تیم ایجاد کنید.',  // TODO: replace "team" with "group".
 'error.upload' => 'خطا در آپلود فایل.',
index 226e8496d4ab1f8ab0ad5ac9cf3d6fadafbfce7a..9f577f3dc7f357dc01a1ede6fbf4b46d6c51fac9 100644 (file)
@@ -98,6 +98,8 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Ei laskutettavia syötteitä.',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Ei laskutettavia syötteitä.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Tuntematon käyttäjänimi.',
 'error.no_groups' => 'Tietokanta on tyhjä. Kirjaudu ylläpitäjänä ja luo uusi tiimi.',  // TODO: replace "team" with "group".
 'error.upload' => 'Virhe tiedoston lataus.',
 'error.no_login' => 'Tuntematon käyttäjänimi.',
 'error.no_groups' => 'Tietokanta on tyhjä. Kirjaudu ylläpitäjänä ja luo uusi tiimi.',  // TODO: replace "team" with "group".
 'error.upload' => 'Virhe tiedoston lataus.',
index a90cc042b29de32b281cf5135526ef655fc9dd34..be5c9d22bf52a6028de5a5486ada9bad2448e54b 100644 (file)
@@ -96,6 +96,8 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Il n\\\'y a pas d\\\'éléments à facturer.',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Il n\\\'y a pas d\\\'éléments à facturer.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Aucun utilisateur avec cet identifiant.',
 'error.no_groups' => 'Votre base de données est vide. Connectez-vous comme administrateur et créez une nouvelle équipe.',  // TODO: replace "team" with "group".
 'error.upload' => 'Erreur de chargement du fichier.',
 'error.no_login' => 'Aucun utilisateur avec cet identifiant.',
 'error.no_groups' => 'Votre base de données est vide. Connectez-vous comme administrateur et créez une nouvelle équipe.',  // TODO: replace "team" with "group".
 'error.upload' => 'Erreur de chargement du fichier.',
index 7257a33f9b3ac87564734da5c2b7e3d582df754c..288982735f84fedc3c66e909813181e09ce0abcf 100644 (file)
@@ -91,6 +91,8 @@ $i18n_key_words = array(
 'error.invoice_exists' => 'Το τιμολόγιο με αυτόν τον αριθμό υπάρχει ήδη.',
 'error.role_exists' => 'Ο ρόλος σε αυτή τη σειρά υπάρχει ήδη.',
 'error.no_invoiceable_items' => 'Δεν υπάρχουν στοιχεία προς τιμολόγηση.',
 'error.invoice_exists' => 'Το τιμολόγιο με αυτόν τον αριθμό υπάρχει ήδη.',
 'error.role_exists' => 'Ο ρόλος σε αυτή τη σειρά υπάρχει ήδη.',
 'error.no_invoiceable_items' => 'Δεν υπάρχουν στοιχεία προς τιμολόγηση.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Δεν υπάρχει χρήστης με αυτά τα στοιχεία.',
 'error.no_groups' => 'Η βάση δεδομένων σας είναι κενή. Συνδεθείτε ως διαχειριστής και δημιουργήστε μια νέα ομάδα.',
 'error.upload' => 'Σφάλμα φόρτωσης αρχείου.',
 'error.no_login' => 'Δεν υπάρχει χρήστης με αυτά τα στοιχεία.',
 'error.no_groups' => 'Η βάση δεδομένων σας είναι κενή. Συνδεθείτε ως διαχειριστής και δημιουργήστε μια νέα ομάδα.',
 'error.upload' => 'Σφάλμα φόρτωσης αρχείου.',
index 47c06c8599be4b614e2290e4a8de369384db0801..d9ab0d1c61445895628eae2583c58faadbe576bf 100644 (file)
@@ -112,6 +112,8 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'אין פריטים לחיוב',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'אין פריטים לחיוב',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'משתמש זה אינו קיים',
 'error.no_groups' => 'בסיס הנתונים שלך ריק. התחבר כמנהל וצור צוות חדש', // TODO: replace "team" with "group".
 'error.upload' => 'שגיאה בהעלת קובץ',
 'error.no_login' => 'משתמש זה אינו קיים',
 'error.no_groups' => 'בסיס הנתונים שלך ריק. התחבר כמנהל וצור צוות חדש', // TODO: replace "team" with "group".
 'error.upload' => 'שגיאה בהעלת קובץ',
index bd699aca0addc4cfc4369a9f5a4099c5486c8d82..38ec28cb7fb4f7403e3843baf57e5df211e58084 100644 (file)
@@ -103,6 +103,8 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 // 'error.no_login' => 'No user with this login.',
 // 'error.no_groups' => 'Your database is empty. Login as admin and create a new group.',
 'error.upload' => 'File feltöltési hiba.',
 // 'error.no_login' => 'No user with this login.',
 // 'error.no_groups' => 'Your database is empty. Login as admin and create a new group.',
 'error.upload' => 'File feltöltési hiba.',
index 351c1cd66e3ff2b5551fc49fb9da857c21b4c121..e4d328e6121b82f0bdf0ca58429f932dcb9e9929 100644 (file)
@@ -95,6 +95,8 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Non ci sono voci fatturabili.',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Non ci sono voci fatturabili.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Non esiste un utente con questo username.',
 'error.no_groups' => 'Il database è vuoto. Loggati come amministratore e crea un nuovo gruppo.',
 'error.upload' => 'Errore di caricamento file.',
 'error.no_login' => 'Non esiste un utente con questo username.',
 'error.no_groups' => 'Il database è vuoto. Loggati come amministratore e crea un nuovo gruppo.',
 'error.upload' => 'Errore di caricamento file.',
index 53f1c5066830f51a271584d2057b7b2b3eda8001..3f0db6e0e0134099a5b4c1296dcc91d1b6e423eb 100644 (file)
@@ -104,6 +104,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'このログインと関連されたユーザーはいません。',
 'error.no_groups' => 'あなたのデータベースは空いています。管理者にログインして新規チームを作成してください。', // TODO: replace "team" with "group".
 'error.upload' => 'ファイルのアップロードのエラー。',
 'error.no_login' => 'このログインと関連されたユーザーはいません。',
 'error.no_groups' => 'あなたのデータベースは空いています。管理者にログインして新規チームを作成してください。', // TODO: replace "team" with "group".
 'error.upload' => 'ファイルのアップロードのエラー。',
index d8da0d813da85f8895e69741d8a0aba8b3968e58..d59c1634795c72ab5a1a947ccd835a1ff8c7a301 100644 (file)
@@ -103,6 +103,7 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => '본 로그인과 연계된 사용자가 없습니다.',
 'error.no_groups' => '당신의 데이터베이스는 비어있습니다. 관리자로 로그인하여 새로운 팀을 생성하십시오.', // TODO: replace "team" with "group".
 'error.upload' => '파일 업로드 오류.',
 'error.no_login' => '본 로그인과 연계된 사용자가 없습니다.',
 'error.no_groups' => '당신의 데이터베이스는 비어있습니다. 관리자로 로그인하여 새로운 팀을 생성하십시오.', // TODO: replace "team" with "group".
 'error.upload' => '파일 업로드 오류.',
index 848e0f3499ed80757ad53359efe77299d1cb3610..8aa557e671d98032d126f2ff64a594948f80ca90 100644 (file)
@@ -89,6 +89,8 @@ $i18n_key_words = array(
 'error.invoice_exists' => 'Dit nummer is al eens toegekend aan een factuur.',
 'error.role_exists' => 'Een rol met deze rangorde bestaat al.',
 'error.no_invoiceable_items' => 'Er zijn geen factuureerbare onderdelen.',
 'error.invoice_exists' => 'Dit nummer is al eens toegekend aan een factuur.',
 'error.role_exists' => 'Een rol met deze rangorde bestaat al.',
 'error.no_invoiceable_items' => 'Er zijn geen factuureerbare onderdelen.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Een medewerker met deze inlognaam bestaat niet.',
 'error.no_groups' => 'Uw database is leeg. Meld je aan als admin en maak een nieuw groep.',
 'error.upload' => 'Fout bij het uploaden van het bestand.',
 'error.no_login' => 'Een medewerker met deze inlognaam bestaat niet.',
 'error.no_groups' => 'Uw database is leeg. Meld je aan als admin en maak een nieuw groep.',
 'error.upload' => 'Fout bij het uploaden van het bestand.',
index 1474cac3128c957a77fb11e936d33fcf8c5c6180..cdcc05de191ff9977c5846dfa5cb89496c023939 100644 (file)
@@ -104,6 +104,7 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Det er ingen bruker med dette brukernavnet.',
 'error.no_groups' => 'Databasen din er tom. Logg inn som admin og opprett et nytt team.', // TODO: replace "team" with "group".
 'error.upload' => 'Feil med lasting av fil.',
 'error.no_login' => 'Det er ingen bruker med dette brukernavnet.',
 'error.no_groups' => 'Databasen din er tom. Logg inn som admin og opprett et nytt team.', // TODO: replace "team" with "group".
 'error.upload' => 'Feil med lasting av fil.',
index 94a094e8f22ebe5eef322098b59035aaa12f5725..11166236b4fde15407b0169ce22beae69a93d8e7 100644 (file)
@@ -99,6 +99,8 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Brak przedmiotów do faktury.',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Brak przedmiotów do faktury.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Użytkownik o takiej nazwie nie istnieje.',
 'error.no_groups' => 'Twoja baza danych jest pusta. Zaloguj się jako administrator i stwórz nowy zespół.', // TODO: replace "team" with "group".
 'error.upload' => 'Błąd podczas wysyłania pliku.',
 'error.no_login' => 'Użytkownik o takiej nazwie nie istnieje.',
 'error.no_groups' => 'Twoja baza danych jest pusta. Zaloguj się jako administrator i stwórz nowy zespół.', // TODO: replace "team" with "group".
 'error.upload' => 'Błąd podczas wysyłania pliku.',
index a10fe4c633c9f4493c1664de7db3c045439ac90c..bfeb7e72097b20c89fe9c858e44606569a12c3d7 100644 (file)
@@ -97,6 +97,8 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Não há items faturáveis.',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Não há items faturáveis.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Não há usuário com este login.',
 'error.no_groups' => 'Sua base de dados está vazia. Entre como admin e crie uma equipe nova.', // TODO: replace "team" with "group".
 'error.upload' => 'Erro no envio do arquivo.',
 'error.no_login' => 'Não há usuário com este login.',
 'error.no_groups' => 'Sua base de dados está vazia. Entre como admin e crie uma equipe nova.', // TODO: replace "team" with "group".
 'error.upload' => 'Erro no envio do arquivo.',
index 9da1e3588207a6fcb3bfb55b4b25ac43fc1cf726..b9b746c9d5c9f2760bcf5a07b3a232e187731563 100644 (file)
@@ -101,6 +101,7 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 // 'error.no_login' => 'No user with this login.',
 // 'error.no_groups' => 'Your database is empty. Login as admin and create a new group.',
 // 'error.upload' => 'File upload error.',
 // 'error.no_login' => 'No user with this login.',
 // 'error.no_groups' => 'Your database is empty. Login as admin and create a new group.',
 // 'error.upload' => 'File upload error.',
index 70fc0ac19f38d4acaeb647ced7ff06cddb3f0c79..050bddef1f564053e60a1c02e156e202de81f94f 100644 (file)
@@ -107,6 +107,7 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 // 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'Baza de date este goala. Intra ca admin si adauga o noua echipa.', // TODO: replace "team" with "group".
 'error.upload' => 'Eroare la upload-ul fisierului.',
 // 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'Baza de date este goala. Intra ca admin si adauga o noua echipa.', // TODO: replace "team" with "group".
 'error.upload' => 'Eroare la upload-ul fisierului.',
index 6c1daa2460ac533ab32ba18f8dc845cf1aa14767..2d04e8f933960de30b587aad1e22d4d2d7dc6a7f 100644 (file)
@@ -88,6 +88,7 @@ $i18n_key_words = array(
 'error.invoice_exists' => 'Счёт с таким номером уже есть.',
 'error.role_exists' => 'Роль с таким рангом уже есть.',
 'error.no_invoiceable_items' => 'Нет записей для включения в счёт.',
 'error.invoice_exists' => 'Счёт с таким номером уже есть.',
 'error.role_exists' => 'Роль с таким рангом уже есть.',
 'error.no_invoiceable_items' => 'Нет записей для включения в счёт.',
+'error.no_records' => 'Нет записей.',
 'error.no_login' => 'Нет пользователя с таким логином.',
 'error.no_groups' => 'Ваша база данных пуста. Войдите в систему как администратор и создайте новую группу.',
 'error.upload' => 'Ошибка загрузки файла.',
 'error.no_login' => 'Нет пользователя с таким логином.',
 'error.no_groups' => 'Ваша база данных пуста. Войдите в систему как администратор и создайте новую группу.',
 'error.upload' => 'Ошибка загрузки файла.',
index a1253d9b3c90fe612f18436896b33d2d904a68dd..0ed07029378773ac346bc6dfd8f82265ea5637f3 100644 (file)
@@ -101,6 +101,8 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Neexistujú položky, ktoré by bolo možné fakturovať.',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Neexistujú položky, ktoré by bolo možné fakturovať.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Neexistuje používateľ s týmto prihlasovacím menom.',
 'error.no_groups' => 'Vaša databáza je prázdna. Prihláste sa ako admin a vytvorte nový tím.', // TODO: replace "team" with "group".
 'error.upload' => 'Prenos súboru bol neúspešný.',
 'error.no_login' => 'Neexistuje používateľ s týmto prihlasovacím menom.',
 'error.no_groups' => 'Vaša databáza je prázdna. Prihláste sa ako admin a vytvorte nový tím.', // TODO: replace "team" with "group".
 'error.upload' => 'Prenos súboru bol neúspešný.',
index 68e2df6a8cd275501fe2d1e8206ad534f5f004ef..e938845052763193b3d1faade73d4fe23c9033c7 100644 (file)
@@ -98,6 +98,7 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 // 'error.no_login' => 'No user with this login.',
 // 'error.no_groups' => 'Your database is empty. Login as admin and create a new group.',
 // 'error.upload' => 'File upload error.',
 // 'error.no_login' => 'No user with this login.',
 // 'error.no_groups' => 'Your database is empty. Login as admin and create a new group.',
 // 'error.upload' => 'File upload error.',
index 8976bda590d9e59e23e993d02b37b2cafd32b64b..5d2b9f88afa70a93b38274fe0ca04a65768e686d 100644 (file)
@@ -96,6 +96,8 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Nema stavke za naplatu.',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Nema stavke za naplatu.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Nema korisnika pod ovom prijavom',
 'error.no_groups' => 'Vaša baza podataka je prazna. Prijavite se kao administrator i napravite novi tim.', // TODO: replace "team" with "group".
 'error.upload' => 'Greška pri otpremanju podatka.',
 'error.no_login' => 'Nema korisnika pod ovom prijavom',
 'error.no_groups' => 'Vaša baza podataka je prazna. Prijavite se kao administrator i napravite novi tim.', // TODO: replace "team" with "group".
 'error.upload' => 'Greška pri otpremanju podatka.',
index 715481d3a9f2a40ae603c410bce4cbb84fd736bd..ba2f6665fd379f7065bb8c15c482b4b847142b07 100644 (file)
@@ -95,6 +95,8 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Det finns inga debiterbara tidsregistreringar.',
 // TODO: translate the following.
 // 'error.role_exists' => 'Role with this rank already exists.',
 'error.no_invoiceable_items' => 'Det finns inga debiterbara tidsregistreringar.',
+// TODO: translate the following.
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => 'Det finns ingen användare med det här användarnamnet.',
 'error.no_groups' => 'Databasen är tom. Logga in som administratör och skapa en ny grupp.',
 'error.upload' => 'Ett fel uppstod när filen laddades upp.',
 'error.no_login' => 'Det finns ingen användare med det här användarnamnet.',
 'error.no_groups' => 'Databasen är tom. Logga in som administratör och skapa en ny grupp.',
 'error.upload' => 'Ett fel uppstod när filen laddades upp.',
index eb92614a9e4daa75ee567476b8504e5d2767fcc0..22e8723742c8a4506ea09fad92aaf261298b7779 100644 (file)
@@ -110,6 +110,7 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 // 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'Veritabanınız boş. Yeni bir ekip yaratmak için yönetici olarak giriş yapın.', // TODO: replace "team" with "group".
 'error.upload' => 'Dosya yükleme hatası.',
 // 'error.no_login' => 'No user with this login.',
 'error.no_groups' => 'Veritabanınız boş. Yeni bir ekip yaratmak için yönetici olarak giriş yapın.', // TODO: replace "team" with "group".
 'error.upload' => 'Dosya yükleme hatası.',
index d31db325969e224db8ec71cfa2b6b70b007e7b2c..a1583eb4a078decab970d1b268ed6cb94040dde5 100644 (file)
@@ -97,6 +97,7 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => '没有该登录信息的用户。',
 'error.no_groups' => '您的数据库没有任何记录。请以管理员身份登录并创建一个新团队。', // TODO: replace "team" with "group".
 'error.upload' => '上传文件出错。',
 'error.no_login' => '没有该登录信息的用户。',
 'error.no_groups' => '您的数据库没有任何记录。请以管理员身份登录并创建一个新团队。', // TODO: replace "team" with "group".
 'error.upload' => '上传文件出错。',
index ca0dad53a176812967fafbe5a759e8ca25530f38..42f15202983291f4193c633fdcaba972215aca6d 100644 (file)
@@ -101,6 +101,7 @@ $i18n_key_words = array(
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
 // 'error.invoice_exists' => 'Invoice with this number already exists.',
 // 'error.role_exists' => 'Role with this rank already exists.',
 // 'error.no_invoiceable_items' => 'There are no invoiceable items.',
+// 'error.no_records' => 'There are no records.',
 'error.no_login' => '沒有該登錄資訊的使用者。',
 'error.no_groups' => '您的資料庫沒有任何記錄。請以管理員身份登錄並創建一個新團隊。', // TODO: replace "team" with "group".
 'error.upload' => '上傳文件出錯。',
 'error.no_login' => '沒有該登錄資訊的使用者。',
 'error.no_groups' => '您的資料庫沒有任何記錄。請以管理員身份登錄並創建一個新團隊。', // TODO: replace "team" with "group".
 'error.upload' => '上傳文件出錯。',
index 5b3b25e2004939bfcc1ed5c86c37c071656908d1..a3dbfb19277a8f1d5377825af4300589d226a4bb 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.46.4791 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.46.4792 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index e24a36b365fe9763e4d2378d6f66be793b5e21f7..f4becf7f580a3f806caa16584f79073f36924e34 100644 (file)
@@ -7,6 +7,18 @@
           <td align="right">{$i18n.label.thing_name} (*):</td>
           <td>{$forms.timesheetForm.timesheet_name.control}</td>
         </tr>
           <td align="right">{$i18n.label.thing_name} (*):</td>
           <td>{$forms.timesheetForm.timesheet_name.control}</td>
         </tr>
+{if $show_client}
+        <tr>
+          <td align="right">{$i18n.label.client}:</td>
+          <td>{$forms.timesheetForm.client.control}</td>
+        </tr>
+{/if}
+{if $show_project}
+        <tr>
+          <td align="right">{$i18n.label.project}:</td>
+          <td>{$forms.timesheetForm.project.control}</td>
+        </tr>
+{/if}
         <tr>
           <td align="right">{$i18n.label.start_date} (*):</td>
           <td>{$forms.timesheetForm.start.control}</td>
         <tr>
           <td align="right">{$i18n.label.start_date} (*):</td>
           <td>{$forms.timesheetForm.start.control}</td>
@@ -17,7 +29,7 @@
         </tr>
         <tr>
           <td align = "right">{$i18n.label.comment}:</td>
         </tr>
         <tr>
           <td align = "right">{$i18n.label.comment}:</td>
-          <td>{$forms.timesheetForm.submitter_comment.control}</td>
+          <td>{$forms.timesheetForm.comment.control}</td>
         </tr>
         <tr>
           <td></td>
         </tr>
         <tr>
           <td></td>
index af65d14b5772263aa93ba3abaddbfc98095d8673..df4782b64954ad735b4886c821eae52036664d39 100644 (file)
 {if $show_client}
           <td class="tableHeader">{$i18n.label.client}</td>
 {/if}
 {if $show_client}
           <td class="tableHeader">{$i18n.label.client}</td>
 {/if}
-{if $not_client}
           <td class="tableHeader">{$i18n.label.submitted}</td>
           <td class="tableHeader">{$i18n.label.approved}</td>
           <td class="tableHeader">{$i18n.label.submitted}</td>
           <td class="tableHeader">{$i18n.label.approved}</td>
-{/if}
           <td class="tableHeader">{$i18n.label.view}</td>
 {if $can_edit}
           <td class="tableHeader">{$i18n.label.edit}</td>
           <td class="tableHeader">{$i18n.label.view}</td>
 {if $can_edit}
           <td class="tableHeader">{$i18n.label.edit}</td>
   {if $show_client}
           <td>{$timesheet.client_name|escape}</td>
   {/if}
   {if $show_client}
           <td>{$timesheet.client_name|escape}</td>
   {/if}
-  {if $not_client}
           <td>{if $timesheet.submit_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>
           <td>{if $timesheet.submit_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>
-     {if $timesheet.approval_status == null}
+  {if $timesheet.approval_status == null}
           <td></td>
           <td></td>
-     {else}
+  {else}
           <td>{if $timesheet.approval_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>
           <td>{if $timesheet.approval_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>
-     {/if}
   {/if}
           <td><a href="timesheet_view.php?id={$timesheet.id}">{$i18n.label.view}</a></td>
   {if $can_edit}
   {/if}
           <td><a href="timesheet_view.php?id={$timesheet.id}">{$i18n.label.view}</a></td>
   {if $can_edit}
         </tr>
 {/foreach}
       </table>
         </tr>
 {/foreach}
       </table>
-{if $not_client}
+
       <table width="100%">
       <table width="100%">
-        <tr><td align="center"><br><form><input type="button" onclick="chLocation('reports.php');" value="{$i18n.button.add}"></form></td></tr>
+        <tr><td align="center"><br><form><input type="button" onclick="chLocation('timesheet_add.php');" value="{$i18n.button.add}"></form></td></tr>
       </table>
       </table>
-{/if}
 
 {if $inactive_timesheets}
       <table cellspacing="1" cellpadding="3" border="0" width="100%">
 
 {if $inactive_timesheets}
       <table cellspacing="1" cellpadding="3" border="0" width="100%">
   {if $show_client}
           <td class="tableHeader">{$i18n.label.client}</td>
   {/if}
   {if $show_client}
           <td class="tableHeader">{$i18n.label.client}</td>
   {/if}
-  {if $not_client}
           <td class="tableHeader">{$i18n.label.submitted}</td>
           <td class="tableHeader">{$i18n.label.approved}</td>
           <td class="tableHeader">{$i18n.label.submitted}</td>
           <td class="tableHeader">{$i18n.label.approved}</td>
-  {/if}
           <td class="tableHeader">{$i18n.label.view}</td>
   {if $can_edit}
           <td class="tableHeader">{$i18n.label.edit}</td>
           <td class="tableHeader">{$i18n.label.view}</td>
   {if $can_edit}
           <td class="tableHeader">{$i18n.label.edit}</td>
     {if $show_client}
           <td>{$timesheet.client_name|escape}</td>
     {/if}
     {if $show_client}
           <td>{$timesheet.client_name|escape}</td>
     {/if}
-    {if $not_client}
           <td>{if $timesheet.submit_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>
           <td>{if $timesheet.submit_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>
-      {if $timesheet.approval_status == null}
+    {if $timesheet.approval_status == null}
           <td></td>
           <td></td>
-      {else}
+    {else}
           <td>{if $timesheet.approval_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>
           <td>{if $timesheet.approval_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>
-      {/if}
     {/if}
           <td><a href="timesheet_view.php?id={$timesheet.id}">{$i18n.label.view}</a></td>
     {if $can_edit}
     {/if}
           <td><a href="timesheet_view.php?id={$timesheet.id}">{$i18n.label.view}</a></td>
     {if $can_edit}
         </tr>
   {/foreach}
       </table>
         </tr>
   {/foreach}
       </table>
-  {if $not_client}
+
       <table width="100%">
         <tr><td align="center"><br><form><input type="button" onclick="chLocation('reports.php');" value="{$i18n.button.add}"></form></td></tr>
       </table>
       <table width="100%">
         <tr><td align="center"><br><form><input type="button" onclick="chLocation('reports.php');" value="{$i18n.button.add}"></form></td></tr>
       </table>
-  {/if}
 {/if}
     </td>
   </tr>
 {/if}
     </td>
   </tr>
index 1ab4b704c990be6a5fd7c5a96db66de7329c0a49..e8eb5659109efe7599932c1de3e1165a4a728c9f 100644 (file)
@@ -43,31 +43,56 @@ if (!$user->isPluginEnabled('ts')) {
 
 if ($request->isPost()) {
   $cl_name = trim($request->getParameter('timesheet_name'));
 
 if ($request->isPost()) {
   $cl_name = trim($request->getParameter('timesheet_name'));
-  $cl_comment = trim($request->getParameter('submitter_comment'));
-
-  // Report settings are stored in session bean before we get here.
-  $bean = new ActionForm('reportBean', new Form('reportForm'), $request);
-  $bean->loadBean();
+  $cl_client = $request->getParameter('client');
+  $cl_project = $request->getParameter('project');
+  $cl_start = $request->getParameter('start');
+  $cl_finish = $request->getParameter('finish');
+  $cl_comment = trim($request->getParameter('comment'));
 }
 
 }
 
+$user_id = $user->getUser();
+
 $form = new Form('timesheetForm');
 $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'timesheet_name','style'=>'width: 250px;','value'=>$cl_name));
 
 $form = new Form('timesheetForm');
 $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'timesheet_name','style'=>'width: 250px;','value'=>$cl_name));
 
+// Dropdown for clients if the clients plugin is enabled.
+$showClient = $user->isPluginEnabled('cl');
+if ($showClient) {
+  $clients = ttGroupHelper::getActiveClients();
+  $form->addInput(array('type'=>'combobox','name'=>'client','style'=>'width: 250px;','data'=>$clients,'datakeys'=>array('id','name'),'value'=>$cl_client,'empty'=>array(''=>$i18n->get('dropdown.select'))));
+}
+// Dropdown for projects.
+$showProject = MODE_PROJECTS == $user->getTrackingMode() || MODE_PROJECTS_AND_TASKS == $user->getTrackingMode();
+if ($showProject) {
+  $projects = $user->getAssignedProjects();
+  $form->addInput(array('type'=>'combobox','name'=>'project','style'=>'width: 250px;','data'=>$projects,'datakeys'=>array('id','name'),'value'=>$cl_project,'empty'=>array(''=>$i18n->get('dropdown.all'))));
+}
 $form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'start','value'=>$cl_start));
 $form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'finish','value'=>$cl_finish));
 $form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'start','value'=>$cl_start));
 $form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'finish','value'=>$cl_finish));
-
-$form->addInput(array('type'=>'textarea','name'=>'submitter_comment','style'=>'width: 250px; height: 40px;','value'=>$cl_comment));
+$form->addInput(array('type'=>'textarea','name'=>'comment','style'=>'width: 250px; height: 40px;','value'=>$cl_comment));
 $form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->get('button.add')));
 
 if ($request->isPost()) {
   // Validate user input.
   if (!ttValidString($cl_name)) $err->add($i18n->get('error.field'), $i18n->get('label.thing_name'));
 $form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->get('button.add')));
 
 if ($request->isPost()) {
   // Validate user input.
   if (!ttValidString($cl_name)) $err->add($i18n->get('error.field'), $i18n->get('label.thing_name'));
+  if (!ttValidDate($cl_start)) $err->add($i18n->get('error.field'), $i18n->get('label.start_date'));
+  if (!ttValidDate($cl_finish)) $err->add($i18n->get('error.field'), $i18n->get('label.end_date'));
   if (!ttValidString($cl_comment, true)) $err->add($i18n->get('error.field'), $i18n->get('label.comment'));
   if (!ttValidString($cl_comment, true)) $err->add($i18n->get('error.field'), $i18n->get('label.comment'));
+  if ($err->no() && ttTimesheetHelper::getTimesheetByName($cl_name, $user_id)) $err->add($i18n->get('error.object_exists'));
+  $fields = array('user_id' => $user_id,
+    'name' => $cl_name,
+    'client_id' => $cl_client,
+    'project_id' => $cl_project,
+    'start_date' => $cl_start,
+    'end_date' => $cl_finish,
+    'comment' => $cl_comment);
+  if ($err->no() && !ttTimesheetHelper::timesheetItemsExist($fields)) $err->add($i18n->get('error.no_records'));
+  // Finished validating user input.
 
 
+  /*
   if ($err->no()) {
   if ($err->no()) {
-    $user_id = $bean->getDetachedAttribute('timesheet_user_id');
-    if (!ttTimesheetHelper::getTimesheetByName($cl_name, $user_id)) {
-      if (ttTimesheetHelper::insert(array('user_id' => $user_id,
+    // TODO: use $fields.
+    if (ttTimesheetHelper::insert(array('user_id' => $user_id,
         'client_id' => $bean->getAttribute('client'),
         'name' => $cl_name,
         'comment' => $cl_comment))) {
         'client_id' => $bean->getAttribute('client'),
         'name' => $cl_name,
         'comment' => $cl_comment))) {
@@ -75,13 +100,13 @@ if ($request->isPost()) {
           exit();
         } else
           $err->add($i18n->get('error.db'));
           exit();
         } else
           $err->add($i18n->get('error.db'));
-    } else
-      $err->add($i18n->get('error.object_exists'));
-  }
+    } */
 } // isPost
 
 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
 $smarty->assign('onload', 'onLoad="document.timesheetForm.timesheet_name.focus()"');
 } // isPost
 
 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
 $smarty->assign('onload', 'onLoad="document.timesheetForm.timesheet_name.focus()"');
+$smarty->assign('show_client', $showClient);
+$smarty->assign('show_project', $showProject);
 $smarty->assign('title', $i18n->get('title.add_timesheet'));
 $smarty->assign('content_page_name', 'timesheet_add.tpl');
 $smarty->display('index.tpl');
 $smarty->assign('title', $i18n->get('title.add_timesheet'));
 $smarty->assign('content_page_name', 'timesheet_add.tpl');
 $smarty->display('index.tpl');