@@ -97,23 +97,31 @@ |
||
| 97 | 97 | $input = safeToDb($input); |
| 98 | 98 | $validator = new Intraface_Validator($this->error); |
| 99 | 99 | |
| 100 | - if (!isset($input["payment_date"])) $input["payment_date"] = ''; |
|
| 100 | + if (!isset($input["payment_date"])) { |
|
| 101 | + $input["payment_date"] = ''; |
|
| 102 | + } |
|
| 101 | 103 | if ($validator->isDate($input["payment_date"], "Ugyldig dato", "allow_no_year")) {
|
| 102 | 104 | $date = new Intraface_Date($input["payment_date"]); |
| 103 | 105 | $date->convert2db(); |
| 104 | 106 | } |
| 105 | 107 | |
| 106 | - if (!isset($input["amount"])) $input["amount"] = 0; |
|
| 108 | + if (!isset($input["amount"])) { |
|
| 109 | + $input["amount"] = 0; |
|
| 110 | + } |
|
| 107 | 111 | if ($validator->isDouble($input["amount"], "Ugyldig bel�b")) {
|
| 108 | 112 | $amount = new Intraface_Amount($input["amount"]); |
| 109 | 113 | $amount->convert2db(); |
| 110 | 114 | $amount = $amount->get(); |
| 111 | 115 | } |
| 112 | 116 | |
| 113 | - if (!isset($input['description'])) $input['description'] = ''; |
|
| 117 | + if (!isset($input['description'])) { |
|
| 118 | + $input['description'] = ''; |
|
| 119 | + } |
|
| 114 | 120 | $validator->isString($input["description"], "Fejl i beskrivelse", "", "allow_empty"); |
| 115 | 121 | |
| 116 | - if (!isset($input['type'])) $input['type'] = NULL; |
|
| 122 | + if (!isset($input['type'])) { |
|
| 123 | + $input['type'] = NULL; |
|
| 124 | + } |
|
| 117 | 125 | $validator->isNumeric($input["type"], "Type er ikke angivet korrekt"); |
| 118 | 126 | $types = $this->getTypes(); |
| 119 | 127 | if (!isset($types[$input["type"]])) {
|
@@ -137,8 +137,7 @@ |
||
| 137 | 137 | $value[$i]["dk_date"] = $credit_notes[$cre]["dk_this_date"]; |
| 138 | 138 | if ($credit_notes[$cre]["description"] != "") { |
| 139 | 139 | $value[$i]["description"] = $credit_notes[$cre]["description"]; |
| 140 | - } |
|
| 141 | - else { |
|
| 140 | + } else { |
|
| 142 | 141 | $value[$i]["description"] = "[Ingen beskrivelse]"; |
| 143 | 142 | } |
| 144 | 143 | $value[$i]["amount"] = $credit_notes[$cre]["total"]; |
@@ -153,15 +153,21 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $validator = new Intraface_Validator($this->error); |
| 155 | 155 | |
| 156 | - if (!isset($input['number'])) $input['number'] = 0; |
|
| 156 | + if (!isset($input['number'])) { |
|
| 157 | + $input['number'] = 0; |
|
| 158 | + } |
|
| 157 | 159 | if ($validator->isNumeric($input["number"], "Rykkernummer skal v�re et tal st�rre end nul", "greater_than_zero")) {
|
| 158 | 160 | if (!$this->isNumberFree($input["number"])) {
|
| 159 | 161 | $this->error->set("Rykkernummer er allerede brugt");
|
| 160 | 162 | } |
| 161 | 163 | } |
| 162 | 164 | |
| 163 | - if (!isset($input['contact_id'])) $input['contact_id'] = 0; |
|
| 164 | - if (!isset($input["contact_person_id"])) $input["contact_person_id"] = 0; |
|
| 165 | + if (!isset($input['contact_id'])) { |
|
| 166 | + $input['contact_id'] = 0; |
|
| 167 | + } |
|
| 168 | + if (!isset($input["contact_person_id"])) { |
|
| 169 | + $input["contact_person_id"] = 0; |
|
| 170 | + } |
|
| 165 | 171 | if ($validator->isNumeric($input["contact_id"], "Du skal angive en kunde", "greater_than_zero")) {
|
| 166 | 172 | $contact = new Contact($this->kernel, (int)$input["contact_id"]); |
| 167 | 173 | if (is_object($contact->address)) {
|
@@ -177,38 +183,56 @@ discard block |
||
| 177 | 183 | } |
| 178 | 184 | |
| 179 | 185 | // $validator->isString($input["attention_to"], "Fejl i att.", "", "allow_empty"); |
| 180 | - if (!isset($input['description'])) $input['description'] = ''; |
|
| 186 | + if (!isset($input['description'])) { |
|
| 187 | + $input['description'] = ''; |
|
| 188 | + } |
|
| 181 | 189 | $validator->isString($input["description"], "Fejl i beskrivelsen", "", "allow_empty"); |
| 182 | 190 | |
| 183 | - if (!isset($input['this_date'])) $input['this_date'] = ''; |
|
| 191 | + if (!isset($input['this_date'])) { |
|
| 192 | + $input['this_date'] = ''; |
|
| 193 | + } |
|
| 184 | 194 | if ($validator->isDate($input["this_date"], "Ugyldig dato", "allow_no_year")) {
|
| 185 | 195 | $this_date = new Intraface_Date($input["this_date"]); |
| 186 | 196 | $this_date->convert2db(); |
| 187 | 197 | } |
| 188 | 198 | |
| 189 | - if (!isset($input['due_date'])) $input['due_date'] = ''; |
|
| 199 | + if (!isset($input['due_date'])) { |
|
| 200 | + $input['due_date'] = ''; |
|
| 201 | + } |
|
| 190 | 202 | if ($validator->isDate($input["due_date"], "Ugyldig forfaldsdato", "allow_no_year")) {
|
| 191 | 203 | $due_date = new Intraface_Date($input["due_date"]); |
| 192 | 204 | $due_date->convert2db(); |
| 193 | 205 | } |
| 194 | 206 | |
| 195 | - if (!isset($input['reminder_fee'])) $input['reminder_fee'] = 0; |
|
| 207 | + if (!isset($input['reminder_fee'])) { |
|
| 208 | + $input['reminder_fee'] = 0; |
|
| 209 | + } |
|
| 196 | 210 | $validator->isNumeric($input["reminder_fee"], "Rykkerbebyr skal v�re et tal"); |
| 197 | - if (!isset($input['text'])) $input['text'] = ''; |
|
| 211 | + if (!isset($input['text'])) { |
|
| 212 | + $input['text'] = ''; |
|
| 213 | + } |
|
| 198 | 214 | $validator->isString($input["text"], "Fejl i teksten", "<b><i>", "allow_empty"); |
| 199 | - if (!isset($input['send_as'])) $input['send_as'] = ''; |
|
| 215 | + if (!isset($input['send_as'])) { |
|
| 216 | + $input['send_as'] = ''; |
|
| 217 | + } |
|
| 200 | 218 | $validator->isString($input["send_as"], "Ugyldig m�de at sende rykkeren p�"); |
| 201 | 219 | |
| 202 | - if (!isset($input['payment_method_key'])) $input['payment_method_key'] = 0; |
|
| 220 | + if (!isset($input['payment_method_key'])) { |
|
| 221 | + $input['payment_method_key'] = 0; |
|
| 222 | + } |
|
| 203 | 223 | $validator->isNumeric($input["payment_method_key"], "Du skal angive en betalingsmetode"); |
| 204 | - if (!isset($input['girocode'])) $input['girocode'] = ''; |
|
| 224 | + if (!isset($input['girocode'])) { |
|
| 225 | + $input['girocode'] = ''; |
|
| 226 | + } |
|
| 205 | 227 | if ($input["payment_method_key"] == 3) {
|
| 206 | 228 | $validator->isString($input["girocode"], "Du skal udfylde girokode"); |
| 207 | 229 | } else {
|
| 208 | 230 | $validator->isString($input["girocode"], "Ugyldig girokode", "", "allow_empty"); |
| 209 | 231 | } |
| 210 | 232 | |
| 211 | - if (!isset($input['checked_invoice'])) $input['checked_invoice'] = array(); |
|
| 233 | + if (!isset($input['checked_invoice'])) { |
|
| 234 | + $input['checked_invoice'] = array(); |
|
| 235 | + } |
|
| 212 | 236 | if (!is_array($input["checked_invoice"]) || count($input["checked_invoice"]) == 0) {
|
| 213 | 237 | $this->error->set("Der er ikke valgt nogle fakturaer til rykkeren");
|
| 214 | 238 | } |
@@ -85,8 +85,7 @@ |
||
| 85 | 85 | |
| 86 | 86 | if ($this->tmp_file_name != NULL && file_exists($this->tmp_file_name)) {
|
| 87 | 87 | $error = $image->load($this->tmp_file_name); |
| 88 | - } |
|
| 89 | - else {
|
|
| 88 | + } else {
|
|
| 90 | 89 | $error = $image->load($this->file_handler->get('file_path'));
|
| 91 | 90 | } |
| 92 | 91 | |
@@ -80,7 +80,9 @@ discard block |
||
| 80 | 80 | if ($this->dbquery->checkFilter("uploaded_from_date")) {
|
| 81 | 81 | $date_parts = explode(" ", $this->dbquery->getFilter("uploaded_from_date"));
|
| 82 | 82 | // Der kontrolleres ikke for gyldig tidsformat |
| 83 | - if (isset($date_parts[1]) && $date_parts[1] != "") $time = " ".$date_parts[1]; |
|
| 83 | + if (isset($date_parts[1]) && $date_parts[1] != "") { |
|
| 84 | + $time = " ".$date_parts[1]; |
|
| 85 | + } |
|
| 84 | 86 | $date = new Intraface_Date($date_parts[0]); |
| 85 | 87 | if ($date->convert2db()) {
|
| 86 | 88 | $this->dbquery->setCondition("file_handler.date_created >= \"".$date->get().$time."\"");
|
@@ -92,7 +94,9 @@ discard block |
||
| 92 | 94 | if ($this->dbquery->checkFilter("uploaded_to_date")) {
|
| 93 | 95 | $date_parts = explode(" ", $this->dbquery->getFilter("uploaded_to_date"));
|
| 94 | 96 | // Der kontrolleres ikke for gyldig tidsformat |
| 95 | - if (isset($date_parts[1]) && $date_parts[1] != "") $time = " ".$date_parts[1]; |
|
| 97 | + if (isset($date_parts[1]) && $date_parts[1] != "") { |
|
| 98 | + $time = " ".$date_parts[1]; |
|
| 99 | + } |
|
| 96 | 100 | $date = new Intraface_Date($date_parts[0]); |
| 97 | 101 | if ($date->convert2db()) {
|
| 98 | 102 | $this->dbquery->setCondition("file_handler.date_created <= \"".$date->get().$time."\"");
|
@@ -104,7 +108,9 @@ discard block |
||
| 104 | 108 | if ($this->dbquery->checkFilter("edited_from_date")) {
|
| 105 | 109 | $date_parts = explode(" ", $this->dbquery->getFilter("edited_from_date"));
|
| 106 | 110 | // Der kontrolleres ikke for gyldig tidsformat |
| 107 | - if (isset($date_parts[1]) && $date_parts[1] != "") $time = " ".$date_parts[1]; |
|
| 111 | + if (isset($date_parts[1]) && $date_parts[1] != "") { |
|
| 112 | + $time = " ".$date_parts[1]; |
|
| 113 | + } |
|
| 108 | 114 | $date = new Intraface_Date($date_parts[0]); |
| 109 | 115 | if ($date->convert2db()) {
|
| 110 | 116 | $this->dbquery->setCondition("file_handler.date_changed >= \"".$date->get().$time."\"");
|
@@ -116,7 +122,9 @@ discard block |
||
| 116 | 122 | if ($this->dbquery->checkFilter("edited_to_date")) {
|
| 117 | 123 | $date_parts = explode(" ", $this->dbquery->getFilter("edited_to_date"));
|
| 118 | 124 | // Der kontrolleres ikke for gyldig tidsformat |
| 119 | - if (isset($date_parts[1]) && $date_parts[1] != "") $time = " ".$date_parts[1]; |
|
| 125 | + if (isset($date_parts[1]) && $date_parts[1] != "") { |
|
| 126 | + $time = " ".$date_parts[1]; |
|
| 127 | + } |
|
| 120 | 128 | $date = new Intraface_Date($date_parts[0]); |
| 121 | 129 | if ($date->convert2db()) {
|
| 122 | 130 | $this->dbquery->setCondition("file_handler.date_changed <= \"".$date->get().$time."\"");
|
@@ -115,8 +115,7 @@ |
||
| 115 | 115 | $extension = strrchr($file_name, '.'); |
| 116 | 116 | if ($extension !== false && (strlen($extension) == 4 || strlen($extension) == 5)) { |
| 117 | 117 | $file_name = substr($file_name, 0, 50-strlen($extension)).$extension; |
| 118 | - } |
|
| 119 | - else { |
|
| 118 | + } else { |
|
| 120 | 119 | $file_name = substr($file_name, 0, 50); |
| 121 | 120 | } |
| 122 | 121 | } |
@@ -86,20 +86,17 @@ discard block |
||
| 86 | 86 | $this->value['resize_type'] = $resize_types[$this->value['resize_type_key']]; |
| 87 | 87 | $this->value['origin'] = 'overwritten'; |
| 88 | 88 | return true; |
| 89 | - } |
|
| 90 | - elseif (isset($standard_type)) { |
|
| 89 | + } elseif (isset($standard_type)) { |
|
| 91 | 90 | $this->value = $standard_type; |
| 92 | 91 | $this->value['origin'] = 'standard'; |
| 93 | 92 | return true; |
| 94 | - } |
|
| 95 | - elseif (isset($custom_type)) { |
|
| 93 | + } elseif (isset($custom_type)) { |
|
| 96 | 94 | $this->value = $custom_type; |
| 97 | 95 | $resize_types = $this->getResizeTypes(); |
| 98 | 96 | $this->value['resize_type'] = $resize_types[$this->value['resize_type_key']]; |
| 99 | 97 | $this->value['origin'] = 'custom'; |
| 100 | 98 | return true; |
| 101 | - } |
|
| 102 | - else { |
|
| 99 | + } else { |
|
| 103 | 100 | $this->type_key = 0; |
| 104 | 101 | $this->value['type_key'] = 0; |
| 105 | 102 | return false; |
@@ -164,8 +161,7 @@ discard block |
||
| 164 | 161 | if ($this->type_key == 0 || $this->get('origin') == 'standard') { |
| 165 | 162 | if ($this->type_key == 0) { |
| 166 | 163 | $type_key = $this->getNextFreeTypeKey(); |
| 167 | - } |
|
| 168 | - else { |
|
| 164 | + } else { |
|
| 169 | 165 | $type_key = $this->type_key; |
| 170 | 166 | } |
| 171 | 167 | |
@@ -183,8 +179,7 @@ discard block |
||
| 183 | 179 | } |
| 184 | 180 | $this->type_key = $type_key; |
| 185 | 181 | return $this->type_key; |
| 186 | - } |
|
| 187 | - else { |
|
| 182 | + } else { |
|
| 188 | 183 | $result = $this->db->exec('UPDATE file_handler_instance_type SET '.$sql.' ' . |
| 189 | 184 | 'WHERE intranet_id = '.$this->db->quote($this->intranet_id, 'integer').' ' . |
| 190 | 185 | 'AND type_key = '.$this->db->quote($this->type_key, 'integer')); |
@@ -275,8 +270,7 @@ discard block |
||
| 275 | 270 | |
| 276 | 271 | if ($row['max_key'] >= InstanceManager::MIN_CUSTOM_TYPE_KEY_VALUE) { |
| 277 | 272 | return $row['max_key'] + 1; |
| 278 | - } |
|
| 279 | - else { |
|
| 273 | + } else { |
|
| 280 | 274 | return InstanceManager::MIN_CUSTOM_TYPE_KEY_VALUE; |
| 281 | 275 | } |
| 282 | 276 | } |
@@ -322,13 +316,11 @@ discard block |
||
| 322 | 316 | $type[$i]['resize_type'] = $resize_types[$type[$i]['resize_type_key']]; |
| 323 | 317 | $type[$i]['origin'] = 'overwritten'; |
| 324 | 318 | $c++; |
| 325 | - } |
|
| 326 | - else { |
|
| 319 | + } else { |
|
| 327 | 320 | $type[$i] = $standard_types[$s]; |
| 328 | 321 | $type[$i]['origin'] = 'standard'; |
| 329 | 322 | } |
| 330 | - } |
|
| 331 | - else { |
|
| 323 | + } else { |
|
| 332 | 324 | $type[$i] = $custom_types[$c]; |
| 333 | 325 | $type[$i]['resize_type'] = $resize_types[$type[$i]['resize_type_key']]; |
| 334 | 326 | $type[$i]['origin'] = 'custom'; |
@@ -386,8 +378,7 @@ discard block |
||
| 386 | 378 | if (!empty($key)) { |
| 387 | 379 | if (isset($this->value[$key])) { |
| 388 | 380 | return($this->value[$key]); |
| 389 | - } |
|
| 390 | - else { |
|
| 381 | + } else { |
|
| 391 | 382 | return ''; |
| 392 | 383 | } |
| 393 | 384 | } |
@@ -94,7 +94,9 @@ |
||
| 94 | 94 | */ |
| 95 | 95 | public function save($var, $user_id = 0) |
| 96 | 96 | {
|
| 97 | - if (empty($var)) return; |
|
| 97 | + if (empty($var)) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 98 | 100 | $var = safeToDb($var); |
| 99 | 101 | $user_id = intval($user_id); |
| 100 | 102 | |
@@ -228,8 +228,7 @@ |
||
| 228 | 228 | // Remove each file in this Directory |
| 229 | 229 | unlink($file); |
| 230 | 230 | echo "Removed File: " . $file . "<br>"; |
| 231 | - } |
|
| 232 | - else if (is_dir($file) === TRUE) {
|
|
| 231 | + } else if (is_dir($file) === TRUE) {
|
|
| 233 | 232 | // If this Directory contains a Subdirectory, run this Function on it |
| 234 | 233 | removeDir($file); |
| 235 | 234 | } |