Changeset 201
- Timestamp:
- 03/22/07 18:59:27
- Files:
-
- trunk/phpbms/common/stylesheet/mozilla/pages/install.css (modified) (1 diff)
- trunk/phpbms/install/install.php (modified) (7 diffs)
- trunk/phpbms/install/updatev0.7.sql (modified) (2 diffs)
- trunk/phpbms/install/updatexml.php (modified) (3 diffs)
- trunk/phpbms/menu.php (modified) (1 diff)
- trunk/phpbms/modules/base/adminsettings.php (modified) (1 diff)
- trunk/phpbms/modules/bms/include/invoices_addedit_include.php (modified) (2 diffs)
- trunk/phpbms/modules/bms/install/tablecolumns.sql (modified) (1 diff)
- trunk/phpbms/modules/bms/install/tabledefs.sql (modified) (previous)
- trunk/phpbms/modules/bms/install/update.php (modified) (11 diffs)
- trunk/phpbms/modules/bms/install/updatev0.70.sql (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phpbms/common/stylesheet/mozilla/pages/install.css
r166 r201 1 1 /* $Rev$ | $LastChangedBy$ */ 2 2 /* $LastChangedDate$ */ 3 #topTitle{} 4 #container{width:740px; margin:0 auto;} 3 #container{width:740px; margin:10px auto;} 5 4 p{margin:0;padding:0px 10px 10px;} 6 5 7 6 .results{width:98%;font-family:'Courier New', Courier, mono;font-size:13px;} 8 #modules{width:200px;}trunk/phpbms/install/install.php
r193 r201 52 52 <link href="../common/stylesheet/mozilla/base.css" rel="stylesheet" type="text/css" /> 53 53 <link href="../common/stylesheet/mozilla/pages/install.css" rel="stylesheet" type="text/css" /> 54 <script language="JavaScript" src="../common/javascript/moo/prototype.lite.js" type="text/javascript" ></script> 55 <script language="JavaScript" src="../common/javascript/moo/moo.fx.js" type="text/javascript" ></script> 56 <script language="JavaScript" src="../common/javascript/moo/moo.fx.pack.js" type="text/javascript" ></script> 54 57 <script language="JavaScript" src="../common/javascript/common.js" type="text/javascript"></script> 55 58 <script language="JavaScript" type="text/javascript"> … … 75 78 } 76 79 80 function enableModuleInstall(){ 81 var modules=getObjectFromID("modules"); 82 var installButton=getObjectFromID("installmodule"); 83 if(modules.value!=0) 84 installButton.disabled=false; 85 } 86 77 87 function runModuleInstall(){ 78 88 var themodule=getObjectFromID("modules"); … … 95 105 <div class="bodyline" id="container"> 96 106 <h1>phpBMS Installation</h1> 97 <p>Welcome to phpBMS. This page will guide you through the step of installing phpBMS, it's database, and included BMS module onto your web server. If you have any problems, questions or need help, please visit the <a href="http://www.phpbms.org">phpBMS Project web site </a>.</p> 98 <p> </p> 99 <h1>Server Requirements</h1> 100 <ul><li> 101 <p>MySQL 3.23.58 or higher</p> 102 </li> 103 <li> 104 <p>PHP 4.1.2 or higher</p> 105 </li> 106 <li> 107 <p>Web Server (Tested using Apache and IIS.)</p> 108 </li> 107 <h2>Server Requirements</h2> 108 <ul> 109 <li>MySQL 3.23.58 or higher</li> 110 <li>PHP 4.1.2 or higher</li> 111 <li>Web Server (Tested using Apache and IIS.)</li> 109 112 </ul> 110 113 111 <p> </p> 112 <h1>Browser Requirements</h1> 114 <h2>Browser Requirements</h2> 113 115 <p>see the <a href="../requirements.php">requirements page</a>.</p> 114 <p> </p> 115 <h1>Set Up The Database</h1> 116 117 <div class="box"> 118 <h2>Step 1 - Set Database Connection Information</h2> 119 <p>This step will require you to manually create the settings file. that is used by PHP to connect to your MySQL database. </p> 120 121 122 123 <h3> Create the settings.php File</h3> 124 <p>Make a copy the file <strong>defaultsettings.php</strong> (located in the web application root) and name the new file <strong>settings.php</strong>.</p> 125 <p> Next, modify the following parameters inside the settings.php file:</p> 116 117 <h2>Creating the data Back-End </h2> 118 119 <h3>Step 1 - Creating the settings.php file. </h3> 120 <p>Make a copy the file <strong>defaultsettings.php</strong> (located in the web application root) and name the new file <strong>settings.php</strong>. Next, modify the following parameters inside the settings.php file:</p> 126 121 <ul class="small"> 127 122 <li><p> … … 129 124 In most cases, this should be the same location as the web server, i.e. "localhost" 130 125 </p> 131 <p class="notes"><strong>Note:</strong> If your database server is different then your web server, make sure you take any necessary security precautions to secure transmission between the two servers.</p> 132 </li> 126 </li> 133 127 <li> 134 128 <p><strong>mysql_database</strong>: the name of the database to be used by phpBMS. <br /> 135 If the database has not been created, You can use <a href="#step2">step two</a> to create a new database for phpBMS.</p>129 If the database has not been created, You can use <a href="#step2">step two</a> to create a new database for phpBMS.</p> 136 130 </li> 137 131 <li> … … 139 133 </li> 140 134 <li> 141 <p><strong>mysql_userpass</strong>: the password for the user thataccess the database.</p>142 </li> 143 <li> 144 <p><strong>mysql_pconnect</strong>: specify whether php should use themysql_pconnect or mysql_connect command. Some web hosting providers do not allow mysql_pconnect.</p>135 <p><strong>mysql_userpass</strong>: the password for the user PHP will use to access the database.</p> 136 </li> 137 <li> 138 <p><strong>mysql_pconnect</strong>: ("true" or "false") This tells phpBMS to use either the PHP mysql_pconnect or mysql_connect command. Some web hosting providers do not allow mysql_pconnect.</p> 145 139 </li> 146 140 </ul> … … 153 147 </p> 154 148 155 <p><input type="button" value="Test Connection" class="Buttons" onclick="runCommand('testconnection')" /></p> 156 157 <h3>Connection Test Results</h3> 158 <p> 159 <textarea name="results" id="testconnectionresults" cols="40" rows="4" class="results"></textarea> 160 </p> 161 162 </div> 163 <div> </div> 164 165 166 167 168 <div class="box"> 169 <h2><a name="step2"></a>Step 2 - Create the Database</h2> 170 <p> 171 If you have already created the MySQL database that phpBMS will use, you can 172 skip to <a href="#step3">step three</a>. 173 </p> 174 <p>If you have not created the database, phpBMS can attempt to create the database for you.<br /> 175 The user that is specified in the settings.php file must 176 have sufficient privileges to create the database. 177 </p> 178 <p><input type="button" value="Create Database" class="Buttons" onclick="runCommand('createdatabase')" /></p> 179 <p class="notes"><strong>Note:</strong> Some ISPs limit the number of mySQL databases you are allowed, control 180 database creation through a web application, or allow changes on a request basis. If you are having problems,, try contacting your ISP.</p> 181 182 <h3>Database Creation Results</h3> 183 <p> 184 <textarea name="results" id="createdatabaseresults" cols="80" class="results"rows="4"></textarea> 185 </p> 186 187 </div> 188 <div> </div> 189 190 <div class="box"> 191 192 <h2>Step 3 - Construct Base System</h2> 193 <p> 194 Next, phpBMS needs to create the base level tables and populate the tables with the basic information that phpBMS needs to 195 work. 196 </p> 197 <p><input type="button" value="Create Tables and Populate Default Information" class="Buttons" onclick="runCommand('populatedata')" /></p> 198 <h3>Table Creation and Population Results</h3> 199 <p> 200 <textarea name="results" id="populatedataresults" class="results" cols="80" rows="10"></textarea> 201 </p> 202 <h3>Default User and Password</h3> 203 <p> 204 Upon successful creation of the tables and population of default data phpBMS is almost ready to run. 205 One of the records populated was the default administrator record. This information is required for the first successful login: 206 </p> 207 <blockquote class="large"> 208 username: <strong>admin</strong><br /> 209 password: <strong>phpbms</strong> 210 </blockquote> 211 <p class="notes"><strong>Note:</strong> Make sure to change the encryptions seed and password after the first successful login.</p> 212 </div> 213 214 215 <p> </p> 216 <h1 >Install Additional Modules </h1> 217 <div class="box"> 218 <p> 219 </p> 220 <p>The base phpBMS system contains <strong>only</strong> the bare framework, administration, and note/task/event capabilities. 221 Additional modules will add functionality such as client/prospect and product management, quote/order/invoice control, 222 and mass e-mailing. 223 </p> 224 <h3>Step 4 - Install Additional Modules</h3> 225 <p>To install a module, highlight the module form the list and click the "Install Selected Module" button.</p> 226 <p> 227 Select a module to install<br /> 228 <select size="4" id="modules" name="modules"> 229 <?php showModules()?> 230 </select> 231 </p> 232 <p> 233 <input type="button" id="installmodule" name="installmodule" value="Install Selected Module" class="Buttons" onclick="runModuleInstall()" /> 234 </p> 235 236 <h3>Module Installation Results</h3> 237 <p> 238 <textarea name="results" id="moduleresults" class="results" cols="80" rows="10"></textarea> 239 </p> 240 241 </div> 242 243 <p> </p> 244 <h1>Secure The Application</h1> 245 <div class="box"> 246 <p> </p> 149 <p><input type="button" value="Test Connection" class="Buttons" onclick="runCommand('testconnection')" /></p> 150 151 <h4>Connection Test Results</h4> 152 <p><textarea name="results" id="testconnectionresults" cols="40" rows="4" class="results"></textarea></p> 153 154 155 <h3><a name="step2"></a>Step 2 - Create the Database</h3> 156 <p>If the MySQL database that phpBMS will use already exists, skip to <a href="#step3">step three</a>. </p> 157 <p>If the MySQL database that phpBMS will use does not exist, phpBMS can attempt to create it.</p> 158 <p class="notes"><strong>Note:</strong> Some hosting companies limit the number of mySQL databases you are allowed, control database creation through a web application, or allow changes on a request basis. If you are having problems contact your hosting company.</p> 159 <p><input type="button" value="Create Database" class="Buttons" onclick="runCommand('createdatabase')" /></p> 160 161 <h4>Database Creation Results</h4> 162 <p><textarea name="results" id="createdatabaseresults" cols="80" class="results"rows="4"></textarea></p> 163 164 165 <h2>Step 3 - Construct the Base Modeule (phpBMS core) Data </h2> 166 <p><input type="button" value="Install Core Data" class="Buttons" onclick="runCommand('populatedata')" /></p> 167 <h4>Table Creation and Population Results</h4> 168 <p> 169 <textarea name="results" id="populatedataresults" class="results" cols="80" rows="10"></textarea> 170 </p> 171 <h3>Note the administrator login and password information. </h3> 172 <p class="notes"> Make sure to change the encryptions seed and password after the first successful login</p> 173 <blockquote class="large"> 174 login: <strong>admin</strong><br /> 175 password: <strong>phpbms</strong> 176 </blockquote> 177 <h2>Install Additional Modules </h2> 178 <h3>Step 4 - Install Additional Modules</h3> 179 <p>The base phpBMS system contains <strong>only</strong> the bare framework, administration, and note/task/event capabilities. Additional modules add functionality such as client and product management, sales orders, and mass e-mailing. </p> 180 <p>To install a module, highlight the module form the list and click the "Install Selected Module" button.</p> 181 <h4>Select a module to insall</h4> 182 <p><select id="modules" name="modules" onchange="enableModuleInstall()"><option value="0">Select a module to install...</option><?php showModules()?></select> <input type="button" id="installmodule" name="installmodule" value="Install Module" class="Buttons" onclick="runModuleInstall()" disabled="disabled"/></p> 183 184 <h4>Module Installation Results</h4> 185 <p> 186 <textarea name="results" id="moduleresults" class="results" cols="80" rows="10"></textarea> 187 </p> 188 189 190 <h2>Secure The Application</h2> 247 191 <p>phpBMS can contain sensitive information such as usernames, passwords, ,sensitive credit card information that could be exposed to the internet insecurely. 248 We recommend performing the following actions to secure phpBMS: 249 </p> 192 We recommend performing the following actions to secure phpBMS: </p> 250 193 <ul> 251 194 <li> … … 261 204 </li> 262 205 </ul> 263 </div> 264 <p> </p> 265 <h1>Complete the Installation</h1> 266 <div class="box"> 267 <h2>Step 5 Log In </h2> 268 <p>If all of the above actions completed successfully, phpBMS was installed successfully. </p> 269 <p>Navigate to log in screen, use the administrative user name password (above) and log in to finish the installation process. After logging in, you may want to go to the administration section, and set up the basic settings for your application as well as change the administrative username and password. </p> 270 <p><input type="button" id="login" name="login" value="Go to Log In Screen" class="Buttons" onclick="document.location='../'" /></p> 271 </div> 272 <p> </p> 273 <h1>Troubleshooting</h1> 274 <div class="box"> 275 <h2>General Help </h2> 276 <p> 277 If you ran into any problems during this installation, have question about how the program works, or would like any additional 278 information about phpBMS, please visit the <a href="http://www.phpbms.org">phpBMS Project web site</a>. The phpBMS project web site 279 has many resources to help you including a user wiki, users forum, and mailing list that can help you.</p> 280 <h2>Paid Customization, Installation, Support Options</h2> 281 <p>Paid technical support and phpBMS customization is available from <a href="http://www.kreotek.com">Kreotek</a>, </p> 282 </div> 206 <h2>Complete the Installation</h2> 207 <h3>Step 5 - Log In </h3> 208 <p>Check the result boxes to make sure that all of the above actions have completed succefully before trying to log in.</p> 209 <p><input type="button" id="login" name="login" value="Log In" class="Buttons" onclick="document.location='../'" /></p> 210 211 <h2>Troubleshooting</h2> 212 <h3>General Help </h3> 213 <p> 214 If you ran into any problems during this installation, have question about how the program works, or would like any additional 215 information about phpBMS, please visit the <a href="http://www.phpbms.org">phpBMS Project web site</a>. The phpBMS project web site 216 has many resources to help you including a user wiki, users forum, and mailing list that can help you.</p> 217 <h3>Paid Customization, Installation, Support Options</h3> 218 <p>Paid technical support and phpBMS customization is available from <a href="http://www.kreotek.com">Kreotek</a>, </p> 283 219 284 220 </div> trunk/phpbms/install/updatev0.7.sql
r200 r201 54 54 UPDATE reports set accesslevel=-100 WHERE accesslevel >=90; 55 55 ALTER TABLE reports CHANGE accesslevel roleid int(11) NOT NULL default '0'; 56 ALTER TABLE `users` DROP COLUMN `accesslevel`;57 56 INSERT INTO `settings` (`name`, `value`) VALUES ('phone_format','US - Loose'); 58 57 UPDATE `menu` SET `name` ='configuration', `roleid` =0 WHERE `name` ='settings'; 59 58 UPDATE `menu` SET `name` ='Settings', `roleid` =0 WHERE `name` ='Admin'; 60 INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('my account','modules/base/myaccount.php', 6,-10,1,1,NOW(),NOW(),0);61 INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('----','', 6,-5,1,1,NOW(),NOW(),0);59 INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('my account','modules/base/myaccount.php',15,-10,1,1,NOW(),NOW(),0); 60 INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('----','',15,-5,1,1,NOW(),NOW(),0); 62 61 INSERT INTO `settings` (`name`, `value`) VALUES ('date_format','English, US'); 63 62 INSERT INTO `settings` (`name`, `value`) VALUES ('time_format','12 Hour'); 63 INSERT INTO `settings` (`name`, `value`) VALUES ('currency_accuracy','2'); 64 64 INSERT INTO `settings` (`name`, `value`) VALUES ('currency_symbol','$'); 65 65 INSERT INTO `settings` (`name`, `value`) VALUES ('decimal_symbol','.'); … … 79 79 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (201,'inactive','scheduler.inactive','center','',2,'',0,'','boolean'); 80 80 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (201,'scheduler.name','name',0,'field'); 81 INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('scheduler','search.php?id=201', 6,32,1,1,NOW(),NOW(),-100);81 INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('scheduler','search.php?id=201',15,32,1,1,NOW(),NOW(),-100); 82 82 CREATE TABLE `log` (`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `type` VARCHAR(25), `userid` INTEGER UNSIGNED, `ip` VARCHAR(45), `value` TEXT, `stamp` TIMESTAMP, PRIMARY KEY(`id`))ENGINE = MYISAM; 83 83 INSERT INTO `users` (`id`, `login`, `password`, `firstname`, `lastname`, `creationdate`, `revoked`, `createdby`, `modifiedby`, `lastlogin`, `modifieddate`, `email`, `phone`, `department`, `employeenumber`, `admin`, `portalaccess`) VALUES (-2,'Scheduler','Òt%ÁBøTv:$ÖRtÈ`','phpBMS','Scheduler',NOW(),0,1,1,NULL,NOW(),'','','','',0,1); 84 INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('system log','search.php?id=202', 6,11,1,1,NOW(),NOW(),-100);84 INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('system log','search.php?id=202',15,11,1,1,NOW(),NOW(),-100); 85 85 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (202,'System Log','system',1,'log','log LEFT JOIN users ON log.userid=users.id','N/A',-100,'N/A',-100,-100,-100,-100,'delete','log.stamp> DATE_SUB(CURDATE(),INTERVAL 1 DAY)','log.stamp','','','',1,NOW(),1,NOW()); 86 86 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (202,'time','log.stamp','left','',1,'',0,'','datetime'); trunk/phpbms/install/updatexml.php
r180 r201 159 159 global $vars; 160 160 161 $querystatement="SELECT id FROM users WHERE login=\"".$user."\" AND password=encode(\"".$pass."\",\"".$vars["encryption_seed"]."\") AND admin=1"; 161 if((real) getCurrentBaseVersion()>=.7) 162 $querystatement="SELECT id FROM users WHERE login=\"".$user."\" AND password=encode(\"".$pass."\",\"".$vars["encryption_seed"]."\") AND admin=1"; 163 else 164 $querystatement="SELECT id FROM users WHERE login=\"".$user."\" AND password=encode(\"".$pass."\",\"".$vars["encryption_seed"]."\") AND accesslevel>=90"; 165 162 166 $queryresult=mysql_query($querystatement,$dblink); 163 if(!$queryresult){ 167 168 if(!$queryresult) 164 169 return false; 165 }166 170 return (mysql_num_rows($queryresult)>0); 167 171 } … … 323 327 } 324 328 } 329 $querystatement="ALTER TABLE `users` DROP COLUMN `accesslevel`"; 330 $queryresult=mysql_query($querystatement,$dblink); 331 325 332 $thereturn.=" - Connverted user access levels to roles.\n"; 326 333 … … 357 364 case "verifyLogin": 358 365 if (!verifyAdminLogin($_GET["u"],$_GET["p"])) 359 $thereturn="DB Connection error or inv laid adminstrative error.\n";366 $thereturn="DB Connection error or invalid administrative error.\n"; 360 367 else 361 368 $thereturn="DB Connected\nAdministrative user successfully verified\n"; trunk/phpbms/menu.php
r187 r201 61 61 ?> 62 62 <div id="menu"> 63 <h1><a href="<?php echo $_SESSION["app_path"]?><?php echo $_SESSION["default_load_page"]?>" title="<?php echo htmlQuotes($_SESSION["application_name"]);?>" ><span><?php echo $_SESSION["application_name"];?></span></a></h1>63 <h1><a href="<?php echo $_SESSION["app_path"]?><?php echo $_SESSION["default_load_page"]?>" title="<?php echo htmlQuotes($_SESSION["application_name"]);?>" name="toptop"><span><?php echo $_SESSION["application_name"];?></span></a></h1> 64 64 65 65 <div id="menuRighthandButtons"> trunk/phpbms/modules/base/adminsettings.php
r197 r201 163 163 <span class="notes"> 164 164 <strong>Note:</strong> This graphic is used on some reports. <br /> 165 On PDF reports, it prints in a mximum of 1.75" x 1.75". PNG format.<br />165 On PDF reports, phpBMS prints the logo at maximum dimensions of 1.75" x 1.75".<br /> 166 166 If you are uploading a PNG, <strong>it must be an 8-bit (256 color) non-interlaced PNG</strong>. 167 167 </span> trunk/phpbms/modules/bms/include/invoices_addedit_include.php
r193 r201 88 88 <?php } ?> 89 89 </script><?php 90 return $ thereturn;90 return $queryresult; 91 91 } 92 92 … … 116 116 <?php } ?> 117 117 </script><?php 118 return $ thereturn;118 return $queryresult; 119 119 } 120 120 trunk/phpbms/modules/bms/install/tablecolumns.sql
r184 r201 7 7 INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (44,3,'id','invoices.id','left','',0,'',0,'',NULL); 8 8 INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (45,3,'type','invoices.type','left','',1,'',0,'',NULL); 9 INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (134,3,'status','invoices .status','left','',2,'',0,'',NULL);9 INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (134,3,'status','invoicesstatuses.name','left','',2,'',0,'',NULL); 10 10 INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (46,3,'date','if(invoices.type=\"Invoice\",invoices.invoicedate,invoices.orderdate)','left','',4,'',0,'','date'); 11 11 INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (47,3,'client name / company','concat(\"<strong>\",if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company),\"</strong>\")','left','',5,NULL,0,'100%','noencoding'); trunk/phpbms/modules/bms/install/update.php
r184 r201 66 66 } 67 67 68 function loadDBSettings($dblink,$vars){ 69 $querystatement="SELECT name,value FROM settings"; 70 $queryresult=mysql_query($querystatement,$dblink); 71 while($therecord=mysql_fetch_array($queryresult)) 72 $vars[$therecord["name"]]=$therecord["value"]; 73 return $vars; 74 } 75 68 76 function importData($thetable){ 69 77 global $dblink; … … 94 102 global $dblink; 95 103 96 $thefile = fopen($filename,"r");104 $thefile = @ fopen($filename,"r"); 97 105 if(!$thefile) { 98 106 return "Could not open the file ".$filename."."; … … 116 124 117 125 function verifyAdminLogin($user,$pass,$encryptionSeed,$dblink){ 118 $querystatement="SELECT id FROM users WHERE login=\"".$user."\" AND password= encode(\"".$pass."\",\"".$encryptionSeed."\") AND admin=1";119 $queryresult=mysql_query($querystatement,$dblink); 120 if(!$queryresult) die("what the!");//return false;126 $querystatement="SELECT id FROM users WHERE login=\"".$user."\" AND password=ENCODE(\"".$pass."\",\"".$encryptionSeed."\") AND admin=1"; 127 $queryresult=mysql_query($querystatement,$dblink); 128 if(!$queryresult) return false; 121 129 if (mysql_num_rows($queryresult)>0) return true; 122 130 return false; … … 127 135 global $dblink; 128 136 129 $thereturn .="Updating BMS\n===================\n";137 $thereturn="Updating BMS\n===================\n"; 130 138 $vars=loadSettings(); 131 139 if(!is_array($vars)) { … … 138 146 $dblink = @ mysql_connect($vars["mysql_server"],$vars["mysql_user"],$vars["mysql_userpass"]); 139 147 mysql_select_db($vars["mysql_database"],$dblink); 148 149 $vars=loadDBSettings($dblink,$vars); 150 140 151 if(!verifyAdminLogin($_GET["u"],$_GET["p"],$vars["encryption_seed"],$dblink)){ 141 152 $thereturn="Update Requires Administrative Access.\n\n"; 142 153 return $thereturn; 143 154 } 144 155 145 156 $file = @ fopen("./version.txt","r"); 146 157 $newVersion=fgets($file,1024); … … 218 229 $queryresult=mysql_query($querystatement,$dblink); 219 230 if(!$queryresult) return (mysql_error($dblink)." --".$querystatement); 220 while($therecord=mysql_fetch_array($queryresult,$dblink)){ 231 232 233 while($therecord=mysql_fetch_array($queryresult)){ 221 234 $querystatement="UPDATE invoices SET taxpercentage=".$therecord["percentage"]."WHERE id=".$therecord["id"]; 222 235 $updateresult=mysql_query($querystatement,$dblink); … … 229 242 $thereturn.=" - modified bms record in modules table\n"; 230 243 244 231 245 $thereturn.="Update to 0.601 Finished\n\n"; 232 246 233 $ver["version"]="0.601"; 247 $ver["version"]="0.601"; 248 234 249 break; 235 250 // ================================================================================================ … … 279 294 $thereturn.="Updating BMS Module to 0.7\n"; 280 295 281 $thereturn.=processSQLfile("updatev0.7 .sql");296 $thereturn.=processSQLfile("updatev0.70.sql"); 282 297 283 298 //update to new status system … … 318 333 $querystatement="SELECT DISTINCT shippingmethod FROM invoices WHERE shippingmethod!=\"\" ORDER BY shippingmethod"; 319 334 $queryresult=mysql_query($querystatement,$dblink); 335 if(!$queryresult) return false; 336 320 337 while($therecord=mysql_fetch_array($queryresult)){ 321 338 $querystatement="INSERT INTO `shippingmethods` (name,createdby,creationdate) VALUES (\"".$therecord["shippingmethod"]."\",1,NOW())"; 322 339 $updatequery=mysql_query($querystatement,$dblink); 323 } 340 if(!$updatequery) return false; 341 } 342 324 343 $querystatement="SELECT id,name FROM shippingmethods"; 325 344 $queryresult=mysql_query($querystatement,$dblink); 345 if(!$queryresult) return false; 346 326 347 while($therecord=mysql_fetch_array($queryresult)){ 327 348 $querystatement="UPDATE invoices SET shippingmethodid=".$therecord["ID"]." 328 349 WHERE shippingmethod=\"".$therecord["name"]."\""; 329 350 $updatequery=mysql_query($querystatement,$dblink); 351 if(!$updatequery) return false; 330 352 } 331 353 $querystatement="ALTER TABLE invoices DROP shippingmethod"; 332 354 $updatequery=mysql_query($querystatement,$dblink); 355 if(!$updatequery) return false; 333 356 334 357 return true; … … 338 361 $querystatement="SELECT DISTINCT paymentmethod FROM invoices WHERE paymentmethod!=\"\" ORDER BY paymentmethod"; 339 362 $queryresult=mysql_query($querystatement,$dblink); 363 if(!$queryresult) return false; 364 340 365 while($therecord=mysql_fetch_array($queryresult)){ 341 366 $querystatement="INSERT INTO `paymentmethods` (name,createdby,creationdate) VALUES (\"".$therecord["paymentmethod"]."\",1,NOW())"; 342 367 $updatequery=mysql_query($querystatement,$dblink); 343 } 368 if(!$updatequery) return false; 369 } 370 344 371 $querystatement="SELECT id,name FROM paymentmethods"; 345 372 $queryresult=mysql_query($querystatement,$dblink); 373 if(!$queryresult) return false; 346 374 while($therecord=mysql_fetch_array($queryresult)){ 347 375 $querystatement="UPDATE invoices SET paymentmethod=".$therecord["ID"]." 348 376 WHERE paymentmethod=\"".$therecord["name"]."\""; 349 377 $updatequery=mysql_query($querystatement,$dblink); 378 if(!$updatequery) return false; 350 379 } 351 380 $querystatement="ALTER TABLE invoices DROP paymentmethod"; 352 381 $updatequery=mysql_query($querystatement,$dblink); 382 if(!$updatequery) return false; 353 383 354 384 return true; … … 357 387 function updateInvoiceStatus($dblink){ 358 388 $querystatement="SELECT id,status,statusdate FROM invoices;"; 389 $queryresult=mysql_query($querystatement,$dblink); 390 if(!$queryresult) return false; 359 391 while($therecord=mysql_fetch_array($queryresult)){ 360 392 $newstatus=1; 361 switch( ){393 switch($therecord["status"]){ 362 394 case "Open": 363 395 $newstatus=1; trunk/phpbms/modules/bms/install/updatev0.70.sql
r200 r201 1 1 CREATE TABLE `shippingmethods` (`id` int(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(128) NOT NULL, `inactive` tinyint(4) DEFAULT 0, `priority` int(11) DEFAULT 0, `canestimate` tinyint(4) DEFAULT 0, `estimationscript` VARCHAR(128), `createdby` INTEGER UNSIGNED, `creationdate` DATETIME, `modifiedby` INTEGER UNSIGNED, `modifieddate` TIMESTAMP, PRIMARY KEY(`id`)) ENGINE = MYISAM; 2 2 ALTER TABLE `invoices` ADD COLUMN `shippingmethodid` INTEGER UNSIGNED AFTER `shippingmethod`; 3 UPDATE `invoice ` SET shippingmethodid=0;3 UPDATE `invoices` SET shippingmethodid=0; 4 4 ALTER TABLE `invoices` ADD COLUMN `paymentmethodid` INTEGER UNSIGNED AFTER `paymentmethod`; 5 UPDATE `invoice ` SET paymentmethodid=0;5 UPDATE `invoices` SET paymentmethodid=0; 6 6 ALTER TABLE `invoices` ADD COLUMN `routingnumber` INTEGER UNSIGNED AFTER `paymentmethodid`; 7 7 ALTER TABLE `invoices` ADD COLUMN `accountnumber` INTEGER UNSIGNED AFTER `routingnumber`; 8 8 ALTER TABLE `invoices` ADD COLUMN `transactionid` VARCHAR(64) AFTER `accountnumber`; 9 9 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (300,'Shipping Methods','table',2,'shippingmethods','shippingmethods','modules/bms/shippingmethods_addedit.php',30,'modules/bms/shippingmethods_addedit.php',30,30,30,-100,'inactivate','shippingmethods.inactive!=0','shippingmethods.priority, shippingmethods.name','','','',1,NOW(),1,NOW()); 10 INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('Shipping Methods','search.php?id=300', 204,30,1,1,NOW(),NOW(),30);10 INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('Shipping Methods','search.php?id=300',6,30,1,1,NOW(),NOW(),30); 11 11 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (300,'All Records','shippingmethods.id!=-1',2,0); 12 12 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (300,'Active Records','shippingmethods.inactive=0',0,0); … … 35 35 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (301,'priority','paymentmethods.priority','center','',3,'',0,'',NULL); 36 36 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (301,'online process','paymentmethods.onlineprocess','center','',4,'',0,'','boolean'); 37 INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (214,'Payment Methods','search.php?id=301', 204,40,1,1,NOW(),NOW(),30);37 INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (214,'Payment Methods','search.php?id=301',6,40,1,1,NOW(),NOW(),30); 38 38 ALTER TABLE `clients` ADD COLUMN `shippingmethodid` INTEGER UNSIGNED DEFAULT 0; 39 39 ALTER TABLE `clients` ADD COLUMN `paymentmethodid` INTEGER UNSIGNED DEFAULT 0; … … 43 43 ALTER TABLE `clients` DROP `ccexpiration`; 44 44 ALTER TABLE `clients` FROP `displayname` 45 ALTER TABLE `clients` ALTERCOLUMN `state` `state` varchar(5) default NULL;46 ALTER TABLE `clients` ALTERCOLUMN `shiptostate` `shiptostate` varchar(5) default NULL;47 ALTER TABLE `invoices` ALTERCOLUMN `state` `state` varchar(5) default NULL;45 ALTER TABLE `clients` CHANGE COLUMN `state` `state` varchar(5) default NULL; 46 ALTER TABLE `clients` CHANGE COLUMN `shiptostate` `shiptostate` varchar(5) default NULL; 47 ALTER TABLE `invoices` CHANGE COLUMN `state` `state` varchar(5) default NULL; 48 48 CREATE TABLE `invoicestatuses` (`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,`name` VARCHAR(128), `invoicedefault` TINYINT UNSIGNED NOT NULL DEFAULT 0,`defaultassignedtoid` INTEGER UNSIGNED,`inactive` TINYINT UNSIGNED NOT NULL DEFAULT 0, `priority` INTEGER UNSIGNED NOT NULL DEFAULT 0, `createdby` INTEGER UNSIGNED, `creationdate` DATETIME, `modifiedby` INTEGER UNSIGNED, `modifieddate` TIMESTAMP, PRIMARY KEY(`id`))ENGINE = MYISAM; 49 49 CREATE TABLE `invoicestatushistory` (`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `invoiceid` INTEGER UNSIGNED, `invoicestatusid` INTEGER UNSIGNED, `statusdate` DATE, `assignedtoid` INTEGER UNSIGNED, PRIMARY KEY(`id`))ENGINE = MYISAM; … … 52 52 INSERT INTO `invoicestatuses` (`id`, `name`, `invoicedefault`, `defaultassignedtoid`, `inactive`, `priority`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (3,'Packed',0,NULL,0,20,1,NOW(),1,NOW()); 53 53 INSERT INTO `invoicestatuses` (`id`, `name`, `invoicedefault`, `defaultassignedtoid`, `inactive`, `priority`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (4,'Shipped / Ready To Invoice',0,NULL,0,30,1,NOW(),1,NOW()); 54 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (302,'Invoice Statuses','table',2,'invoicestatuses','invoicestatuses','modules/bms/invoicestatuses_addedit.php',30,'modules/bms/invoicestatuses_addedit.php',30,30,-100,-100,'inactivate','invoicestatuses.inactive=0','invoicestatuses.priority,invoicestatuses.name','','','' 1,NOW(),1,NOW());55 INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (215,'----','', 204,15,1,1,NOW(),NOW(),30);56 INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (216,'invoice statuses','search.php?id=302', 204,50,1,1,NOW(),NOW(),30);54 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (302,'Invoice Statuses','table',2,'invoicestatuses','invoicestatuses','modules/bms/invoicestatuses_addedit.php',30,'modules/bms/invoicestatuses_addedit.php',30,30,-100,-100,'inactivate','invoicestatuses.inactive=0','invoicestatuses.priority,invoicestatuses.name','','','',1,NOW(),1,NOW()); 55 INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (215,'----','',6,15,1,1,NOW(),NOW(),30); 56 INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (216,'invoice statuses','search.php?id=302',6,50,1,1,NOW(),NOW(),30); 57 57 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (302,'name','invoicestatuses.name','left','',0,'',1,'99%',NULL); 58 58 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (302,'priority','invoicestatuses.priority','right','',1,'',0,'',NULL); … … 80 80 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (6,'Inactive Records','tax.inactive=1',2,0); 81 81 ALTER TABLE `productcategories` ADD COLUMN `inactive` TINYINT UNSIGNED DEFAULT 0 AFTER `name`; 82 UPDATE `tabledefs` SET `defaultwhereclause`='productcategories.inactive=0',`deletebutton`="inactivate" WHERE `id`=11; 83 DELETE FROM `tablefindoptions` WHERE `tabledefid`=11; 84 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (11,'All Records','productcategories.id != 0',3,0); 85 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (11,'Active Records','productcategories.inactive=0',1,0); 86 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (11,'Inactive Records','productcategories.inactive=1',2,0); 82 UPDATE `tabledefs` SET `defaultwhereclause`='productcategories.inactive=0',`deletebutton`="inactivate" WHERE `id`=7; 83 DELETE FROM `tablefindoptions` WHERE `tabledefid`=7; 84 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (7,'All Records','productcategories.id != 0',3,0); 85 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (7,'Active Records','productcategories.inactive=0',1,0); 86 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (7,'Inactive Records','productcategories.inactive=1',2,0); 87 UPDATE `tablecolumns` set `column`='invoicesstatuses.name' WHERE `column`='invoices.name';