예제 #1
0
파일: scanning.php 프로젝트: phpsmith/IS4C
$db = Database::pDataConnect();
$specialDeptMapExists = $db->table_exists('SpecialDeptMap');
$mapModel = new \COREPOS\pos\lib\models\op\SpecialDeptMapModel($db);
$sconf = CoreLocal::get('SpecialDeptMap');
/**
  If a mapping exists and the new table is available,
  migrate existing settings to the table and remove
  the setting from ini and/or ini-local
*/
if (is_array($sconf) && $specialDeptMapExists) {
    $mapModel->initTable($sconf);
    if (InstallUtilities::confExists('SpecialDeptMap')) {
        InstallUtilities::confRemove('SpecialDeptMap');
    }
    if (InstallUtilities::confExists('SpecialDeptMap', true)) {
        InstallUtilities::confRemove('SpecialDeptMap', true);
    }
}
if (!is_array($sconf)) {
    $sconf = array();
}
if (isset($_REQUEST['SDEPT_MAP_LIST'])) {
    if ($specialDeptMapExists) {
        $db->query('TRUNCATE TABLE SpecialDeptMap');
    } else {
        $sconf = array();
    }
    for ($i = 0; $i < count($_REQUEST['SDEPT_MAP_NAME']); $i++) {
        if (!isset($_REQUEST['SDEPT_MAP_LIST'][$i])) {
            continue;
        }
예제 #2
0
파일: CoreLocal.php 프로젝트: phpsmith/IS4C
 /**
   Examine configuration file. Extract settings
   that do not belong in the configuration file,
   write them to opdata.parameters, then remove
   them from the configuration file
 */
 public static function migrateSettings()
 {
     if (file_exists(dirname(__FILE__) . '/../../ini.php') && class_exists('InstallUtilities')) {
         $file = dirname(__FILE__) . '/../../ini.php';
         $settings = self::readIniPhp();
         foreach ($settings as $key => $value) {
             if (!in_array($key, self::$INI_SETTINGS)) {
                 if ($key == 'SpecialDeptMap') {
                     // SpecialDeptMap has a weird array structure
                     // and gets moved to a dedicated table
                     $db = Database::pDataConnect();
                     if ($db->table_exists('SpecialDeptMap')) {
                         $mapModel = new \COREPOS\pos\lib\models\op\SpecialDeptMapModel($db);
                         $mapModel->initTable($sconf);
                         InstallUtilities::confRemove($key);
                     }
                 } else {
                     // other settings go into opdata.parameters
                     $saved = InstallUtilities::paramSave($key, $value);
                     if ($saved && is_writable($file)) {
                         InstallUtilities::confRemove($key);
                     }
                 }
             }
         }
     }
 }