Przeglądaj źródła

Fix data source usage - TableAcl::getDataSource()

Piotr Labudda 10 lat temu
rodzic
commit
cde9aab9b6

+ 1 - 13
SE/se-lib/Przypomnij.php

@@ -663,19 +663,7 @@ if(V::get('DBG_P', '', $_GET) > 2){echo'<pre style="max-height:200px;overflow:au
 	private function getDataSource($tblAcl) {
 		$tblName = $tblAcl->getName();
 		if (!isset($this->_dSource[$tblName])) {
-			$this->_dSource[$tblName] = null;
-
-			Lib::loadClass('Data_Source');
-			$dataSource = new Data_Source($tblAcl->getDB());
-			$dataSource->setTable($tblAcl->getName());
-			$realFieldList = $tblAcl->getRealFieldList();
-			$dataSource->setCols($realFieldList);
-			$dataSource->setColTypes($tblAcl->getTypes());
-			$dataSource->setVirtualCols($tblAcl->getVirtualFieldList());
-			$dataSource->setFieldGroupWrite('A_ADM_COMPANY', $tblAcl->hasFieldType('A_ADM_COMPANY'));
-			$dataSource->setFieldGroupRead('A_CLASSIFIED', $tblAcl->hasFieldType('A_CLASSIFIED'));
-
-			$this->_dSource[$tblName] = $dataSource;
+			$this->_dSource[$tblName] = $tblAcl->getDataSource();
 		}
 
 		return $this->_dSource[$tblName];

+ 1 - 16
SE/superedit-AHMES_MNP.php

@@ -81,23 +81,8 @@ class Ahmes_Mnp {
 		$this->_korespAcl = $korespAcl;
 		$this->_zasobID = $tblAcl->getID();
 		Lib::loadClass('Data_Source');
-		$this->_dataSource = new Data_Source($tblAcl->getDB());
-		$this->_dataSource->setTable($tblAcl->getName());
-		$realFieldList = $tblAcl->getRealFieldList();
-		$this->_dataSource->setCols($realFieldList);
-		$this->_dataSource->setColTypes($tblAcl->getTypes());
-		$this->_dataSource->setVirtualCols($tblAcl->getVirtualFieldList());
-		$this->_dataSource->setFieldGroupWrite('A_ADM_COMPANY', $tblAcl->hasFieldType('A_ADM_COMPANY'));
-		$this->_dataSource->setFieldGroupRead('A_CLASSIFIED', $tblAcl->hasFieldType('A_CLASSIFIED'));
-		$this->_dataSource->setAccessFltrAllowed(!$tblAcl->hasSuperAccessPerms());
+		$this->_dataSource = $tblAcl->getDataSource();
 		$this->_htmlID = 'Ahmes_Mnp';
-
-		$adminFields = array('A_RECORD_CREATE_DATE', 'A_RECORD_CREATE_AUTHOR', 'A_RECORD_UPDATE_DATE', 'A_RECORD_UPDATE_AUTHOR');
-		foreach ($adminFields as $vAdmFld) {
-			if (!in_array($vAdmFld, $realFieldList) && $tblAcl->hasFieldType($vAdmFld)) {
-				$this->_dataSource->addCol($vAdmFld);
-			}
-		}
 	}
 
 	public function run() {

+ 1 - 17
SE/superedit-AHMES_REKLAMACJE.php

@@ -98,24 +98,8 @@ class Ahmes_Reklamacje {
 		$this->_acl = $tblAcl;
 		$this->_korespAcl = $korespAcl;
 		$this->_zasobID = $tblAcl->getID();
-		Lib::loadClass('Data_Source');
-		$this->_dataSource = new Data_Source($tblAcl->getDB());
-		$this->_dataSource->setTable($tblAcl->getName());
-		$realFieldList = $tblAcl->getRealFieldList();
-		$this->_dataSource->setCols($realFieldList);
-		$this->_dataSource->setColTypes($tblAcl->getTypes());
-		$this->_dataSource->setVirtualCols($tblAcl->getVirtualFieldList());
-		$this->_dataSource->setFieldGroupWrite('A_ADM_COMPANY', $tblAcl->hasFieldType('A_ADM_COMPANY'));
-		$this->_dataSource->setFieldGroupRead('A_CLASSIFIED', $tblAcl->hasFieldType('A_CLASSIFIED'));
-		$this->_dataSource->setAccessFltrAllowed(!$tblAcl->hasSuperAccessPerms());
+		$this->_dataSource = $tblAcl->getDataSource();
 		$this->_htmlID = 'Ahmes_Reklamacje';
-
-		$adminFields = array('A_RECORD_CREATE_DATE', 'A_RECORD_CREATE_AUTHOR', 'A_RECORD_UPDATE_DATE', 'A_RECORD_UPDATE_AUTHOR');
-		foreach ($adminFields as $vAdmFld) {
-			if (!in_array($vAdmFld, $realFieldList) && $tblAcl->hasFieldType($vAdmFld)) {
-				$this->_dataSource->addCol($vAdmFld);
-			}
-		}
 	}
 
 	public function run() {

+ 1 - 5
SE/superedit-DODAJ_WYNIK_ANKIETY_FUNC.php

@@ -26,11 +26,7 @@ $tblAcl->init($forceTblAclInit);
 
 if(V::get('DBG', '', $_GET)){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">tblAcl (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($tblAcl);echo'</pre>';}
 
-Lib::loadClass('Data_Source');
-$dataSource = new Data_Source($tblAcl->getDB());
-$dataSource->setTable($tblAcl->getName());
-$dataSource->setCols($tblAcl->getRealFieldList());
-$dataSource->setVirtualCols($tblAcl->getVirtualFieldList());
+$dataSource = $tblAcl->getDataSource();
 
 $cols = array();
 

+ 1 - 8
SE/superedit-POKAZ_OFERTY_AKTUALNE_FUNC.php

@@ -1815,14 +1815,7 @@ body {font:11px helvetica, arial;}
 		$forceTblAclInit = ('1' == V::get('_force', '', $_GET));
 		$tblAcl->init($forceTblAclInit);
 
-		Lib::loadClass('Data_Source');
-		$dataSource = new Data_Source($tblAcl->getDB());
-		$dataSource->setTable($tblAcl->getName());
-		$dataSource->setCols($tblAcl->getRealFieldList());
-		$dataSource->setColTypes($tblAcl->getTypes());
-		$dataSource->setVirtualCols($tblAcl->getVirtualFieldList());
-		$dataSource->setFieldGroupWrite('A_ADM_COMPANY', $tblAcl->hasFieldType('A_ADM_COMPANY'));
-		$dataSource->setFieldGroupRead('A_CLASSIFIED', $tblAcl->hasFieldType('A_CLASSIFIED'));
+		$dataSource = $tblAcl->getDataSource();
 
 		$cols = array();