@@ -64,6 +64,12 @@ class fcpayone_main extends fcpayone_admindetails
64
64
*/
65
65
protected $ _aCountryList = array ();
66
66
67
+ /**
68
+ * List of config errors encountered
69
+ * @var array
70
+ */
71
+ protected $ _aConfErrors = null ;
72
+
67
73
/**
68
74
* Set of default config strings
69
75
*
@@ -309,6 +315,12 @@ public function fcpoGetCountryList()
309
315
*/
310
316
public function save ()
311
317
{
318
+ $ blValid = $ this ->_fcpoValidateData ();
319
+
320
+ if (!$ blValid ) {
321
+ return ;
322
+ }
323
+
312
324
$ oConfig = $ this ->_oFcpoHelper ->fcpoGetConfig ();
313
325
$ aConfBools = $ this ->_oFcpoHelper ->fcpoGetRequestParameter ("confbools " );
314
326
$ aConfStrs = $ this ->_oFcpoHelper ->fcpoGetRequestParameter ("confstrs " );
@@ -359,6 +371,66 @@ public function save()
359
371
$ this ->_fcpoLoadConfigs ($ sOxid );
360
372
}
361
373
374
+ /**
375
+ * Returns collected errors
376
+ *
377
+ * @param void
378
+ * @return mixed array|false
379
+ */
380
+ public function fcpoGetConfigErrors ()
381
+ {
382
+ if (!is_array ($ this ->_aConfErrors )) {
383
+ return false ;
384
+ }
385
+
386
+ return $ this ->_aConfErrors ;
387
+ }
388
+
389
+ /**
390
+ * Validation of entered configuration values
391
+ *
392
+ * @param void
393
+ * @return bool
394
+ */
395
+ protected function _fcpoValidateData ()
396
+ {
397
+ $ blValidAccountData = $ this ->_fcpoValidateAccountData ();
398
+
399
+ $ blValid = (
400
+ $ blValidAccountData
401
+ );
402
+
403
+ return $ blValid ;
404
+ }
405
+
406
+ /**
407
+ * Checks accountdata section on errors
408
+ *
409
+ * @param void
410
+ * @return bool
411
+ */
412
+ protected function _fcpoValidateAccountData ()
413
+ {
414
+ return true ;
415
+ }
416
+
417
+ /**
418
+ * Adding a detected configuration error
419
+ *
420
+ * @param $sTranslationString
421
+ * @return void
422
+ */
423
+ protected function _fcpoAddConfigError ($ sTranslationString )
424
+ {
425
+ $ oLang = $ this ->_oFcpoHelper ->fcpoGetLang ();
426
+ $ sMessage = $ oLang ->translateString ($ sTranslationString );
427
+
428
+ if (!is_array ($ this ->_aConfErrors )) {
429
+ $ this ->_aConfErrors = array ();
430
+ }
431
+ $ this ->_aConfErrors [] = $ sMessage ;
432
+ }
433
+
362
434
/**
363
435
* Loads list of countries
364
436
*
0 commit comments