navigation  interaction  search

 other resources

Changeset 201

Show
Ignore:
Timestamp:
03/22/07 18:59:27
Author:
brieb
Message:

Addresses install/update process errors.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/phpbms/common/stylesheet/mozilla/pages/install.css

    r166 r201  
    11/* $Rev$ | $LastChangedBy$ */ 
    22/* $LastChangedDate$ */ 
    3 #topTitle{} 
    4 #container{width:740px; margin:0 auto;} 
     3#container{width:740px; margin:10px auto;} 
    54p{margin:0;padding:0px 10px 10px;} 
    65 
    76.results{width:98%;font-family:'Courier New', Courier, mono;font-size:13px;} 
    8 #modules{width:200px;} 
  • trunk/phpbms/install/install.php

    r193 r201  
    5252<link href="../common/stylesheet/mozilla/base.css" rel="stylesheet" type="text/css" /> 
    5353<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> 
    5457<script language="JavaScript" src="../common/javascript/common.js" type="text/javascript"></script> 
    5558<script language="JavaScript" type="text/javascript">    
     
    7578        } 
    7679         
     80        function enableModuleInstall(){ 
     81                var modules=getObjectFromID("modules"); 
     82                var installButton=getObjectFromID("installmodule"); 
     83                if(modules.value!=0) 
     84                        installButton.disabled=false; 
     85        } 
     86         
    7787        function runModuleInstall(){ 
    7888                var themodule=getObjectFromID("modules"); 
     
    95105<div class="bodyline" id="container"> 
    96106        <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>&nbsp;</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> 
    109112    </ul> 
    110113         
    111         <p>&nbsp;</p> 
    112         <h1>Browser Requirements</h1> 
     114        <h2>Browser Requirements</h2> 
    113115        <p>see the <a href="../requirements.php">requirements page</a>.</p> 
    114         <p>&nbsp;</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> 
    126121        <ul class="small"> 
    127122                <li><p> 
     
    129124                        In most cases, this should be the same location as the web server, i.e. &quot;localhost&quot; 
    130125                        </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> 
    133127                <li> 
    134128                        <p><strong>mysql_database</strong>: the name of the database to be used by phpBMS. <br /> 
    135                                If the data base 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> 
    136130                </li> 
    137131                <li> 
     
    139133                </li> 
    140134                <li> 
    141                         <p><strong>mysql_userpass</strong>:     the     password for the user that access the database.</p> 
    142                 </li> 
    143                 <li> 
    144                         <p><strong>mysql_pconnect</strong>:     specify whether php should use the mysql_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>:     (&quot;true&quot; or &quot;false&quot;) This tells phpBMS to use either the PHP mysql_pconnect or mysql_connect command. Some web hosting providers do not allow mysql_pconnect.</p> 
    145139                </li> 
    146140        </ul> 
     
    153147        </p> 
    154148 
    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>&nbsp;</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>&nbsp;</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>&nbsp;</p> 
    216         <h1 >Install Additional Modules </h1> 
    217         <div class="box"> 
    218                 <p>&nbsp; 
    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>&nbsp;</p> 
    244         <h1>Secure The Application</h1> 
    245         <div class="box"> 
    246                 <p>&nbsp;</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> 
    247191                <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> 
    250193                <ul> 
    251194                        <li> 
     
    261204                </li> 
    262205                </ul> 
    263         </div> 
    264     <p>&nbsp;</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>&nbsp;</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> 
    283219         
    284220</div> 
  • trunk/phpbms/install/updatev0.7.sql

    r200 r201  
    5454UPDATE reports set accesslevel=-100 WHERE accesslevel >=90; 
    5555ALTER TABLE reports CHANGE accesslevel roleid int(11) NOT NULL default '0'; 
    56 ALTER TABLE `users` DROP COLUMN `accesslevel`; 
    5756INSERT INTO `settings` (`name`, `value`) VALUES ('phone_format','US - Loose'); 
    5857UPDATE `menu` SET `name` ='configuration', `roleid` =0 WHERE `name` ='settings'; 
    5958UPDATE `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); 
     59INSERT 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); 
     60INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('----','',15,-5,1,1,NOW(),NOW(),0); 
    6261INSERT INTO `settings` (`name`, `value`) VALUES ('date_format','English, US'); 
    6362INSERT INTO `settings` (`name`, `value`) VALUES ('time_format','12 Hour'); 
     63INSERT INTO `settings` (`name`, `value`) VALUES ('currency_accuracy','2'); 
    6464INSERT INTO `settings` (`name`, `value`) VALUES ('currency_symbol','$'); 
    6565INSERT INTO `settings` (`name`, `value`) VALUES ('decimal_symbol','.'); 
     
    7979INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (201,'inactive','scheduler.inactive','center','',2,'',0,'','boolean'); 
    8080INSERT 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); 
     81INSERT INTO `menu` (`name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('scheduler','search.php?id=201',15,32,1,1,NOW(),NOW(),-100); 
    8282CREATE 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; 
    8383INSERT 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); 
     84INSERT 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); 
    8585INSERT 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()); 
    8686INSERT 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  
    159159                global $vars; 
    160160                 
    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                 
    162166                $queryresult=mysql_query($querystatement,$dblink); 
    163                 if(!$queryresult){ 
     167                                 
     168                if(!$queryresult) 
    164169                        return false; 
    165                 } 
    166170                return (mysql_num_rows($queryresult)>0); 
    167171        } 
     
    323327                                                } 
    324328                                        }                                        
     329                                        $querystatement="ALTER TABLE `users` DROP COLUMN `accesslevel`"; 
     330                                        $queryresult=mysql_query($querystatement,$dblink); 
     331 
    325332                                        $thereturn.=" - Connverted user access levels to roles.\n";                              
    326333 
     
    357364                                        case "verifyLogin": 
    358365                                                if (!verifyAdminLogin($_GET["u"],$_GET["p"])) 
    359                                                         $thereturn="DB Connection error or invlaid adminstrative error.\n"; 
     366                                                        $thereturn="DB Connection error or invalid administrative error.\n"; 
    360367                                                else 
    361368                                                        $thereturn="DB Connected\nAdministrative user successfully verified\n"; 
  • trunk/phpbms/menu.php

    r187 r201  
    6161?> 
    6262<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> 
    6464 
    6565        <div id="menuRighthandButtons"> 
  • trunk/phpbms/modules/base/adminsettings.php

    r197 r201  
    163163                        <span class="notes"> 
    164164                                <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 /> 
    166166                                If you are uploading a PNG, <strong>it must be an 8-bit (256 color) non-interlaced PNG</strong>. 
    167167                        </span> 
  • trunk/phpbms/modules/bms/include/invoices_addedit_include.php

    r193 r201  
    8888                <?php } ?> 
    8989        </script><?php  
    90         return $thereturn
     90        return $queryresult
    9191} 
    9292 
     
    116116                <?php } ?> 
    117117        </script><?php  
    118         return $thereturn
     118        return $queryresult
    119119} 
    120120 
  • trunk/phpbms/modules/bms/install/tablecolumns.sql

    r184 r201  
    77INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (44,3,'id','invoices.id','left','',0,'',0,'',NULL); 
    88INSERT 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); 
     9INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (134,3,'status','invoicesstatuses.name','left','',2,'',0,'',NULL); 
    1010INSERT 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'); 
    1111INSERT 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  
    6666} 
    6767 
     68function 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 
    6876        function importData($thetable){ 
    6977                global $dblink; 
     
    94102                global $dblink; 
    95103                 
    96                 $thefile = fopen($filename,"r"); 
     104                $thefile = @ fopen($filename,"r"); 
    97105                if(!$thefile) { 
    98106                        return "Could not open the file ".$filename."."; 
     
    116124         
    117125        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; 
    121129                if (mysql_num_rows($queryresult)>0) return true; 
    122130                return false; 
     
    127135                global $dblink; 
    128136                 
    129                 $thereturn.="Updating BMS\n===================\n"; 
     137                $thereturn="Updating BMS\n===================\n"; 
    130138                $vars=loadSettings(); 
    131139                if(!is_array($vars)) { 
     
    138146                        $dblink = @  mysql_connect($vars["mysql_server"],$vars["mysql_user"],$vars["mysql_userpass"]); 
    139147                mysql_select_db($vars["mysql_database"],$dblink); 
     148 
     149                $vars=loadDBSettings($dblink,$vars); 
     150                 
    140151                if(!verifyAdminLogin($_GET["u"],$_GET["p"],$vars["encryption_seed"],$dblink)){ 
    141152                        $thereturn="Update Requires Administrative Access.\n\n"; 
    142153                        return $thereturn; 
    143154                } 
    144                          
     155                                
    145156                $file =  @ fopen("./version.txt","r"); 
    146157                $newVersion=fgets($file,1024); 
     
    218229                                        $queryresult=mysql_query($querystatement,$dblink); 
    219230                                        if(!$queryresult) return (mysql_error($dblink)." --".$querystatement); 
    220                                         while($therecord=mysql_fetch_array($queryresult,$dblink)){ 
     231                                         
     232                                         
     233                                        while($therecord=mysql_fetch_array($queryresult)){ 
    221234                                                $querystatement="UPDATE invoices SET taxpercentage=".$therecord["percentage"]."WHERE id=".$therecord["id"]; 
    222235                                                $updateresult=mysql_query($querystatement,$dblink); 
     
    229242                                        $thereturn.=" - modified bms record in modules table\n"; 
    230243 
     244 
    231245                                        $thereturn.="Update to 0.601 Finished\n\n"; 
    232246                         
    233                                         $ver["version"]="0.601";                                 
     247                                        $ver["version"]="0.601"; 
     248 
    234249                                break; 
    235250                                // ================================================================================================ 
     
    279294                                        $thereturn.="Updating BMS Module to 0.7\n"; 
    280295                                         
    281                                         $thereturn.=processSQLfile("updatev0.7.sql"); 
     296                                        $thereturn.=processSQLfile("updatev0.70.sql"); 
    282297                                         
    283298                                        //update to new status system 
     
    318333                $querystatement="SELECT DISTINCT shippingmethod FROM invoices WHERE shippingmethod!=\"\" ORDER BY shippingmethod"; 
    319334                $queryresult=mysql_query($querystatement,$dblink); 
     335                if(!$queryresult) return false; 
     336                 
    320337                while($therecord=mysql_fetch_array($queryresult)){ 
    321338                        $querystatement="INSERT INTO `shippingmethods` (name,createdby,creationdate) VALUES (\"".$therecord["shippingmethod"]."\",1,NOW())"; 
    322339                        $updatequery=mysql_query($querystatement,$dblink); 
    323                 } 
     340                        if(!$updatequery) return false; 
     341                } 
     342 
    324343                $querystatement="SELECT id,name FROM shippingmethods"; 
    325344                $queryresult=mysql_query($querystatement,$dblink); 
     345                if(!$queryresult) return false; 
     346 
    326347                while($therecord=mysql_fetch_array($queryresult)){ 
    327348                        $querystatement="UPDATE invoices SET shippingmethodid=".$therecord["ID"]." 
    328349                                                        WHERE shippingmethod=\"".$therecord["name"]."\""; 
    329350                        $updatequery=mysql_query($querystatement,$dblink); 
     351                        if(!$updatequery) return false; 
    330352                } 
    331353                $querystatement="ALTER TABLE invoices DROP shippingmethod"; 
    332354                $updatequery=mysql_query($querystatement,$dblink); 
     355                if(!$updatequery) return false; 
    333356                 
    334357                return true; 
     
    338361                $querystatement="SELECT DISTINCT paymentmethod FROM invoices WHERE paymentmethod!=\"\" ORDER BY paymentmethod"; 
    339362                $queryresult=mysql_query($querystatement,$dblink); 
     363                if(!$queryresult) return false; 
     364 
    340365                while($therecord=mysql_fetch_array($queryresult)){ 
    341366                        $querystatement="INSERT INTO `paymentmethods` (name,createdby,creationdate) VALUES (\"".$therecord["paymentmethod"]."\",1,NOW())"; 
    342367                        $updatequery=mysql_query($querystatement,$dblink); 
    343                 } 
     368                        if(!$updatequery) return false; 
     369                } 
     370 
    344371                $querystatement="SELECT id,name FROM paymentmethods"; 
    345372                $queryresult=mysql_query($querystatement,$dblink); 
     373                if(!$queryresult) return false; 
    346374                while($therecord=mysql_fetch_array($queryresult)){ 
    347375                        $querystatement="UPDATE invoices SET paymentmethod=".$therecord["ID"]." 
    348376                                                        WHERE paymentmethod=\"".$therecord["name"]."\""; 
    349377                        $updatequery=mysql_query($querystatement,$dblink); 
     378                        if(!$updatequery) return false; 
    350379                } 
    351380                $querystatement="ALTER TABLE invoices DROP paymentmethod"; 
    352381                $updatequery=mysql_query($querystatement,$dblink); 
     382                if(!$updatequery) return false; 
    353383                 
    354384                return true; 
     
    357387        function updateInvoiceStatus($dblink){ 
    358388                $querystatement="SELECT id,status,statusdate FROM invoices;"; 
     389                $queryresult=mysql_query($querystatement,$dblink); 
     390                if(!$queryresult) return false; 
    359391                while($therecord=mysql_fetch_array($queryresult)){ 
    360392                        $newstatus=1; 
    361                         switch(){ 
     393                        switch($therecord["status"]){ 
    362394                                case "Open": 
    363395                                        $newstatus=1; 
  • trunk/phpbms/modules/bms/install/updatev0.70.sql

    r200 r201  
    11CREATE 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; 
    22ALTER TABLE `invoices` ADD COLUMN `shippingmethodid` INTEGER UNSIGNED AFTER `shippingmethod`; 
    3 UPDATE `invoice` SET shippingmethodid=0; 
     3UPDATE `invoices` SET shippingmethodid=0; 
    44ALTER TABLE `invoices` ADD COLUMN `paymentmethodid` INTEGER UNSIGNED AFTER `paymentmethod`; 
    5 UPDATE `invoice` SET paymentmethodid=0; 
     5UPDATE `invoices` SET paymentmethodid=0; 
    66ALTER TABLE `invoices` ADD COLUMN `routingnumber` INTEGER UNSIGNED AFTER `paymentmethodid`; 
    77ALTER TABLE `invoices` ADD COLUMN `accountnumber` INTEGER UNSIGNED AFTER `routingnumber`; 
    88ALTER TABLE `invoices` ADD COLUMN `transactionid` VARCHAR(64) AFTER `accountnumber`; 
    99INSERT 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); 
     10INSERT 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); 
    1111INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (300,'All Records','shippingmethods.id!=-1',2,0); 
    1212INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (300,'Active Records','shippingmethods.inactive=0',0,0); 
     
    3535INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (301,'priority','paymentmethods.priority','center','',3,'',0,'',NULL); 
    3636INSERT 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); 
     37INSERT 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); 
    3838ALTER TABLE `clients` ADD COLUMN `shippingmethodid` INTEGER UNSIGNED DEFAULT 0; 
    3939ALTER TABLE `clients` ADD COLUMN `paymentmethodid` INTEGER UNSIGNED DEFAULT 0; 
     
    4343ALTER TABLE `clients` DROP `ccexpiration`; 
    4444ALTER TABLE `clients` FROP `displayname` 
    45 ALTER TABLE `clients` ALTER COLUMN `state` `state` varchar(5) default NULL; 
    46 ALTER TABLE `clients` ALTER COLUMN `shiptostate` `shiptostate` varchar(5) default NULL; 
    47 ALTER TABLE `invoices` ALTER COLUMN `state` `state` varchar(5) default NULL; 
     45ALTER TABLE `clients` CHANGE COLUMN `state` `state` varchar(5) default NULL; 
     46ALTER TABLE `clients` CHANGE COLUMN `shiptostate` `shiptostate` varchar(5) default NULL; 
     47ALTER TABLE `invoices` CHANGE COLUMN `state` `state` varchar(5) default NULL; 
    4848CREATE 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; 
    4949CREATE 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; 
     
    5252INSERT INTO `invoicestatuses` (`id`, `name`, `invoicedefault`, `defaultassignedtoid`, `inactive`, `priority`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (3,'Packed',0,NULL,0,20,1,NOW(),1,NOW()); 
    5353INSERT 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); 
     54INSERT 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()); 
     55INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (215,'----','',6,15,1,1,NOW(),NOW(),30); 
     56INSERT 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); 
    5757INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (302,'name','invoicestatuses.name','left','',0,'',1,'99%',NULL); 
    5858INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (302,'priority','invoicestatuses.priority','right','',1,'',0,'',NULL); 
     
    8080INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (6,'Inactive Records','tax.inactive=1',2,0); 
    8181ALTER 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); 
     82UPDATE `tabledefs` SET `defaultwhereclause`='productcategories.inactive=0',`deletebutton`="inactivate" WHERE `id`=7; 
     83DELETE FROM `tablefindoptions` WHERE `tabledefid`=7; 
     84INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (7,'All Records','productcategories.id != 0',3,0); 
     85INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (7,'Active Records','productcategories.inactive=0',1,0); 
     86INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (7,'Inactive Records','productcategories.inactive=1',2,0); 
     87UPDATE `tablecolumns` set `column`='invoicesstatuses.name' WHERE `column`='invoices.name'; 
Copyright © 2006-2007 Kreotek, LLC. All Rights reserved.