]> wagnertech.de Git - timetracker.git/commitdiff
Introduced handling of max user count.
authorNik Okuntseff <support@anuko.com>
Mon, 24 Dec 2018 15:01:49 +0000 (15:01 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 24 Dec 2018 15:01:49 +0000 (15:01 +0000)
34 files changed:
WEB-INF/lib/ttUserHelper.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
mobile/user_add.php
user_add.php

index 26ced938acf251afc89741aa16687cf9a94f4adf..b3a5e36037b0b615ff1e747310a8636cdd503990 100644 (file)
@@ -386,4 +386,22 @@ class ttUserHelper {
     $sql = "update tt_users set accessed = now(), accessed_ip = $accessed_ip where id = $user->id";
     $mdb2->exec($sql);
   }
+
+  // canAdd determines if we can add a user in case there is a limit.
+  static function canAdd() {
+    $mdb2 = getConnection();
+    $sql = "select param_value from tt_site_config where param_name = 'max_users'";
+    $res = $mdb2->query($sql);
+    $val = $res->fetchRow();
+    if (!$val) return true; // No limit.
+
+    $max_count = $val['param_value'];
+    $sql = "select count(*) as user_count from tt_users where status is not null";
+    $res = $mdb2->query($sql);
+    $val = $res->fetchRow();
+    if ($val['user_count'] < $max_count)
+      return true; // Limit not reached.
+
+    return false;
+  }
 }
index b4d86993008de69395f5c2127360aa8f6cd91d42..f38bcabd2c3555b46752b9fddc1f2a5b7d8d513b 100644 (file)
@@ -116,6 +116,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index d12be155e729c2e2fcde19ed5a42563d6a75f6d2..baf085b51605169a738f7d0bbb72b782e2619541 100644 (file)
@@ -118,6 +118,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index c4974513053b5054c3b39599ff7f04958020b2ac..051b6f8c2fdcb2a39a1fbb6b443a24237d5fafd7 100644 (file)
@@ -110,6 +110,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index eab807e85a99bae8924b203952d7f1f8c3407df4..6c75c7e31a1550c65b37c05645189eaa66ddbc78 100644 (file)
@@ -104,6 +104,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index aadf6f5ac0271ed4ba6b911625a43fc4649828d9..687f19daf35e2060c7684a255387ecb03d4b5d46 100644 (file)
@@ -101,6 +101,7 @@ $i18n_key_words = array(
 'error.xml' => 'Error in XML file at line %d: %s.',
 'error.cannot_import' => 'Cannot import: %s.',
 'error.format' => 'Invalid file format.',
+'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 'warn.sure' => 'Are you sure?',
index cc4fe03472fc89412444eddcff14d5b5d7811908..fbf7076aaec1f1b56dba4025c45eb5d245dc3099 100644 (file)
@@ -114,6 +114,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index a29929afd7080bc8d3caef78f2d1bb1cb753614b..860b8cd93e8147d2b9fb2bc20452db1a0edfc520 100644 (file)
@@ -119,6 +119,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index f1a37b4f549f87a7f74d3c732d128d34bdc26070..3ec01e23e09063ff8a8facb54d086c1b91747152 100644 (file)
@@ -117,6 +117,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 065f71c1ce0033366fd9442b3b30f1b908285666..4895713b5d4f5584cba4c0a1dc5284a4df1e6691 100644 (file)
@@ -112,6 +112,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 4c6d767497bf5ea8ae2735650244a632de0276b5..5e003665473d1b64bf8b08c5658a60c4c6925ec1 100644 (file)
@@ -110,6 +110,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 6be29a04b3ab97b6de578bd14886549d20d25511..6e7b32ef0c9cd3e97469ec4ded58475e5cfaf771 100644 (file)
@@ -105,6 +105,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index d27edb8c7cc267b487f3dfd71897e6b1aa025da8..daedb00be03ffbc9d4773cfc6cc47a9a2cbb7e28 100644 (file)
@@ -127,6 +127,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 27642b47864d498f4003538b9bf630e571da6305..fcd4c2566be08103ad55a05b86da77e3c921a09e 100644 (file)
@@ -116,6 +116,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 8f35a78ec11050c97fdc28595b1084a0a7555ae7..36f8ab3da36616039c3ebd1f852fdc3aa05a24f9 100644 (file)
@@ -109,6 +109,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index ea158793aab75818bd2edb325c48dc45061f46ed..4cb224fb5a14fd96780ec9a0d4b4a85ec88166ab 100644 (file)
@@ -120,6 +120,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 27cbe669297f3db4192a7b0be613abf472ac0aab..2c0a898e007cee039f884f24badde17748aef0d3 100644 (file)
@@ -119,6 +119,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index b0ada311d2503956f7b9151c236caac62c6f9292..d98188f48cb12d2fa1a557995e9341bec55d6513 100644 (file)
@@ -101,6 +101,8 @@ $i18n_key_words = array(
 'error.xml' => 'Fout in XML bestand in regel line %d: %s.',
 'error.cannot_import' => 'Kan het volgende niet importeren: %s.',
 'error.format' => 'Bestandsformaat niet valide.',
+// TODO: translate the following.
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 34f4f6d30ec45c91547a4375f52a5a9670edb3ca..650957eda51f08bed96094cd19a3c8bdd7d61b80 100644 (file)
@@ -119,6 +119,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index a9220c4eb2284527cd5edeca18d10f6a0c877dd1..11b6c4b42c28b61170b7acc2ec786ec2681e81c5 100644 (file)
@@ -114,6 +114,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index ee699e11bee2fc9d3e43e122d041b25d021fbf2c..3e36200ea351c8b58fdfa0707266245a186e861a 100644 (file)
@@ -111,6 +111,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 8a96bc88243e61ba560886f362c65520aed10a8b..c3ef6c5c36efe0bced6e9340a139a70603531dbd 100644 (file)
@@ -113,6 +113,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 4f027f6b0fc8c41ea9137dd09c6cf386fa7ff258..01ecded5d9f97db05a3c655c026743216924b00b 100644 (file)
@@ -120,6 +120,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 466f7cd1e987bb42102ad8adb0b4b3db04db332a..f68e0631c085d8a1b44ececa1ad296d263925351 100644 (file)
@@ -100,6 +100,7 @@ $i18n_key_words = array(
 'error.xml' => 'Ошибка в файле XML на строке %d: %s.',
 'error.cannot_import' => 'Невозможно импортировать: %s.',
 'error.format' => 'Неверный формат файла.',
+'error.user_count' => 'Ограничение на количество пользователей.',
 
 // Warning messages.
 'warn.sure' => 'Вы уверены?',
index 0077e713de4aef29cfffac48de60d411e71a8b19..33622c9909e1a18c25d47d4bd0d61f9d40e38a6d 100644 (file)
@@ -116,6 +116,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 9be563c428629574d375cc504634501be64391c7..6b3881a132ce00708603ebae3c008b1db83d4322 100644 (file)
@@ -110,6 +110,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 270984d4598b54f6a032b14c8df88e739d4088b7..3b12961d6f5a2526bf980d1801289c2c5c9ad97b 100644 (file)
@@ -111,6 +111,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 815ad80e131aea7f9520f1d4b5a76b018b038847..5ddd55d1fd11ac4b1e970cff65cfa2eef5704ca4 100644 (file)
@@ -109,6 +109,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 720475be6953bff806b94f0c04c819efa9242c20..fafeeaaf2b4e36fb9fd49bf8ab4323ddbf4dadb8 100644 (file)
@@ -123,6 +123,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index aa9e7dea8a3e0c9e8f2715e2927a3cea5a0c465c..656eb451691006decbdbf0c0a5b83342bb565172 100644 (file)
@@ -111,6 +111,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 7346c9ad1b3aedaaecd455dbd4947c4427b46a00..0bdb2e05d07a315fda19d89bba664a8601546ea0 100644 (file)
@@ -117,6 +117,7 @@ $i18n_key_words = array(
 // 'error.xml' => 'Error in XML file at line %d: %s.',
 // 'error.cannot_import' => 'Cannot import: %s.',
 // 'error.format' => 'Invalid file format.',
+// 'error.user_count' => 'Limit on user count.',
 
 // Warning messages.
 // TODO: translate the following.
index 57e94258b8ceb24da3d62aa6a30904f68e47fd1c..d163b71dc074991d31765c57bc86c25f294c9944 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.36.4686 | 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.36.4687 | 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>
index b1d155aa0f3458ac3439eff62ea39aa98b9b8e14..c821c7d4fff8fdbd5abad43d6bfa899baf6d59fe 100644 (file)
@@ -149,6 +149,7 @@ if ($request->isPost()) {
   if (!ttValidEmail($cl_email, true)) $err->add($i18n->get('error.field'), $i18n->get('label.email'));
   if (!ttValidFloat($cl_rate, true)) $err->add($i18n->get('error.field'), $i18n->get('form.users.default_rate'));
   if (!ttValidFloat($cl_quota_percent, true)) $err->add($i18n->get('error.field'), $i18n->get('label.quota'));
+  if (!ttUserHelper::canAdd()) $err->add($i18n->get('error.user_count'));
 
   if ($err->no()) {
     if (!ttUserHelper::getUserByLogin($cl_login)) {
index a999519125a38f5c87b950e92214ec11e631fdfe..cf233d5b55f8ec5e98e6c7a82865ea3fd1d2f949 100644 (file)
@@ -152,6 +152,7 @@ if ($request->isPost()) {
   if ($user->isPluginEnabled('cl') && ttRoleHelper::isClientRole($cl_role_id) && !$cl_client_id) $err->add($i18n->get('error.client'));
   if (!ttValidFloat($cl_rate, true)) $err->add($i18n->get('error.field'), $i18n->get('form.users.default_rate'));
   if (!ttValidFloat($cl_quota_percent, true)) $err->add($i18n->get('error.field'), $i18n->get('label.quota'));
+  if (!ttUserHelper::canAdd()) $err->add($i18n->get('error.user_count'));
 
   if ($err->no()) {
     if (!ttUserHelper::getUserByLogin($cl_login)) {