]> wagnertech.de Git - timetracker.git/commitdiff
Refactoring, moving plugin config options into config field.
authorNik Okuntseff <support@anuko.com>
Fri, 26 Apr 2019 15:54:27 +0000 (15:54 +0000)
committerNik Okuntseff <support@anuko.com>
Fri, 26 Apr 2019 15:54:27 +0000 (15:54 +0000)
21 files changed:
WEB-INF/lib/ttGroup.class.php
WEB-INF/lib/ttUser.class.php
WEB-INF/templates/expense_edit.tpl
WEB-INF/templates/expenses.tpl
WEB-INF/templates/footer.tpl
WEB-INF/templates/mobile/expense_edit.tpl
WEB-INF/templates/mobile/expenses.tpl
WEB-INF/templates/time.tpl
WEB-INF/templates/time_edit.tpl
WEB-INF/templates/week.tpl
expense_edit.php
expenses.php
mobile/expense_edit.php
mobile/expenses.php
mobile/time.php
mobile/time_edit.php
mobile/timer.php
plugins.php
time.php
time_edit.php
week.php

index 9c12e95b6cb0d65c7ea7d321042301351086bd78..c3a56e05540605a8f164c84f39829d505178b311 100644 (file)
@@ -54,7 +54,10 @@ class ttGroup {
   var $password_complexity = null; // Password complexity example.
   var $currency = null;         // Currency.
   var $plugins = null;          // Comma-separated list of enabled plugins.
   var $password_complexity = null; // Password complexity example.
   var $currency = null;         // Currency.
   var $plugins = null;          // Comma-separated list of enabled plugins.
+
   var $config = null;           // Comma-separated list of miscellaneous config options.
   var $config = null;           // Comma-separated list of miscellaneous config options.
+  var $configHelper = null;     // An instance of ttConfigHelper class.
+
   var $custom_logo = 0;         // Whether to use a custom logo for group.
   var $lock_spec = null;        // Cron specification for record locking.
   var $workday_minutes = 480;   // Number of work minutes in a regular day.
   var $custom_logo = 0;         // Whether to use a custom logo for group.
   var $lock_spec = null;        // Cron specification for record locking.
   var $workday_minutes = 480;   // Number of work minutes in a regular day.
@@ -104,13 +107,15 @@ class ttGroup {
       /*
       $this->custom_logo = $val['custom_logo'];
       */
       /*
       $this->custom_logo = $val['custom_logo'];
       */
+
+      // TODO: refactor this.
       $this->config = $val['config'];
       $this->config = $val['config'];
-      $config = new ttConfigHelper($this->config);
+      $this->configHelper = new ttConfigHelper($val['config']);
       // Set user config options.
       // Set user config options.
-      $this->show_holidays = $config->getDefinedValue('show_holidays');
-      $this->punch_mode = $config->getDefinedValue('punch_mode');
-      $this->allow_overlap = $config->getDefinedValue('allow_overlap');
-      $this->future_entries = $config->getDefinedValue('future_entries');
+      $this->show_holidays = $this->configHelper->getDefinedValue('show_holidays');
+      $this->punch_mode = $this->configHelper->getDefinedValue('punch_mode');
+      $this->allow_overlap = $this->configHelper->getDefinedValue('allow_overlap');
+      $this->future_entries = $this->configHelper->getDefinedValue('future_entries');
     }
 
     // Determine active user count in a separate query.
     }
 
     // Determine active user count in a separate query.
index dd4a81d5226ae31892b3783689569b6d3b287f58..5ee67f594737edfb5159590fdf5fc9ab3f1805c8 100644 (file)
@@ -68,7 +68,11 @@ class ttUser {
   var $password_complexity = null; // Password complexity example.
   var $currency = null;         // Currency.
   var $plugins = null;          // Comma-separated list of enabled plugins.
   var $password_complexity = null; // Password complexity example.
   var $currency = null;         // Currency.
   var $plugins = null;          // Comma-separated list of enabled plugins.
+
+  // Refactoring ongoing. Towards using helper instead of config string?
   var $config = null;           // Comma-separated list of miscellaneous config options.
   var $config = null;           // Comma-separated list of miscellaneous config options.
+  var $configHelper = null;     // An instance of ttConfigHelper class.
+
   var $custom_logo = 0;         // Whether to use a custom logo for group.
   var $lock_spec = null;        // Cron specification for record locking.
   var $workday_minutes = 480;   // Number of work minutes in a regular day.
   var $custom_logo = 0;         // Whether to use a custom logo for group.
   var $lock_spec = null;        // Cron specification for record locking.
   var $workday_minutes = 480;   // Number of work minutes in a regular day.
@@ -137,13 +141,15 @@ class ttUser {
       $this->workday_minutes = $val['workday_minutes'];
       $this->custom_logo = $val['custom_logo'];
 
       $this->workday_minutes = $val['workday_minutes'];
       $this->custom_logo = $val['custom_logo'];
 
+      // TODO: refactor this.
       $this->config = $val['config'];
       $this->config = $val['config'];
-      $config = new ttConfigHelper($this->config);
+      $this->configHelper = new ttConfigHelper($val['config']);
+
       // Set user config options.
       // Set user config options.
-      $this->show_holidays = $config->getDefinedValue('show_holidays');
-      $this->punch_mode = $config->getDefinedValue('punch_mode');
-      $this->allow_overlap = $config->getDefinedValue('allow_overlap');
-      $this->future_entries = $config->getDefinedValue('future_entries');
+      $this->show_holidays = $this->configHelper->getDefinedValue('show_holidays');
+      $this->punch_mode = $this->configHelper->getDefinedValue('punch_mode');
+      $this->allow_overlap = $this->configHelper->getDefinedValue('allow_overlap');
+      $this->future_entries = $this->configHelper->getDefinedValue('future_entries');
       
       // Set "on behalf" id and name (user).
       if (isset($_SESSION['behalf_id'])) {
       
       // Set "on behalf" id and name (user).
       if (isset($_SESSION['behalf_id'])) {
@@ -229,7 +235,7 @@ class ttUser {
 
   // getConfig returns config string for active group.
   function getConfig() {
 
   // getConfig returns config string for active group.
   function getConfig() {
-    return ($this->behalfGroup ? $this->behalfGroup->config : $this->config);
+    return ($this->behalfGroup ? $this->behalfGroup->configHelper->getConfig() : $this->configHelper->getConfig());
   }
 
   // getConfigOption returns true if an option is defined for group.
   }
 
   // getConfigOption returns true if an option is defined for group.
@@ -263,6 +269,19 @@ class ttUser {
     return in_array($plugin, explode(',', $this->getPlugins()));
   }
 
     return in_array($plugin, explode(',', $this->getPlugins()));
   }
 
+  // isOptionEnabled checks whether a config option is enabled for user.
+  function isOptionEnabled($option)
+  {
+    return $this->behalfGroup ? $this->behalfGroup->configHelper->getDefinedValue($option) : $this->configHelper->getDefinedValue($option);
+  }
+
+  // setOption sets an option inside of ttConfigHelper instance.
+  // Note that it does not write to the database.
+  function setOption($option, $enable = true)
+  {
+    return $this->behalfGroup ? $this->behalfGroup->configHelper->setDefinedValue($option, $enable) : $this->configHelper->setDefinedValue($option, $enable);
+  }
+
   // getAssignedProjects - returns an array of assigned projects.
   function getAssignedProjects($includeFiles = false)
   {
   // getAssignedProjects - returns an array of assigned projects.
   function getAssignedProjects($includeFiles = false)
   {
index 850e6442abaa03c60b0edbefb1423c114e3093b2..671e868cf34b7f5ba3b0588813af709f08479a39 100644 (file)
@@ -134,7 +134,7 @@ function recalculateCost() {
     <table border="0">
 {if $user->isPluginEnabled('cl')}
     <tr>
     <table border="0">
 {if $user->isPluginEnabled('cl')}
     <tr>
-      <td align="right">{$i18n.label.client} {if $user->isPluginEnabled('cm')}(*){/if}:</td>
+      <td align="right">{$i18n.label.client} {if $user->isOptionEnabled('client_required')}(*){/if}:</td>
       <td>{$forms.expenseItemForm.client.control}</td>
     </tr>
 {/if}
       <td>{$forms.expenseItemForm.client.control}</td>
     </tr>
 {/if}
index df0eb4d124652ff96571699671411d15c9e854e2..7272f01fee7e58e406358417115189b81f23414a 100644 (file)
@@ -125,7 +125,7 @@ function recalculateCost() {
 {/if}
 {if $user->isPluginEnabled('cl')}
         <tr>
 {/if}
 {if $user->isPluginEnabled('cl')}
         <tr>
-          <td align="right">{$i18n.label.client}{if $user->isPluginEnabled('cm')} (*){/if}:</td>
+          <td align="right">{$i18n.label.client}{if $user->isOptionEnabled('client_required')} (*){/if}:</td>
           <td>{$forms.expensesForm.client.control}</td>
         </tr>
 {/if}
           <td>{$forms.expensesForm.client.control}</td>
         </tr>
 {/if}
index 2edaa4b1ee4e0435724328e247c593b15b1c617e..e806ad80500cda955c44b3df9af17aa3771c9519 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.19.3.4986 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.19.3.4987 | 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 708cc23c4cadf9240b6be12bbb80a78619cf2687..d4834ae1ab9a92e5463316b5d33b1343fc5ff34d 100644 (file)
@@ -134,7 +134,7 @@ function recalculateCost() {
     <table border="0">
 {if $user->isPluginEnabled('cl')}
     <tr>
     <table border="0">
 {if $user->isPluginEnabled('cl')}
     <tr>
-      <td align="right">{$i18n.label.client} {if $user->isPluginEnabled('cm')}(*){/if}:</td>
+      <td align="right">{$i18n.label.client} {if $user->isOptionEnabled('client_required')}(*){/if}:</td>
       <td>{$forms.expenseItemForm.client.control}</td>
     </tr>
 {/if}
       <td>{$forms.expenseItemForm.client.control}</td>
     </tr>
 {/if}
index 7afde73d27b3d1f28c5f72bdc71986eee2d601e9..81d7a214ac0fd3cfa50adb28f0cb6334447053c4 100644 (file)
@@ -134,7 +134,7 @@ function recalculateCost() {
 {/if}
 {if $user->isPluginEnabled('cl')}
         <tr>
 {/if}
 {if $user->isPluginEnabled('cl')}
         <tr>
-          <td align="right">{$i18n.label.client}{if $user->isPluginEnabled('cm')} (*){/if}:</td>
+          <td align="right">{$i18n.label.client}{if $user->isOptionEnabled('client_required')} (*){/if}:</td>
           <td>{$forms.expensesForm.client.control}</td>
         </tr>
 {/if}
           <td>{$forms.expensesForm.client.control}</td>
         </tr>
 {/if}
index 0dcfd107971f14d8094797da317329022a24b09e..e3266076ba3bc7227c869396e52427eaf386c1de 100644 (file)
@@ -26,7 +26,7 @@
 {/if}
 {if $show_client}
         <tr>
 {/if}
 {if $show_client}
         <tr>
-          <td align="right">{$i18n.label.client}{if $user->isPluginEnabled('cm')} (*){/if}:</td>
+          <td align="right">{$i18n.label.client}{if $user->isOptionEnabled('client_required')} (*){/if}:</td>
           <td>{$forms.timeRecordForm.client.control}</td>
         </tr>
 {/if}
           <td>{$forms.timeRecordForm.client.control}</td>
         </tr>
 {/if}
index 66778e17d40d405f0646cf3ca492b0637fe3f59e..42b1674d4e18d0e1a8bd14fabca21e6468b02f0e 100644 (file)
@@ -24,7 +24,7 @@ function confirmSave() {
     <table border="0">
 {if $user->isPluginEnabled('cl')}
     <tr>
     <table border="0">
 {if $user->isPluginEnabled('cl')}
     <tr>
-      <td align="right">{$i18n.label.client}{if $user->isPluginEnabled('cm')} (*){/if}:</td>
+      <td align="right">{$i18n.label.client}{if $user->isOptionEnabled('client_required')} (*){/if}:</td>
       <td>{$forms.timeRecordForm.client.control}</td>
     </tr>
 {/if}
       <td>{$forms.timeRecordForm.client.control}</td>
     </tr>
 {/if}
index e786ba856ffec41fad7710bb5b01ee182eb6f314..366762cfc32fa6ddfae6ca93e7596bf6308fc7b4 100644 (file)
@@ -41,7 +41,7 @@ function fillDropdowns() {
 {/if}
 {if $show_client}
         <tr>
 {/if}
 {if $show_client}
         <tr>
-          <td align="right">{$i18n.label.client}{if $user->isPluginEnabled('cm')} (*){/if}:</td>
+          <td align="right">{$i18n.label.client}{if $user->isOptionEnabled('client_required')} (*){/if}:</td>
           <td>{$forms.weekTimeForm.client.control}</td>
         </tr>
 {/if}
           <td>{$forms.weekTimeForm.client.control}</td>
         </tr>
 {/if}
index 877ec663811d9cfe59d405eb76d5f6ee904b4a99..3cebac1290620230272aa69f29a2b270165c3fdf 100644 (file)
@@ -160,7 +160,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get(
 
 if ($request->isPost()) {
   // Validate user input.
 
 if ($request->isPost()) {
   // Validate user input.
-  if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
+  if ($user->isPluginEnabled('cl') && $user->isOptionEnabled('client_required') && !$cl_client)
     $err->add($i18n->get('error.client'));
   if ($show_project && !$cl_project)
     $err->add($i18n->get('error.project'));
     $err->add($i18n->get('error.client'));
   if ($show_project && !$cl_project)
     $err->add($i18n->get('error.project'));
index e1eaeddae4cd14503a07f53396e455eb75a357ed..2c25bde66e0c91b254fc7be13f5bcf0c9f945524 100644 (file)
@@ -190,7 +190,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_
 if ($request->isPost()) {
   if ($request->getParameter('btn_submit')) {
     // Validate user input.
 if ($request->isPost()) {
   if ($request->getParameter('btn_submit')) {
     // Validate user input.
-    if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
+    if ($user->isPluginEnabled('cl') && $user->isOptionEnabled('client_required') && !$cl_client)
       $err->add($i18n->get('error.client'));
     if ($show_project && !$cl_project)
       $err->add($i18n->get('error.project'));
       $err->add($i18n->get('error.client'));
     if ($show_project && !$cl_project)
       $err->add($i18n->get('error.project'));
index 10035a9b42d4dcc05dd4707a01d99ede11a1b5f7..654d1698d76892f9094963441008a9799691dbda 100644 (file)
@@ -155,7 +155,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get(
 
 if ($request->isPost()) {
   // Validate user input.
 
 if ($request->isPost()) {
   // Validate user input.
-  if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
+  if ($user->isPluginEnabled('cl') && $user->isOptionEnabled('client_required') && !$cl_client)
     $err->add($i18n->get('error.client'));
   if ($show_project && !$cl_project)
     $err->add($i18n->get('error.project'));
     $err->add($i18n->get('error.client'));
   if ($show_project && !$cl_project)
     $err->add($i18n->get('error.project'));
index 1b8f7cda9f268f7bb19b4c36bf7a9a4532b6d82e..3b229368ebc6a0a6c8eb366b46b9086f640bcba1 100644 (file)
@@ -195,7 +195,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_
 if ($request->isPost()) {
   if ($request->getParameter('btn_submit')) {
     // Validate user input.
 if ($request->isPost()) {
   if ($request->getParameter('btn_submit')) {
     // Validate user input.
-    if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
+    if ($user->isPluginEnabled('cl') && $user->isOptionEnabled('client_required') && !$cl_client)
       $err->add($i18n->get('error.client'));
     if ($show_project && !$cl_project)
       $err->add($i18n->get('error.project'));
       $err->add($i18n->get('error.client'));
     if ($show_project && !$cl_project)
       $err->add($i18n->get('error.project'));
index 30c7a402edd1439fedf451ec8295279ab1992fcb..5a5c054d6a310a0b08e6fde75a890954aad80b58 100644 (file)
@@ -249,7 +249,7 @@ if ($request->isPost()) {
   if ($request->getParameter('btn_submit')) {
 
     // Validate user input.
   if ($request->getParameter('btn_submit')) {
 
     // Validate user input.
-    if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
+    if ($user->isPluginEnabled('cl') && $user->isOptionEnabled('client_required') && !$cl_client)
       $err->add($i18n->get('error.client'));
     if ($custom_fields) {
       if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
       $err->add($i18n->get('error.client'));
     if ($custom_fields) {
       if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
index b33b099146735ae5de0009d8a70d0ac9a466b746..364ebaf8201e2f5803727dbe50318b0a0998f96e 100644 (file)
@@ -234,7 +234,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get(
 if ($request->isPost()) {
 
   // Validate user input.
 if ($request->isPost()) {
 
   // Validate user input.
-  if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
+  if ($user->isPluginEnabled('cl') && $user->isOptionEnabled('client_required') && !$cl_client)
     $err->add($i18n->get('error.client'));
   if ($custom_fields) {
     if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
     $err->add($i18n->get('error.client'));
   if ($custom_fields) {
     if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
index a8f708a8a682c924d57f3f7974d858c9b125efc5..667536324de14442e359a096af24fad8db5ccba7 100644 (file)
@@ -186,7 +186,7 @@ if ($request->isPost()) {
     $cl_finish = null;
 
     // Validate user input.
     $cl_finish = null;
 
     // Validate user input.
-    if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
+    if ($user->isPluginEnabled('cl') && $user->isOptionEnabled('client_required') && !$cl_client)
       $err->add($i18n->get('error.client'));
     if ($custom_fields) {
       if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
       $err->add($i18n->get('error.client'));
     if ($custom_fields) {
       if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
index dc3b7a5d855729309d7b6e607a2acfa215a24102..4d2972bfd0732b1f2416831c3b7188164a5f9497 100644 (file)
@@ -62,7 +62,7 @@ if ($request->isPost()) {
   $plugins = explode(',', $user->getPlugins());
   $cl_charts = in_array('ch', $plugins);
   $cl_clients = in_array('cl', $plugins);
   $plugins = explode(',', $user->getPlugins());
   $cl_charts = in_array('ch', $plugins);
   $cl_clients = in_array('cl', $plugins);
-  $cl_client_required = in_array('cm', $plugins);
+  $cl_client_required = $user->isOptionEnabled('client_required');
   $cl_invoices = in_array('iv', $plugins);
   $cl_paid_status = in_array('ps', $plugins);
   $cl_custom_fields = in_array('cf', $plugins);
   $cl_invoices = in_array('iv', $plugins);
   $cl_paid_status = in_array('ps', $plugins);
   $cl_custom_fields = in_array('cf', $plugins);
@@ -114,8 +114,6 @@ if ($request->isPost()) {
     $plugins .= ',ch';
   if ($cl_clients)
      $plugins .= ',cl';
     $plugins .= ',ch';
   if ($cl_clients)
      $plugins .= ',cl';
-  if ($cl_client_required)
-    $plugins .= ',cm';
   if ($cl_invoices)
     $plugins .= ',iv';
   if ($cl_paid_status)
   if ($cl_invoices)
     $plugins .= ',iv';
   if ($cl_paid_status)
@@ -158,8 +156,14 @@ if ($request->isPost()) {
 
   $plugins = trim($plugins, ',');
 
 
   $plugins = trim($plugins, ',');
 
+  // Prepare a new config string.
+  $user->setOption('client_required', $cl_client_required);
+  $user->setOption('tax_expenses', $cl_tax_expenses);
+  $config = $user->getConfig();
+
   if ($user->updateGroup(array(
   if ($user->updateGroup(array(
-    'plugins' => $plugins))) {
+    'plugins' => $plugins,
+    'config' => $config))) {
     header('Location: success.php');
     exit();
   } else
     header('Location: success.php');
     exit();
   } else
index e7ff10ae8f8eb3f9ffba59123a5a25bb0a3af1b3..ca48056a8aeff5b62859b9250fd8bc5f3584374f 100644 (file)
--- a/time.php
+++ b/time.php
@@ -306,7 +306,7 @@ if ($request->isPost()) {
   if ($request->getParameter('btn_submit')) {
 
     // Validate user input.
   if ($request->getParameter('btn_submit')) {
 
     // Validate user input.
-    if ($showClient && $user->isPluginEnabled('cm') && !$cl_client)
+    if ($showClient && $user->isOptionEnabled('client_required') && !$cl_client)
       $err->add($i18n->get('error.client'));
     if ($custom_fields) {
       if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
       $err->add($i18n->get('error.client'));
     if ($custom_fields) {
       if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
index bbc95eade1c22374d59af8eb255fb8b526f9d2b4..bb0457384a2087b56cc3c88b32f67e2a11fd2b33 100644 (file)
@@ -239,7 +239,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get(
 if ($request->isPost()) {
 
   // Validate user input.
 if ($request->isPost()) {
 
   // Validate user input.
-  if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
+  if ($user->isPluginEnabled('cl') && $user->isOptionEnabled('client_required') && !$cl_client)
     $err->add($i18n->get('error.client'));
   if ($custom_fields) {
     if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
     $err->add($i18n->get('error.client'));
   if ($custom_fields) {
     if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
index e2aa2d9d81c27b9adc7b6d48bc4516e6e44fc2ca..05d399214d4d8e8677121006859f1a72d3a3442a 100644 (file)
--- a/week.php
+++ b/week.php
@@ -349,7 +349,7 @@ if ($request->isPost()) {
       }
     }
     if ($newEntryPosted) {
       }
     }
     if ($newEntryPosted) {
-      if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
+      if ($user->isPluginEnabled('cl') && $user->isOptionEnabled('client_required') && !$cl_client)
         $err->add($i18n->get('error.client'));
       if ($custom_fields) {
         if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
         $err->add($i18n->get('error.client'));
       if ($custom_fields) {
         if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);