Example #1
0
    $result = DB_query($sql, $db);
    if (DB_num_rows($result) > 0) {
        $response = executeSQL("UPDATE fixedassets INNER JOIN stockmaster ON fixedassets.stockid=stockmaster.stockid SET assetcategoryid=stockmaster.categoryid,\nfixedassets.description=stockmaster.description, fixedassets.longdescription=stockmaster.longdescription", $db, False);
        if ($response == 0) {
            OutputResult(_('The fixedassets table has been updated from stockmaster'), 'success');
        } else {
            OutputResult(_('The fixedassets table could not be updated from stockmaster'), 'error');
        }
    } else {
        OutputResult(_('The fixedassets table is already correct'), 'info');
    }
} else {
    $response = executeSQL("UPDATE fixedassets INNER JOIN stockmaster ON fixedassets.stockid=stockmaster.stockid SET assetcategoryid=stockmaster.categoryid,\nfixedassets.description=stockmaster.description, fixedassets.longdescription=stockmaster.longdescription", $db, False);
}
Createtable('fixedassetcategories', "CREATE TABLE IF NOT EXISTS `fixedassetcategories` (\n  `categoryid` char(6) NOT NULL DEFAULT '',\n  `categorydescription` char(20) NOT NULL DEFAULT '',\n  `costact` int(11) NOT NULL DEFAULT '0',\n  `depnact` int(11) NOT NULL DEFAULT '0',\n  `disposalact` int(11) NOT NULL DEFAULT '80000',\n  `accumdepnact` int(11) NOT NULL DEFAULT '0',\n  defaultdepnrate double NOT NULL DEFAULT '.2',\n  defaultdepntype int NOT NULL DEFAULT '1',\n  PRIMARY KEY (`categoryid`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8", $db);
if (DB_table_exists('fixedassets', $db)) {
    $sql = "SELECT categoryid FROM fixedassetcategories";
    $result = DB_query($sql, $db);
    if (DB_num_rows($result) == 0) {
        $response = executeSQL("INSERT INTO fixedassetcategories (categoryid, categorydescription, costact, depnact, disposalact, accumdepnact)\nSELECT categoryid, categorydescription, stockact, adjglact, materialuseagevarac, wipact FROM stockcategory WHERE stocktype='A'", $db, False);
        if ($response == 0) {
            OutputResult(_('The fixedassetcategories table has been updated from stockcategory'), 'success');
        } else {
            OutputResult(_('The fixedassetcategories table could not be updated from stockcategory'), 'error');
        }
    } else {
        OutputResult(_('The fixedassetcategories table is already correct'), 'info');
    }
} else {
    $response = executeSQL("INSERT INTO fixedassetcategories (categoryid, categorydescription, costact, depnact, disposalact, accumdepnact)\nSELECT categoryid, categorydescription, stockact, adjglact, materialuseagevarac, wipact FROM stockcategory WHERE stocktype='A'", $db, False);
}
Example #2
0
 $ConfigResult = DB_query($sql, $db, $ErrMsg);
 while ($myrow = DB_fetch_row($ConfigResult)) {
     if (is_numeric($myrow[1]) and $myrow[0] != 'DefaultPriceList') {
         //the variable name is given by $myrow[0]
         $_SESSION[$myrow[0]] = (double) $myrow[1];
     } else {
         $_SESSION[$myrow[0]] = $myrow[1];
     }
 }
 //end loop through all config variables
 $_SESSION['CompanyDefaultsLoaded'] = true;
 DB_free_result($ConfigResult);
 // no longer needed
 /*Maybe we should check config directories exist and try to create if not */
 /*Load the pagesecurity settings from the database */
 if (DB_table_exists('pagesecurity', $db)) {
     $sql = "SELECT script, security FROM pagesecurity";
     $ErrMsg = _('Could not get the page security details from the database because');
     $result = DB_query($sql, $db);
     while ($myrow = DB_fetch_array($result)) {
         $_SESSION['PageSecurityArray'][$myrow['script']] = $myrow['security'];
     }
 } else {
     header('Location: Z_UpgradeDatabase.php');
     //divert to the db upgrade if the table doesn't exist
 }
 if (!isset($_SESSION['DBUpdateNumber'])) {
     // the config record for VersionNumber is not yet added
     $_SESSION['DBUpdateNumber'] = -1;
     header('Location: Z_UpgradeDatabase.php');
     //divert to the db upgrade if the VersionNumber is not in the config table
Example #3
0
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(175, 'PC Tabs', 173, 'PcTabs.php?'), array('id', 'caption', 'parent', 'href'), array(175, 'PC Tabs', 173, 'PcTabs.php?'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(176, 'PC Expenses', 173, 'PcExpenses.php?'), array('id', 'caption', 'parent', 'href'), array(176, 'PC Expenses', 173, 'PcExpenses.php?'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(177, 'Expenses for Type of PC Tab', 173, 'PcExpensesTypeTab.php?'), array('id', 'caption', 'parent', 'href'), array(177, 'Expenses for Type of PC Tab', 173, 'PcExpensesTypeTab.php?'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(178, 'Configuration', -1, '#'), array('id', 'caption', 'parent', 'href'), array(178, 'Configuration', -1, '#'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(179, 'General Settings', 178, '#'), array('id', 'caption', 'parent', 'href'), array(179, 'General Settings', 178, '#'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(180, 'Company Preferences', 179, 'CompanyPreferences.php?'), array('id', 'caption', 'parent', 'href'), array(180, 'Company Preferences', 179, 'CompanyPreferences.php?'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(181, 'Configuration Settings', 179, 'SystemParameters.php?'), array('id', 'caption', 'parent', 'href'), array(181, 'Configuration Settings', 179, 'SystemParameters.php?'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(188, 'Page Security Settings', 179, 'PageSecurity.php?'), array('id', 'caption', 'parent', 'href'), array(188, 'Page Security Settings', 179, 'PageSecurity.php?'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(182, 'Users', 178, '#'), array('id', 'caption', 'parent', 'href'), array(182, 'Users', 178, '#'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(183, 'User Maintenance', 182, 'WWW_Users.php?'), array('id', 'caption', 'parent', 'href'), array(183, 'User Maintenance', 182, 'WWW_Users.php?'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(184, 'Role Permissions', 182, 'WWW_Access.php?'), array('id', 'caption', 'parent', 'href'), array(184, 'Role Permissions', 182, 'WWW_Access.php?'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(185, 'Menu Access Rights', 182, 'MenuAccess.php?'), array('id', 'caption', 'parent', 'href'), array(185, 'Menu Access Rights', 182, 'MenuAccess.php?'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(186, 'General Ledger Setup', 178, '#'), array('id', 'caption', 'parent', 'href'), array(186, 'General Ledger Setup', 178, '#'), $db);
InsertRecord('menu', array('id', 'caption', 'parent', 'href'), array(187, 'Bank Accounts', 186, 'BankAccounts.php?'), array('id', 'caption', 'parent', 'href'), array(187, 'Bank Accounts', 186, 'BankAccounts.php?'), $db);
CreateTable('usermenurights', "CREATE TABLE `usermenurights` (\n\t`userid` varchar(20) NOT NULL DEFAULT '',\n\t`menuid` int(11) NOT NULL DEFAULT 0,\n\t`access` tinyint NOT NULL DEFAULT 1,\n\tPRIMARY KEY  (`userid`, `menuid`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8", $db);
if (DB_table_exists('usermenurights', $db)) {
    $sql = "select userid FROM usermenurights";
    $result = DB_query($sql, $db);
    if (DB_num_rows($result) == 0) {
        $response = executeSQL("INSERT INTO `usermenurights` (userid,menuid,access) SELECT www_users.userid,  menu.`id`, 1 FROM menu, www_users", $db, False);
        if ($response == 0) {
            OutputResult(_('The usermenurights table has been populated'), 'success');
        } else {
            OutputResult(_('The usermenurights table could not be populated'), 'error');
        }
    } else {
        OutputResult(_('The usermenurights table is already populated'), 'info');
    }
} else {
    $response = executeSQL("INSERT INTO `usermenurights` (userid,menuid,access) SELECT www_users.userid,  menu.`id`, 1 FROM menu, www_users", $db, False);
}