From: <lin...@us...> - 2010-04-30 10:57:41
|
Revision: 3435 http://web-erp.svn.sourceforge.net/web-erp/?rev=3435&view=rev Author: lindsayh Date: 2010-04-30 10:57:35 +0000 (Fri, 30 Apr 2010) Log Message: ----------- Made the installation function work. This included: Correcting email syntax check regular expressions Ensure that the SQL script interpreter does not execute CREATE DATABASE and USE commands from install scripts (it puts things in the wrong DB) Add PCtabs to install and demo SQL scripts - not sure what else may be missing Make weberpdemo the default database name Correct SQL to set the admin account password Modified Paths: -------------- trunk/PcReportTab.php trunk/Z_MakeNewCompany.php trunk/doc/Change.log.html trunk/install/index.php trunk/install/save.php trunk/sql/mysql/weberp-demo.sql trunk/sql/mysql/weberp-new.sql Modified: trunk/PcReportTab.php =================================================================== --- trunk/PcReportTab.php 2010-04-29 16:08:41 UTC (rev 3434) +++ trunk/PcReportTab.php 2010-04-30 10:57:35 UTC (rev 3435) @@ -32,8 +32,6 @@ echo '<table>'; echo '<tr><td>' . _('Code Of Petty Cash Tab') . ":</td><td><select name='SelectedTabs'>"; - DB_free_result($result); - if ($_SESSION['AccessLevel'] >= 15){ // superuser can supervise the supervisors $SQL = "SELECT tabcode FROM pctabs @@ -56,7 +54,9 @@ } //end while loop get type of tab + DB_free_result($result); + echo '</select></td></tr>'; echo'<tr><td>' . _('From Date :') . '</td><td>'; echo '<input tabindex="2" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="TEXT" name="FromDate" maxlength="10" size="11" VALUE="' . $_POST['FromDate'] . '">'; Modified: trunk/Z_MakeNewCompany.php =================================================================== --- trunk/Z_MakeNewCompany.php 2010-04-29 16:08:41 UTC (rev 3434) +++ trunk/Z_MakeNewCompany.php 2010-04-30 10:57:35 UTC (rev 3435) @@ -93,7 +93,7 @@ mysqli_select_db($db,$_POST['NewCompany']); $SQLScriptFile = file('./sql/mysql/weberp-new.sql'); } - + $ScriptFileEntries = sizeof($SQLScriptFile); $ErrMsg = _('The script to create the new company database failed because'); $SQL =''; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-04-29 16:08:41 UTC (rev 3434) +++ trunk/doc/Change.log.html 2010-04-30 10:57:35 UTC (rev 3435) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>30/04/10 Lindsay: Make installation operation functional again <p>29/04/10 Tim Schofield: SelectOrderItems.php : Ensure PO line number is carried through from quck entry screen.</p> <p>29/04/10 Tim Schofield: SelectOrderItems.php : LastCustomer was not being initialised.</p> <p>28/04/10 Tim Schofield: MiscFunctions.php : Fix currency download for when there is no internat connection.</p> Modified: trunk/install/index.php =================================================================== --- trunk/install/index.php 2010-04-29 16:08:41 UTC (rev 3434) +++ trunk/install/index.php 2010-04-30 10:57:35 UTC (rev 3435) @@ -141,10 +141,8 @@ </td> <td style="color: #666666;"><?php echo 'Company data dirs ('. $comp_path. '/*)'; ?> </td> - <td><?php if(is_writable($comp_path) && is_writable($comp_path.'/weberpdemo') && is_writable($comp_path.'/weberpdemo/part_pics')) { + <td><?php if(is_writable($comp_path)) { echo '<font class="good">Writeable</font>'; - } elseif(!file_exists($comp_path)) { - echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } @@ -257,7 +255,7 @@ <tr> <td style="color: #666666;" colspan="1">Company Name:</td> <td colspan="4"> - <input type="text" tabindex="13" name="company_name" style="width: 99%;" value="<?php if(isset($_SESSION['company_name'])) { echo $_SESSION['company_name']; } else { echo 'weberp'; } ?>" /> + <input type="text" tabindex="13" name="company_name" style="width: 99%;" value="<?php if(isset($_SESSION['company_name'])) { echo $_SESSION['company_name']; } else { echo 'weberpdemo'; } ?>" /> </td> </tr> <tr> Modified: trunk/install/save.php =================================================================== --- trunk/install/save.php 2010-04-29 16:08:41 UTC (rev 3434) +++ trunk/install/save.php 2010-04-30 10:57:35 UTC (rev 3435) @@ -104,7 +104,7 @@ } function is_valid_email($email) { - return preg_match("/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9_-.]+.[a-zA-Z]+/", $email) > 0; + return preg_match("/[a-zA-Z0-9_.+-]+@[a-zA-Z0-9_.-]+.[a-zA-Z]+/", $email) > 0; } if (isset($_POST['path_to_root'])) { @@ -312,14 +312,13 @@ //need to drop any pre-existing weberpdemo database mysqli_query($db, "DROP DATABASE 'weberpdemo'"); } else { //creating a new database with no demo data - mysqli_query($db, 'CREATE DATABASE IF NOT EXISTS `' . mysqli_real_escape_string($db, $_POST['company_name']) . '`'); - mysqli_select_db($db, $_POST['company_name']); $SQLScriptFile = file($path_to_root . '/sql/mysql/weberp-new.sql'); } + mysqli_query($db, 'CREATE DATABASE IF NOT EXISTS `' . mysqli_real_escape_string($db, $_POST['company_name']) . '`'); + mysqli_select_db($db, $_POST['company_name']); $ScriptFileEntries = sizeof($SQLScriptFile); $SQL =''; $InAFunction = false; - for ($i=0; $i<$ScriptFileEntries; $i++) { $SQLScriptFile[$i] = trim($SQLScriptFile[$i]); @@ -339,9 +338,13 @@ $InAFunction = false; } if (strpos($SQLScriptFile[$i],';')>0 AND ! $InAFunction){ - $SQL = substr($SQL,0,strlen($SQL)-1); - $result = mysqli_query($db,$SQL); - $SQL=''; + // Database created above with correct name. + if (strncasecmp($SQL, ' CREATE DATABASE ', 17) + AND strncasecmp($SQL, ' USE ', 5)){ + $SQL = substr($SQL,0,strlen($SQL)-1); + $result = mysqli_query($db,$SQL); + } + $SQL = ''; } } //end if its a valid sql line not a comment @@ -350,12 +353,12 @@ $sql = "UPDATE www_users SET password = '" . sha1($_POST['admin_password']) . "', email = '".mysqli_real_escape_string($db, $_POST['admin_email']) ."' - WHERE user_id = 'admin'"; -mysqli_query($db,$sql); + WHERE userid = 'admin'"; +$result = mysqli_query($db,$sql); $sql = "UPDATE companies SET coyname = '". mysqli_real_escape_string($db, $_POST['company_name']) . "' WHERE coycode = 1"; -mysqli_query($db,$sql); +$result = mysqli_query($db,$sql); session_unset(); session_destroy(); Modified: trunk/sql/mysql/weberp-demo.sql =================================================================== --- trunk/sql/mysql/weberp-demo.sql 2010-04-29 16:08:41 UTC (rev 3434) +++ trunk/sql/mysql/weberp-demo.sql 2010-04-30 10:57:35 UTC (rev 3435) @@ -1,6 +1,7 @@ CREATE DATABASE IF NOT EXISTS weberpdemo DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; USE weberpdemo; +SET FOREIGN_KEY_CHECKS=0; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -969,6 +970,73 @@ /*!40101 SET character_set_client = @saved_cs_client */; +CREATE TABLE IF NOT EXISTS `pcashdetails` ( + `counterindex` int(20) NOT NULL AUTO_INCREMENT, + `tabcode` varchar(20) NOT NULL, + `date` date NOT NULL, + `codeexpense` varchar(20) NOT NULL, + `amount` double NOT NULL, + `authorized` date NOT NULL COMMENT 'date cash assigment was revised and authorized by authorizer from tabs table', + `posted` tinyint(4) NOT NULL COMMENT 'has (or has not) been posted into gltrans', + `notes` text NOT NULL, + `receipt` text COMMENT 'filename or path to scanned receipt or code of receipt to find physical receipt if tax guys or auditors show up', + PRIMARY KEY (`counterindex`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + + +CREATE TABLE IF NOT EXISTS `pcexpenses` ( + `codeexpense` varchar(20) NOT NULL COMMENT 'code for the group', + `description` varchar(50) NOT NULL COMMENT 'text description, e.g. meals, train tickets, fuel, etc', + `glaccount` int(11) NOT NULL COMMENT 'GL related account', + PRIMARY KEY (`codeexpense`), + KEY (`glaccount`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE IF NOT EXISTS `pctabexpenses` ( + `typetabcode` varchar(20) NOT NULL, + `codeexpense` varchar(20) NOT NULL, + KEY (`typetabcode`), + KEY (`codeexpense`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `pctabs` ( + `tabcode` varchar(20) NOT NULL, + `usercode` varchar(20) NOT NULL COMMENT 'code of user employee from www_users', + `typetabcode` varchar(20) NOT NULL, + `currency` char(3) NOT NULL, + `tablimit` double NOT NULL, + `authorizer` varchar(20) NOT NULL COMMENT 'code of user from www_users', + `glaccountassignment` int(11) NOT NULL COMMENT 'gl account where the money comes from', + `glaccountpcash` int(11) NOT NULL, + PRIMARY KEY (`tabcode`), + KEY (`usercode`), + KEY (`typetabcode`), + KEY (`currency`), + KEY (`authorizer`), + KEY (`glaccountassignment`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `pctypetabs` ( + `typetabcode` varchar(20) NOT NULL COMMENT 'code for the type of petty cash tab', + `typetabdescription` varchar(50) NOT NULL COMMENT 'text description, e.g. tab for CEO', + PRIMARY KEY (`typetabcode`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE `pcexpenses` + ADD CONSTRAINT `pcexpenses_ibfk_1` FOREIGN KEY (`glaccount`) REFERENCES `chartmaster` (`accountcode`); + +ALTER TABLE `pctabexpenses` + ADD CONSTRAINT `pctabexpenses_ibfk_1` FOREIGN KEY (`typetabcode`) REFERENCES `pctypetabs` (`typetabcode`), + ADD CONSTRAINT `pctabexpenses_ibfk_2` FOREIGN KEY (`codeexpense`) REFERENCES `pcexpenses` (`codeexpense`); + +ALTER TABLE `pctabs` + ADD CONSTRAINT `pctabs_ibfk_1` FOREIGN KEY (`usercode`) REFERENCES `www_users` (`userid`), + ADD CONSTRAINT `pctabs_ibfk_2` FOREIGN KEY (`typetabcode`) REFERENCES `pctypetabs` (`typetabcode`), + ADD CONSTRAINT `pctabs_ibfk_3` FOREIGN KEY (`currency`) REFERENCES `currencies` (`currabrev`), + ADD CONSTRAINT `pctabs_ibfk_4` FOREIGN KEY (`authorizer`) REFERENCES `www_users` (`userid`), + ADD CONSTRAINT `pctabs_ibfk_5` FOREIGN KEY (`glaccountassignment`) REFERENCES `chartmaster` (`accountcode`); + /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `periods` ( @@ -7075,3 +7143,4 @@ /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +SET FOREIGN_KEY_CHECKS=1; Modified: trunk/sql/mysql/weberp-new.sql =================================================================== --- trunk/sql/mysql/weberp-new.sql 2010-04-29 16:08:41 UTC (rev 3434) +++ trunk/sql/mysql/weberp-new.sql 2010-04-30 10:57:35 UTC (rev 3435) @@ -971,6 +971,73 @@ /*!40101 SET character_set_client = @saved_cs_client */; +CREATE TABLE IF NOT EXISTS `pcashdetails` ( + `counterindex` int(20) NOT NULL AUTO_INCREMENT, + `tabcode` varchar(20) NOT NULL, + `date` date NOT NULL, + `codeexpense` varchar(20) NOT NULL, + `amount` double NOT NULL, + `authorized` date NOT NULL COMMENT 'date cash assigment was revised and authorized by authorizer from tabs table', + `posted` tinyint(4) NOT NULL COMMENT 'has (or has not) been posted into gltrans', + `notes` text NOT NULL, + `receipt` text COMMENT 'filename or path to scanned receipt or code of receipt to find physical receipt if tax guys or auditors show up', + PRIMARY KEY (`counterindex`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + + +CREATE TABLE IF NOT EXISTS `pcexpenses` ( + `codeexpense` varchar(20) NOT NULL COMMENT 'code for the group', + `description` varchar(50) NOT NULL COMMENT 'text description, e.g. meals, train tickets, fuel, etc', + `glaccount` int(11) NOT NULL COMMENT 'GL related account', + PRIMARY KEY (`codeexpense`), + KEY (`glaccount`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE IF NOT EXISTS `pctabexpenses` ( + `typetabcode` varchar(20) NOT NULL, + `codeexpense` varchar(20) NOT NULL, + KEY (`typetabcode`), + KEY (`codeexpense`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `pctabs` ( + `tabcode` varchar(20) NOT NULL, + `usercode` varchar(20) NOT NULL COMMENT 'code of user employee from www_users', + `typetabcode` varchar(20) NOT NULL, + `currency` char(3) NOT NULL, + `tablimit` double NOT NULL, + `authorizer` varchar(20) NOT NULL COMMENT 'code of user from www_users', + `glaccountassignment` int(11) NOT NULL COMMENT 'gl account where the money comes from', + `glaccountpcash` int(11) NOT NULL, + PRIMARY KEY (`tabcode`), + KEY (`usercode`), + KEY (`typetabcode`), + KEY (`currency`), + KEY (`authorizer`), + KEY (`glaccountassignment`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `pctypetabs` ( + `typetabcode` varchar(20) NOT NULL COMMENT 'code for the type of petty cash tab', + `typetabdescription` varchar(50) NOT NULL COMMENT 'text description, e.g. tab for CEO', + PRIMARY KEY (`typetabcode`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE `pcexpenses` + ADD CONSTRAINT `pcexpenses_ibfk_1` FOREIGN KEY (`glaccount`) REFERENCES `chartmaster` (`accountcode`); + +ALTER TABLE `pctabexpenses` + ADD CONSTRAINT `pctabexpenses_ibfk_1` FOREIGN KEY (`typetabcode`) REFERENCES `pctypetabs` (`typetabcode`), + ADD CONSTRAINT `pctabexpenses_ibfk_2` FOREIGN KEY (`codeexpense`) REFERENCES `pcexpenses` (`codeexpense`); + +ALTER TABLE `pctabs` + ADD CONSTRAINT `pctabs_ibfk_1` FOREIGN KEY (`usercode`) REFERENCES `www_users` (`userid`), + ADD CONSTRAINT `pctabs_ibfk_2` FOREIGN KEY (`typetabcode`) REFERENCES `pctypetabs` (`typetabcode`), + ADD CONSTRAINT `pctabs_ibfk_3` FOREIGN KEY (`currency`) REFERENCES `currencies` (`currabrev`), + ADD CONSTRAINT `pctabs_ibfk_4` FOREIGN KEY (`authorizer`) REFERENCES `www_users` (`userid`), + ADD CONSTRAINT `pctabs_ibfk_5` FOREIGN KEY (`glaccountassignment`) REFERENCES `chartmaster` (`accountcode`); + /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `periods` ( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |