Browse Source

DBG - select OD/DO

Piotr Labudda 4 years ago
parent
commit
107578e910
2 changed files with 438 additions and 0 deletions
  1. 408 0
      theme/assets/js/createTableSelectedStateObject.js
  2. 30 0
      theme/bocian.php

+ 408 - 0
theme/assets/js/createTableSelectedStateObject.js

@@ -0,0 +1,408 @@
+var DBG = DBG || false;
+var DBG1 = true;
+
+// if (!URI_WPS) throw "Missing URI_WPS";
+if (!KEY_PREFIX) return; // KEY_PREFIX = KRS | KRS/p | MSIG | MSIG/p | CEIDG
+if (!URL_BAZA_OD) throw "Missing URL_BAZA_OD";
+if (!URL_BAZA_DO) throw "Missing URL_BAZA_DO";
+if (!URL_BAZA_NONE) throw "Missing URL_BAZA_NONE";
+
+var BAZA_OD_DO = BAZA_OD_DO || false;
+BAZA_OD_DO = (BAZA_OD_DO === 'OD' || BAZA_OD_DO === 'DO') ? BAZA_OD_DO : '';
+// - `Bocian.biAuditForm.odFeatureKeys`: `["CEIDG.879134","KRS/p.4398202"]`
+// - `Bocian.biAuditForm.doFeatureKeys`: `["KRS.1533062","KRS/p.4616336"]`
+var LOCAL_STORAGE_KEY = (BAZA_OD_DO) ? 'Bocian.biAuditForm.' + BAZA_OD_DO.toLowerCase() + 'FeatureKeys' : null;
+DBG1 && console.log('DBG:', { BAZA_OD_DO, LOCAL_STORAGE_KEY, KEY_PREFIX })
+
+if (!global.p5VendorJs) throw "Missing p5 Vendor js libs";
+if (!global.p5VendorJs.Redux) throw "Missing p5 Vendor js lib: Redux";
+if (!global.swal) throw "Missing swal";
+if (!localStorage) throw "Missing localStorage!";
+var swal = global.swal;
+var Redux = global.p5VendorJs.Redux;
+var ReduxThunk = global.p5VendorJs.ReduxThunk;
+var createStoreWithThunkMiddleware = Redux.applyMiddleware(ReduxThunk)(Redux.createStore); // TODO: to vendor.js
+
+{ // from `tools/Bocian.php.addItemToRaport.js`
+	function getSelectedListLocalStorageKey(from) { // from: ( OD | DO )
+		switch (from) {
+			case 'OD': return 'Bocian.biAuditForm.odFeatureKeys';
+			case 'DO': return 'Bocian.biAuditForm.doFeatureKeys';
+			default: throw "Not implemented from selected list '" + from + "' - expected 'OD' or 'DO'";
+		}
+	}
+	function getSelectedListFromLocalStorage(from) {
+		var key = getSelectedListLocalStorageKey(from);
+		return JSON.parse( localStorage.getItem(key) || '[]' );
+	}
+	function saveToSelectedListInLocalStorage(from, featureKey) {
+		DBG && console.log("DBG::saveToSelectedListInLocalStorage(from, featureKey)", {from, featureKey}, {added: getSelectedListFromLocalStorage(from).concat(featureKey)});
+		var key = getSelectedListLocalStorageKey(from);
+		var newValue = getSelectedListFromLocalStorage(from).concat(featureKey)
+		newValue = Array.from(new Set(newValue))
+		localStorage.setItem(key, JSON.stringify(newValue))
+	}
+	function saveSelectedListInLocalStorage(from, listFeatureKey) {
+		DBG && console.log("DBG::saveSelectedListInLocalStorage(from, listFeatureKey)", {from, listFeatureKey}, {added: getSelectedListFromLocalStorage(from).concat(listFeatureKey)});
+		var key = getSelectedListLocalStorageKey(from);
+		// var newValue = getSelectedListFromLocalStorage(from).concat(listFeatureKey)
+		var newValue = listFeatureKey
+		localStorage.setItem(key, JSON.stringify(newValue))
+	}
+	function removeFromSelectedListInLocalStorage(from, featureKey) {
+		DBG && console.log("DBG::removeFromSelectedListInLocalStorage(from, featureKey)", {from, featureKey});
+		localStorage.setItem(getSelectedListLocalStorageKey(from), JSON.stringify(
+			getSelectedListFromLocalStorage(from).filter(function (item) {
+				return ( item !== featureKey );
+			})
+		))
+	}
+}
+function getCurrentBazaSelectedList(listPrimaryKeys, selected, prefix) {
+	// selected: (3) ["KRS/p.5872624", "KRS/p.4616336", "KRS.1533062"]
+	return listPrimaryKeys.filter(function (pk) {
+		return -1 !== selected.indexOf(prefix + '.' + pk);
+	})
+}
+
+function selectedStore(state, action) {
+	var prevState = state || { isLoading: false, selected: [], loading: [], listPrimaryKeys: [], totalSelected: 0 };
+	DBG1 && console.log('DBG::selectedStore', { prevState, action });
+	switch (action.type) {
+		case 'SET_CHECKED': return fixSelectAllInSelectedState(Object.assign({}, prevState, {
+			loading: p5Utils__arrayRemove(prevState.loading, action.primaryKey),
+			selected: prevState.selected.concat(action.primaryKey),
+			totalSelected: action.totalSelected,
+		}));
+		case 'SET_UNCHECKED': return fixSelectAllInSelectedState(Object.assign({}, prevState, {
+			loading: p5Utils__arrayRemove(prevState.loading, action.primaryKey),
+			selected: p5Utils__arrayRemove(prevState.selected, action.primaryKey),
+			totalSelected: action.totalSelected,
+		}));
+		case 'SET_LIST_CHECKED': return fixSelectAllInSelectedState(Object.assign({}, prevState, {
+			loading: [], // TODO: p5Utils__arrayExcept(prevState.loading, action.listPrimaryKeys),
+			selected: [].concat(action.listPrimaryKeys), // TODO: p5Utils__arrayUniqueUnion(prevState.selected, action.listPrimaryKeys)
+			totalSelected: action.totalSelected,
+		}));
+		case 'SET_LIST_UNCHECKED': return fixSelectAllInSelectedState(Object.assign({}, prevState, {
+			loading: [], // TODO: p5Utils__arrayExcept(prevState.loading, action.listPrimaryKeys),
+			selected: [], // TODO: p5Utils__arrayUniqueUnion(prevState.selected, action.listPrimaryKeys)
+			totalSelected: action.totalSelected,
+		}));
+		case 'SET_LOADING': return Object.assign(prevState, {
+			loading: prevState.loading.concat(action.primaryKey)
+		});
+		case 'SET_LIST_LOADING': return Object.assign(prevState, {
+			loading: [].concat(action.listPrimaryKeys)
+		});
+		case 'SET_PRIMARY_KEYS': return fixSelectAllInSelectedState(Object.assign({}, prevState, {
+			listPrimaryKeys: [].concat(action.listPrimaryKeys),
+			loading: [].concat(action.listPrimaryKeys)
+		}));
+		// case 'SET_ERROR_MSG': return Object.assign(prevState, {
+		// 	errorMsg: action.errorMsg
+		// });
+		default: return prevState;
+	}
+}
+function fixSelectAllInSelectedState(state) {
+	var len = state.listPrimaryKeys.length;
+	var selLen = state.selected.length;
+	var isAllSelected = ( len > 0 && selLen >= len ); // selected array may contain 'select-all'
+	for (var i = 0, pk = ''; i < len; i++) {
+		pk = state.listPrimaryKeys[i];
+		if (-1 === state.selected.indexOf(pk)) {
+			isAllSelected = false;
+			break;
+		}
+	}
+	// DBG1 && console.log('fixSelectAllInSelectedState', { isAllSelected, state });
+	var isSelectedSelectAll = ( -1 !== state.selected.indexOf('select-all') );
+	if (isAllSelected && !isSelectedSelectAll) return Object.assign(state, {
+		selected: ['select-all'].concat(state.selected)
+	});
+	if (!isAllSelected && isSelectedSelectAll) return Object.assign(state, {
+		selected: p5Utils__arrayRemove(state.selected, 'select-all'),
+	});
+	return state;
+}
+function p5Utils__arrayRemove(array, toRemoveItem) {
+	return array.filter(function (item) {
+		return ( item !== toRemoveItem );
+	});
+}
+
+var p5WPSUtils__createConvertToWpsDataInputFunction = function (identifier) {
+	return function (value) {
+		if (!value) return null; // WPS function require value, but for eg. featureQuery mey be empty
+		return { // "wps:Input"
+			identifier: identifier, // "ows:Identifier"
+			// title: "...", // "ows:Title"
+			data: { literalData: { value: value } }, // "wps:Data"
+			// reference: "???", // "wps:Reference"
+			// boundingBoxData: "???", // "wps:BoundingBoxData"
+		};
+	}
+};
+var p5WPSHelper_generateProcessSelectFeatureWithArgs = function (identifier, args) {
+	var dataInputs = Object.keys(args).reduce(function (ret, argName) {
+		var value = args[argName];
+		var convertValueToWpsDataInput = p5WPSUtils__createConvertToWpsDataInputFunction(argName);
+		return (p5Utils__isArray(value))
+			? ret.concat( value.map( convertValueToWpsDataInput ) )
+			: ret.concat([ convertValueToWpsDataInput(value) ])
+		;
+	}, []).filter(function (wpsTag) {
+		return !! wpsTag;
+	})
+	return {
+		identifier: identifier, // "ows:Identifier"
+		dataInputs: dataInputs,
+		responseForm: { // "wps:ResponseForm"
+			// rawDataOutput: "???", // "wps:RawDataOutput"
+			// responseDocument: "???", // "wps:ResponseDocument"
+		}
+	}
+}
+
+
+function selectedActions(idContext) {
+	var idContext = idContext || null;
+	function setChecked(primaryKey, totalSelected) {
+		return { type: 'SET_CHECKED', primaryKey: primaryKey, totalSelected: totalSelected }
+	}
+	function setUnchecked(primaryKey, totalSelected) {
+		return { type: 'SET_UNCHECKED', primaryKey: primaryKey, totalSelected: totalSelected }
+	}
+	function setLoading(primaryKey) {
+		return { type: 'SET_LOADING', primaryKey: primaryKey }
+	}
+	function setListChecked(listPrimaryKeys, totalSelected) {
+		return { type: 'SET_LIST_CHECKED', listPrimaryKeys: listPrimaryKeys, totalSelected: totalSelected }
+	}
+	function setListUnchecked(listPrimaryKeys, totalSelected) {
+		return { type: 'SET_LIST_UNCHECKED', listPrimaryKeys: listPrimaryKeys, totalSelected: totalSelected }
+	}
+	function setListLoading(listPrimaryKeys) {
+		return { type: 'SET_LIST_LOADING', listPrimaryKeys: listPrimaryKeys }
+	}
+	function setErrorMsg(errorMsg) {
+		return { type: 'SET_ERROR_MSG', errorMsg: errorMsg }
+	}
+	function toggle(namespace, primaryKey, checked) {
+		DBG1 && console.log('DBG::toggle action: (pks:['+primaryKey+'])...');
+		if ('select-all' === primaryKey) return toggleAll(namespace, checked);
+
+		return function(dispatch, getState) {
+			dispatch(setLoading(primaryKey));
+
+			return new Promise(function (resolve, reject) {
+				DBG1 && console.log('DBG::toggle action: (pks:['+primaryKey+'])...');
+
+				if (checked) {
+					saveToSelectedListInLocalStorage(BAZA_OD_DO, KEY_PREFIX + '.' + primaryKey)
+				} else {
+					removeFromSelectedListInLocalStorage(BAZA_OD_DO, KEY_PREFIX + '.' + primaryKey)
+				}
+
+				var selected = getSelectedListFromLocalStorage(BAZA_OD_DO)
+				DBG1 && console.log('DBG:setPrimaryKeys TODO read localStorage and setListChecked:', { selected, BAZA_OD_DO, LOCAL_STORAGE_KEY, KEY_PREFIX })
+
+				dispatch( checked ? setChecked(primaryKey, selected.length) : setUnchecked(primaryKey, selected.length) );
+			});
+		}
+	}
+	function setPrimaryKeys(namespace, listPrimaryKeys) { // TODO: should set list primaryKeys, change checkboxes to loading and fetch its state, then update gui
+		DBG1 && console.log('DBG::setPrimaryKeys action: (pks:['+listPrimaryKeys.join(',')+'])...');
+		return function(dispatch, getState) {
+			dispatch({ type: 'SET_PRIMARY_KEYS', listPrimaryKeys: listPrimaryKeys });
+			// dispatch( setListLoading(listPrimaryKeys) );
+			if (!listPrimaryKeys.length) return;
+
+			return new Promise(function (resolve, reject) {
+				DBG1 && console.log('DBG::setPrimaryKeys action: (pks:['+listPrimaryKeys.join(',')+'])...');
+
+				var selected = getSelectedListFromLocalStorage(BAZA_OD_DO)
+				// selected: (3) ["KRS/p.5872624", "KRS/p.4616336", "KRS.1533062"]
+				var curSelectedPK = getCurrentBazaSelectedList(listPrimaryKeys, selected, KEY_PREFIX)
+				DBG1 && console.log('DBG:setPrimaryKeys TODO read localStorage and setListChecked:', { selected, curSelectedPK, BAZA_OD_DO, LOCAL_STORAGE_KEY, KEY_PREFIX })
+
+				dispatch( setListChecked(curSelectedPK, selected.length) );
+			});
+		}
+	}
+	function toggleAll(namespace, checked) {
+		var primaryKey = 'select-all';
+		return function(dispatch, getState) {
+			dispatch(setLoading(primaryKey));
+			var state = getState();
+			var listPrimaryKeys = state.listPrimaryKeys;
+
+			return new Promise(function (resolve, reject) {
+				DBG1 && console.log('DBG::toggleAll action: (pks:['+listPrimaryKeys.join(',')+'])...');
+
+				var selected = getSelectedListFromLocalStorage(BAZA_OD_DO)
+				// selected: (3) ["KRS/p.5872624", "KRS/p.4616336", "KRS.1533062"]
+				var toAdd = listPrimaryKeys.map(function (pk) {
+					return KEY_PREFIX + '.' + pk;
+				}).filter(function (key) {
+					return (-1 === selected.indexOf(key));
+				})
+				DBG1 && console.log('DBG:setPrimaryKeys TODO read localStorage and setListChecked:', { selected, toAdd, BAZA_OD_DO, LOCAL_STORAGE_KEY, KEY_PREFIX })
+				var newSelected = new Set(selected)
+				listPrimaryKeys.map(function (pk) { return KEY_PREFIX + '.' + pk; }).forEach(function (key) {
+					(checked) ? newSelected.add(key) : newSelected.delete(key)
+				})
+				saveSelectedListInLocalStorage(BAZA_OD_DO, Array.from(newSelected))
+
+				selected = getSelectedListFromLocalStorage(BAZA_OD_DO)
+
+				dispatch( checked ? setListChecked(listPrimaryKeys, selected.length) : setListUnchecked(listPrimaryKeys, selected.length) );
+			});
+		}
+	}
+	function unselectAll(namespace) {
+		// dispatch(setLoading());
+		return function(dispatch, getState) {
+			// var reqArgs = { typeName: namespace };
+			// if (idContext) reqArgs.idContext = idContext;
+			// var reqPromise = p5WPS__unselecAllFeatures(reqArgs);
+			// return reqPromise.then(function (response) {
+			// 	DBG1 && console.log('DBG::setPrimaryKeys action: (pks:['+listPrimaryKeys.join(',')+']) dispatch success');
+			// 	// dispatch( setListChecked(response.selected, response.totalSelected) );
+			// 	dispatch( setListChecked([], 0) );
+			// }).catch(function (e) {
+			// 	p5UI__notifyAjaxCallback({type: 'error', msg: 'Wystąpił błąd #TA4: ' + e});
+			// 	DBG1 && console.warn('DBG::setPrimaryKeys action: (pks:['+listPrimaryKeys.join(',')+']) ERROR dispatch error');
+			// 	// var fullListPks = ['select-all'].concat(listPrimaryKeys)
+			// 	// dispatch( checked ? setListUnchecked(fullListPks) : setListChecked(fullListPks) );
+			// 	// dispatch( setErrorMsg(e) ); // TODO: show error with msg and refresh button
+			// 	// dispatch( setListLoading([]) );
+			// });
+			return new Promise(function (resolve, reject) {
+				DBG1 && console.log('DBG::unselectAll action: (pks:['+listPrimaryKeys.join(',')+'])...');
+				{
+					reject('TODO: unselectAll');
+					return;
+				}
+
+				// resolve();
+			});
+		};
+	}
+	function selectAllMatchingFilter(namespace, filterQuery) {
+		DBG1 && console.log('DBG::selectAllMatchingFilter', { filterQuery });
+		return function(dispatch, getState) {
+			DBG1 && console.log('DBG::selectAllMatchingFilter state', state);
+			var state = getState();
+			var listPrimaryKeys = state.listPrimaryKeys;
+
+			// var reqArgs = { typeName: namespace, primaryKey: listPrimaryKeys, filterQuery: filterQuery };
+			// if (idContext) reqArgs.idContext = idContext;
+			// return p5WPS__selectAllFeaturesMatchingFilter(reqArgs).then(function (listSelected) {
+			// 	DBG1 && console.log('DBG::selectAllMatchingFilter dispatch success');
+			// 	dispatch( setListChecked(listSelected.selected, listSelected.totalSelected) );
+			// }).catch(function (e) {
+			// 	p5UI__notifyAjaxCallback({type: 'error', msg: 'Wystąpił błąd #TA5: ' + e});
+			// 	DBG1 && console.warn('DBG::selectAllMatchingFilter ERROR dispatch error');
+			// 	// var fullListPks = ['select-all'].concat(listPrimaryKeys);
+			// 	// dispatch( setListUnchecked(fullListPks) );
+			// 	// dispatch( setErrorMsg(e) ); // TODO: show error with msg and refresh button
+			// 	dispatch( setListLoading([]) );
+			// });
+			return new Promise(function (resolve, reject) {
+				DBG1 && console.log('DBG::selectAllMatchingFilter action: (pks:['+listPrimaryKeys.join(',')+'])...');
+				{
+					reject('TODO: selectAllMatchingFilter');
+					return;
+				}
+
+				// resolve();
+			});
+		}
+	}
+	return {
+		setPrimaryKeys: setPrimaryKeys,
+		setChecked: setChecked,
+		setUnchecked: setUnchecked,
+		toggle: toggle,
+		unselectAll: unselectAll,
+		selectAllMatchingFilter: selectAllMatchingFilter,
+	}
+}
+
+function bocian_createTableSelectedStateObject(idContext) {
+	var _idContext = idContext || 0;
+	return {
+		store: createStoreWithThunkMiddleware(selectedStore),
+		actions: selectedActions(_idContext),
+	}
+}
+
+// TOOD: select OD/DO or default
+// swal({
+// 	title: 'Are you sure?',
+// 	text: "You won't be able to revert this!",
+// 	type: 'warning',
+// 	showCancelButton: true,
+// 	confirmButtonText: 'Yes, delete it!',
+// 	cancelButtonText: 'No, cancel!',
+// 	reverseButtons: true,
+// 	confirmButtonClass: 'btn btn-success',
+// 	cancelButtonClass: 'btn btn-danger',
+// 	buttonsStyling: false,
+// }).then((result) => {
+// 	if (result.value) {
+// 		DBG1 && console.log('DBG::setPrimaryKeys swal(value:'+result.value+') action: (pks:['+listPrimaryKeys.join(',')+'])');
+// 		// swalWithBootstrapButtons(
+// 		// 	'Deleted!',
+// 		// 	'Your file has been deleted.',
+// 		// 	'success'
+// 		// )
+// 	} else if (result.dismiss === swal.DismissReason.cancel) {
+// 		DBG1 && console.log('DBG::setPrimaryKeys swal(cancel) action: (pks:['+listPrimaryKeys.join(',')+'])');
+// 		// swalWithBootstrapButtons(
+// 		// 	'Cancelled',
+// 		// 	'Your imaginary file is safe :)',
+// 		// 	'error'
+// 		// )
+// 	} else {
+// 		DBG1 && console.log('DBG::setPrimaryKeys swal(else?) action: (pks:['+listPrimaryKeys.join(',')+'])');
+// 	}
+// })
+
+function _px(px) { return (!px) ? '0px' : '' + px + 'px'; }
+
+// var original_global__createTableSelectedStateObject = global.createTableSelectedStateObject; // to revert back to original
+{ // make fixed panel to select checkbox context OD, DO or default
+	var panelNode = document.createElement('div')
+	var panelWidth = 600;
+	panelNode.style.position = 'fixed';
+	panelNode.style.top = _px(0);
+	panelNode.style.width = _px(panelWidth);
+	panelNode.style.left = _px(window.innerWidth > panelWidth ? Math.floor(window.innerWidth / 2 - panelWidth / 2) : 0);
+	panelNode.style.padding = '8px 15px'
+	panelNode.style.textAlign = 'center'
+	panelNode.className = 'alert alert-info'
+	panelNode.style.boxShadow = '6px 6px 20px 0px #31708f'
+	// panelNode.style.border = '1px solid red'
+	// panelNode.style.padding = '6px'
+	// panelNode.style.backgroundColor = 'lightRed'
+	// panelNode.style.color = 'black'
+
+	panelNode.innerHTML = 'Wybierz elementy do raportu: ' +
+		'<div class="tblAjax__footer__toolbar__pagination" style="display:inline-block">' +
+			'<a class="btn btn-xs btn-default' + (BAZA_OD_DO === 'OD' ? ' active' : '') + '" href="' + URL_BAZA_OD + '">' + 'OD' + '</a>' +
+			' ' +
+			'<a class="btn btn-xs btn-default' + (BAZA_OD_DO === 'DO' ? ' active' : '') + '" href="' + URL_BAZA_DO + '">' + 'DO' + '</a>' +
+			' ' +
+			(!BAZA_OD_DO ? '' : '<a class="btn btn-xs btn-default" href="' + URL_BAZA_NONE + '">' + 'Anuluj' + '</a>') +
+		'</div>' +
+	'';
+	
+	document.body.appendChild(panelNode)
+}
+
+if (BAZA_OD_DO) {
+	global.createTableSelectedStateObject = bocian_createTableSelectedStateObject;
+}

+ 30 - 0
theme/bocian.php

@@ -64,6 +64,36 @@ class Theme_bocian extends ThemeDefault {
 			'URL_BI_AUDIT_RESULT' => Router::getRoute('UrlAction_BiAuditGenerate')->getLink(''),
 			'ID_ARG_BI_AUDIT_RESULT' => 'ID_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA'
 		]);
+
+
+		// override checkbox selecting for live select to localStorage - PROBLEM: how to choose OD/DO?
+		if ('ViewTableAjax' === V::get('_route', '', $_GET)
+			// TODO: what tables? maybe GET arg?
+			// && 'default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA' === V::get('namespace', '', $_GET)
+		) {
+			$keyPrefix = $this->_getKeyPrefixFromNamespace(V::get('namespace', '', $_GET));
+			if ($keyPrefix) {
+				UI::inlineJS(dirname(__FILE__) . '/assets/js/createTableSelectedStateObject.js', [
+					// 'URI_WPS' => Request::getPathUri() . 'wps.php',
+					'KEY_PREFIX' => $keyPrefix,
+					'BAZA_OD_DO' => V::get('BAZA_OD_DO', '', $_GET), // OD | DO | ''
+					'URL_BAZA_OD' => 'index.php?' . http_build_query(array_merge($_GET, [ 'BAZA_OD_DO' => 'OD' ])),
+					'URL_BAZA_DO' => 'index.php?' . http_build_query(array_merge($_GET, [ 'BAZA_OD_DO' => 'DO' ])),
+					'URL_BAZA_NONE' => 'index.php?' . http_build_query(array_merge($_GET, [ 'BAZA_OD_DO' => '' ])),
+					'DBG' => ('1' === V::get('DBG_JS', '', $_GET)),
+				]);
+			}
+		}
+	}
+	function _getKeyPrefixFromNamespace($ns) {
+		switch ($ns) {
+			case 'default_db/BI_audit_KRS/BI_audit_KRS': return 'KRS';
+			case 'default_db/BI_audit_KRS_person/BI_audit_KRS_person': return 'KRS/p';
+			case 'default_db/BI_audit_MSIG/BI_audit_MSIG': return 'MSIG';
+			case 'default_db/BI_audit_MSIG_person/BI_audit_MSIG_person': return 'MSIG/p';
+			case 'default_db/BI_audit_CEIDG/BI_audit_CEIDG': return 'CEIDG';
+			default: return '';
+		}
 	}
 
 	function login($data) {