예제 #1
0
파일: scanning.php 프로젝트: phpsmith/IS4C
$sdepts = AutoLoader::listModules('SpecialDept');
$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;