|
@@ -87,23 +87,27 @@
|
87
|
87
|
function parseStatementLine($line) {
|
88
|
88
|
global $categories, $genericTypes, $types, $rules;
|
89
|
89
|
|
90
|
|
- if (preg_match('/^(.*?)\s*\((.*? @ RATE .*?)\)$/', $line['Description'], $m)) {
|
91
|
|
- $line['Description'] = $m[1];
|
92
|
|
- $line['Exchange'] = $m[2];
|
|
90
|
+ if (!isset($line['Exchange']) || empty($line['Exchange'])) {
|
|
91
|
+ if (preg_match('/^(.*?)\s*\((.*? @ RATE .*?)\)$/', $line['Description'], $m)) {
|
|
92
|
+ $line['Description'] = $m[1];
|
|
93
|
+ $line['Exchange'] = $m[2];
|
|
94
|
+ }
|
93
|
95
|
}
|
94
|
96
|
|
95
|
|
- foreach ($types as $prefix => $type) {
|
96
|
|
- if (strpos($line['Description'], $prefix) === 0) {
|
97
|
|
- $line['Type'] = $type;
|
|
97
|
+ if (!isset($line['Type']) || empty($line['Type'])) {
|
|
98
|
+ foreach ($types as $prefix => $type) {
|
|
99
|
+ if (strpos($line['Description'], $prefix) === 0) {
|
|
100
|
+ $line['Type'] = $type;
|
98
|
101
|
|
99
|
|
- if (array_search($type, $genericTypes) === false) {
|
100
|
|
- $line['Description'] = substr($line['Description'], strlen($prefix));
|
101
|
|
- } else {
|
102
|
|
- $line['RawDescription'] = $line['Description'];
|
103
|
|
- $line['Description'] = $type;
|
104
|
|
- }
|
|
102
|
+ if (array_search($type, $genericTypes) === false) {
|
|
103
|
+ $line['Description'] = substr($line['Description'], strlen($prefix));
|
|
104
|
+ } else {
|
|
105
|
+ $line['RawDescription'] = $line['Description'];
|
|
106
|
+ $line['Description'] = $type;
|
|
107
|
+ }
|
105
|
108
|
|
106
|
|
- break;
|
|
109
|
+ break;
|
|
110
|
+ }
|
107
|
111
|
}
|
108
|
112
|
}
|
109
|
113
|
|
|
@@ -114,11 +118,13 @@
|
114
|
118
|
}
|
115
|
119
|
}
|
116
|
120
|
|
117
|
|
- foreach ($categories as $cat => $entries) {
|
118
|
|
- foreach ($entries as $regex) {
|
119
|
|
- if (preg_match('(' . $regex . ')', $line['Description'])) {
|
120
|
|
- $line['Category'] = $cat;
|
121
|
|
- break;
|
|
121
|
+ if (!isset($line['Category']) || empty($line['Category'])) {
|
|
122
|
+ foreach ($categories as $cat => $entries) {
|
|
123
|
+ foreach ($entries as $regex) {
|
|
124
|
+ if (preg_match('(' . $regex . ')', $line['Description'])) {
|
|
125
|
+ $line['Category'] = $cat;
|
|
126
|
+ break;
|
|
127
|
+ }
|
122
|
128
|
}
|
123
|
129
|
}
|
124
|
130
|
}
|