diff --git a/VERSION.txt b/VERSION.txt index af6dd97a7b10..36ed3dba85f7 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.10.25 \ No newline at end of file +5.10.26 \ No newline at end of file diff --git a/app/Services/Bank/ProcessBankRules.php b/app/Services/Bank/ProcessBankRules.php index 5caf82649ff6..6199368d7db1 100644 --- a/app/Services/Bank/ProcessBankRules.php +++ b/app/Services/Bank/ProcessBankRules.php @@ -140,7 +140,7 @@ class ProcessBankRules extends AbstractService } } - if (($bank_transaction_rule['matches_on_all'] && (count($match_set) == $rule_count)) || (!$bank_transaction_rule['matches_on_all'] && count($match_set) > 0)) { + if (($bank_transaction_rule['matches_on_all'] && $this->checkMatchSetForKey($match_set, $rule_count)) || (!$bank_transaction_rule['matches_on_all'] && count($match_set) > 0)) { $this->bank_transaction->vendor_id = $bank_transaction_rule->vendor_id; $this->bank_transaction->ninja_category_id = $bank_transaction_rule->category_id; @@ -150,11 +150,71 @@ class ProcessBankRules extends AbstractService //auto-convert + + if ($bank_transaction_rule['auto_convert']) { + + //all types must match. + $entity = $match_set[0][0]; + + foreach($match_set as $set) + { + if($set[0] != $entity) + return false; + } + + +// $result_set = []; + +// foreach($match_set as $key => $set) { + +// $parseable_set = $match_set; +// unset($parseable_set[$key]); + +// $entity_ids = $set[1]; + +// foreach($parseable_set as $kkey => $vvalue) { + +// $i = array_intersect($vvalue[1], $entity_ids); + +// if(count($i) == 0) { +// return false; +// } + + +// $result_set[] = $i; + +// } + + +// $commonValues = $result_set[0]; // Start with the first sub-array + +// foreach ($result_set as $subArray) { +// $commonValues = array_intersect($commonValues, $subArray); +// } + +// echo print_r($commonValues, true); + +//just need to ensure the result count = rule count +// } + + + + //there must be a key in each set + + //no misses allowed + + $this->bank_transaction->status_id = BankTransaction::STATUS_CONVERTED; + $this->bank_transaction->save(); + + } } } + } + private function checkMatchSetForKey(array $match_set, $rule_count) + { } diff --git a/config/ninja.php b/config/ninja.php index f57f7bb901a5..d152f711c57c 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -17,8 +17,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => env('APP_VERSION', '5.10.25'), - 'app_tag' => env('APP_TAG', '5.10.25'), + 'app_version' => env('APP_VERSION', '5.10.26'), + 'app_tag' => env('APP_TAG', '5.10.26'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false),