phpBMS

Changeset 485

Show
Ignore:
Timestamp:
04/07/09 11:44:18 (3 years ago)
Author:
nate
Message:
  • Merged Nathan branch back into trunk.
Location:
trunk/phpbms
Files:
11 removed
88 modified
16 copied

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/ChangeLog

    r392 r485 ?
    ?1phpBMS v0.98?
    ?2http://phpbms.org/browser/tags/phpbms-0.98?
    ?3 * Support for importing records directly from within phpBMS?
    ?4 * New install and update procedures?
    ?5?
    ?6The complete list of closed tickets can be found here: http://phpbms.org/query?status=closed&milestone=0.98?
    ?7?
    18phpBMS v0.96?
    ?9http://phpbms.org/browser/tags/phpbms-0.96?
    210 * Support For Multiple Client Addresses?
    311 * Separate Bill To and Ship To Addresses on Sales Orders?
    4? * Automatic removal of old CC/Bank routing information on Invoices ?
    ?12 * Automatic removal of old CC/Bank routing information on Invoices?
    513?
    614The complete list of closed tickets can be found here: http://phpbms.org/query?status=closed&milestone=0.96?
    ? ? ?
    5159phpBMS v0.7?
    5260http://phpbms.org/browser/tags/phpbms-0.7?
    53? ?
    ?61?
    5462 * Support for multiple phone formats?
    5563 * Support for multiple currency formats?
    5664 * Support for multiple date/time formats?
    5765 * New client order defaults?
    58? * New scheduler system ?
    ?66 * New scheduler system?
    5967 * New logging system?
    6068 * Support for type JPG on logo?
    ? ? ?
    6573 * Longer state fields?
    6674 * Order status now modifiable?
    67? * Track order status history ?
    ?75 * Track order status history?
    6876 * Users can edit their information?
    6977 * New user access level system?
    ? ? ?
    223231 * Fixed issue with invoice line items not able to enter/fill correctly?
    224232 * addressed global variable problem in multiple areas?
    225? * Removed parameter "response" from passed variables to UPS shipping lookup.  ?
    ?233 * Removed parameter "response" from passed variables to UPS shipping lookup.?
    226234 * Including parameter breaks the CGI lookup (returned blank response) for UPS shipping lookup?
    227235 * Included amount due on invoice report?
  • trunk/phpbms/common/javascript/fields.js

    r285 r485 ?
    4141        var thereturn=true;?
    4242        var errorMessage="";?
    43?                        ?
    ?43?
    4444        //skip validation if cancel?
    4545        if (theform["cancelclick"]){?
    ? ? ?
    5656                        break;?
    5757                }?
    58?        }       ?
    59?                ?
    ?58        }?
    ?59?
    6060        //validate required fields first?
    6161        for(i=0;i<requiredArray.length;i++){?
    ? ? ?
    101101                }?
    102102        }?
    103?        ?
    ?103?
    104104        //next phone numbers?
    105105        for(i=0;i<phoneArray.length;i++){?
    ? ? ?
    133133        }?
    134134        return thereturn;?
    135?        ?
    ?135?
    136136}?
    137137?
    ? ? ?
    209209function validateCurrency(theitem){?
    210210        theitem.value=numberToCurrency(currencyToNumber(theitem.value));?
    211?        ?
    ?211?
    212212        //in case the field has an additional onchange code to be run?
    213213        if (theitem.thechange) theitem.thechange();?
    ? ? ?
    227227                if (thenumber.charAt(i)!="%" && thenumber.charAt(i)!="+" && thenumber.charAt(i)!=",") markupnumber+=thenumber.charAt(i);?
    228228        }?
    229?        ?
    ?229?
    230230        //get rid of trailing zeros and possibly "."?
    231231        while(markupnumber.charAt(markupnumber.length-1)=="0" && markupnumber.indexOf(".")!=-1) markupnumber=markupnumber.substring(0,markupnumber.length-1);?
    ? ? ?
    238238?
    239239function checkUnique(tabledefid,column,checkvalue,excludeid){?
    240?        ?
    ?240?
    241241        var theurl=APP_PATH+"checkunique.php?tdid="+parseInt(tabledefid);?
    242242        theurl=theurl+"&c="+encodeURIComponent(column);?
    ? ? ?
    246246?
    247247        loadXMLDoc(theurl,null,false);?
    248?        ?
    ?248?
    249249        response = req.responseXML.documentElement;?
    250250        thevalue = response.getElementsByTagName('isunique')[0].firstChild.data;?
    251?        ?
    ?251?
    252252        if(thevalue==1) return true; else return false;?
    253253}?
  • trunk/phpbms/common/stylesheet/mozilla/menu.css

    r442 r485 ?
    124124?
    125125/* ------ Help Page  ---- */?
    126?#helpBox{height:420px; overflow:auto; background:white}?
    127?#helpBox h1{margin-top:20px;}?
    128?#helpClose{width:70px}?
    ?126#helpBox{background:white}?
    ?127#helpClose{?
    ?128        padding-left: 15px;?
    ?129        padding-right: 15px;?
    ?130}?
  • trunk/phpbms/common/stylesheet/mozilla/pages/info.css

    r204 r485 ?
    11/* $Rev$ | $LastChangedBy$ */?
    22/* $LastChangedDate$ */?
    3?#container{width:740px; margin:10px auto}?
    ?3#container{?
    ?4        width:740px; margin:10px auto?
    ?5}?
    ?6?
    47#phpBMSLogo{?
    5?        float:right;?
    6?        background:white url(../../../image/logo-large.png) 10px 10px no-repeat;?
    7?        padding:77px 10px 10px 10px;?
    8?        margin-right:20px;?
    9?        width:250px;?
    10?        text-align:right;?
    ?8        float: right;?
    ?9        background: white url("../../../image/logo-large.png") 10px 10px no-repeat;?
    ?10        padding: 77px 10px 10px 10px;?
    ?11        width: 250px;?
    ?12        text-align: right;?
    1113}?
    12?#companyInfo{margin-right:190px;}?
    13?#loginButton{width:100px;}?
    ?14?
    ?15#companyInfo{?
    ?16        margin-right:260px;?
    ?17}?
    ?18?
    ?19#loginButton{?
    ?20        padding-right: 15px;?
    ?21        padding-left: 15px;?
    ?22}?
  • trunk/phpbms/common/stylesheet/mozilla/pages/login.css

    r285 r485 ?
    22/* $LastChangedDate$ */?
    33?
    4?.bodyline{display:block;padding:5px;width:300px; margin: 0 auto;}?
    ?4.bodyline{?
    ?5        display: block;?
    ?6        padding: 5px;?
    ?7        width: 22em;?
    ?8        margin: 0 auto;?
    ?9}?
    ?10?
    ?11label{?
    ?12        line-height: 1.5em;?
    ?13}?
    ?14?
    515#loginbox{?
    616        margin:100px auto 50px;?
    717}?
    818?
    9?#loginbox h1{font-size:21px;font-weight:bold;background-position:6px 6px;padding-left:28px;color:#455372;}?
    ?19        #loginbox h1{?
    ?20                font-size: 21px;?
    ?21                font-weight: bold;?
    ?22                background-position: 6px 6px;?
    ?23                padding-left: 28px;?
    ?24                color:#455372;?
    ?25        }?
    1026?
    11?#moreinfoButtonP{text-align:left;padding-bottom:5px;}?
    ?27        #loginbox .box{?
    ?28                margin:10px 8px 10px;?
    ?29                border-style: none;?
    ?30                background-color: white;?
    ?31                text-align: center;?
    ?32        }?
    1233?
    13?#moreinfo{padding:0;}?
    14?#moreingo p{padding:2px;}?
    15?#moreinfo h2{margin:0;padding:5px;background:none;height:22px;}?
    16?#moreinfo h2 a{display:block;width:85px;height:22px;background:url(../../../image/logo.png);}?
    17?#moreinfo h3{text-align:left;padding:2px 5px 10px;margin:0;border:0;font-weight:normal;font-size:9px; border:0;}?
    ?34        #loginbox form{?
    ?35                padding:10px 5px 0;?
    ?36                margin:0;?
    ?37        }?
    1838?
    19?#buttonP{padding-right:18px;text-align:right;}?
    20?#buttonP button{padding-left:15px;padding-right:15px;}?
    21??
    22?#loginbox .box{?
    23?        margin:10px 8px 10px;?
    24?        border-style:none;?
    25?        background-color:white;?
    26?        text-align:center;?
    ?39#moreinfoButtonP{?
    ?40        float: left;?
    ?41        text-align:left;?
    ?42        padding-top: 6px;?
    2743}?
    2844?
    29?#loginbox form{padding:10px 5px 0;margin:0;}?
    ?45#moreinfo{?
    ?46        padding:0;?
    ?47}?
    3048?
    31?#username,#password{width:98%;}?
    32?#command{width:75px;}?
    ?49        #moreinfo p{?
    ?50                padding:2px;?
    ?51        }?
    3352?
    34?#failed{text-align:center;margin-top:5px;}?
    ?53        #moreinfo h2{?
    ?54                margin: 0;?
    ?55                padding: 5px;?
    ?56                background: none;?
    ?57                height: 22px;?
    ?58        }?
    ?59?
    ?60                #moreinfo h2 a{?
    ?61                        display: block;?
    ?62                        width: 85px;?
    ?63                        height: 22px;?
    ?64                        background: url("../../../image/logo.png");?
    ?65                }?
    ?66?
    ?67        #moreinfo h3{?
    ?68                text-align: left;?
    ?69                padding: 2px 5px 10px;?
    ?70                margin: 0;?
    ?71                border: 0;?
    ?72                font-weight: normal;?
    ?73                font-size: 9px;?
    ?74                border: 0;?
    ?75        }?
    ?76?
    ?77#buttonP{?
    ?78        text-align:right;?
    ?79}?
    ?80?
    ?81        #buttonP button{?
    ?82                padding-left: 15px;?
    ?83                padding-right: 15px;?
    ?84                font-size: 13px;?
    ?85        }?
    3586?
    3687?
    3788?
    38?#demobox{ margin:0 auto;}?
    39?#demobox h2{margin-top:0;}?
    40?#demobox dt{font-weight:bold; padding:2px 10px;}?
    41?#demobox dd{padding-bottom:10px;}?
    ?89#username, #password{?
    ?90        width:99%;?
    ?91        font-size: 15px;?
    ?92}?
    ?93?
    ?94#command{?
    ?95        width:75px;?
    ?96}?
    ?97?
    ?98#failed{?
    ?99        text-align: center;?
    ?100        margin-top: 5px;?
    ?101}?
    ?102?
    ?103?
    ?104#demobox{?
    ?105        margin: 0 auto;?
    ?106}?
    ?107?
    ?108        #demobox h2{?
    ?109                margin-top:0;?
    ?110        }?
    ?111?
    ?112        #demobox dt{?
    ?113                font-weight:bold;?
    ?114                padding:2px 10px;?
    ?115        }?
    ?116?
    ?117        #demobox dd{?
    ?118                padding-bottom: 10px;?
    ?119        }?
  • trunk/phpbms/common/stylesheet/mozilla/pages/requirements.css

    r204 r485 ?
    11/* $Rev$ | $LastChangedBy$ */?
    22/* $LastChangedDate$ */?
    3?#container{width:740px; margin:10px auto;}?
    4?#cba{margin-top:45px;}?
    5?#logo{?
    6?        float:right;background:white url(../../../image/logo-large.png) 8px 12px no-repeat;?
    7?        width:260px;height:67px;?
    ?3#container{?
    ?4        width:740px;?
    ?5        margin:10px auto;?
    86}?
    9?#logo span{display:none;}?
    10?#browserTable{margin:20px;}?
    11?#loginButton{width:100px;}?
    ?7?
    ?8#browserTable{?
    ?9        width: 100%?
    ?10}?
    ?11?
    ?12#loginButton{?
    ?13        padding-left: 10px;?
    ?14        padding-right: 10px;?
    ?15}?
  • trunk/phpbms/defaultsettings.php

    r180 r485 ?
    1?<?php /* ]?
    ?1<?php /* [?
    22mysql_server    = "localhost"?
    33mysql_database  = "phpbms"?
    4?mysql_user              = "bms"?
    ?4mysql_user      = "bms"?
    55mysql_userpass  = "bmspass"?
    66mysql_pconnect  = "true"?
    7? end] */ ?>?
    ?7] */ ?>?
  • trunk/phpbms/help/index.php

    r308 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev$ | $LastChangedBy$?
    ? ? ?
    3737 +-------------------------------------------------------------------------+?
    3838*/?
    39?        require("../include/session.php");      ?
    40?        ?
    41?        $querystatement="SELECT displayname,version from modules ORDER BY id";?
    42?        $queryresult=$db->query($querystatement);?
    ?39        require("../include/session.php");?
    4340?
    44?        function displayVersions($db,$queryresult){?
    45?                if($queryresult){?
    46?                        while($therecord=$db->fetchArray($queryresult)){?
    47?                                if($therecord["displayname"]!="Base"){?
    48?                                        echo $therecord["displayname"].": ";?
    49?                                        echo "v".$therecord["version"]."<br />";?
    50?                                } else?
    51?                                        echo "<span class=\"important\">phpBMS version: ".$therecord["version"]."</span><br />";?
    52?                        }?
    53?                }?
    54?        }?
    55?                ?
    ?41        class versions{?
    ?42?
    ?43                var $db;?
    ?44                var $queryresult;?
    ?45?
    ?46                function versions($db){?
    ?47?
    ?48                        $this->db = $db;?
    ?49?
    ?50                }//end function init?
    ?51?
    ?52                function get(){?
    ?53?
    ?54                        $querystatement = "?
    ?55                                SELECT?
    ?56                                        `name`,?
    ?57                                        `displayname`,?
    ?58                                        `version`?
    ?59                                FROM?
    ?60                                        `modules`?
    ?61                                ORDER BY?
    ?62                                        `id`";?
    ?63?
    ?64                        $this->queryresult = $this->db->query($querystatement);?
    ?65?
    ?66                }//end function get?
    ?67?
    ?68?
    ?69                function show(){?
    ?70?
    ?71                        if(!$this->queryresult)?
    ?72                                return false;?
    ?73?
    ?74                        while($therecord = $this->db->fetchArray($this->queryresult)){?
    ?75?
    ?76                                if($therecord["name"] != "base")?
    ?77                                        echo formatVariable($therecord["displayname"]).": v".$therecord["version"]."<br />";?
    ?78                                else?
    ?79                                        echo '<strong>v'.$therecord["version"].'</strong><br /><br />';?
    ?80?
    ?81                        }//endwhile?
    ?82?
    ?83                        return true;?
    ?84?
    ?85                }//end function show?
    ?86?
    ?87        }//end class?
    ?88?
    ?89        $versions = new versions($db);?
    ?90        $versions->get();?
    ?91?
    5692?>?
    5793<div class="box" id="helpBox">?
    5894?
    59?        <h1>About This Program</h3>?
    60?        <blockquote>?
    61?                <p align="right" style="float:right;"><img src="<?php echo APP_PATH?>common/image/logo.png" alt="phpBMS Logo" width="85" height="22"/></p>?
    62?                ?
    63?                <h3>phpBMS - Commercial Open Source Business Management Web Application</h3>?
    64?                ?
    65?                <p class="small"><?php displayVersions($db,$queryresult)?></p>?
    66?                ?
    67?                <p>Copyright &reg; 2004-2007 Kreotek, LLC. All Rights Reserved. phpBMS, and the phpBMS logo are trademarks of Kreotek, LLC.</p>?
    68?        ?
    69?                <p>?
    70?                        <strong>Kreotek, LLC</strong><br />?
    71?                        610 Quantum<br />?
    72?                        Rio Rancho, NM 87124<br />?
    73?                        <a href="http://www.kreotek.com" target="_blank">http://www.kreotek.com</a><br />?
    74?                        1-800-731-8026<br />?
    75?                </p>?
    76?        </blockquote>?
    ?95        <p align="right" style="float:right; text-align:right; padding-left: 10px;" class="small">?
    ?96                <img src="<?php echo APP_PATH?>common/image/logo.png" alt="phpBMS Logo" width="85" height="22"/><br />?
    ?97                <?php $versions->show()?>?
    ?98        </p>?
    7799?
    78?        <h1>Keyboard Shortcuts</h1>?
    79?        <blockquote>?
    80?                <p>?
    81?                        phpBMS takes advanage of HTML's accesskey property to allow?
    82?                        you to use your keyboard to navigate pages.  Some browsers and OS's?
    83?                        might have different modifier keys, so check your?
    84?                        browser documentation.  In windows, when using Internet Explorer and Firefox &lt 2.0, hold?
    85?                        down the Alt key followed by the shortcut.  When using Firefox &gt 2.0 in windows hold down Alt-Shift buttons ?
    86?                        followed by the shortcut. In opera hold down Shift-Esc then?
    87?                        the shortut.  On a Mac, use the ctrl key in both Firefox &lt; 2.0 and Safari. ?
    88?                </p>?
    89?        ?
    90?                <h2>Search/List Screens</h2>?
    91?                <div class="fauxP">?
    92?                        <table border="0" cellpadding="0" cellspacing="0" class="querytable" width="300">?
    93?                                <tr>?
    94?                                        <th valign="bottom" class="queryheader" align="right" width="100%">Command</th>?
    95?                                        <th valign="bottom" class="queryheader" align="center">Key</th>?
    96?                                </tr>?
    97?                                <tr class="qr1" >?
    98?                                        <td align="right">New Record</td>?
    99?                                        <td align="center">N</td>?
    100?                                </tr>?
    101?                                <tr class="qr2" >?
    102?                                        <td align="right">Edit Record</td>?
    103?                                        <td align="center">E</td>?
    104?                                </tr>?
    105?                                <tr class="qr1" >?
    106?                                        <td align="right">Print</td>?
    107?                                        <td align="center">P</td>?
    108?                                </tr>?
    109?                                <tr class="qr2" >?
    110?                                        <td align="right">Delete (where applicable)</td>?
    111?                                        <td align="center">D</td>?
    112?                                </tr>?
    113?                                <tr class="qr1" >?
    114?                                        <td align="right">Select All</td>?
    115?                                        <td align="center">A</td>?
    116?                                </tr>?
    117?                                <tr class="qr2" >?
    118?                                        <td align="right">Select None</td>?
    119?                                        <td align="center">X</td>?
    120?                                </tr>?
    121?                                <tr class="qr1" >?
    122?                                        <td align="right">Keep Highlighted</td>?
    123?                                        <td align="center">K</td>?
    124?                                </tr>?
    125?                                <tr class="qr2">?
    126?                                        <td align="right">Omit Highlighted</td>?
    127?                                        <td align="center">O</td>?
    128?                                </tr>?
    129?                                <tr class="queryfooter">?
    130?                                        <td>&nbsp;</td>?
    131?                                        <td>&nbsp;</td>?
    132?                                </tr>?
    133?                        </table>?
    134?                </div>?
    135?        ?
    136?                <h2>Add/Edit Screens</h2>?
    137?                <div class="fauxP">?
    138?                        <table border="0" cellpadding="0" cellspacing="0" class="querytable" width="300">?
    139?                                <tr>?
    140?                                        <th valign="bottom" class="queryheader" align="right" width="100%">Command</th>?
    141?                                        <th valign="bottom" class="queryheader" align="center">Key</th>?
    142?                                </tr>?
    143?                                <tr class="qr1">?
    144?                                        <td align="right">Save Record</td>?
    145?                                        <td align="center">S</td>?
    146?                                </tr>?
    147?                                <tr class="qr2">?
    148?                                        <td align="right">Cancel</td>?
    149?                                        <td align="center">X</td>?
    150?                                </tr>?
    151?                                <tr class="queryfooter">?
    152?                                        <td>&nbsp;</td>?
    153?                                        <td>&nbsp;</td>?
    154?                                </tr>?
    155?                        </table>?
    156?                </div>?
    157?        </blockquote>?
    ?100        <h3 style="margin-top:0">phpBMS</h3>?
    ?101        <p><strong>Commercial Open Source Business Management Web Application</strong>?
    ?102?
    ?103        <p class="tiny">Copyright &reg; <?php echo date("Y") ?> Kreotek, LLC. All Rights Reserved. phpBMS, and the phpBMS logo are trademarks of Kreotek, LLC.</p>?
    158104?
    159105?
    160?        <h1>Community Support at www.phpbms.org</h1>?
    161?        ?
    162?        <blockquote>?
    163?                <ul>?
    164?                        <li><p><a href="http://www.phpbms.org" target="_blank">phpBMS project Web Site</a> - Main site for phpBMS development, documentation, and user support.</p></li>?
    165?                        <li><p><a href="http://phpbms.org/wiki/PhpbmsFaq" target="_blank">phpBMS FAQ</a> - Frequently asked questions </p></li>?
    166?                        <li><p><a href="http://www.phpbms.org/forum" target="_blank">phpBMS User Support forum</a> - A place for user and developer discussions.</p></li>?
    167?                        <li><p><a href="http://phpbms.org/wiki/PhpbmsGuide" target="_blank">phpBMS Wiki Documentation </a> - Wiki driven user documentation starting point.</p></li>?
    168?                </ul>?
    169?        </blockquote>?
    ?106        <p class="tiny" style="clear: right;float: right;"><a href="http://www.kreotek.com" target="_blank">http://www.kreotek.com</a></p>?
    170107?
    171?        <h1>Customization and Paid Support Options</h1>?
    172108?
    173?        <blockquote>?
    174?                <h2>Paid Technical, Development and Installation Support</h2>?
    175?        ?
    176?                <p>?
    177?                        Know that your mission critical business software is backed by?
    178?                        toll-free phone and e-mail support provided by the very people?
    179?                        who created the software.  Choose a paid support contract?
    180?                        provided by Kreotek that suits your need and budget.?
    181?                </p>?
    182?                <p>?
    183?                        Visit <a href="http://www.kreotek.com" target="_blank">http://www.kreotek.com</a> or call?
    184?                        <strong>1-800-731-8026</strong> for more information.?
    185?                </p>?
    186?                <h2>Customizing phpBMS</h2>?
    187?                <p>?
    188?                        No two businesses are run the exact same way. Every individual buiness has uniques needs. Don't conform?
    189?                        your business processes to your software, make your software work the way your business does.?
    190?                </p>?
    191?                <p>?
    192?                        Kreotek can provide for all of  your company's customization needs.  From custom reports, importing, adding fields,?
    193?                        or integrating with legacy systems, let the people who created the software tailor phpBMS to work within your?
    194?                        specific business processes.?
    195?                </p>?
    196?                <p>?
    197?                        Visit <a href="http://www.kreotek.com" target="_blank">http://www.kreotek.com</a> or call?
    198?                        <strong>1-800-731-8026</strong> for more information.?
    199?                </p>?
    200?        </blockquote>?
    ?109        <p class="small">?
    ?110                <strong>Kreotek, LLC</strong><br />?
    ?111                610 Quantum<br />?
    ?112                Rio Rancho, NM 87124 USA?
    ?113        </p>?
    ?114?
    ?115?
    ?116        <p class="tiny">?
    ?117                U.S. and Canada Toll Free<br />?
    ?118                1-800-731-8026?
    ?119        </p>?
    ?120?
    ?121        <p class="tiny">?
    ?122                Outside US and Canada<br />?
    ?123                +1-505-994-6388?
    ?124        </p>?
    ?125?
    ?126        <h3>Community Support</h3>?
    ?127        <ul>?
    ?128                <li class="small"><a href="http://www.phpbms.org" target="_blank">phpBMS project Web Site</a></li>?
    ?129                <li class="small"><a href="http://www.phpbms.org/forum" target="_blank">phpBMS Community Support forum</a></li>?
    ?130                <li class="small"> <a href="http://phpbms.org/wiki/PhpbmsGuide" target="_blank">phpBMS Wiki Documentation </a></li>?
    ?131        </ul>?
    ?132?
    ?133        <h3>Paid Support and Customization</h3>?
    ?134        <p class="small">?
    ?135                Receive paid support directly from the creators of phpBMS, Kreotek.?
    ?136                We have multiple tiers of support contracts available and can customize?
    ?137                phpBMS to suit your specific needs.?
    ?138        </p>?
    ?139?
    201140</div>?
    202141<p align="right"><button id="helpClose" type="button" class="Buttons" onclick="closeModal()"><span>close</span></button></p>?
  • trunk/phpbms/include/common_functions.php

    r427 r485 ?
    4040// it should be instanced in session.php?
    4141class phpbms{?
    42?        ?
    ?42?
    4343        var $db;?
    4444        var $modules = array();//array of installed modules?
    ? ? ?
    4848        var $bottomJS = array();?
    4949        var $onload = array();?
    50?                ?
    ?50?
    5151        var $showFooter = true;?
    5252        var $showMenu = true;?
    53?        ?
    ?53?
    5454        function phpbms($db){?
    5555                $this->db = $db;?
    56?                ?
    ?56?
    5757                $this->modules = $this->getModules();?
    5858        }?
    ? ? ?
    6565                }?
    6666        }?
    67?        ?
    ?67?
    6868        function showJsIncludes(){?
    6969                foreach($this->jsIncludes as $theinclude){?
    ? ? ?
    8484        }//end method?
    8585?
    86?        ?
    ?86?
    8787        function getModules(){?
    8888                $modules = array();?
    89?                ?
    ?89?
    9090                $querystatement = "SELECT * FROM `modules`";?
    9191                $queryresult = $this->db->query($querystatement);?
    9292                while($therecord = $this->db->fetchArray($queryresult))?
    9393                        $modules[$therecord["name"]] = $therecord;?
    94?                        ?
    ?94?
    9595                return $modules;?
    9696        }?
    97?        ?
    ?97?
    9898?
    9999        function displayRights($roleid,$rolename = NULL){?
    100100                        switch($roleid){?
    101?                                ?
    ?101?
    102102                                case 0:?
    103103                                        echo "EVERYONE";?
    104104                                break;?
    105?                                ?
    ?105?
    106106                                case -100:?
    107107                                        echo "Administrators";?
    108108                                break;?
    109?                                ?
    ?109?
    110110                                default:?
    111111                                        if(!$rolename){?
    112112                                                $querystatement = "SELECT name FROM roles WHERE id=".((int) $roleid);?
    113113                                                $queryresult = $this->db->query($querystatement);?
    114?        ?
    ?114?
    115115                                                $therecord = $this->db->fetchArray($queryresult);?
    116116                                                $rolename = $therecord["name"];?
    117117                                        }//end if?
    118?                                        ?
    ?118?
    119119                                        echo $rolename;?
    120120                        }//end case?
    ? ? ?
    123123?
    124124        function showTabs($tabgroup,$currenttabid,$recordid=0){?
    125?                        ?
    ?125?
    126126                $querystatement="SELECT id,name,location,enableonnew,notificationsql,tooltip,roleid FROM tabs WHERE tabgroup=\"".$tabgroup."\" ORDER BY displayorder";?
    127127                $queryresult=$this->db->query($querystatement);?
    128?        ?
    129?                ?><ul class="tabs"><?php ?
    ?128?
    ?129                ?><ul class="tabs"><?php?
    130130                        while($therecord=$this->db->fetchArray($queryresult)){?
    131131?
    132132                                if(hasRights($therecord["roleid"])){?
    133?                        ?
    ?133?
    134134                                        ?><li <?php if($therecord["id"]==$currenttabid) echo "class=\"tabsSel\"" ?>><?php?
    135135                                                if($therecord["id"]==$currenttabid || ($recordid==0 && $therecord["enableonnew"]==0)){?
    ? ? ?
    143143                                                        $therecord["notificationsql"]=str_replace("{{id}}",((int) $recordid),$therecord["notificationsql"]);?
    144144                                                        $notificationresult=$this->db->query($therecord["notificationsql"]);?
    145?                ?
    ?145?
    146146                                                        if($this->db->numRows($notificationresult)!=0){?
    147147                                                                $notificationrecord=$this->db->fetchArray($notificationresult);?
    ? ? ?
    153153                                                        }?
    154154                                                }?
    155?                                                ?
    ?155?
    156156                                                echo $opener.$therecord["name"].$closer;?
    157?                ?
    158?                                        ?></li><?php ?
    ?157?
    ?158                                        ?></li><?php?
    159159                                }//endif hasRights?
    160?                        }//end whilt    ?
    ?160                        }//end whilt?
    161161                ?>?
    162162                </ul><?php?
    ? ? ?
    165165?
    166166        function getUserName($id=0){?
    167?                ?
    ?167?
    168168                $querystatement="select concat(firstname,\" \",lastname) as name from users where id=".((int) $id);?
    169169                $queryresult = $this->db->query($querystatement);?
    170?        ?
    ?170?
    171171                $tempinfo = $this->db->fetchArray($queryresult);?
    172172                return trim($tempinfo["name"]);?
    173?                ?
    ?173?
    174174        }// end method?
    175175?
    ? ? ?
    222222                                if(count($temparray)==3)?
    223223                                        $thedate=mktime(0,0,0,(int) $temparray[1],(int) $temparray[2],(int) $temparray[0]);?
    224?                                else ?
    ?224                                else?
    225225                                        return false;?
    226226                        break;?
    ? ? ?
    231231                                if(count($temparray)==4)?
    232232                                        $thedate=mktime(0,0,0,(int) $temparray[1],(int) $temparray[2],(int) $temparray[3]);?
    233?                                else ?
    ?233                                else?
    234234                                        return false;?
    235235                        break;?
    236?                        ?
    ?236?
    237237                        case "English, UK":?
    238238                                $datestring="/".ereg_replace(",.","/",$datestring);?
    ? ? ?
    240240                                if(count($temparray)==4)?
    241241                                        $thedate=mktime(0,0,0,(int) $temparray[2],(int) $temparray[1],(int) $temparray[3]);?
    242?                                else ?
    ?242                                else?
    243243                                        return false;?
    244244                        break;?
    245?                        ?
    ?245?
    246246                        case "Dutch, NL":?
    247247                                $datestring="-".ereg_replace(",.","-",$datestring);?
    ? ? ?
    249249                                if(count($temparray)==4)?
    250250                                        $thedate=mktime(0,0,0,(int) $temparray[2],(int) $temparray[1],(int) $temparray[3]);?
    251?                                else ?
    ?251                                else?
    252252                                        return false;?
    253253                        break;?
    ? ? ?
    302302                                $datestring=strftime("%Y-%m-%d",$thedate);?
    303303                        break;?
    304?                        ?
    ?304?
    305305                        case "English, US":?
    306306                                $datestring=strftime("%m/%d/%Y",$thedate);?
    307307                        break;?
    308?                        ?
    ?308?
    309309                        case "English, UK":?
    310310                                $datestring=strftime("%d/%m/%Y",$thedate);?
    ? ? ?
    349349                if($format=="24 Hour")?
    350350                        $timestring=$sqltime;?
    351?                else ?
    ?351                else?
    352352                        $timestring=timeToString(stringToTime($sqltime,"24 Hour"),$format);?
    353353        return $timestring;?
    ? ? ?
    362362                        if(count($tempdatearray)>1 && count($temptimearray)>1)?
    363363                                $thedatetime=mktime((int) $temptimearray[0],(int) $temptimearray[1],(int) $temptimearray[2],(int) $tempdatearray[1],(int) $tempdatearray[2],(int) $tempdatearray[0]);?
    364?                }               ?
    ?364                }?
    365365                return $thedatetime;?
    366366}?
    ? ? ?
    371371        if($sqldatetime!=""){?
    372372                $datetimearray=explode(" ",$sqldatetime);?
    373?                ?
    ?373?
    374374                $datestring=trim($datetimearray[0]);?
    375375                if($dateformat=="SQL")?
    376376                        $datestring=$datestring;?
    377?                else ?
    ?377                else?
    378378                        $datestring=dateToString(stringToDate($datestring,"SQL"),$dateformat);?
    379379                if(isset($datetimearray[1])){?
    ? ? ?
    381381                        if($timeformat=="24 Hour")?
    382382                                $timestring=$timestring;?
    383?                        else ?
    ?383                        else?
    384384                                $timestring=timeToString(stringToTime($timestring,"24 Hour"),$timeformat);?
    385385                }?
    ? ? ?
    400400        settype($datetime, 'string');?
    401401        eregi('(....)(..)(..)(..)(..)(..)',$datetime,$matches);?
    402?        array_shift ($matches); ?
    ?402        array_shift ($matches);?
    403403        foreach (array('year','month','day','hour','minute','second') as $var) {?
    404404                $$var = (int) array_shift($matches);?
    405405        }?
    406?        ?
    407?        ?
    ?406?
    ?407?
    408408        $thedatetime=mktime($hour,$minute,$second,$month,$day,$year);?
    409?        ?
    ?409?
    410410        return trim(dateToString($thedatetime,$dateformat)." ".timeToString($thedatetime,$timeformat));?
    411411}?
    ? ? ?
    448448        $number=str_replace(DECIMAL_SYMBOL,".",$number);?
    449449        $number=((real) $number);?
    450?        ?
    ?450?
    451451        return $number;?
    452452}?
    453453?
    454??
    ?454// Phone/Email functions?
    ?455//=====================================================================?
    ?456function validateEmail($value){?
    ?457?
    ?458        $thereturn = false;?
    ?459        $atPos = strpos($value, "@");?
    ?460?
    ?461        //@ symobol must be after first char?
    ?462        if($atPos > 0){?
    ?463?
    ?464                $dotPos = strpos($value, ".", $atPos);?
    ?465                $length = strlen($value);?
    ?466?
    ?467                //the dot must be at least 2 chars away from at?
    ?468                //it also must not be the last char in the string?
    ?469                if( ($dotPos > ($atPos + 1)) && ($length > ($dotPos + 1)) )?
    ?470                        $thereturn = true;?
    ?471?
    ?472        }//end if?
    ?473?
    ?474        return $thereturn;?
    ?475?
    ?476}//end function --validateEmail--?
    ?477?
    ?478?
    ?479function validatePhone($number){?
    ?480?
    ?481        //need to decide on the phone reg ex based upon settings information?
    ?482        switch(PHONE_FORMAT){?
    ?483?
    ?484                case "US - Loose":?
    ?485                        $phoneRegEx = "/^(?:[\+]?(?:[\d]{1,3})?(?:\s*[\(\.-]?(\d{3})[\)\.-])?\s*(\d{3})[\.-](\d{4}))(?:(?:[ ]+(?:[xX]|(?:[eE][xX][tT][\.]?)))[ ]?[\d]{1,5})?$/";?
    ?486                break;?
    ?487?
    ?488                case "US - Strict":?
    ?489                        $phoneRegEx = "/^[2-9]\d{2}-\d{3}-\d{4}$/";?
    ?490                break;?
    ?491?
    ?492                case "UK - Loose":?
    ?493                        $phoneRegEx = "/^((\(?0\d{4}\)?\s?\d{3}\s?\d{3})|(\(?0\d{3}\)?\s?\d{3}\s?\d{4})|(\(?0\d{2}\)?\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$/";?
    ?494                break;?
    ?495?
    ?496                case "International":?
    ?497                        $phoneRegEx = "/^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$/";?
    ?498                break;?
    ?499                case "No Verification":?
    ?500                        $phoneRegEx = "/.*/";?
    ?501                break;?
    ?502        }//end switch?
    ?503?
    ?504        return preg_match($phoneRegEx,$number);?
    ?505?
    ?506}//end function --validatePhone--?
    455507?
    456508//============================================================================?
    ? ? ?
    496548?
    497549        //This function prepares an array for SQL manipulation.?
    498?        ?
    ?550?
    499551        if(get_magic_quotes_runtime() || get_magic_quotes_gpc()){?
    500?        ?
    501?                foreach ($thearray as $key=>$value) ?
    ?552?
    ?553                foreach ($thearray as $key=>$value)?
    502554                        if(is_array($value))?
    503555                                $thearray[$key]= addSlashesToArray($value);?
    504556                        else?
    505557                                $thearray[$key] = mysql_real_escape_string(stripslashes($value));?
    506?                                ?
    507?        } else  ?
    ?558?
    ?559        } else?
    508560                foreach ($thearray as $key=>$value)?
    509561                        if(is_array($value))?
    510?                                $thearray[$key]= addSlashesToArray($value);                             ?
    ?562                                $thearray[$key]= addSlashesToArray($value);?
    511563                        else?
    512564                                $thearray[$key] = mysql_real_escape_string($value);?
    513?        ?
    ?565?
    514566        return $thearray;?
    515?        ?
    ?567?
    516568}//end function?
    517569?
    ? ? ?
    522574        if(!isset($sqlEncoding))?
    523575                $sqlEncoding = "";?
    524?                ?
    ?576?
    525577        switch ($sqlEncoding){?
    526?        ?
    ?578?
    527579                case "latin1":?
    528580                        $encoding = "ISO-8859-15";?
    529581                        break;?
    530?                ?
    ?582?
    531583                case "utf8":?
    532584                default:?
    533585                        $encoding = "UTF-8";?
    534586                        break;?
    535?        ?
    ?587?
    536588        }//endswitch?
    537?        ?
    ?589?
    538590        return htmlspecialchars($string, ENT_COMPAT, $encoding);?
    539591?
    ? ? ?
    605657                        $value=$value;?
    606658                        break;?
    607?                ?
    608?                ?
    ?659?
    ?660?
    609661                case "bbcode":?
    610662                        $value=htmlQuotes($value);?
    611?                                                ?
    ?663?
    612664                        // This list needs to be expanded?
    613665                        $bbcodelist["[b]"] = "<strong>";?
    ? ? ?
    615667                        $bbcodelist["[br]"] = "<br />";?
    616668                        $bbcodelist["[space]"] = "&nbsp;";?
    617?                        ?
    ?669?
    618670                        foreach($bbcodelist as $bbcode => $translation)?
    619671                                $value = str_replace($bbcode, $translation, $value);?
    620?                                                        ?
    621?                        break;?
    622?                        ?
    ?672?
    ?673                        break;?
    ?674?
    623675                default:?
    624676                        $value=htmlQuotes($value);?
    ? ? ?
    639691?
    640692        function nl_langinfo($constant){?
    641?        ?
    642?                return $constant;       ?
    643?                ?
    ?693?
    ?694                return $constant;?
    ?695?
    644696        }//end function?
    645697?
    646698        function nl_setup(){?
    647?        ?
    ?699?
    648700                $date = mktime(0,0,0,10,7,2007);?
    649?                ?
    ?701?
    650702                for($i = 1; $i<=7; $i++){?
    651?                ?
    ?703?
    652704                        define("ABDAY_".$i, date("D", $date));?
    653705                        define("DAY_".$i, date("l"), $date);?
    654?                        ?
    ?706?
    655707                        $date = strtotime("tomorrow", $date);?
    656708                }//end for?
    657?                ?
    658?                ?
    ?709?
    ?710?
    659711                for($i = 1; $i<=12; $i++){?
    660?                        ?
    ?712?
    661713                        $date = mktime(0, 0, 0, $i, 1, 2007);?
    662?                        ?
    ?714?
    663715                        define("ABMON_".$i, date("M", $date));?
    664716                        define("MON_".$i, date("F"), $date);?
    665?                ?
    ?717?
    666718                }//end for?
    667?                                ?
    ?719?
    668720        }//end function?
    669721?
    670722        nl_setup();?
    671?        ?
    ?723?
    672724}//end if?
    673725?>?
  • trunk/phpbms/include/db.php

    r427 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev: 249 $ | $LastChangedBy: brieb $?
    ? ? ?
    4141                //we may want to do more than connect via mysql;?
    4242                var $type="mysql";?
    43?                                ?
    ?43?
    4444                // mysql vars;?
    4545                var $db_link;?
    ? ? ?
    4949                var $dbpass;?
    5050                var $pconnect=true;?
    51?                ?
    ?51?
    5252                var $showError=false;?
    5353                var $logError=true;?
    5454                var $stopOnError=true;?
    5555                var $errorFormat="xhtml";?
    56?                ?
    ?56?
    5757                var $error = NULL;?
    58?                                ?
    ?58?
    5959                function db($connect = true, $hostname = NULL, $schema = NULL, $user = NULL, $pass = NULL, $pconnect = NULL, $type = "mysql"){?
    60?                        ?
    ?60?
    6161                        if($type!="mysql")?
    6262                        $this->type=$type;?
    ? ? ?
    6969                                        if($hostname!=NULL)?
    7070                                                $this->hostname = $hostname;?
    71?                                        ?
    ?71?
    7272                                        if(defined("MYSQL_DATABASE"))?
    7373                                                $this->schema = MYSQL_DATABASE;?
    7474                                        if($schema!=NULL)?
    7575                                                $this->schema = $schema;?
    76?                ?
    ?76?
    7777                                        if(defined("MYSQL_USER"))?
    7878                                                $this->dbuser = MYSQL_USER;?
    7979                                        if($schema!=NULL)?
    8080                                                $this->dbuser = $user;?
    81?                ?
    ?81?
    8282                                        if(defined("MYSQL_USERPASS"))?
    8383                                                $this->dbpass = MYSQL_USERPASS;?
    8484                                        if($schema!=NULL)?
    8585                                                $this->dbpass = $pass;?
    86?                ?
    ?86?
    8787                                        if(defined("MYSQL_PCONNECT"))?
    8888                                                $this->pconnect = MYSQL_PCONNECT;?
    8989                                        if($pconnect!=NULL)?
    9090                                                $this->pconnect = $pconnect;?
    91?                                break;                          ?
    ?91                                break;?
    9292                        }?
    93?                                                ?
    ?93?
    9494                        if($connect){?
    9595                                if($this->connect()){?
    ? ? ?
    9797                                                return $this->db_link;?
    9898                                        else?
    99?                                                return false;                           ?
    ?99                                                return false;?
    100100                                } else?
    101101                                        return false;?
    ? ? ?
    106106                function connect(){?
    107107                        // This functions connects to the database.  It uses pconnect if the variable is set;?
    108?                                                ?
    ?108?
    109109                        if($this->pconnect)?
    110110                                $this->db_link = @ mysql_pconnect($this->hostname,$this->dbuser,$this->dbpass);?
    111111                        else?
    112112                                $this->db_link = @ mysql_connect($this->hostname,$this->dbuser,$this->dbpass);?
    ?113?
    113114                        if(!$this->db_link){?
    ?115?
    114116                                $error = new appError(-400,"Could not connect to database server.\n\n".$this->getError(),"",$this->showError,$this->stopOnError,false,$this->errorFormat);?
    115117                                return false;?
    116?                        } else                  ?
    ?118?
    ?119                        } else?
    117120                                return $this->db_link;?
    118?                }?
    119??
    120?                ?
    ?121?
    ?122                }//end function connect?
    ?123?
    ?124?
    121125                function selectSchema($schema=NULL){?
    122126                        if($schema!=NULL)?
    123127                                $this->schema=$schema;?
    124?                                ?
    ?128?
    125129                        if(! @ mysql_select_db($this->schema,$this->db_link)){?
    126?                                $error = new appError(-410,"Could not open schema ".$this->schema,"",$this->showError,$this->stopOnError,false,$this->errorFormat);     ?
    ?130                                $error = new appError(-410,"Could not open schema ".$this->schema,"",$this->showError,$this->stopOnError,false,$this->errorFormat);?
    127131                                return false;?
    128132                        } else?
    129?                                return true;                                                    ?
    ?133                                return true;?
    130134                }?
    131135?
    ? ? ?
    134138                        switch($this->type){?
    135139                                case "mysql":?
    136?                                        if(!isset($this->db_link)) ?
    137?                                                if(!$this->dataB()) die($this->error);?
    ?140                                        if(!isset($this->db_link))?
    ?141                                                if(!$this->db()) die($this->error);?
    138142                                        $queryresult = @ mysql_query($sqlstatement,$this->db_link);?
    139143                                        if(!$queryresult){?
    ? ? ?
    141145                                                $error = new appError(-420,$this->getError($this->db_link)."\n\nStatement: ".$sqlstatement,"",$this->showError,$this->stopOnError,$this->logError,$this->errorFormat);?
    142146                                                return false;?
    143?                                        }                                       ?
    144?                                break;?
    145?                        }//end case?
    146?                        ?
    ?147                                        }?
    ?148                                break;?
    ?149                        }//end case?
    ?150?
    147151                        $this->error=NULL;?
    148152                        return $queryresult;?
    ? ? ?
    153157?
    154158                        switch($this->type){?
    155?                                case "mysql":                   ?
    ?159                                case "mysql":?
    156160                                        @ mysql_query("SET NAMES ".$encoding, $this->db_link);?
    157161                                        break;?
    158?                                        ?
    ?162?
    159163                        }//endswitch?
    160164?
    ? ? ?
    163167?
    164168                function getError($link = NULL){?
    165?                        ?
    166?                        switch($this->type){?
    167?                                case "mysql":?
    168?                                        $thereturn = mysql_error($link);?
    ?169?
    ?170                        switch($this->type){?
    ?171                                case "mysql":?
    ?172                                        if($link)?
    ?173                                                $thereturn = @ mysql_error($link);?
    ?174                                        else?
    ?175                                                $thereturn = @ mysql_error();?
    169176                                break;?
    170177                        }//end switch --type--?
    171?                        ?
    172?                        return $thereturn;?
    173?                        ?
    ?178?
    ?179                        return $thereturn;?
    ?180?
    174181                }//end method --getError--?
    175?                ?
    ?182?
    176183?
    177184                function numRows($queryresult){?
    ? ? ?
    200207                }//end function?
    201208?
    202?                ?
    ?209?
    203210                function startTransaction(){?
    204?                        ?
    205?                        switch($this->type){?
    206?                                ?
    ?211?
    ?212                        switch($this->type){?
    ?213?
    207214                                case "mysql":?
    208215                                        $this->query("START TRANSACTION;");?
    209216                                break;?
    210?                        ?
    ?217?
    211218                        }//end switch?
    212?                        ?
    ?219?
    213220                }//end method --startTransaction--?
    214?                ?
    215?                ?
    ?221?
    ?222?
    216223                function commitTransaction(){?
    217?                        ?
    218?                        switch($this->type){?
    219?                                ?
    ?224?
    ?225                        switch($this->type){?
    ?226?
    220227                                case "mysql":?
    221228                                        $this->query("COMMIT;");?
    222229                                break;?
    223?                        ?
    ?230?
    224231                        }//end switch?
    225?                        ?
    ?232?
    226233                }//end method --startTransaction--?
    227?                ?
    228?                ?
    ?234?
    ?235?
    229236                function rollbackTransaction(){?
    230?                        ?
    231?                        switch($this->type){?
    232?                                ?
    ?237?
    ?238                        switch($this->type){?
    ?239?
    233240                                case "mysql":?
    234241                                        $this->query("ROLLBACK;");?
    235242                                break;?
    236?                        ?
    ?243?
    237244                        }//end switch?
    238?                        ?
    ?245?
    239246                }//end method --startTransaction--?
    240?                ?
    ?247?
    241248?
    242249                function seek($queryresult,$rownum){?
    ? ? ?
    278285                        return $thereturn;?
    279286                }//end function?
    280?                ?
    281?                ?
    ?287?
    ?288?
    282289                function tableInfo($tablename){?
    283290                        //this function returns a multi-dimensional array describing the fields in a given table?
    ? ? ?
    291298                                                        $thereturn[$name]["type"] = @ mysql_field_type($queryresult,$offset);?
    292299                                                        $thereturn[$name]["length"] = mysql_field_len($queryresult,$offset);?
    293?                                                        $thereturn[$name]["flags"] = mysql_field_flags($queryresult,$offset);                                                   ?
    ?300                                                        $thereturn[$name]["flags"] = mysql_field_flags($queryresult,$offset);?
    294301                                                }?
    295302                                        }?
    ? ? ?
    305312                                case "mysql":?
    306313                                        $thereturn = @ mysql_insert_id($this->db_link);?
    307?                                break;                  ?
    ?314                                break;?
    308315                        }?
    309?                        ?
    ?316?
    310317                        return $thereturn;?
    311318                }?
    312?                ?
    ?319?
    313320                function affectedRows(){?
    314321                        $thereturn = false;?
    ? ? ?
    316323                                case "mysql":?
    317324                                        $thereturn = @ mysql_affected_rows($this->db_link);?
    318?                                break;                  ?
    ?325                                break;?
    319326                        }?
    320?                        ?
    ?327?
    321328                        return $thereturn;?
    322329                }?
    323?                ?
    ?330?
    324331}//end db class?
    325332?>?
  • trunk/phpbms/include/fields.php

    r447 r485 ?
    451451                                ?><option value="0" <?php?
    452452                                if ($this->value==0 || $this->value==""){?
    453?                                        echo " selected=\"selected\" "?>>&lt;none&gt;</option><?php?
    ?453                                        echo " selected=\"selected\" ";?
    454454                                }//end if --value--?
    ?455                                ?>>&lt;none&gt;</option><?php?
    455456                        }//end if --hasblank--?
    456457?
  • trunk/phpbms/include/imports.php

    r433 r485 ?
    11<?php?
    22        class phpbmsImport{?
    3?                ?
    ?3?
    44                var $table;?
    55                var $error = "";?
    ? ? ?
    1010                var $data;?
    1111                var $revertID = 0;?
    12?                ?
    ?12?
    1313                // Do not manually override?
    1414                var $transactionRecords = array();?
    1515                var $tempFileID = 0;?
    1616                var $pageType = "main";?
    17?                ?
    ?17?
    1818                function phpbmsImport($table, $importType = "csv"){?
    19?                        ?
    ?19?
    2020                        $this->table = $table;?
    2121                        $this->importType = $importType;?
    ? ? ?
    2525                                break;?
    2626                        }//end switch?
    27?                        ?
    ?27?
    2828                        $this->table->db->logError = true;?
    2929                        //So, that, when there is a db error, it will go all the way through and not just stop?
    3030                        $this->table->db->stopOnError = false;?
    31?                        //Won't display db errors, just log them.       ?
    ?31                        //Won't display db errors, just log them.?
    3232                        $this->table->db->showError = false;?
    3333                        if(isset($_POST["pageType"]))?
    3434                                $this->pageType = $_POST["pageType"];?
    35?                        ?
    ?35?
    3636                        if(isset($_POST["tempFileID"]))?
    3737                                $this->tempFileID = ((int)$_POST["tempFileID"]);?
    38?                        ?
    ?38?
    3939                }//end method --imports--?
    40?                ?
    ?40?
    4141                function _parseFromData($data){?
    42?                        ?
    ?42?
    4343                        switch($this->importType){?
    44?                                ?
    ?44?
    4545                                case "csv":?
    46?                                        ?
    ?46?
    4747                                        if(is_readable($data)){?
    4848                                                $contents = $this->_getFile($data);?
    49?                                        ?
    ?49?
    5050                                                if(is_readable($contents)){?
    5151                                                        $this->docError = "invalid csv document";?
    5252                                                        return false;?
    5353                                                }//end if?
    54?                                                ?
    ?54?
    5555                                        }//end if?
    56?                                        ?
    ?56?
    5757                                        $this->parser->parse($data);?
    58?                                                ?
    ?58?
    5959                                        if(!count($this->parser->titles) || !count($this->parser->data)){?
    6060                                                $this->docError = "invalid csv document";?
    61?                                                return false;   ?
    ?61                                                return false;?
    6262                                        }//end if?
    63?                                        ?
    ?63?
    6464                                        return true;?
    6565                                break;?
    66?                        ?
    ?66?
    6767                        }//end swtich?
    68?                ?
    ?68?
    6969                }//end method --_parseFromFile--?
    70?                ?
    71?                ?
    ?70?
    ?71?
    7272                function _getTransactionData(){?
    7373                //needs to be changed for more complicated tables?
    ? ? ?
    7575                        foreach($this->transactionIDs as $theid)?
    7676                                $inStatement .= $theid.",";?
    77?                        ?
    ?77?
    7878                        if($inStatement){?
    79?                                ?
    ?79?
    8080                                $inStatement = substr($inStatement, 0, -1);?
    81?                        ?
    ?81?
    8282                                $querystatement = "?
    8383                                        SELECT?
    ? ? ?
    8888                                                `id` IN (".$inStatement.");?
    8989                                        ";?
    90?                                ?
    ?90?
    9191                                $queryresult = $this->table->db->query($querystatement);?
    92?                                ?
    ?92?
    9393                                while($therecord = $this->table->db->fetchArray($queryresult))?
    9494                                        $this->transactionRecords[] = $therecord;?
    95?                                        ?
    96?                        }//end if ?
    97?                        ?
    ?95?
    ?96                        }//end if?
    ?97?
    9898                }//end method --_getTransactionData--?
    99?                ?
    100?                ?
    ?99?
    ?100?
    101101                function _getFile($fileName){?
    102102                        if(function_exists('file_get_contents')){?
    ? ? ?
    106106                                $file = addslashes(fread(fopen($fileName, 'r'), filesize($fileName)));?
    107107                        }//end if?
    108?                        ?
    ?108?
    109109                        return $file;?
    110110                }//end method --_getFile--?
    111?                ?
    ?111?
    112112                //DO NOT CALL IN TRANSACTION?
    113113                function _storeTempCSV($fileName){?
    114?                        ?
    ?114?
    115115                        $querystatement = "?
    116116                                INSERT INTO?
    ? ? ?
    136136                                                '".$_SESSION["userinfo"]["id"]."',?
    137137                                                '".$_SESSION["userinfo"]["id"]."'?
    138?                                                ?
    ?138?
    139139                                        )?
    140140                                ";?
    141?                        ?
    ?141?
    142142                        $this->table->db->query($querystatement);?
    143?                        ?
    ?143?
    144144                        $id = $this->table->db->insertId();?
    145?                        ?
    ?145?
    146146                        if($id)?
    147147                                $this->tempFileID = ((int) $id);?
    148148                        else?
    149149                                $this->error .= '<li> inserting temporary file failure </li>';?
    150?                        ?
    ?150?
    151151                }//end method --_storeTempCSV--?
    152?                ?
    153?                ?
    ?152?
    ?153?
    154154                function _getTempCSV($tempFileID){?
    155?                        ?
    ?155?
    156156                        if($tempFileID){?
    157?                                ?
    ?157?
    158158                                $querystatement = "?
    159159                                        SELECT?
    ? ? ?
    164164                                                id = ".((int)$tempFileID)."?
    165165                                        ";?
    166?                                ?
    ?166?
    167167                                $queryresult = $this->table->db->query($querystatement);?
    168?                                ?
    ?168?
    169169                                $therecord = $this->table->db->fetchArray($queryresult);?
    170?                                ?
    ?170?
    171171                                return $therecord["file"];?
    172?                        ?
    ?172?
    173173                        }//end if?
    174?                        ?
    ?174?
    175175                        return false;?
    176?                        ?
    ?176?
    177177                }//end method --_getTempCSV--?
    178?                ?
    ?178?
    179179                //DO NOT CALL IN TRANSACTION?
    180180                function _removeTempCSV($tempFileID = 0){?
    181?                        ?
    ?181?
    182182                        $querystatement = "?
    183183                                DELETE FROM?
    ? ? ?
    192192                                        );?
    193193                                ";?
    194?                                ?
    ?194?
    195195                        $queryresult = $this->table->db->query($querystatement);?
    196?                        ?
    ?196?
    197197                        $querystatement = "?
    198198                                ALTER TABLE?
    ? ? ?
    200200                                AUTO_INCREMENT = ".((int) $tempFileID).";?
    201201                                ";?
    202?                        ?
    ?202?
    203203                        $queryresult = $this->table->db->query($querystatement);?
    204?                        ?
    ?204?
    205205                }//end method --_removeTempCSV--?
    206?                ?
    ?206?
    207207                //DO NOT USE THIS METHOD INSIDE AN OPEN TRANSACTION.?
    208208                //IT WILL AUTOMATICALLY COMMIT THE TRANSACTION?
    209209                function _revertAutoIncrement($revertID = 0){?
    210?                        ?
    ?210?
    211211                        //check to see if there is a revert id (i.e. there was a valid insert)?
    212212                        if($revertID)?
    213213                                if(is_numeric($revertID)){?
    214?                                        ?
    ?214?
    215215                                        $querystatement = "?
    216216                                                ALTER TABLE?
    ? ? ?
    218218                                                AUTO_INCREMENT = ".((int) $revertID).";?
    219219                                                ";?
    220?                                        ?
    ?220?
    221221                                        $this->table->db->query($querystatement);?
    222?                                        ?
    ?222?
    223223                                }//end if?
    224?                        ?
    ?224?
    225225                }//end method --_revertAutoIncrement--?
    226?                ?
    227?                ?
    ?226?
    ?227?
    228228                function importRecords($rows, $titles){?
    229?                        ?
    ?229?
    230230                        switch($this->importType){?
    231?                                ?
    232?                                case "csv":                     ?
    ?231?
    ?232                                case "csv":?
    233233                                        //count total fieldnames (top row of csv document)?
    234234                                        $fieldNum = count($titles);?
    235?                                        ?
    ?235?
    236236                                        //the file starts at line number 1, but since line 1 is?
    237237                                        //supposed to be the fieldnames in the table(s), the lines?
    238238                                        //being insereted start @ 2.?
    239239                                        $rowNum = 2;?
    240?                                        ?
    ?240?
    241241                                        //get the data one row at a time?
    242242                                        foreach($rows as $rowData){?
    243?                                                ?
    244?                                                $theid = 0;?
    245?                                                ?
    ?243?
    ?244                                                $theid = 0; // set for when verifification does not pass?
    ?245                                                $verify = array(); //set for when number of field rows does not match number of titles?
    ?246?
    246247                                                //trim off leading/trailing spaces?
    247248                                                $trimmedRowData = array();?
    ?249?
    248250                                                foreach($rowData as $name => $data)?
    249251                                                        $trimmedRowData[$name] = trim($data);?
    250?                                                ?
    ?252?
    251253                                                //check to see if number of fieldnames is consistent for each row?
    252254                                                $rowFieldNum = count($trimmedRowData);?
    253?                                                ?
    ?255?
    254256                                                //if valid, insert, if not, log error and don't insert.?
    255?                                                if($rowFieldNum == $fieldNum)?
    256?                                                        $theid = $this->table->insertRecord($trimmedRowData);?
    257?                                                else?
    ?257                                                if($rowFieldNum == $fieldNum){?
    ?258                                                        $verify = $this->table->verifyVariables($trimmedRowData);?
    ?259                                                        if(!count($verify))?
    ?260                                                                $theid = $this->table->insertRecord($trimmedRowData);?
    ?261                                                }else?
    258262                                                        $this->error .= '<li> incorrect amount of fields for line number '.$rowNum.'.</li>';?
    259?                                                ?
    ?263?
    260264                                                if($theid){?
    261265                                                        //keep track of the ids in the transaction to be able to select them?
    262266                                                        //for preview purposes?
    263267                                                        $this->transactionIDs[] = $theid;?
    264?                                                        ?
    ?268?
    265269                                                        //get first id to correct auto increment?
    266270                                                        if(!$this->revertID)?
    ? ? ?
    268272                                                }else?
    269273                                                        $this->error .= '<li> failed insert for line number '.$rowNum.'.</li>';?
    270?                                                ?
    ?274?
    ?275                                                foreach($verify as $error)?
    ?276                                                        $this->error .= '<li class="subError">'.$error.'</li>';?
    ?277?
    271278                                                $rowNum++;?
    272?                                                ?
    ?279?
    273280                                        }//end foreach?
    274281                                break;?
    275?                                ?
    ?282?
    276283                        }//end switch?
    277?                        ?
    ?284?
    278285                }//end method --importRecords--?
    279?                ?
    280?                ?
    ?286?
    ?287?
    281288                function displayTransaction($recordsArray, $fieldsArray){?
    282289                //needs to be changed for more complicated tables?
    ? ? ?
    317324                                <?php?
    318325                        }//end if?
    319?                        ?
    ?326?
    320327                }//end method --displayTransaction--?
    321?                ?
    322?                ?
    ?328?
    ?329?
    323330                function processImportPage(){?
    324?                        ?
    ?331?
    325332                        $this->table->getTableInfo();?
    326?                        ?
    ?333?
    327334                        if(!isset($_POST["command"])){?
    328?                                ?
    ?335?
    329336                                //happens upon first coming to page?
    330?                                ?
    ?337?
    331338                                //remove any other temporary csv files in the `files` table?
    332339                                //present from previous imports?
    333340                                $this->_removeTempCSV();?
    334?                                ?
    ?341?
    335342                                //check to see if user has the rights to be here.?
    336343                                //If not, kick him to the no access page.?
    337344                                if(!hasRights($this->table->importroleid))?
    338345                                        goURL(APP_PATH."noaccess.php");?
    339?                                ?
    ?346?
    340347                        }else{?
    341348                                //form has been submitted?
    342349                                switch($_POST["command"]){?
    343?                                        ?
    ?350?
    344351                                        //cancel button pressed.?
    345352                                        case "cancel":?
    ? ? ?
    354361                                                }//end if?
    355362                                        break;?
    356?                                ?
    ?363?
    357364                                        case "upload":?
    358?                                                ?
    ?365?
    359366                                                //check for valid file upload?
    360367                                                if(!$_FILES["import"]["error"] && ($_FILES["import"]["size"] > 0)){?
    361?                                                        ?
    ?368?
    362369                                                        //check and parse the file?
    363370                                                        if($this->_parseFromData($_FILES["import"]["tmp_name"])){?
    364?                                                                ?
    ?371?
    365372                                                                //start transaction?
    366373                                                                $this->table->db->startTransaction();?
    367?                                                                ?
    ?374?
    368375                                                                $this->importRecords($this->parser->data, $this->parser->titles);?
    369?                                                                ?
    ?376?
    370377                                                                //get data for preview purposes?
    371378                                                                $this->_getTransactionData();?
    372379                                                                //"undo" any inserts?
    373380                                                                $this->table->db->rollbackTransaction();?
    374?                                                                ?
    ?381?
    375382                                                                //DO NOT CALL IN TRANSACTION?
    376383                                                                //ALTER TABLES AUTO COMMIT AND THE FILE NEEDS TO CARRY?
    ? ? ?
    378385                                                                $this->_revertAutoIncrement($this->revertID);?
    379386                                                                $this->_storeTempCSV($_FILES["import"]["tmp_name"]);?
    380?                                                                ?
    ?387?
    381388                                                        }//end if?
    382?                                                        ?
    ?389?
    383390                                                }else?
    384391                                                        $this->docError .= "failed file upload";?
    385?                                                ?
    ?392?
    386393                                                //switch page types?
    387394                                                $this->pageType = "confirm";?
    388?                                                ?
    ?395?
    389396                                                if(!$this->error && !$this->docError){?
    390397                                                        $therecord["phpbmsStatus"] = "Confirm Import";?
    ? ? ?
    394401                                                }else?
    395402                                                        $therecord["phpbmsStatus"] = "Import Error";?
    396?                                                ?
    ?403?
    397404                                        break;?
    398?                                        ?
    ?405?
    399406                                        case "import":?
    400?                                                ?
    ?407?
    401408                                                //get the contents of the stored csv document?
    402409                                                $CSVcontents = $this->_getTempCSV($this->tempFileID);?
    403?                                                ?
    ?410?
    404411                                                //parser uses newline character to be able to parse the last line?
    405412                                                if(substr($CSVcontents,-1,1) != "\n")?
    406413                                                        $CSVcontents .= "\n";?
    407?                                                ?
    408?                                                ?
    ?414?
    ?415?
    409416                                                $this->parser->parse($CSVcontents);?
    410?                                                ?
    ?417?
    411418                                                $this->importRecords($this->parser->data, $this->parser->titles);?
    412?                                                ?
    ?419?
    413420                                                $this->table->db->commitTransaction();?
    414?                                                ?
    ?421?
    415422                                                //DO NOT CALL IN TRANSACTION?
    416?                                                ?
    ?423?
    417424                                                //get rid of temporary csv document?
    418425                                                $this->_removeTempCSV($this->tempFileID);?
    419?                                                ?
    ?426?
    420427                                                $therecord["phpbmsStatus"] = "Record(s) Imported";?
    421428                                                //change page type?
    422429                                                $this->pageType = "main";?
    423430                                        break;?
    424?                                        ?
    ?431?
    425432                                }//end command switch?
    426?                                        ?
    ?433?
    427434                        }// end if?
    428?                        ?
    ?435?
    429436                        //display the title?
    430437                        $therecord["title"] = $this->table->displayname." Import";?
    431438                        return $therecord;?
    432?                        ?
    ?439?
    433440                }//end method --imports--?
    434?                ?
    ?441?
    435442        }//end class --imports--?
    436?        ?
    437?        ?
    ?443?
    ?444?
    438445        //this class is to have different buttons, and no created/modified.?
    439446        if(class_exists("phpbmsForm")){?
    440447                class importForm extends phpbmsForm{?
    441?                        ?
    ?448?
    442449                        function importForm($action = NULL, $method="post", $name="record", $onsubmit="return validateForm(this);", $dontSubmit = true){?
    443?                                ?
    ?450?
    444451                                parent::phpbmsForm($action,$method,$name,$onsubmit,$dontSubmit);?
    445?                                ?
    ?452?
    446453                        }//end method --importForm--?
    447?                        ?
    448?                        function startForm($pageTitle, $pageType){?
    449?                ?
    450?                                ?><form action="<?php echo str_replace("&","&amp;",$this->action) ?>" method="<?php echo $this->method?>" name="<?php echo $this->name?>" onsubmit="<?php echo $this->onsubmit?>" <?php ?
    ?454?
    ?455                        function startForm($pageTitle, $pageType, $numberOfRecords = 0){?
    ?456?
    ?457                                ?><form action="<?php echo str_replace("&","&amp;",$this->action) ?>" method="<?php echo $this->method?>" name="<?php echo $this->name?>" onsubmit="<?php echo $this->onsubmit?>" <?php?
    451458                                        if(isset($this->enctype)) echo ' enctype="'.$this->enctype.'" ';?
    452459                                        if(isset($this->id)) echo ' id="'.$this->id.'" ';?
    453?                                ?>><?php ?
    ?460                                ?>><?php?
    454461                                if($this->dontSubmit){?
    455462                                        ?><div id="dontSubmit"><input type="submit" value=" " onclick="return false;" /></div><?php?
    456463                                } ?>?
    457?                                <div id="topButtons"><?php $this->showButtons(1, $pageType); ?></div>?
    458?                                <h1 id="h1Title"><span><?php echo $pageTitle ?></span></h1><?php        ?
    459?                                ?
    ?464                                <div id="topButtons"><?php $this->showButtons(1, $pageType, $numberOfRecords); ?></div>?
    ?465                                <h1 id="h1Title"><span><?php echo $pageTitle ?></span></h1><?php?
    ?466?
    460467                        }//end method --startForm--?
    461?                        ?
    462?                        function showButtons($ids = 1, $pageType = "main"){?
    ?468?
    ?469                        function showButtons($ids = 1, $pageType = "main", $numberOfRecords = 0){?
    463470                                ?>?
    464471                                <div class="importCancels">?
    465472                                        <?php if($pageType == "main"){ ?>?
    466?                                        <input <?php if($ids==1) {?>accesskey="i"<?php }?> title="Upload (alt+u)" id="uploadButton<?php echo $ids?>" name="command" type="submit" value="upload" class="Buttons" />?
    ?473                                        <input <?php if($ids==1) {?>accesskey="u"<?php }?> title="Upload (alt+u)" id="uploadButton<?php echo $ids?>" name="command" type="submit" value="upload" class="Buttons" />?
    467474                                        <input id="cancelButton<?php echo $ids?>" name="command" type="submit" value="cancel" class="Buttons" <?php if($ids==1) {?>accesskey="x" <?php }?> title="(access key+x)" />?
    468475                                        <?php }else{?>?
    469?                                        <input type="submit" class="Buttons" value="import" name="command" id="import<?php echo $ids?>" title="commit"/>?
    ?476                                        <input type="submit" class="Buttons" value="import" name="command" id="import<?php echo $ids?>" title="commit" <?php echo ($numberOfRecords? '':'disabled="disabled"') ?>/>?
    470477                                        <input type="submit" class="Buttons" value="cancel" name="command" id="cancelButton<?php echo $ids?>" title="rollback"/>?
    471478                                        <?php }//end if ?>?
    472479                                </div><?php?
    473480                        }//end method --showButtons--?
    474?                ?
    ?481?
    475482                }//end class --importForm--?
    476483        }?
  • trunk/phpbms/include/jstransport.php

    r440 r485 ?
    1?<?php ?
    ?1<?php?
    22        $loginNoKick=true;?
    33        $loginNoDisplayError=true;?
    4?        require_once("session.php");    ?
    5?        ?
    ?4        require_once("session.php");?
    ?5?
    66        //phone formating?
    7?        ?>phoneRegExpression=<?php ?
    ?7        ?>phoneRegExpression=<?php?
    88        switch(PHONE_FORMAT){?
    99                case "US - Loose":?
    ? ? ?
    1111                break;?
    1212                case "US - Strict":?
    13?                        ?>/^[2-9]\d{2}-\d{3}-\d{4}$/;<?php              ?
    ?13                        ?>/^[2-9]\d{2}-\d{3}-\d{4}$/;<?php?
    1414                break;?
    1515                case "UK - Loose":?
    1616                        ?>/^((\(?0\d{4}\)?\s?\d{3}\s?\d{3})|(\(?0\d{3}\)?\s?\d{3}\s?\d{4})|(\(?0\d{2}\)?\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$/;<?php?
    17?                break;  ?
    ?17                break;?
    1818                case "International":?
    1919                    ?>/^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$/;<?php?
    20?                break;  ?
    21?        } ?
    22?                ?
    ?20                break;?
    ?21                case "No Verification":?
    ?22                        ?>/.*/;<?php?
    ?23                break;?
    ?24        }?
    ?25?
    2326        //date formating?
    2427        ?>APP_PATH="<?php echo htmlQuotes(APP_PATH)?>";<?php?
    ? ? ?
    2629        //date formating?
    2730        ?>DATE_FORMAT="<?php echo htmlQuotes(DATE_FORMAT)?>";<?php?
    28?        ?
    ?31?
    2932        //time formating?
    3033        ?>TIME_FORMAT="<?php echo htmlQuotes(TIME_FORMAT)?>";<?php?
    ? ? ?
    4043?
    4144        ?>LOGIN_REFRESH=<?php echo LOGIN_REFRESH?>;<?php?
    42?        ?
    ?45?
    4346        if(defined("TERM1_DAYS")){?
    4447        ?>TERM1_DAYS=<?php echo TERM1_DAYS?>;<?php?
    4548        }//end if?
    46?        ?
    47?        ?>MONTH_NAMES_LONG= [ <?php ?
    48?                ?
    ?49?
    ?50        ?>MONTH_NAMES_LONG= [ <?php?
    ?51?
    4952                $mNames = "";?
    5053                for($i=0; $i < 11; $i++)?
    5154                        $mNames .= ', "'.strftime("%B", mktime(0, 0, 0, $i+1, 1, 1974)).'"';?
    5255                $mNames = substr($mNames, 2);?
    53?                ?
    ?56?
    5457                echo $mNames;?
    55?        ?
    56?        ?> ];<?php ?
    ?58?
    ?59        ?> ];<?php?
    5760?
    5861        if(isset($phpbms->modules["bms"])){?
    59?        ?
    ?62?
    6063                ?>TERM1_DAYS=<?php echo TERM1_DAYS?>;<?php?
    61?        ?
    ?64?
    6265        }//end if?
    63?        ?
    ?66?
    6467?
    6568?>?
  • trunk/phpbms/include/login_include.php

    r311 r485 ?
    3737 +-------------------------------------------------------------------------+?
    3838*/?
    39?        function verifyLogin($username,$password,$db){?
    40?                $thereturn = "Login Failed";?
    41?                ?
    42?                $querystatement = "SELECT id, firstname, lastname, email, phone, department, employeenumber, admin?
    43?                                                FROM users ?
    44?                                                WHERE login=\"".mysql_real_escape_string($username)."\" ?
    45?                                                AND password=ENCODE(\"".mysql_real_escape_string($password)."\",\"".mysql_real_escape_string(ENCRYPTION_SEED)."\") ?
    46?                                                AND revoked=0 AND portalaccess=0";?
    47?                                                ?
    48?                $queryresult = $db->query($querystatement);?
    49?                                ?
    50?                if($db->numRows($queryresult)){?
    51?                        ?
    ?39class login{?
    ?40?
    ?41        var $db;?
    ?42?
    ?43        function login($db){?
    ?44?
    ?45                $this->db = $db;?
    ?46?
    ?47        }//end function init?
    ?48?
    ?49?
    ?50        function verify($username, $password){?
    ?51?
    ?52                $querystatement = "?
    ?53                        SELECT?
    ?54                                id,?
    ?55                                firstname,?
    ?56                                lastname,?
    ?57                                email,?
    ?58                                phone,?
    ?59                                department,?
    ?60                                employeenumber,?
    ?61                                admin?
    ?62                        FROM?
    ?63                                users?
    ?64                        WHERE?
    ?65                                login = '".mysql_real_escape_string($username)."'?
    ?66                                AND password = ENCODE('".mysql_real_escape_string($password)."','".mysql_real_escape_string(ENCRYPTION_SEED)."')?
    ?67                                AND revoked = 0?
    ?68                                AND portalaccess = 0";?
    ?69?
    ?70                $queryresult = $this->db->query($querystatement);?
    ?71?
    ?72                if($this->db->numRows($queryresult)){?
    ?73?
    5274                        //We found a record that matches in the database?
    5375                        // populate the session and go in?
    54?                        $_SESSION["userinfo"]=$db->fetchArray($queryresult);?
    55?                        ?
    ?76                        $_SESSION["userinfo"] = $this->db->fetchArray($queryresult);?
    ?77?
    5678                        // Next get the users roles, and populate the session with them?
    57?                        $_SESSION["userinfo"]["roles"][]=0;?
    58?                        $querystatement = "SELECT roleid FROM rolestousers WHERE userid=".$_SESSION["userinfo"]["id"];?
    59?                        $rolesqueryresult = $db->query($querystatement);?
    60?                        ?
    61?                        while($rolerecord=$db->fetchArray($rolesqueryresult))?
    ?79                        $_SESSION["userinfo"]["roles"][] = 0;?
    ?80                        $querystatement = "?
    ?81                                SELECT?
    ?82                                        roleid?
    ?83                                FROM?
    ?84                                        rolestousers?
    ?85                                WHERE userid=".$_SESSION["userinfo"]["id"];?
    ?86?
    ?87                        $rolesqueryresult = $this->db->query($querystatement);?
    ?88?
    ?89                        while($rolerecord = $this->db->fetchArray($rolesqueryresult))?
    6290                                $_SESSION["userinfo"]["roles"][]=$rolerecord["roleid"];?
    63?                        ?
    64?                ?
    65?                        $querystatement = "UPDATE users SET modifieddate=modifieddate, lastlogin=Now() WHERE id = ".$_SESSION["userinfo"]["id"];?
    66?                        $updateresult = $db->query($querystatement);?
    6791?
    68?                        $_SESSION["tableparams"]=array();?
    ?92                        //update lastlogin?
    ?93                        $ip = $_SERVER["REMOTE_ADDR"];?
    ?94?
    ?95                        $updatestatement = "?
    ?96                                UPDATE?
    ?97                                        users?
    ?98                                SET?
    ?99                                        modifieddate = modifieddate,?
    ?100                                        lastlogin = Now(),?
    ?101                                        `lastip` = '".$ip."'?
    ?102                                WHERE?
    ?103                                        id = ".$_SESSION["userinfo"]["id"];?
    ?104?
    ?105                        $this->db->query($updatestatement);?
    ?106?
    ?107                        $_SESSION["tableparams"] = array();?
    69108?
    70109                        goURL(DEFAULT_LOAD_PAGE);?
    71?                } else          ?
    72?                return "Login Failed";?
    73?        }?
    ?110?
    ?111                } else  {?
    ?112?
    ?113                        //log login attempt?
    ?114                        $log = new phpbmsLog("Login attempt failed for user '".$username."'", "SECURITY");?
    ?115?
    ?116                        return "Login Failed";?
    ?117?
    ?118                }//endif numrows?
    74119?
    75120?
    76?// Start Code?
    77?//=================================================================================================================?
    78?        ?
    79?        $failed="";?
    80?        if (isset($_POST["name"])) {?
    81?                $variables=addSlashesToArray($_POST);?
    82?                $failed=verifyLogin($variables["name"],$variables["password"],$db);?
    83?        } else ?
    84?                $_POST["name"]="";?
    85??>?
    ?121        }//end function verify?
    ?122?
    ?123}//end class?
  • trunk/phpbms/include/session.php

    r402 r485 ?
    3737 +-------------------------------------------------------------------------+?
    3838*/?
    ?39?
    ?40// Turn on/or off debugging?
    3941@ define("APP_DEBUG",true);?
    4042if(APP_DEBUG)?
    4143        error_reporting(E_ALL);?
    4244?
    ?45?
    ?46// Error Class - This class reports errors.  It can also log these errors?
    ?47// to the phpBMS log table in some cases.?
    4348class appError{?
    ?49?
    4450        var $number=0;?
    4551        var $title="";?
    ? ? ?
    4854        var $logerror=true;?
    4955        var $format="xhtml";?
    50?        ?
    ?56?
    ?57        //init?
    5158        function appError($number=0,$details="",$title="",$display=false,$stop=true,$logerror=true,$format="xhtml"){?
    ?59?
    5260                $this->title = $title;?
    53?                ?
    54?                ?
    5561                $this->details = $details;?
    56?                ?
    5762                $this->stop = $stop;?
    58?                                ?
    ?63?
    5964                $this->logerror = $logerror;?
    6065                $this->format = $format;?
    6166                $this->number = $number;?
    62?                                ?
    ?67?
    ?68                // find a predetermined title;?
    6369                if($this->number<0){?
    ?70?
    6471                        switch($number){?
    ?72                                case -300:?
    ?73                                        $this->title = "settings.php file not readable";?
    ?74                                        $this->details =?
    ?75                                        'If this is the initial installation of the program,?
    ?76                                        you may wan to run the installer.  Use your web browser to navigate to:<br /><br />?
    ?77?
    ?78                                        <a href="'.APP_PATH.'install">phpBMS Installation</a><br /><br />?
    ?79?
    ?80                                        If your application already has a settings.php file in the main phpbms directory, you may need to give your web server rights to read the file.';?
    ?81                                        break;?
    6582                                case -400:?
    6683                                case -410:?
    ? ? ?
    7188                                case -460:?
    7289                                        $this->title="Database Error";?
    73?                                break;?
    74?                        }?
    75?                } ?
    76?                ?
    ?90                                        break;?
    ?91                        }//end case;?
    ?92?
    ?93                }//endif this->number?
    ?94?
    7795                if($display || APP_DEBUG) $this->display($format);?
    7896                if($logerror) $this->logError();?
    7997                if($this->stop) exit;?
    80?        }?
    81?        ?
    82?        function display($format=NULL){?
    83??
    84?                if($format==NULL)?
    85?                        $format=$this->format;?
    86?        ?
    ?98?
    ?99        }//eend function init?
    ?100?
    ?101?
    ?102        //This function outputs the error to screen either in?
    ?103        // XHTML, plain text, or JSON format?
    ?104        function display($format = NULL){?
    ?105?
    ?106                if($format == NULL)?
    ?107                        $format = $this->format;?
    ?108?
    87109                switch(strtolower($format)){?
    ?110?
    88111                        case "json":?
    89112?
    90?                                echo "{\n";?
    91?                                echo "\"error\" : { \"id\" : ".$this->number;?
    92?                                if($this->title)?
    93?                                        echo ", \"title\" : \"".addslashes($this->title)."\"";?
    94?                                if($this->details)?
    95?                                        echo ", \"details\" : \"".addslashes($this->details)."\"";?
    96?                                echo "\n}";?
    97??
    98?                        break;?
    99?                        ?
    ?113                                $return["id"] = $this->number;?
    ?114                                $return["title"] = $this->title;?
    ?115                                $return["details"] = $this->details;?
    ?116?
    ?117                                echo json_encode($return);?
    ?118?
    ?119                                break;?
    ?120?
    100121                        case "xhtml":?
    101122?
    102?                                $this->details = str_replace("\n","<br />", htmlspecialchars($this->details,ENT_COMPAT,"UTF-8"));?
    ?123                                // Unsure if this line is needed, as it limits what we can do with detail print out?
    ?124                                //$this->details = str_replace("\n","<br />", htmlspecialchars($this->details,ENT_COMPAT,"UTF-8"));?
    103125?
    104126                                if(defined("APP_PATH")){?
    ?127?
    105128                                        if(!defined("STYLESHEET"))?
    106129                                                define("STYLESHEET","mozilla");?
    107?                                ?><link href="<?php echo APP_PATH ?>common/stylesheet/<?php echo STYLESHEET ?>/base.css" rel="stylesheet" type="text/css" /><?php?
    ?130?
    ?131                                        ?><link href="<?php echo APP_PATH ?>common/stylesheet/<?php echo STYLESHEET ?>/base.css" rel="stylesheet" type="text/css" /><?php?
    ?132?
    108133                                } else {?
    109?                                        //if the app_path is not defined, we can try including the mozilla stylesheet, relative to ?
    ?134?
    ?135                                        //if the app_path is not defined, we can try including the mozilla stylesheet, relative to?
    110136                                        // the assumed phpbms root?
    111?                                ?><link href="common/stylesheet/mozilla/base.css" rel="stylesheet" type="text/css" /><?php ?
    ?137                                        ?><link href="common/stylesheet/mozilla/base.css" rel="stylesheet" type="text/css" /><?php?
    ?138?
    112139                                }//end if?
    ?140?
    113141                                ?><div class="bodyline">?
    114142                                        <h1><span>phpBMS Error: <?php echo $this->number; if($this->title) echo " ".$this->title?></span></h1>?
    ? ? ?
    118146                                        </div>?
    119147                                        <?php  } //end if?>?
    120?                                </div><?php ?
    121??
    122?                        break;?
    123?                        ?
    ?148                                </div><?php?
    ?149?
    ?150                                break;?
    ?151?
    124152                        default:?
    125?                        ?
    ?153?
    126154                                echo "phpBMS Error: ".$this->number;?
    127155                                if($this->title) echo ": ".$this->title;?
    128156                                if($this->details) echo  " - ".$this->details;?
    129?                                ?
    130?                        break;?
    ?157?
    ?158                                break;?
    131159                }//end switch?
    132160        }// end dispaly function?
    133?        ?
    ?161?
    ?162?
    ?163        // this function logs the error in the phpBMS log table?
    134164        function logError(){?
    ?165?
    135166                $message = $_SERVER["REQUEST_URI"]."\n";?
    136167                $message .= $this->number;?
    ?168?
    137169                if($this->title)?
    138170                        $message.=": ".$this->title;?
    ?171?
    139172                if($this->details)?
    140173                        $message.="\n\n".$this->details;?
    141?                                                ?
    ?174?
    142175                $log = new phpbmsLog($message,"ERROR");?
    ?176?
    143177        }//end logError?
    144?        ?
    ?178?
    145179}//end appError class?
    146180?
    ?181?
    ?182// This is the class for logging items tot the phpBMS?
    ?183// log table;?
    147184class phpbmsLog{?
    148?        ?
    149?        var $db=NULL;?
    150?        var $type="ERROR";?
    151?        var $value="";?
    152?        var $userid=2;?
    153?        ?
    ?185?
    ?186        var $db = NULL;?
    ?187        var $type = "ERROR";?
    ?188        var $value = "";?
    ?189        var $userid = 2;?
    ?190?
    154191        function phpbmsLog($value=NULL,$type=NULL,$userid=NULL,$db=NULL,$sendLog=true){?
    155192?
    ? ? ?
    158195                if($db){?
    159196                        if(is_object($db)){?
    160?                                $this->db=$db;?
    161?        ?
    ?197?
    ?198                                $this->db = $db;?
    ?199?
    162200                                $this->db->showError=false;?
    163201                                $this->db->logError=false;?
    164202                                $this->db->stopOnError=false;?
    165?                        }?
    166?                }?
    167?                else{?
    ?203?
    ?204                        }//endif object?
    ?205?
    ?206                } else {?
    ?207?
    168208                        if(class_exists("db")){?
    ?209?
    169210                                $this->db= new db(false);?
    170?        ?
    ?211?
    171212                                $this->db->showError=false;?
    172213                                $this->db->logError=false;?
    173214                                $this->db->stopOnError=false;?
    174?        ?
    ?215?
    175216                                $this->db->connect();?
    176217                                $this->db->selectSchema();?
    177?                        } else ?
    ?218?
    ?219                        } else?
    178220                                return false;?
    179?                }?
    180?                ?
    ?221?
    ?222                }//endif db?
    ?223?
    181224                if($value)?
    182?                        $this->value=$value;?
    ?225                        $this->value = $value;?
    ?226?
    183227                if($type)?
    184?                        $this->type=$type;?
    ?228                        $this->type = $type;?
    ?229?
    185230                if($userid)?
    186?                        $this->userid=((int) $userid);?
    187?                ?
    ?231                        $this->userid = ((int) $userid);?
    ?232?
    188233                if($sendLog)?
    189234                        return $this->sendLog();?
    190235                else?
    191236                        return true;?
    192?                ?
    193?        }//end function?
    194?        ?
    ?237?
    ?238        }//end function init?
    ?239?
    ?240?
    ?241        // inserts record into log table?
    195242        function sendLog(){?
    196?                        ?
    197?                $ip=$_SERVER["REMOTE_ADDR"];?
    198?        ?
    199?                $querystatement="INSERT INTO `log` (`type`,`value`,`userid`,`ip`) VALUES (";?
    200?                $querystatement.="\"".mysql_real_escape_string($this->type)."\", ";?
    201?                $querystatement.="\"".mysql_real_escape_string($this->value)."\", ";?
    202?                $querystatement.=$this->userid.", ";?
    203?                $querystatement.="\"".$ip."\")";?
    204?                ?
    205?                $this->db->query($querystatement);?
    206?                ?
    207?        }?
    208?}//end phpbmslog?
    209??
    210??
    211??
    ?243?
    ?244                $ip = $_SERVER["REMOTE_ADDR"];?
    ?245?
    ?246                $insertstatement = "?
    ?247                        INSERT INTO?
    ?248                                `log`?
    ?249                        (`type`, `value`, `userid`, `ip`) VALUES (?
    ?250                                '".mysql_real_escape_string($this->type)."',?
    ?251                                '".mysql_real_escape_string($this->value)."',?
    ?252                                ".$this->userid.",?
    ?253                                '".$ip."'?
    ?254                        )";?
    ?255?
    ?256                $this->db->query($insertstatement);?
    ?257?
    ?258        }//end function sendLog?
    ?259?
    ?260}//end class phpbmslog?
    ?261?
    ?262?
    ?263// This class handles the loading of the database, session and application?
    ?264// variables, as well as verifying API level logins?
    212265class phpbmsSession{?
    213266?
    214?        var $db=null;?
    ?267        var $db = null;?
    215268?
    216269        function loadDBSettings($reportError = true){?
    ?270?
    217271                // This functions looks for the settings.php file, and loads?
    218272                // the database variables as constants.  As an added benefit?
    219273                // it adds the phpBMS root as an included path.?
    220?                ?
    221?                $path="";?
    222?                $count=1;?
    ?274?
    223275?
    224276                //need to look for settings file... only go up a total of 10 directories?
    225?                $currdirectory= getcwd();?
    226?                ?
    227?                while(!file_exists("settings.php") and ($count<10)){?
    ?277                $currdirectory = getcwd();?
    ?278?
    ?279                //Prep the setting of the application path;?
    ?280                $currentURL = explode("/",$_SERVER["PHP_SELF"]);?
    ?281                array_pop($currentURL);?
    ?282?
    ?283                $count = 0;?
    ?284                $path = "";?
    ?285?
    ?286                //We need to find the applications root?
    ?287                while(!file_exists("phpbmsversion.php") && $count < 9){?
    ?288?
    228289                        $path.="../";?
    229290                        @ chdir("../");?
    230291                        $count++;?
    231?                }?
    232?                ?
    ?292?
    ?293                }//end while?
    ?294?
    ?295                //Now set the Web location (APP_PATH)?
    ?296                $appPath = "/";?
    ?297                for($i = 0; $i < count($currentURL) - $count; $i++)?
    ?298                        if($currentURL[$i])?
    ?299                                $appPath .= $currentURL[$i]."/";?
    ?300?
    ?301                define("APP_PATH", $appPath);?
    ?302?
    233303                $settingsfile =  @ fopen("settings.php","r");?
    ?304?
    234305                if($settingsfile){?
    235?                        //loop through the settings file and load variables into the session ?
    ?306?
    ?307                        //loop through the settings file and load variables into the session?
    236308                        while( !feof($settingsfile)) {?
    237?                                $line=NULL;?
    238?                                $key=NULL;?
    239?                                $value=NULL;?
    240?                                $line=fscanf($settingsfile,"%[^=]=%[^[]]",$key,$value);?
    ?309?
    ?310                                $line = NULL;?
    ?311                                $key = NULL;?
    ?312                                $value = NULL;?
    ?313                                $line = @ fscanf($settingsfile,"%[^=]=%[^[]]",$key,$value);?
    ?314?
    241315                                if ($line){?
    ?316?
    242317                                        $key=trim($key);?
    243318                                        $value=trim($value);?
    244?                                        if($key!="" and !strpos($key,"]")){     ?
    ?319?
    ?320                                        if($key!="" and !strpos($key,"]")){?
    ?321?
    245322                                                $startpos=strpos($value,"\"");?
    246323                                                $endpos=strrpos($value,"\"");?
    ?324?
    247325                                                if($endpos!=false)?
    248326                                                        $value=substr($value,$startpos+1,$endpos-$startpos-1);?
    249?                                                if(strpos($key,"mysql_")===0){?
    ?327?
    ?328                                                if(strpos($key,"mysql_")===0)?
    250329                                                        define(strtoupper($key),$value);?
    251?                                                }?
    252?                                        }?
    253?                                }?
    254?                        }?
    255?                        ?
    ?330?
    ?331                                        }//endif key?
    ?332?
    ?333                                }//endif line?
    ?334?
    ?335                        }//endwhile?
    ?336?
    256337                        @ fclose($settingsfile);?
    257338?
    ? ? ?
    261342?
    262343                        //this adds the phpbms root to the include path?
    263?                        if ( ! defined( "PATH_SEPARATOR" ) ) {?
    264?                          ?
    265?                          //if we cannot determin the OS, we will assume its unix?
    266?                          if(!isset($_ENV["OS"]))?
    267?                                  $_ENV["OS"] = "unix";?
    268?                          ?
    269?                          if ( strpos( $_ENV["OS"], "Win" ) !== false )?
    270?                                define( "PATH_SEPARATOR", ";" );?
    271?                          else ?
    272?                                define( "PATH_SEPARATOR", ":" );?
    273?                          ?
    ?344                        if ( !defined( "PATH_SEPARATOR" ) ) {?
    ?345?
    ?346                                //if we cannot determin the OS, we will assume its unix?
    ?347                                if(!isset($_ENV["OS"]))?
    ?348                                        $_ENV["OS"] = "unix";?
    ?349?
    ?350                                if ( strpos( $_ENV["OS"], "Win" ) !== false )?
    ?351                                        define( "PATH_SEPARATOR", ";" );?
    ?352                                else?
    ?353                                        define( "PATH_SEPARATOR", ":" );?
    ?354?
    274355                        }//end if?
    275356?
    276?                        $pathToAdd=@ getcwd();?
    277?                        ini_set("include_path",ini_get("include_path").PATH_SEPARATOR.$pathToAdd);?
    278?                        ?
    279?                        //Now to set the path?
    280?                        $pathrev = strrev($_SERVER["PHP_SELF"]);?
    281?                        $choppos=0;?
    282??
    283?                        for($x=0;$x<$count;$x++)?
    284?                                $choppos = strpos($pathrev,"/",$choppos+1);?
    285?                        define("APP_PATH",strrev(substr($pathrev,$choppos)));?
    286?                        ?
    ?357                        $pathToAdd = @ getcwd();?
    ?358?
    ?359                        //Now we include the root application path to php's include path?
    ?360                        if(ini_set("include_path", ini_get("include_path").PATH_SEPARATOR.$pathToAdd) === false && $reportError)?
    ?361                                $error = new appError(-310, "Your implementation of PHP does not allow changing of the include path. You may need to modify your PHP settings to allow phpBMS to modify this php ini setting. If you are using a web hosting company, you may need to contact them to allow this.", "Cannot add to include path", true, true, false);?
    ?362?
    ?363?
    ?364                        //return directory to current directory?
    287365                        @ chdir ($currdirectory);?
    ?366?
    288367                        return $path;?
    ?368?
    289369                } else {?
    ?370?
    290371                        if($reportError)?
    291?                                $error= new appError(-300,"You may need to run the install process, or set the permission on your settings file correctly.","Settings File Could Not Be Read",true,true,false);?
    ?372                                $error = new appError(-300,"","",true,true,false);?
    ?373?
    292374                        return false;?
    293?                }?
    ?375?
    ?376                }//endif settingsfile?
    ?377?
    294378        }//end function?
    295?        ?
    ?379?
    ?380?
    296381        function loadSettings($encoding = "utf8"){?
    297?                // We are going to make sure that we are using utf8 ?
    ?382?
    ?383                // We are going to make sure that we are using utf8?
    298384                // but it works only in mySQL 5, so we supress errors?
    299385                // when trying it.?
    300386                if($this->db==NULL)?
    301387                        $error=new appError(-310,"","Database not loaded");?
    302?                ?
    ?388?
    303389                $this->db->logError = false;?
    304390                $this->db->stopOnError = false;?
    305?        ?
    ?391?
    306392                $this->db->setEncoding($encoding);?
    307?        ?
    ?393?
    308394                $this->db->logError = true;?
    309?        ?
    ?395?
    310396                $querystatement = "SELECT name,value FROM settings";?
    311397?
    ? ? ?
    313399?
    314400                if(!$queryresult){?
    ?401?
    315402                        $error= new appError(-310,"If you have not ran the update script for phpBMS, please run it before logging in.","Could Not Retrieve Settings From Database");?
    316403                        return false;?
    ?404?
    317405                } else {?
    ?406?
    318407                        while($therecord=$this->db->fetchArray($queryresult)){?
    319?                        ?
    ?408?
    320409                                //old versions used a reserved constant in certain php versions?
    321410                                if($therecord["name"] == "currency_symbol")?
    322411                                        $therecord["name"] = "currency_sym";?
    323?                                        ?
    ?412?
    324413                                if(!defined(strtoupper($therecord["name"])))?
    325414                                        define(strtoupper($therecord["name"]),$therecord["value"]);?
    ? ? ?
    330419                        if(!isset($_SERVER['REQUEST_URI'])) {?
    331420                                $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];?
    332?                                ?
    ?421?
    333422                                if(!defined("HOUR_FORMAT"))?
    334423                                        define("HOUR_FORMAT","%I");?
    335?                        ?
    ?424?
    336425                                // Append the query string if it exists and isn't null?
    337426                                if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']))?
    ? ? ?
    342431?
    343432                        return true;?
    344?                }?
    345?        }?
    346??
    347??
    ?433?
    ?434                }//endif queryresult?
    ?435?
    ?436        }//end function?
    ?437?
    ?438?
    ?439        // This is in a function in case we want to do sessions differently in the future?
    348440        function startSession(){?
    349?                // This is in a function in case we want to do sessions differently in the future               ?
    350?                ?
    ?441?
    351442                session_name("phpBMS".preg_replace('/\W/',"",APPLICATION_NAME)."v096ID");?
    352443                session_start();?
    353?        }?
    354??
    355??
    356?        function verifyAPIlogin($user,$pass){?
    357?                $thereturn=false;?
    ?444?
    ?445        }//end function startSesion?
    ?446?
    ?447?
    ?448        function verifyAPIlogin($user, $pass){?
    ?449?
    ?450                $thereturn = false;?
    358451                $this->db->stopOnError = false;?
    359?                ?
    360?                $querystatement = "SELECT id, firstname, lastname, email, phone, department, employeenumber, admin?
    361?                                                FROM users ?
    362?                                                WHERE login!=\"Scheduler\" AND login=\"".mysql_real_escape_string($user)."\" ?
    363?                                                AND password=ENCODE(\"".mysql_real_escape_string($pass)."\",\"".mysql_real_escape_string(ENCRYPTION_SEED)."\") ?
    364?                                                AND revoked=0 AND portalaccess=1";?
    ?452?
    ?453                $querystatement = "?
    ?454                        SELECT?
    ?455                                id,?
    ?456                                firstname,?
    ?457                                lastname,?
    ?458                                email,?
    ?459                                phone,?
    ?460                                department,?
    ?461                                employeenumber,?
    ?462                                admin?
    ?463                        FROM?
    ?464                                users?
    ?465                        WHERE?
    ?466                                login != 'Scheduler'?
    ?467                                AND login = '".mysql_real_escape_string($user)."'?
    ?468                                AND password = ENCODE('".mysql_real_escape_string($pass)."', '".mysql_real_escape_string(ENCRYPTION_SEED)."')?
    ?469                                AND revoked = 0?
    ?470                                AND portalaccess = 1";?
    ?471?
    365472                $queryresult = $this->db->query($querystatement);?
    ?473?
    366474                if(!$queryresult) {?
    ?475?
    367476                        $error = new appError(-720,"","Error retrieving user record",true,true,true,"json");?
    368477                        return false;?
    369?                }?
    370?                ?
    ?478?
    ?479                }//endif?
    ?480?
    371481                if($this->db->numRows($queryresult)){?
    ?482?
    372483                        //We found a record that matches in the database?
    373484                        // populate the session and go in?
    374?                        $_SESSION["userinfo"]=$this->db->fetchArray($queryresult);?
    375?                ?
    376?                        $querystatement="UPDATE users SET modifieddate=modifieddate, lastlogin=Now() WHERE id = ".$_SESSION["userinfo"]["id"];?
    377?                        $queryresult=@ $this->db->query($querystatement);?
    378?                        if(!$queryresult) {?
    ?485                        $_SESSION["userinfo"] = $this->db->fetchArray($queryresult);?
    ?486?
    ?487                        $querystatement = "?
    ?488                                UPDATE?
    ?489                                        users?
    ?490                                SET?
    ?491                                        modifieddate=modifieddate,?
    ?492                                        lastlogin=Now()?
    ?493                                WHERE?
    ?494                                        id = ".$_SESSION["userinfo"]["id"];?
    ?495?
    ?496                        $queryresult = @ $this->db->query($querystatement);?
    ?497?
    ?498                        if(!$queryresult)?
    379499                                $error = new appError(-730,"","Error Updating User Login Time",true,true,true,"json");?
    380?                        } else?
    381?                                $thereturn=true;?
    382?                }?
    383?                return $thereturn;      ?
    384?        }?
    385?        ?
    386?}//end loginSession class?
    387??
    388??
    389?// Start Code?
    390?//=================================================================================================================?
    391?//php <4.3.0 compatibility?
    392?if(!function_exists("mysql_real_escape_string")){?
    393?        function mysql_real_escape_string($string){?
    394?                return mysql_escape_string($string);?
    395?        }?
    396?        ?
    397?   function utf8_replaceEntity($result){?
    398?           $value = (int)$result[1];?
    399?           $string = '';?
    400?          ?
    401?           $len = round(pow($value,1/8));?
    402?          ?
    403?           for($i=$len;$i>0;$i--){?
    404?                   $part = ($value & (255>>2)) | pow(2,7);?
    405?                   if ( $i == 1 ) $part |= 255<<(8-$len);?
    406?                  ?
    407?                   $string = chr($part) . $string;?
    408?                  ?
    409?                   $value >>= 6;?
    410?           }?
    411?          ?
    412?           return $string;?
    413?   }?
    414?  ?
    415?        if(!function_exists("mysql_real_escape_string")){?
    416?                function html_entity_decode($string){?
    417?                        return preg_replace_callback('/&#([0-9]+);/u','utf8_replaceEntity',$string);?
    418?                }//end function?
    419?        }//end if?
    420??
    421?}// end PHP<4.3 compatibility?
    ?500                        else?
    ?501                                $thereturn = true;?
    ?502?
    ?503                }//endif numrows?
    ?504?
    ?505                return $thereturn;?
    ?506?
    ?507        }//end function verifyAPIlogin?
    ?508?
    ?509?
    ?510        //Check to see if install folders are present.  If so, do not continue.?
    ?511        function checkForInstallDirs($errorFormat = "xhtml"){?
    ?512?
    ?513                //first lets check for the main programs install folder?
    ?514                if(file_exists("install") && is_dir("install"))?
    ?515                        $error = new appError(-353,"You must remove the install directory and all modules' install directories before phpBMS can run.","Main Install Directory Present",true,true,true,$errorFormat);?
    ?516?
    ?517                $thedir= @ opendir("modules");?
    ?518?
    ?519                while($entry = readdir($thedir)){?
    ?520?
    ?521                        if($entry != "." && $entry != ".." && $entry != "base" && $entry != "sample" && is_dir("modules/".$entry)){?
    ?522?
    ?523                                if(file_exists("modules/".$entry."/install") && is_dir("modules/".$entry."/install")){?
    ?524?
    ?525                                        $error = new appError(-354,"You must remove the install directory and all modules' install directories before phpBMS can run.","Module '".$entry."' Install Directory Present",true,true,true,$errorFormat);?
    ?526?
    ?527                                }//endif?
    ?528?
    ?529                        }//endif?
    ?530?
    ?531                }//end if?
    ?532?
    ?533        }//end function checkForInstallDirs?
    ?534?
    ?535}//end phpbmsSession class?
    ?536?
    422537?
    423538?
    424539// Start Login verification Code?
    425?//=================================================================================================================?
    ?540//==============================================================================?
    426541if(!isset($sqlEncoding))?
    427542        $sqlEncoding = "utf8";?
    428543?
    429544if(!defined("noStartup")){?
    ?545?
    430546        $scriptname = basename($_SERVER["PHP_SELF"]);?
    431547        $phpbmsSession = new phpbmsSession;?
    432?        ?
    ?548?
    433549        //Testing for API login?
    434550        if(strpos($scriptname,"api_")!==false){?
    435551                if(isset($_POST["phpbmsusername"]) && isset($_POST["phpbmspassword"])){?
    ?552?
    436553                        $phpbmsSession->loadDBSettings(APP_DEBUG);?
    437?                        ?
    ?554?
    ?555                        if(!APP_DEBUG)?
    ?556                                $phpbmsSession->checkForInstallDirs("json");?
    ?557?
    438558                        include_once("include/db.php");?
    439559                        $db = new db();?
    440560                        $phpbmsSession->db = $db;?
    441561?
    442?                        include_once("common_functions.php");                   ?
    ?562                        include_once("common_functions.php");?
    443563                        $phpbmsSession->loadSettings($sqlEncoding);?
    444564                        $phpbms = new phpbms($db);?
    445?        ?
    446?        ?
    ?565?
    ?566?
    447567                        if(!$phpbmsSession->verifyAPILogin($_POST["phpbmsusername"],$_POST["phpbmspassword"]))?
    448568                                $error = new appError(-700,"","Login credentials incorrect",true,true,true,"json");?
    ?569?
    449570                } else?
    450571                        $error= new appError(-710,"","No login credentials passed",true,true,true,"json");?
    ?572?
    451573        } else {?
    452?        ?
    ?574?
    453575                $phpbmsSession->loadDBSettings(APP_DEBUG);?
    454?        ?
    455?        ?
    ?576?
    ?577                if(!APP_DEBUG)?
    ?578                        $phpbmsSession->checkForInstallDirs();?
    ?579?
    ?580                //start database?
    456581                include_once("include/db.php");?
    457582                $db = new db();?
    458?                ?
    ?583?
    459584                $phpbmsSession->db = $db;?
    460?                ?
    ?585?
    ?586                //load application settings from table?
    461587                $phpbmsSession->loadSettings($sqlEncoding);?
    462?                ?
    ?588?
    463589                include_once("common_functions.php");?
    464590                $phpbms = new phpbms($db);?
    465?                ?
    ?591?
    466592                if(!isset($noSession))?
    467593                        $phpbmsSession->startSession();?
    468?                ?
    ?594?
    469595                if (!isset($_SESSION["userinfo"]) && $scriptname != "index.php") {?
    470?                ?
    ?596?
    471597                        if(isset($loginNoKick)){?
    ?598?
    472599                                if(!isset($loginNoDisplayError))?
    473600                                        exit();?
    ?601?
    474602                        } else{?
    ?603?
    475604                                goURL(APP_PATH."index.php");?
    476?                        }?
    477?                }?
    478?                ?
    479?        }?
    480?        ?
    481?        $db->stopOnError=true;?
    ?605?
    ?606                        }//endif?
    ?607?
    ?608                }//endif iseet userinfo?
    ?609?
    ?610        }//endif?
    ?611?
    ?612        $db->stopOnError = true;?
    ?613?
    482614}//end if?
    483615?
  • trunk/phpbms/include/tables.php

    r427 r485 ?
    3939?
    4040?
    41?class phpbmsTable{?
    42?        ?
    43?        var $db = NULL;?
    44?        var $backurl = NULL;?
    45?        ?
    46?        // The table definition record id.?
    47?        var $id=0;?
    48?        ?
    49?        var $fields = array();?
    50??
    51?        function phpbmsTable($db,$tabledefid = 0,$backurl = NULL){?
    52?        ?
    53?                if(is_object($db))?
    54?                        if(get_class($db)=="db")?
    55?                                $this->db = $db;?
    56?                if($this->db === NULL)?
    57?                        $error = new appError(-800,"database object is required for parameter 1.","Initializing phpbmsTable Class");?
    58??
    59?                $this->id = ((int) $tabledefid);?
    60?                ?
    61?                if($backurl == NULL)?
    62?                        $this->backurl = APP_PATH."search.php?id=".$this->id;?
    63?                else ?
    64?                        $this->backurl = $backurl;?
    65?                        ?
    66?                if(!$this->getTableInfo())?
    67?                        $error = new appError(-810,"Table definition not found for id ".$this->id,"Initializing phpbmsTable Class");?
    68?        }?
    69?        ?
    70?        ?
    71?        function getTableInfo(){?
    72?                $querystatement = "SELECT * FROM tabledefs WHERE id=".$this->id;?
    73?                ?
    74?                $queryresult = $this->db->query($querystatement);?
    75?                ?
    76?                if($this->db->numRows($queryresult)){?
    77?                        foreach($this->db->fetchArray($queryresult) as $key => $value)?
    78?                                $this->$key = $value;?
    79?                        ?
    80?                        $this->fields = $this->db->tableInfo($this->maintable);?
    81?                        ?
    82?                        return true;                                            ?
    83?                } else?
    84?                        return false;?
    85?        }?
    86?        ?
    87?        function getDefaultByType($fieldtype){?
    88?                        $default = NULL;?
    89?                        ?
    90?                        switch ($fieldtype){?
    91?                                case "blob":?
    92?                                case "string":?
    93?                                        $default = "";?
    94?                                break;?
    95?                                case "real":?
    96?                                case "int":?
    97?                                        $default = 0;?
    98?                                break;?
    99?                                case "date":?
    100?                                        $default=dateToString(mktime(),"SQL");?
    101?                                break;?
    102?                                case "time":?
    103?                                        $default=timeToString(mktime(),"SQL");?
    104?                                break;?
    105?                                case "year":?
    106?                                        $default=strftime("%Y");?
    107?                                break;?
    108?                                case "datetime":?
    109?                                case "timestamp":?
    110?                                        $default = dateToString(mktime(),"SQL")." ".timeToString(mktime(),"24 Hour");?
    111?                                break;?
    112?                        }?
    113?                        ?
    114?                        return $default;?
    115?                        ?
    116?        }?
    117?        ?
    118?        function prepareFieldForSQL($value,$type,$flags){?
    119?                        switch ($type){?
    120?                                ?
    121?                                case "blob":?
    122?                                case "string":?
    123?                                        if($value === "" or $value === NULL){?
    124?                                                if(strpos($flags,"not_null") === false)?
    125?                                                        $value = NULL;?
    126?                                                else?
    127?                                                        $value = "''";?
    128?                                        } else                                  ?
    129?                                                $value = "'".$value."'";?
    130?                                break;?
    131?                                ?
    132?                                case "real":?
    133?                                        if($value === "" or $value === NULL){?
    134?                                                if(strpos($flags,"not_null") === false)?
    135?                                                        $value = NULL;?
    136?                                                else?
    137?                                                        $value = 0;?
    138?                                        } else                                  ?
    139?                                                $value = (real) $value;?
    140?                                break;?
    141?                                ?
    142?                                case "int":?
    143?                                        if($value === "" or $value === NULL){?
    144?                                                if(strpos($flags,"not_null") === false)?
    145?                                                        $value = NULL;?
    146?                                                else?
    147?                                                        $value = 0;?
    148?                                        } else?
    149?                                                $value = (int) $value;?
    150?                                break;?
    151?                                ?
    152?                                case "date":?
    153?                                        if($value === "" or $value === NULL){?
    154?                                                if(strpos($flags,"not_null") === false)?
    155?                                                        $value = NULL;?
    156?                                                else?
    157?                                                        $value = "'".dateToString(mktime(),"SQL")."'";?
    158?                                        } else?
    159?                                                $value = "'".sqlDateFromString($value)."'";?
    160?                                break;?
    161??
    162?                                case "time":?
    163?                                        if($value === "" or $value === NULL){?
    164?                                                if(strpos($flags,"not_null") === false)?
    165?                                                        $value = NULL;?
    166?                                                else?
    167?                                                        $value = "'".timeToString(mktime(),"SQL")."'";?
    168?                                        } else?
    169?                                                $value = "'".sqlTimeFromString($value)."'";?
    170?                                break;?
    171?                                ?
    172?                                case "year":?
    173?                                        if($value === "" or $value === NULL)?
    174?                                                if(strpos($flags,"not_null") === false)?
    175?                                                        $value = NULL;?
    176?                                                else?
    177?                                                        $value = strftime("%Y");?
    178?                                break;?
    179?                                ?
    180?                                case "datetime":?
    181?                                case "timestamp":?
    182?                                        if($value === "" or $value === NULL){?
    183?                                                if(strpos($flags,"not_null") === false)?
    184?                                                        $value = NULL;?
    185?                                                else?
    186?                                                        $value = "'".dateToString(mktime(),"SQL")." ".timeToString(mktime(),"24 Hour")."'";?
    187?                                        } else{?
    188?                                                $datetimearray = explode(" ",$value);?
    189?                                                if(count($datetimearray) > 1){?
    190?                                                        $value = "'".sqlDateFromString($datetimearray[0])." ".sqlTimeFromString($datetimearray[1])."'";?
    191?                                                } else ?
    192?                                                $value = "'".$value."'";?
    193?                                        }?
    194?                                break;?
    195?                                case "password":?
    196?                                        $value = "ENCODE('".$value."','".ENCRYPTION_SEED."')";?
    197?                                break;          ?
    198?                        }//end case?
    199??
    200??
    201?                        if($value === NULL)?
    202?                                $value = "NULL";?
    203?                        return $value;?
    204?        }//end method?
    205?        ?
    206?        ?
    207?        function getDefaults(){?
    208?                $therecord = array();?
    209?                ?
    210?                foreach($this->fields as $fieldname => $thefield){?
    211?                        switch($fieldname){?
    212?                                case "id":?
    213?                                case "modifiedby":                      ?
    214?                                case "modifieddate":?
    215?                                        $therecord[$fieldname] = NULL;?
    216?                                break;?
    217?                                ?
    218?                                case "createdby":?
    219?                                        $therecord["createdby"] = $_SESSION["userinfo"]["id"];?
    220?                                break;?
    221?                                                                ?
    222?                                default:?
    223?                                        if(strpos($thefield["flags"],"not_null") === false)?
    224?                                                $therecord[$fieldname] = NULL;?
    225?                                        else {?
    226?                                                $therecord[$fieldname] = $this->getDefaultByType($thefield["type"]);?
    227?                                        }?
    228?                                break;?
    229?                        }//end switch?
    230?                }//end foreach?
    231?                ?
    232?                return $therecord;?
    233?        }?
    234?        ?
    235?        ?
    236?        function getRecord($id = 0){?
    237?                $id = (int) $id;?
    238?                ?
    239?                $querystatement = "SELECT ";?
    240?                                ?
    241?                foreach($this->fields as $fieldname => $thefield){?
    242?                        if(isset($thefield["select"]))?
    243?                                $querystatement .= "(".$thefield["select"].") AS `".$fieldname."`, ";?
    ?41        class phpbmsTable{?
    ?42?
    ?43                var $db = NULL;?
    ?44                var $backurl = NULL;?
    ?45                var $verifyErrors = array();?
    ?46?
    ?47                // The table definition record id.?
    ?48                var $id=0;?
    ?49?
    ?50                var $fields = array();?
    ?51?
    ?52                function phpbmsTable($db,$tabledefid = 0,$backurl = NULL){?
    ?53?
    ?54                        if(is_object($db))?
    ?55                                if(get_class($db)=="db")?
    ?56                                        $this->db = $db;?
    ?57                        if($this->db === NULL)?
    ?58                                $error = new appError(-800,"database object is required for parameter 1.","Initializing phpbmsTable Class");?
    ?59?
    ?60                        $this->id = ((int) $tabledefid);?
    ?61?
    ?62                        if($backurl == NULL)?
    ?63                                $this->backurl = APP_PATH."search.php?id=".$this->id;?
    24464                        else?
    245?                                $querystatement .= "`".$fieldname."`, ";?
    246?                }//end foreach?
    247?                $querystatement = substr($querystatement, 0, strlen($querystatement)-2);?
    248?                ?
    249?                $querystatement .= " FROM `".$this->maintable."` WHERE `".$this->maintable."`.`id` = ".$id;?
    250?                                ?
    251?                $queryresult = $this->db->query($querystatement);?
    252?                ?
    253?                if($this->db->numRows($queryresult))?
    254?                        $therecord = $this->db->fetchArray($queryresult);?
    255?                else ?
    256?                        $therecord = $this-> getDefaults();?
    257?                ?
    258?                return $therecord;?
    259?        }//end getRecord function?
    260?        ?
    261?        ?
    262?        function updateRecord($variables, $modifiedby = NULL){?
    263?                $variables = addSlashesToArray($variables);?
    264?                ?
    265?                if($modifiedby === NULL)?
    266?                        if(isset($_SESSION["userinfo"]["id"]))?
    267?                                $modifiedby = $_SESSION["userinfo"]["id"];?
    268?                        else?
    269?                                $error = new appError(-840,"Session Timed Out.","Creating New Record");?
    270??
    271?                if(!isset($variables["id"]))?
    272?                        $error = new appError(-820,"id not set","Updating Record");?
    273?                ?
    274?                $updatestatement = "UPDATE `".$this->maintable."` SET ";?
    275?                ?
    276?                foreach($this->fields as $fieldname => $thefield){?
    277?                        if(!isset($thefield["select"])){?
    ?65                                $this->backurl = $backurl;?
    ?66?
    ?67                        if(!$this->getTableInfo())?
    ?68                                $error = new appError(-810,"Table definition not found for id ".$this->id,"Initializing phpbmsTable Class");?
    ?69                }?
    ?70?
    ?71?
    ?72                function getTableInfo(){?
    ?73                        $querystatement = "SELECT * FROM tabledefs WHERE id=".$this->id;?
    ?74?
    ?75                        $queryresult = $this->db->query($querystatement);?
    ?76?
    ?77                        if($this->db->numRows($queryresult)){?
    ?78                                foreach($this->db->fetchArray($queryresult) as $key => $value)?
    ?79                                        $this->$key = $value;?
    ?80?
    ?81                                $this->fields = $this->db->tableInfo($this->maintable);?
    ?82?
    ?83                                return true;?
    ?84                        } else?
    ?85                                return false;?
    ?86                }?
    ?87?
    ?88                function getDefaultByType($fieldtype){?
    ?89                                $default = NULL;?
    ?90?
    ?91                                switch ($fieldtype){?
    ?92                                        case "blob":?
    ?93                                        case "string":?
    ?94                                                $default = "";?
    ?95                                        break;?
    ?96                                        case "real":?
    ?97                                        case "int":?
    ?98                                                $default = 0;?
    ?99                                        break;?
    ?100                                        case "date":?
    ?101                                                $default=dateToString(mktime(),"SQL");?
    ?102                                        break;?
    ?103                                        case "time":?
    ?104                                                $default=timeToString(mktime(),"SQL");?
    ?105                                        break;?
    ?106                                        case "year":?
    ?107                                                $default=strftime("%Y");?
    ?108                                        break;?
    ?109                                        case "datetime":?
    ?110                                        case "timestamp":?
    ?111                                                $default = dateToString(mktime(),"SQL")." ".timeToString(mktime(),"24 Hour");?
    ?112                                        break;?
    ?113                                }?
    ?114?
    ?115                                return $default;?
    ?116?
    ?117                }?
    ?118?
    ?119                function prepareFieldForSQL($value,$type,$flags){?
    ?120                                switch ($type){?
    ?121?
    ?122                                        case "blob":?
    ?123                                        case "string":?
    ?124                                                if($value === "" or $value === NULL){?
    ?125                                                        if(strpos($flags,"not_null") === false)?
    ?126                                                                $value = NULL;?
    ?127                                                        else?
    ?128                                                                $value = "''";?
    ?129                                                } else?
    ?130                                                        $value = "'".$value."'";?
    ?131                                        break;?
    ?132?
    ?133                                        case "real":?
    ?134                                                if($value === "" or $value === NULL){?
    ?135                                                        if(strpos($flags,"not_null") === false)?
    ?136                                                                $value = NULL;?
    ?137                                                        else?
    ?138                                                                $value = 0;?
    ?139                                                } else?
    ?140                                                        $value = (real) $value;?
    ?141                                        break;?
    ?142?
    ?143                                        case "int":?
    ?144                                                if($value === "" or $value === NULL){?
    ?145                                                        if(strpos($flags,"not_null") === false)?
    ?146                                                                $value = NULL;?
    ?147                                                        else?
    ?148                                                                $value = 0;?
    ?149                                                } else?
    ?150                                                        $value = (int) $value;?
    ?151                                        break;?
    ?152?
    ?153                                        case "date":?
    ?154                                                if($value === "" or $value === NULL){?
    ?155                                                        if(strpos($flags,"not_null") === false)?
    ?156                                                                $value = NULL;?
    ?157                                                        else?
    ?158                                                                $value = "'".dateToString(mktime(),"SQL")."'";?
    ?159                                                } else?
    ?160                                                        $value = "'".sqlDateFromString($value)."'";?
    ?161                                        break;?
    ?162?
    ?163                                        case "time":?
    ?164                                                if($value === "" or $value === NULL){?
    ?165                                                        if(strpos($flags,"not_null") === false)?
    ?166                                                                $value = NULL;?
    ?167                                                        else?
    ?168                                                                $value = "'".timeToString(mktime(),"SQL")."'";?
    ?169                                                } else?
    ?170                                                        $value = "'".sqlTimeFromString($value)."'";?
    ?171                                        break;?
    ?172?
    ?173                                        case "year":?
    ?174                                                if($value === "" or $value === NULL)?
    ?175                                                        if(strpos($flags,"not_null") === false)?
    ?176                                                                $value = NULL;?
    ?177                                                        else?
    ?178                                                                $value = strftime("%Y");?
    ?179                                        break;?
    ?180?
    ?181                                        case "datetime":?
    ?182                                        case "timestamp":?
    ?183                                                if($value === "" or $value === NULL){?
    ?184                                                        if(strpos($flags,"not_null") === false)?
    ?185                                                                $value = NULL;?
    ?186                                                        else?
    ?187                                                                $value = "'".dateToString(mktime(),"SQL")." ".timeToString(mktime(),"24 Hour")."'";?
    ?188                                                } else{?
    ?189                                                        $datetimearray = explode(" ",$value);?
    ?190                                                        if(count($datetimearray) > 1){?
    ?191                                                                $value = "'".sqlDateFromString($datetimearray[0])." ".sqlTimeFromString($datetimearray[1])."'";?
    ?192                                                        } else?
    ?193                                                        $value = "'".$value."'";?
    ?194                                                }?
    ?195                                        break;?
    ?196                                        case "password":?
    ?197                                                $value = "ENCODE('".$value."','".ENCRYPTION_SEED."')";?
    ?198                                        break;?
    ?199                                }//end case?
    ?200?
    ?201?
    ?202                                if($value === NULL)?
    ?203                                        $value = "NULL";?
    ?204                                return $value;?
    ?205                }//end method?
    ?206?
    ?207?
    ?208                function getDefaults(){?
    ?209                        $therecord = array();?
    ?210?
    ?211                        foreach($this->fields as $fieldname => $thefield){?
    278212                                switch($fieldname){?
    279213                                        case "id":?
    280?                                        case "creationdate":?
    ?214                                        case "modifiedby":?
    ?215                                        case "modifieddate":?
    ?216                                                $therecord[$fieldname] = NULL;?
    ?217                                        break;?
    ?218?
    281219                                        case "createdby":?
    282?                                        break;?
    ?220                                                $therecord["createdby"] = $_SESSION["userinfo"]["id"];?
    ?221                                        break;?
    ?222?
    ?223                                        default:?
    ?224                                                if(strpos($thefield["flags"],"not_null") === false)?
    ?225                                                        $therecord[$fieldname] = NULL;?
    ?226                                                else {?
    ?227                                                        $therecord[$fieldname] = $this->getDefaultByType($thefield["type"]);?
    ?228                                                }?
    ?229                                        break;?
    ?230                                }//end switch?
    ?231                        }//end foreach?
    ?232?
    ?233                        return $therecord;?
    ?234                }?
    ?235?
    ?236?
    ?237                function getRecord($id = 0){?
    ?238                        $id = (int) $id;?
    ?239?
    ?240                        $querystatement = "SELECT ";?
    ?241?
    ?242                        foreach($this->fields as $fieldname => $thefield){?
    ?243                                if(isset($thefield["select"]))?
    ?244                                        $querystatement .= "(".$thefield["select"].") AS `".$fieldname."`, ";?
    ?245                                else?
    ?246                                        $querystatement .= "`".$fieldname."`, ";?
    ?247                        }//end foreach?
    ?248                        $querystatement = substr($querystatement, 0, strlen($querystatement)-2);?
    ?249?
    ?250                        $querystatement .= " FROM `".$this->maintable."` WHERE `".$this->maintable."`.`id` = ".$id;?
    ?251?
    ?252                        $queryresult = $this->db->query($querystatement);?
    ?253?
    ?254                        if($this->db->numRows($queryresult))?
    ?255                                $therecord = $this->db->fetchArray($queryresult);?
    ?256                        else?
    ?257                                $therecord = $this-> getDefaults();?
    ?258?
    ?259                        return $therecord;?
    ?260                }//end getRecord function?
    ?261?
    ?262?
    ?263                function prepareVariables($variables){?
    ?264?
    ?265                        return $variables;?
    ?266?
    ?267                }//end method --prepareVariables--?
    ?268?
    ?269?
    ?270                function verifyVariables($variables){?
    ?271?
    ?272                        $thereturn = array();?
    ?273?
    ?274                        if(!isset($this->verifyErrors))?
    ?275                                $this->verifyErrors = array();?
    ?276?
    ?277                        if(isset($variables["id"]))?
    ?278                                if(!is_numeric($variables["id"]) && $variables["id"])?
    ?279                                        $this->verifyErrors[] = "The `id` field must be numeric or equivalent to zero (although positive is reccomended).";?
    ?280?
    ?281                        if(isset($variables["inactive"]))?
    ?282                                if($variables["inactive"] && $variables["inactive"] != 1)?
    ?283                                        $this->verifyErrors[] = "The `inactive` field must be a boolean (equivalent to 0 or exactly 1).";?
    283284                                        ?
    284?                                        case "modifiedby":?
    285?                                                $updatestatement .= "`modifiedby` = ".((int) $modifiedby).", ";?
    286?                                        break;?
    287?        ?
    288?                                        case "modifieddate":?
    289?                                                $updatestatement .= "`modifieddate` = NOW(), ";?
    290?                                        break;?
    291?                                        ?
    292?                                        default:?
    293?                                                if(!isset($variables[$fieldname]) && strpos($thefield["flags"],"not_null") !== false)?
    294?                                                        $variables[$fieldname] = $this->getDefaultByType($thefield["type"],true);?
    295?                                                ?
    296?                                                if(isset($variables[$fieldname]))?
    297?                                                        $updatestatement .= "`".$fieldname."` = ".$this->prepareFieldForSQL($variables[$fieldname],$thefield["type"],$thefield["flags"]).", ";?
    298?                                        break;?
    299?                                }//end switch field name?
    300?                        }//end if?
    301?                }//end foreach?
    302?                $updatestatement = substr($updatestatement, 0, strlen($updatestatement)-2);?
    303?                ?
    304?                $updatestatement .= " WHERE `id`=".((int) $variables["id"]);?
    305??
    306?                $updateresult = $this->db->query($updatestatement);?
    307?                ?
    308?                return true;?
    309?        }?
    310?        ?
    311?        ?
    312?        function insertRecord($variables,$createdby = NULL, $overrideID = false){?
    313?        ?
    314?                if($createdby === NULL)?
    315?                        if(isset($_SESSION["userinfo"]["id"]))?
    316?                                $createdby = $_SESSION["userinfo"]["id"];?
    ?285                        if(count($this->verifyErrors))?
    ?286                                $thereturn = $this->verifyErrors;?
    ?287?
    ?288                        unset($this->verifyErrors);?
    ?289?
    ?290                        return $thereturn;?
    ?291?
    ?292                }//end method --verifyVariables--?
    ?293?
    ?294?
    ?295                function updateRecord($variables, $modifiedby = NULL){?
    ?296?
    ?297                        $variables = addSlashesToArray($variables);?
    ?298?
    ?299                        if($modifiedby === NULL)?
    ?300                                if(isset($_SESSION["userinfo"]["id"]))?
    ?301                                        $modifiedby = $_SESSION["userinfo"]["id"];?
    ?302                                else?
    ?303                                        $error = new appError(-840,"Session Timed Out.","Creating New Record");?
    ?304?
    ?305                        if(!isset($variables["id"]))?
    ?306                                $error = new appError(-820,"id not set","Updating Record");?
    ?307?
    ?308                        $updatestatement = "UPDATE `".$this->maintable."` SET ";?
    ?309?
    ?310                        foreach($this->fields as $fieldname => $thefield){?
    ?311                                if(!isset($thefield["select"])){?
    ?312                                        switch($fieldname){?
    ?313                                                case "id":?
    ?314                                                case "creationdate":?
    ?315                                                case "createdby":?
    ?316                                                break;?
    ?317?
    ?318                                                case "modifiedby":?
    ?319                                                        $updatestatement .= "`modifiedby` = ".((int) $modifiedby).", ";?
    ?320                                                break;?
    ?321?
    ?322                                                case "modifieddate":?
    ?323                                                        $updatestatement .= "`modifieddate` = NOW(), ";?
    ?324                                                break;?
    ?325?
    ?326                                                default:?
    ?327                                                        if(!isset($variables[$fieldname]) && strpos($thefield["flags"],"not_null") !== false)?
    ?328                                                                $variables[$fieldname] = $this->getDefaultByType($thefield["type"],true);?
    ?329?
    ?330                                                        if(isset($variables[$fieldname]))?
    ?331                                                                $updatestatement .= "`".$fieldname."` = ".$this->prepareFieldForSQL($variables[$fieldname],$thefield["type"],$thefield["flags"]).", ";?
    ?332                                                break;?
    ?333                                        }//end switch field name?
    ?334                                }//end if?
    ?335                        }//end foreach?
    ?336                        $updatestatement = substr($updatestatement, 0, strlen($updatestatement)-2);?
    ?337?
    ?338                        $updatestatement .= " WHERE `id`=".((int) $variables["id"]);?
    ?339?
    ?340                        $updateresult = $this->db->query($updatestatement);?
    ?341?
    ?342?
    ?343                        return true;?
    ?344                }?
    ?345?
    ?346?
    ?347                function insertRecord($variables,$createdby = NULL, $overrideID = false){?
    ?348?
    ?349                        if($createdby === NULL)?
    ?350                                if(isset($_SESSION["userinfo"]["id"]))?
    ?351                                        $createdby = $_SESSION["userinfo"]["id"];?
    ?352                                else?
    ?353                                        $error = new appError(-840,"Session Timed Out.","Creating New Record");?
    ?354?
    ?355?
    ?356                        $variables = addSlashesToArray($variables);?
    ?357?
    ?358                        $fieldlist = "";?
    ?359                        $insertvalues = "";?
    ?360                        foreach($this->fields as $fieldname => $thefield){?
    ?361                                if(!isset($thefield["select"])){?
    ?362                                        switch($fieldname){?
    ?363                                                case "id":?
    ?364                                                        if(isset($variables["id"]))?
    ?365                                                                if($overrideID && $variables["id"]){?
    ?366                                                                        $fieldlist .= "id, ";?
    ?367                                                                        $insertvalues .= ((int) $variables["id"]).", ";?
    ?368                                                                }//endif?
    ?369                                                        break;?
    ?370?
    ?371                                                case "createdby":?
    ?372                                                case "modifiedby":?
    ?373                                                        $fieldlist .= $fieldname.", ";?
    ?374                                                        $insertvalues .= ((int) $createdby).", ";?
    ?375                                                        break;?
    ?376?
    ?377                                                case "creationdate":?
    ?378                                                case "modifieddate":?
    ?379                                                        $fieldlist .= $fieldname.", ";?
    ?380                                                        $insertvalues .= "NOW(), ";?
    ?381                                                        break;?
    ?382?
    ?383                                                default:?
    ?384                                                        if(!isset($variables[$fieldname]) && strpos($thefield["flags"],"not_null") !== false)?
    ?385                                                                $variables[$fieldname] = $this->getDefaultByType($thefield["type"],true);?
    ?386?
    ?387                                                        if(isset($variables[$fieldname])){?
    ?388                                                                $fieldlist .= "`".$fieldname."`, ";?
    ?389                                                                $insertvalues .= $this->prepareFieldForSQL($variables[$fieldname],$thefield["type"],$thefield["flags"]).", ";?
    ?390                                                        }//endif - fieldname?
    ?391                                                        break;?
    ?392                                        }//end switch field name?
    ?393                                }//end if?
    ?394                        }//end foreach?
    ?395                        $fieldlist = substr($fieldlist, 0, strlen($fieldlist)-2);?
    ?396                        $insertvalues = substr($insertvalues, 0, strlen($insertvalues)-2);?
    ?397?
    ?398                        $insertstatement = "INSERT INTO ".$this->maintable." (".$fieldlist.") VALUES (".$insertvalues.")";?
    ?399                        $insertresult = $this->db->query($insertstatement);?
    ?400?
    ?401                        if($insertresult)?
    ?402                                return $this->db->insertId();?
    317403                        else?
    318?                                $error = new appError(-840,"Session Timed Out.","Creating New Record");?
    319??
    320?                ?
    321?                $variables = addSlashesToArray($variables);?
    322??
    323?                $fieldlist = "";?
    324?                $insertvalues = "";?
    325?                foreach($this->fields as $fieldname => $thefield){?
    326?                        if(!isset($thefield["select"])){?
    327?                                switch($fieldname){?
    328?                                        case "id":?
    329?                                                if(isset($variables["id"]))?
    330?                                                        if($overrideID && $variables["id"]){?
    331?                                                                $fieldlist .= "id, ";?
    332?                                                                $insertvalues .= ((int) $variables["id"]).", ";?
    333?                                                        }//endif?
    334?                                                break;?
    335?                                        ?
    336?                                        case "createdby":?
    337?                                        case "modifiedby":?
    338?                                                $fieldlist .= $fieldname.", ";                                  ?
    339?                                                $insertvalues .= ((int) $createdby).", ";?
    340?                                                break;?
    341?        ?
    342?                                        case "creationdate":?
    343?                                        case "modifieddate":?
    344?                                                $fieldlist .= $fieldname.", ";?
    345?                                                $insertvalues .= "NOW(), ";?
    346?                                                break;?
    347?                                        ?
    348?                                        default:?
    349?                                                if(!isset($variables[$fieldname]) && strpos($thefield["flags"],"not_null") !== false)?
    350?                                                        $variables[$fieldname] = $this->getDefaultByType($thefield["type"],true);?
    351?                                                ?
    352?                                                if(isset($variables[$fieldname])){?
    353?                                                        $fieldlist .= "`".$fieldname."`, ";?
    354?                                                        $insertvalues .= $this->prepareFieldForSQL($variables[$fieldname],$thefield["type"],$thefield["flags"]).", ";?
    355?                                                }//endif - fieldname?
    356?                                                break;?
    357?                                }//end switch field name?
    358?                        }//end if?
    359?                }//end foreach?
    360?                $fieldlist = substr($fieldlist, 0, strlen($fieldlist)-2);?
    361?                $insertvalues = substr($insertvalues, 0, strlen($insertvalues)-2);?
    362??
    363?                $insertstatement = "INSERT INTO ".$this->maintable." (".$fieldlist.") VALUES (".$insertvalues.")";?
    364?                $insertresult = $this->db->query($insertstatement);?
    365?                ?
    366?                if($insertresult)?
    367?                        return $this->db->insertId();?
    368?                else?
    369?                        return false;?
    370?        }?
    371?        ?
    372?        ?
    373?        function processAddEditPage(){?
    374?                if(!isset($_POST["command"])){?
    375?                        ?
    376?                        if(isset($_GET["id"])){?
    377?                                //editing?
    378?                                if(!hasRights($this->editroleid))?
    379?                                        goURL(APP_PATH."noaccess.php");?
    380?                                else?
    381?                                        return $this->getRecord((integer) $_GET["id"]);?
    382?                        } else {?
    383?                                if(!hasRights($this->addroleid))?
    384?                                        goURL(APP_PATH."noaccess.php");?
    385?                                else    ?
    386?                                        return $this->getDefaults();?
    ?404                                return false;?
    ?405                }?
    ?406?
    ?407?
    ?408                function processAddEditPage(){?
    ?409                        if(!isset($_POST["command"])){?
    ?410?
    ?411                                if(isset($_GET["id"])){?
    ?412                                        //editing?
    ?413                                        if(!hasRights($this->editroleid))?
    ?414                                                goURL(APP_PATH."noaccess.php");?
    ?415                                        else?
    ?416                                                return $this->getRecord((integer) $_GET["id"]);?
    ?417                                } else {?
    ?418                                        if(!hasRights($this->addroleid))?
    ?419                                                goURL(APP_PATH."noaccess.php");?
    ?420                                        else?
    ?421                                                return $this->getDefaults();?
    ?422                                }?
    387423                        }?
    388?                }?
    389?                else?
    390?                {?
    391?                        switch($_POST["command"]){?
    392?                                case "cancel":?
    393?                                        // if we needed to do any clean up (deleteing temp line items)?
    394?                                        if(!isset($_POST["id"])) $_POST["id"]=0;?
    395??
    396?                                        $theurl = $this->backurl;?
    397?                                        ?
    398?                                        if(isset($_POST["id"]))?
    399?                                                $theurl .= "#".((int) $_POST["id"]);?
    400?                                        goURL($theurl);                                 ?
    401?                                break;?
    402?                                case "save":?
    403?                                        if($_POST["id"]) {?
    404?                                                $this->updateRecord($_POST);                                            ?
    405?                                                $theid = $_POST["id"];?
    406?                                                //get record?
    407?                                                $therecord = $this->getRecord($theid);?
    408?                                                $therecord["phpbmsStatus"]="Record Updated";?
    409??
    410?                                                return $therecord;?
    411?                                        }?
    412?                                        else {?
    413?                                                $theid = $this->insertRecord($_POST);?
    414?                                                ?
    415?                                                //get record?
    416?                                                $therecord=$this->getRecord($theid);?
    417?                                                $therecord["phpbmsStatus"] = "<div style=\"float:right;margin-top:-3px;\"><button type=\"button\" class=\"smallButtons\" onclick=\"document.location='".str_replace("&","&amp;",$_SERVER["REQUEST_URI"])."'\">add new</button></div>";?
    418?                                                $therecord["phpbmsStatus"] .= "Record Created";?
    419?                                                ?
    420?                                                return $therecord;?
    421?                                        }?
    422?                                break;?
    423?                        }//end command switch                   ?
    424?                }// end if?
    425?        }// end function?
    426?}?
    ?424                        else?
    ?425                        {?
    ?426                                switch($_POST["command"]){?
    ?427                                        case "cancel":?
    ?428                                                // if we needed to do any clean up (deleteing temp line items)?
    ?429                                                if(!isset($_POST["id"])) $_POST["id"]=0;?
    ?430?
    ?431                                                $theurl = $this->backurl;?
    ?432?
    ?433                                                if(isset($_POST["id"]))?
    ?434                                                        $theurl .= "#".((int) $_POST["id"]);?
    ?435                                                goURL($theurl);?
    ?436                                        break;?
    ?437                                        case "save":?
    ?438?
    ?439                                                $variables = $this->prepareVariables($_POST);?
    ?440                                                $errorArray = $this->verifyVariables($variables);?
    ?441?
    ?442                                                if($_POST["id"]) {?
    ?443?
    ?444                                                        $theid = $variables["id"];?
    ?445?
    ?446                                                        if(!count($errorArray)){?
    ?447?
    ?448                                                                $this->updateRecord($variables);?
    ?449?
    ?450                                                                //get record?
    ?451                                                                $therecord = $this->getRecord($theid);?
    ?452                                                                $therecord["phpbmsStatus"] = "Record Updated";?
    ?453                                                        }else{?
    ?454                                                                foreach($errorArray as $error)?
    ?455                                                                        $logError = new appError(-900, $error, "Verification Error");?
    ?456?
    ?457                                                                //get record?
    ?458                                                                $therecord = $this->getRecord($theid);?
    ?459                                                                $therecord["phpbmsStatus"] = "Data Verification Error";?
    ?460                                                        }//end if?
    ?461?
    ?462?
    ?463?
    ?464                                                        return $therecord;?
    ?465                                                }?
    ?466                                                else {?
    ?467?
    ?468                                                        $theid = 0;?
    ?469?
    ?470                                                        if(!count($errorArray)){?
    ?471                                                                $theid = $this->insertRecord($variables);?
    ?472                                                                //get record?
    ?473                                                                $therecord = $this->getRecord($theid);?
    ?474                                                                $therecord["phpbmsStatus"] = "<div style=\"float:right;margin-top:-3px;\"><button type=\"button\" class=\"smallButtons\" onclick=\"document.location='".str_replace("&","&amp;",$_SERVER["REQUEST_URI"])."'\">add new</button></div>";?
    ?475                                                                $therecord["phpbmsStatus"] .= "Record Created";?
    ?476                                                        }else{?
    ?477                                                                foreach($errorArray as $error)?
    ?478                                                                        $logError = new appError(-900, $error, "Verification Error");?
    ?479?
    ?480                                                                //get record?
    ?481                                                                $therecord = $this->getRecord($theid);?
    ?482                                                                $therecord["phpbmsStatus"] .= "Data Verification Error";?
    ?483                                                        }//end if?
    ?484?
    ?485                                                        return $therecord;?
    ?486                                                }?
    ?487                                        break;?
    ?488                                }//end command switch?
    ?489                        }// end if?
    ?490                }// end function?
    ?491        }//end class?
    427492?>?
  • trunk/phpbms/index.php

    r308 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev$ | $LastChangedBy$?
    ? ? ?
    3939        require_once("include/session.php");?
    4040        require_once("include/login_include.php");?
    41?        ?
    42?        $pageTitle = APPLICATION_NAME." Log in";?
    43?        ?
    ?41?
    ?42?
    ?43        if(isset($_POST["name"]) && isset($_POST["password"])){?
    ?44?
    ?45                $login = new login($db);?
    ?46                $failed = $login->verify($_POST["name"], $_POST["password"]);?
    ?47?
    ?48        } else {?
    ?49?
    ?50                $failed = "";?
    ?51                $_POST["name"] = "";?
    ?52?
    ?53        }//endif?
    ?54?
    ?55        $pageTitle = formatVariable(APPLICATION_NAME)." Log in";?
    ?56?
    4457        $phpbms->cssIncludes[] = "pages/login.css";?
    4558        $phpbms->jsIncludes[] = "common/javascript/login.js";?
    46?        ?
    ?59?
    4760        $phpbms->showMenu = false;?
    48?        $phpbms->showFooter = false;    ?
    49?        ?
    ?61        $phpbms->showFooter = false;?
    ?62?
    5063        include("header.php");?
    5164?>?
    52?        ?
    ?65?
    5366        <div id="loginbox" class="bodyline" >?
    ?67?
    5468                <h1><span><?php echo APPLICATION_NAME;?></span></h1>?
    5569                <?php if ($failed) {?><div class="standout" id="failed"><?php echo $failed?></div><?php } ?>?
    ?70?
    5671                <noscript>?
    5772                        <p class="standout" align="center">JavaScript is disabled.</p>?
    5873                        <p> Please check browser requirements.</p>?
    5974                </noscript>?
    60?                ?
    ?75?
    6176                <form name="form1" method="post" action="<?php echo $_SERVER["PHP_SELF"]?>">?
    62?                        <fieldset>?
    63?                                <legend>Log In</legend>?
    64?                                <p>?
    65?                                        <label for="username">name</label><br />?
    66?                                        <input name="name" type="text" id="username" size="25" maxlength="64" value="<?php echo htmlQuotes($_POST["name"])?>" disabled="disabled"/>?
    ?77?
    ?78                        <p>?
    ?79                                <label for="username">name</label><br />?
    ?80                                <input name="name" type="text" id="username" size="25" maxlength="64" value="<?php echo htmlQuotes($_POST["name"])?>" disabled="disabled"/>?
    ?81                        </p>?
    ?82?
    ?83                        <p>?
    ?84                                <label for="password">password</label><br />?
    ?85                                <input name="password" type="password" id="password" size="25" maxlength="24" disabled="disabled"/>?
    ?86                        </p>?
    ?87?
    ?88?
    ?89                        <p id="moreinfoButtonP"><button id="moreinfoButton" type="button" class="graphicButtons buttonInfo"><span>more info</span></button></p>?
    ?90                        <p id="buttonP"><button class="Buttons" type="submit" id="loginButton" disabled="disabled">Log In</button></p>?
    ?91?
    ?92                </form>?
    ?93?
    ?94?
    ?95                <div id="moreinfo" >?
    ?96?
    ?97                        <div class="box">?
    ?98?
    ?99                                <h2><a href="http://www.phpbms.org" title="phpBMS"><span class="alt">phpBMS</span></a></h2>?
    ?100?
    ?101                                <h3>Business Management Web Application</h3>?
    ?102?
    ?103                                <p class="tiny">?
    ?104                                        <a href="requirements.php">browser requirements</a> |?
    ?105                                        <a href="info.php">about phpBMS</a>?
    67106                                </p>?
    68?                                ?
    69?                                <p>?
    70?                                        <label for="password">password</label><br />?
    71?                                        <input name="password" type="password" id="password" size="25" maxlength="24" disabled="disabled"/>?
    72?                                </p>?
    73?                                ?
    74?                        </fieldset>?
    75?                        <p id="buttonP"><button class="Buttons" type="submit" id="loginButton" disabled="disabled">Log In</button></p>?
    76?                </form>         ?
    77?                <p id="moreinfoButtonP"><button id="moreinfoButton" type="button" class="graphicButtons buttonInfo"><span>more info</span></button></p>?
    78?                <div id="moreinfo" >?
    79?                        <div class="box">?
    80?                        <h2><a href="http://www.phpbms.org" title="phpBMS"><span class="alt">phpBMS</span></a></h2>?
    81?                        <h3>Business Management Web Application</h3>?
    82?                        <p class="tiny">?
    83?                                <a href="requirements.php">browser requirements</a> |?
    84?                                <a href="info.php">program info</a>?
    85?                        </p>?
    ?107?
    86108                        </div>?
    87109                </div>?
    88110        </div>?
    89111?
    90?                ?
    ?112?
    91113        <?php if(DEMO_ENABLED=="true"){?>?
    ?114?
    92115        <div id="demobox" class="bodyline">?
    ?116?
    93117                <h2>Demonstration Mode</h2>?
    ?118?
    94119                <p>?
    95?                        Use the following user credentials to log into phpBMS. Each user ?
    ?120                        Use the following user credentials to log into phpBMS. Each user?
    96121                        highlights a different security access level.?
    97122                </p>?
    ?123?
    98124                <dl>?
    99125                        <dt>Shipping Personnel</dt>?
    ? ? ?
    101127                                username: shipping<br />?
    102128                                password: shipping?
    103?</dd>?
    ?129                        </dd>?
    ?130?
    104131                        <dt>Sales Personnel</dt>?
    105?                        <dd>username: sales<br />?
    106?                        password: sales</dd>?
    ?132                        <dd>?
    ?133                                username: sales<br />?
    ?134                                password: sales?
    ?135                        </dd>?
    ?136?
    107137                        <dt>Sales Manager</dt>?
    108?                        <dd>username: salesmanager<br />?
    ?138                        <dd>?
    ?139                                username: salesmanager<br />?
    109140                                password: salesmanager?
    110?                     </dd>?
    ?141                        </dd>?
    111142                </dl>?
    112143        </div>?
    ?144?
    113145        <?php } include("footer.php")?>?
  • trunk/phpbms/info.php

    r427 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev$ | $LastChangedBy$?
    ? ? ?
    3737 +-------------------------------------------------------------------------+?
    3838*/?
    39?        $loginNoKick=true;?
    40?        $loginNoDisplayError=true;?
    ?39        $loginNoKick = true;?
    ?40        $loginNoDisplayError = true;?
    4141?
    4242        require_once("include/session.php");?
    43?        ?
    44?        ?
    45?        function displayVersions($db){?
    46?                $querystatement="SELECT displayname,version from modules ORDER BY id";?
    47?                $queryresult=$db->query($querystatement);?
    4843?
    49?                if($queryresult){?
    50?                        while($therecord=$db->fetchArray($queryresult)){?
    51?                                if($therecord["displayname"]!="Base"){?
    52?                                        echo $therecord["displayname"].": ";?
    53?                                        echo "v".$therecord["version"]."<br />";?
    54?                                } else?
    55?                                        echo "<span class=\"important\">v".$therecord["version"]."</span><br /><br />";?
    56?                        }?
    57?                }?
    58?        }?
    59?        ?
    ?44        class versions{?
    ?45?
    ?46                var $db;?
    ?47                var $queryresult;?
    ?48?
    ?49                function versions($db){?
    ?50?
    ?51                        $this->db = $db;?
    ?52?
    ?53                }//end function init?
    ?54?
    ?55                function get(){?
    ?56?
    ?57                        $querystatement = "?
    ?58                                SELECT?
    ?59                                        `name`,?
    ?60                                        `displayname`,?
    ?61                                        `version`?
    ?62                                FROM?
    ?63                                        `modules`?
    ?64                                ORDER BY?
    ?65                                        `id`";?
    ?66?
    ?67                        $this->queryresult = $this->db->query($querystatement);?
    ?68?
    ?69                }//end function get?
    ?70?
    ?71?
    ?72                function show(){?
    ?73?
    ?74                        if(!$this->queryresult)?
    ?75                                return false;?
    ?76?
    ?77                        while($therecord = $this->db->fetchArray($this->queryresult)){?
    ?78?
    ?79                                if($therecord["name"] != "base")?
    ?80                                        echo formatVariable($therecord["displayname"]).": v".$therecord["version"]."<br />";?
    ?81                                else?
    ?82                                        echo '<p class="important">v'.$therecord["version"].'</p>';?
    ?83?
    ?84                        }//endwhile?
    ?85?
    ?86                        return true;?
    ?87?
    ?88                }//end function show?
    ?89?
    ?90        }//end class?
    ?91?
    ?92        $versions = new versions($db);?
    ?93        $versions->get();?
    ?94?
    6095        $pageTitle="phpBMS Information";?
    6196        $phpbms->cssIncludes[] = "pages/info.css";?
    62?        ?
    ?97?
    6398        $phpbms->showMenu = false;?
    6499        $phpbms->showFooter = false;?
    65?        ?
    ?100?
    66101        include("header.php");?
    67?        ?
    ?102?
    68103?><div class="bodyline" id="container">?
    ?104?
    ?105        <div id="phpBMSLogo" class="box small">?
    ?106                <?php $versions->show() ?>?
    ?107        </div>?
    ?108?
    69109        <h1>About phpBMS</h1>?
    70?        <p>phpBMS is commercial open source, web-based, business management software.</p>?
    71?        ?
    72?        <div id="phpBMSLogo" class="box small">?
    73?                <?php if(isset($db)) displayVersions($db)?>?
    74?        </div>?
    75?        ?
    ?110        <p>phpBMS is commercial, open source, web-based, business management software.</p>?
    ?111?
    76112        <div id="companyInfo">?
    77?                <p class="small">?
    78?                        Copyright &copy; 2004 -2007 Kreotek, llc. All Rights Reserved.?
    79?                        phpBMS, and the phpBMS logo are trademarks of Kreotek, llc. ?
    ?113                <p >?
    ?114                        Copyright &copy; <?php echo date("Y")?> Kreotek, LLC. All Rights Reserved.?
    ?115                        phpBMS, and the phpBMS logo are trademarks of Kreotek, LLC.?
    80116                        Software is licensed under a <a href="license.txt">modified BSD license</a>.?
    81117                </p>?
    82?                ?
    ?118?
    83119                <h3>Kreotek, LLC</h3>?
    84?                <p class="small">?
    ?120                <p>?
    85121                        610 Quantum<br />?
    86?                        Rio Rancho, NM 87124?
    ?122                        Rio Rancho, NM 87124 USA?
    ?123                </p>?
    ?124                <p><a href="http://www.kreotek.com">http://www.kreotek.com</a></p>?
    ?125                <p>?
    ?126                        sales: <a href="mailto:sales@kreotek.com">sales@kreotek.com</a><br />?
    ?127                        support: <a href="mailtosupport@kreotek.com">support@kreotek.com</a>?
    87128                </p>?
    88129                <p>?
    89?                        web: <a href="http://www.kreotek.com">http://www.kreotek.com</a><br />?
    90?                        sales: <a href="mailto:sales@kreotek.com">sales@kreotek.com</a><br />?
    91?                        support: <a href="mailtosupport@kreotek.com">support@kreotek.com</a><br />?
    92?                        phone: <strong>1-800-731-8026</strong>?
    ?130                        U.S. and Canada Toll Free<br />?
    ?131                        1-800-731-8026?
    ?132?
    ?133                <p>?
    ?134                        Outside US and Canada<br />?
    ?135                        +1-505-994-6388?
    93136                </p>?
    ?137?
    94138                <h3>phpBMS Open Source Project</h3>?
    95139                <p>?
    96?                        project web site: <a href="http://www.kreotek.com">http://www.phpbms.org</a><br />?
    97?                        project forums: <a href="mailto:sales@kreotek.com">sales@kreotek.com</a><br />?
    ?140                        community web site: <a href="http://www.kreotek.com">http://www.phpbms.org</a><br />?
    ?141                        community forums: <a href="http://www.phpbms.org/forum">http://www.phpbms.org/forum</a><br />?
    98142                </p>?
    99143        </div>?
    100?        ?
    101?                <h2>Source Code</h2>?
    102?                <ul>?
    103?                        <li><strong>phpBMS</strong> - Commercial Open Source Business Management Web Appllication (<a href="http://www.kreotek.com">www.phpbms.org</a>)</li>?
    104?                        <li><strong>fpdf</strong> - A PHP class which allows to generate PDF files with pure PHP (<a href="http://www.fpdf.org">www.fpdf.org</a>)</li>?
    105?                    <li><strong>moo.fx</strong> - Super lightweight JavaScript effects library (<a href="http://moofx.mad4milk.net/">moofx.mad4milk.net</a>) </li>?
    106?                        <li><strong>mochikit</strong> - A lightweight JavaScript library (<a href="http://mochichit.com/">mochikit.com</a>) - phpBMS utilizes modified parts mochikit code and it's programming structure.</li>?
    107?                        <li><strong>parseCSV</strong> - An easy to use PHP class to read and write CSV data properly.(<a href="http://code.google.com/p/parsecsv-for-php/" >code.google.com/p/parsecsv-for-php/</a>)</li>?
    108?                </ul>?
    109?                <h2>Technologies</h2>?
    110?                <ul>?
    111?                        <li><strong>php</strong> -  A widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.  (<a href="http://www.php.net">www.php.net</a>)</li>?
    112?                        <li><strong>MySQL</strong> - An open source relational database management system (RDBMS) that uses Structured Query Language (SQL) (<a href="http://www.mysql.org">www.mysql.org</a>)</li>?
    113?                        <li><strong>AJAX</strong> - Asynchronous Javascript And XML is a group of technologies that help browser based applications behave more like applications you run from your desktop.</li>?
    114?                </ul>?
    115144?
    116?        <p align="right">?
    117?                <input type="button" value="Back" class="Buttons" onclick="document.location='<?php echo APP_PATH; if(isset($_SESSION["userinfo"])) echo DEFAULT_LOAD_PAGE?>'" id="loginButton"/>?
    118?        </p>?
    ?145        <h2>Source Code</h2>?
    ?146        <ul>?
    ?147                <li>?
    ?148                        <h3>phpBMS (<a href="http://www.phpbms.org">www.phpbms.org</a>)</h3>?
    ?149                        <p>Commercial Open Source Business Management Web Appllication</p>?
    ?150                </li>?
    ?151?
    ?152                <li>?
    ?153                        <h3>fpdf (<a href="http://www.fpdf.org">www.fpdf.org</a>)</h3>?
    ?154                        <p>A PHP class which allows to generate PDF files with pure PHP</p>?
    ?155                </li>?
    ?156?
    ?157                <li>?
    ?158                        <h3>moo.fx (<a href="http://moofx.mad4milk.net/">moofx.mad4milk.net</a>)</h3>?
    ?159                        <p>Super lightweight JavaScript effects library</p>?
    ?160                </li>?
    ?161?
    ?162                <li>?
    ?163                        <h3>mochikit (<a href="http://mochichit.com/">mochikit.com</a>)</h3>?
    ?164                        <p>A lightweight JavaScript library - phpBMS utilizes modified parts of mochikit code and it's programming structure for JavaScript as inspiration.</p>?
    ?165                </li>?
    ?166?
    ?167                <li>?
    ?168                        <h3>parseCSV (<a href="http://code.google.com/p/parsecsv-for-php/" >code.google.com/p/parsecsv-for-php/</a>)</h3>?
    ?169                        <p>An easy to use PHP class to read and write CSV data properly.</p>?
    ?170                </li>?
    ?171        </ul>?
    ?172?
    ?173        <p align="right"><input type="button" value="Log In" class="Buttons" onclick="document.location='./'" id="loginButton" /></p>?
    ?174?
    119175</div><?php include("footer.php") ?>?
  • trunk/phpbms/install/createtables.sql

    r427 r485 ?
    5858  `assignedtodate` date default NULL,?
    5959  `subject` varchar(128) default NULL,?
    60?  `type` char(2) default NULL,?
    ?60  `type` char(2) NOT NULL default 'NT',?
    6161  `createdby` int(11) NOT NULL default '0',?
    6262  `creationdate` datetime NOT NULL default '0000-00-00 00:00:00',?
    ? ? ?
    115115  `displayorder` int(11) NOT NULL default '0',?
    116116  `roleid` int(11) NOT NULL default '0',?
    117?  `reportfile` varchar(128) default NULL,?
    ?117  `reportfile` varchar(128) NOT NULL,?
    118118  `description` text,?
    119119  `createdby` int(11) NOT NULL default '0',?
    ? ? ?
    169169  `modifieddate` timestamp NOT NULL,?
    170170  PRIMARY KEY  (`id`)?
    171?) ENGINE=INNODB  AUTO_INCREMENT=1000; ?
    ?171) ENGINE=INNODB  AUTO_INCREMENT=1000;?
    172172?
    173173CREATE TABLE tablefindoptions (?
    ? ? ?
    180180  PRIMARY KEY  (id),?
    181181  KEY tabledef (tabledefid)?
    182?) ENGINE=INNODB  AUTO_INCREMENT=2000; ?
    ?182) ENGINE=INNODB  AUTO_INCREMENT=2000;?
    183183?
    184184CREATE TABLE tableoptions (?
    ? ? ?
    193193  PRIMARY KEY  (id),?
    194194  KEY tabledef (tabledefid)?
    195?) ENGINE=INNODB  AUTO_INCREMENT=2000; ?
    ?195) ENGINE=INNODB  AUTO_INCREMENT=2000;?
    196196?
    197197CREATE TABLE tablesearchablefields (?
    ? ? ?
    211211  firstname varchar(64) NOT NULL default '',?
    212212  lastname varchar(64) NOT NULL default '',?
    ?213  `lastip` VARCHAR(45) NOT NULL DEFAULT '',?
    213214  creationdate datetime NOT NULL default '0000-00-00 00:00:00',?
    214215  revoked tinyint(1) NOT NULL default '0',?
    ? ? ?
    259260  `roleid` int(11) NOT NULL default '0',?
    260261  PRIMARY KEY  (`id`)?
    261?) ENGINE=INNODB  AUTO_INCREMENT=100; ?
    ?262) ENGINE=INNODB  AUTO_INCREMENT=100;?
    262263?
    263264CREATE TABLE `attachments` (?
    ? ? ?
    274275  KEY `thetable` (`tabledefid`),?
    275276  KEY `thefile` (`fileid`)?
    276?) ENGINE=INNODB ; ?
    ?277) ENGINE=INNODB ;?
    277278?
    278279CREATE TABLE `roles` (?
    ? ? ?
    280281  `name` VARCHAR(64) NOT NULL,?
    281282  `description` TEXT,?
    282?  `inactive` tinyint(4) NOT NULL,?
    ?283  `inactive` tinyint(4) NOT NULL DEFAULT 0,?
    283284  `createdby` INTEGER UNSIGNED,?
    284285  `creationdate` DATETIME,?
    ? ? ?
    351352  PRIMARY KEY  (`id`)?
    352353) ENGINE=INNODB;?
    353??
  • trunk/phpbms/install/install.css

    r285 r485 ?
    1?.bodyline,#topTitle{width:740px; margin:10px auto;}?
    2?h1{margin-bottom:20px;}?
    3?p{margin:0;padding:0px 10px 10px;}?
    ?1li{?
    ?2    margin-bottom: 20px;?
    ?3}?
    ?4?
    ?5.bodyline,#topTitle{?
    ?6    width:100%;?
    ?7    max-width: 740px;?
    ?8    margin:10px auto;?
    ?9}?
    ?10?
    ?11h1{?
    ?12    margin-bottom:20px;?
    ?13}?
    ?14?
    ?15p{?
    ?16    margin:10px 0;?
    ?17    padding:0;?
    ?18}?
    ?19?
    ?20#navPanel{?
    ?21    float: left;?
    ?22    width: 190px;?
    ?23}?
    ?24?
    ?25#navSelect{?
    ?26    font-size: 12px;?
    ?27    padding:0;?
    ?28    width: 98%?
    ?29}?
    ?30?
    ?31#stepsPanel{?
    ?32    margin-left: 198px;?
    ?33    min-height: 400px;?
    ?34    border-left: 1px solid #CCCCCC;?
    ?35    padding-left: 8px;?
    ?36}?
    ?37?
    ?38?
    ?39.success{?
    ?40    color: green;?
    ?41    line-height: 16px;?
    ?42    background: url("success.gif") no-repeat left;?
    ?43    padding:2px 0 2px 20px;?
    ?44}?
    ?45?
    ?46.fail {?
    ?47    color: red;?
    ?48    line-height: 16px;?
    ?49    background: url("fail.gif") no-repeat left;?
    ?50    padding:2px 0 2px 20px;?
    ?51}?
    ?52?
    ?53.warning {?
    ?54    line-height: 16px;?
    ?55    background: url("warning.gif") no-repeat left;?
    ?56    padding:2px 0 2px 20px;?
    ?57}?
    ?58?
    ?59.running {?
    ?60    line-height: 16px;?
    ?61    background: url("../common/image/spinner.gif") no-repeat left;?
    ?62    padding:2px 0 2px 20px;?
    ?63}?
    ?64?
    ?65?
    ?66#sysRequirements td{?
    ?67    border-bottom: 1px solid #CCCCCC;?
    ?68    padding: 5px 10px;?
    ?69}?
    470?
    571.results{width:99%;font-family:'Courier New', Courier, mono;font-size:13px;}?
    672.testButtonsP{text-align:center; padding:20px;}?
    773?
    8?.nextprevP{text-align:right;}?
    9?.nextprevButtons{padding-right:20px;padding-left:20px;}?
    ?74.nextprevP{?
    ?75    float: right;?
    ?76    margin: 0;?
    ?77}?
    1078?
    11?#moduleInformation h2{margin-top:0;padding-top:5px;}?
    ?79.nextButtons, .prevButtons{?
    ?80    padding:3px 20px;?
    ?81}?
    ?82?
    ?83.debugResults{?
    ?84    display: none;?
    ?85}?
    ?86?
    ?87#moduleTable td{?
    ?88?
    ?89    padding: 5px 10px;?
    ?90    border-top: 1px solid #CCCCCC;?
    ?91    vertical-align: top;?
    ?92}?
    ?93?
    ?94#moduleTable td h3{?
    ?95    margin-top: 0;?
    ?96    margin-left: 0;?
    ?97}?
    ?98?
    ?99#moduleTable th{?
    ?100    text-align: left;?
    ?101    background: #7B8DA1;?
    ?102    color: white;?
    ?103    padding: 10px;?
    ?104}?
    ?105?
    ?106.moduleInstall{?
    ?107    white-space: nowrap;?
    ?108    min-width: 120px;?
    ?109}?
    ?110?
    ?111#userpassTable{?
    ?112?
    ?113    margin: 0 auto;?
    ?114?
    ?115}?
    ?116?
    ?117    #userpassTable td{?
    ?118?
    ?119        font-size: 22px;?
    ?120?
    ?121    }?
  • trunk/phpbms/install/install.js

    r308 r485 ?
    1?window.onload = function(){?
    2?        var sections = getElementsByClassName("bodyline");?
    3?        ?
    4?        var i;?
    5?        for(i=0; i< sections.length; i++){?
    6?                if(sections[i].id != "step1"){?
    7?                        sections[i].style.display = "none";?
    ?1installer = {?
    ?2?
    ?3        testConnection: function(){?
    ?4?
    ?5                var response = installer.runCommand("testconnection");?
    ?6                var testConnectionNoDebug = getObjectFromID("testConnectionNoDebug");?
    ?7?
    ?8                if(response.success === true){?
    ?9                        testConnectionNoDebug.className = "success"?
    ?10                        testConnectionNoDebug.innerHTML = "Connection Successful";?
    ?11                } else {?
    ?12                        testConnectionNoDebug.className = "fail"?
    ?13                        testConnectionNoDebug.innerHTML = "Connection Failed";?
    814                }?
    ?15?
    ?16        },//endfunction testConnection?
    ?17?
    ?18?
    ?19        createDatabase: function(){?
    ?20?
    ?21                var response = installer.runCommand("createdatabase");?
    ?22                var noDebug = getObjectFromID("createDatabaseNoDebug");?
    ?23?
    ?24                if(response.success === true){?
    ?25?
    ?26                        noDebug.className = "success"?
    ?27                        noDebug.innerHTML = "Database Schema Created";?
    ?28?
    ?29                } else {?
    ?30?
    ?31                        noDebug.className = "fail"?
    ?32                        noDebug.innerHTML = "Database Schema Creation Failed";?
    ?33?
    ?34                }//endif?
    ?35?
    ?36        }, // endfunction createdatabase?
    ?37?
    ?38?
    ?39        coreDataInstall: function(){?
    ?40?
    ?41                var noDebug = getObjectFromID("coreDataNoDebug");?
    ?42?
    ?43                noDebug.className = "running";?
    ?44                noDebug.innerHTML = "Running...";?
    ?45?
    ?46?
    ?47                //we pass the entered application name and e-mail address as a "::" separated pair?
    ?48                var appname = getObjectFromID("appname");?
    ?49                var email = getObjectFromID("email");?
    ?50?
    ?51                var extras = encodeURIComponent(appname.value + "::" + email.value)?
    ?52?
    ?53                var response = installer.runCommand("coredatainstall", extras);?
    ?54?
    ?55                if(response.success === true){?
    ?56?
    ?57                        noDebug.className = "success";?
    ?58                        noDebug.innerHTML = "Core Data Installed Succefully";?
    ?59?
    ?60                        var pass2 = getObjectFromID("pass2")?
    ?61?
    ?62                        pass2.innerHTML = response.extras;?
    ?63?
    ?64                } else {?
    ?65?
    ?66                        noDebug.className = "fail";?
    ?67                        noDebug.innerHTML = "Core Data Installation Failed";?
    ?68?
    ?69                }//endif?
    ?70?
    ?71        }, // endfunction coreDataInstall?
    ?72?
    ?73?
    ?74        moduleInstall: function(e){?
    ?75?
    ?76                var theButton = e.src();?
    ?77?
    ?78                var foo = "";?
    ?79?
    ?80                var module = theButton.id.substring(12);?
    ?81?
    ?82                var noDebug = getObjectFromID("Results"+module);?
    ?83?
    ?84                noDebug.className = "running";?
    ?85                noDebug.innerHTML = "Running...";?
    ?86?
    ?87                var response = installer.runCommand("moduleinstall", module);?
    ?88?
    ?89                if(response.success === true){?
    ?90?
    ?91                        noDebug.className = "success";?
    ?92                        noDebug.innerHTML = "Module Installed";?
    ?93?
    ?94                } else {?
    ?95?
    ?96                        noDebug.className = "fail";?
    ?97                        noDebug.innerHTML = "Installation Failed";?
    ?98?
    ?99                }//endif?
    ?100?
    ?101        },//end function moduleInstall?
    ?102?
    ?103?
    ?104        runCommand: function(command, extras){?
    ?105?
    ?106                if(typeof(extras) == "undefined")?
    ?107                        extras = "";?
    ?108                else?
    ?109                        extras = "&extras=" + extras?
    ?110?
    ?111                var theURL = "installajax.php?command=" + command + extras;?
    ?112?
    ?113                loadXMLDoc(theURL,null,false);?
    ?114?
    ?115                var JSONresponse;?
    ?116                eval("JSONresponse = (" + req.responseText +")");?
    ?117?
    ?118                var responseText = getObjectFromID(command + "results");?
    ?119                if(typeof(responseText) != "undefined"){?
    ?120?
    ?121                        if(responseText.value)?
    ?122                                responseText.value += "\n";?
    ?123?
    ?124                        responseText.value += JSONresponse.details;?
    ?125?
    ?126                }//endif?
    ?127?
    ?128                return JSONresponse?
    ?129?
    ?130        },//endfunction runCommand?
    ?131?
    ?132?
    ?133        toggleDebug: function(){?
    ?134?
    ?135                var debug = getObjectFromID("debug");?
    ?136                var display = "none";?
    ?137                if(debug.checked)?
    ?138                        display = "block";?
    ?139?
    ?140                var debugDisplays = getElementsByClassName("debugResults");?
    ?141?
    ?142                for(var i = 0; i < debugDisplays.length; i ++)?
    ?143                        debugDisplays[i].style.display = display;?
    ?144?
    ?145        }//end function toggleDebug?
    ?146?
    ?147}//end class installer?
    ?148?
    ?149?
    ?150?
    ?151stepsNav = {?
    ?152?
    ?153        currentSection: 1,?
    ?154        sections: null,?
    ?155?
    ?156        navNext: function(){?
    ?157?
    ?158                if(stepsNav.currentSection + 1 <= stepsNav.sections.length){?
    ?159                        stepsNav.navTo(stepsNav.currentSection + 1);?
    ?160                }?
    ?161        },?
    ?162?
    ?163?
    ?164        navPrev: function(){?
    ?165                if(stepsNav.currentSection - 1 > 0)?
    ?166                        stepsNav.navTo(stepsNav.currentSection - 1);?
    ?167        },?
    ?168?
    ?169?
    ?170        navTo: function(section){?
    ?171?
    ?172                for(var i=0; i< stepsNav.sections.length; i++){?
    ?173?
    ?174                        if(stepsNav.sections[i].id != "step" + section){?
    ?175                                stepsNav.sections[i].style.display = "none";?
    ?176                        } else {?
    ?177                                stepsNav.sections[i].style.display = "block";?
    ?178                        }//endif?
    ?179?
    ?180                }//endfor?
    ?181?
    ?182                navBar = getObjectFromID("navSelect");?
    ?183                for(i=0; i < navBar.options.length; i++){?
    ?184                        if(navBar.options[i].value == section){?
    ?185                                navBar.options[i].selected = true;?
    ?186                        }?
    ?187                }//endfor?
    ?188                //navBar.selectedIndex = section?
    ?189?
    ?190                stepsNav.currentSection = section;?
    ?191?
    ?192        },//end function navTo?
    ?193?
    ?194?
    ?195        navLeft: function(){?
    ?196?
    ?197                var navSelect = getObjectFromID("navSelect");?
    ?198                stepsNav.navTo(parseInt(navSelect.value));?
    ?199?
    ?200?
    9201        }?
    ?202?
    10203}?
    11204?
    12?function goSection(direction){?
    13?        var sections = getElementsByClassName("bodyline");?
    14?        var currSection = 1;?
    15?        ?
    16?        for(i=0; i< sections.length; i++){?
    17?                if(sections[i].style.display == "block")                        ?
    18?                        currSection = parseInt(sections[i].id.substr(4),10);?
    19?        }?
    20?        ?
    21?        if(direction == "next")?
    22?                direction = 1;?
    23?        else?
    24?                direction = -1;?
    25?        ?
    26?        if(currSection + direction == 0)?
    27?                return false;?
    28?        else{?
    29?                var currDiv = getObjectFromID("step"+currSection);?
    30?                var newDiv = getObjectFromID("step"+(currSection + direction))?
    31??
    32?                currDiv.style.display = "none";?
    33?                newDiv.style.display = "block";?
    34?        }?
    35?}//end function?
    36??
    37??
    38?        function runCommand(command){?
    39?                var theURL="installxml.php?command="+command;?
    40?                if(command=="updatesettings"){?
    41?                        var mServer=getObjectFromID("mysqlserver");?
    42?                        var mDatabase=getObjectFromID("mysqldb");?
    43?                        var mUser=getObjectFromID("mysqluser");?
    44?                        var mPassword=getObjectFromID("mysqluserpass");?
    45?                        theURL+="&ms="+encodeURIComponent(mServer.value);?
    46?                        theURL+="&mdb="+encodeURIComponent(mDatabase.value);?
    47?                        theURL+="&mu="+encodeURIComponent(mUser.value);?
    48?                        theURL+="&mup="+encodeURIComponent(mPassword.value);?
    49?                }?
    50?                var responseText= getObjectFromID(command+"results");?
    51?                loadXMLDoc(theURL,null,false);?
    52?                if(req.responseXML)?
    53?                        response = req.responseXML.documentElement.firstChild.data+"\n";?
    54?                else ?
    55?                        response = req.responseText+"\n";?
    56?                responseText.value += response;?
    57?        }?
    58?        ?
    59??
    60?        function changeModule(){?
    61?                var moduleSel=getObjectFromID("modules");?
    62?                var installButton=getObjectFromID("installmodule");?
    63?                var modinfo = getObjectFromID("moduleInformation");?
    64?                ?
    65?                var modName = getObjectFromID("modulename");?
    66?                var modVer = getObjectFromID("moduleversion");?
    67?                var modDesc = getObjectFromID("moduledescription");?
    68?                var modReq = getObjectFromID("modulerequirements");?
    69?                ?
    70?                if(moduleSel.value!=0){?
    71?                        installButton.disabled=false;?
    72?                        ?
    73?                        modName.innerHTML = modules[moduleSel.value]["name"];?
    74?                        modVer.innerHTML = modules[moduleSel.value]["version"];?
    75?                        modDesc.innerHTML = modules[moduleSel.value]["description"];?
    76?                        modReq.innerHTML = modules[moduleSel.value]["requirements"];?
    77?                        ?
    78?                        modinfo.style.display = "block";                                                ?
    79?                }?
    80?                else{?
    81?                        installButton.disabled=true;?
    82?                        modinfo.style.display = "none";                 ?
    83?                }?
    84?        }?
    85?        ?
    86?        function runModuleInstall(){?
    87?                var themodule=getObjectFromID("modules");?
    88?                var responseText= getObjectFromID("moduleresults");?
    89?                if(themodule.value=="")?
    90?                        alert("You must select a module to install first.");?
    91?                else {?
    92?                        var theURL="../modules/"+themodule.value+"/install/install.php";?
    93?                        loadXMLDoc(theURL,null,false);?
    94?                        if(req.responseXML)?
    95?                                response = req.responseXML.documentElement.firstChild.data+"\n";?
    96?                        else ?
    97?                                response = req.responseText;?
    98?                        responseText.value+=response;?
    99?                }?
    100?        }?
    ?205// ====== Init Listeners =======================================================?
    ?206?
    ?207connect(window,"onload",function() {?
    ?208?
    ?209        stepsNav.sections = getElementsByClassName("steps");?
    ?210        stepsNav.navTo(1);?
    ?211?
    ?212        var nextButtons = getElementsByClassName("nextButtons");?
    ?213        for(var i=0; i< nextButtons.length; i++)?
    ?214                connect(nextButtons[i], "onclick", stepsNav.navNext);?
    ?215?
    ?216        var prevButtons = getElementsByClassName("prevButtons");?
    ?217        for(var i=0; i< prevButtons.length; i++)?
    ?218                connect(prevButtons[i], "onclick", stepsNav.navPrev);?
    ?219?
    ?220        var navSelect = getObjectFromID("navSelect");?
    ?221        connect(navSelect, "onchange", stepsNav.navLeft);?
    ?222?
    ?223        var debug = getObjectFromID("debug");?
    ?224        connect(debug, "onchange", installer.toggleDebug);?
    ?225?
    ?226        var testConnectionButton = getObjectFromID("testConnectionButton");?
    ?227        connect(testConnectionButton, "onclick", installer.testConnection);?
    ?228?
    ?229        var createDatabaseButton = getObjectFromID("createDatabaseButton");?
    ?230        connect(createDatabaseButton, "onclick", installer.createDatabase)?
    ?231?
    ?232        var coreDataButton = getObjectFromID("coreDataButton");?
    ?233        connect(coreDataButton, "onclick", installer.coreDataInstall);?
    ?234?
    ?235        moduleButtons = getElementsByClassName("moduleButtons");?
    ?236        for(i = 0; i < moduleButtons.length; i++)?
    ?237                connect(moduleButtons[i], "onclick", installer.moduleInstall);?
    ?238?
    ?239})?
  • trunk/phpbms/install/install_include.php

    r448 r485 ?
    11<?php?
    2?function processSQLfile($db,$filename){?
    3?        global $dblink;?
    4??
    5?        $thefile = @ fopen($filename,"r");?
    6?        if(!$thefile)?
    7?                return "Could not open the file ".$filename.".\n";?
    8??
    9?        $thereturn="Processing SQL from file '".$filename."'\n";?
    10?                while(!feof($thefile)) {?
    11?                        $sqlstatement=trim(fgets($thefile,2048));?
    12?                        if(strrpos($sqlstatement,";")==strlen($sqlstatement)-1){?
    13?                                $theresult=$db->query($sqlstatement);?
    14?                                if($db->error)?
    15?                                        $thereturn = "Error processing SQL file  ".$filename.": ".$db->error."\n".$sqlstatement;?
    16?                                $sqlstatement="";?
    17?                        }//end if;?
    18?                }//end while?
    19??
    20?        $thereturn.="Done processing SQL from file '".$filename."'. \n\n";?
    21?        return $thereturn;?
    22?}//end function?
    23??
    24??
    25?function verifyAdminLogin($db,$user,$pass){?
    26??
    27?        if((real) getCurrentVersion($db,"base")>=.7)?
    28?                $querystatement="SELECT id FROM users WHERE login=\"".mysql_real_escape_string($user)."\" AND password=encode(\"".mysql_real_escape_string($pass)."\",\"".ENCRYPTION_SEED."\") AND admin=1";?
    29?        else?
    30?                $querystatement="SELECT id FROM users WHERE login=\"".mysql_real_escape_string($user)."\" AND password=encode(\"".mysql_real_escape_string($pass)."\",\"".ENCRYPTION_SEED."\") AND accesslevel>=90";?
    31??
    32?        $queryresult=$db->query($querystatement);?
    33??
    34?        if(!$queryresult)?
    35?                return false;?
    36?        return ($db->numRows($queryresult)>0);?
    37?}?
    38??
    39??
    40?function getCurrentVersion($db,$module){?
    41??
    42?        $querystatement="SELECT version FROM modules WHERE name=\"".mysql_real_escape_string($module)."\";";?
    43?        $queryresult=$db->query($querystatement);?
    44??
    45?        $ver=$db->fetchArray($queryresult);?
    46?        return $ver["version"];?
    47?}?
    48??
    49??
    50?function loadModules($type){?
    51?        $currdirectory = @getcwd();?
    52??
    53?        $thedir= @ opendir("../modules/");?
    54??
    55?        echo 'modules = Array();'."\n";?
    56??
    57?        $modules = array();?
    58?        while($entry=readdir($thedir)){?
    59?                if($entry != "." && $entry != ".." && $entry != "base" && $entry != "sample" && is_dir("../modules/".$entry)){?
    60?                        if(file_exists("../modules/".$entry."/install/".$type.".php") && file_exists("../modules/".$entry."/install/version.php")){?
    61?                                include("../modules/".$entry."/install/version.php");?
    62?                        }?
    63?                }?
    64?        }?
    65??
    66?        foreach($modules as $name=>$module)?
    67?                if(is_array($module)){?
    68?                        echo 'modules["'.$name.'"] = Array()'."\n";?
    69?                        foreach($module as $key=>$value)?
    70?                                echo 'modules["'.$name.'"]["'.$key.'"] = "'.$value.'";'."\n";?
    71?                }?
    72??
    73?        @ chdir ($currdirectory);?
    74??
    75?        return $modules;?
    76?}//end function?
    77??
    78??
    79?function showModules($modules){?
    80?        if(is_array($modules)){?
    81?                foreach($modules as $name => $module)?
    82?                        if($name != "base")?
    83?                                if(is_array($module)){?
    84?                                        ?><option value="<?php echo $name ?>"><?php echo $module["name"]?></option><?php?
    85?                                }?
    86?        }?
    87?}?
    88??
    89??
    90?function createTables($db,$sqlfile){?
    91??
    92?        $sqlstatement="";?
    93?        $thereturn = "";?
    94??
    95?        $createfile = @ fopen("createtables.sql","r");?
    96?        if(!$createfile)?
    97?                return "Could not open SQL file: ".$sqlfile;?
    98?        else{?
    99?                while(!feof($createfile)) {?
    100?                        $sqlstatement.= @ fgets($createfile,1024);?
    101?                        if(strpos($sqlstatement,";")){?
    102??
    103?                                $theresult = $db->query(trim($sqlstatement));?
    104??
    105?                                if($db->error){?
    106?                                        return "Error creating tables: ".$db->error."\n\n".trim($sqlstatement);?
    107?                                }?
    108?                                $sqlstatement="";?
    109?                        }//end if;?
    110?                }//end while?
    111??
    112?        }//end if?
    113??
    114?        return true;?
    115?}?
    116??
    117??
    118?function importData($db,$tablename){?
    119??
    120?        $tablefile = @ fopen($tablename.".sql","rb");?
    121?        if(!$tablefile)?
    122?                return "Could not open the file ".$tablename.".sql\n";?
    123??
    124?        $thereturn="";?
    125?        $counter=0;?
    126?        $failure = false;?
    127??
    128?        while(!feof($tablefile)) {?
    129?                $sqlstatement=trim(fgets($tablefile,8184));?
    130?                if(strrpos($sqlstatement,";")==strlen($sqlstatement)-1){?
    131??
    132?                        $theresult=$db->query($sqlstatement);?
    133??
    134?                        if($db->error){?
    135?                                $failure = true;?
    136?                                $thereturn .= "Error importing record into ".$tablename.": ".$db->error."\n";?
    137?                        }?
    ?2        class installer{?
    ?3?
    ?4                var $db;?
    ?5?
    ?6                function installer($db){?
    ?7?
    ?8                        $this->db = $db;?
    ?9?
    ?10                }//end function init?
    ?11?
    ?12?
    ?13                function createTables($sqlfile){?
    ?14?
    ?15                        $sqlstatement="";?
    ?16                        $thereturn = "";?
    ?17                        $line = 1;?
    ?18?
    ?19                        $filePointer = @ fopen($sqlfile,"r");?
    ?20?
    ?21                        if(!$filePointer)?
    ?22                                return "Could not open SQL file: ".$sqlfile;?
    ?23?
    ?24                        while(!feof($filePointer)) {?
    ?25?
    ?26                                $createstatement .= @ fgets($filePointer,1024);?
    ?27?
    ?28                                if(strpos($createstatement,";")){?
    ?29?
    ?30                                        $this->db->query(trim($createstatement));?
    ?31?
    ?32                                        if($this->db->error)?
    ?33                                                return "Error creating tables on line ".$line.": ".$this->db->error." SQL Statement: ".trim($createstatement);?
    ?34?
    ?35                                        $createstatement = "";?
    ?36?
    ?37                                }//end if;?
    ?38?
    ?39                                $line++;?
    ?40?
    ?41                        }//end while?
    ?42?
    ?43                        return true;?
    ?44?
    ?45                }//end function createTables?
    ?46?
    ?47?
    ?48                function processSQLfile($filename){?
    ?49?
    ?50                        $thefile = @ fopen($filename,"r");?
    ?51                        $line = 1;?
    ?52                        $thereturn = "";?
    ?53?
    ?54                        if(!$thefile)?
    ?55                                return "Could not open the SQL file ".$filename;?
    ?56?
    ?57                        while(!feof($thefile)) {?
    ?58?
    ?59                                $sqlstatement .= @ trim(fgets($thefile));?
    ?60?
    ?61                                // we look for the ; at the end of the line?
    ?62                                // If it is not there, we keep adding to the sql statement?
    ?63                                if(strrpos($sqlstatement,";") == strlen($sqlstatement)-1){?
    ?64?
    ?65                                        $this->db->query(trim($sqlstatement));?
    ?66                                        if($this->db->error)?
    ?67                                                $thereturn .= "Error processing SQL file '".$filename."' on line ".$line.": ".$this->db->error." - SQL Statement: ".$sqlstatement."\n";?
    ?68?
    ?69                                        $sqlstatement = "";?
    ?70?
    ?71                                }//end if;?
    ?72?
    ?73                                $line++;?
    ?74?
    ?75                        }//end while?
    ?76?
    ?77                        if($thereturn)?
    ?78                                return $thereturn;?
    13879                        else?
    139?                                $counter++;?
    140??
    141?                        $sqlstatement="";?
    142?                }//end if;?
    143?        }//end while?
    144??
    145?        if($failure)?
    146?                $threturn = "Importing of some records in ".$tablename." occured.\n\n";?
    147?        else?
    148?                $thereturn.="Import of ".$counter." record(s) for '".$tablename."' complete.\n";?
    149??
    150?        return $thereturn;?
    151?}//end function?
    ?80                                return true;?
    ?81?
    ?82                }//end function?
    ?83?
    ?84        }//end class?
    ?85?
    ?86?
    ?87?
    ?88        class modules{?
    ?89?
    ?90                var $list = array();?
    ?91?
    ?92                // this loads the modules in to an array?
    ?93                // type looks for either update, to make sure the?
    ?94                // module folder has an install folder, and inside the install?
    ?95                // folder is an install.php or update .php (depending on type)?
    ?96                // and that it has a version.php file;?
    ?97                function modules($type = "install"){?
    ?98?
    ?99                        $currdirectory = @getcwd();?
    ?100?
    ?101                        $thedir= @ opendir("../modules/");?
    ?102?
    ?103                        $modules = array();?
    ?104?
    ?105                        //this helps build the modules array?
    ?106                        // each included modules version.php should add to the?
    ?107                        // array?
    ?108                        while($entry = readdir($thedir)){?
    ?109?
    ?110                                if($entry != "." && $entry != ".." && $entry != "base" && $entry != "sample" && is_dir("../modules/".$entry)){?
    ?111?
    ?112                                        if(file_exists("../modules/".$entry."/install/".$type.".php") && file_exists("../modules/".$entry."/version.php")){?
    ?113?
    ?114                                                include("../modules/".$entry."/version.php");?
    ?115?
    ?116                                        }//endif?
    ?117?
    ?118                                }//endif?
    ?119?
    ?120                        }//end if?
    ?121?
    ?122                        @ chdir ($currdirectory);?
    ?123?
    ?124                        $this->list = $modules;?
    ?125?
    ?126                }//end function init?
    ?127?
    ?128?
    ?129                function displpayJS(){?
    ?130?
    ?131                        echo 'modules = Array();'."\n";?
    ?132?
    ?133                        foreach($this->list as $name=>$module)?
    ?134                                if(is_array($module) && $name != "base"){?
    ?135?
    ?136                                        echo 'modules["'.$name.'"] = Array()'."\n";?
    ?137                                        foreach($module as $key=>$value)?
    ?138                                                echo 'modules["'.$name.'"]["'.$key.'"] = "'.$value.'";'."\n";?
    ?139                                }//endif?
    ?140?
    ?141?
    ?142                }//end function displayJS?
    ?143?
    ?144?
    ?145                function displayInstallTable(){?
    ?146?
    ?147                        ?>?
    ?148                        <table id="moduleTable" cellpadding="0" cellspacing="0" border="0">?
    ?149                                <thead>?
    ?150                                        <tr>?
    ?151                                                <th>module</th>?
    ?152                                                <th>version</th>?
    ?153                                                <th>&nbsp;</th>?
    ?154                                        </tr>?
    ?155                                </thead>?
    ?156                                <tbody>?
    ?157                        <?php?
    ?158?
    ?159                        ksort($this->list);?
    ?160?
    ?161                        foreach($this->list as $key=>$module){?
    ?162?
    ?163                                if($key != "base"){?
    ?164?
    ?165                                        ?>?
    ?166                                        <tr>?
    ?167                                                <td>?
    ?168                                                        <h3><strong><?php echo $module["name"]?></strong></h3>?
    ?169                                                        <p><?php echo $module["description"]?></p>?
    ?170                                                        <p class="notes"><strong>Requirements:</strong> <?php echo $module["requirements"]?></p>?
    ?171                                                </td>?
    ?172                                                <td><?php echo $module["version"] ?></td>?
    ?173                                                <td class="moduleInstall">?
    ?174                                                        <button class="Buttons moduleButtons" id="moduleButton<?php echo $key ?>">Install Module</button>?
    ?175                                                        <p><span class="" id="Results<?php echo $key?>"></span></p>?
    ?176                                                </td>?
    ?177                                        </tr>?
    ?178                                        <?php?
    ?179?
    ?180                                }//end if?
    ?181?
    ?182                        }//end foreach?
    ?183?
    ?184                        ?></tbody></table><?php?
    ?185?
    ?186                }//end function displayInstallTable?
    ?187?
    ?188        }//end class?
    ?189?
    ?190?
    ?191?
    ?192        class installUpdateBase{?
    ?193?
    ?194                var $db;?
    ?195                var $phpbmsSession;?
    ?196?
    ?197                function returnJSON($success, $details, $extras = null){?
    ?198?
    ?199                        $thereturn["success"] = $success;?
    ?200                        $thereturn["details"] = $details;?
    ?201?
    ?202                        if($extras)?
    ?203                                $thereturn["extras"] = $extras;?
    ?204?
    ?205                        return json_encode($thereturn);?
    ?206?
    ?207                }//endfunction returnJSON?
    ?208?
    ?209        }//end class installUpdateBase?
    ?210?
    152211?
    153212?>?
  • trunk/phpbms/install/menu.sql

    r386 r485 ?
    1?INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('1', 'Organizer', '', '0', '3', '1', '1', NOW(), NOW(), '0');?
    ?1INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('1', 'Tools', '', '0', '3', '1', '1', NOW(), NOW(), '0');?
    22INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('2', 'Notes', 'search.php?id=12', '1', '1', '1', '1', NOW(), NOW(), '0');?
    33INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES ('3', 'Tasks', 'search.php?id=23', '1', '2', '1', '1', NOW(), NOW(), '0');?
  • trunk/phpbms/install/notes.sql

    r308 r485 ?
    11INSERT INTO `notes` (`assignedtoid`, `attachedid`, `attachedtabledefid`, `content`, `assignedtodate`, `subject`, `type`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `importance`, `parentid`, `startdate`, `enddate`, `completed`, `private`, `status`, `completeddate`, `location`, `category`, `assignedtotime`, `starttime`, `endtime`, `assignedbyid`, `repeating`, `repeattype`, `repeatuntil`, `repeatevery`, `repeattimes`, `repeateachlist`, `repeatontheday`, `repeatontheweek`, `firstrepeat`, `lastrepeat`, `timesrepeated`, `repeatname`) VALUES (NULL,NULL,NULL,'For more help using this software use the following links:\r\n\r\nhttp://www.phpbms.org - community site and wiki.\r\n\r\nhttp://www.phpbms.org/forum -user support forum.\r\n\r\nhttp://www.kreotek.com - paid support and customization.',NULL,'Welcome to phpBMS','SM',1,NOW(),1,NOW(),0,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'Daily',NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL);?
    ?2INSERT INTO `notes` (`assignedtoid`, `attachedid`, `attachedtabledefid`, `content`, `assignedtodate`, `subject`, `type`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `importance`, `parentid`, `startdate`, `enddate`, `completed`, `private`, `status`, `completeddate`, `location`, `category`, `assignedtotime`, `starttime`, `endtime`, `assignedbyid`, `repeating`, `repeattype`, `repeatuntil`, `repeatevery`, `repeattimes`, `repeateachlist`, `repeatontheday`, `repeatontheweek`, `firstrepeat`, `lastrepeat`, `timesrepeated`, `repeatname`) VALUES (NULL, NULL, NULL, '1) From the menu, navigate to Tools->Notes.\r\n2) From the find drop down, choose \'System Messages\' and then click the search button.\r\n3) Select the record(s) you want to delete and then click the delete (-) button.', NULL, 'How To Delete System Messages', 'SM', 1, NOW(), 1, NOW(), '0', NULL, NULL, NULL, '0', '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '0', 'Daily', NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL);?
  • trunk/phpbms/install/scheduler.sql

    r427 r485 ?
    1?INSERT INTO `scheduler` (`name`, `job`, `crontab`, `lastrun`, `startdatetime`, `enddatetime`, `description`, `inactive`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('clean import files', '/scheduler_delete_tempimport.php', '30::*::*::*::*', NULL, NOW(), NULL, 'This will delete any temporary import files that are present (for whatever reason) after 30 minutes of their creation.', '0', 1, NOW(), 1, NOW());?
    ?1INSERT INTO `scheduler` (`name`, `job`, `crontab`, `lastrun`, `startdatetime`, `enddatetime`, `description`, `inactive`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('Clean Import Files', './scheduler_delete_tempimport.php', '30::*::*::*::*', NULL, NOW(), NULL, 'This will delete any temporary import files that are present (for whatever reason) after 30 minutes of their creation.', '0', 1, NOW(), 1, NOW());?
    ?2INSERT INTO `scheduler` (`id`, `name`, `job`, `crontab`, `lastrun`, `startdatetime`, `enddatetime`, `description`, `inactive`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('4', 'Remove Excess System Log Records', './scheduler_delete_logs.php', '*::24::*::*::*', NULL, '2009-03-31 12:00:00', NULL, 'This script will trim the system log when there are more than 2000 records present at the time of its calling (default will be every 24 hours).', '0', 1, NOW(), 1, NOW());?
  • trunk/phpbms/install/tablecolumns.sql

    r384 r485 ?
    1?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (9,'log in name','users.login','left','',1,'',0,'',NULL,0);?
    2?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (9,'name','concat(users.firstname,\" \",users.lastname)','left','',0,'',0,'100%',NULL,0);?
    3?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (9,'last login','users.lastlogin','left','',3,'',0,'','datetime',0);?
    4?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (9,'revoked','users.revoked','center','',2,'',0,'','boolean',0);?
    5?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (10,'name','relationships.name','left','',0,'',0,'100%',NULL,0);?
    6?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (10,'to','concat(totable.maintable, \'.\', relationships.tofield)','left','',2,'',0,'',NULL,0);?
    7?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (10,'from','concat(fromtable.maintable, \'.\', relationships.fromfield)','left','',1,'',0,'',NULL,0);?
    8?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (10,'inherent','relationships.inherint','center','',3,'',0,'','boolean',0);?
    9?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (11,'id','tabledefs.id','center','',0,'',0,'',NULL,0);?
    10?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (11,'main table','tabledefs.maintable','left','',3,'',0,'',NULL,0);?
    11?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (11,'display','tabledefs.displayname','left','',1,'',0,'100%',NULL,0);?
    12?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (11,'type','tabledefs.type','center','',2,'',0,'',NULL,0);?
    13?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (12,'done','notes.completed','center','',1,'',0,'','boolean',0);?
    14?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (12,'title','notes.subject','left','',0,'',1,'99%',NULL,0);?
    15?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (16,'id','reports.id','center','',0,'',0,'',NULL,0);?
    16?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (16,'name','reports.name','left','',1,'',0,'100%','noencoding',0);?
    17?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (16,'type','reports.type','left','',3,'',0,'',NULL,0);?
    18?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (16,'order','reports.displayorder','center','',2,'',0,'',NULL,0);?
    19?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (17,'id','usersearches.id','center','',0,'',0,'',NULL,0);?
    20?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (17,'name','usersearches.name','left','',1,'',0,'100%',NULL,0);?
    21?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (17,'user','if(usersearches.userid=0,\"<b>global</b>\",concat(users.lastname,\", \",users.firstname))','left','',2,NULL,0,'','noencoding',0);?
    22?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (19,'id','menu.id','center','',0,'',0,'',NULL,0);?
    23?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (19,'link','menu.link','left','',2,'',1,'',NULL,0);?
    24?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (19,'access','if(menu.roleid=0,\'EVERYONE\',if(menu.roleid=-100,\'Administrators\',roles.name))','left','',3,'',0,'',NULL,0);?
    25?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (19,'Item','menu.name','left','',1,'',0,'100%',NULL,0);?
    26?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (21,'id','modules.id','center','',0,'',0,'',NULL,0);?
    27?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (21,'name','modules.displayname','left','',1,'',1,'100%',NULL,0);?
    28?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (21,'version','modules.version','left','',2,'',0,'',NULL,0);?
    29?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (23,'complete','notes.completed','center','',1,'',0,'','boolean',0);?
    30?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (23,'title','notes.subject','left','',2,'',1,'65%',NULL,0);?
    31?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (23,'repeat','notes.repeatname','left','',3,'',1,'30%',NULL,0);?
    32?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (23,'due date','if(notes.endtime is not null,concat(notes.enddate,\" \",notes.endtime),notes.enddate)','left','',0,'',0,'','datetime',0);?
    33?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (24,'start','if(notes.starttime,concat(notes.startdate,\" \",notes.starttime),notes.startdate)','left','',0,'concat(notes.startdate,\" \",notes.starttime)',0,'','datetime',0);?
    34?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (24,'end','if(notes.endtime,concat(notes.enddate,\" \",notes.endtime),notes.enddate)','left','',1,'concat(notes.enddate,\" \",notes.endtime)',0,'','datetime',0);?
    35?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (24,'title','notes.subject','left','',2,'',1,'65%',NULL,0);?
    36?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (24,'status','notes.status','left','',3,'',0,'',NULL,0);?
    37?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (24,'repeating','notes.repeatname','left','',5,'',1,'30%',NULL,0);?
    38?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (24,'location','notes.location','left','',4,'',1,'',NULL,0);?
    39?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (26,'id','files.id','left','',0,'',0,'',NULL,0);?
    40?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (26,'description','files.description','left','',2,'',1,'99%',NULL,0);?
    41?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (26,'file','files.name','left','',1,'',0,'',NULL,0);?
    42?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (26,'download','files.id','center','',3,'',0,'','filelink',0);?
    43?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (27,'attached','attachments.creationdate','left','',2,'',0,'','datetime',0);?
    44?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (27,'file','concat(\"<b>\",files.name,\"</b>\")','left','',0,NULL,0,'','noencoding',0);?
    45?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (27,'download','files.id','center','',3,'',0,'','filelink',0);?
    46?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (27,'description','files.description','left','',1,'',1,'100%',NULL,0);?
    47?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (200,'name','roles.name','left','',1,'',0,'99%',NULL,0);?
    48?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (200,'inactive','roles.inactive','center','',2,'',0,'','boolean',0);?
    49?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (200,'id','roles.id','left','',0,'',0,'',NULL,0);?
    50?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (201,'name','scheduler.name','left','',0,'',0,'95%',NULL,0);?
    51?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (201,'cron interval','scheduler.crontab','left','',1,'',0,'',NULL,0);?
    52?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (201,'inactive','scheduler.inactive','center','',2,'',0,'','boolean',0);?
    53?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (202,'time','log.stamp','left','',1,'',0,'','datetime',0);?
    54?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (202,'id','log.id','left','',0,'',0,'',NULL,0);?
    55?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (202,'type','log.type','left','',2,'',0,'',NULL,0);?
    56?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (202,'value','log.value','left','',3,'',1,'90%',NULL,0);?
    57?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (202,'user','concat(users.firstname,\" \",users.lastname)','left','',4,'',0,'',NULL,0);?
    58?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (202,'ip address','log.ip','left','',5,'',0,'',NULL,0);?
    59?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (203,'name','tabs.name','left','',1,'',0,'',NULL,0);?
    60?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (203,'location','tabs.location','left','',2,'',1,'95%',NULL,0);?
    61?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (203,'display order','tabs.displayorder','center','',3,'',0,'',NULL,0);?
    62?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (203,'id','tabs.id','left','',0,'',0,'',NULL,0);?
    63?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (203,'access','if(tabs.roleid=0,\'EVERYONE\',if(tabs.roleid=-100,\'Administrators\',roles.name))','left','',4,'',0,'',NULL,0);?
    ?1INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('9', 'log in name', 'users.login', 'left', '', '1', '', '0', '', NULL, '0');?
    ?2INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('9', 'name', 'concat(users.firstname,\" \",users.lastname)', 'left', '', '0', '', '0', '100%', NULL, '0');?
    ?3INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('9', 'last login', 'users.lastlogin', 'left', '', '3', '', '0', '', 'datetime', '0');?
    ?4INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('9', 'revoked', 'users.revoked', 'center', '', '2', '', '0', '', 'boolean', '0');?
    ?5INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('10', 'name', 'relationships.name', 'left', '', '0', '', '0', '100%', NULL, '0');?
    ?6INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('10', 'to', 'concat(totable.maintable, \'.\', relationships.tofield)', 'left', '', '2', '', '0', '', NULL, '0');?
    ?7INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('10', 'from', 'concat(fromtable.maintable, \'.\', relationships.fromfield)', 'left', '', '1', '', '0', '', NULL, '0');?
    ?8INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('10', 'inherent', 'relationships.inherint', 'center', '', '3', '', '0', '', 'boolean', '0');?
    ?9INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('11', 'id', 'tabledefs.id', 'center', '', '0', '', '0', '', NULL, '0');?
    ?10INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('11', 'main table', 'tabledefs.maintable', 'left', '', '3', '', '0', '', NULL, '0');?
    ?11INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('11', 'display', 'tabledefs.displayname', 'left', '', '1', '', '0', '100%', NULL, '0');?
    ?12INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('11', 'type', 'tabledefs.type', 'center', '', '2', '', '0', '', NULL, '0');?
    ?13INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('12', 'done', 'notes.completed', 'center', '', '1', '', '0', '', 'boolean', '0');?
    ?14INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('12', 'title', 'notes.subject', 'left', '', '0', '', '1', '99%', NULL, '0');?
    ?15INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('16', 'id', 'reports.id', 'center', '', '0', '', '0', '', NULL, '0');?
    ?16INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('16', 'name', 'reports.name', 'left', '', '1', '', '0', '100%', 'noencoding', '0');?
    ?17INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('16', 'type', 'reports.type', 'left', '', '3', '', '0', '', NULL, '0');?
    ?18INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('16', 'order', 'reports.displayorder', 'center', '', '2', '', '0', '', NULL, '0');?
    ?19INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('17', 'id', 'usersearches.id', 'center', '', '0', '', '0', '', NULL, '0');?
    ?20INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('17', 'name', 'usersearches.name', 'left', '', '1', '', '0', '100%', NULL, '0');?
    ?21INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('17', 'user', 'if(usersearches.userid=0,\"<b>global</b>\",concat(users.lastname,\", \",users.firstname))', 'left', '', '2', NULL, '0', '', 'noencoding', '0');?
    ?22INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('19', 'id', 'menu.id', 'center', '', '0', '', '0', '', NULL, '0');?
    ?23INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('19', 'link', 'menu.link', 'left', '', '2', '', '1', '', NULL, '0');?
    ?24INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('19', 'access', 'if(menu.roleid=0,\'EVERYONE\',if(menu.roleid=-100,\'Administrators\',roles.name))', 'left', '', '3', '', '0', '', NULL, '0');?
    ?25INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('19', 'Item', 'menu.name', 'left', '', '1', '', '0', '100%', NULL, '0');?
    ?26INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('21', 'id', 'modules.id', 'center', '', '0', '', '0', '', NULL, '0');?
    ?27INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('21', 'name', 'modules.displayname', 'left', '', '1', '', '1', '100%', NULL, '0');?
    ?28INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('21', 'version', 'modules.version', 'left', '', '2', '', '0', '', NULL, '0');?
    ?29INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('23', 'complete', 'notes.completed', 'center', '', '1', '', '0', '', 'boolean', '0');?
    ?30INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('23', 'title', 'notes.subject', 'left', '', '2', '', '1', '65%', NULL, '0');?
    ?31INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('23', 'repeat', 'notes.repeatname', 'left', '', '3', '', '1', '30%', NULL, '0');?
    ?32INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('23', 'due date', 'if(notes.endtime is not null,concat(notes.enddate,\" \",notes.endtime),notes.enddate)', 'left', '', '0', '', '0', '', 'datetime', '0');?
    ?33INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('24', 'start', 'if(notes.starttime,concat(notes.startdate,\" \",notes.starttime),notes.startdate)', 'left', '', '0', 'concat(notes.startdate,\" \",notes.starttime)', '0', '', 'datetime', '0');?
    ?34INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('24', 'end', 'if(notes.endtime,concat(notes.enddate,\" \",notes.endtime),notes.enddate)', 'left', '', '1', 'concat(notes.enddate,\" \",notes.endtime)', '0', '', 'datetime', '0');?
    ?35INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('24', 'title', 'notes.subject', 'left', '', '2', '', '1', '65%', NULL, '0');?
    ?36INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('24', 'status', 'notes.status', 'left', '', '3', '', '0', '', NULL, '0');?
    ?37INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('24', 'repeating', 'notes.repeatname', 'left', '', '5', '', '1', '30%', NULL, '0');?
    ?38INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('24', 'location', 'notes.location', 'left', '', '4', '', '1', '', NULL, '0');?
    ?39INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('26', 'id', 'files.id', 'left', '', '0', '', '0', '', NULL, '0');?
    ?40INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('26', 'description', 'files.description', 'left', '', '2', '', '1', '99%', NULL, '0');?
    ?41INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('26', 'file', 'files.name', 'left', '', '1', '', '0', '', NULL, '0');?
    ?42INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('26', 'download', 'files.id', 'center', '', '3', '', '0', '', 'filelink', '0');?
    ?43INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('27', 'attached', 'attachments.creationdate', 'left', '', '2', '', '0', '', 'datetime', '0');?
    ?44INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('27', 'file', 'concat(\"<b>\",files.name,\"</b>\")', 'left', '', '0', NULL, '0', '', 'noencoding', '0');?
    ?45INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('27', 'download', 'files.id', 'center', '', '3', '', '0', '', 'filelink', '0');?
    ?46INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('27', 'description', 'files.description', 'left', '', '1', '', '1', '100%', NULL, '0');?
    ?47INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('200', 'name', 'roles.name', 'left', '', '1', '', '0', '99%', NULL, '0');?
    ?48INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('200', 'inactive', 'roles.inactive', 'center', '', '2', '', '0', '', 'boolean', '0');?
    ?49INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('200', 'id', 'roles.id', 'left', '', '0', '', '0', '', NULL, '0');?
    ?50INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('201', 'name', 'scheduler.name', 'left', '', '0', '', '0', '95%', NULL, '0');?
    ?51INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('201', 'cron interval', 'scheduler.crontab', 'left', '', '1', '', '0', '', NULL, '0');?
    ?52INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('201', 'inactive', 'scheduler.inactive', 'center', '', '2', '', '0', '', 'boolean', '0');?
    ?53INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('202', 'time', 'log.stamp', 'left', '', '1', '', '0', '', 'datetime', '0');?
    ?54INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('202', 'id', 'log.id', 'left', '', '0', '', '0', '', NULL, '0');?
    ?55INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('202', 'type', 'log.type', 'left', '', '2', '', '0', '', NULL, '0');?
    ?56INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('202', 'value', 'log.value', 'left', '', '3', '', '1', '90%', NULL, '0');?
    ?57INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('202', 'user', 'concat(users.firstname,\" \",users.lastname)', 'left', '', '4', '', '0', '', NULL, '0');?
    ?58INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('202', 'ip address', 'log.ip', 'left', '', '5', '', '0', '', NULL, '0');?
    ?59INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('203', 'name', 'tabs.name', 'left', '', '1', '', '0', '', NULL, '0');?
    ?60INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('203', 'location', 'tabs.location', 'left', '', '2', '', '1', '95%', NULL, '0');?
    ?61INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('203', 'display order', 'tabs.displayorder', 'center', '', '3', '', '0', '', NULL, '0');?
    ?62INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('203', 'id', 'tabs.id', 'left', '', '0', '', '0', '', NULL, '0');?
    ?63INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('203', 'access', 'if(tabs.roleid=0,\'EVERYONE\',if(tabs.roleid=-100,\'Administrators\',roles.name))', 'left', '', '4', '', '0', '', NULL, '0');?
    6464INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('204', 'name', 'smartsearches.name', 'left', '', '0', '', '1', '99%', NULL, '0');?
    6565INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('204', 'table', 'tabledefs.displayname', 'left', '', '1', '', '0', '', NULL, '0');?
  • trunk/phpbms/install/tabledefs.sql

    r427 r485 ?
    1?INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('9', 'Users', 'system', '1', 'users', 'users', 'modules/base/users_addedit.php', '0', 'modules/base/users_addedit.php', '0', 'modules/base/users_import.php', '-100', '0', '-100', '-100', 'revoke', 'users.id !=0', 'users.id', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    2?INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('10', 'Relationships', 'system', '1', 'relationships', '(relationships inner join tabledefs as fromtable on relationships.fromtableid=fromtable.id) inner join tabledefs as totable on relationships.totableid=totable.id', 'modules/base/relationships_addedit.php', '0', 'modules/base/relationships_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'delete', 'relationships.id != 0', 'fromtable.displayname, name', '', '', '', 1, NOW(), 1, NOW());?
    3?INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('11', 'Table Definitions', 'system', '1', 'tabledefs', 'tabledefs left join modules on tabledefs.moduleid=modules.id', 'modules/base/tabledefs_addedit.php', '-100', 'modules/base/tabledefs_addedit.php', '-100', NULL, '-100', '-100', '-100', '-100', 'delete', 'tabledefs.id != 0', 'modules.name, tabledefs.displayname', '', '', '', 1, NOW(), 1, NOW());?
    ?1INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('9', 'Users', 'system', '1', 'users', 'users', 'modules/base/users_addedit.php', '0', 'modules/base/users_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'revoke', 'users.id !=0', 'users.id', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    ?2INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('10', 'Relationships', 'system', '1', 'relationships', '(relationships inner join tabledefs as fromtable on relationships.fromtableid=fromtable.id) inner join tabledefs as totable on relationships.totableid=totable.id', 'modules/base/relationships_addedit.php', '0', 'modules/base/relationships_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'delete', 'relationships.id != 0', 'fromtable.displayname, name', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    ?3INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('11', 'Table Definitions', 'system', '1', 'tabledefs', 'tabledefs left join modules on tabledefs.moduleid=modules.id', 'modules/base/tabledefs_addedit.php', '-100', 'modules/base/tabledefs_addedit.php', '-100', NULL, '-100', '-100', '-100', '-100', 'delete', 'tabledefs.id != 0', 'modules.name, tabledefs.displayname', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    44INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('12', 'Notes', 'table', '1', 'notes', 'notes', 'modules/base/notes_addedit.php', '0', 'modules/base/notes_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'delete', 'notes.type=\'NT\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND completed=0', 'notes.category,notes.type,notes.importance DESC,notes.creationdate', 'search', 'My Unread Notes', 'new', 1, NOW(), 1, NOW());?
    5?INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('16', 'Reports', 'system', '1', 'reports', 'reports left join tabledefs on reports.tabledefid=tabledefs.id', 'modules/base/reports_addedit.php', '0', 'modules/base/reports_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'delete', 'reports.id != 0', 'tabledefid,displayorder DESC, reports.name', '', '', '', 1, NOW(), 1, NOW());?
    6?INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('17', 'Saved Searches/Sorts', 'system', '1', 'usersearches', '(usersearches left join users on usersearches.userid = users.id) inner join tabledefs on usersearches.tabledefid=tabledefs.id', 'modules/base/usersearches_edit.php', '0', 'N/A', '0', NULL, '-100', '0', '-100', '-100', 'delete', 'usersearches.id != 0', 'usersearches.name', '', '', '', 1, NOW(), 1, NOW());?
    7?INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('19', 'Menu', 'system', '1', 'menu', '((menu LEFT JOIN menu as parentmenu on menu.parentid=parentmenu.id) LEFT JOIN roles on menu.roleid=roles.id)', 'modules/base/menu_addedit.php', '-100', 'modules/base/menu_addedit.php', '-100', NULL, '-100', '-100', '-100', '-100', 'delete', 'menu.id!=0', 'if(parentmenu.name is null,menu.displayorder,parentmenu.displayorder+(menu.displayorder+1)/10000)', '', '', '', 1, NOW(), 1, NOW());?
    ?5INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('16', 'Reports', 'system', '1', 'reports', 'reports left join tabledefs on reports.tabledefid=tabledefs.id', 'modules/base/reports_addedit.php', '0', 'modules/base/reports_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'delete', 'reports.id != 0', 'tabledefid,displayorder DESC, reports.name', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    ?6INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('17', 'Saved Searches/Sorts', 'system', '1', 'usersearches', '(usersearches left join users on usersearches.userid = users.id) inner join tabledefs on usersearches.tabledefid=tabledefs.id', 'modules/base/usersearches_edit.php', '0', 'N/A', '0', NULL, '-100', '0', '-100', '-100', 'delete', 'usersearches.id != 0', 'usersearches.name', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    ?7INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('19', 'Menu', 'system', '1', 'menu', '((menu LEFT JOIN menu as parentmenu on menu.parentid=parentmenu.id) LEFT JOIN roles on menu.roleid=roles.id)', 'modules/base/menu_addedit.php', '-100', 'modules/base/menu_addedit.php', '-100', NULL, '-100', '-100', '-100', '-100', 'delete', 'menu.id!=0', 'if(parentmenu.name is null,menu.displayorder,parentmenu.displayorder+(menu.displayorder+1)/10000)', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    88INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('21', 'Installed Modules', 'system', '1', 'modules', 'modules', 'modules/base/modules_view.php', '0', 'modules/base/modules_view.php', '0', NULL, '-100', '0', '-100', '-100', 'NA', 'modules.id!=0', 'modules.name', '', '', '', 1, NOW(), 1, NOW());?
    99INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('23', 'Tasks', 'view', '1', 'notes', '((notes left join users as assignedto on assignedto.id= notes.assignedtoid)  left join users as assignedby on assignedby.id=notes.assignedbyid)', 'modules/base/notes_addedit.php?backurl=../../search.php?id=23', '0', 'modules/base/notes_addedit.php?ty=TS&backurl=../../search.php?id=23', '0', NULL, '-100', '0', '-100', '-100', 'delete', 'notes.type=\'TS\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND completed=0', 'notes.category,notes.enddate,notes.endtime,notes.startdate,notes.starttime,notes.importance DESC,notes.subject', 'search', 'My Uncompleted Tasks', '', 1, NOW(), 1, NOW());?
    1010INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('24', 'Events', 'view', '1', 'notes', '((notes left join users as assignedto on assignedto.id= notes.assignedtoid)  left join users as assignedby on assignedby.id=notes.assignedbyid)', 'modules/base/notes_addedit.php?backurl=../../search.php?id=24', '0', 'modules/base/notes_addedit.php?ty=EV&backurl=../../search.php?id=24', '0', NULL, '-100', '0', '-100', '-100', 'delete', 'notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = year(notes.startdate)=year(curdate()) and week(notes.startdate)=week(curdate())))', 'notes.startdate DESC,notes.starttime DESC,notes.enddate DESC,notes.endtime DESC,notes.importance', 'search', NULL, NULL, 1, NOW(), 1, NOW());?
    11?INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('26', 'Files', 'table', '1', 'files', 'files', 'modules/base/files_addedit.php', '0', 'modules/base/files_addedit.php', '0', NULL, '-100', '-100', '-100', '-100', 'delete', 'files.id=-1', 'files.name', 'search', '', '', 1, NOW(), 1, NOW());?
    ?11INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('26', 'Files', 'table', '1', 'files', 'files', 'modules/base/files_addedit.php', '0', 'modules/base/files_addedit.php', '0', NULL, '-100', '-100', '-100', '-100', 'delete', 'files.id=-1', 'files.name', 'search', NULL, NULL, 1, NOW(), 1, NOW());?
    1212INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('27', 'Attachments', 'table', '1', 'attachments', '(attachments INNER JOIN files on attachments.fileid=files.id)', 'modules/base/files_addedit.php', '0', 'modules/base/files_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'delete', 'attachments.id!=0', 'attachments.creationdate DESC', 'search', '', '', 1, NOW(), 1, NOW());?
    13?INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('200', 'Roles', 'table', '1', 'roles', 'roles', 'modules/base/roles_addedit.php', '-100', 'modules/base/roles_addedit.php', '-100', NULL, '-100', '-100', '-100', '-100', 'inactivate', 'roles.id!=-1', 'name', 'search', '', '', 1, NOW(), 1, NOW());?
    14?INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('201', 'Scheduler', 'system', '1', 'scheduler', 'scheduler', 'modules/base/scheduler_addedit.php', '-100', 'modules/base/scheduler_addedit.php', '-100', NULL, '-100', '-100', '-100', '-100', 'delete', 'scheduler.id!=0', 'scheduler.name', '', '', '', 1, NOW(), 1, NOW());?
    ?13INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('200', 'Roles', 'table', '1', 'roles', 'roles', 'modules/base/roles_addedit.php', '-100', 'modules/base/roles_addedit.php', '-100', NULL, '-100', '-100', '-100', '-100', 'inactivate', 'roles.id!=-1', 'name', 'search', NULL, NULL, 1, NOW(), 1, NOW());?
    ?14INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('201', 'Scheduler', 'system', '1', 'scheduler', 'scheduler', 'modules/base/scheduler_addedit.php', '-100', 'modules/base/scheduler_addedit.php', '-100', NULL, '-100', '-100', '-100', '-100', 'delete', 'scheduler.id!=0', 'scheduler.name', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    1515INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `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', NULL, '-100', '-100', '-100', '-100', 'delete', 'log.stamp> DATE_SUB(CURDATE(),INTERVAL 1 DAY)', 'log.stamp', '', '', '', 1, NOW(), 1, NOW());?
    1616INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('203', 'Tabs', 'system', '1', 'tabs', 'tabs LEFT JOIN roles ON tabs.roleid=roles.id', 'modules/base/tabs_addedit.php', '-100', 'modules/base/tabs_addedit.php', '-100', NULL, '-100', '-100', '-100', '-100', 'delete', 'tabs.id!=0', 'tabs.tabgroup,tabs.displayorder', '', '', '', 1, NOW(), 1, NOW());?
  • trunk/phpbms/install/tablefindoptions.sql

    r384 r485 ?
    1?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (3,9,'All Users','users.id!=0',1,0);?
    2?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (4,9,'Revoked Users','users.revoked=1',1,0);?
    3?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (13,10,'All Records','relationships.id !=0',1,0);?
    4?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (5,11,'All Records','tabledefs.id !=0',1,0);?
    5?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (70,12,'Unread Notes Assigned By Me','notes.type=\'NT\' and notes.assignedbyid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0',3,0);?
    6?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (69,12,'Unread Notes Assigned To Me','notes.type=\'NT\' and notes.assignedtoid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0',2,0);?
    7?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (20,12,'My Notes','notes.type=\'NT\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}',1,0);?
    8?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (21,12,'All Viewable Notes and System Notes','notes.type=\'SM\' OR ( notes.type=\'NT\' AND !(notes.private=1 AND notes.createdby!={{$_SESSION[\'userinfo\'][\'id\']}}))',7,0);?
    9?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (14,16,'All Reports','reports.id != 0',1,0);?
    10?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (15,17,'All Records','usersearches.id != 0',1,0);?
    11?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (42,19,'All Records','menu.id!=0',1,0);?
    12?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (43,21,'All Records','modules.id!=0',1,0);?
    13?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (71,12,'System Messages','notes.type=\"SM\"',4,0);?
    14?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (72,12,'Public Notes','notes.type=\'NT\' AND notes.private=0',6,0);?
    15?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (73,12,'My Unread Notes','notes.type=\'NT\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND completed=0',0,0);?
    16?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (74,12,'Public Unread Notes','notes.type=\'NT\' AND notes.private=0 AND notes.completed=0',5,0);?
    17?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (76,23,'My Uncompleted Tasks','notes.type=\'TS\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND completed=0',0,0);?
    18?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (77,23,'My Tasks','notes.type=\'TS\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}',1,0);?
    19?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (78,23,'Uncomplete Tasks Assigned To Me','notes.type=\'TS\' and notes.assignedtoid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0',2,0);?
    20?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (79,23,'Uncomplete Tasks Assigned By Me','notes.type=\'NT\' and notes.assignedbyid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0',3,0);?
    21?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (80,23,'Public Uncomplete Tasks','notes.type=\'TS\' AND notes.private=0 AND notes.completed=0',4,0);?
    22?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (81,23,'Public Tasks','notes.type=\'NT\' AND notes.private=0',5,0);?
    23?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (82,23,'All Viewable Tasks','notes.type=\'TS\' AND !(notes.private=1 AND notes.createdby!={{$_SESSION[\'userinfo\'][\'id\']}})',6,0);?
    24?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (83,24,'My Events','notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}',0,0);?
    25?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (84,24,'Public Events','notes.type=\'EV\' AND notes.private=0',8,0);?
    26?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (85,24,'Undone Events Assigned To Me','notes.type=\'EV\' and notes.assignedtoid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0',17,0);?
    27?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (86,24,'Undone Events Assigned By Me','notes.type=\'NT\' and notes.assignedbyid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0',16,0);?
    28?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (87,24,'All Viewable Events','notes.type=\'EV\' AND !(notes.private=1 AND notes.createdby!={{$_SESSION[\'userinfo\'][\'id\']}})',18,0);?
    29?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (88,24,'My Events - Today','notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = curdate()) OR notes.`repeat`=1)',1,0);?
    30?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (89,24,'My Events - Yesterday','notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = date_sub(curdate(),INTERVAL 1 DAY)) OR notes.`repeat`=1)',2,0);?
    31?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (90,24,'My Events - This Week','notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = year(notes.startdate)=year(curdate()) and week(notes.startdate)=week(curdate())) OR notes.repeat=1)',4,0);?
    32?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (91,24,'My Events - This Month','notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = year(notes.startdate)=year(curdate()) and month(notes.startdate)=month(curdate())) OR notes.repeat=1)',6,0);?
    33?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (92,24,'My Events - Tomorrow','notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND (notes.startdate = date_add(curdate(),INTERVAL 1 DAY) OR notes.repeat=1)',3,0);?
    34?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (93,24,'My Events - Next Month','notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((year(notes.startdate)=year(date_add(curdate(),INTERVAL 1 MONTH)) and month(notes.startdate)=month(date_add(curdate(),INTERVAL 1 MONTH))) OR notes.repeat=1)',7,0);?
    35?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (94,24,'My Events - Next Week','notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = year(notes.startdate)=year(date_add(curdate(),INTERVAL 1 WEEK)) and week(notes.startdate)=week(date_add(curdate(),INTERVAL 1 WEEK))) OR notes.repeat=1)',5,0);?
    36?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (95,24,'Public Events - Today','notes.type=\'EV\' AND notes.private=0 AND ((notes.startdate = curdate()) OR notes.repeat=1)',9,0);?
    37?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (96,24,'Public Events - Yesterday','notes.type=\'EV\' AND notes.private=0 AND ((notes.startdate = date_sub(curdate(),INTERVAL 1 DAY)) OR notes.repeat=1)',10,0);?
    38?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (97,24,'Public Events - Tomorrow','notes.type=\'EV\' AND notes.private=0 AND (notes.startdate = date_add(curdate(),INTERVAL 1 DAY) OR notes.repeat=1)',11,0);?
    39?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (98,24,'Public Events - This Week','notes.type=\'EV\' AND notes.private=0 AND ((notes.startdate = year(notes.startdate)=year(curdate()) and week(notes.startdate)=week(curdate())) OR notes.repeat=1)',12,0);?
    40?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (99,24,'Public Events - Next Week','notes.type=\'EV\' AND notes.private=0 AND ((notes.startdate = year(notes.startdate)=year(date_add(curdate(),INTERVAL 1 WEEK)) and week(notes.startdate)=week(date_add(curdate(),INTERVAL 1 WEEK))) OR notes.repeat=1)',13,0);?
    41?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (100,24,'Public Events - This Month','notes.type=\'EV\' AND notes.private=0 AND ((notes.startdate = year(notes.startdate)=year(curdate()) and month(notes.startdate)=month(curdate())) OR notes.repeat=1)',14,0);?
    42?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (101,24,'Public Events - Next Month','notes.type=\'EV\' notes.private=0 AND ((year(notes.startdate)=year(date_add(curdate(),INTERVAL 1 MONTH)) and month(notes.startdate)=month(date_add(curdate(),INTERVAL 1 MONTH))) OR notes.repeat=1)',15,0);?
    43?INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (108,26,'All Records','files.id!=0',0,0);?
    44?INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (200,'Active Roles','roles.inactive=0',0,0);?
    45?INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (200,'Inactive Roles','roles.inactive=1',1,0);?
    46?INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (200,'All Records','roles.id!=-100',2,0);?
    47?INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (201,'all records','scheduler.id!=0',0,0);?
    48?INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (202,'entries within last day','log.stamp> DATE_SUB(CURDATE(),INTERVAL 1 DAY)',0,0);?
    49?INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (202,'entries within last week','log.stamp> DATE_SUB(CURDATE(),INTERVAL 1 WEEK)',1,0);?
    50?INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (202,'all entries','log.id!=-1',2,0);?
    51?INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (203,'All Records','tabs.id!=-1',0,-100);?
    ?1INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('9', 'All Users', 'users.id!=0', '1', '0');?
    ?2INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('9', 'Revoked Users', 'users.revoked=1', '1', '0');?
    ?3INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('10', 'All Records', 'relationships.id !=0', '1', '0');?
    ?4INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('11', 'All Records', 'tabledefs.id !=0', '1', '0');?
    ?5INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('12', 'My Notes', 'notes.type=\'NT\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}', '1', '0');?
    ?6INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('12', 'All Viewable Notes and System Notes', 'notes.type=\'SM\' OR ( notes.type=\'NT\' AND !(notes.private=1 AND notes.createdby!={{$_SESSION[\'userinfo\'][\'id\']}}))', '7', '0');?
    ?7INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('12', 'Unread Notes Assigned To Me', 'notes.type=\'NT\' and notes.assignedtoid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0', '2', '0');?
    ?8INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('12', 'Unread Notes Assigned By Me', 'notes.type=\'NT\' and notes.assignedbyid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0', '3', '0');?
    ?9INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('12', 'System Messages', 'notes.type=\"SM\"', '4', '0');?
    ?10INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('12', 'Public Notes', 'notes.type=\'NT\' AND notes.private=0', '6', '0');?
    ?11INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('12', 'My Unread Notes', 'notes.type=\'NT\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND completed=0', '0', '0');?
    ?12INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('12', 'Public Unread Notes', 'notes.type=\'NT\' AND notes.private=0 AND notes.completed=0', '5', '0');?
    ?13INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('16', 'All Reports', 'reports.id != 0', '1', '0');?
    ?14INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('17', 'All Records', 'usersearches.id != 0', '1', '0');?
    ?15INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('19', 'All Records', 'menu.id!=0', '1', '0');?
    ?16INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('21', 'All Records', 'modules.id!=0', '1', '0');?
    ?17INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('23', 'My Uncompleted Tasks', 'notes.type=\'TS\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND completed=0', '0', '0');?
    ?18INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('23', 'My Tasks', 'notes.type=\'TS\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}', '1', '0');?
    ?19INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('23', 'Uncomplete Tasks Assigned To Me', 'notes.type=\'TS\' and notes.assignedtoid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0', '2', '0');?
    ?20INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('23', 'Uncomplete Tasks Assigned By Me', 'notes.type=\'NT\' and notes.assignedbyid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0', '3', '0');?
    ?21INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('23', 'Public Uncomplete Tasks', 'notes.type=\'TS\' AND notes.private=0 AND notes.completed=0', '4', '0');?
    ?22INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('23', 'Public Tasks', 'notes.type=\'NT\' AND notes.private=0', '5', '0');?
    ?23INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('23', 'All Viewable Tasks', 'notes.type=\'TS\' AND !(notes.private=1 AND notes.createdby!={{$_SESSION[\'userinfo\'][\'id\']}})', '6', '0');?
    ?24INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'My Events', 'notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}', '0', '0');?
    ?25INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'Public Events', 'notes.type=\'EV\' AND notes.private=0', '8', '0');?
    ?26INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'Undone Events Assigned To Me', 'notes.type=\'EV\' and notes.assignedtoid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0', '17', '0');?
    ?27INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'Undone Events Assigned By Me', 'notes.type=\'NT\' and notes.assignedbyid={{$_SESSION[\'userinfo\'][\'id\']}} and notes.completed=0', '16', '0');?
    ?28INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'All Viewable Events', 'notes.type=\'EV\' AND !(notes.private=1 AND notes.createdby!={{$_SESSION[\'userinfo\'][\'id\']}})', '18', '0');?
    ?29INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'My Events - Today', 'notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = curdate()) OR notes.`repeat`=1)', '1', '0');?
    ?30INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'My Events - Yesterday', 'notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = date_sub(curdate(),INTERVAL 1 DAY)) OR notes.`repeat`=1)', '2', '0');?
    ?31INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'My Events - This Week', 'notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = year(notes.startdate)=year(curdate()) and week(notes.startdate)=week(curdate())) OR notes.repeat=1)', '4', '0');?
    ?32INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'My Events - This Month', 'notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = year(notes.startdate)=year(curdate()) and month(notes.startdate)=month(curdate())) OR notes.repeat=1)', '6', '0');?
    ?33INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'My Events - Tomorrow', 'notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND (notes.startdate = date_add(curdate(),INTERVAL 1 DAY) OR notes.repeat=1)', '3', '0');?
    ?34INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'My Events - Next Month', 'notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((year(notes.startdate)=year(date_add(curdate(),INTERVAL 1 MONTH)) and month(notes.startdate)=month(date_add(curdate(),INTERVAL 1 MONTH))) OR notes.repeat=1)', '7', '0');?
    ?35INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'My Events - Next Week', 'notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = year(notes.startdate)=year(date_add(curdate(),INTERVAL 1 WEEK)) and week(notes.startdate)=week(date_add(curdate(),INTERVAL 1 WEEK))) OR notes.repeat=1)', '5', '0');?
    ?36INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'Public Events - Today', 'notes.type=\'EV\' AND notes.private=0 AND ((notes.startdate = curdate()) OR notes.repeat=1)', '9', '0');?
    ?37INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'Public Events - Yesterday', 'notes.type=\'EV\' AND notes.private=0 AND ((notes.startdate = date_sub(curdate(),INTERVAL 1 DAY)) OR notes.repeat=1)', '10', '0');?
    ?38INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'Public Events - Tomorrow', 'notes.type=\'EV\' AND notes.private=0 AND (notes.startdate = date_add(curdate(),INTERVAL 1 DAY) OR notes.repeat=1)', '11', '0');?
    ?39INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'Public Events - This Week', 'notes.type=\'EV\' AND notes.private=0 AND ((notes.startdate = year(notes.startdate)=year(curdate()) and week(notes.startdate)=week(curdate())) OR notes.repeat=1)', '12', '0');?
    ?40INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'Public Events - Next Week', 'notes.type=\'EV\' AND notes.private=0 AND ((notes.startdate = year(notes.startdate)=year(date_add(curdate(),INTERVAL 1 WEEK)) and week(notes.startdate)=week(date_add(curdate(),INTERVAL 1 WEEK))) OR notes.repeat=1)', '13', '0');?
    ?41INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'Public Events - This Month', 'notes.type=\'EV\' AND notes.private=0 AND ((notes.startdate = year(notes.startdate)=year(curdate()) and month(notes.startdate)=month(curdate())) OR notes.repeat=1)', '14', '0');?
    ?42INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('24', 'Public Events - Next Month', 'notes.type=\'EV\' notes.private=0 AND ((year(notes.startdate)=year(date_add(curdate(),INTERVAL 1 MONTH)) and month(notes.startdate)=month(date_add(curdate(),INTERVAL 1 MONTH))) OR notes.repeat=1)', '15', '0');?
    ?43INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('26', 'All Records', 'files.id!=0', '0', '0');?
    ?44INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('200', 'Active Roles', 'roles.inactive=0', '0', '0');?
    ?45INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('200', 'Inactive Roles', 'roles.inactive=1', '1', '0');?
    ?46INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('200', 'All Records', 'roles.id!=-100', '2', '0');?
    ?47INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('201', 'all records', 'scheduler.id!=0', '0', '0');?
    ?48INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('202', 'entries within last day', 'log.stamp> DATE_SUB(CURDATE(),INTERVAL 1 DAY)', '0', '0');?
    ?49INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('202', 'entries within last week', 'log.stamp> DATE_SUB(CURDATE(),INTERVAL 1 WEEK)', '1', '0');?
    ?50INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('202', 'all entries', 'log.id!=-1', '2', '0');?
    ?51INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('203', 'All Records', 'tabs.id!=-1', '0', '-100');?
    5252INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('204', 'All Records', 'smartsearches.id!=-1', '0', '0');?
  • trunk/phpbms/install/tablegroupings.sql

    r308 r485 ?
    1?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (10,'fromtable.displayname',1,1,'',0);?
    2?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (11,'modules.name',1,0,'',0);?
    3?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (12,'notes.category',1,1,'',0);?
    4?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (16,'if(tabledefs.displayname is null,\"global\",tabledefs.displayname)',1,1,'',0);?
    5?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (17,'tabledefs.displayname',1,1,'',0);?
    6?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (17,'if(usersearches.type=\"SCH\",\"Search\",\"Sort\")',2,1,'',0);?
    7?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (19,'if(menu.parentid=0,concat( lpad(menu.displayorder,3,\"0\"), \" - \" ,menu.name )  , concat( lpad(parentmenu.displayorder,3,\"0\") , \" - \",parentmenu.name))',1,1,'',0);?
    8?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (23,'ELT(notes.importance+3,\'6 - Lowest\',\' 5 - Low\',\'4 - Normal\',\"3 - Medium\",\'2 - High\',\'1 - Highest\')',1,1,'Importance',0);?
    9?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (23,'notes.category',2,1,'Category',0);?
    10?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (24,'notes.category',1,1,'category',0);?
    11?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (203,'tabs.tabgroup',1,1,'Group',0);?
    ?1INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('10', 'fromtable.displayname', '1', '1', '', '0');?
    ?2INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('11', 'modules.name', '1', '0', '', '0');?
    ?3INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('12', 'notes.category', '1', '1', '', '0');?
    ?4INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('16', 'if(tabledefs.displayname is null,\"global\",tabledefs.displayname)', '1', '1', '', '0');?
    ?5INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('17', 'tabledefs.displayname', '1', '1', '', '0');?
    ?6INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('17', 'if(usersearches.type=\"SCH\",\"Search\",\"Sort\")', '2', '1', '', '0');?
    ?7INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('19', 'if(menu.parentid=0,concat( lpad(menu.displayorder,3,\"0\"), \" - \" ,menu.name )  , concat( lpad(parentmenu.displayorder,3,\"0\") , \" - \",parentmenu.name))', '1', '1', '', '0');?
    ?8INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('23', 'ELT(notes.importance+3,\'6 - Lowest\',\' 5 - Low\',\'4 - Normal\',\"3 - Medium\",\'2 - High\',\'1 - Highest\')', '1', '1', 'Importance', '0');?
    ?9INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('23', 'notes.category', '2', '1', 'Category', '0');?
    ?10INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('24', 'notes.category', '1', '1', 'category', '0');?
    ?11INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('203', 'tabs.tabgroup', '1', '1', 'Group', '0');?
  • trunk/phpbms/install/tableoptions.sql

    r427 r485 ?
    1414INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('11', 'edit', '1', '1', '0', '0', '0');?
    1515INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('11', 'printex', '1', '0', '0', '0', '0');?
    16?INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('12', 'import', '0', '0', '0', '-100', '0');?
    ?16INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('12', 'import', '1', '0', '0', '-100', '0');?
    1717INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('12', 'select', '1', '0', '0', '0', '0');?
    1818INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('12', 'edit', '1', '1', '0', '0', '0');?
  • trunk/phpbms/install/tablesearchablefields.sql

    r384 r485 ?
    1?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (3,9,'(users.lastname like \"{{value}}%\" or users.firstname like \"{{value}}%\" )','name',0,'whereclause');?
    2?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (5,9,'users.accesslevel','access level',2,'field');?
    3?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (6,9,'users.login','log in name',1,'field');?
    4?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (7,9,'users.id','id',3,'field');?
    5?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (26,10,'relationships.id','id',0,'field');?
    6?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (8,11,'tabledefs.maintable','main table',0,'field');?
    7?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (9,11,'tabledefs.displayname','display',1,'field');?
    8?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (10,11,'tabledefs.id','id',2,'field');?
    9?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (35,12,'notes.subject','title',0,'field');?
    10?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (36,12,'notes.content','content',2,'field');?
    11?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (37,12,'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"','assigned to',3,'whereclause');?
    12?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (38,12,'assignedby.firstname like \"{{value}}%\"or assignedby.lastname like \"{{value}}%\"','assigned by',4,'whereclause');?
    13?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (39,12,'notes.id','id',5,'field');?
    14?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (81,12,'notes.category','category',1,'field');?
    15?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (27,16,'reports.name','name',0,'field');?
    16?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (28,16,'reports.reporttable','table',1,'field');?
    17?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (29,16,'reports.type','type',2,'field');?
    18?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (30,16,'reports.id','id',3,'field');?
    19?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (31,17,'usersearches.name','name',0,'field');?
    20?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (32,17,'({{value]]=\"global\" or users.firstname like \"{{value}}%\" or users.lastname like \"{{value}}%\")','user',1,'whereclause');?
    21?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (33,17,'usersearches.table','table',2,'field');?
    22?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (34,17,'usersearches.id','id',3,'field');?
    23?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (67,19,'menu.name','name',0,'field');?
    24?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (68,19,'parentmenu.name','parent name',1,'field');?
    25?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (69,19,'menu.id','id',2,'field');?
    26?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (70,21,'modules.id','id',0,'field');?
    27?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (83,23,'notes.subject','title',0,'field');?
    28?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (84,23,'notes.category','category',1,'field');?
    29?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (85,23,'notes.content','content',2,'field');?
    30?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (86,23,'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"','assigned to',3,'whereclause');?
    31?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (87,23,'assignedby.firstname like \"{{value}}%\"or assignedby.lastname like \"{{value}}%\"','assigned by',4,'whereclause');?
    32?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (88,23,'notes.id','id',5,'field');?
    33?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (89,24,'notes.subject','title',0,'field');?
    34?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (90,24,'notes.category','category',1,'field');?
    35?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (91,24,'notes.content','content',2,'field');?
    36?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (92,24,'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"','assigned to',3,'whereclause');?
    37?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (93,24,'assignedby.firstname like','assigned by',4,'whereclause');?
    38?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (94,24,'notes.id','id',5,'field');?
    39?INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (96,26,'files.name','name',0,'field');?
    40?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (200,'roles.name','name',0,'field');?
    41?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (201,'scheduler.name','name',0,'field');?
    42?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (202,'log.type','type',0,'field');?
    43?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (202,'log.ip','ip address',1,'field');?
    44?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (203,'tabs.name','name',1,'field');?
    45?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (203,'tabs.tabgroup','group',0,'field');?
    ?1INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('9', '(users.lastname like \"{{value}}%\" or users.firstname like \"{{value}}%\" )', 'name', '0', 'whereclause');?
    ?2INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('9', 'users.accesslevel', 'access level', '2', 'field');?
    ?3INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('9', 'users.login', 'log in name', '1', 'field');?
    ?4INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('9', 'users.id', 'id', '3', 'field');?
    ?5INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('10', 'relationships.id', 'id', '0', 'field');?
    ?6INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('11', 'tabledefs.id', 'id', '2', 'field');?
    ?7INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('11', 'tabledefs.displayname', 'display', '1', 'field');?
    ?8INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('11', 'tabledefs.maintable', 'main table', '0', 'field');?
    ?9INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('12', 'notes.id', 'id', '5', 'field');?
    ?10INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('12', 'assignedby.firstname like \"{{value}}%\"or assignedby.lastname like \"{{value}}%\"', 'assigned by', '4', 'whereclause');?
    ?11INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('12', 'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"', 'assigned to', '3', 'whereclause');?
    ?12INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('12', 'notes.content', 'content', '2', 'field');?
    ?13INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('12', 'notes.subject', 'title', '0', 'field');?
    ?14INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('12', 'notes.category', 'category', '1', 'field');?
    ?15INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('16', 'reports.reporttable', 'table', '1', 'field');?
    ?16INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('16', 'reports.name', 'name', '0', 'field');?
    ?17INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('16', 'reports.id', 'id', '3', 'field');?
    ?18INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('16', 'reports.type', 'type', '2', 'field');?
    ?19INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('17', '({{value]]=\"global\" or users.firstname like \"{{value}}%\" or users.lastname like \"{{value}}%\")', 'user', '1', 'whereclause');?
    ?20INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('17', 'usersearches.id', 'id', '3', 'field');?
    ?21INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('17', 'usersearches.table', 'table', '2', 'field');?
    ?22INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('17', 'usersearches.name', 'name', '0', 'field');?
    ?23INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('19', 'menu.name', 'name', '0', 'field');?
    ?24INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('19', 'parentmenu.name', 'parent name', '1', 'field');?
    ?25INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('19', 'menu.id', 'id', '2', 'field');?
    ?26INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('21', 'modules.id', 'id', '0', 'field');?
    ?27INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('23', 'notes.id', 'id', '5', 'field');?
    ?28INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('23', 'assignedby.firstname like \"{{value}}%\"or assignedby.lastname like \"{{value}}%\"', 'assigned by', '4', 'whereclause');?
    ?29INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('23', 'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"', 'assigned to', '3', 'whereclause');?
    ?30INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('23', 'notes.content', 'content', '2', 'field');?
    ?31INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('23', 'notes.category', 'category', '1', 'field');?
    ?32INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('23', 'notes.subject', 'title', '0', 'field');?
    ?33INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('24', 'notes.id', 'id', '5', 'field');?
    ?34INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('24', 'assignedby.firstname like', 'assigned by', '4', 'whereclause');?
    ?35INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('24', 'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"', 'assigned to', '3', 'whereclause');?
    ?36INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('24', 'notes.content', 'content', '2', 'field');?
    ?37INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('24', 'notes.category', 'category', '1', 'field');?
    ?38INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('24', 'notes.subject', 'title', '0', 'field');?
    ?39INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('26', 'files.name', 'name', '0', 'field');?
    ?40INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('200', 'roles.name', 'name', '0', 'field');?
    ?41INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('201', 'scheduler.name', 'name', '0', 'field');?
    ?42INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('202', 'log.ip', 'ip address', '1', 'field');?
    ?43INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('202', 'log.type', 'type', '0', 'field');?
    ?44INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('203', 'tabs.name', 'name', '1', 'field');?
    ?45INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('203', 'tabs.tabgroup', 'group', '0', 'field');?
    4646INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('204', 'tabledefs.displayname', 'table', '2', 'field');?
    4747INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('204', 'smartsearches.name', 'name', '1', 'field');?
  • trunk/phpbms/install/update.js

    r308 r485 ?
    1?window.onload = function(){?
    2?        var sections = getElementsByClassName("bodyline");?
    3?        ?
    4?        var i;?
    5?        for(i=0; i< sections.length; i++){?
    6?                if(sections[i].id != "step1"){?
    7?                        sections[i].style.display = "none";?
    ?1updater = {?
    ?2?
    ?3        coreDataUpdate: function(){?
    ?4?
    ?5                var noDebug = getObjectFromID("coreDataNoDebug");?
    ?6?
    ?7                noDebug.className = "running";?
    ?8                noDebug.innerHTML = "Running...";?
    ?9?
    ?10                var response = updater.runCommand("coredataupdate");?
    ?11?
    ?12                if(response.success === true){?
    ?13?
    ?14                        noDebug.className = "success";?
    ?15                        noDebug.innerHTML = "Core Program Updated Succefully";?
    ?16?
    ?17                } else {?
    ?18?
    ?19                        noDebug.className = "fail";?
    ?20                        noDebug.innerHTML = "Core Program Update Failed";?
    ?21?
    ?22                }//endif?
    ?23?
    ?24        }, // endfunction coreDataInstall?
    ?25?
    ?26?
    ?27        moduleUpdate: function(e){?
    ?28?
    ?29                var theButton = e.src();?
    ?30?
    ?31                var foo = "";?
    ?32?
    ?33                var module = theButton.id.substring(12);?
    ?34?
    ?35                var noDebug = getObjectFromID("Results" + module);?
    ?36?
    ?37                noDebug.className = "running";?
    ?38                noDebug.innerHTML = "Running...";?
    ?39?
    ?40                var response = updater.runCommand("moduleupdate", module);?
    ?41?
    ?42                if(response.success === true){?
    ?43?
    ?44                        noDebug.className = "success";?
    ?45                        noDebug.innerHTML = "Update Successful";?
    ?46?
    ?47                } else {?
    ?48?
    ?49                        noDebug.className = "fail";?
    ?50                        noDebug.innerHTML = "Update Failed";?
    ?51?
    ?52                }//endif?
    ?53?
    ?54        },//end function moduleInstall?
    ?55?
    ?56?
    ?57        runCommand: function(command, extras){?
    ?58?
    ?59                if(typeof(extras) == "undefined")?
    ?60                        extras = "";?
    ?61                else?
    ?62                        extras = "&extras=" + extras?
    ?63?
    ?64                var theURL = "updateajax.php?command=" + command + extras;?
    ?65?
    ?66                loadXMLDoc(theURL,null,false);?
    ?67?
    ?68                var JSONresponse;?
    ?69                eval("JSONresponse = (" + req.responseText +")");?
    ?70?
    ?71                var responseText = getObjectFromID(command + "results");?
    ?72                if(typeof(responseText) != "undefined"){?
    ?73?
    ?74                        if(responseText.value)?
    ?75                                responseText.value += "\n";?
    ?76?
    ?77                        responseText.value += JSONresponse.details;?
    ?78?
    ?79                }//endif?
    ?80?
    ?81                return JSONresponse?
    ?82?
    ?83        },//endfunction runCommand?
    ?84?
    ?85?
    ?86        toggleDebug: function(){?
    ?87?
    ?88                var debug = getObjectFromID("debug");?
    ?89                var display = "none";?
    ?90                if(debug.checked)?
    ?91                        display = "block";?
    ?92?
    ?93                var debugDisplays = getElementsByClassName("debugResults");?
    ?94?
    ?95                for(var i = 0; i < debugDisplays.length; i ++)?
    ?96                        debugDisplays[i].style.display = display;?
    ?97?
    ?98        }//end function toggleDebug?
    ?99?
    ?100}//end class installer?
    ?101?
    ?102?
    ?103?
    ?104stepsNav = {?
    ?105?
    ?106        currentSection: 1,?
    ?107        sections: null,?
    ?108?
    ?109        navNext: function(){?
    ?110?
    ?111                if(stepsNav.currentSection + 1 <= stepsNav.sections.length){?
    ?112                        stepsNav.navTo(stepsNav.currentSection + 1);?
    8113                }?
    ?114        },?
    ?115?
    ?116?
    ?117        navPrev: function(){?
    ?118                if(stepsNav.currentSection - 1 > 0)?
    ?119                        stepsNav.navTo(stepsNav.currentSection - 1);?
    ?120        },?
    ?121?
    ?122?
    ?123        navTo: function(section){?
    ?124?
    ?125                for(var i=0; i< stepsNav.sections.length; i++){?
    ?126?
    ?127                        if(stepsNav.sections[i].id != "step" + section){?
    ?128                                stepsNav.sections[i].style.display = "none";?
    ?129                        } else {?
    ?130                                stepsNav.sections[i].style.display = "block";?
    ?131                        }//endif?
    ?132?
    ?133                }//endfor?
    ?134?
    ?135                navBar = getObjectFromID("navSelect");?
    ?136                for(i=0; i < navBar.options.length; i++){?
    ?137                        if(navBar.options[i].value == section){?
    ?138                                navBar.options[i].selected = true;?
    ?139                        }?
    ?140                }//endfor?
    ?141                //navBar.selectedIndex = section?
    ?142?
    ?143                stepsNav.currentSection = section;?
    ?144?
    ?145        },//end function navTo?
    ?146?
    ?147?
    ?148        navLeft: function(){?
    ?149?
    ?150                var navSelect = getObjectFromID("navSelect");?
    ?151                stepsNav.navTo(parseInt(navSelect.value));?
    ?152?
    ?153?
    9154        }?
    ?155?
    10156}?
    11157?
    12?function goSection(direction){?
    13?        var sections = getElementsByClassName("bodyline");?
    14?        var currSection = 1;?
    15?        ?
    16?        for(i=0; i< sections.length; i++){?
    17?                if(sections[i].style.display == "block")                        ?
    18?                        currSection = parseInt(sections[i].id.substr(4),10);?
    19?        }?
    20?        ?
    21?        if(direction == "next")?
    22?                direction = 1;?
    23?        else?
    24?                direction = -1;?
    25?        ?
    26?        if(currSection + direction == 0)?
    27?                return false;?
    28?        else{?
    29?                var currDiv = getObjectFromID("step"+currSection);?
    30?                var newDiv = getObjectFromID("step"+(currSection + direction))?
    ?158// ====== Init Listeners =======================================================?
    31159?
    32?                currDiv.style.display = "none";?
    33?                newDiv.style.display = "block";?
    34?        }?
    35?}//end function?
    ?160connect(window,"onload",function() {?
    36161?
    ?162        stepsNav.sections = getElementsByClassName("steps");?
    ?163        stepsNav.navTo(1);?
    37164?
    38?function changeModule(){?
    39?        var moduleSel=getObjectFromID("modules");?
    40?        var updateButton=getObjectFromID("updatemodule");?
    41?        var modinfo = getObjectFromID("moduleInformation");?
    42?        ?
    43?        var modName = getObjectFromID("modulename");?
    44?        var modVer = getObjectFromID("moduleversion");?
    45?        var modDesc = getObjectFromID("moduledescription");?
    46?        var modReq = getObjectFromID("modulerequirements");?
    47?        ?
    48?        if(moduleSel.value!=0){?
    49?                updateButton.disabled=false;?
    50?                ?
    51?                modName.innerHTML = modules[moduleSel.value]["name"];?
    52?                modVer.innerHTML = modules[moduleSel.value]["version"];?
    53?                modDesc.innerHTML = modules[moduleSel.value]["description"];?
    54?                modReq.innerHTML = modules[moduleSel.value]["requirements"];?
    55?                ?
    56?                modinfo.style.display = "block";                                                ?
    57?        }?
    58?        else{?
    59?                updateButton.disabled=true;?
    60?                modinfo.style.display = "none";                 ?
    61?        }?
    62?}?
    ?165        var nextButtons = getElementsByClassName("nextButtons");?
    ?166        for(var i=0; i< nextButtons.length; i++)?
    ?167                connect(nextButtons[i], "onclick", stepsNav.navNext);?
    63168?
    ?169        var prevButtons = getElementsByClassName("prevButtons");?
    ?170        for(var i=0; i< prevButtons.length; i++)?
    ?171                connect(prevButtons[i], "onclick", stepsNav.navPrev);?
    64172?
    65?function runCommand(command){?
    66?        var theURL="updatexml.php?command="+command;?
    67?        var adminName=getObjectFromID("username");?
    68?        var adminPass=getObjectFromID("password");?
    69?        var version=getObjectFromID("version");?
    70?        var theModules=getObjectFromID("modules");?
    71?        ?
    72?        theURL+="&u="+encodeURIComponent(adminName.value);?
    73?        theURL+="&p="+encodeURIComponent(adminPass.value);?
    74?        theURL+="&v="+encodeURIComponent(version.value);?
    75?        ?
    76?        if(command == "checkModuleUpdate"){?
    77?                theURL+="&m="+encodeURIComponent(theModules.value);?
    78?                theURL+="&mv="+encodeURIComponent(modules[theModules.value]["version"]);?
    79?        }?
    ?173        var navSelect = getObjectFromID("navSelect");?
    ?174        connect(navSelect, "onchange", stepsNav.navLeft);?
    80175?
    81?        var responseText= getObjectFromID(command+"results");?
    82?        loadXMLDoc(theURL,null,false);?
    83?        if(req.responseXML)?
    84?                response = req.responseXML.documentElement.firstChild.data+"\n";?
    85?        else ?
    86?                response = req.responseText+"\n";?
    87?                ?
    88?        responseText.value+=response;?
    89?}?
    ?176        var debug = getObjectFromID("debug");?
    ?177        connect(debug, "onchange", updater.toggleDebug);?
    90178?
    ?179        var updatecoreButton = getObjectFromID("updatecoreButton");?
    ?180        if(updatecoreButton)?
    ?181                connect(updatecoreButton,"onclick", updater.coreDataUpdate);?
    91182?
    92?function runModuleUpdate(){?
    93?        var themodule=getObjectFromID("modules");?
    94?        var responseText= getObjectFromID("checkModuleUpdateresults");?
    95?        if(themodule.value=="")?
    96?                alert("First, Select a module");?
    97?        else {?
    98?                var theURL="../modules/"+themodule.value+"/install/update.php";?
    99?                var adminName=getObjectFromID("username");?
    100?                var adminPass=getObjectFromID("password");?
    101?                var theModules=getObjectFromID("modules");?
    ?183        moduleButtons = getElementsByClassName("moduleButtons");?
    ?184        for(i = 0; i < moduleButtons.length; i++)?
    ?185                connect(moduleButtons[i], "onclick", updater.moduleUpdate);?
    102186?
    103?                theURL+="?u="+encodeURIComponent(adminName.value);?
    104?                theURL+="&p="+encodeURIComponent(adminPass.value);?
    105?                theURL+="&v="+encodeURIComponent(modules[theModules.value]["version"]);?
    106?                ?
    107?                loadXMLDoc(theURL,null,false);?
    108?                if(req.responseXML)?
    109?                        response = req.responseXML.documentElement.firstChild.data+"\n";?
    110?                else ?
    111?                        response = req.responseText;?
    112?                        ?
    113?                responseText.value+=response?
    114?        }?
    115?}?
    ?187})?
  • trunk/phpbms/install/update.php

    r312 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev$ | $LastChangedBy$?
    ? ? ?
    3838*/?
    3939?
    40?        include("install_include.php");?
    41?        include("version.php");?
    42?        ?
    ?40        include("update_include.php");?
    ?41?
    ?42        $updater = new updater();?
    ?43        $updater->buildList();?
    ?44?
    ?45?
    ?46        //check for php version?
    ?47        $neededVer = "5.2.0";?
    ?48        $phpVer = phpversion();?
    ?49        if(floatval($neededVer) <= floatval($phpVer))?
    ?50                $phpVerClass = "success";?
    ?51        else?
    ?52                $phpVerClass = "fail";?
    ?53?
    ?54        //check to see if mysql plugin present?
    ?55        if(phpversion("mysql"))?
    ?56                $mysqlPresent = "success";?
    ?57        else?
    ?58                $mysqlPresent = "fail";?
    ?59?
    ?60        //check the web server?
    ?61        $webServer = explode(" ",$_SERVER['SERVER_SOFTWARE']);?
    ?62        $webServer = explode("/", $webServer[0]);?
    ?63?
    ?64        if(strtolower($webServer[0]) == "apache"){?
    ?65?
    ?66                if(floatval($webServer[1]) > 2)?
    ?67                        $webServerReport["class"] = "success";?
    ?68                else?
    ?69                        $webServerReport["class"] = "warning";?
    ?70?
    ?71                $webServerReport["message"] = $webServer[0]."/".$webServer[1];?
    ?72?
    ?73        } else {?
    ?74                $webServerReport["class"] = "warning";?
    ?75                $webServerReport["message"] = "Non-Apache servers are untested and may have problems.";?
    ?76        }?
    ?77?
    ?78        $mysqlVer = $updater->getMySQLVersion();?
    ?79?
    ?80        if(floatval($mysqlVer) >= 5)?
    ?81                $mysqlPassFailClass = "success";?
    ?82        else?
    ?83                $mysqlPassFailClass = "fail";?
    ?84?
    4385?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">?
    4486<html xmlns="http://www.w3.org/1999/xhtml">?
    ? ? ?
    5395<script language="JavaScript" src="../common/javascript/moo/moo.fx.pack.js" type="text/javascript" ></script>?
    5496<script language="JavaScript" src="update.js" type="text/javascript" ></script>?
    55?<script language="JavaScript" type="text/javascript">?
    56?        <?php $modules = array_merge($modules,loadModules("update")) ?>?
    57?</script>?
    5897</head>?
    5998?
    6099<body>?
    61?        <h1 id="topTitle">phpBMS v<?php echo $modules["base"]["version"]?> Update</h1>?
    62?        ?
    63?        <div class="bodyline" id="step1">?
    64?                <h1>Before Updating</h1>?
    65?                ?
    66?                <p class="important">Backup all of your data and program files before running any update.</p>?
    67?                <p>?
    68?                        By downloading and decompressing this update, you may have already replaced script files ?
    69?                        from the previous version of phpBMS. If you have decompressed these files to a separate ?
    70?                        directory and have made custom changes directly to the system we recommend backing up ?
    71?                        those files before continuing. ?
    72?                </p>?
    73?                <p>For the latest information about phpBMS check the <a href="http://www.phpbms.org">phpBMS Project web site</a>.</p>?
    74??
    75?                <p class="nextprevP">?
    76?                        <button type="button" class="disabledButtons nextprevButtons" onclick="goSection('back')" disabled="disabled">back</button>?
    77?                        <button type="button" class="Buttons nextprevButtons" onclick="goSection('next')">next</button>?
    78?                </p>?
    ?100        <noscript>?
    ?101                <div class="bodyline">?
    ?102                        <h1>Javascript Support Disabled</h1>?
    ?103                        <p>Both the installer and the main phpBMS program require JavaScript support in order to run.</p>?
    ?104                </div>?
    ?105        </noscript>?
    ?106?
    ?107        <h1 id="topTitle">phpBMS v<?php echo $updater->list["base"]["version"]?> Update</h1>?
    ?108?
    ?109        <div class="bodyline">?
    ?110?
    ?111                <div id="navPanel">?
    ?112                        <select id="navSelect" size="10">?
    ?113                                <option value="1" selected="selected">* Preparing For Update</option>?
    ?114                                <option value="2">* Update Core Program</option>?
    ?115                                <option value="3">* Update Modules</option>?
    ?116                                <option value="4">* Finish Update</option>?
    ?117                        </select>?
    ?118                        <p><input type="checkbox" id="debug" /><label for="debug">updating debug</label></p>?
    ?119                </div>?
    ?120                <div id="stepsPanel">?
    ?121?
    ?122                        <div class="steps" id="step1">?
    ?123?
    ?124                                <p class="nextprevP">?
    ?125                                        <button type="button" class="disabledButtons prevButtons" disabled="disabled">back</button>?
    ?126                                        <button type="button" class="Buttons nextButtons">next</button>?
    ?127                                </p>?
    ?128?
    ?129                                <h1>Preparing For Update</h1>?
    ?130                                <p>?
    ?131                                        Before updating, There are several steps to take and insure that backup runs smoothly.?
    ?132                                </p>?
    ?133                                <ul>?
    ?134                                        <li>?
    ?135                                                <strong>Backup</strong> your data file. If you have access to a shell, using?
    ?136                                                the mysqldump command is a fast way of creating a reliable backup of your data.?
    ?137                                        </li>?
    ?138?
    ?139                                        <li>?
    ?140                                                By downloading and decompressing this update, you may have already replaced script files?
    ?141                                                from the previous version of phpBMS. If you have decompressed these files to a separate?
    ?142                                                directory and have made custom changes directly to the system we recommend backing up?
    ?143                                                those files before continuing.?
    ?144                                        </li>?
    ?145?
    ?146                                        <li>?
    ?147                                                For the latest information about phpBMS check the <a href="http://www.phpbms.org">phpBMS Project web site</a>.?
    ?148                                        </li>?
    ?149                                </ul>?
    ?150?
    ?151                                <h2>Server Requirements</h2>?
    ?152                                <table id="sysRequirements" cellpadding="0" cellspacing="0" border="0">?
    ?153                                        <thead>?
    ?154                                                <tr>?
    ?155                                                        <td>requirement</td>?
    ?156                                                        <td>server</td>?
    ?157                                                </tr>?
    ?158                                        </thead>?
    ?159                                        <tbody>?
    ?160                                                <tr>?
    ?161                                                        <td>PHP 5.2.0 or higher</td>?
    ?162                                                        <td><span class="<?php echo $phpVerClass?>"><?php echo $phpVer?></span></td>?
    ?163                                                </tr>?
    ?164                                                <tr>?
    ?165                                                        <td>PHP MySQL Support</td>?
    ?166                                                        <td><span class="<?php echo $mysqlPresent?>"><?php echo $mysqlPresent?></span></td>?
    ?167                                                </tr>?
    ?168                                                <tr>?
    ?169                                                        <td>Apache 2.0 or higher</td>?
    ?170                                                        <td><span class="<?php echo $webServerReport["class"]?>"><?php echo $webServerReport["message"]?></span></td>?
    ?171                                                </tr>?
    ?172                                                <tr>?
    ?173                                                        <td>MySQL Server 5.0 or higher</td>?
    ?174                                                        <td><span class="<?php echo $mysqlPassFailClass ?>"><?php echo $mysqlVer ?></span></td>?
    ?175                                                </tr>?
    ?176?
    ?177                                        </tbody>?
    ?178                                </table>?
    ?179?
    ?180                        </div>?
    ?181?
    ?182                        <div class="steps" id="step2">?
    ?183?
    ?184                                <p class="nextprevP">?
    ?185                                        <button type="button" class="Buttons prevButtons">back</button>?
    ?186                                        <button type="button" class="Buttons nextButtons">next</button>?
    ?187                                </p>?
    ?188?
    ?189                                <h1>Update Core Program</h1>?
    ?190?
    ?191                                <p>?
    ?192                                        The database reports the current version is <strong><?php echo $updater->list["base"]["currentversion"] ?></strong>.?
    ?193                                        The application files show the application version to upgrade to is <strong><?php echo $updater->list["base"]["version"] ?></strong>.?
    ?194                                </p>?
    ?195?
    ?196                                <?php if($updater->checkBaseUpdate()) { ?>?
    ?197?
    ?198                                        <p class="notes"><strong>Versions match.  No update is necessary.</strong></p>?
    ?199?
    ?200                                <?php } else { ?>?
    ?201?
    ?202                                        <p class="notes"><strong>You must update the phpBMS Core Program before updating any modules.</strong></p>?
    ?203?
    ?204?
    ?205                                        <p><button class="Buttons" id="updatecoreButton">Update Core Program</button> <span id="coreDataNoDebug"></span></p>?
    ?206?
    ?207                                        <div class="debugResults">?
    ?208                                                <h3>Update Core Results</h3>?
    ?209                                                <p><textarea name="results" id="coredataupdateresults" cols="40" rows="4" class="results"></textarea></p>?
    ?210                                        </div>?
    ?211?
    ?212                                <?php } //endif  ?>?
    ?213                        </div>?
    ?214?
    ?215                        <div class="steps" id="step3">?
    ?216?
    ?217                                <p class="nextprevP">?
    ?218                                        <button type="button" class="Buttons prevButtons">back</button>?
    ?219                                        <button type="button" class="Buttons nextButtons">next</button>?
    ?220                                </p>?
    ?221?
    ?222                                <h1>Udate Modules</h1>?
    ?223?
    ?224                                <?php $updater->showModulesUpdate(); ?>?
    ?225?
    ?226                                <div class="debugResults">?
    ?227                                        <h3>Module Installation Results</h3>?
    ?228                                        <p><textarea name="results" id="moduleupdateresults" class="results" cols="80" rows="10"></textarea></p>?
    ?229                                </div>?
    ?230?
    ?231                        </div>?
    ?232?
    ?233                        <div class="steps" id="step4">?
    ?234?
    ?235                                <p class="nextprevP">?
    ?236                                        <button type="button" class="Buttons prevButtons">back</button>?
    ?237                                        <button type="button" class="disabledButtons nextButtons" disabled="disabled">next</button>?
    ?238                                </p>?
    ?239?
    ?240                                <h1>Finish Update</h1>?
    ?241                                <p>?
    ?242                                        To finish the update process you will need to:?
    ?243                                </p>?
    ?244                                <ul>?
    ?245                                        <li>?
    ?246                                                <h3>Delete Install Folders</h3>?
    ?247                                                <p>?
    ?248                                                        You must delete both the core installation folder, as well as all modules' installation?
    ?249                                                        folders before you can use the system?
    ?250                                                </p>?
    ?251                                        </li>?
    ?252                                        <li>?
    ?253                                                <h3>Clear your Browser Cache</h3>?
    ?254                                                <p>?
    ?255                                                        Part of the update process may have replaced javascript and stylesheet (css) files.?
    ?256                                                        Most browsers cache these files to speed loading times. In order to insure that?
    ?257                                                        your web application is using all of the latest updates, you will need to?
    ?258                                                        clear the browser cache of all client browsers that access the application.?
    ?259                                                </p>?
    ?260                                                <p>?
    ?261                                                        Most browsers will clear this cache automatically if you simply restart the browser?
    ?262                                                </p>?
    ?263                                        </li>?
    ?264?
    ?265                                </ul>?
    ?266                                <h2>Troubleshooting</h2>?
    ?267                                <h3>General Help </h3>?
    ?268                                <p>?
    ?269                                If you have problems during updating, have questions about how the program works, or would like additional?
    ?270                                information about phpBMS, please visit the <a href="http://www.phpbms.org">phpBMS Project web site</a>.  The phpBMS project web site?
    ?271                                has many resources to help you including a user wiki, users forum, and mailing list that can help you.</p>?
    ?272                                <h3>Paid Customization, Update, Support Options</h3>?
    ?273                                <p>Paid technical support and phpBMS customization is available from <a href="http://www.kreotek.com">Kreotek</a>,</p>?
    ?274?
    ?275                        </div>?
    ?276?
    ?277                </div>?
    ?278?
    79279        </div>?
    80280?
    81?        ?
    82?        <div class="bodyline" id="step2">?
    83?                <h1>Enter Administrative Log In Information</h1>?
    84?                <p>?
    85?                        Running the update requires administrative access privleges.  Please enter the login credentials?
    86?                        that have administrative priveleges.?
    87?                </p>?
    88??
    89?                <fieldset>?
    90?                        <legend>administrative login</legend>?
    91?                        <p>?
    92?                                <label for="username">name</label><br />?
    93?                                <input name="name" type="text" id="username" size="32" maxlength="64" />?
    94?                                <input name="name" type="hidden" id="version"  value="<?php echo $modules["base"]["version"] ?>" />?
    95?                        </p>?
    96?                        <p>?
    97?                                <label for="password">password</label><br />?
    98?                                <input name="password" type="password" id="password" size="32" maxlength="24"  />?
    99?                        </p>?
    100?                        <p>?
    101?                                <input type="button" value="Verify" class="Buttons" onclick="runCommand('verifyLogin')" />?
    102?                        </p>?
    103?                </fieldset>?
    104?                <h3>Administrative Verification Results</h3>?
    105?                <p>?
    106?                        <textarea name="results" id="verifyLoginresults" class="results" cols="80" rows="2"></textarea>?
    107?                </p>?
    108?                ?
    109?                <p class="nextprevP">?
    110?                        <button type="button" class="Buttons nextprevButtons" onclick="goSection('back')">back</button>?
    111?                        <button type="button" class="Buttons nextprevButtons" onclick="goSection('next')">next</button>?
    112?                </p>            ?
    113?        </div>?
    114?        ?
    115?        ?
    116?        <div class="bodyline" id="step3">?
    117?                <h1>Check for phpBMS Core Update Availability</h1>?
    118??
    119?                <p>Check to see if the phpBMS core needs to be updated</p>?
    120?                <p class="testButtonsP">?
    121?                        <input type="button" value="Check Core Availability" class="Buttons" onclick="runCommand('checkBaseUpdate')" />?
    122?                </p>?
    123?                <h3>Availability Results</h3>?
    124?                <p>?
    125?                        <textarea name="results" id="checkBaseUpdateresults" class="results" cols="80" rows="2"></textarea>?
    126?                </p>?
    127??
    128??
    129?                <p class="nextprevP">?
    130?                        <button type="button" class="Buttons nextprevButtons" onclick="goSection('back')">back</button>?
    131?                        <button type="button" class="Buttons nextprevButtons" onclick="goSection('next')">next</button>?
    132?                </p>            ?
    133?        </div>?
    134??
    135??
    136?        <div class="bodyline" id="step4">?
    137?                <h1>Update phpBMS Core</h1>?
    138?                ?
    139?                <p>If an update was reported as available in the previous section, you should  run the update to the phpBMS core.</p>?
    140?                ?
    141?                <p class="notes">?
    142?                        If no update is available, running the update on an already updated version of phpBMS?
    143?                        can cause data corruption and break the application.?
    144?                </p>?
    145?                ?
    146?                <p class="testButtonsP">?
    147?                        <input type="button" value="Update Core" class="Buttons" onclick="runCommand('updateBaseVersion')" />?
    148?                </p>?
    149?                <h3>Core Update Results</h3>?
    150?                <p>?
    151?                        <textarea name="results" id="updateBaseVersionresults" class="results" cols="80" rows="8"></textarea>?
    152?                </p>?
    153??
    154?                <p class="nextprevP">?
    155?                        <button type="button" class="Buttons nextprevButtons" onclick="goSection('back')">back</button>?
    156?                        <button type="button" class="Buttons nextprevButtons" onclick="goSection('next')">next</button>?
    157?                </p>            ?
    158?        </div>?
    159?        ?
    160?        ?
    161?        <div class="bodyline" id="step5">?
    162?                <h1>Update Installed Modules</h1>?
    163?                <p>Before updating an installed module, make sure that you meet any module requirements listed.</p>?
    164?                ?
    165?                <p>?
    166?                        <label for="modules">available modules</label><br />?
    167?                        <select id="modules" name="modules" onchange="changeModule()">?
    168?                                <option value="0">Select a module to update...</option>?
    169?                                <?php showModules($modules);?>?
    170?                        </select>                       ?
    171?        </p>?
    172??
    173?                <div id="moduleInformation" class="box" style="display:none">?
    174?                        <h2>Module Information</h2>?
    175?                        <p>?
    176?                                module Name<br />?
    177?                                <strong id="modulename"></strong>?
    178?                        </p>?
    179?                        <p>?
    180?                                version: <strong id="moduleversion"></strong>?
    181?                        </p>?
    182?                        <p class="notes">?
    183?                                The version above is not necessarily the current data version.  Use the?
    184?                                "Check For Updates" button to see if an update is necessary.?
    185?                        </p>?
    186?                        <p>?
    187?                                description<br />?
    188?                                <strong id="moduledescription"></strong>                                ?
    189?                        </p>?
    190?                        <p>?
    191?                                requirements<br />?
    192?                                <strong id="modulerequirements"></strong>?
    193?                        </p>?
    194?                        <p class="notes">make sure your system meets all of the module's requirements.</p>?
    195?                        <p class="testButtonsP">?
    196?                                <input type="button" id="checkModule" value="Check For Updates" class="Buttons" onclick="runCommand('checkModuleUpdate')" />?
    197?                                <input type="button" id="updatemodule" name="updatemodule" value="Update Module" class="Buttons" onclick="runModuleUpdate()" disabled="disabled"/>?
    198?                        </p>?
    199?                </div>?
    200??
    201?                ?
    202?                <h3>Module Update Results</h3>?
    203?                <p>?
    204?                        <textarea name="results" id="checkModuleUpdateresults" class="results" cols="80" rows="8"></textarea>?
    205?                </p>?
    206??
    207?                ?
    208?                <p class="nextprevP">?
    209?                        <button type="button" class="Buttons nextprevButtons" onclick="goSection('back')">back</button>?
    210?                        <button type="button" class="Buttons nextprevButtons" onclick="goSection('next')">next</button>?
    211?                </p>            ?
    212?        </div>?
    213??
    214?        <div class="bodyline" id="step6">?
    215?                <h1>Complete the Update Process</h1>?
    216?                ?
    217?                <p>?
    218?                        To complete the update process, you may need to <strong>restart your browser</strong>, or <strong>clear site cookies and browser?
    219?                        cache</strong> in order for all the changes to take affect.?
    220?                </p>?
    221?                ?
    222?                <p class="testButtonsP"><input type="button" id="login" name="login" value="phpBMS Log In" class="Buttons" onclick="document.location='../'" /></p>?
    223?                ?
    224?                <p class="nextprevP">?
    225?                        <button type="button" class="Buttons nextprevButtons" onclick="goSection('back')">back</button>?
    226?                        <button type="button" class="disabledButtons nextprevButtons" onclick="goSection('next')" disabled="disabled">next</button>?
    227?                </p>    ?
    228?        </div>?
    229?        ?
    230281        <p class="tiny" align="center"> $Rev$ |  $LastChangedDate$</p>?
    231282</body>?
  • trunk/phpbms/install/updatev0.98.sql

    r427 r485 ?
    44ALTER TABLE `log` ENGINE=INNODB;?
    55ALTER TABLE `menu` ENGINE=INNODB;?
    ?6UPDATE `menu` SET `name` = 'Tools' WHERE `id` = '1' AND `name` = 'Organizer';?
    67ALTER TABLE `modules` ENGINE=INNODB;?
    78ALTER TABLE `notes` ENGINE=INNODB;?
    ?9ALTER TABLE `notes` MODIFY COLUMN `type` CHAR(2) NOT NULL DEFAULT 'NT';?
    810ALTER TABLE `relationships` ENGINE=INNODB;?
    911ALTER TABLE `reports` ENGINE=INNODB;?
    ?12ALTER TABLE `reports` MODIFY COLUMN `reportfile` VARCHAR(128) NOT NULL;?
    ?13UPDATE `reports` SET `description` = 'This report will generate a comma-delimited text file. Values are encapsulated in quotes, and the first line lists the field names.' WHERE `name` = 'Raw Table Export';?
    1014ALTER TABLE `roles` ENGINE=INNODB;?
    ?15ALTER TABLE `roles` MODIFY COLUMN `inactive` TINYINT(4) NOT NULL DEFAULT 0;?
    1116ALTER TABLE `rolestousers` ENGINE=INNODB;?
    1217ALTER TABLE `scheduler` ENGINE=INNODB;?
    ?18INSERT INTO `scheduler` (`name`, `job`, `crontab`, `lastrun`, `startdatetime`, `enddatetime`, `description`, `inactive`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('Clean Import Files', './scheduler_delete_tempimport.php', '30::*::*::*::*', NULL, NOW(), NULL, 'This will delete any temporary import files that are present (for whatever reason) after 30 minutes of their creation.', '0', 1, NOW(), 1, NOW());?
    ?19INSERT INTO `scheduler` (`id`, `name`, `job`, `crontab`, `lastrun`, `startdatetime`, `enddatetime`, `description`, `inactive`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('4', 'Remove Excess System Log Records', './scheduler_delete_logs.php', '*::24::*::*::*', NULL, '2009-03-31 12:00:00', NULL, 'This script will trim the system log when there are more than 2000 records present at the time of its calling (default will be every 24 hours).', '0', 1, NOW(), 1, NOW());?
    1320ALTER TABLE `settings` ENGINE=INNODB;?
    1421ALTER TABLE `smartsearches` ENGINE=INNODB;?
    1522ALTER TABLE `tablecolumns` ENGINE=INNODB;?
    1623ALTER TABLE `tabledefs` ENGINE=INNODB;?
    ?24ALTER TABLE `tabledefs` ADD COLUMN `importfile` VARCHAR(128) DEFAULT NULL AFTER `addroleid`, ADD COLUMN `importroleid` int(11) NOT NULL DEFAULT '-100' AFTER `importfile`;?
    1725ALTER TABLE `tablefindoptions` ENGINE=INNODB;?
    1826ALTER TABLE `tablegroupings` ENGINE=INNODB;?
    1927ALTER TABLE `tableoptions` ENGINE=INNODB;?
    20?ALTER TABLE `tablesearchablefields` ENGINE=INNODB;?
    21?ALTER TABLE `tabs` ENGINE=INNODB;?
    22?ALTER TABLE `users` ENGINE=INNODB;?
    23?ALTER TABLE `usersearches` ENGINE=INNODB;?
    24?INSERT INTO `scheduler` (`name`, `job`, `crontab`, `lastrun`, `startdatetime`, `enddatetime`, `description`, `inactive`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('clean import files', '/scheduler_delete_tempimport.php', '30::*::*::*::*', NULL, NOW(), NULL, 'This will delete any temporary import files that are present (for whatever reason) after 30 minutes of their creation.', '0', 1, NOW(), 1, NOW());?
    25?ALTER TABLE `tabledefs` ADD COLUMN `importfile` VARCHAR(128) DEFAULT NULL AFTER `addroleid`, ADD COLUMN `importroleid` int(11) NOT NULL DEFAULT '-100' AFTER `importfile`;?
    26?UPDATE `tabledefs` SET `importfile`='modules/base/users_import.php' WHERE `id` = 9;?
    2728ALTER TABLE `tableoptions` ADD COLUMN `needselect` BOOLEAN NOT NULL DEFAULT 1 AFTER `option`;?
    2829UPDATE `tableoptions` SET `needselect` = 0 WHERE `name` IN('massEmail','new','printex','select') AND `tabledefid` IN (9,10,11,12,16,17,19,21,23,24,26,27,200,201,202,203,204);?
    ? ? ?
    3031INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('10', 'import', '0', '0', '0', '-100', '0');?
    3132INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('11', 'import', '0', '0', '0', '-100', '0');?
    32?INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('12', 'import', '0', '0', '0', '-100', '0');?
    ?33INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('12', 'import', '1', '0', '0', '-100', '0');?
    3334INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('16', 'import', '0', '0', '0', '-100', '0');?
    3435INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('17', 'import', '1', '0', '0', '-100', '0');?
    ? ? ?
    4445INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('203', 'import', '0', '0', '0', '-100', '0');?
    4546INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('204', 'import', '0', '0', '0', '-100', '0');?
    46?UPDATE `reports` SET `description` = 'This report will generate a comma-delimited text file. Values are encapsulated in quotes, and the first line lists the field names.' WHERE `name` = 'Raw Table Export';?
    ?47ALTER TABLE `tablesearchablefields` ENGINE=INNODB;?
    ?48ALTER TABLE `tabs` ENGINE=INNODB;?
    ?49ALTER TABLE `users` ENGINE=INNODB;?
    ?50ALTER TABLE `users` ADD COLUMN `lastip` VARCHAR(45) NOT NULL DEFAULT '' AFTER `lastname`;?
    ?51ALTER TABLE `usersearches` ENGINE=INNODB;?
  • trunk/phpbms/install/update_include.php

    r285 r485 ?
    11<?php?
    22?
    3?        ?
    ?3define("APP_DEBUG",false);?
    ?4define("noStartup",true);?
    ?5?
    ?6require("../include/session.php");?
    ?7?
    ?8        class updater{?
    ?9?
    ?10                // database object?
    ?11                var $db;?
    ?12?
    ?13                // module list?
    ?14                var $list;?
    ?15?
    ?16                var $phpbmsSession;?
    417?
    518?
    6?//=======================================================================================?
    7?//=======================================================================================?
    8?        function loadSettings() {       ?
    9?                $settingsfile =  fopen("../settings.php","r");?
    10?                if($settingsfile){?
    11?                        //loop through the settings file and load variables into the session ?
    12?                        while( !feof($settingsfile)) {?
    13?                                $line=NULL;?
    14?                                $key=NULL;?
    15?                                $value=NULL;?
    16?                                $line=fscanf($settingsfile,"%[^=]=%[^[]]",$key,$value);?
    17?                                if ($line){?
    18?                                        $key=trim($key);?
    19?                                        $value=trim($value);?
    20?                                        if($key!="" and !strpos($key,"]")){     ?
    21?                                                $startpos=strpos($value,"\"");?
    22?                                                $endpos=strrpos($value,"\"");?
    23?                                                if($endpos!=false)?
    24?                                                        $value=substr($value,$startpos+1,$endpos-$startpos-1);?
    25?                                                $variables[$key]=$value;?
    26?                                        }?
    27?                                }?
    28?                        }?
    29?                        if(!isset($variables["mysql_pconnect"]))?
    30?                        $variables["mysql_pconnect"]="true";?
    31?                        fclose($settingsfile);?
    32?                        return $variables;?
    33?                } else return "Cannot open setting.php file";?
    34?        }?
    ?19                function updater(){?
    3520?
    36?        ?
    37?        function getNewVersion($dir="."){?
    38?                $file =  @ fopen($dir."/version.txt","r");?
    39?                $version=fgets($file,1024);?
    40?                @ fclose($file);?
    41?                return $version;?
    42?        }?
    43?        ?
    44?        function showModules(){?
    45?                $vars=loadSettings();?
    46?                if(!is_array($vars)) {?
    47?                        echo "<option>Could Not Open Settings File</option>";?
    48?                        return false;?
    49?                }?
    50?                if($vars["mysql_pconnect"]=="true")?
    51?                        $dblink = @  mysql_pconnect($vars["mysql_server"],$vars["mysql_user"],$vars["mysql_userpass"]);?
    52?                else?
    53?                        $dblink = @  mysql_connect($vars["mysql_server"],$vars["mysql_user"],$vars["mysql_userpass"]);?
    54?                @ mysql_select_db($vars["mysql_database"],$dblink);?
    55?                ?
    56?                $querystatement="SELECT name,version FROM modules WHERE name!=\"base\" ";?
    57?                $queryresult=$db->query($querystatement);?
    58?                ?
    59?                while($modulerecord=$db->fetchArray($queryresult)){?
    60?                        $newVersion=getNewVersion("../modules/".$modulerecord["name"]."/install");?
    61?                        if($newVersion!=$modulerecord["version"])?
    62?                                echo "<OPTION value=\"".$modulerecord["name"]."\">".$modulerecord["name"]." (".$modulerecord["version"]." -&gt; ".$newVersion.")</OPTION>\n";?
    63?                }?
    64?                ?
    65?        }?
    ?21                        $this->phpbmsSession = new phpbmsSession;?
    6622?
    67?        $version=getNewVersion();?
    ?23                        if($this->phpbmsSession->loadDBSettings(false)){?
    6824?
    ?25                                @ include_once("include/db.php");?
    ?26?
    ?27                                $this->db = new db(false);?
    ?28                                $this->db->stopOnError = false;?
    ?29                                $this->db->showError = false;?
    ?30                                $this->db->logError = false;?
    ?31?
    ?32                        } else?
    ?33                                $error = new appError(-300,"","",true,true,false);?
    ?34?
    ?35                        if(!$this->db->connect())?
    ?36                                $error = new appError(-400,"Could not connect to database server.\n\n".$this->db->getError(),"Database Error",true,true,false);?
    ?37?
    ?38                        if(!$this->db->selectSchema())?
    ?39                                $error = new appError(-410,"Could not open schema ".$this->db->schema,"Database Error", true, true, false);?
    ?40?
    ?41                }//end function init?
    ?42?
    ?43?
    ?44                function buildList(){?
    ?45?
    ?46                        $thedir = @ opendir("../modules/");?
    ?47?
    ?48                        $modules = array();?
    ?49?
    ?50                        //this helps build the modules array?
    ?51                        // each included modules version.php should add to the?
    ?52                        // array?
    ?53                        while($entry = readdir($thedir)){?
    ?54?
    ?55                                if($entry != "." && $entry != ".." && $entry != "base" && $entry != "sample" && is_dir("../modules/".$entry)){?
    ?56?
    ?57                                        if(file_exists("../modules/".$entry."/install/update.php") && file_exists("../modules/".$entry."/version.php")){?
    ?58?
    ?59                                                include("../modules/".$entry."/version.php");?
    ?60?
    ?61                                        }//endif?
    ?62?
    ?63                                }//endif?
    ?64?
    ?65                        }//end if?
    ?66?
    ?67                        //Next we add the base version in?
    ?68                        include("../phpbmsversion.php");?
    ?69?
    ?70                        //go retrieve current versions?
    ?71                        foreach($modules as $key=>$value)?
    ?72                                $modules[$key]["currentversion"] = $this->getCurrentVersion($key);?
    ?73?
    ?74                        $this->list = $modules;?
    ?75?
    ?76                }//end function buildList?
    ?77?
    ?78?
    ?79                function getMySQLVersion(){?
    ?80?
    ?81                        $querystatement = "SELECT VERSION() AS ver";?
    ?82                        $queryresult = $this->db->query($querystatement);?
    ?83                        if($this->db->error)?
    ?84                                $error = new appError(-425,"Could not retrieve mysql verson. ","Database Error", true, true, false);?
    ?85?
    ?86                        $therecord = $this->db->fetchArray($queryresult);?
    ?87?
    ?88                        return $therecord["ver"];?
    ?89?
    ?90                }//endif?
    ?91?
    ?92?
    ?93                function getCurrentVersion($module){?
    ?94?
    ?95                        $querystatement = "?
    ?96                                SELECT?
    ?97                                        version?
    ?98                                FROM?
    ?99                                        modules?
    ?100                                WHERE?
    ?101                                        name = '".$module."'";?
    ?102?
    ?103                        $queryresult = $this->db->query($querystatement);?
    ?104                        if($this->db->error)?
    ?105                                $error = new appError(-600,"Could not retrieve current version information for ".$module.": ".$this->db->error,"Cannot load module information",true,true,false);?
    ?106?
    ?107                        if($this->db->numRows($queryresult)){?
    ?108?
    ?109                                $therecord = $this->db->fetchArray($queryresult);?
    ?110?
    ?111                                return floatval($therecord["version"]);?
    ?112?
    ?113                        } else?
    ?114                                return 0;?
    ?115?
    ?116                }//end function getCurrentVersion?
    ?117?
    ?118?
    ?119                function checkBaseUpdate(){?
    ?120?
    ?121                        return ($this->list["base"]["version"] == $this->list["base"]["currentversion"]);?
    ?122?
    ?123                }//end function showBaseUpdate?
    ?124?
    ?125?
    ?126                function showModulesUpdate(){?
    ?127?
    ?128                        ?>?
    ?129                        <table id="moduleTable" cellpadding="0" cellspacing="0" border="0">?
    ?130                                <thead>?
    ?131                                        <tr>?
    ?132                                                <th>module</th>?
    ?133                                                <th>database version</th>?
    ?134                                                <th>file version</th>?
    ?135                                                <th>&nbsp;</th>?
    ?136                                        </tr>?
    ?137                                </thead>?
    ?138                                <tbody>?
    ?139                        <?php?
    ?140?
    ?141                        ksort($this->list);?
    ?142?
    ?143                        foreach($this->list as $key=>$module){?
    ?144?
    ?145                                if($key != "base"){?
    ?146?
    ?147                                        ?>?
    ?148                                        <tr>?
    ?149                                                <td>?
    ?150                                                        <h3><strong><?php echo $module["name"]?></strong></h3>?
    ?151                                                        <p><?php echo $module["description"]?></p>?
    ?152                                                        <p class="notes"><strong>Requirements:</strong> <?php echo $module["requirements"]?>?
    ?153                                                </td>?
    ?154                                                <td><?php echo $module["version"] ?></td>?
    ?155                                                <td><?php echo $module["currentversion"] ?></td>?
    ?156?
    ?157                                                <td class="moduleInstall">?
    ?158                                                        <?php?
    ?159                                                                if($module["version"] != $module["currentversion"]){?
    ?160                                                                        if($module["currentversion"] == 0) {?
    ?161                                                        ?>?
    ?162                                                                Not Installed>?
    ?163                                                        <?php?
    ?164                                                                        } else {}?
    ?165                                                        ?>?
    ?166?
    ?167                                                                <button class="Buttons moduleButtons" id="moduleButton<?php echo $key ?>">Update Module</button>?
    ?168                                                                <p><span class="" id="Results<?php echo $key?>"></span></p>?
    ?169?
    ?170                                                        <?php } else {?>?
    ?171                                                                Versions Match<br />?
    ?172                                                                Update Unnecessary?
    ?173                                                        <?php }//endif version!=currentversion ?>?
    ?174                                                </td>?
    ?175                                        </tr>?
    ?176                                        <?php?
    ?177?
    ?178                                }//end if?
    ?179?
    ?180                        }//end foreach?
    ?181?
    ?182                        ?></tbody></table><?php?
    ?183?
    ?184                }//end function showModuleUpdate?
    ?185?
    ?186        }//end class?
    69187?>?
  • trunk/phpbms/modules/base/adminsettings.php

    r448 r485 ?
    8686        $theform->addField($theinput);?
    8787?
    88?        $theinput = new inputField("currency_sym",$therecord["currency_sym"],"currency symbol",true,NULL,4,1);?
    ?88        $theinput = new inputField("currency_sym",$therecord["currency_sym"],"currency symbol",true,NULL,5,5);?
    8989        $theform->addField($theinput);?
    9090?
    ? ? ?
    225225                                <option value="UK - Loose" <?php if($therecord["phone_format"] == "UK - Loose")  echo "selected=\"selected\"";?>>UK - Loose</option>?
    226226                                <option value="International" <?php if($therecord["phone_format"] == "International")  echo "selected=\"selected\"";?>>International</option>?
    ?227                                <option value="No Verification" <?php if($therecord["phone_format"] == "No Verification")  echo "selected=\"selected\"";?>>No Verification</option>?
    227228                        </select>?
    228229                </p>?
  • trunk/phpbms/modules/base/cron.php

    r295 r485 ?
    1?<?php ?
    ?1<?php?
    22        $loginNoKick=true;?
    33        $loginNoDisplayError=true;?
    4?        ?
    ?4?
    55        include("../../include/session.php");?
    6?                ?
    ?6?
    77        $now = gmdate('Y-m-d H:i', strtotime('now'));?
    8?        ?
    9?        $querystatment="SELECT id,name,crontab,job,startdatetime,enddatetime FROM scheduler WHERE inactive=0 AND startdatetime<NOW() AND (enddatetime>NOW() OR enddatetime IS NULL);";?
    ?8?
    ?9        $querystatment = "?
    ?10                SELECT?
    ?11                        id,?
    ?12                        name,?
    ?13                        crontab,?
    ?14                        job,?
    ?15                        startdatetime,?
    ?16                        enddatetime?
    ?17                FROM?
    ?18                        scheduler?
    ?19                WHERE?
    ?20                        inactive = 0?
    ?21                        AND startdatetime < NOW()?
    ?22                        AND (enddatetime > NOW() OR enddatetime IS NULL)";?
    ?23?
    1024        $queryresult=$db->query($querystatment);?
    11?        ?
    ?25?
    1226        while($schedule_record=$db->fetchArray($queryresult)){?
    ?27?
    1328                $datetimearray=explode(" ",$schedule_record["startdatetime"]);?
    1429                $schedule_record["startdate"]=stringToDate($datetimearray[0],"SQL");?
    ? ? ?
    1631?
    1732                if($schedule_record["enddatetime"]){?
    ?33?
    1834                        $datetimearray=explode(" ",$schedule_record["enddatetime"]);?
    1935                        $schedule_record["enddate"]=stringToDate($datetimearray[0],"SQL");?
    2036                        $schedule_record["endtime"]=stringToTime($datetimearray[1],"24 Hour");?
    21?                }?
    22??
    23?                $validTimes=getTimes($schedule_record);?
    ?37?
    ?38                }//endif enddateiem?
    ?39?
    ?40                $validTimes = getTimes($schedule_record);?
    ?41?
    2442                if(is_array($validTimes) && in_array($now, $validTimes)){?
    ?43?
    2544                        $success = @ include($schedule_record["job"]);?
    ?45?
    2646                        if($success){?
    ?47?
    2748                                $updatestatement="UPDATE scheduler SET lastrun=NOW() WHERE id=".$schedule_record["id"];?
    2849                                $db->query($updatestatement);?
    29?                                $log = new phpbmsLog("Secheduled Job ".$schedule_record["name"]." (".$schedule_record["id"].") completed","SCHEDULER",-2);?
    30?                        } else {?
    31?                                $log = new phpbmsLog("Secheduled Job ".$schedule_record["name"]." (".$schedule_record["id"].") returned errors","SCHEDULER",-2);?
    32?                        }?
    33?                                ?
    34?                }               ?
    35?        }?
    36?        ?
    ?50                                $log = new phpbmsLog("Scheduled Job ".$schedule_record["name"]." (".$schedule_record["id"].") completed","SCHEDULER",-2);?
    ?51?
    ?52                        } else {?
    ?53?
    ?54                                $log = new phpbmsLog("Scheduled Job ".$schedule_record["name"]." (".$schedule_record["id"].") returned errors","SCHEDULER",-2);?
    ?55?
    ?56                        }//endif success?
    ?57?
    ?58                }//endif is_array();?
    ?59?
    ?60        }//endwhile?
    ?61?
    ?62?
    3763        function getTimes($recordarray){?
    38?        ?
    ?64?
    3965                $dayInt = array('*',1,2,3,4,5,6,7);?
    4066                $dayLabel = array('*',"Monday","Tuesday","Wedensday","Thursday","Friday","Saturday","Sunday");?
    ? ? ?
    4369                $metricsVar = array("*", "/", "-", ",");?
    4470                $metricsVal = array(' every ','',' thru ',' and ');?
    45?                        ?
    ?71?
    4672                $dateTimes = array();?
    4773                $ints   = explode('::', str_replace(' ','',$recordarray["crontab"]));?
    ? ? ?
    5985                        $theDay = str_replace('*/','',$days);?
    6086                        $dayName[] = str_replace($dayInt, $dayLabel, $theDay);?
    61?                } elseif($days != '*') { ?
    ?87                } elseif($days != '*') {?
    6288                        if(strstr($days, ',')) {?
    6389                                $exDays = explode(',',$days);?
    6490                                foreach($exDays as $k1 => $dayGroup) {?
    6591                                        if(strstr($dayGroup,'-')) {?
    66?                                                $exDayGroup = explode('-', $dayGroup); ?
    ?92                                                $exDayGroup = explode('-', $dayGroup);?
    6793                                                for($i=$exDayGroup[0];$i<=$exDayGroup[1];$i++) {?
    6894                                                        $dayName[] = str_replace($dayInt, $dayLabel, $i);?
    ? ? ?
    7399                                }?
    74100                        } elseif(strstr($days, '-')) {?
    75?                                $exDayGroup = explode('-', $days); ?
    ?101                                $exDayGroup = explode('-', $days);?
    76102                                for($i=$exDayGroup[0];$i<=$exDayGroup[1];$i++) {?
    77103                                        $dayName[] = str_replace($dayInt, $dayLabel, $i);?
    ? ? ?
    80106                                $dayName[] = str_replace($dayInt, $dayLabel, $days);?
    81107                        }?
    82?                        ?
    ?108?
    83109                        // check the day to be in scope:?
    84110                        if(!in_array($today['weekday'], $dayName)) {?
    ? ? ?
    88114                        return false;?
    89115                }?
    90?                ?
    91?                ?
    ?116?
    ?117?
    92118                // derive months part?
    93119                if($mons == '*') {?
    ? ? ?
    104130                        // this month is not in one of the multiplier months?
    105131                        if(!in_array($today['mon'],$compMons)) {?
    106?                                return false;   ?
    ?132                                return false;?
    107133                        }?
    108134                } elseif($mons != '*') {?
    ? ? ?
    127153                                $monName[] = $mons;?
    128154                        }?
    129?                        ?
    ?155?
    130156                        // check that particular months are in scope?
    131157                        if(!in_array($today['mon'], $monName)) {?
    ? ? ?
    133159                        }?
    134160                }?
    135?                ?
    ?161?
    136162?
    137163                // derive dates part?
    ? ? ?
    147173                                $i += $mult;?
    148174                        }?
    149?                        ?
    ?175?
    150176                        if(!in_array($today['mday'], $dateName)) {?
    151?                                return false;   ?
    ?177                                return false;?
    152178                        }?
    153179                } elseif($dates != '*') {?
    ? ? ?
    158184                                                $exDateGroup = explode('-', $dateGroup);?
    159185                                                for($i=$exDateGroup[0];$i<=$exDateGroup[1];$i++) {?
    160?                                                        $dateName[] = $i; ?
    ?186                                                        $dateName[] = $i;?
    161187                                                }?
    162188                                        } else {?
    ? ? ?
    167193                                $exDateGroup = explode('-', $dates);?
    168194                                for($i=$exDateGroup[0];$i<=$exDateGroup[1];$i++) {?
    169?                                        $dateName[] = $i; ?
    ?195                                        $dateName[] = $i;?
    170196                                }?
    171197                        } else {?
    172198                                $dateName[] = $dates;?
    173199                        }?
    174?                        ?
    ?200?
    175201                        // check that dates are in scope?
    176202                        if(!in_array($today['mday'], $dateName)) {?
    ? ? ?
    178204                        }?
    179205                }?
    180?                ?
    ?206?
    181207                // derive hours part?
    182208                $currentHour = date('G', strtotime('00:00'));?
    ? ? ?
    213239                        }?
    214240                }?
    215?                ?
    ?241?
    216242                // derive minutes?
    217243                $currentMin = date('i', strtotime($recordarray["starttime"]));?
    ? ? ?
    239265                                $i += $mult;?
    240266                        }?
    241?                        ?
    ?267?
    242268                } elseif($mins != '*') {?
    243269                        if(strstr($mins, ',')) {?
    ? ? ?
    261287                                $minName[] = $mins;?
    262288                        }?
    263?                } ?
    ?289                }?
    264290?
    265291                // prep some boundaries - these are not in GMT b/c gmt is a 24hour period, possibly bridging 2 local days?
    ? ? ?
    281307                        $hourSeen++;?
    282308                        foreach($minName as $kMin=>$min) {?
    283?                                if($hr < $currentHour || $hourSeen == 25) ?
    ?309                                if($hr < $currentHour || $hourSeen == 25)?
    284310                                        $theDate = date('Y-m-d', strtotime('+1 day'));?
    285311                                else?
    ? ? ?
    287313?
    288314                                $tsGmt = strtotime($theDate.' '.str_pad($hr,2,'0',STR_PAD_LEFT).":".str_pad($min,2,'0',STR_PAD_LEFT).":00"); // this is LOCAL?
    289?                                $validJobTime[] = gmdate('Y-m-d H:i', $tsGmt);                          ?
    ?315                                $validJobTime[] = gmdate('Y-m-d H:i', $tsGmt);?
    290316                        }?
    291317                }?
    292318                sort($validJobTime);?
    293319?
    294?                return $validJobTime;           ?
    ?320                return $validJobTime;?
    295321        }//end function?
    296322?>?
  • trunk/phpbms/modules/base/general_import.php

    r432 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev: 258 $ | $LastChangedBy: brieb $?
    ? ? ?
    4343        include("include/imports.php");?
    4444        include("include/parsecsv.lib.php");?
    45?        ?
    46?        //if you need to overide the phpbmsTable class make sure to include the modules file?
    47?        ?
    48?        //              include("modules/[modulename]/include/[tablename].php");?
    49??
    50??
    51?        //If the addedit page will be accessd directly from a page other than the ?
    52?        // basic search results page, you may want to grab and pass the previous URL?
    53?        //with the following code?
    54??
    55?        //===================================================?
    56?        if(!isset($_GET["backurl"])) ?
    57?                $backurl = NULL; ?
    58?        else{ ?
    59?                $backurl = $_GET["backurl"];?
    60?                if(isset($_GET["refid"]))?
    61?                        $backurl .= "?refid=".$_GET["refid"];?
    62?        }?
    63?        //===================================================?
    64??
    65?        if(isset($_GET["id"]))?
    66?                $tabledefid = ((int)$_GET["id"]);?
    67?        ?
    68??
    69?        //Here you invoke the table and import classes.  If you are going to use the standard phpbmsTable class?
    70?        // for updates and the such you would access it like this?
    71?        ?
    72?                        $thetable = new phpbmsTable($db,$tabledefid);?
    73?                        $import = new phpbmsImport($thetable);?
    74?        ?
    75?        //if you are going to overide the class you would instantiate?
    76?        // like this?
    77?        ?
    78?        //              $thetable = new [tablename]($db,[table definition id],$backurl);?
    79?        //              $import = new [importname]($thetable);?
    80?        ?
    81?        //and if you are setting the backurl, make sure you pass that as well?
    82?        // like this:?
    83?        ?
    84?        //              $thetable = new [tablename]($db,[table definition id],$backurl);?
    85?        ?
    86?        ?
    87?        //Next we process the form (if submitted) and ?
    ?45?
    ?46?
    ?47        $tabledefid = (int) $_GET["id"];?
    ?48?
    ?49        $querystatement = "?
    ?50                        SELECT?
    ?51                                `modules`.`name` AS `modulename`,?
    ?52                                `tabledefs`.`maintable` AS `maintable`?
    ?53                        FROM?
    ?54                                `tabledefs` INNER JOIN `modules` ON `tabledefs`.`moduleid` = `modules`.`id`?
    ?55                        WHERE?
    ?56                                `tabledefs`.`id` = '".$tabledefid."';?
    ?57                        ";?
    ?58?
    ?59        $queryresult = $db->query($querystatement);?
    ?60?
    ?61        $thereturn = $db->fetchArray($queryresult);?
    ?62?
    ?63        //try to include table specific functions?
    ?64        if(file_exists("../".$thereturn["modulename"]."/include/".$thereturn["maintable"].".php"))?
    ?65                include("../".$thereturn["modulename"]."/include/".$thereturn["maintable"].".php");?
    ?66?
    ?67        //next, see if the table class exists?
    ?68        if(class_exists($thereturn["maintable"])){?
    ?69                $classname = $thereturn["maintable"];?
    ?70                $thetable = new $classname($db,$tabledefid);?
    ?71        } else?
    ?72                $thetable = new phpbmsTable($db,$tabledefid);?
    ?73?
    ?74        //finally, check to see if import class exists?
    ?75        if(class_exists($thereturn["maintable"]."Import")){?
    ?76                $classname = $thereturn["maintable"]."Import";?
    ?77                $import = new $classname($thetable);?
    ?78        } else?
    ?79                $import = new phpbmsImport($thetable);?
    ?80?
    ?81        //Next we process the form (if submitted) and?
    8882        // return the current record as an array ($therecord)?
    8983        // or if this is a new record, it returns the defaults?
    ? ? ?
    9690?
    9791        $pageTitle = ($therecord["title"])?$therecord["title"]:"General Table Import";?
    98?        ?
    ?92?
    9993        // Next, we set up to include any?
    10094        // additional css or javascript files we will be using?
    ? ? ?
    106100?
    107101        // if you need to define a body onlload function, do so with the phpbms property?
    108?        ?
    ?102?
    109103        //              $phpbms->onload[] = "initializePage()";?
    110104?
    ? ? ?
    112106        // Next we need to define any special fields that will be used in the form?
    113107        // A list of field objects (with documentation)is available in the /include/fields.php?
    114?        // file.  ?
    115?        ?
    ?108        // file.?
    ?109?
    116110        // We need to define them here in the head?
    117111        // so that any necessay javascript is loaded appropriately.?
    118?        ?
    ?112?
    119113                //Form Elements?
    120114                //==============================================================?
    121?                ?
    ?115?
    122116                // Create the form?
    123117                $theform = new importForm();?
    ? ? ?
    125119                //if you need to set specific form vaiables (like enctype, or extra onsubmit?
    126120                // you can set those form properties here.?
    127?                ?
    128?                // for each field we will use, create the field object and add it to ?
    129?                // the forms list.?
    130?                //$theinput = new inputDatePicker("orderdate", $therecord["orderdate"], "order date");?
    131?                //$theform->addField($theinput);?
    132?                //?
    133?                //$theinput = new inputCheckBox("weborder",$therecord["weborder"],NULL, false, false);?
    134?                //$theform->addField($theinput);?
    135?                //?
    136?                //$theinput = new inputField("accountnumber",$therecord["accountnumber"],  "account number" ,false, "integer", 20, 64);?
    137?                //$theform->addField($theinput);?
    138??
    139??
    140?                // if you neeed to add additional attributes toa field, it's easy.?
    141?                //$theinput = new inputBasicList("type",$therecord["type"],array("Quote"=>"Quote","Order"=>"Order","Invoice"=>"Invoice","VOID"=>"VOID"), $displayName = NULL, $displayLabel = true);?
    142?                //$theinput->setAttribute("onchange","checkType(this)");?
    143?                //$theinput->setAttribute("class","important");?
    144?                //$theform->addField($theinput);?
    ?121?
    145122?
    146123                // lastly, use the jsMerge method to create the final Javascript formatting?
    147124                $theform->jsMerge();?
    148125                //==============================================================?
    149?                //End Form Elements     ?
    150??
    151?        include("header.php");  ?
    152?        ?
    ?126                //End Form Elements?
    ?127?
    ?128        include("header.php");?
    ?129?
    153130?><div class="bodyline">?
    154?        <!-- ?
    ?131        <!--?
    155132                Next we start the form.  This also prints the H1 with title, and top save,cancel buttons?
    156133                If you need to have other buttons, or need a specific top, you will need to create your form manually.?
    157134        -->?
    158?        <?php $theform->startForm($pageTitle, $import->pageType)?>?
    ?135        <?php $theform->startForm($pageTitle, $import->pageType, count($import->transactionRecords))?>?
    159136?
    160137        <div id="leftSideDiv">?
    ? ? ?
    164141                <!-- /* This next input also determines whether the file/import fieldset will be displayed or if the preview sections will be displayed*/ -->?
    165142                <input id="pageType" name="pageType" type="hidden" value="<?php echo $import->pageType?>" />?
    166?                ?
    ?143?
    167144                <?php?
    168145                if($import->pageType == "main"){ ?>?
    ? ? ?
    175152                                        <input id="import" name="import" type="file" size="64"/><br/>?
    176153                                </p>?
    177?                                ?
    ?154?
    178155                                <div id="info0" class="info">?
    179156                                        <p>?
    ? ? ?
    201178                <?php?
    202179                }//end if?
    203?                ?
    ?180?
    204181                if($import->error && $import->pageType != "main"){?
    205182                        ?>?
    ? ? ?
    216193        </div>?
    217194        <div id="createmodifiedby" >?
    218?        <?php   ?
    ?195        <?php?
    219196                //Last, we show the create/modifiy with the bottom save and cancel buttons?
    220197                // and then close the form.?
    221?                $theform->showButtons(2, $import->pageType);?
    ?198                $theform->showButtons(2, $import->pageType, count($import->transactionRecords));?
    222199                ?></div><?php?
    223200                $theform->endForm();?
  • trunk/phpbms/modules/base/include/adminsettings_include.php

    r357 r485 ?
    4343class settings{?
    4444        var $db;?
    45?        ?
    ?45?
    4646        function settings($db){?
    47?        ?
    ?47?
    4848                $this->db = $db;?
    49?        ?
    50?        }?
    51?        ?
    52?        ?
    ?49?
    ?50        }?
    ?51?
    ?52?
    5353        function getSettings(){?
    5454                $therecord = array();?
    55?                ?
    ?55?
    5656                $querystatement = "SELECT `name`, `value` FROM `settings`";?
    5757                $queryresult = $this->db->query($querystatement);?
    58?                ?
    ?58?
    5959                while($setting = $this->db->fetchArray($queryresult))?
    6060                        $therecord[$setting["name"]] = $setting["value"];?
    61?                        ?
    ?61?
    6262                return $therecord;?
    6363        }?
    64?        ?
    65?        ?
    ?64?
    ?65?
    6666        function updateSettings($variables){?
    67?        ?
    ?67?
    6868                global $phpbms;?
    69?                ?
    ?69?
    7070                if(!isset($variables["persistent_login"])) $variables["persistent_login"]=0;?
    71?                ?
    ?71?
    7272                //include any procesing that needs to be done by modules?
    7373                foreach($phpbms->modules as $module => $moduleinfo)?
    ? ? ?
    7777                                        $extraUpdate = new $class($this->db);?
    7878                                        $variables = $extraUpdate->updateSettings($variables);?
    79?                                        ?
    ?79?
    8080                                }//end if?
    81?        ?
    ?81?
    8282                // Update the settings records?
    8383                foreach($variables as $settingname => $settingvalue){?
    8484                        if(defined(strtoupper($settingname))){?
    8585                                if(constant(strtoupper($settingname)) != $settingvalue){?
    86?                                ?
    ?86?
    8787                                        $updatestatement = "?
    88?                                                UPDATE ?
    89?                                                        settings ?
    90?                                                SET ?
    91?                                                        value ='".$settingvalue."' ?
    92?                                                WHERE ?
    ?88                                                UPDATE?
    ?89                                                        settings?
    ?90                                                SET?
    ?91                                                        value ='".$settingvalue."'?
    ?92                                                WHERE?
    9393                                                        name='".mysql_real_escape_string($settingname)."'";?
    94?                                                        ?
    ?94?
    9595                                        $updateresult = $this->db->query($updatestatement);?
    96?                                        ?
    ?96?
    9797                                        if(!$this->db->affectedRows()){?
    9898?
    9999                                                //check to see why the update did not work?
    100100                                                $querystatement = "?
    101?                                                        SELECT ?
    ?101                                                        SELECT?
    102102                                                                name?
    103103                                                        FROM?
    ? ? ?
    105105                                                        WHERE?
    106106                                                                name = '".mysql_real_escape_string($settingname)."'";?
    107?                                                ?
    ?107?
    108108                                                $queryresult = $this->db->query($querystatement);?
    109?                                                ?
    ?109?
    110110                                                if(!$this->db->numRows($queryresult)){?
    111?                                                ?
    ?111?
    112112                                                        //insert the setting if need be?
    113113                                                        $insertstatement ="?
    ? ? ?
    120120                                                                                '".mysql_real_escape_string($settingname)."'?
    121121                                                                        }";?
    122?                                                                        ?
    ?122?
    123123                                                        $this->db-query($insertstatement);?
    124?                                                        ?
    ?124?
    125125                                                }//end if?
    126?                                        ?
    ?126?
    127127                                        }//end if?
    128?                                        ?
    ?128?
    129129                                }//end if?
    130130                        }?
    131131                }//end foreach?
    132?                ?
    ?132?
    133133                // deal with logo graphic.?
    134134                if(isset($_FILES["printedlogo"])){?
    135?                        if($_FILES["printedlogo"]["type"] == "image/png" || $_FILES["printedlogo"]["type"] == "image/jpeg"){?
    ?135?
    ?136                        $validFileTypes = array(?
    ?137                                "image/png",?
    ?138                                "image/x-png",?
    ?139                                "image/jpg",?
    ?140                                "image/jpeg",?
    ?141                                "imagep/jpeg",?
    ?142                        );?
    ?143?
    ?144                        if(in_array($_FILES["printedlogo"]["type"], $validFileTypes)){?
    ?145?
    136146                                if (function_exists('file_get_contents')) {?
    ?147?
    137148                                        $file = mysql_real_escape_string(file_get_contents($_FILES['printedlogo']['tmp_name']));?
    ?149?
    138150                                } else {?
    ?151?
    139152                                        // If using PHP < 4.3.0 use the following:?
    140153                                        $file = mysql_real_escape_string(fread(fopen($_FILES['printedlogo']['tmp_name'], 'r'), filesize($_FILES['printedlogo']['tmp_name'])));?
    141?                                }?
    ?154?
    ?155                                }//endif?
    ?156?
    142157                                if($_FILES["printedlogo"]["type"] == "image/jpeg")?
    143158                                        $name = "logo.jpg";?
    144159                                else?
    145160                                        $name = "logo.png";?
    146?                                        ?
    147?                                $querystatement="UPDATE `files` SET `file` = '".$file."', `type` = '".$_FILES["printedlogo"]["type"]."', `name`='".$name."' WHERE id=1";?
    148?                                $queryresult=$this->db->query($querystatement);?
    149?                        }?
    150?                }               ?
    ?161?
    ?162                                $updatestatement = "?
    ?163                                        UPDATE?
    ?164                                                `files`?
    ?165                                        SET?
    ?166                                                `file` = '".$file."',?
    ?167                                                `type` = '".$_FILES["printedlogo"]["type"]."',?
    ?168                                                `name`='".$name."'?
    ?169                                        WHERE?
    ?170                                                id = 1";?
    ?171?
    ?172                                $this->db->query($updatestatement);?
    ?173?
    ?174                        }//endif file types?
    ?175?
    ?176                }//endif file exists?
    151177?
    152178                return true;?
    153?                ?
    ?179?
    154180        }//end method?
    155?        ?
    ?181?
    156182?
    157183        function updateEncyptionSeed($newseed,$currpassword,$userid){?
    158?        ?
    ?184?
    159185                $userid = (int) $userid;?
    160?        ?
    ?186?
    161187                //first let's make sure the password matches?
    162188                $querystatement="SELECT id FROM users WHERE id=".$userid." AND password=ENCODE('".$currpassword."','".ENCRYPTION_SEED."')";?
    ? ? ?
    165191                if(!$this->db->numRows($queryresult))?
    166192                        return "Encryption Seed not Updated: Invalid Current Password";?
    167?                ?
    ?193?
    168194                //let's update the encryption seed then?
    169195                $querystatement="UPDATE settings SET value='".$newseed."' WHERE name='encryption_seed'";?
    170196                $queryresult=$this->db->query($querystatement);?
    171?                        ?
    ?197?
    172198                //last, reencode the current password?
    173199                $querystatement="UPDATE users SET password=ENCODE('".$currpassword."','".$newseed."') WHERE id=".$userid;?
    ? ? ?
    177203                $querystatement="UPDATE users SET password = ENCODE(DECODE(password,'".ENCRYPTION_SEED."'),'".$newseed."') WHERE id !=".$userid;?
    178204                $queryresult=$this->db->query($querystatement);?
    179?                        ?
    ?205?
    180206                return "Encryption Seed Updated.";?
    181?        }       ?
    ?207        }?
    182208?
    183209?
    ? ? ?
    185211?
    186212                $variables = addSlashesToArray($variables);?
    187?                ?
    ?213?
    188214                switch($variables["command"]){?
    189215                        case "update settings":?
    ? ? ?
    191217                                        $statusmessage="Settings Updated";?
    192218                        break;?
    193?                        ?
    ?219?
    194220                        case "update encryption seed":?
    195221                                if(isset($variables["changeseed"]))?
    ? ? ?
    201227?
    202228        }//end method?
    203?        ?
    204?        ?
    ?229?
    ?230?
    205231        function displayStylesheets($stylesheet){?
    206232?
    207233                $thedir="../../common/stylesheet";?
    208234                $thedir_stream = @opendir($thedir);?
    209?                ?
    ?235?
    210236                while($entry = @ readdir($thedir_stream)){?
    211237                        if ($entry!="." and  $entry!=".." and is_dir($thedir."/".$entry)) {?
  • trunk/phpbms/modules/base/include/files.php

    r285 r485 ?
    4040if(class_exists("phpbmsTable")){?
    4141        class files extends phpbmsTable{?
    42?        ?
    ?42?
    ?43                var $availableRoleIDs = array();?
    ?44?
    4345                function getPicture($name){?
    4446                        if (function_exists('file_get_contents')) {?
    ? ? ?
    4850                                $file = addslashes(fread(fopen($_FILES[$name]['tmp_name'], 'r'), filesize($_FILES[$name]['tmp_name'])));?
    4951                        }?
    50?                        ?
    ?52?
    5153                        return $file;?
    5254                }?
    53?                ?
    54?                function formatVariables($variables){?
    55?        ?
    56?                        if($_FILES['upload']["name"]){?
    57?                                ?
    58?                                $variables["name"] = $_FILES['upload']["name"];                 ?
    59?                                $variables["type"] = $_FILES['upload']['type'];                 ?
    60?                                $variables["file"] = $this->getPicture("upload");?
    61?                                ?
    62?                        } else {?
    63?                                unset($this->fields["type"]);?
    64?                                unset($this->fields["file"]);?
    ?55?
    ?56                //populates the list of possible role ids?
    ?57                //into $this->availableRoleIDs (an array)?
    ?58                function populateRoleArray(){?
    ?59?
    ?60                        $this->availableRoleIDs = array();?
    ?61?
    ?62                        $querystatement = "?
    ?63                                SELECT?
    ?64                                        `id`?
    ?65                                FROM?
    ?66                                        `roles`;?
    ?67                                ";?
    ?68?
    ?69                        $queryresult = $this->db->query($querystatement);?
    ?70?
    ?71                        //next two should also be allowed, but aren't stored in the database?
    ?72                        $this->availableRoleIDs[] = 0;//for everyone?
    ?73                        $this->availableRoleIDs[] = -100;//for administrators?
    ?74?
    ?75                        while($therecord = $this->db->fetchArray($queryresult))?
    ?76                                $this->availableRoleIDs[] = $therecord["id"];?
    ?77?
    ?78                }//end method --populateRoleArray--?
    ?79?
    ?80?
    ?81                function verifyVariables($variables){?
    ?82?
    ?83                        //if it is set, we'll have to check, if not, it defaults to 0 which is an acceptable?
    ?84                        //value.?
    ?85                        if(isset($variables["roleid"])){?
    ?86?
    ?87                                //either its numeric or == 0?
    ?88                                if(is_numeric($variables["roleid"]) || !$variables["roleid"]){?
    ?89?
    ?90                                        //check to see if the RoleIDs are populated?
    ?91                                        if(!count($this->availableRoleIDs))?
    ?92                                                $this->populateRoleArray();//populate if not?
    ?93?
    ?94                                        //check to see if the int typecast of the roleid (to allow for values?
    ?95                                        //equivalent to 0) is an acceptable role id.?
    ?96                                        if(!in_array(((int)$variables["roleid"]), $this->availableRoleIDs))?
    ?97                                                $this->verifyErrors[] = "The `roleid` field does not give an existing/acceptable role id number.";?
    ?98                                }else?
    ?99                                        $this->verifyErrors[] = "The `roleid` field must be numeric or equivalent to 0.";?
    65100                        }//end if?
    66?                        ?
    67?                        return $variables;                      ?
    68?                ?
    ?101?
    ?102                        return parent::verifyVariables($variables);?
    ?103?
    ?104                }//end method?
    ?105?
    ?106?
    ?107                function prepareVariables($variables){?
    ?108?
    ?109                        if(isset($_FILES['upload']))?
    ?110                                if($_FILES['upload']["name"]){?
    ?111?
    ?112                                        $variables["name"] = $_FILES['upload']["name"];?
    ?113                                        $variables["type"] = $_FILES['upload']['type'];?
    ?114                                        $variables["file"] = $this->getPicture("upload");?
    ?115?
    ?116                                } else {?
    ?117                                        unset($this->fields["type"]);?
    ?118                                        unset($this->fields["file"]);?
    ?119                                }//end if?
    ?120?
    ?121                        return $variables;?
    ?122?
    69123                }//end function?
    70?        ?
    71?        ?
    ?124?
    ?125?
    72126                function updateRecord($variables, $modifiedby = NULL){?
    73?        ?
    74?                        $variables = $this->formatVariables($variables);?
    75?        ?
    ?127?
    76128                        $thereturn = parent::updateRecord($variables, $modifiedby);?
    77?                        ?
    ?129?
    78130                        //restore the fields?
    79131                        $this->getTableInfo();?
    80?                        ?
    ?132?
    81133                        return $thereturn;?
    82134                }//end method?
    83?                ?
    84?                ?
    ?135?
    ?136?
    85137                function insertRecord($variables, $createdby = NULL){?
    86?                ?
    87?                        $variables = $this->formatVariables($variables);?
    88?        ?
    ?138?
    89139                        $newid = parent::insertRecord($variables, $createdby);?
    90?                        ?
    ?140?
    91141                        //restore the fields?
    92142                        $this->getTableInfo();?
    93?                        ?
    ?143?
    94144                        return $newid;?
    95?                        ?
    ?145?
    96146                }//end method?
    97?                        ?
    ?147?
    98148        }//end class?
    99149}//end if?
    ? ? ?
    101151if(class_exists("searchFunctions")){?
    102152        class filesSearchFunctions extends searchFunctions{?
    103?        ?
    ?153?
    104154                function delete_record(){?
    105?                ?
    ?155?
    106156                        $whereclause = $this->buildWhereClause();?
    107157                        $attachmentwhereclause = $this->buildWhereClause("attachments.fileid");?
    108?                ?
    ?158?
    109159                        $querystatement = "DELETE FROM attachments WHERE ".$attachmentwhereclause." AND attachments.fileid!=1;";?
    110160                        $queryresult = $this->db->query($querystatement);?
    111?                ?
    ?161?
    112162                        $querystatement = "DELETE FROM files WHERE ".$whereclause." AND files.id!=1;";?
    113163                        $queryresult = $this->db->query($querystatement);?
    114?                        ?
    ?164?
    115165                        $message = $this->buildStatusMessage();?
    116166                        $message.=" deleted";?
    117167                        return $message;?
    118168                }?
    119?        ?
    ?169?
    120170        }//end class?
    121171}//end if?
  • trunk/phpbms/modules/base/include/menu.php

    r285 r485 ?
    3939if(class_exists("phpbmsTable")){?
    4040        class menus extends phpbmsTable{?
    41?        ?
    42?                function formatVariables($variables){?
    ?41?
    ?42                var $availableRoleIDs = array();?
    ?43?
    ?44                function checkParentMenuIDs($currentID = 0, $parentID = 0){?
    ?45?
    ?46                        //cannot be own parent?
    ?47                        $currentID = ((int) $currentID);?
    ?48                        //current setting of the parentid?
    ?49                        $parentID = ((int) $parentID);?
    ?50?
    ?51                        if(!$parentID)?
    ?52                                return true;?
    ?53?
    ?54                        $querystatement = "?
    ?55                                SELECT?
    ?56                                        `id`?
    ?57                                FROM?
    ?58                                        `menu`?
    ?59                                WHERE?
    ?60                                        `id` = '".$parentID."'?
    ?61                                        AND?
    ?62                                        `id`!='".$currentID."'?
    ?63                                        AND?
    ?64                                        `parentid` = '0'?
    ?65                                        AND?
    ?66                                        (?
    ?67                                                `link` = ''?
    ?68                                                OR?
    ?69                                                `link` IS NULL?
    ?70                                        )?
    ?71                                        ;?
    ?72                                ";?
    ?73?
    ?74                        $queryresult = $this->db->query($querystatement);?
    ?75?
    ?76                        return $this->db->numRows($queryresult);?
    ?77?
    ?78                }//end method --getParentMenuIDs--?
    ?79?
    ?80                //pouplate the id roles array?
    ?81                function populateRoleArray(){?
    ?82?
    ?83                        $this->availableRoleIDs = array();?
    ?84?
    ?85                        $querystatement = "?
    ?86                                SELECT?
    ?87                                        `id`?
    ?88                                FROM?
    ?89                                        `roles`;?
    ?90                                ";?
    ?91?
    ?92                        $queryresult = $this->db->query($querystatement);?
    ?93?
    ?94                        $this->availableRoleIDs[] = 0;//for everyone?
    ?95                        $this->availableRoleIDs[] = -100;//for admin?
    ?96?
    ?97?
    ?98                        while($therecord = $this->db->fetchArray($queryresult))?
    ?99                                $this->availableRoleIDs[] = $therecord["id"];?
    ?100?
    ?101                }//end method --populateRoleArray()--?
    ?102?
    ?103?
    ?104                function verifyVariables($variables){?
    ?105?
    ?106                        //table default (0) for `roleid` is ok (i.e. doesn't have to be set)?
    ?107                        if(isset($variables["roleid"])){?
    ?108?
    ?109                                //can either be numeric or equivalent to 0?
    ?110                                if(is_numeric($variables["roleid"]) || !$variables["roleid"]){?
    ?111?
    ?112                                        //check for populated role id array?
    ?113                                        if(!count($this->availableRoleIDs))?
    ?114                                                $this->populateRoleArray();?
    ?115?
    ?116                                        //check to see if the int typecast role id is in one of the available ones?
    ?117                                        if(!in_array(((int)$variables["roleid"]), $this->availableRoleIDs))?
    ?118                                                $this->verifyErrors[] = "The `roleid` field does not give an existing/acceptable role id number.";?
    ?119                                }else?
    ?120                                        $this->verifyErrors[] = "The `roleid` field must be numeric or equivalent to 0.";?
    ?121?
    ?122                        }//end if?
    ?123?
    ?124                        //check parent ids under certain circumstances?
    ?125                        //not set is acceptable?
    ?126                        if(isset($variables["parentid"])){?
    ?127?
    ?128                                //can be either numeric or equivalent to 0 and its int typecast must be non-negative?
    ?129                                if( !$variables["parentid"] || ((int)$variables["parentid"]) > 0 ){?
    ?130?
    ?131                                        $id = 0;?
    ?132?
    ?133                                        //use the current id if it exists (A menu record cannot be its own parent)?
    ?134                                        if(isset($variables["id"]))?
    ?135                                                if(is_numeric($variables["id"]) && ((int) $variables["id"]) > 0)?
    ?136                                                        $id = $variables["id"];?
    ?137?
    ?138                                        //Select run every time because `id` can be different?
    ?139                                        if( !$this->checkParentMenuIDs($id, ((int) $variables["parentid"])) )?
    ?140                                                $this->verifyErrors[] = "The `parentid` field does not give an existing/acceptable parent id number.";?
    ?141?
    ?142                                }else?
    ?143                                        $this->verifyErrors[] = "The `roleid` field must be a non-negative number or equivalent to 0.";?
    ?144?
    ?145                        }//end if?
    ?146?
    ?147                        return parent::verifyVariables($variables);?
    ?148?
    ?149                }//end method --verifyVariables--?
    ?150?
    ?151?
    ?152                function prepareVariables($variables){?
    43153                        switch($variables["radio"]){?
    44154                                case "cat":?
    ? ? ?
    52162                                default:?
    53163                        }?
    54?                ?
    ?164?
    55165                        return $variables;?
    56166                }?
    57?        ?
    58?                ?
    59?                function updateRecord($variables, $modifiedby = NULL){?
    60?                        ?
    61?                        $variables = $this->formatVariables($variables);?
    62?                ?
    63?                        parent::updateRecord($variables, $modifiedby);?
    64?                }?
    65?        ?
    66?        ?
    67?                function insertRecord($variables, $createdby = NULL){?
    68?                        ?
    69?                        $variables = $this->formatVariables($variables);?
    70?                ?
    71?                        return parent::insertRecord($variables, $createdby );?
    72?                }?
    73?        ?
    74?        ?
    ?167?
    ?168?
    75169                function displayTableDropDown($selectedlink){?
    76?        ?
    ?170?
    77171                        $querystatement="select id, displayname from tabledefs order by displayname";?
    78172                        $thequery=$this->db->query($querystatement);?
    79?                        ?
    ?173?
    80174                        echo "<select id=\"linkdropdown\" name=\"linkdropdown\">\n";?
    81175                        while($therecord=$this->db->fetchArray($thequery)){?
    82176                                echo "<option value=\"search.php?id=".$therecord["id"]."\" ";?
    83?        ?
    84?                                if ($selectedlink == "search.php?id=".$therecord["id"]) ?
    ?177?
    ?178                                if ($selectedlink == "search.php?id=".$therecord["id"])?
    85179                                        echo "selected=\"selected\"";?
    86?        ?
    ?180?
    87181                                echo " >".$therecord["displayname"]."</option>\n";?
    88182                        }?
    89183                        echo "</select>\n";?
    90?                ?
    ?184?
    91185                }//end method?
    92?                ?
    93?                ?
    ?186?
    ?187?
    94188                function displayParentDropDown($selectedpid,$id=0){?
    95?        ?
    ?189?
    96190                        if($id=="")$id=0;?
    97191                        $querystatement="SELECT id, name FROM menu WHERE id!=".$id." and parentid=0 and (link=\"\" or link is null) ORDER BY displayorder";?
    98192                        $thequery=$this->db->query($querystatement);?
    99?        ?
    ?193?
    100194                        echo "<select name=\"parentid\" id=\"parentid\">\n";?
    101195                        echo "<option value=\"0\" ";?
    102?        ?
    ?196?
    103197                        if ($selectedpid=="0")?
    104198                                echo "selected=\"selected\"";?
    105?                                ?
    ?199?
    106200                        echo " >-- none --</option>\n";?
    107201                        while($therecord=$this->db->fetchArray($thequery)){?
    108202                                echo "<option value=\"".$therecord["id"]."\" ";?
    109?                                if ($selectedpid==$therecord["id"]) ?
    ?203                                if ($selectedpid==$therecord["id"])?
    110204                                        echo "selected=\"selected\"";?
    111?        ?
    ?205?
    112206                                echo " >".$therecord["name"]."</option>\n";?
    113207                        }?
    114208                        echo "</select>\n";?
    115?                        ?
    ?209?
    116210                }//end method?
    117?        ?
    ?211?
    118212        }//end class?
    119213}//end if?
    ? ? ?
    122216if(class_exists("searchFunctions")){?
    123217        class menuSearchFunctions extends searchFunctions{?
    124?        ?
    ?218?
    125219                function delete_record(){?
    126?                        ?
    ?220?
    127221                        //passed variable is array of user ids to be revoked?
    128222                        $whereclause = $this->buildWhereClause();?
    129223                        $verifywhereclause = $this->buildWhereClause("menu.parentid");?
    130?                        ?
    ?224?
    131225                        $querystatement = "SELECT id FROM menu WHERE ".$verifywhereclause;?
    132226                        $queryresult = $this->db->query($querystatement);?
    ? ? ?
    136230                                $queryresult = $this->db->query($querystatement);?
    137231                        }?
    138?                        ?
    ?232?
    139233                        $message=$this->buildStatusMessage();?
    140234                        $message.=" deleted.";?
    141235                        return $message;?
    142236                }?
    143?        ?
    ?237?
    144238        }//end class?
    145239}//end if?
  • trunk/phpbms/modules/base/include/notes.php

    r351 r485 ?
    4545        var $weekArray = array("First"=>"1", "Second"=>"2", "Third"=>"3", "Fourth"=>"4", "Last"=>"5");?
    4646        var $dayOfWeekArray = array();?
    47?        ?
    48?        ?
    ?47?
    ?48?
    4949        function notes($db,$tabledefid = 0,$backurl = NULL){?
    5050?
    ? ? ?
    5757        }?
    5858?
    59?        ?
    ?59?
    6060        function showWeeklyOptions($therecord,$repeatbase){?
    6161                if($therecord["repeattype"] == "Weekly")?
    ? ? ?
    6363                else?
    6464                        $daysSelected = array(strftime("%u",$repeatbase));?
    65?                        ?
    ?65?
    6666                $daysAvailable = array(7,1,2,3,4,5,6);?
    67?                ?
    ?67?
    6868                foreach($daysAvailable as $dayNum){?
    6969                        $tempday = ($dayNum != 7)?($dayNum+1):(1);?
    70?                        ?><button id="dayOption<?php echo $dayNum?>" class="<?php ?
    71?                        ?
    ?70                        ?><button id="dayOption<?php echo $dayNum?>" class="<?php?
    ?71?
    7272                        if(in_array($dayNum,$daysSelected))?
    73?                                echo "pressed"; ?
    74?                        ?
    75?                        ?>Buttons" type="button" value="<?php echo $dayNum?>" onclick="daySelect(this)"><?php ?
    76?                        ?
    ?73                                echo "pressed";?
    ?74?
    ?75                        ?>Buttons" type="button" value="<?php echo $dayNum?>" onclick="daySelect(this)"><?php?
    ?76?
    7777                        echo nl_langinfo(constant("ABDAY_".$tempday));?
    78?                        ?
    ?78?
    7979                        ?></button><?php?
    8080                }?
    81?                        ?
    82?                ?
    ?81?
    ?82?
    8383        }?
    84?        ?
    ?84?
    8585        function showMonthlyOptions($therecord,$repeatbase){?
    8686                if($therecord["repeattype"] == "Monthly" && $therecord["repeateachlist"])?
    ? ? ?
    8888                else?
    8989                        $daysSelected = array(strftime("%e",$repeatbase));?
    90?                        ?
    91?                ?
    ?90?
    ?91?
    9292                for($dayNum = 1; $dayNum <= 31; $dayNum++){?
    93?                        ?><button id="monthDayOption<?php echo $dayNum?>" class="<?php ?
    94?                        ?
    ?93                        ?><button id="monthDayOption<?php echo $dayNum?>" class="<?php?
    ?94?
    9595                        if(in_array($dayNum,$daysSelected))?
    96?                                echo "pressed"; ?
    97?                        ?
    98?                        ?>Buttons monthDays" type="button" value="<?php echo $dayNum?>" onclick="monthDaySelect(this)" <?php ?
    99?                        ?
    ?96                                echo "pressed";?
    ?97?
    ?98                        ?>Buttons monthDays" type="button" value="<?php echo $dayNum?>" onclick="monthDaySelect(this)" <?php?
    ?99?
    100100                                if($therecord["repeatontheday"])?
    101101                                        echo 'disabled="disabled"';?
    102?                        ?
    103?                        ?>><?php ?
    104?                        ?
    ?102?
    ?103                        ?>><?php?
    ?104?
    105105                        echo $dayNum;?
    106?                        ?
    ?106?
    107107                        ?></button><?php?
    108108                        if(($dayNum % 7) == 0) echo "<br />";?
    109?                }                       ?
    110?                ?
    ?109                }?
    ?110?
    111111        }//end method?
    112112?
    113?        ?
    ?113?
    114114        function showYearlyOptions($therecord,$repeatbase){?
    115115                if($therecord["repeattype"] == "Yearly")?
    ? ? ?
    117117                else?
    118118                        $monthsSelected = array(date("n",$repeatbase));?
    119?                        ?
    ?119?
    120120                for($monthNum = 1; $monthNum <=12; $monthNum++){?
    121?                        ?><button id="yearlyMonthOption<?php echo $monthNum?>" class="<?php ?
    122?                        ?
    ?121                        ?><button id="yearlyMonthOption<?php echo $monthNum?>" class="<?php?
    ?122?
    123123                        if(in_array($monthNum,$monthsSelected))?
    124?                                echo "pressed"; ?
    125?                        ?
    126?                        ?>Buttons yearlyMonths" type="button" value="<?php echo $monthNum?>" onclick="yearlyMonthSelect(this)"><?php ?
    127?                        ?
    ?124                                echo "pressed";?
    ?125?
    ?126                        ?>Buttons yearlyMonths" type="button" value="<?php echo $monthNum?>" onclick="yearlyMonthSelect(this)"><?php?
    ?127?
    128128                        echo nl_langinfo(constant("ABMON_".$monthNum));?
    129?                        ?
    ?129?
    130130                        ?></button><?php?
    131131                        if(($monthNum % 4) == 0) echo "<br />";?
    ? ? ?
    135135?
    136136                function newerRepeats($parentid,$id){?
    137?        ?
    ?137?
    138138                        if ($parentid=="NULL")?
    139139                                $parentid=$id;?
    140?                                ?
    ?140?
    141141                        $querystatement="SELECT creationdate FROM notes WHERE id=".((int) $id);?
    142142                        $queryresult = $this->db->query($querystatement);?
    143143                        $therecord=$this->db->fetchArray($queryresult);?
    144?                ?
    ?144?
    145145                        $querystatement="SELECT id FROM notes WHERE completed=0 AND parentid=".((int) $parentid)." AND creationdate > '".$therecord["creationdate"]."'";?
    146146                        $queryresult = $this->db->query($querystatement);?
    147?        ?
    ?147?
    148148                        if($this->db->numRows($queryresult)) return true; else return false;?
    149149                }?
    150?        ?
    151?        ?
    ?150?
    ?151?
    152152                function resetRepeating($parentid){?
    153?                        ?
    ?153?
    154154                        $deletstatement="DELETE FROM notes WHERE completed=0 AND parentid=".$parentid;?
    155155                        $this->db->query($deletstatement);?
    156?                        ?
    ?156?
    157157                        $updatestatement="UPDATE notes SET parentid=NULL WHERE completed=1 AND parentid=".$parentid;?
    158158                        $queryresult = $this->db->query($updatestatement);?
    159159?
    160160                }?
    161?        ?
    162?        ?
    ?161?
    ?162?
    163163                function updateTask($id,$completed,$type){?
    164?                ?
    ?164?
    165165                        if($completed)?
    166166                                $compDate="CURDATE()";?
    167167                        else?
    168168                                $compDate="NULL";?
    169?                        ?
    ?169?
    170170                        $querystatement="UPDATE notes SET completed=".((int) $completed)." , completeddate=".$compDate." WHERE id=".((int) $id);?
    171171                        $queryresult=$this->db->query($querystatement);?
    172?                        ?
    ?172?
    173173                        if($completed && $type == "TS")?
    174174                                $this->repeatTask($id);?
    175?                        ?
    ?175?
    176176                        return "success";?
    177?                        ?
    178?                }?
    179?        ?
    180?                ?
    ?177?
    ?178                }?
    ?179?
    ?180?
    181181                function repeatTask($id, $dateToCheck = NULL){?
    182?                        if($dateToCheck == NULL) ?
    183?                                $dateToCheck = mktime(0,0,0);                           ?
    ?182                        if($dateToCheck == NULL)?
    ?183                                $dateToCheck = mktime(0,0,0);?
    184184                        //see if we need to grab the parent?
    185185                        $querystatement = "SELECT parentid,repeating FROM notes WHERE id=".((int) $id);?
    ? ? ?
    191191                                        return false;?
    192192?
    193?                        $querystatement = "SELECT notes.repeattype, notes.repeatevery, notes.startdate, notes.enddate, notes.firstrepeat, ?
    ?193                        $querystatement = "SELECT notes.repeattype, notes.repeatevery, notes.startdate, notes.enddate, notes.firstrepeat,?
    194194                                                                notes.lastrepeat,?
    195?                                                                notes.timesrepeated, notes.repeatontheday, notes.repeatontheweek, notes.repeateachlist, ?
    ?195                                                                notes.timesrepeated, notes.repeatontheday, notes.repeatontheweek, notes.repeateachlist,?
    196196                                                                notes.repeatuntil, notes.repeattimes?
    197197                                                                FROM notes WHERE repeating=1 AND id=".((int) $id)." AND type='TS'?
    ? ? ?
    207207                                else?
    208208                                        $startDate = stringToDate($therecord["startdate"],"SQL");?
    209?                                ?
    ?209?
    210210                                if($dateToCheck <= $startDate)?
    211211                                        $dateToCheck = strtotime("tomorrow",$startDate);?
    212212?
    213213                                $dateArray = $this->getValidInRange($startDate,$dateToCheck,$therecord);?
    214?                                ?
    ?214?
    215215                                foreach($dateArray as $date){?
    216216                                        if($date != $startDate){?
    ? ? ?
    219219                                                else?
    220220                                                        $enddate = NULL;?
    221?                                                        ?
    ?221?
    222222                                                $return = $this->createChildTask($id, $date, stringToDate($therecord["startdate"],"SQL"), $enddate );?
    223223                                                if($return){?
    ? ? ?
    228228                                                                $updatestatement .= "firstrepeat='".dateToString($date,"SQL")."',";?
    229229                                                        $updatestatement .="timesrepeated = timesrepeated+1 WHERE id =".$id;?
    230?                                                        ?
    ?230?
    231231                                                        $this->db->query($updatestatement);?
    232232?
    ? ? ?
    235235                                        }//endif?
    236236                                }//endforeach?
    237?                                ?
    ?237?
    238238                        }//endif?
    239239                }//end method?
    240?        ?
    ?240?
    241241?
    242242                function getValidInRange($startDate,$endDate,$therecord){?
    243243                        $nextDate = $startDate;?
    244?        ?
    ?244?
    245245                        //should pad the end date to make sure we get all weekly repeats?
    246246                        $endDate = strtotime("+7 days",$endDate);?
    247?                        ?
    ?247?
    248248                        $validDates = array();?
    249?                                        ?
    ?249?
    250250                        while($nextDate <= $endDate){?
    251?                                                ?
    ?251?
    252252                                switch($therecord["repeattype"]){?
    253253                                        case "Daily":?
    ? ? ?
    256256                                                $nextDate = strtotime("+".$therecord["repeatevery"]." days",$nextDate);?
    257257                                                break;?
    258?                                                ?
    259?                                        case "Weekly":                                                                                  ?
    ?258?
    ?259                                        case "Weekly":?
    260260                                                //==================================================================================?
    261261                                                $weekDayArray = explode("::",$therecord["repeateachlist"]);?
    262?        ?
    ?262?
    263263                                                //need to start from the sunday of the current week?
    264264                                                $tempDate = strtotime(nl_langinfo( constant("DAY_1") ),$nextDate);?
    265265                                                $tempDate = strtotime("-7 days",$tempDate);?
    266?                                                ?
    ?266?
    267267                                                foreach($weekDayArray as $weekday){?
    268268                                                        if($weekday == 7)?
    269269                                                                $validDates[]=$tempDate;?
    270270                                                        else{?
    271?                                                                $weekday++; ?
    ?271                                                                $weekday++;?
    272272                                                                $validDates[] = strtotime(nl_langinfo( constant("DAY_".$weekday) ),$tempDate);?
    273273                                                        }?
    274274                                                }// endforeach?
    275?                                                                                                                                                                                        ?
    276?                                                ?
    ?275?
    ?276?
    277277                                                $nextDate = strtotime("+".$therecord["repeatevery"]." week",$nextDate);?
    278?                                                ?
    279?                                                break;?
    280?                                        ?
    ?278?
    ?279                                                break;?
    ?280?
    281281                                        case "Monthly":?
    282282                                                //==================================================================================?
    283?                                                $dateArray = localtime($nextDate,true);                                         ?
    ?283                                                $dateArray = localtime($nextDate,true);?
    284284                                                $daysInMonth = date("d", mktime(0,0,0,$dateArray["tm_mon"],0,$dateArray["tm_year"]+1900) );?
    285?                                                ?
    ?285?
    286286                                                if($therecord["repeateachlist"]){?
    287287                                                        $dayArray = explode("::",$therecord["repeateachlist"]);?
    288?                                                        ?
    ?288?
    289289                                                        foreach($dayArray as $theday)?
    290?                                                                $validDates[] = mktime(0,0,0,$dateArray["tm_mon"]+1,$theday,$dateArray["tm_year"]+1900);                                                        ?
    291?                                                        ?
    ?290                                                                $validDates[] = mktime(0,0,0,$dateArray["tm_mon"]+1,$theday,$dateArray["tm_year"]+1900);?
    ?291?
    292292                                                } else{?
    293293                                                        // check for things like second tuesday or last friday;?
    294294                                                        $tempDate = mktime(0,0,0,$dateArray["tm_mon"]+1,1,$dateArray["tm_year"]+1900);?
    295295                                                        $weekday = $therecord["repeatontheday"];?
    296?                                                        $weekday = ($weekday == 7)? 1: ($weekday+1);                                                    ?
    ?296                                                        $weekday = ($weekday == 7)? 1: ($weekday+1);?
    297297                                                        if($therecord["repeatontheday"] != strftime("%u",$tempDate));?
    298298                                                                $tempDate = strtotime(nl_langinfo( constant("DAY_".$weekday) ),$tempDate);?
    299?                                                                ?
    ?299?
    300300                                                        while(date("n",$tempDate) == ($dateArray["tm_mon"]+1)){?
    301?                                                        ?
    ?301?
    302302                                                                if($therecord["repeatontheweek"] == 5){?
    303303                                                                        // 5 is the "last" option, so we just need to see if?
    ? ? ?
    305305                                                                        if($daysInMonth - date("d",$tempDate) < 7)?
    306306                                                                                $validDates[] = $tempDate;?
    307?                                                                                ?
    ?307?
    308308                                                                } else {?
    309309                                                                        if( ceil(date("d",$tempDate)/7) == $therecord["repeatontheweek"])?
    310?                                                                                $validDates[] = $tempDate;                                                                              ?
    ?310                                                                                $validDates[] = $tempDate;?
    311311                                                                }// endif?
    312?        ?
    ?312?
    313313                                                                $tempDate = strtotime("+7 days",$tempDate);?
    314?        ?
    ?314?
    315315                                                        }// endwhile?
    316316                                                }//endif?
    317?        ?
    ?317?
    318318                                                $nextDate = strtotime("+".$therecord["repeatevery"]." months", $nextDate);?
    319319                                                break;?
    320?                                                ?
    ?320?
    321321                                        case "Yearly":?
    322322                                                //==================================================================================?
    323323                                                $monthArray = explode("::",$therecord["repeateachlist"]);?
    324324                                                foreach($monthArray as $monthNum){?
    325?                                                        $dateArray = localtime($nextDate,true);                                         ?
    ?325                                                        $dateArray = localtime($nextDate,true);?
    326326                                                        $daysInMonth = date("d", mktime(0,0,0,$monthNum,0,$dateArray["tm_year"]+1900) );?
    327?        ?
    ?327?
    328328                                                        if(!$therecord["repeatontheday"]){?
    329329                                                                $tempDay = ($dateArray["tm_mday"] > $daysInMonth)? $daysInMonth :$dateArray["tm_mday"];?
    330330                                                                $validDates[] = mktime(0,0,0,$monthNum,$tempDay,$dateArray["tm_year"]+1900);?
    331?        ?
    ?331?
    332332                                                        } else {?
    333333                                                                // check for things like second tuesday or last friday;?
    334334                                                                $tempDate = mktime(0,0,0,$monthNum,1,$dateArray["tm_year"]+1900);?
    335?                                                                ?
    ?335?
    336336                                                                $weekday = $therecord["repeatontheday"];?
    337?                                                                $weekday = ($weekday == 7)? 1: ($weekday+1);                                                    ?
    ?337                                                                $weekday = ($weekday == 7)? 1: ($weekday+1);?
    338338                                                                if($therecord["repeatontheday"] != strftime("%u",$tempDate));?
    339339                                                                        $tempDate = strtotime(nl_langinfo( constant("DAY_".$weekday) ),$tempDate);?
    340?                                                                ?
    341?                                                                ?
    ?340?
    ?341?
    342342                                                                while(date("n",$tempDate) == $monthNum){?
    343343                                                                        if($therecord["repeatontheweek"] == 5){?
    ? ? ?
    346346                                                                                if($daysInMonth - date("d",$tempDate) < 7)?
    347347                                                                                        $validDates[] = $tempDate;?
    348?                                                                                        ?
    ?348?
    349349                                                                        } else {?
    350350                                                                                if( ceil(date("d",$tempDate)/7) == $therecord["repeatontheweek"])?
    351?                                                                                        $validDates[] = $tempDate;                                                                              ?
    ?351                                                                                        $validDates[] = $tempDate;?
    352352                                                                        }// endif?
    353?                ?
    ?353?
    354354                                                                        $tempDate = strtotime("+7 days",$tempDate);?
    355?                ?
    ?355?
    356356                                                                }// endwhile?
    357?        ?
    358?                                                        }//endif                        ?
    359?        ?
    ?357?
    ?358                                                        }//endif?
    ?359?
    360360                                                }//endforeach?
    361?        ?
    ?361?
    362362                                                $nextDate = strtotime("+".$therecord["repeatevery"]." years",$nextDate);?
    363?        ?
    ?363?
    364364                                                break;?
    365365                                }//endswitch?
    366?                                                        ?
    ?366?
    367367                        }//end while?
    368?                        ?
    ?368?
    369369                        return $validDates;?
    370?                        ?
    ?370?
    371371                }//end method?
    372?                ?
    ?372?
    373373?
    374374                function createChildTask($parentid, $newdate, $startdate, $enddate=NULL){?
    375?                        ?
    ?375?
    376376                        //let's check to see if the new task already exists?
    377377                        $querystatement = "SELECT id FROM notes WHERE parentid=".$parentid." AND startdate='".dateToString($newdate,"SQL")."'";?
    ? ? ?
    379379                        if($this->db->numRows($queryresult))?
    380380                                return false;?
    381?                                                                ?
    ?381?
    382382                        $newenddate="NULL";?
    383?                        if($enddate)                    ?
    ?383                        if($enddate)?
    384384                                $newenddate="\"".dateToString($newdate+($enddate-$startdate),"SQL")."\"";?
    385?                                                ?
    ?385?
    386386                        $querystatement="SELECT id,type,subject,content,status,starttime,private,modifiedby,location,importance,endtime,CURDATE() as creationdate,createdby,category,?
    387387                                                attachedtabledefid,attachedid,assignedtoid,assignedtodate,assignedtotime,assignedbyid?
    388388                                                FROM notes WHERE id=".$parentid;?
    389389                        $queryresult=$this->db->query($querystatement);?
    390?        ?
    ?390?
    391391                        $therecord=$this->db->fetchArray($queryresult);?
    392?                ?
    ?392?
    393393                        $querystatement="SELECT id FROM notes WHERE parentid=".((int) $parentid)." AND completed=0 AND startdate=\"".dateToString($newdate,"SQL")."\"";?
    394394                        $queryresult=$this->db->query($querystatement);?
    395?        ?
    ?395?
    396396                        if($this->db->numRows($queryresult))?
    397?                                return false;           ?
    398?                        ?
    ?397                                return false;?
    ?398?
    399399                        if(!$therecord["assignedtoid"])?
    400400                                $therecord["assignedtoid"]="NULL";?
    401?                                                ?
    ?401?
    402402                        $querystatement="INSERT INTO notes (parentid,startdate,enddate,completed,completeddate,?
    403403                                                type,subject,content,status,starttime,private,modifiedby,location,importance,endtime,creationdate,createdby,category,?
    ? ? ?
    412412                        else?
    413413                                $querystatement.="NULL, ";?
    414?                        ?
    ?414?
    415415                        $querystatement.=$therecord["private"].", ";?
    416416                        $querystatement.=$therecord["modifiedby"].", ";?
    ? ? ?
    430430                                $querystatement.="\"".$therecord["assignedtodate"]."\", ";?
    431431                        else?
    432?                                $querystatement.="NULL, ";                      ?
    ?432                                $querystatement.="NULL, ";?
    433433                        if($therecord["assignedtotime"])?
    434434                                $querystatement.="\"".$therecord["assignedtotime"]."\", ";?
    ? ? ?
    436436                                $querystatement.="NULL, ";?
    437437                        $querystatement.=$therecord["assignedbyid"].") ";?
    438?                        ?
    ?438?
    439439                        $queryresult=$this->db->query($querystatement);?
    440?                        ?
    ?440?
    441441                        return true;?
    442442                }//end method?
    443?        ?
    444?        ?
    ?443?
    ?444?
    445445                function getAttachedTableDefInfo($id){?
    446446                        if($id){?
    ? ? ?
    452452                                $therecord["editfile"]="";?
    453453                        }?
    454?                                        ?
    455?                        return $therecord;      ?
    456?                }?
    457?        ?
    458?        ?
    ?454?
    ?455                        return $therecord;?
    ?456                }?
    ?457?
    ?458?
    459459                //CLASS OVERRIDES =============================================================================?
    460?        ?
    ?460?
    461461                function getDefaults(){?
    462462                        $therecord = parent::getDefaults();?
    463?                        ?
    ?463?
    464464                        if(isset($_GET["ty"]))?
    465465                                $therecord["type"]=$_GET["ty"];?
    466466                        else?
    467467                                $therecord["type"]="NT";?
    468?        ?
    ?468?
    469469                        $therecord["private"]=true;?
    470?        ?
    ?470?
    471471                        $therecord["attachedtabledefid"]=(isset($_GET["tabledefid"]))?$_GET["tabledefid"]:NULL;?
    472472                        $therecord["attachedid"]=(isset($_GET["refid"]))?$_GET["refid"]:NULL;?
    ? ? ?
    476476                                $therecord["attachedid"]=$_GET["cid"];?
    477477                        }?
    478?        ?
    ?478?
    479479                        $therecord["repeatevery"] = 1;?
    480480                        $therecord["repeattype"] = "Daily";?
    481?                        ?
    ?481?
    482482                        return $therecord;?
    483483                }?
    484?                ?
    485?                ?
    486?                function formatVariables($variables,$userid){?
    ?484?
    ?485?
    ?486                function verifyVariables($variables){?
    ?487?
    ?488                        //table default ok?
    ?489                        if(isset($variables["type"])){?
    ?490                                switch($variables["type"]){?
    ?491?
    ?492                                        case "NT":?
    ?493                                        case "TS":?
    ?494                                        case "EV":?
    ?495                                                break;?
    ?496?
    ?497                                        case "SM":?
    ?498                                                //for system message, not private?
    ?499                                                if(isset($variables["private"]))?
    ?500                                                        if($variables["private"])?
    ?501                                                                $this->verifyErrors[] = "For records with `type` of 'SM' (System Message), the `private?
    ?502                                                                                                field must be equivalent to 0.";?
    ?503                                                break;?
    ?504?
    ?505                                        default:?
    ?506                                                $this->verifyErrors[] = "The `type` field given is not an acceptable value. Acceptable values are 'NT', 'TS', 'EV', or 'SM'";?
    ?507                                                break;?
    ?508?
    ?509                                }//end switch?
    ?510                        }//end if?
    ?511?
    ?512                        //Doesn't need to be set... only used if repeating?
    ?513?
    ?514                        if(isset($variables["repeat"]))?
    ?515                                if($variables["repeat"])?
    ?516                                        if(isset($variables["startdate"])){?
    ?517                                                if($variables["startdate"]){?
    ?518?
    ?519                                                }else?
    ?520                                                        $this->verifyErrors[] = "If a `note` record is set to repeat it must also have a `startdate`.";?
    ?521                                        }else?
    ?522                                                $this->verifyErrors[] = "If a `note` record is set to repeat it must also have a `startdate`.";?
    ?523?
    ?524                        if(isset($variables["repeattype"]))?
    ?525                                if($variables["repeattype"])//it can be "" or NULL?
    ?526                                        switch($variables["repeattype"]){?
    ?527?
    ?528?
    ?529                                                case "Daily":?
    ?530                                                case "Weekly":?
    ?531                                                case "Monthly":?
    ?532                                                case "Yearly":?
    ?533                                                        break;?
    ?534?
    ?535                                                default:?
    ?536                                                        $this->verifyErrors[] = "The `repeatetype` field given is not an acceptable value.?
    ?537                                                                                        Acceptable values are 'Daily', 'Weekly', 'Monthly', or 'Yearly'";?
    ?538                                                        break;?
    ?539?
    ?540                                        }//end switch?
    ?541?
    ?542?
    ?543                        //check booleans?
    ?544                        if(isset($variables["completed"]))?
    ?545                                if($variables["completed"] && $variables["completed"] != 1)?
    ?546                                        $this->verifyErrors[] = "The `completed` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?547?
    ?548                        if(isset($variables["private"]))?
    ?549                                if($variables["private"] && $variables["private"] != 1)?
    ?550                                        $this->verifyErrors[] = "The `private` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?551?
    ?552                        if(isset($variables["repeating"]))?
    ?553                                if($variables["repeating"] && $variables["repeating"] != 1)?
    ?554                                        $this->verifyErrors[] = "The `repeating` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?555?
    ?556                        return parent::verifyVariables($variables);?
    ?557?
    ?558                }//end method --verifyVariables--?
    ?559?
    ?560?
    ?561                function prepareVariables($variables,$userid = NULL){?
    ?562?
    ?563                        if($userid == NULL)?
    ?564                                if(isset($_SESSION["userinfo"]["id"]))?
    ?565                                        $userid = $_SESSION["userinfo"]["id"];?
    ?566?
    ?567                                if($variables["id"]){ //i.e. only on update?
    ?568?
    ?569                                        unset($this->fields["type"]);?
    ?570?
    ?571                                        if($variables["typeCheck"]=="TS" && isset($variables["repeating"]) && $variables["lastrepeat"]){?
    ?572                                                $variables["lastrepeat"] = NULL;?
    ?573                                                $variables["firstrepeat"] = NULL;?
    ?574                                                $variables["timesrepeated"] = NULL;?
    ?575?
    ?576                                                if(isset($variables["completed"]))?
    ?577                                                        $variables["completedChange"] = 0;?
    ?578?
    ?579                                                $this->resetRepeating($variables["id"]);?
    ?580                                        }//end if?
    ?581?
    ?582                                }//end if?
    487583?
    488584                                if(isset($variables["thetype"]))?
    489585                                        $variables["type"] = $variables["thetype"];?
    490?                                ?
    ?586?
    491587                                if(!isset($variables["completed"]))?
    492588                                        $variables["completeddate"] = NULL;?
    493?        ?
    ?589?
    494590                                if($variables["enddate"] == "") {?
    495591                                        $variables["enddate"] = NULL;?
    496592                                        $variables["endtime"] = NULL;?
    497593                                }?
    498?        ?
    ?594?
    499595                                if($variables["startdate"] == "") {?
    500596                                        $variables["startdate"] = NULL;?
    501597                                        $variables["starttime"] = NULL;?
    502598                                }?
    503?                                ?
    ?599?
    504600                                if(isset($variables["repeating"])) {?
    505?                                        ?
    ?601?
    506602                                        $thename="Every ";?
    507?                                                                        ?
    ?603?
    508604                                        switch($variables["repeattype"]){?
    509605                                                case "Daily":?
    ? ? ?
    512608                                                        else?
    513609                                                                $thename .= " day ";?
    514?                                                        ?
    ?610?
    515611                                                        $variables["repeatechlist"] = NULL;?
    516612                                                        $variables["repeatontheday"] = NULL;?
    517613                                                        $variables["repeatontheweek"] = NULL;?
    518614                                                break;?
    519?                        ?
    ?615?
    520616                                                case "Weekly":?
    521617                                                        if($variables["repeatevery"] != 1)?
    ? ? ?
    523619                                                        else?
    524620                                                                $thename .= "week on";?
    525?                                                                ?
    ?621?
    526622                                                        foreach(explode("::",$variables["eachlist"]) as $dayNum){?
    527623                                                                $tempday = ($dayNum != 7)?($dayNum+1):(1);?
    ? ? ?
    529625                                                        }?
    530626                                                        $thename = substr($thename,0,strlen($thename)-2);?
    531?                        ?
    ?627?
    532628                                                        if(strpos($thename,",") != false)?
    533629                                                                $thename = strrev(preg_replace("/,/","dna ",strrev($thename),1));?
    534?                                                        ?
    ?630?
    535631                                                        $variables["repeateachlist"] = $variables["eachlist"];?
    536632                                                        $variables["repeatontheday"] = NULL;?
    537633                                                        $variables["repeatontheweek"] = NULL;?
    538634                                                break;?
    539?                        ?
    540?                                                case "Monthly":                 ?
    ?635?
    ?636                                                case "Monthly":?
    541637                                                        if($variables["repeatevery"] != 1)?
    542638                                                                $thename .= $variables["repeatevery"]." months";?
    543639                                                        else?
    544640                                                                $thename .= "month";?
    545?                        ?
    ?641?
    546642                                                        $thename .= " on the";?
    547643                                                        if($variables["monthlyWhat"] == 1){?
    548?                                                        ?
    ?644?
    549645                                                                foreach(explode("::",$variables["eachlist"]) as $dayNum)?
    550646                                                                        $thename .=" ".ordinal($dayNum).", ";?
    551?                        ?
    ?647?
    552648                                                                $thename = substr($thename,0,strlen($thename)-2);?
    553?                        ?
    ?649?
    554650                                                                if(strpos($thename,",") != false)?
    555651                                                                        $thename = strrev(preg_replace("/,/","dna ",strrev($thename),1));?
    556?                        ?
    ?652?
    557653                                                                $variables["repeateachlist"] = $variables["eachlist"];?
    558654                                                                $variables["repeatontheday"] = NULL;?
    ? ? ?
    562658                                                                        if($value == $variables["monthlyontheweek"])?
    563659                                                                                $thename .= " ".strtolower($key);?
    564?                        ?
    ?660?
    565661                                                                foreach($this->dayOfWeekArray as $key=>$value)?
    566662                                                                        if($value == $variables["monthlyontheday"])?
    ? ? ?
    572668                                                        }?
    573669                                                break;?
    574?                                                ?
    ?670?
    575671                                                case "Yearly":?
    576672                                                        if($variables["repeatevery"] > 1)?
    ? ? ?
    578674                                                        else?
    579675                                                                $thename .= "year";?
    580?                                                        ?
    ?676?
    581677                                                        $thename .= " in";?
    582?                                                        ?
    ?678?
    583679                                                        foreach(explode("::",$variables["eachlist"]) as $monthNum)?
    584680                                                                $thename .=" ".nl_langinfo(constant("MON_".$monthNum)).", ";?
    585?                                                                ?
    ?681?
    586682                                                        $thename = substr($thename,0,strlen($thename)-2);?
    587683                                                        if(strpos($thename,",") != false)?
    588684                                                                $thename = strrev(preg_replace("/,/","dna ",strrev($thename),1));?
    589?                                                                ?
    ?685?
    590686                                                        $variables["repeateachlist"] = $variables["eachlist"];?
    591?                        ?
    ?687?
    592688                                                        if(isset($variables["yearlyOnThe"])){?
    593689                                                                $thename .= " on the";?
    ? ? ?
    595691                                                                        if($value == $variables["yearlyontheweek"])?
    596692                                                                                $thename .= " ".strtolower($key);?
    597?                                                                ?
    ?693?
    598694                                                                foreach($this->dayOfWeekArray as $key=>$value)?
    599695                                                                        if($value == $variables["yearlyontheday"])?
    600696                                                                                $thename .= " ".$key;?
    601?                        ?
    ?697?
    602698                                                                $variables["repeatontheday"] = $variables["yearlyontheday"];?
    603699                                                                $variables["repeatontheweek"] = $variables["yearlyontheweek"];?
    604700?
    605701                                                        } else {?
    606?                                                        ?
    ?702?
    607703                                                                $variables["repeatontheday"] = NULL;?
    608704                                                                $variables["repeatontheweek"] = NULL;?
    609?                                                                ?
    ?705?
    610706                                                        }//end if?
    611707                                                break;?
    612708                                        }?
    613?                        ?
    ?709?
    614710                                        switch($variables["repeatend"]){?
    615711                                                case "never":?
    ? ? ?
    617713                                                        $variables["repeattimes"] = NULL;?
    618714                                                        break;?
    619?                                                        ?
    ?715?
    620716                                                case "after":?
    621717                                                        $thename .= " for ".$variables["repeattimes"];?
    622?                                                        ?
    ?718?
    623719                                                        $variables["repeatuntil"] = NULL;?
    624720                                                        break;?
    625?                                                        ?
    ?721?
    626722                                                case "on date":?
    627723                                                        $thename .= " until ".$variables["repeatuntil"];?
    ? ? ?
    631727                                        $thename = trim($thename).".";?
    632728                                        $variables["repeatname"] = $thename;?
    633?                                        ?
    ?729?
    634730                                        $variables["firstrepeat"] = dateToString(stringToDate($variables["firstrepeat"],"SQL"));?
    635731                                        $variables["lastrepeat"] = dateToString(stringToDate($variables["lastrepeat"],"SQL"));;?
    636?                                        $variables["timesrepeated"] = NULL;                                     ?
    637?                                                                ?
    ?732                                        $variables["timesrepeated"] = NULL;?
    ?733?
    638734                                }else {?
    639735?
    ? ? ?
    645741                                        $variables["repeatuntil"] = NULL;?
    646742                                        $variables["repeattimes"] = NULL;?
    647?                                        ?
    ?743?
    648744                                        $variables["firstrepeat"] = NULL;?
    649745                                        $variables["lastrepeat"] = NULL;?
    ? ? ?
    654750                                if($variables["assignedtoid"] != $variables["assignedtochange"]){?
    655751                                        if($variables["assignedtoid"] != "")?
    656?                                                $variables["assignedbyid"] = $userid; ?
    ?752                                                $variables["assignedbyid"] = $userid;?
    657753                                        else?
    658?                                                $variables["assignedbyid"] = 0; ?
    ?754                                                $variables["assignedbyid"] = 0;?
    659755                                }//endif?
    660756?
    661757                        return $variables;?
    ?758?
    662759                }//end method?
    663?                ?
    664?                ?
    ?760?
    ?761?
    665762                function updateRecord($variables, $modifiedby = NULL){?
    666?                        ?
    667?                        if($modifiedby == NULL)?
    668?                                $modifiedby = $_SESSION["userinfo"]["id"];?
    669?                        ?
    670?                        if($variables["typeCheck"]=="TS" && isset($variables["repeating"]) && $variables["lastrepeat"]){?
    671?                                $variables["lastrepeat"] = NULL;?
    672?                                $variables["firstrepeat"] = NULL;?
    673?                                $variables["timesrepeated"] = NULL;?
    674?                                ?
    675?                                if(isset($variables["completed"]))?
    676?                                        $variables["completedChange"] = 0;?
    677?                                        ?
    678?                                $this->resetRepeating($variables["id"]);?
    679?                        }?
    680?                        ?
    681?                        $variables = $this->formatVariables($variables,$modifiedby);?
    682??
    683?                        parent::updateRecord($variables, $modifiedby);?
    684??
    685?                        if($variables["typeCheck"]=="TS" && isset($variables["completed"]) && $variables["completedChange"]==0) {                               ?
    ?763?
    ?764                        $thereturn = parent::updateRecord($variables, $modifiedby);?
    ?765?
    ?766                        $this->getTableInfo();?
    ?767?
    ?768                        if($variables["typeCheck"]=="TS" && isset($variables["completed"]) && $variables["completedChange"]==0) {?
    686769                                        if($variables["parentid"]){?
    687770                                                if(!$this->newerRepeats($variables["parentid"],$variables["id"])){?
    688771                                                        $this->repeatTask($variables["parentid"]);?
    689772                                                }?
    690?                                                        ?
    ?773?
    691774                                        } elseif(isset($variables["repeating"])) {?
    692775                                                if(!$this->newerRepeats($variables["id"],$variables["id"])){?
    693776                                                        $this->repeatTask($variables["id"]);?
    694777                                                }?
    695?                                                        ?
    ?778?
    696779                                        }//endif elseif?
    697?                        }//endif                                                ?
    698?                                                ?
    ?780                        }//endif?
    ?781?
    ?782                        return $thereturn;?
    ?783?
    699784                }//end endmethod?
    700785?
    701?        ?
    ?786?
    702787                function insertRecord($variables, $createdby = NULL){?
    703?                        ?
    704?                        if($createdby == NULL)?
    705?                                $createdby = $_SESSION["userinfo"]["id"];?
    706?                        ?
    707?                        $variables = $this->formatVariables($variables,$createdby);?
    708?                ?
    ?788?
    709789                        $newid = parent::insertRecord($variables, $createdby);?
    710?                        ?
    ?790?
    711791                        if(isset($variables["completed"]) && isset($variables["repeating"]))?
    712792                                $this->repeatTask($newid);?
    713?                        ?
    ?793?
    714794                        return $newid;?
    715795                }//end method?
    716?        ?
    ?796?
    717797        }//end class?
    718798}//end if?
    ? ? ?
    722802?
    723803                function mark_asread(){?
    724?                ?
    ?804?
    725805                        //passed variable is array of user ids to be revoked?
    726806                        $whereclause = $this->buildWhereClause();?
    727?                        ?
    ?807?
    728808                        $querystatement = "UPDATE notes SET notes.completed=1,modifiedby=\"".$_SESSION["userinfo"]["id"]."\" WHERE (".$whereclause.") AND type!=\"SM\";";?
    729809                        $queryresult = $this->db->query($querystatement);?
    ? ? ?
    732812?
    733813                        $message.=" marked as completed/read.";?
    734?                        ?
    ?814?
    735815                        //for repeatable tasks, need to repeat dem!?
    736816                        $querystatement="SELECT id,parentid FROM notes WHERE type='TS' AND ((parentid IS NOT NULL AND parentid!=0 ) OR `repeating`=1) AND (".$whereclause.")";?
    737817                        $queryresult = $this->db->query($querystatement);?
    738818                        if ($this->db->numRows($queryresult)){?
    739?                        ?
    ?819?
    740820                                $thetable = new notes($this->db,12);?
    741821?
    742822                                while($therecord=$db->fetchArray($queryresult)){?
    743?                                        if($variables["parentid"])                                      ?
    ?823                                        if($variables["parentid"])?
    744824                                                if(!$thetable->newerRepeats($therecord["parentid"],$therecord["id"]))?
    745825                                                        $thetable->repeatTask($therecord["parentid"]);?
    ? ? ?
    748828                                                        $thetable->repeatTask($therecord["id"]);?
    749829                                }//endwhile?
    750?                                ?
    ?830?
    751831                        }//endif?
    752?                                        ?
    ?832?
    753833                        return $message;?
    754834                }?
    755?                ?
    756?                ?
    ?835?
    ?836?
    757837                //delete notes?
    758838                function delete_record(){?
    759?                        ?
    ?839?
    760840                        //passed variable is array of user ids to be revoked?
    761841                        $whereclause = $this->buildWhereClause("notes.id");?
    762?                ?
    ?842?
    763843                        //we need to check for incomplete repeatable child tasks?
    764844                        $querystatement="SELECT notes.id, notes.parentid, notes.repeating, notes.completed?
    765845                        FROM notes WHERE (".$whereclause.") AND ((notes.createdby=".$_SESSION["userinfo"]["id"]." OR notes.assignedtoid=".$_SESSION["userinfo"]["id"].")?
    766846                                                                 OR (".$_SESSION["userinfo"]["admin"]." =1))";?
    767?                                                                 ?
    ?847?
    768848                        $repeatqueryresult = $this->db->query($querystatement);?
    769?                                        ?
    ?849?
    770850                        //repeat where applicable?
    771851                        if ($this->db->numRows($repeatqueryresult)){?
    772?                ?
    ?852?
    773853                                $thetable = new notes($this->db,12);?
    774?                                ?
    ?854?
    775855                                $repeatArray=array();?
    776856                                $orphanArray= array();?
    777857                                while($therecord=$this->db->fetchArray($repeatqueryresult)){?
    778?                                ?
    ?858?
    779859                                        if($therecord["parentid"] && $therecord["completed"] == 0){?
    780860                                                $repeatArray[] = array("parentid" => $therecord["parentid"], "id"=> $therecord["id"]);?
    ? ? ?
    782862                                                $orphanArray[] = array("id" => $therecord["id"]);?
    783863                                        }//endif elseif?
    784?                                        ?
    ?864?
    785865                                }//endwhile?
    786?                                ?
    ?866?
    787867                                foreach($repeatArray as $repeat){?
    788868                                        if (!in_array($repeat["parentid"],$orphanArray))?
    ? ? ?
    790870                                                        $thetable->repeatTask($repeat["parentid"]);?
    791871                                }//end foreach?
    792?                                ?
    ?872?
    793873                                foreach($orphanArray as $orphaner){?
    794874                                        $thetable->resetRepeating($orphaner);?
    795875                                }?
    796?                                ?
    ?876?
    797877                        }//end if?
    798878?
    799?                        $querystatement = "DELETE FROM notes WHERE ?
    ?879                        $querystatement = "DELETE FROM notes WHERE?
    800880                                                                ((notes.createdby=".$_SESSION["userinfo"]["id"]." OR notes.assignedtoid=".$_SESSION["userinfo"]["id"].")?
    801?                                                                 OR (".$_SESSION["userinfo"]["admin"]." =1)) ?
    ?881                                                                 OR (".$_SESSION["userinfo"]["admin"]." =1))?
    802882                                                                 AND (".$whereclause.")";?
    803883                        $queryresult = $this->db->query($querystatement);?
    804?                ?
    ?884?
    805885                        $message = $this->buildStatusMessage();?
    806886                        $message.=" deleted";?
    807?                        ?
    ?887?
    808888                        return $message;?
    809?                ?
    810?                }       ?
    811?        ?
    ?889?
    ?890                }?
    ?891?
    812892        }//end class?
    813893}//end if?
  • trunk/phpbms/modules/base/include/relationships.php

    r285 r485 ?
    3939if(class_exists("phpbmsTable")){?
    4040        class relationships extends phpbmsTable{?
    41?                ?
    ?41?
    ?42                var $availableTabledefIDs = array();?
    ?43                var $availableTabledefNames = array();?
    ?44?
    ?45                //function populateds the tabledef ids?
    ?46                //and the tabledef names corresponding to those ids?
    ?47                function populateTabledefArrays(){?
    ?48?
    ?49                        $this->availableTabledefIDs = array();?
    ?50                        $this->availableTabledefNames = array();?
    ?51?
    ?52                        $querystatement = "?
    ?53                                SELECT?
    ?54                                        `id`,?
    ?55                                        `displayname`?
    ?56                                FROM?
    ?57                                        `tabledefs`?
    ?58                                WHERE?
    ?59                                        `type` != 'view'?
    ?60                                ORDER BY?
    ?61                                        `displayname`;?
    ?62                                ";?
    ?63?
    ?64                        $queryresult = $this->db->query($querystatement);?
    ?65?
    ?66                        if($this->db->numRows($queryresult)){?
    ?67                                while($therecord = $this->db->fetchArray($queryresult)){?
    ?68?
    ?69                                        $this->availableTabledefIDs[] = $therecord["id"];?
    ?70                                        $this->availableTabledefNames[] = $therecord["displayname"];?
    ?71?
    ?72                                }//end while?
    ?73                        }else{?
    ?74                                //if no valid id/names, I put in a value that will?
    ?75                                //give the arrays a count but not actually match any integers?
    ?76                                $this->availableTabledefIDs[] = "none";?
    ?77                                $this->availableTabledefNames[] = "none";?
    ?78                        }//end if?
    ?79?
    ?80                }//end method --populateArrays--?
    ?81?
    ?82?
    ?83                function verifyVariables($variables){?
    ?84?
    ?85                        //cannot be table default ("")?
    ?86                        if(isset($variables["tofield"])){?
    ?87                                if($variables["tofield"] === "" || $variables["tofield"] === NULL)?
    ?88                                        $this->verifyErrors[] = "The `tofield` field cannot be blank.";?
    ?89                        }else?
    ?90                                $this->verifyErrors[] = "The `tofield` field must be set.";?
    ?91?
    ?92                        //cannot be table default ("")?
    ?93                        if(isset($variables["fromfield"])){?
    ?94                                if($variables["fromfield"] === "" || $variables["fromfield"] === NULL)?
    ?95                                        $this->verifyErrors[] = "The `from` field cannot be blank.";?
    ?96                        }else?
    ?97                                $this->verifyErrors[] = "The `fromfield` field must be set.";?
    ?98?
    ?99                        //cannot be table default (0)?
    ?100                        if(isset($variables["fromtableid"])){?
    ?101?
    ?102                                //must be a positive number?
    ?103                                if(((int) $variables["fromtableid"]) > 0 ){?
    ?104?
    ?105                                        if(!count($this->availableTabledefIDs))?
    ?106                                                $this->populateTableDefArrays();?
    ?107?
    ?108                                        if(!in_array(((int)$variables["fromtableid"]), $this->availableTabledefIDs))?
    ?109                                                $this->verifyErrors[] = "The `fromtableid` field does not give an existing/acceptable parent id number.";?
    ?110                                }else?
    ?111                                        $this->verifyErrors[] = "The `fromtableid` field must be a positive number.";?
    ?112?
    ?113                        }else?
    ?114                                $this->verifyErrors[] = "The `fromtableid` field must be set.";?
    ?115?
    ?116                        //cannot be table default (0)?
    ?117                        if(isset($variables["totableid"])){?
    ?118?
    ?119                                //must be a positive number?
    ?120                                if(((int) $variables["totableid"]) > 0 ){?
    ?121?
    ?122                                        if(!count($this->availableTabledefIDs))?
    ?123                                                $this->populateTableDefArrays();?
    ?124?
    ?125                                        if(!in_array(((int)$variables["totableid"]), $this->availableTabledefIDs))?
    ?126                                                $this->verifyErrors[] = "The `totableid` field does not give an existing/acceptable to table id number.";?
    ?127                                }else?
    ?128                                        $this->verifyErrors[] = "The `totableid` field must be a positive number.";?
    ?129                        }else?
    ?130                                $this->verifyErrors[] = "The `totableid` field must be set.";?
    ?131?
    ?132                        //check boolean?
    ?133                        if(isset($variables["inherit"]))?
    ?134                                if($variables["inherit"] && $variables["inherit"] != 1)?
    ?135                                        $this->verifyErrors[] = "The `inherit` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?136?
    ?137                        return parent::verifyVariables($variables);?
    ?138?
    ?139                }//end method --verifyVariables--?
    ?140?
    ?141?
    42142                function displayTables($fieldname,$selectedid){?
    43?                        ?
    44?                        $querystatement="SELECT id, displayname FROM tabledefs WHERE type!=\"view\" ORDER BY displayname";?
    45?                        $thequery=$this->db->query($querystatement);?
    46?                        ?
    ?143?
    ?144                        if(!count($this->availableTabledefIDs) || !count($this->availableTabledefNames))?
    ?145                                $this->populateTabledefArrays();?
    ?146?
    47147                        echo "<select id=\"".$fieldname."\" name=\"".$fieldname."\">\n";?
    48?                        while($therecord=$this->db->fetchArray($thequery)){?
    49?                                echo "  <option value=\"".$therecord["id"]."\"";?
    50?                                        if($selectedid==$therecord["id"]) echo " selected=\"selected\"";?
    51?                                echo ">".$therecord["displayname"]."</option>\n";?
    ?148?
    ?149                        for($i = 0; $i < count($this->availableTabledefIDs); $i++){?
    ?150                                echo "  <option value=\"".$this->availableTabledefIDs[$i]."\"";?
    ?151                                        if($selectedid==$this->availableTabledefIDs[$i]) echo " selected=\"selected\"";?
    ?152                                echo ">".$this->availableTabledefNames[$i]."</option>\n";?
    52153                        }?
    53?                ?
    ?154?
    54155                        echo "</select>\n";?
    55156                }?
    56?        ?
    ?157?
    57158        }//end class?
    58159}//end if?
  • trunk/phpbms/modules/base/include/reports.php

    r285 r485 ?
    3939if(class_exists("phpbmsTable")) {?
    4040        class reports extends phpbmsTable{?
    41?        ?
    ?41?
    ?42                var $availableTabledefIDs = array();?
    ?43                var $availableRoleIDs = array();?
    ?44?
    4245                function getDefaults(){?
    4346                        $therecord = parent::getDefaults();?
    44?                        ?
    ?47?
    4548                        $therecord["type"]="report";?
    46?                        ?
    ?49?
    4750                        return $therecord;?
    48?                        ?
    ?51?
    4952                }?
    50?        ?
    ?53?
    ?54                //populates tabledef id array?
    ?55                function populateTabledefArray(){?
    ?56?
    ?57                        $this->availableTabledefIDs = array();?
    ?58?
    ?59                        $querystatement = "?
    ?60                                SELECT?
    ?61                                        `id`?
    ?62                                FROM?
    ?63                                        `tabledefs`;?
    ?64                                ";?
    ?65?
    ?66                        $queryresult = $this->db->query($querystatement);?
    ?67?
    ?68                        //This is for the "global" option?
    ?69                        $this->availableTabledefIDs[] = 0;?
    ?70?
    ?71                        while($therecord = $this->db->fetchArray($queryresult))?
    ?72                                $this->availableTabledefIDs[] = $therecord["id"];?
    ?73?
    ?74?
    ?75?
    ?76                }//end method --populateRoleArray--?
    ?77?
    ?78                //populates role id array?
    ?79                function populateRoleArray(){?
    ?80?
    ?81                        $this->availableRoleIDs = array();?
    ?82?
    ?83                        $querystatement = "?
    ?84                                SELECT?
    ?85                                        `id`?
    ?86                                FROM?
    ?87                                        `roles`;?
    ?88                                ";?
    ?89?
    ?90                        $queryresult = $this->db->query($querystatement);?
    ?91?
    ?92                        //These two are added for no restriction on the role (0) and for?
    ?93                        //administrative restrictioin (-100)?
    ?94                        $this->availableRoleIDs[] = 0;?
    ?95                        $this->availableRoleIDs[] = -100;?
    ?96?
    ?97                        while($therecord = $this->db->fetchArray($queryresult))?
    ?98                                $this->availableRoleIDs[] = $therecord["id"];?
    ?99?
    ?100                }//end method --populateRoleArray--?
    ?101?
    ?102?
    ?103                function verifyVariables($variables){?
    ?104?
    ?105                        //cannot be table default ("")?
    ?106                        if(isset($variables["reportfile"])){?
    ?107                                if($variables["reportfile"] === "" || $variables["reportfile"] === NULL)?
    ?108                                        $this->verifyErrors[] = "The `reportfile` field must not be blank.";?
    ?109                        }else?
    ?110                                $this->verifyErrors[] = "The `reportfile` field must be set.";?
    ?111?
    ?112                        //Table default (NULL) OK?
    ?113                        if(isset($variables["type"]))?
    ?114                                if($variables["type"])//don't care if it's ""?
    ?115                                        switch($variables["type"]){?
    ?116                                                case "report":?
    ?117                                                case "PDF Report":?
    ?118                                                case "export":?
    ?119                                                        break;?
    ?120?
    ?121                                                default:?
    ?122                                                        $this->verifyErrors[] = "The `type` field is not an accepted value.  It must be 'report', 'PDF Report', or 'export.";?
    ?123                                                break;?
    ?124?
    ?125                                        }//end switch?
    ?126?
    ?127                        //Table Default (0) ok becuase it means report is globally available to any table?
    ?128                        if(isset($variables["tabledefid"])){?
    ?129?
    ?130                                //must be a non-negative number or NULL/""?
    ?131                                if( (!$variables["tabledefid"]) || ((int)$variables["tabledefid"]) > 0 ){?
    ?132?
    ?133                                        if(!count($this->availableTabledefIDs))?
    ?134                                                $this->populateTabledefArray();?
    ?135?
    ?136                                        if( !in_array((int)$variables["tabledefid"], $this->availableTabledefIDs) )?
    ?137                                                $this->verifyErrors[] = "The `tabledefid` field does not give an existing/acceptable to table definition id number.";?
    ?138?
    ?139                                }else?
    ?140                                        $this->verifyErrors[] = "The `tabledefid` field must be either a non-negative number or equivalent to 0.";?
    ?141?
    ?142                        }//end if?
    ?143?
    ?144                        //Table Default (0) ok becuase it means report is globally available to any user?
    ?145                        if(isset($variables["roleid"])){?
    ?146?
    ?147                                //must be a number or NULL/""?
    ?148                                if(is_numeric($variables["roleid"]) || !$variables["roleid"]){?
    ?149?
    ?150                                        if(!count($this->availableRoleIDs))?
    ?151                                                $this->populateRoleArray();?
    ?152?
    ?153                                        if( !in_array((int)$variables["roleid"], $this->availableRoleIDs) )?
    ?154                                                $this->verifyErrors[] = "The `roleid` field does not give an existing/acceptable to role id number.";?
    ?155?
    ?156                                }else?
    ?157                                        $this->verifyErrors[] = "The `roleid` field must be numeric or equivalent to 0.";?
    ?158?
    ?159                        }//end if?
    ?160?
    ?161                        return parent::verifyVariables($variables);?
    ?162?
    ?163                }//end method?
    ?164?
    ?165?
    51166                function displayTables($fieldname,$selectedid){?
    52?                        ?
    ?167?
    53168                        $querystatement="SELECT id, displayname FROM tabledefs ORDER BY displayname";?
    54?                        $thequery=$this->db->query($querystatement);            ?
    55?                                ?
    ?169                        $thequery=$this->db->query($querystatement);?
    ?170?
    56171                        echo "<select id=\"".$fieldname."\" name=\"".$fieldname."\">\n";?
    57?                ?
    ?172?
    58173                        echo "<option value=\"0\" ";?
    59174                        if ($selectedid=="0") echo "selected=\"selected\"";?
    60175                        echo " style=\"font-weight:bold\">global</option>\n";?
    61?                ?
    ?176?
    62177                        while($therecord=$this->db->fetchArray($thequery)){?
    63178                                echo "  <option value=\"".$therecord["id"]."\"";?
    ? ? ?
    65180                                echo ">".$therecord["displayname"]."</option>\n";?
    66181                        }?
    67?                ?
    ?182?
    68183                        echo "</select>\n";?
    69184                }//end method?
    70?        ?
    ?185?
    71186        }//end class?
    72187}//end if?
  • trunk/phpbms/modules/base/include/roles.php

    r290 r485 ?
    3939if(class_exists("phpbmsTable")){?
    4040        class roles extends phpbmsTable{?
    41?        ?
    ?41                ?
    4242                function updateRecord($variables, $modifiedby = NULL){  ?
    4343                        parent::updateRecord($variables, $modifiedby);?
  • trunk/phpbms/modules/base/include/scheduler.php

    r285 r485 ?
    3939if(class_exists("phpbmsTable")){?
    4040        class schedulers extends phpbmsTable{?
    41?        ?
    ?41?
    ?42                var $availableRoleIDs = array();?
    ?43?
    4244                function getDefaults(){?
    4345                        $therecord = parent::getDefaults();?
    44?                        ?
    ?46?
    4547                        $therecord["crontab"]="*::*::*::*::*";?
    46?        ?
    ?48?
    4749                        $therecord["min"]="*";?
    4850                        $therecord["hrs"]="*";?
    ? ? ?
    5052                        $therecord["mo"]="*";?
    5153                        $therecord["day"]="*";?
    52?                        ?
    53?                        $therecord["startdate"]=dateToString(mktime(),"SQL");?
    54?                        $therecord["starttime"]="";?
    55?                ?
    ?54?
    ?55                        $therecord["startdate"] = dateToString(mktime(),"SQL");?
    ?56                        $therecord["starttime"] = sqlTimeFromString(timeToString(time()));?
    ?57?
    5658                        $therecord["enddate"]="";?
    5759                        $therecord["endtime"]="";?
    58?                        ?
    ?60?
    5961                        return $therecord;?
    60?                        ?
    ?62?
    6163                }//end method?
    62?        ?
    63?                ?
    ?64?
    ?65?
    6466                function getRecord($id = 0){?
    6567                        $therecord = parent::getRecord($id);?
    66?                        ?
    ?68?
    6769                        $datearray=explode(" ",$therecord["startdatetime"]);?
    6870                        $therecord["startdate"]=$datearray[0];?
    6971                        if(isset($datearray[1])) $therecord["starttime"]=$datearray[1]; else $therecord["starttime"]="";?
    70?                        ?
    ?72?
    7173                        $datearray=explode(" ",$therecord["enddatetime"]);?
    7274                        $therecord["enddate"]=$datearray[0];?
    7375                        if(isset($datearray[1])) $therecord["endtime"]=$datearray[1]; else $therecord["endtime"]="";?
    74?                ?
    ?76?
    7577                        $cronarray=explode("::",$therecord["crontab"]);?
    7678                        if(isset($cronarray[0])) $therecord["min"]=$cronarray[0]; else $therecord["min"]="*";?
    ? ? ?
    7981                        if(isset($cronarray[3])) $therecord["mo"]=$cronarray[3]; else $therecord["mo"]="*";?
    8082                        if(isset($cronarray[4])) $therecord["day"]=$cronarray[4]; else $therecord["day"]="*";?
    81?                        ?
    ?83?
    8284                        $therecord["lastrun"]=formatFromSQLDatetime($therecord["lastrun"]);?
    83?                        ?
    ?85?
    8486                        return $therecord;?
    85?        ?
    ?87?
    8688                }//end method?
    87?                ?
    88?        ?
    ?89?
    ?90?
    ?91                function verifyVariables($variables){?
    ?92?
    ?93                        //must have the file that has the job that will?
    ?94                        //be run.?
    ?95                        if(isset($variables["job"])){?
    ?96                                if(!$variables["job"] === "" || $variables["job"] === NULL)?
    ?97                                        $this->verifyErrors[] = "The `job` field must not be blank.";?
    ?98                        }else?
    ?99                                $this->verifyErrors[] = "The `job` field must be set.";?
    ?100?
    ?101                        //checks to see if crontab is in the (somewhat) right format?
    ?102                        if(isset($variables["crontab"])){?
    ?103                                $explode = explode("::", $variables["crontab"]);?
    ?104                                if(count($explode) != 5)?
    ?105                                        $this->verifyErrors[] = "The `crontab` field is not of the proper form.  There must be four pairs of '::' in the field's value.";?
    ?106                        }//end if?
    ?107?
    ?108                        return parent::verifyVariables($variables);?
    ?109?
    ?110                }//end method?
    ?111?
    ?112?
    89113                function prepareVariables($variables){?
    90?        ?
    ?114?
    91115                        $temparray[0]=$variables["min"];?
    92116                        $temparray[1]=$variables["hrs"];?
    ? ? ?
    95119                        $temparray[4]=$variables["day"];?
    96120                        $variables["crontab"]=implode("::",$temparray);?
    97?        ?
    ?121?
    98122                        if($variables["startdate"]){?
    99123                                $variables["startdatetime"] = $variables["startdate"];?
    100124                                if($variables["starttime"])?
    101125                                        $variables["startdatetime"] .= " ".$variables["starttime"];?
    102?                        }?
    103?                        else?
    ?126                        }else?
    104127                                $variables["startdatetime"] = NULL;?
    105?                ?
    ?128?
    ?129?
    106130                        if($variables["enddate"]){?
    107131                                $variables["enddatetime"] = $variables["enddate"];?
    108132                                if($variables["endtime"])?
    109133                                        $variables["enddatetime"].=" ".$variables["endtime"];?
    110?                        }?
    111?                        else?
    112?                                $variables["enddatetime"] = NULL; ?
    113?        ?
    114?                ?
    ?134                        }else?
    ?135                                $variables["enddatetime"] = NULL;?
    ?136?
    ?137?
    115138                        return $variables;?
    116139                }?
    117?                ?
    118?                ?
    119?                function updateRecord($variables, $modifiedby = NULL){?
    120?        ?
    121?                        $variables = $this->prepareVariables($variables);?
    122?                ?
    123?                        return parent::updateRecord($variables, $modifiedby);?
    124?                }?
    125?        ?
    126?        ?
    127?                function insertRecord($variables, $createdby = NULL){?
    128?        ?
    129?                        $variables = $this->prepareVariables($variables);?
    130?                ?
    131?                        return parent::insertRecord($variables, $createdby);?
    132?                }?
    133?                ?
    ?140?
    134141        }//end class?
    135142}//end if?
  • trunk/phpbms/modules/base/include/snapshot_include.php

    r443 r485 ?
    6969                if($this->db->numRows($queryresult)){ ?>?
    7070?
    71?                <div class="box" id="systemMessageContainer">?
    ?71                <div id="systemMessageContainer">?
    7272                        <h2>System Messages</h2>?
    7373                        <?php while($therecord = $this->db->fetchArray($queryresult)) {?
    ? ? ?
    7676?
    7777                        ?>?
    78?                        <h3 class="systemMessageLinks"><?php echo htmlQuotes($therecord["subject"])?> <span>[ <?php echo htmlQuotes(formatFromSQLDateTime($therecord["creationdate"]))?> <?php echo htmlQuotes($therecord["createdby"])?>]</span></h3>?
    79?                        <div class="systemMessages">?
    80?                                <p><?php echo $therecord["content"]?></p>?
    81?                        </div>?
    ?78                                <div class="systemMessageLinks">?
    ?79                                        <h3><?php echo htmlQuotes($therecord["subject"])?></h3>?
    ?80                                        <div>by <?php echo htmlQuotes($therecord["createdby"])?> on <?php echo htmlQuotes(formatFromSQLDateTime($therecord["creationdate"]))?></div>?
    ?81                                </div>?
    ?82                                <div class="systemMessages"><p><?php echo $therecord["content"]?></p></div>?
    8283                        <?php }//end while ?>?
    8384                </div>?
    ? ? ?
    113114?
    114115                                $querystatement.="?
    115?                                        assignedtoid = ".$this->userid."?
    116?                                         OR (?
    117?                                                type = 'TS'?
    118?                                                AND (assignedtoid = 0 OR assignedtoid IS NULL)?
    119?                                                AND createdby = ".$this->userid."?
    120?                                        ) AND (completed = 0?
    121?                                                OR (completed = 1 AND completeddate >= CURDATE())?
    ?116                                        ((?
    ?117                                                assignedtoid = ".$this->userid."?
    ?118                                                OR      (?
    ?119                                                        type = 'TS'?
    ?120                                                        AND (assignedtoid = 0 OR assignedtoid IS NULL)?
    ?121                                                        AND createdby = ".$this->userid."?
    ?122                                                        )?
    ?123                                        )?
    ?124                                                AND     (?
    ?125                                                        completed = 0?
    ?126                                                        OR      (?
    ?127                                                                completed = 1?
    ?128                                                                AND completeddate >= CURDATE()?
    ?129                                                                )?
    ?130                                                        )?
    122131                                        )";?
    123132?
    ? ? ?
    129138?
    130139                                $querystatement.="?
    131?                                        assignedbyid = ".$this->userid."?
    ?140                                        (assignedbyid = ".$this->userid."?
    132141                                        AND (completed = 0?
    133142                                                OR (completed = 1 AND completeddate >= CURDATE())?
    134?                                        )";?
    ?143                                        ))";?
    135144?
    136145                                $title = "Delegations";?
    ? ? ?
    142151?
    143152                $querystatement.="AND (?
    144?                                        (startdate IS NULL AND enddate IS NULL AND assignedtodate IS NULL) OR?
    145?                                        (startdate IS NOT NULL AND startdate <= DATE_ADD(CURDATE(),INTERVAL 30 DAY)) OR?
    146?                                        (enddate IS NOT NULL AND enddate <= DATE_ADD(CURDATE(),INTERVAL 30 DAY)) OR?
    147?                                        (assignedtodate IS NOT NULL AND assignedtodate <= DATE_ADD(CURDATE(),INTERVAL 30 DAY))?
    ?153                                        (startdate IS NULL AND enddate IS NULL AND assignedtodate IS NULL)?
    ?154?
    ?155                                        OR (?
    ?156                                                (startdate IS NOT NULL AND startdate <= DATE_ADD(CURDATE(),INTERVAL 30 DAY))?
    ?157                                                AND (?
    ?158                                                        (enddate IS NOT NULL AND enddate <= DATE_ADD(CURDATE(),INTERVAL 30 DAY))?
    ?159                                                        OR (assignedtodate IS NOT NULL AND assignedtodate <= DATE_ADD(CURDATE(),INTERVAL 30 DAY))?
    ?160                                                )?
    ?161                                        )?
    148162                                   )";?
    149163?
    ? ? ?
    234248                                                                case "Now":?
    235249                                                                        $section["title"] = "Soon";?
    236?                                                                        $section["date"] = mktime(0,0,0,date("m"),date("d")+7,date("Y"));;?
    ?250                                                                        $section["date"] = mktime(0,0,0,date("m"),date("d")+7,date("Y"));?
    237251                                                                        break;?
    238252?
    239253                                                                case "Soon":?
    240254                                                                        $section["title"] = "Later";?
    241?                                                                        $section["date"] = mktime(0,0,0,date("m"),date("d")+31,date("Y"));;?
    ?255//                                                                      $section["date"] = mktime(0,0,0,date("m"),date("d")+31,date("Y"));?
    ?256                                                                        $section["date"] = mktime(0,0,0,date("m"),date("d"),2038);?
    242257                                                                        break;?
    243258?
  • trunk/phpbms/modules/base/include/tabledefs.php

    r427 r485 ?
    3939if(class_exists("phpbmsTable")){?
    4040        class tableDefinitions extends phpbmsTable{?
    41?        ?
    ?41?
    ?42                var $availableRoleIDs = array();?
    ?43?
    4244                function getDefaults(){?
    4345                        $therecord = parent::getDefaults();?
    44?                        ?
    ?46?
    4547                        $therecord["moduleid"]=1;?
    4648                        $therecord["deletebutton"]="delete";?
    ? ? ?
    5052                        $therecord["advsearchroleid"]=-100;?
    5153                        $therecord["viewsqlroleid"]=-100;?
    52?                        ?
    ?54?
    5355                        return $therecord;?
    5456                }?
    55?                ?
    ?57?
    ?58                //populates $this->availableRoleIDs?
    ?59                function populateRoleArray(){?
    ?60?
    ?61                        $this->availableRoleIDs = array();?
    ?62?
    ?63                        $querystatement = "?
    ?64                                SELECT?
    ?65                                        `id`?
    ?66                                FROM?
    ?67                                        `roles`;?
    ?68                                ";?
    ?69?
    ?70                        $queryresult = $this->db->query($querystatement);?
    ?71?
    ?72                        $this->availableRoleIDs[] = 0;//for everyone?
    ?73                        $this->availableRoleIDs[] = -100;//for administrators?
    ?74?
    ?75                        while($therecord = $this->db->fetchArray($queryresult))?
    ?76                                $this->availableRoleIDs[] = $therecord["id"];?
    ?77?
    ?78                }//end method --populateRoleArray--?
    ?79?
    ?80?
    ?81                function verifyVariables($variables){?
    ?82?
    ?83?
    ?84                        //the following ifs are constructed in such a way as to allow?
    ?85                        //the integer 0 as an acceptable value?
    ?86?
    ?87                        if(isset($variables["maintable"])){?
    ?88                                if($variables["maintable"] === "" || $variables["maintable"] === NULL)?
    ?89                                        $this->verifyErrors[] = "The `maintable` field must not be blank.";?
    ?90                        }else?
    ?91                                $this->verifyErrors[] = "The `maintable` field must be set.";?
    ?92?
    ?93                        if(isset($variables["addfile"])){?
    ?94                                if($variables["addfile"] === "" || $variables["addfile"] === NULL)?
    ?95                                        $this->verifyErrors[] = "The `addfile` field must not be blank.";?
    ?96                        }else?
    ?97                                $this->verifyErrors[] = "The `addfile` field must be set.";?
    ?98?
    ?99                        if(isset($variables["editfile"])){?
    ?100                                if($variables["editfile"] === "" || $variables["editfile"] === NULL)?
    ?101                                        $this->verifyErrors[] = "The `editfile` field must not be blank.";?
    ?102                        }else?
    ?103                                $this->verifyErrors[] = "The `editfile` field must be set.";?
    ?104?
    ?105                        if(isset($variables["querytable"])){?
    ?106                                if($variables["querytable"] === "" || $variables["querytable"] === NULL)?
    ?107                                        $this->verifyErrors[] = "The `querytable` field must not be blank.";?
    ?108                        }else?
    ?109                                $this->verifyErrors[] = "The `querytable` field must be set.";?
    ?110?
    ?111                        if(isset($variables["defaultwhereclause"])){?
    ?112                                if($variables["defaultwhereclause"] === "" || $variables["defaultwhereclause"] === NULL)?
    ?113                                        $this->verifyErrors[] = "The `defaultwhereclause` field must not be blank.";?
    ?114                        }else?
    ?115                                $this->verifyErrors[] = "The `defaultwhereclause` field must be set.";?
    ?116?
    ?117                        if(isset($variables["defaultsortorder"])){?
    ?118                                if($variables["defaultsortorder"] === "" || $variables["defaultsortorder"] === NULL)?
    ?119                                        $this->verifyErrors[] = "The `defaultsortorder` field must not be blank.";?
    ?120                        }else?
    ?121                                $this->verifyErrors[] = "The `defaultsortorder` field must be set.";?
    ?122?
    ?123                        if(isset($variables["deletebutton"])){?
    ?124                                if($variables["deletebutton"] === "" || $variables["deletebutton"] === NULL)?
    ?125                                        $this->verifyErrors[] = "The `delete` field must not be blank.";?
    ?126                        }else?
    ?127                                $this->verifyErrors[] = "The `delete` field must be set.";?
    ?128?
    ?129                        //table default sufficient?
    ?130                        if(isset($variables["type"]))?
    ?131                                switch($variables["type"]){?
    ?132?
    ?133                                        case "table":?
    ?134                                        case "view":?
    ?135                                        case "system":?
    ?136                                        break;?
    ?137?
    ?138                                        default:?
    ?139                                                $this->verifyErrors[] = "The value of `type` field is invalid. Its value must be?
    ?140                                                        'table', 'view', or 'system'.";?
    ?141                                        break;?
    ?142?
    ?143                                }//end switch?
    ?144?
    ?145                        if(isset($variables["addroleid"])){?
    ?146?
    ?147                                if(is_numeric($variables["addroleid"]) || !$variables["addroleid"]){?
    ?148?
    ?149                                        if(!count($this->availableRoleIDs))?
    ?150                                                $this->populateRoleArray();?
    ?151?
    ?152                                        if(!in_array(((int)$variables["addroleid"]), $this->availableRoleIDs))?
    ?153                                                $this->verifyErrors[] = "The `addroleid` field does not give an existing/acceptable role id number.";?
    ?154?
    ?155                                }else?
    ?156                                        $this->verifyErrors[] = "The `addroleid` field must be numeric or equivalent to 0.";?
    ?157?
    ?158                        }//end if?
    ?159?
    ?160                        if(isset($variables["editroleid"])){?
    ?161?
    ?162                                if(is_numeric($variables["editroleid"]) || !$variables["editroleid"]){?
    ?163?
    ?164                                        if(!count($this->availableRoleIDs))?
    ?165                                                $this->populateRoleArray();?
    ?166?
    ?167                                        if(!in_array(((int)$variables["editroleid"]), $this->availableRoleIDs))?
    ?168                                                $this->verifyErrors[] = "The `editroleid` field does not give an existing/acceptable role id number.";?
    ?169?
    ?170                                }else?
    ?171                                        $this->verifyErrors[] = "The `editroleid` field must be numeric or equivalent to 0.";?
    ?172?
    ?173                        }//end if?
    ?174?
    ?175                        if(isset($variables["importroleid"])){?
    ?176?
    ?177                                if(is_numeric($variables["importroleid"]) || !$variables["importroleid"]){?
    ?178?
    ?179                                        if(!count($this->availableRoleIDs))?
    ?180                                                $this->populateRoleArray();?
    ?181?
    ?182                                        if(!in_array(((int)$variables["importroleid"]), $this->availableRoleIDs))?
    ?183                                                $this->verifyErrors[] = "The `importroleid` field does not give an existing/acceptable role id number.";?
    ?184?
    ?185                                }else?
    ?186                                        $this->verifyErrors[] = "The `importroleid` field must be numeric or equivalent to 0.";?
    ?187?
    ?188                        }//end if?
    ?189?
    ?190                        if(isset($variables["searchroleid"])){?
    ?191?
    ?192                                if(is_numeric($variables["searchroleid"]) || !$variables["searchroleid"]){?
    ?193?
    ?194                                        if(!count($this->availableRoleIDs))?
    ?195                                                $this->populateRoleArray();?
    ?196?
    ?197                                        if(!in_array(((int)$variables["searchroleid"]), $this->availableRoleIDs))?
    ?198                                                $this->verifyErrors[] = "The `searchroleid` field does not give an existing/acceptable role id number.";?
    ?199?
    ?200                                }else?
    ?201                                        $this->verifyErrors[] = "The `searchroleid` field must be numeric or equivalent to 0.";?
    ?202?
    ?203                        }//end if?
    ?204?
    ?205                        if(isset($variables["advsearchroleid"])){?
    ?206?
    ?207                                if(is_numeric($variables["advsearchroleid"]) || !$variables["advsearchroleid"]){?
    ?208?
    ?209                                        if(!count($this->availableRoleIDs))?
    ?210                                                $this->populateRoleArray();?
    ?211?
    ?212                                        if(!in_array(((int)$variables["advsearchroleid"]), $this->availableRoleIDs))?
    ?213                                                $this->verifyErrors[] = "The `advsearchroleid` field does not give an existing/acceptable role id number.";?
    ?214?
    ?215                                }else?
    ?216                                        $this->verifyErrors[] = "The `advsearchroleid` field must be numeric or equivalent to 0.";?
    ?217?
    ?218                        }//end if?
    ?219?
    ?220                        if(isset($variables["viewsqlroleid"])){?
    ?221?
    ?222                                if(is_numeric($variables["viewsqlroleid"]) || !$variables["viewsqlroleid"]){?
    ?223?
    ?224                                        if(!count($this->availableRoleIDs))?
    ?225                                                $this->populateRoleArray();?
    ?226?
    ?227                                        if(!in_array(((int)$variables["viewsqlroleid"]), $this->availableRoleIDs))?
    ?228                                                $this->verifyErrors[] = "The `viewsqlroleid` field does not give an existing/acceptable role id number.";?
    ?229?
    ?230                                }else?
    ?231                                        $this->verifyErrors[] = "The `viewsqlroleid` field must benumeric or quivalent to 0.";?
    ?232?
    ?233                        }//end if?
    ?234?
    ?235                        return parent::verifyVariables($variables);?
    ?236?
    ?237                }//end method --verifyVariables--?
    ?238?
    56239                function insertRecord($variables,$createdby = NULL){?
    57240?
    58241                        if(!isset($variables["newid"]))?
    59242                                $variables["newid"] = "";?
    60?                                ?
    ?243?
    61244                        if($variables["newid"]){?
    62?                                //this will set a specific ID to be used.                               ?
    ?245                                //this will set a specific ID to be used.?
    63246                                $variables["id"] = $variables["newid"];?
    64247                                parent::insertRecord($variables,$createdby,true);?
    65248                                $newid =  $variables["newid"];?
    66?                        ?
    ?249?
    67250                        } else {?
    68?                        ?
    ?251?
    69252                                $newid = parent::insertRecord($variables,$createdby);?
    70?                                ?
    ?253?
    71254                        }//endif - newid?
    72?                        ?
    ?255?
    73256                        //we need to create the some default supporting records?
    74257                        //first a single column.?
    75?                        $querystatement = "INSERT INTO `tablecolumns` ?
    76?                        (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) ?
    ?258                        $querystatement = "INSERT INTO `tablecolumns`?
    ?259                        (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`)?
    77260                        VALUES (".$newid.",'id','".$variables["maintable"].".id','left','',0,'',0,'',NULL,0);";?
    78261                        $this->db->query($querystatement);?
    79?                        ?
    ?262?
    80263                        //next default button options?
    81?                        $querystatement = "INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`) ?
    ?264                        $querystatement = "INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`)?
    82265                        VALUES (".$newid.",'new','1',0,0,0);";?
    83266                        $this->db->query($querystatement);?
    84267?
    85?                        $querystatement = "INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`) ?
    ?268                        $querystatement = "INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`)?
    86269                        VALUES (".$newid.",'edit','1','1',0,0);";?
    87270                        $this->db->query($querystatement);?
    88271?
    89?                        $querystatement = "INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`) ?
    ?272                        $querystatement = "INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`)?
    90273                        VALUES (".$newid.",'printex','1',0,0,0);";?
    91274                        $this->db->query($querystatement);?
    92275?
    93?                        $querystatement = "INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`) ?
    ?276                        $querystatement = "INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`)?
    94277                        VALUES (".$newid.",'select','1',0,0,0);";?
    95278                        $this->db->query($querystatement);?
    96?                        ?
    97?                        $querystatement = "INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`) ?
    ?279?
    ?280                        $querystatement = "INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`)?
    98281                        VALUES (".$newid.",'import','1',0,0,'-100');";?
    99282                        $this->db->query($querystatement);?
    100283?
    101284                        //next quicksearch?
    102?                        $querystatement = "INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) ?
    ?285                        $querystatement = "INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`)?
    103286                        VALUES (".$newid.",'All Records','".$variables["maintable"].".id!=-1',0,0);";?
    104287                        $this->db->query($querystatement);?
    105288?
    106289                        //and last findfields?
    107?                        $querystatement = "INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) ?
    ?290                        $querystatement = "INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`)?
    108291                        VALUES (".$newid.",'".$variables["maintable"].".id','id',1,'field');";?
    109292                        $this->db->query($querystatement);?
    110?                        ?
    ?293?
    111294                        return $newid;?
    112?                        ?
    ?295?
    113296                }?
    114297        }//end class?
    ? ? ?
    119302?
    120303                function delete_record(){?
    121?                ?
    ?304?
    122305                        //passed variable is array of user ids to be revoked?
    123306                        $whereclause="";?
    ? ? ?
    127310                        $linkedwhereclause = $this->buildWhereClause("tabledefid");?
    128311                        $relationshipswhereclause = $this->buildWhereClause("fromtableid")." or ".$this->buildWhereClause("totableid");?
    129?                        ?
    ?312?
    130313                        $querystatement = "DELETE FROM tablecolumns WHERE ".$linkedwhereclause.";";?
    131314                        $queryresult = $this->db->query($querystatement);?
    132?                ?
    ?315?
    133316                        $querystatement = "DELETE FROM tablefindoptions WHERE ".$linkedwhereclause.";";?
    134317                        $queryresult = $this->db->query($querystatement);?
    135?                ?
    ?318?
    136319                        $querystatement = "DELETE FROM tableoptions WHERE ".$linkedwhereclause.";";?
    137320                        $queryresult = $this->db->query($querystatement);?
    138?                ?
    ?321?
    139322                        $querystatement = "DELETE FROM tablesearchablefields WHERE ".$linkedwhereclause.";";?
    140323                        $queryresult = $this->db->query($querystatement);?
    141?                ?
    ?324?
    142325                        $querystatement = "DELETE FROM usersearches WHERE ".$linkedwhereclause.";";?
    143326                        $queryresult = $this->db->query($querystatement);?
    144?                ?
    ?327?
    145328                        $querystatement = "DELETE FROM relationships WHERE ".$relationshipswhereclause.";";?
    146329                        $queryresult = $this->db->query($querystatement);?
    147?                ?
    ?330?
    148331                        $querystatement = "DELETE FROM tabledefs WHERE ".$whereclause.";";?
    149332                        $queryresult = $this->db->query($querystatement);?
    150?                ?
    ?333?
    151334                        $message = $this->buildStatusMessage();?
    152335                        $message.=" deleted.";?
    153?                        return $message;        ?
    ?336                        return $message;?
    154337                }//end method?
    155338?
  • trunk/phpbms/modules/base/include/users.php

    r427 r485 ?
    3939if(class_exists("phpbmsTable")){?
    4040        class users extends phpbmsTable{?
    41?        ?
    42?                function updateRecord($variables, $modifiedby = NULL){  ?
    43?                        ?
    ?41?
    ?42                var $usedLoginNames = array();?
    ?43?
    ?44                function populateLoginNameArray(){?
    ?45?
    ?46                        $querystatement="?
    ?47                                SELECT?
    ?48                                        `id`,?
    ?49                                        `login`?
    ?50                                FROM?
    ?51                                        `users`;?
    ?52                                ";?
    ?53?
    ?54                        $queryresult = $this->db->query($querystatement);?
    ?55?
    ?56                        if($this->db->numRows($queryresult)){?
    ?57                                while($therecord = $this->db->fetchArray($queryresult)){?
    ?58?
    ?59                                        $login = $therecord["login"];?
    ?60                                        $id = $therecord["id"];?
    ?61                                        $this->usedLoginNames[$login]["id"] = $id;?
    ?62?
    ?63                                }//end while?
    ?64                        }else{?
    ?65                                //if no valid login names, I put in a value that will?
    ?66                                //give the arrays a count but not actually match any realistic login names?
    ?67                                $login = "THIS is @ ve|2`/ D|_||\/|B |_0GI|\| and stupid too.";?
    ?68                                $id = -1;?
    ?69?
    ?70                                $this->usedLoginNames[$login]["id"] = $id;?
    ?71                        }//end if?
    ?72?
    ?73                }//end method?
    ?74?
    ?75?
    ?76                function verifyVariables($variables){?
    ?77                        //---------[ check login names ]------------------------------?
    ?78?
    ?79                        if(isset($variables["login"])){?
    ?80                                if( $variables["login"] !== "" || $variables["login"] !== NULL ){?
    ?81?
    ?82                                        if(!count($this->usedLoginNames))?
    ?83                                                $this->populateLoginNameArray();?
    ?84?
    ?85                                        if(!isset($variables["id"]))?
    ?86                                                $variables["id"] = 0;?
    ?87?
    ?88                                        if($variables["id"] < 0)?
    ?89                                                $variables["id"] = 0;?
    ?90?
    ?91                                        //check to see new login name is taken?
    ?92                                        $templogin = $variables["login"];// using this because it looks ugly to but the brackets within brackets?
    ?93                                        if( array_key_exists($variables["login"], $this->usedLoginNames) ){?
    ?94?
    ?95                                                if( $this->usedLoginNames[$templogin]["id"] !== $variables["id"] )?
    ?96                                                        $this->verifyErrors[] = "The `login` field must give an unique login name.";?
    ?97?
    ?98                                        }else{?
    ?99                                                $this->availableProducts[$templogin]["id"] = -1;// impossible id put in (besides the type will through off the if anyways)?
    ?100                                        }//end if?
    ?101?
    ?102                                }else?
    ?103                                        $this->verifyErrors[] = "The `login` field must not be blank.";?
    ?104                        }else?
    ?105                                $this->verifyErrors[] = "The `login` field must be set.";?
    ?106?
    ?107                        //---------[ check email ]---------------------------------?
    ?108                        if(isset($variables["email"]))?
    ?109                                if( $variables["email"] !== NULL && $variables["email"] !== "" && !validateEmail($variables["email"]))?
    ?110                                        $this->verifyErrors[] = "The `email` field must have a valid email or must be left blank.";?
    ?111?
    ?112                        //---------[ check booleans ]---------------------------------?
    ?113                        if(isset($variables["revoked"]))?
    ?114                                if($variables["revoked"] && $variables["revoked"] != 1)?
    ?115                                        $this->verifyErrors[] = "The `revoked` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?116?
    ?117                        if(isset($variables["portalaccess"]))?
    ?118                                if($variables["portalaccess"] && $variables["portalaccess"] != 1)?
    ?119                                        $this->verifyErrors[] = "The `portalaccess` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?120?
    ?121                        if(isset($variables["admin"]))?
    ?122                                if($variables["admin"] && $variables["admin"] != 1)?
    ?123                                        $this->verifyErrors[] = "The `admin` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?124?
    ?125                        return parent::verifyVariables($variables);?
    ?126?
    ?127                }//end method --verifyVariables--?
    ?128?
    ?129?
    ?130                function updateRecord($variables, $modifiedby = NULL){?
    ?131?
    44132                        if($variables["password"])?
    45133                                $this->fields["password"]["type"] = "password";?
    ? ? ?
    48136?
    49137                        unset($this->fields["lastlogin"]);?
    50?                ?
    ?138?
    51139                        parent::updateRecord($variables, $modifiedby);?
    52?                        ?
    ?140?
    53141                        if($variables["roleschanged"]==1)?
    54142                                $this->assignRoles($variables["id"],$variables["newroles"]);?
    55?                        ?
    ?143?
    56144                        //reset field information?
    57145                        $this->fields = $this->db->tableInfo($this->maintable);?
    58146                }?
    59147?
    60?        ?
    61?                function insertRecord($variables, $createdby = NULL){   ?
    62?                        ?
    ?148?
    ?149                function insertRecord($variables, $createdby = NULL){?
    ?150?
    63151                        $this->fields["password"]["type"] = "password";?
    64152                        unset($this->fields["lastlogin"]);?
    65?                                                ?
    ?153?
    66154                        $theid = parent::insertRecord($variables, $createdby);?
    67?        ?
    ?155?
    68156                        //reset field information?
    69157                        $this->fields = $this->db->tableInfo($this->maintable);?
    ? ? ?
    71159                        return $theid;?
    72160                }?
    73?                ?
    ?161?
    74162                function assignRoles($id,$roles){?
    75163                        $querystatement="DELETE FROM rolestousers WHERE userid=".$id;?
    76164                        $queryresult=$this->db->query($querystatement);?
    77?        ?
    ?165?
    78166                        $newroles=explode(",",$roles);?
    79?        ?
    ?167?
    80168                        foreach($newroles as $therole)?
    81169                                if($therole!=""){?
    ? ? ?
    84172                                }?
    85173                }?
    86?                ?
    87?        ?
    ?174?
    ?175?
    88176                function displayRoles($id,$type){?
    89177                        $querystatement="SELECT roles.id,roles.name?
    90?                                                        FROM roles INNER JOIN rolestousers ON rolestousers.roleid=roles.id ?
    ?178                                                        FROM roles INNER JOIN rolestousers ON rolestousers.roleid=roles.id?
    91179                                                        WHERE rolestousers.userid=".((int) $id);?
    92180                        $assignedquery=$this->db->query($querystatement);?
    93?        ?
    ?181?
    94182                        $thelist=array();?
    95?                        ?
    ?183?
    96184                        if($type=="available"){?
    97185                                $excludelist=array();?
    98186                                while($therecord=$this->db->fetchArray($assignedquery))?
    99187                                        $excludelist[]=$therecord["id"];?
    100?                                        ?
    ?188?
    101189                                $querystatement="SELECT id,name FROM roles WHERE inactive=0";?
    102190                                $availablequery=$this->db->query($querystatement);?
    103191                                while($therecord=$this->db->fetchArray($availablequery))?
    104192                                        if(!in_array($therecord["id"],$excludelist))?
    105?                                                $thelist[]=$therecord;          ?
    106?                        } else ?
    ?193                                                $thelist[]=$therecord;?
    ?194                        } else?
    107195                                while($therecord=$this->db->fetchArray($assignedquery))?
    108196                                        $thelist[]=$therecord;?
    109?                                        ?
    ?197?
    110198                        foreach($thelist as $theoption){?
    111199                                ?>      <option value="<?php echo $theoption["id"]?>"><?php echo htmlQuotes($theoption["name"])?></option>?
    112?                <?php ?
    ?200                <?php?
    113201                        }?
    114202                }//end function?
    ? ? ?
    120208?
    121209                function delete_record(){?
    122?                        ?
    ?210?
    123211                        //passed variable is array of user ids to be revoked?
    124212                        $whereclause = $this->buildWhereClause();?
    125?                ?
    ?213?
    126214                        $querystatement = "UPDATE users SET revoked=1,modifiedby=".$_SESSION["userinfo"]["id"]." WHERE ".$whereclause.";";?
    127215                        $queryresult = $this->db->query($querystatement);?
    128?                ?
    ?216?
    129217                        $message = $this->buildStatusMessage();?
    130218                        $message.=" revoked access.";?
    131?                        return $message;        ?
    132?                }?
    133??
    134?                ?
    ?219                        return $message;?
    ?220                }?
    ?221?
    ?222?
    135223        }//end class?
    136224}//end if?
  • trunk/phpbms/modules/base/include/usersearches.php

    r285 r485 ?
    3939if(class_exists("phpbmsTable")){?
    4040        class userSearches extends phpbmsTable{?
    41?        ?
    ?41?
    ?42                var $availableUserIDs = array();?
    ?43                var $availableTabledefIDs = array();?
    ?44                var $availableRoleIDs = array();?
    ?45?
    ?46?
    ?47                function populateUserArray(){?
    ?48?
    ?49                        $this->availableUserIDs = array();?
    ?50?
    ?51                        $querystatement = "?
    ?52                                SELECT?
    ?53                                        `id`?
    ?54                                FROM?
    ?55                                        `users`;?
    ?56                                ";?
    ?57?
    ?58                        $queryresult = $this->db->query($querystatement);?
    ?59?
    ?60                        $this->availableUserIDs[] = 0;//for global?
    ?61?
    ?62                        while($therecord = $this->db->fetchArray($queryresult))?
    ?63                                $this->availableUserIDs[] = $therecord["id"];?
    ?64?
    ?65                }//end method --populateUserArray--?
    ?66?
    ?67?
    ?68                function populateRoleArray(){?
    ?69?
    ?70                        $this->availableRoleIDs = array();?
    ?71?
    ?72                        $querystatement = "?
    ?73                                SELECT?
    ?74                                        `id`?
    ?75                                FROM?
    ?76                                        `roles`;?
    ?77                                ";?
    ?78?
    ?79                        $queryresult = $this->db->query($querystatement);?
    ?80?
    ?81                        $this->availableRoleIDs[] = 0;//for global?
    ?82                        $this->availableRoleIDs[] = -100;//for admin?
    ?83?
    ?84                        while($therecord = $this->db->fetchArray($queryresult))?
    ?85                                $this->availableRoleIDs[] = $therecord["id"];?
    ?86?
    ?87?
    ?88                }//end method --populateRoleArray--?
    ?89?
    ?90?
    ?91                function populateTabledefArray(){?
    ?92?
    ?93                        $this->availableTabledefIDs = array();?
    ?94?
    ?95                        $querystatement = "?
    ?96                                SELECT?
    ?97                                        `id`?
    ?98                                FROM?
    ?99                                        `tabledefs`;?
    ?100                                ";?
    ?101?
    ?102                        $queryresult = $this->db->query($querystatement);?
    ?103?
    ?104                        if($this->db->numRows($queryresult)){?
    ?105                                while($therecord = $this->db->fetchArray($queryresult))?
    ?106                                        $this->availableTabledefIDs[] = $therecord["id"];?
    ?107                        }else?
    ?108                                $this->availableTabledefIDs[] = "none";// so the function doesn't keep?
    ?109                                //getting called?
    ?110?
    ?111?
    ?112                }//end method --populateRoleArray--?
    ?113?
    ?114?
    ?115                function verifyVariables($variables){?
    ?116?
    ?117                        //table default (SCH) is sufficient?
    ?118                        if(isset($variables["type"])){?
    ?119?
    ?120                                switch($variables["type"]){?
    ?121?
    ?122                                        case "SRT":?
    ?123                                        case "SCH":?
    ?124                                        break;?
    ?125?
    ?126                                        default:?
    ?127                                                $this->verifyErrors[] = "The value of `type` field is invalid. Its value must be?
    ?128                                                        'SRT' or 'SCH'.";?
    ?129                                        break;?
    ?130?
    ?131                                }//end switch?
    ?132?
    ?133                        }//end if?
    ?134?
    ?135                        //table default (0) is sufficient?
    ?136                        if(isset($variables["userid"])){?
    ?137?
    ?138                                if( !$variables["userid"] || ((int) $variables["userid"] > 0) ){?
    ?139?
    ?140                                        if(!count($this->availableUserIDs))?
    ?141                                                $this->populateUserArray();?
    ?142?
    ?143                                        if(!in_array(((int)$variables["userid"]), $this->availableUserIDs))?
    ?144                                                $this->verifyErrors[] = "The `userid` field does not give an existing/acceptable user id number.";?
    ?145?
    ?146                                }else?
    ?147                                        $this->verifyErrors[] = "The `userid` field must be a non-negative number or equivalent to 0.";?
    ?148?
    ?149                        }//end if?
    ?150?
    ?151                        //The table default is not enough, so it must be set?
    ?152                        if(isset($variables["tabledefid"])){?
    ?153?
    ?154                                if(is_numeric($variables["tabledefid"]) || !$variables["tabledefid"]){?
    ?155?
    ?156                                        if(!count($this->availableTabledefIDs))?
    ?157                                                $this->populateTabledefArray();?
    ?158?
    ?159                                        if(!in_array(((int)$variables["tabledefid"]), $this->availableTabledefIDs))?
    ?160                                                $this->verifyErrors[] = "The `tabledefid` field does not give an existing/acceptable table definition id number.";?
    ?161                                }else?
    ?162                                        $this->verifyErrors[] = "The `tabledefid` field must be numeric or equivalent to 0.";?
    ?163                        }else?
    ?164                                $this->verifyErrors[] = "The `tabledefid` field must be set.";?
    ?165?
    ?166                        //table default (0) is sufficient?
    ?167                        if(isset($variables["roleid"])){?
    ?168?
    ?169                                if(is_numeric($variables["roleid"]) || !$variables["roleid"]){?
    ?170?
    ?171                                        if(!count($this->availableRoleIDs))?
    ?172                                                $this->populateRoleArray();?
    ?173?
    ?174                                        if(!in_array(((int)$variables["roleid"]), $this->availableRoleIDs))?
    ?175                                                $this->verifyErrors[] = "The `roleid` field does not give an existing/acceptable role id number.";?
    ?176                                }else?
    ?177                                        $this->verifyErrors[] = "The `roleid` field must be numeric or equivalent to 0.";?
    ?178?
    ?179                        }//end if?
    ?180?
    ?181                        return parent::verifyVariables($variables);?
    ?182?
    ?183                }//end method?
    ?184?
    ?185?
    42186                function displayTables($fieldname,$selectedid){?
    43?                ?
    ?187?
    44188                        $querystatement="SELECT id, displayname FROM tabledefs ORDER BY displayname";?
    45189                        $thequery=$this->db->query($querystatement);?
    46?                        ?
    ?190?
    47191                        echo "<select id=\"".$fieldname."\" name=\"".$fieldname."\">\n";?
    48192                        while($therecord=$this->db->fetchArray($thequery)){?
    ? ? ?
    53197                        echo "</select>\n";?
    54198                }?
    55?                ?
    ?199?
    ?200?
    56201                function updateRecord($variables, $modifiedby = NULL){?
    57?                ?
    ?202?
    58203                        if(isset($variables["makeglobal"]))?
    59204                                $variables["userid"] = 0;?
    60?                                        ?
    ?205?
    61206                        parent::updateRecord($variables, $modifiedby);?
    62207                }?
    63?        ?
    ?208?
    64209        }//end class?
    65210}//end if?
  • trunk/phpbms/modules/base/notes_addedit.php

    r384 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev$ | $LastChangedBy$?
    ? ? ?
    3737 +-------------------------------------------------------------------------+?
    3838*/?
    39??
    40?        require_once("../../include/session.php");      ?
    ?39//var_dump($_POST);?
    ?40//exit;?
    ?41        require_once("../../include/session.php");?
    4142        require_once("include/fields.php");?
    4243        require_once("include/tables.php");?
    4344        require_once("include/notes.php");?
    4445?
    45?        if(isset($_GET["backurl"])){ ?
    ?46        if(isset($_GET["backurl"])){?
    4647                $backurl=$_GET["backurl"];?
    4748                if(isset($_GET["refid"]))?
    ? ? ?
    4950        } else?
    5051                $backurl = NULL;?
    51?                ?
    ?52?
    5253        $thetable = new notes($db,12,$backurl);?
    5354        $therecord = $thetable->processAddEditPage();?
    5455?
    5556        if(isset($therecord["phpbmsStatus"]))?
    56?                $statusmessage = $therecord["phpbmsStatus"];    ?
    ?57                $statusmessage = $therecord["phpbmsStatus"];?
    5758?
    5859?
    ? ? ?
    6970                $theform->onsubmit = "return submitForm(this)";?
    7071                $theform->id = "record";?
    71?                ?
    ?72?
    7273                $temparray = array("Note"=>"NT","Task"=>"TS","Event"=>"EV","System Message"=>"SM");?
    7374                $theinput = new inputBasicList("thetype",$therecord["type"],$temparray,"type");?
    ? ? ?
    7576                $theinput->setAttribute("onchange","changeType()");?
    7677                $theform->addField($theinput);?
    77?                ?
    ?78?
    7879                $theinput = new inputField("subject",$therecord["subject"], "title" ,true);?
    79?                $theform->addField($theinput);          ?
    ?80                $theform->addField($theinput);?
    8081?
    8182                $temparray = array("Highest"=>3,"High"=>2,"Medium"=>1,"Normal"=>0,"Low"=>-1,"Lowest"=>-2);?
    8283                $theinput = new inputBasicList("importance",$therecord["importance"],$temparray,"importance",false);?
    8384                $theform->addField($theinput);?
    84?                ?
    ?85?
    8586                $theinput = new inputCheckbox("private",$therecord["private"]);?
    8687                $theform->addField($theinput);?
    87?                ?
    ?88?
    8889                $theinput = new inputDatePicker("startdate",$therecord["startdate"], "start date" ,false, 11, 15, false);?
    89?                $theinput->setAttribute("onchange","checkEndDate();");                          ?
    ?90                $theinput->setAttribute("onchange","checkEndDate();");?
    9091                $theform->addField($theinput);?
    9192?
    9293                $theinput = new inputTimePicker("starttime",$therecord["starttime"], "start time" ,false,11, 15, false);?
    93?                $theinput->setAttribute("onchange","checkEndDate();");                          ?
    94?                $theform->addField($theinput);          ?
    95?                ?
    ?94                $theinput->setAttribute("onchange","checkEndDate();");?
    ?95                $theform->addField($theinput);?
    ?96?
    9697                $theinput = new inputDatePicker("enddate",$therecord["enddate"], "end date" ,false, 11, 15, false);?
    9798                $theform->addField($theinput);?
    9899?
    99100                $theinput = new inputTimePicker("endtime",$therecord["endtime"], "end time" ,false,11, 15, false);?
    100?                $theform->addField($theinput);          ?
    ?101                $theform->addField($theinput);?
    101102?
    102103                $theinput = new inputCheckbox("completed",$therecord["completed"],"completed",false,false);?
    ? ? ?
    110111                $theinput = new inputChoiceList($db, "status",$therecord["status"],"notestatus");?
    111112                $theform->addField($theinput);?
    112?                ?
    ?113?
    113114                $theinput = new inputSmartSearch($db, "assignedtoid", "Pick Active User", $therecord["assignedtoid"], "assigned to", false, 18, 255, false);?
    114115                $theform->addField($theinput);?
    115?                ?
    ?116?
    116117                $theinput = new inputDatePicker("assignedtodate",$therecord["assignedtodate"], "follow up date");?
    117118                $theform->addField($theinput);?
    118119?
    119120                $theinput = new inputTimePicker("assignedtotime",$therecord["assignedtotime"], "follow up time" ,false,11, 15, false);?
    120?                $theform->addField($theinput);          ?
    ?121                $theform->addField($theinput);?
    121122?
    122123                $theinput = new inputChoiceList($db, "category",$therecord["category"],"notecategories");?
    ? ? ?
    129130                else?
    130131                        $repeatBase = mktime();?
    131?                ?
    ?132?
    132133                $theinput = new inputCheckbox("repeating",$therecord["repeating"],"repeat");?
    133134                $theinput->setAttribute("onchange","checkRepeat();");?
    134135                $theform->addField($theinput);?
    135?                ?
    ?136?
    136137                $temparray = array("Daily"=>"Daily", "Weekly"=>"Weekly", "Monthly"=>"Monthly", "Yearly"=>"Yearly");?
    137138                $theinput = new inputBasiclist("repeattype",$therecord["repeattype"],$temparray,"frequency");?
    138139                $theinput->setAttribute("onchange","changeRepeatType();");?
    139140                $theform->addField($theinput);?
    140?                ?
    ?141?
    141142                $theinput = new inputField("repeatevery",$therecord["repeatevery"],"frequency of repeating",false,"integer",2,4,false);?
    142143                $theform->addField($theinput);?
    143?                ?
    ?144?
    144145                $theinput = new inputBasiclist("monthlyontheweek",$therecord["repeatontheweek"],$thetable->weekArray,"on the week of",false);?
    145146                $theinput2 = new inputBasiclist("yearlyontheweek",$therecord["repeatontheweek"],$thetable->weekArray,"on the week of",false);?
    ? ? ?
    150151                        $weekNumber = ceil(date("d",$repeatBase)/7);?
    151152                        if($weekNumber > 4) $weekNumber = 5;?
    152?                        ?
    ?153?
    153154                        $theinput->value = $weekNumber;?
    154155                        $theinput2->value = $weekNumber;?
    155?                                                ?
    ?156?
    156157                }?
    157158                $theform->addField($theinput);?
    158159                $theform->addField($theinput2);?
    159?                ?
    ?160?
    160161                $temparray = array();?
    161162                for($i=1; $i<8; $i++)?
    ? ? ?
    186187                $theinput = new inputField("repeattimes",$therecord["repeattimes"],"repeat until number of times",false,"integer",3,5,false);?
    187188                $theform->addField($theinput);?
    188?                ?
    ?189?
    189190                if(!$therecord["repeatuntil"])?
    190191                        $therecord["repeatuntil"] = dateToString(mktime(),"SQL");?
    ? ? ?
    193194                $theform->addField($theinput);?
    194195                //end repeat fields?
    195?                                ?
    ?196?
    196197                $theform->jsMerge();?
    197198                //==============================================================?
    198?                //End Form Elements     ?
    199?                ?
    ?199                //End Form Elements?
    ?200?
    200201        include("header.php");?
    201?        ?
    ?202?
    202203?><div class="bodyline">?
    203204        <?php $theform->startForm($pageTitle)?>?
    ? ? ?
    211212                        <input name="thebackurl" id="thebackurl" type="hidden" value="<?php if(isset($_GET["backurl"])) echo $_GET["backurl"]; ?>" />?
    212213                </p>?
    213?                ?
    ?214?
    214215                <p>?
    215216                        <?php $theform->showField("thetype")?>?
    216?                        <input type="hidden" id="typeCheck" name="typeCheck" value="<?php echo $therecord["type"]?>" />         ?
    ?217                        <input type="hidden" id="typeCheck" name="typeCheck" value="<?php echo $therecord["type"]?>" />?
    217218                </p>?
    218?                ?
    ?219?
    219220                <p><?php $theform->showField("subject") ?></p>?
    220221        </fieldset>?
    221?        ?
    ?222?
    222223        <div id="leftSideDiv">?
    223224                <fieldset>?
    ? ? ?
    234235                                <label for="startdate" id="starttext">start</label><br />?
    235236                                <input name="dostart" id="startcheck" type="checkbox" value="1" <?php if($therecord["startdate"]) echo "checked=\"checked\"" ?> onclick="dateChecked('start')" class="radiochecks" />?
    236?                                &nbsp;<?php $theform->showField("startdate");?> ?
    ?237                                &nbsp;<?php $theform->showField("startdate");?>?
    237238                                &nbsp;<?php $theform->showField("starttime");?>?
    238239                        </p>?
    ? ? ?
    240241                                <label for="enddate" id="endtext">end</label><br />?
    241242                                <input name="doend" id="endcheck" type="checkbox" value="1" <?php if($therecord["enddate"]) echo "checked=\"checked\"" ?> onclick="dateChecked('end')" class="radiochecks" />?
    242?                                &nbsp;<?php $theform->showField("enddate");?>   ?
    ?243                                &nbsp;<?php $theform->showField("enddate");?>?
    243244                                &nbsp;<?php $theform->showField("endtime");?>?
    244245                        </p>?
    245246                </fieldset>?
    246?                ?
    ?247?
    247248                <div id="thecompleted" class="fauxP">?
    248249                        <p>?
    ? ? ?
    251252                                <?php $theform->showField("completeddate")?>?
    252253                        </p>?
    253?                        <p id="thestatus"><?php $theform->showField("status") ?></p>                    ?
    ?254                        <p id="thestatus"><?php $theform->showField("status") ?></p>?
    254255                </div>?
    255?                ?
    ?256?
    256257                <fieldset>?
    257258                        <legend><label for="ds-assignedtoid">assigned to</label></legend>?
    ? ? ?
    275276                        <p><?php $theform->showField("assignedtodate");?> &nbsp; <?php $theform->showField("assignedtotime")?></p>?
    276277                </fieldset>?
    277?                ?
    ?278?
    278279                <input id="attachedtabledefid" name="attachedtabledefid" type="hidden" value="<?php echo $therecord["attachedtabledefid"]?>" />?
    279280                <fieldset id="theassociated">?
    ? ? ?
    283284                                        <input id="assocarea" type="text" readonly="readonly" class="uneditable" value="<?php echo $attachedtableinfo["displayname"];?>" />?
    284285                                </p>?
    285?                                                                ?
    ?286?
    286287                                <p>?
    287288                                        <label for="attachedid">record id</label><br />?
    ? ? ?
    296297                                <input name="location" id="location" type="text" value="<?php echo $therecord["location"]?>"/>?
    297298                        </p>?
    298?                        ?
    299?                        <p><?php $theform->showField("category") ?></p>                 ?
    300?                </fieldset>?
    301?                ?
    ?299?
    ?300                        <p><?php $theform->showField("category") ?></p>?
    ?301                </fieldset>?
    ?302?
    302303        </div>?
    303304?
    ? ? ?
    316317?
    317318        <div id="repeatDiv">?
    318?        ?
    ?319?
    319320                <div <?php if($therecord["parentid"]) echo 'style="display:none;"'?>>?
    320321                        <input type="hidden" id="bypass" name="bypass" value=""/>?
    ? ? ?
    325326                        <fieldset>?
    326327                                <legend>repeat</legend>?
    327?                                ?
    ?328?
    328329                                <p><?php $theform->showField("repeating")?></p>?
    329?                                ?
    ?330?
    330331                                <div id="repeatOptions" <?php if(!$therecord["repeating"]) echo 'style="display:none"'?>>?
    331?                                ?
    ?332?
    332333                                        <p><?php $theform->showField("repeattype")?></p>?
    333?                ?
    ?334?
    334335                                        <p>every <?php $theform->showField("repeatevery")?> <span id="repeatTypeText">day(s)</span></p>?
    335?                ?
    ?336?
    336337                                        <div id="DailyDiv"></div>?
    337?                ?
    ?338?
    338339                                        <div id="WeeklyDiv">?
    339340                                                <p><?php $thetable->showWeeklyOptions($therecord,$repeatBase)?></p>?
    340341                                        </div>?
    341?                ?
    ?342?
    342343                                        <div id="MonthlyDiv">?
    343344                                                <p><input type="radio" id="monthlyEach" name="monthlyWhat" onchange="monthlyChange();" value="1" <?php if(!$therecord["repeatontheday"]) echo 'checked="checked"'?> /><label for="monthlyEach"> each</label></p>?
    344?                                                ?
    ?345?
    345346                                                <p><?php $thetable->showMonthlyOptions($therecord,$repeatBase)?></p>?
    346?                                                ?
    ?347?
    347348                                                <p><input type="radio" id="monthlyOnThe" name="monthlyWhat" onchange="monthlyChange();" value="2" <?php if($therecord["repeatontheday"]) echo 'checked="checked"'?> /><label for="monthlyOnThe"> on the</label></p>?
    348349                                                <p>?
    ? ? ?
    351352                                                </p>?
    352353                                        </div>?
    353?                ?
    ?354?
    354355                                        <div id="YearlyDiv">?
    355356                                                <p><?php $thetable->showYearlyOptions($therecord,$repeatBase)?></p>?
    356?                                                ?
    ?357?
    357358                                                <p><input id="yearlyOnThe" type="checkbox" name="yearlyOnThe" onclick="yearlyOnTheChecked();" value="1" <?php if($therecord["repeattype"]=="Yearly" && $therecord["repeatontheday"]) echo 'checked="checked"'?>/><label for="yearlyOnThe"> on the</label></p>?
    358359                                                <p>?
    ? ? ?
    360361                                                        <?php $theform->showField("yearlyontheday");?>?
    361362                                                </p>?
    362?                                                ?
    ?363?
    363364                                        </div>?
    364365                                </div>?
    365366                        </fieldset>?
    366?        ?
    ?367?
    367368                        <fieldset id="repeatEnding" <?php if(!$therecord["repeating"]) echo 'style="display:none"'?>>?
    368369                                <legend>end</legend>?
    ? ? ?
    383384                        <p>This record was created from a repeated task/event.</p>?
    384385                        <p>Click the <strong>Edit Repeating Options</strong> button to edit the options for the repeatable parent record.</p>?
    385?                        <p class="notes">Any unsaved changes with the current record will be lost.</p>                  ?
    ?386                        <p class="notes">Any unsaved changes with the current record will be lost.</p>?
    386387                        <p><input id="goparent" name="goparent" type="button" value="Edit Repeating Options..." onclick="goParent('<?php echo getAddEditFile($db,12) ?>')" class="Buttons" /></p>?
    387388                </fieldset>?
    388389                <?php }//endif ?>?
    389390        </div>?
    390?        <?php ?
    ?391        <?php?
    391392                $theform->showCreateModify($phpbms,$therecord);?
    392393                $theform->endForm();?
  • trunk/phpbms/modules/base/scheduler_addedit.php

    r290 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev: 197 $ | $LastChangedBy: brieb $?
    ? ? ?
    4545        $thetable = new schedulers($db,201);?
    4646        $therecord = $thetable->processAddEditPage();?
    47?        ?
    ?47?
    4848        if(isset($therecord["phpbmsStatus"]))?
    49?                $statusmessage = $therecord["phpbmsStatus"];    ?
    50?        ?
    ?49                $statusmessage = $therecord["phpbmsStatus"];?
    ?50?
    5151        $pageTitle="Scheduler";?
    52?        ?
    ?52?
    5353        $currentpath=getcwd();?
    54?        ?
    ?54?
    5555        $phpbms->cssIncludes[] = "pages/scheduler.css";?
    5656?
    ? ? ?
    5858                //==============================================================?
    5959                $theform = new phpbmsForm();?
    60?                ?
    ?60?
    6161                $theinput = new inputCheckbox("inactive",$therecord["inactive"]);?
    6262                $theform->addField($theinput);?
    ? ? ?
    7272                $theform->addField($theinput);?
    7373?
    74?                $theinput = new inputTimePicker("starttime",$therecord["starttime"], "start time" ,false,11, 15, false);?
    75?                $theinput->setAttribute("onchange","checkEndDate();");                          ?
    76?                $theform->addField($theinput);          ?
    77?                ?
    ?74                $theinput = new inputTimePicker("starttime",$therecord["starttime"], "start time" ,true,11, 15, false);?
    ?75                //$theinput->setAttribute("onchange","checkEndDate();");?
    ?76                $theform->addField($theinput);?
    ?77?
    7878                $theinput = new inputDatePicker("enddate",$therecord["enddate"], "end date" ,false, 11, 15, false);?
    7979                $theform->addField($theinput);?
    8080?
    8181                $theinput = new inputTimePicker("endtime",$therecord["endtime"], "end time" ,false,11, 15, false);?
    82?                $theform->addField($theinput);          ?
    ?82                $theform->addField($theinput);?
    8383?
    8484                $theform->jsMerge();?
    8585                //==============================================================?
    86?                //End Form Elements     ?
    87?                        ?
    ?86                //End Form Elements?
    ?87?
    8888        include("header.php");?
    89?        ?
    ?89?
    9090?><div class="bodyline">?
    91?        <?php $theform->startForm($pageTitle)?> ?
    92?        ?
    ?91        <?php $theform->startForm($pageTitle)?>?
    ?92?
    9393        <fieldset id="fsAttributes">?
    9494                <legend>attributes</legend>?
    ? ? ?
    9797                        <input id="id" name="id" type="text" value="<?php echo htmlQuotes($therecord["id"]); ?>" size="10" maxlength="10" readonly="readonly" class="uneditable" />?
    9898                </p>?
    99?                ?
    ?99?
    100100                <p><?php $theform->showField("inactive");?></p>?
    101101?
    ? ? ?
    105105                </p>?
    106106        </fieldset>?
    107?        ?
    ?107?
    108108        <div id="leftSideDiv">?
    109109                <fieldset>?
    ? ? ?
    116116                        <legend>Scheduled Job</legend>?
    117117?
    118?                        <p><?php $theform->showField("name");?></p>             ?
    ?118                        <p><?php $theform->showField("name");?></p>?
    119119?
    120120                        <p>?
    ? ? ?
    127127                        </p>?
    128128                </fieldset>?
    129?                ?
    ?129?
    130130                <fieldset>?
    131131                        <legend>Interval</legend>?
    ? ? ?
    151151                                </p>?
    152152                        <p class="notes" id="standarNotationP">(Uses standard crontab notation.)</p>?
    153?                        ?
    ?153?
    154154                </fieldset>?
    155155                <fieldset>?
    ? ? ?
    157157                        <p>?
    158158                                <label for="startdate">start</label><br />?
    159?                                <?php $theform->showField("startdate");?> &nbsp; <?php $theform->showField("starttime");?>      ?
    ?159                                <?php $theform->showField("startdate");?> &nbsp; <?php $theform->showField("starttime");?>?
    160160                        </p>?
    161161                        <p>?
    162162                                <label for="enddate">end</label><br />?
    163?                                <?php $theform->showField("enddate");?> &nbsp; <?php $theform->showField("endtime");?>  ?
    ?163                                <?php $theform->showField("enddate");?> &nbsp; <?php $theform->showField("endtime");?>?
    164164                        </p>?
    165165                </fieldset>?
    166166        </div>?
    167167?
    168?        <?php ?
    ?168        <?php?
    169169                $theform->showCreateModify($phpbms,$therecord);?
    170170                $theform->endForm();?
  • trunk/phpbms/modules/base/scheduler_delete_tempimport.php

    r427 r485 ?
    11<?php?
    2?if(!class_exists("appError"))?
    3?        include_once("../../include/session.php");?
    ?2?
    ?3//uncomment for debug purposes?
    ?4//if(!class_exists("appError"))?
    ?5//      include_once("../../include/session.php");?
    46?
    57class cleanImports{?
    6?        ?
    ?8?
    79        function cleanImports($db){?
    810                $this->db = $db;?
    911        }//end method --cleanImports--?
    10?        ?
    11?        function removeTempCSV($tempFileID = 0){?
    12?                        ?
    13?                        $querystatement = "?
    14?                                DELETE FROM?
    15?                                        `files`?
    16?                                WHERE?
    17?                                        `type` = 'phpbms/temp'?
    18?                                        AND?
    19?                                        (?
    20?                                                `id` = ".((int)$tempFileID)."?
    21?                                                OR?
    22?                                                `creationdate` <= NOW() - INTERVAL 30 MINUTE?
    23?                                        );?
    24?                                ";?
    25?                                ?
    26?                        $queryresult = $this->db->query($querystatement);?
    27?                        ?
    28?                }//end method --_removeTempCSV--?
    29?        ?
    ?12?
    ?13        function removeTempCSV(){?
    ?14?
    ?15                $querystatement = "?
    ?16                        DELETE FROM?
    ?17                                `files`?
    ?18                        WHERE?
    ?19                                `type` = 'phpbms/temp'?
    ?20                                AND?
    ?21                                `creationdate` <= NOW() - INTERVAL '30' MINUTE?
    ?22                                ;?
    ?23                        ";?
    ?24?
    ?25                $queryresult = $this->db->query($querystatement);?
    ?26?
    ?27        }//end method --_removeTempCSV--?
    ?28?
    3029}//end class --cleanImports--?
    3130?
  • trunk/phpbms/modules/base/snapshot.php

    r443 r485 ?
    4343        $pageTitle = APPLICATION_NAME;?
    4444?
    45?        $phpbms->cssIncludes[] = "pages/snapshot.css";?
    ?45        $phpbms->cssIncludes[] = "pages/base/snapshot.css";?
    4646?
    4747        $phpbms->jsIncludes[] = "modules/base/javascript/snapshot.js";?
    ? ? ?
    6363<div class="bodyline">?
    6464        <h1><?php echo $_SESSION["userinfo"]["firstname"]; if($_SESSION["userinfo"]["lastname"]) echo " ".$_SESSION["userinfo"]["lastname"]?>'s Snapshot</h1>?
    ?65?
    6566        <?php $myBase->showSystemMessages() ?>?
    6667?
  • trunk/phpbms/modules/base/tabs_addedit.php

    r285 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev: 205 $ | $LastChangedBy: brieb $?
    ? ? ?
    4646        ?
    4747        if(isset($therecord["phpbmsStatus"]))?
    48?                $statusmessage = $therecord["phpbmsStatus"];    ?
    ?48                $statusmessage = $therecord["phpbmsStatus"];?
    4949?
    50?        $pageTitle="Tab";       ?
    ?50        $pageTitle="Tab";?
    5151        $phpbms->cssIncludes[] = "pages/tabs.css";?
    5252?
    ? ? ?
    5454                //==============================================================?
    5555                $theform = new phpbmsForm();?
    56?                ?
    ?56?
    5757                $theinput = new inputField("name",$therecord["name"],NULL,true,NULL,32,64);?
    5858                $theinput->setAttribute("class","important");?
    ? ? ?
    6161                $theinput = new inputField("displayorder",$therecord["displayorder"],"display order",true,NULL,10,10);?
    6262                $theform->addField($theinput);?
    63?                                ?
    ?63?
    6464                $theinput = new inputRolesList($db,"roleid",$therecord["roleid"],"access (role)");?
    65?                $theform->addField($theinput);                  ?
    ?65                $theform->addField($theinput);?
    6666?
    6767                $theinput = new inputChoiceList($db,"tabgroup",$therecord["tabgroup"],"tabgroups", "tab group");?
    68?                $theform->addField($theinput);                  ?
    ?68                $theform->addField($theinput);?
    6969?
    7070                $theinput = new inputCheckbox("enableonnew",$therecord["enableonnew"],"enable on new");?
    71?                $theform->addField($theinput);                  ?
    72?                ?
    ?71                $theform->addField($theinput);?
    ?72?
    7373                $theform->jsMerge();?
    7474                //==============================================================?
    75?                //End Form Elements     ?
    76?                ?
    ?75                //End Form Elements?
    ?76?
    7777        include("header.php");?
    78?        ?
    ?78?
    7979?><div class="bodyline">?
    80?        <?php $theform->startForm($pageTitle)?> ?
    ?80        <?php $theform->startForm($pageTitle)?>?
    8181        <fieldset id="fsAttributes">?
    8282                <legend>attributes</legend>?
    ? ? ?
    8585                        <input id="id" name="id" type="text" value="<?php echo htmlQuotes($therecord["id"]); ?>" size="10" maxlength="10" readonly="readonly" class="uneditable" />?
    8686                </p>?
    87?                ?
    ?87?
    8888                <p>?
    8989                        <?php $theform->showField("displayorder"); ?><br />?
    9090                        <span class="notes">Lower numbers are displayed first.</span>?
    9191                </p>?
    92?                ?
    ?92?
    9393                <p><?php $theform->showField("roleid")?></p>?
    9494?
    ? ? ?
    9696?
    9797        </fieldset>?
    98?        ?
    ?98?
    9999        <div id="leftSideDiv">?
    100100                <fieldset>?
    ? ? ?
    104104?
    105105                        <p><?php $theform->showField("tabgroup"); ?></p>?
    106?                                ?
    ?106?
    107107                        <p>?
    108108                                <label for="location">location</label><br />?
    ? ? ?
    123123        </div>?
    124124?
    125?        <?php ?
    ?125        <?php?
    126126                $theform->showCreateModify($phpbms,$therecord);?
    127127                $theform->endForm();?
  • trunk/phpbms/modules/base/users_addedit.php

    r285 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev$ | $LastChangedBy$?
    ? ? ?
    4545        $thetable = new users($db,9);?
    4646        $therecord = $thetable->processAddEditPage();?
    47?        ?
    ?47?
    4848        if(isset($therecord["phpbmsStatus"]))?
    49?                $statusmessage = $therecord["phpbmsStatus"];    ?
    50?        ?
    ?49                $statusmessage = $therecord["phpbmsStatus"];?
    ?50?
    5151        $pageTitle="User";?
    52?        ?
    ?52?
    5353        $phpbms->cssIncludes[] = "pages/users.css";?
    5454        $phpbms->jsIncludes[] = "modules/base/javascript/users.js";?
    ? ? ?
    5858                $theform = new phpbmsForm();?
    5959                $theform->onsubmit="return submitForm(this);";?
    60?                ?
    ?60?
    6161                $theinput = new inputCheckbox("admin",$therecord["admin"],"administrator");?
    6262                $theform->addField($theinput);?
    63?                ?
    ?63?
    6464                $theinput = new inputCheckbox("revoked",$therecord["revoked"],"access revoked");?
    6565                $theform->addField($theinput);?
    ? ? ?
    8686                $theinput = new inputField("phone",$therecord["phone"],"phone/extension",false,"phone",32,64);?
    8787                $theform->addField($theinput);?
    88?                ?
    ?88?
    ?89                $theinput = new inputField("lastip", $therecord["lastip"], "last log in IP");?
    ?90                $theinput->setAttribute("readonly", "readonly");?
    ?91                $theinput->setAttribute("class", "uneditable");?
    ?92                $theform->addField($theinput);?
    ?93?
    8994                $theinput = new inputChoiceList($db,"department",$therecord["department"],"department");?
    9095                $theform->addField($theinput);?
    ? ? ?
    9297                $theform->jsMerge();?
    9398                //==============================================================?
    94?                //End Form Elements     ?
    95?                        ?
    ?99                //End Form Elements?
    ?100?
    96101        include("header.php");?
    97?        ?
    ?102?
    98103?><div class="bodyline">?
    99?        <?php $theform->startForm($pageTitle)?>         ?
    ?104        <?php $theform->startForm($pageTitle)?>?
    100105        <fieldset id="fsAttributes">?
    101106                <legend>attributes</legend>?
    102?                ?
    ?107?
    103108                <p>?
    104109                        <label for="id">id</label><br />?
    105?                        <input id="id" name="id" type="text" value="<?php echo $therecord["id"]; ?>" size="5" maxlength="5" readonly="readonly" class="uneditable"/>            ?
    ?110                        <input id="id" name="id" type="text" value="<?php echo $therecord["id"]; ?>" size="5" maxlength="5" readonly="readonly" class="uneditable"/>?
    106111                </p>?
    107112?
    ? ? ?
    117122                </p>?
    118123        </fieldset>?
    119?        ?
    ?124?
    120125        <div id="leftSideDiv">?
    121126                <fieldset id="fsName">?
    ? ? ?
    135140                        <p>?
    136141                                <label for="lastlogin" >last log in</label><br />?
    137?                                <input id="lastlogin" name="lastlogin" type="text" value="<?php echo formatFromSQLDateTime($therecord["lastlogin"]); ?>" size="32" maxlength="64" readonly="readonly" class="uneditable"  />                    ?
    138?                        </p>?
    ?142                                <input id="lastlogin" name="lastlogin" type="text" value="<?php echo formatFromSQLDateTime($therecord["lastlogin"]); ?>" size="32" maxlength="64" readonly="readonly" class="uneditable"  />?
    ?143                        </p>?
    ?144?
    ?145                        <p><?php $theform->showField("lastip"); ?></p>?
    139146?
    140147                        <p>?
    141148                                <label for="password">set new password</label><br />?
    142?                                <input id="password" name="password" type="password" size="32" maxlength="32" />                        ?
    143?                        </p>?
    144?                        ?
    ?149                                <input id="password" name="password" type="password" size="32" maxlength="32" />?
    ?150                        </p>?
    ?151?
    145152                        <p>?
    146153                                <label for="password2">confirm new password</label><br />?
    ? ? ?
    155162?
    156163                        <p><?php $theform->showField("phone");?></p>?
    157?                        ?
    ?164?
    158165                        <p><?php $theform->showField("department");?></p>?
    159166?
    160167                        <p>?
    161168                                <label for="employeenumber">employee number</label><br />?
    162?                                <input type="text" id="employeenumber" name="employeenumber" value="<?php echo htmlQuotes($therecord["employeenumber"]) ?>" size="32" maxlength="32" />                 ?
    ?169                                <input type="text" id="employeenumber" name="employeenumber" value="<?php echo htmlQuotes($therecord["employeenumber"]) ?>" size="32" maxlength="32" />?
    163170                        </p>?
    164171                </fieldset>?
    ? ? ?
    190197                        </div>?
    191198                        </div>?
    192?                </fieldset>             ?
    ?199                </fieldset>?
    193200                <?php }?>?
    194?        </div>  ?
    195??
    196?        <?php ?
    ?201        </div>?
    ?202?
    ?203        <?php?
    197204                $theform->showCreateModify($phpbms,$therecord);?
    198205                $theform->endForm();?
  • trunk/phpbms/modules/bms/clients_addedit.php

    r419 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev$ | $LastChangedBy$?
    ? ? ?
    3737 +-------------------------------------------------------------------------+?
    3838*/?
    ?39?
    3940        include("../../include/session.php");?
    4041        include("include/tables.php");?
    ? ? ?
    4445        include("include/clients.php");?
    4546?
    46?        if(!isset($_GET["backurl"])) ?
    47?                $backurl = NULL; ?
    48?        else{ ?
    ?47        if(!isset($_GET["backurl"]))?
    ?48                $backurl = NULL;?
    ?49        else{?
    4950                $backurl = $_GET["backurl"];?
    5051                if(isset($_GET["refid"]))?
    ? ? ?
    5455        $thetable = new clients($db,2,$backurl);?
    5556        $therecord = $thetable->processAddEditPage();?
    56?        ?
    ?57?
    5758        if(isset($therecord["phpbmsStatus"]))?
    5859                $statusmessage = $therecord["phpbmsStatus"];?
    59?        ?
    ?60?
    6061        $pageTitle=ucwords($therecord["type"]);?
    6162?
    6263        if($therecord["inactive"])?
    6364                $pageTitle="Inactive ".$pageTitle;?
    64?                ?
    65?                ?
    ?65?
    ?66?
    6667        $phpbms->cssIncludes[] = "pages/client.css";?
    6768        $phpbms->jsIncludes[] = "modules/bms/javascript/client.js";?
    ? ? ?
    7071                //==============================================================?
    7172                $theform = new phpbmsForm();?
    72?                ?
    ?73?
    7374                $phpbms->bottomJS[] = 'var thefirstname=getObjectFromID("firstname");thefirstname.focus();';?
    74?                ?
    ?75?
    7576                $theinput = new inputCheckbox("inactive",$therecord["inactive"]);?
    7677                $theform->addField($theinput);?
    77?                ?
    ?78?
    7879                $theinput = new inputBasicList("type",$therecord["type"],array("prospect"=>"prospect","client"=>"client"), "type");?
    7980                $theinput->setAttribute("class","important");?
    ? ? ?
    8687                }//endif?
    8788                $theform->addField($theinput);?
    88?                ?
    ?89?
    8990                $theinput = new inputChoiceList($db, "category",$therecord["category"],"clientcategories");?
    9091                $theform->addField($theinput);?
    ? ? ?
    9293                $theinput = new inputSmartSearch($db, "salesmanagerid", "Pick Active User", $therecord["salesmanagerid"], "sales person");?
    9394                $theform->addField($theinput);?
    94?                ?
    ?95?
    9596                $theinput = new inputChoiceList($db, "leadsource",$therecord["leadsource"],"leadsource", "lead source");?
    9697                $theinput->setAttribute("class","small");?
    9798                $theform->addField($theinput);?
    98?                ?
    ?99?
    99100                $theinput = new inputDataTableList($db, "paymentmethodid",$therecord["paymentmethodid"],"paymentmethods","id","name",?
    100101                                                                "inactive=0", "priority,name", true, "payment method");?
    ? ? ?
    104105                                                                "inactive=0", "priority,name", true, "shipping method");?
    105106                $theform->addField($theinput);?
    106?                ?
    ?107?
    107108                $theinput = new inputDataTableList($db, "discountid",$therecord["discountid"],"discounts","id","name",?
    108109                                                                "inactive=0", "name", true, "discount");?
    ? ? ?
    112113                                                                "inactive=0", "name", true, "tax area");?
    113114                $theform->addField($theinput);?
    114?                ?
    ?115?
    115116                $theinput = new inputField("workphone",$therecord["workphone"],"work phone",false,"phone",25,32);?
    116117                $theform->addField($theinput);?
    ? ? ?
    133134                $theinput = new inputField("webaddress",$therecord["webaddress"],"web address",false,"www",68,128);?
    134135                $theform->addField($theinput);?
    135?                ?
    ?136?
    136137                $theinput = new inputField("taxid", $therecord["taxid"], "tax id", false, "", 25, 32);?
    137138                $theform->addField($theinput);?
    ? ? ?
    140141                //==============================================================?
    141142                //End Form Elements?
    142?         ?
    143?        include("header.php");  ?
    ?143?
    ?144        include("header.php");?
    144145?
    145146        $action = htmlQuotes($_SERVER["REQUEST_URI"]);?
    ? ? ?
    155156?
    156157        <h1 id="h1Title"><span><?php echo $pageTitle ?></span></h1>?
    157?        ?
    ?158?
    158159        <div id="rightSideDiv">?
    159160                <?php if(isset($_GET["invoiceid"])){?>?
    ? ? ?
    161162                        <input name="gotoinvoice" id="gotoinvoice" type="button" value="return to order" onclick="location.href='<?php echo getAddEditFile($db,3) ?>?id=<?php echo $_GET["invoiceid"] ?>'" class="Buttons" />?
    162163                </p>?
    163?                <?php } ?>                      ?
    ?164                <?php } ?>?
    164165                <fieldset>?
    165166                        <legend>attributes</legend>?
    ? ? ?
    170171                                <input type="hidden" id="creditlimit" name="creditlimit" value="<?php echo $therecord["creditlimit"]?>"/>?
    171172                        </p>?
    172?                                ?
    ?173?
    173174                        <p><?php $theform->showField("type");?></p>?
    174?                        ?
    ?175?
    175176                        <p><?php $theform->showField("inactive")?></p>?
    176?                        ?
    ?177?
    177178                        <p id="becameclientDiv" <?php if($therecord["type"]=="prospect") echo "style=\"display:none;\"" ?>>?
    178179                                <label for="becameclient">became a client</label><br />?
    179180                                <input type="text" id="becameclient" name="becameclient" readonly="readonly" class="uneditable" value="<?php echo formatFromSQLDate($therecord["becameclient"])?>" size="8" />?
    180181                        </p>?
    181?                        ?
    ?182?
    182183                        <p><?php $theform->showField("category")?></p>?
    183?                        ?
    184?                </fieldset>?
    185?        ?
    ?184?
    ?185                </fieldset>?
    ?186?
    186187                <fieldset>?
    187188                        <legend>sales</legend>?
    188189                        <div class="fauxP"><?php $theform->showField("salesmanagerid")?></div>?
    189?                        ?
    ?190?
    190191                        <p><?php $theform->showField("leadsource")?></p>?
    191192                </fieldset>?
    192?                                ?
    ?193?
    193194                <fieldset>?
    194195                        <legend>order defaults</legend>?
    ? ? ?
    220221                </fieldset>?
    221222        </div>?
    222?                ?
    223?        <div id="leftSideDiv">          ?
    ?223?
    ?224        <div id="leftSideDiv">?
    224225                <fieldset>?
    225226                        <legend>name / company</legend>?
    ? ? ?
    230231                        <p>?
    231232                                <label for="lastname" class="important">last name</label><br />?
    232?                                <input id="lastname" name="lastname" type="text" value="<?php echo htmlQuotes($therecord["lastname"])?>" size="32" maxlength="65" class="important" />                          ?
    ?233                                <input id="lastname" name="lastname" type="text" value="<?php echo htmlQuotes($therecord["lastname"])?>" size="32" maxlength="65" class="important" />?
    233234                        </p>?
    234235                        <p>?
    ? ? ?
    236237                                <input name="company" type="text" id="company" value="<?php echo htmlQuotes($therecord["company"])?>" size="71" maxlength="128" class="important"/>?
    237238                        </p>?
    238?                </fieldset>     ?
    239?                                                        ?
    240?                <fieldset>                                      ?
    ?239                </fieldset>?
    ?240?
    ?241                <fieldset>?
    241242                        <legend>contact</legend>?
    242243?
    243244                        <p class="phonelefts"><?php $theform->showField("workphone")?></p>?
    244?                        ?
    ?245?
    245246                        <p><?php $theform->showField("homephone")?></p>?
    246?                        ?
    ?247?
    247248                        <p class="phonelefts"><?php $theform->showField("mobilephone")?></p>?
    248249?
    249250                        <p><?php $theform->showField("fax")?></p>?
    250?                        ?
    ?251?
    251252                        <p><?php $theform->showField("otherphone")?></p>?
    252?                        ?
    ?253?
    253254                        <p><?php $theform->showField("email")?></p>?
    254?                        ?
    ?255?
    255256                        <p><?php $theform->showField("webaddress")?></p>?
    256?                        ?
    ?257?
    257258                        <p><?php $theform->showField("taxid")?></p>?
    258259                </fieldset>?
    259?                ?
    ?260?
    260261                <fieldset>?
    261262                        <legend>?
    ? ? ?
    263264                                <button type="button" class="graphicButtons buttonMap" id="buttonMap" title="show map"><span>map</span></button>?
    264265                        </legend>?
    265?                        ?
    ?266?
    266267                        <p>?
    267268                                <input type="hidden" id="addressid" name="addressid" value="<?php echo $therecord["addressid"]?>"/>?
    ? ? ?
    281282                        <p>?
    282283                                <label for="postalcode">zip/postal code</label><br />?
    283?                                <input name="postalcode" type="text" id="postalcode" value="<?php echo htmlQuotes($therecord["postalcode"])?>" size="12" maxlength="15" />                              ?
    ?284                                <input name="postalcode" type="text" id="postalcode" value="<?php echo htmlQuotes($therecord["postalcode"])?>" size="12" maxlength="15" />?
    284285                        </p>?
    285286                        <p>?
    ? ? ?
    287288                                <input id="country" name="country" type="text" value="<?php echo htmlQuotes($therecord["country"])?>" size="44" maxlength="128" />?
    288289                        </p>?
    289?                        ?
    290?                </fieldset>?
    291?                ?
    292?                ?
    ?290?
    ?291                </fieldset>?
    ?292?
    ?293?
    293294                <fieldset>?
    294295                        <legend><label for="comments">memo</label></legend>?
    ? ? ?
    297298                        </p>?
    298299                </fieldset>?
    299?                ?
    ?300?
    300301        </div><?php $theform->showCreateModify($phpbms,$therecord);?>?
    301302        </div>?
  • trunk/phpbms/modules/bms/clients_import.php

    r432 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev: 258 $ | $LastChangedBy: brieb $?
    ? ? ?
    4343        include("include/imports.php");?
    4444        include("include/parsecsv.lib.php");?
    45?        ?
    ?45?
    4646        //if you need to overide the phpbmsTable class make sure to include the modules file?
    47?        ?
    ?47?
    4848        include("modules/bms/include/clients.php");?
    4949        include("modules/bms/include/addresses.php");?
    50?        include("modules/bms/include/addresstorecord.php");     ?
    51??
    52?        //If the addedit page will be accessd directly from a page other than the ?
    ?50        include("modules/bms/include/addresstorecord.php");?
    ?51?
    ?52        //If the addedit page will be accessd directly from a page other than the?
    5353        // basic search results page, you may want to grab and pass the previous URL?
    5454        //with the following code?
    5555?
    5656        //===================================================?
    57?        if(!isset($_GET["backurl"])) ?
    58?                $backurl = NULL; ?
    59?        else{ ?
    ?57        if(!isset($_GET["backurl"]))?
    ?58                $backurl = NULL;?
    ?59        else{?
    6060                $backurl = $_GET["backurl"];?
    6161                if(isset($_GET["refid"]))?
    ? ? ?
    6666        if(isset($_GET["id"]))?
    6767                $tabledefid = ((int)$_GET["id"]);?
    68?        ?
    ?68?
    6969?
    7070        //Here you invoke the table and import classes.  If you are going to use the standard phpbmsTable class?
    7171        // for updates and the such you would access it like this?
    72?        ?
    ?72?
    7373                        //$thetable = new phpbmsTable($db,$tabledefid);?
    7474                        //$import = new phpbmsImport($thetable);?
    75?        ?
    ?75?
    7676        //if you are going to overide the class you would instantiate?
    7777        // like this?
    78?                        ?
    ?78?
    7979                        $importType = "csv";?
    8080                        if(isset($_POST["importType"])){?
    81?                                ?
    ?81?
    8282                                switch($_POST["importType"]){?
    83?                                        ?
    ?83?
    8484                                        case 0:?
    8585                                                $importType = "csv";?
    8686                                        break;?
    87?                                        ?
    ?87?
    8888                                        case 1:?
    8989                                                $importType = "sugarcrm";?
    9090                                        break;?
    91?                                        ?
    ?91?
    9292                                }//end switch?
    93?                                ?
    ?93?
    9494                        }//end if?
    95?        ?
    ?95?
    9696                        $thetable = new clients($db,2,$backurl);?
    9797                        $import = new clientsImport($thetable, $importType);?
    98?        ?
    ?98?
    9999        //and if you are setting the backurl, make sure you pass that as well?
    100100        // like this:?
    101?        ?
    ?101?
    102102        //              $thetable = new [tablename]($db,[table definition id],$backurl);?
    103?        ?
    104?        ?
    105?        //Next we process the form (if submitted) and ?
    ?103?
    ?104?
    ?105        //Next we process the form (if submitted) and?
    106106        // return the current record as an array ($therecord)?
    107107        // or if this is a new record, it returns the defaults?
    ? ? ?
    114114?
    115115        $pageTitle = ($therecord["title"])?$therecord["title"]:"General Table Import";?
    116?        ?
    ?116?
    117117        // Next, we set up to include any?
    118118        // additional css or javascript files we will be using?
    ? ? ?
    124124?
    125125        // if you need to define a body onlload function, do so with the phpbms property?
    126?        ?
    ?126?
    127127        //              $phpbms->onload[] = "initializePage()";?
    128128?
    ? ? ?
    130130        // Next we need to define any special fields that will be used in the form?
    131131        // A list of field objects (with documentation)is available in the /include/fields.php?
    132?        // file.  ?
    133?        ?
    ?132        // file.?
    ?133?
    134134        // We need to define them here in the head?
    135135        // so that any necessay javascript is loaded appropriately.?
    136?        ?
    ?136?
    137137                //Form Elements?
    138138                //==============================================================?
    139?                ?
    ?139?
    140140                // Create the form?
    141141                $theform = new importForm();?
    ? ? ?
    143143                //if you need to set specific form vaiables (like enctype, or extra onsubmit?
    144144                // you can set those form properties here.?
    145?                ?
    146?                // for each field we will use, create the field object and add it to ?
    ?145?
    ?146                // for each field we will use, create the field object and add it to?
    147147                // the forms list.?
    148?                ?
    ?148?
    149149                $list = array("phpBMS csv file" => 0, "Sugar CRM (v5.0)" => 1);?
    150150                $default = 0;?
    ? ? ?
    163163                $theform->jsMerge();?
    164164                //==============================================================?
    165?                //End Form Elements     ?
    166??
    167?        include("header.php");  ?
    168?        ?
    ?165                //End Form Elements?
    ?166?
    ?167        include("header.php");?
    ?168?
    169169?><div class="bodyline">?
    170?        <!-- ?
    ?170        <!--?
    171171                Next we start the form.  This also prints the H1 with title, and top save,cancel buttons?
    172172                If you need to have other buttons, or need a specific top, you will need to create your form manually.?
    173173        -->?
    174?        <?php $theform->startForm($pageTitle, $import->pageType)?>?
    ?174        <?php $theform->startForm($pageTitle, $import->pageType, count($import->transactionRecords))?>?
    175175?
    176176        <div id="leftSideDiv">?
    ? ? ?
    180180                <!-- /* This next input also determines whether the file/import fieldset will be displayed or if the preview sections will be displayed*/ -->?
    181181                <input id="pageType" name="pageType" type="hidden" value="<?php echo $import->pageType?>" />?
    182?                ?
    ?182?
    183183                <?php?
    184184                if($import->pageType == "main"){ ?>?
    185185                <fieldset>?
    186186                        <legend>import</legend>?
    187?                        ?
    ?187?
    188188                        <p><?php $theform->showField("importType"); ?></p>?
    189?                        ?
    ?189?
    190190                        <div id="uploadlabel">?
    191191                                <p>?
    ? ? ?
    193193                                        <input id="import" name="import" type="file" size="64"/><br/>?
    194194                                </p>?
    195?                                ?
    ?195?
    196196                                <div id="info0" class="info">?
    197197                                        <p>?
    ? ? ?
    244244                <?php?
    245245                }//end if?
    246?                ?
    ?246?
    247247                if($import->error && $import->pageType != "main"){?
    248248                        ?>?
    ? ? ?
    259259        </div>?
    260260        <div id="createmodifiedby" >?
    261?        <?php   ?
    ?261        <?php?
    262262                //Last, we show the create/modifiy with the bottom save and cancel buttons?
    263263                // and then close the form.?
    264?                $theform->showButtons(2, $import->pageType);?
    ?264                $theform->showButtons(2, $import->pageType, count($import->transactionRecords));?
    265265                ?></div><?php?
    266266                $theform->endForm();?
  • trunk/phpbms/modules/bms/include/addresses.php

    r384 r485 ?
    4141        class addresses extends phpbmsTable{?
    4242?
    ?43                function getName($tabledefid, $recordid){?
    4344?
    44?                function getName($tabledefid, $recordid){?
    45?                ?
    4645                        switch($tabledefid){?
    47?                        ?
    ?46?
    4847                                case 2:?
    4948                                default:?
    5049                                        $querystatement = "?
    51?                                                SELECT ?
    ?50                                                SELECT?
    5251                                                        if(clients.lastname!='',concat(clients.lastname,', ',clients.firstname,if(clients.company!='',concat(' (',clients.company,')'),'')),clients.company) AS thename?
    5352                                                FROM?
    ? ? ?
    5655                                                        id = ".$recordid;?
    5756                                        break;?
    58?                                                        ?
    ?57?
    5958                        }//endswitch tabledefid?
    60?                ?
    ?59?
    6160                        $queryresult = $this->db->query($querystatement);?
    62?                        ?
    ?61?
    6362                        if($this->db->numRows($queryresult)){?
    64?                        ?
    ?63?
    6564                                $therecord = $this->db->fetchArray($queryresult);?
    6665                                return htmlQuotes($therecord["thename"]);?
    67?                                ?
    ?66?
    6867                        } else?
    6968                                return "orphaned record: tableDefinitionID=".$tabledefid.", RecordID:".$recordid;?
    70?                ?
    ?69?
    7170                }//end method - getName?
    72?                ?
    ?71?
    7372?
    7473                function showAssociations($addressid){?
    75?                        // This function generates a table listing all the records ?
    ?74                        // This function generates a table listing all the records?
    7675                        // associated with the address record.?
    77?                        ?
    ?76?
    7877                        $querystatement = "?
    7978                                SELECT?
    ? ? ?
    8180                                        addresstorecord.recordid,?
    8281                                        addresstorecord.primary,?
    83?                                        addresstorecord.defaultshipto                                   ?
    84?                                FROM ?
    ?82                                        addresstorecord.defaultshipto?
    ?83                                FROM?
    8584                                        addresstorecord?
    8685                                WHERE?
    ? ? ?
    8988                                        addresstorecord.tabledefid?
    9089                        ";?
    91?                        ?
    ?90?
    9291                        $queryresult = $this->db->query($querystatement);?
    93?                        ?
    ?92?
    9493                        ?>?
    9594                        <table class="querytable" cellspacing="0" cellpadding="0" border="0">?
    ? ? ?
    108107                                </tfoot>?
    109108                                <tbody>?
    110?                                <?php ?
    ?109                                <?php?
    111110                                        $row =1;?
    112111                                        while($therecord = $this->db->fetchArray($queryresult)) {?
    113?                                        ?
    ?112?
    114113                                                $row = ($row==1)? 2:1;?
    115?                                                ?
    ?114?
    116115                                                ?><tr class="qr<?php echo $row?>">?
    117116                                                        <td><?php echo $therecord["recordid"]?></td>?
    ? ? ?
    121120                                                </tr>?
    122121                                                <?php?
    123?                                                ?
    124?                                        }//endwhile - therecord                                 ?
    ?122?
    ?123                                        }//endwhile - therecord?
    125124                                ?>?
    126125                                </tbody>?
    127126                        </table>?
    128127                        <?php?
    129?                ?
    ?128?
    130129                }//end method - showAssociation?
    131130?
    ?131        }//end class?
    132132?
    133?                // CLASS OVERRIDES =================================================?
    134?                        ?
    135?                function formatVariables($variables){?
    136?                                                ?
    137?                        return $variables;                      ?
    138?                ?
    139?                }//end function?
    140?        ?
    141?        ?
    142?                function updateRecord($variables, $modifiedby = NULL){?
    143?        ?
    144?                        $variables = $this->formatVariables($variables);?
    145??
    146?                        $thereturn = parent::updateRecord($variables, $modifiedby);?
    147?                                                ?
    148?                        return $thereturn;?
    149?                        ?
    150?                }//end method?
    151?                ?
    152?                ?
    153?                function insertRecord($variables, $createdby = NULL){?
    154?                ?
    155?                        $variables = $this->formatVariables($variables);?
    156?        ?
    157?                        $newid = parent::insertRecord($variables, $createdby);?
    158?                                                                        ?
    159?                        return $newid;?
    160?                        ?
    161?                }//end method?
    162?                        ?
    163?        }//end class?
    164?        ?
    165133}//end if?
    166134?
    167135if(class_exists("searchFunctions")){?
    168136        class filesSearchFunctions extends searchFunctions{?
    169?        ?
    ?137?
    170138                function delete_record(){?
    171?                ?
    ?139?
    172140                        $whereclause = $this->buildWhereClause();?
    173141                        $attachmentwhereclause = $this->buildWhereClause("attachments.fileid");?
    174?                ?
    ?142?
    175143                        $querystatement = "DELETE FROM attachments WHERE ".$attachmentwhereclause." AND attachments.fileid!=1;";?
    176144                        $queryresult = $this->db->query($querystatement);?
    177?                ?
    ?145?
    178146                        $querystatement = "DELETE FROM files WHERE ".$whereclause." AND files.id!=1;";?
    179147                        $queryresult = $this->db->query($querystatement);?
    180?                        ?
    ?148?
    181149                        $message = $this->buildStatusMessage();?
    182150                        $message.=" deleted";?
    183151                        return $message;?
    184152                }?
    185?        ?
    ?153?
    186154        }//end class?
    187155}//end if?
  • trunk/phpbms/modules/bms/include/addresstorecord.php

    r427 r485 ?
    3939if(class_exists("addresses")){?
    4040        class addresstorecord extends addresses{?
    41?        ?
    ?41?
    ?42                var $availableTabledefIDs = array();?
    ?43                var $availableTabledefNames = array();?
    4244?
    4345                function createAddressToRecord($variables, $addressid, $createdby = NULL){?
    4446                        // This functions adds the addresstorecord record tying the client and address?
    4547                        // records.?
    46?                ?
    ?48?
    4749                        if(!$createdby && isset($_SESSION["userinfo"]["id"]))?
    4850                                $createdby = $_SESSION["userinfo"]["id"];?
    49?                                ?
    ?51?
    5052                        $insertstatement = "?
    5153                                INSERT INTO?
    ? ? ?
    7072                                        NOW(),?
    7173                                        ".((int) $createdby).",?
    72?                                        NOW()                                   ?
    ?74                                        NOW()?
    7375                                )";?
    74?                        ?
    ?76?
    7577                        $insertresult = $this->db->query($insertstatement);?
    76?                        ?
    ?78?
    7779                        if($insertresult)?
    7880                                return $this->db->insertId();?
    7981                        else?
    8082                                return false;?
    81?                        ?
    ?83?
    8284                }//end method - createAddressToRecord?
    83?                ?
    ?85?
    8486                // CLASS OVERRIDES ===============================================?
    8587                // ===============================================================?
    8688                function getRecord($id){?
    8789                        $id = (int) $id;?
    88?                        ?
    ?90?
    8991                        $querystatement = "?
    9092                                SELECT?
    91?                                        *       ?
    92?                                FROM ?
    93?                                        addresstorecord?
    94?                                WHERE ?
    95?                                        id = ".$id;                     ?
    96?                                        ?
    ?93                                        *?
    ?94                                FROM?
    ?95                                        addresstorecord?
    ?96                                WHERE?
    ?97                                        id = ".$id;?
    ?98?
    9799                        $queryresult = $this->db->query($querystatement);?
    98?                        if($this->db->numRows($queryresult)) { ?
    99?                        ?
    ?100                        if($this->db->numRows($queryresult)) {?
    ?101?
    100102                                $therecord = $this->db->fetchArray($queryresult);?
    101103                                $addressrecord = parent::getRecord($therecord["addressid"]);?
    102104?
    103105                                unset($addressrecord["id"], $addressrecord["createdby"], $addressrecord["creationdate"], $addressrecord["modifiedby"], $addressrecord["modifieddate"]);?
    104?                                ?
    ?106?
    105107                                $therecord = array_merge($addressrecord, $therecord);?
    106?                                ?
    107?                        } else ?
    ?108?
    ?109                        } else?
    108110                                $therecord = $this->getDefaults();?
    109111?
    110112                        return $therecord;?
    111?        ?
    ?113?
    112114                }//end method - getRecord?
    113?                ?
    114?                ?
    ?115?
    ?116?
    115117                function getDefaults(){?
    116?                ?
    ?118?
    117119                        $therecord = parent::getDefaults();?
    118?                        ?
    ?120?
    119121                        $therecord["addressid"] = 0;?
    120122                        $therecord["tabledefid"] = 0;?
    121123                        $therecord["recordid"] = NULL;?
    122124                        $therecord["defaultshipto"] = 0;?
    123?                        $therecord["primary"] = 0;                      ?
    124?                        ?
    125?                        return $therecord;      ?
    126?        ?
    ?125                        $therecord["primary"] = 0;?
    ?126?
    ?127                        return $therecord;?
    ?128?
    127129                }//end method - getDefauls?
    128?                ?
    129?                ?
    130??
    131?                function formatVariables($variables){?
    132?                        ?
    ?130?
    ?131?
    ?132                function populateTabledefArrays(){?
    ?133?
    ?134                        $this->availableTabledefIDs = array();?
    ?135                        $this->availableTabledefNames = array();?
    ?136?
    ?137                        $querystatement = "?
    ?138                                SELECT?
    ?139                                        `id`,?
    ?140                                        `maintable`?
    ?141                                FROM?
    ?142                                        `tabledefs`;?
    ?143                                ";?
    ?144?
    ?145                        $queryresult = $this->db->query($querystatement);?
    ?146?
    ?147                        if($this->db->numRows($queryresult)){?
    ?148                                while($therecord = $this->db->fetchArray($queryresult)){?
    ?149                                        $this->availableTabledefIDs[] = $therecord["id"];?
    ?150                                        $this->availableTabledefNames[$therecord["id"]] = $therecord["maintable"];?
    ?151                                }//end while?
    ?152                        }else{?
    ?153                                $this->availableTabledefIDs[] = "none";?
    ?154                                $this->availableTabledefNames[] = "none";?
    ?155                        }//end if?
    ?156?
    ?157                }//end method --populateTabledefArray--?
    ?158?
    ?159?
    ?160                function checkRecordID($recordid, $tablename){?
    ?161?
    ?162                        $recordid = ((int) $recordid);?
    ?163                        $tablename = addslashes($tablename);?
    ?164?
    ?165                        $querystatement = "?
    ?166                                SELECT?
    ?167                                        `id`?
    ?168                                FROM?
    ?169                                        `".$tablename."`?
    ?170                                WHERE?
    ?171                                        `id` = '".$recordid."';?
    ?172                                ";?
    ?173?
    ?174                        $queryresult = $this->db->query($querystatement);?
    ?175?
    ?176                        return $this->db->numRows($queryresult);?
    ?177?
    ?178                }//end method --checkRecordID--?
    ?179?
    ?180?
    ?181                function verifyVariables($variables){?
    ?182                        //POSSIBLY CHANGE>>>> NOT FINISHIED >>>>?
    ?183                        //Check tabledefs?
    ?184                        if(isset($variables["tabledefid"])){?
    ?185?
    ?186                                if(is_numeric($variables["tabledefid"])){?
    ?187?
    ?188                                        if(!count($this->availableTabledefIDs) || !count($this->availableTabledefNames))?
    ?189                                                $this->populateTabledefArrays();?
    ?190?
    ?191                                        if(in_array($variables["tabledefid"], $this->availableTabledefIDs)){?
    ?192?
    ?193                                                //check recordid?
    ?194                                                if(isset($variables["recordid"])){?
    ?195?
    ?196                                                        if((int) $variables["recordid"] > 0){?
    ?197?
    ?198                                                                if(!count($this->availableTabledefIDs) || !count($this->availableTabledefNames))?
    ?199                                                                        $this->populateTabledefArrays();?
    ?200?
    ?201                                                                if(!$this->checkRecordID($variables["recordid"], $this->availableTabledefNames[$variables["tabledefid"]]))?
    ?202                                                                        $this->verifyErrors[] = "The `recordid` field does match an id number in ".$this->availableTabledefNames[$variables["tabledefid"]].".";?
    ?203?
    ?204                                                        }else?
    ?205                                                                $this->verifyErrors[] = "The `recordid` field must be a positive number.";?
    ?206?
    ?207                                                }else?
    ?208                                                        $this->verifyErrors[] = "The `recordid` field must be set.";?
    ?209?
    ?210                                        }else?
    ?211                                                $this->verifyErrors[] = "The `tabledefid` field does not give an existing/acceptable table definition id number.";?
    ?212?
    ?213                                }else?
    ?214                                        $this->verifyErrors[] = "The `tabledefid` field must be numeric.";?
    ?215?
    ?216                        }else?
    ?217                                $this->verifyErrors[] = "The `tabledefid` field must be set.";?
    ?218?
    ?219                        return parent::verifyVariables($variables);?
    ?220?
    ?221                }//end method --verifyVariables--?
    ?222?
    ?223?
    ?224                function prepareVariables($variables){?
    ?225?
    133226                        if(!isset($variables['primary']))?
    134227                                $variables['primary'] = 0;?
    ? ? ?
    136229                        if(!isset($variables['defaultshipto']))?
    137230                                $variables['defaultshipto'] = 0;?
    138?                        ?
    ?231?
    139232                        if(!isset($variables["existingaddressid"]))?
    140233                                $variables["existingaddressid"] = false;?
    141?                                                ?
    142?                        return $variables;                      ?
    143?                ?
    ?234?
    ?235                        if(isset($variables["id"]))?
    ?236                                if($variables["id"]){// if update?
    ?237?
    ?238                                        $variables["id"] = $variables["addressid"];?
    ?239?
    ?240                                }//end if?
    ?241?
    ?242                        return $variables;?
    ?243?
    144244                }//end function?
    145245?
    146246?
    147??
    148?                function updateRecord($variables, $modifiedby = NULL){?
    149?        ?
    150?                        $variables = $this->formatVariables($variables);?
    151??
    152?                        $variables["id"] = $variables["addressid"];?
    153?        ?
    154?                        $thereturn = parent::updateRecord($variables, $modifiedby);?
    155?                                                ?
    156?                        return $thereturn;?
    157?                        ?
    158?                }//end method?
    159?                ?
    160?        ?
    161247                function insertRecord($variables, $createdby = NULL){?
    162248?
    163?                        $variables = $this->formatVariables($variables);?
    ?249                        //$variables = $this->prepareVariables($variables);?
    164250?
    165251                        if($variables["existingaddressid"]){?
    166?                        ?
    ?252?
    167253                                $this->createAddressToRecord($variables, $variables["existingaddressid"], $createdby);?
    168?                                ?
    ?254?
    169255                                $newAtrID = $variables["existingaddressid"];?
    170?                        ?
    ?256?
    171257                        } else {?
    172258?
    173259                                $newid = parent::insertRecord($variables, $createdby);?
    174?                                ?
    ?260?
    175261                                //create the addresstorecord?
    176262                                $newAtrID = $this->createAddressToRecord($variables, $newid, $createdby);?
    177?                                ?
    ?263?
    178264                        }//endif - existingaddressid?
    179?                        ?
    ?265?
    180266                        return $newAtrID;?
    181?                                        ?
    ?267?
    182268                }//end method?
    183?                ?
    ?269?
    184270        }//end class?
    185271}//end if?
    ? ? ?
    192278?
    193279                        $whereclause = $this->buildWhereClause();?
    194?                        ?
    ?280?
    195281                        //We need to itterate trhough each record?
    196?                        // to check for cross-record addresses                  ?
    ?282                        // to check for cross-record addresses?
    197283                        $querystatement = "?
    198284                                SELECT?
    ? ? ?
    201287                                        addresstorecord?
    202288                                WHERE ".$whereclause;?
    203?                        ?
    ?289?
    204290                        $queryresult = $this->db->query($querystatement);?
    205?                        ?
    ?291?
    206292                        $removedCount = 0;?
    207293                        $deletedCount = 0;?
    208294                        $beenMarked = false;?
    209?                        ?
    ?295?
    210296                        while($therecord = $this->db->fetchArray($queryresult)){?
    211297?
    ? ? ?
    213299                                // cannot be removed?
    214300                                if(!$therecord["primary"] && !$therecord["defaultshipto"]){?
    215?                                ?
    ?301?
    216302                                        //look up address to see if it is associated with other records?
    217303                                        $querystatement = "?
    ? ? ?
    224310                                                        AND tabledefid = ".$therecord["tabledefid"]."?
    225311                                                        AND recordid != ".$therecord["recordid"];?
    226?                                                        ?
    ?312?
    227313                                        $lookupResult = $this->db->query($querystatement);?
    228314?
    229315                                        if(!$this->db->numRows($lookupResult)){?
    230?                                        ?
    ?316?
    231317                                                //we can safely delete the address (no other associations)?
    232318                                                $deletestatement = "?
    ? ? ?
    237323?
    238324                                                $this->db->query($deletestatement);?
    239?                                                ?
    ?325?
    240326                                                $deletedCount++;?
    241327                                                $removedCount--;?
    242?                                                ?
    ?328?
    243329                                        }//end if - numRows?
    244?                                ?
    ?330?
    245331                                        //remove the connecting record?
    246332                                        $deletestatement = "?
    ? ? ?
    249335                                                WHERE?
    250336                                                        id =".$therecord["id"];?
    251?                                        ?
    ?337?
    252338                                        $this->db->query($deletestatement);?
    253?                                        ?
    ?339?
    254340                                        $removedCount++;?
    255?                                ?
    ?341?
    256342                                } else {?
    257?                                ?
    258?                                        $beenMarked = true;                     ?
    259?                                        ?
    ?343?
    ?344                                        $beenMarked = true;?
    ?345?
    260346                                }//endif - primary or defaultshipto?
    261?                                ?
    ?347?
    262348                        }//endwhile - fetchArray?
    263349?
    264350                        //next, craft the response?
    265?                        ?
    ?351?
    266352                        $message = "";?
    267?                        ?
    268?                        if($removedCount){      ?
    269?                                ?
    ?353?
    ?354                        if($removedCount){?
    ?355?
    270356                                $message .= $removedCount." address";?
    271?                                ?
    ?357?
    272358                                if($removedCount > 1)?
    273359                                        $message .= "es";?
    274?                                ?
    ?360?
    275361                                $message .= " dissociated from record. ";?
    276?                                ?
    ?362?
    277363                        }//endif removedCount?
    278?                        ?
    279?                        if($deletedCount){      ?
    280?                                ?
    ?364?
    ?365                        if($deletedCount){?
    ?366?
    281367                                $message .= $deletedCount." address";?
    282?                                ?
    ?368?
    283369                                if($deletedCount > 1)?
    284370                                        $message .= "es";?
    285?                                ?
    ?371?
    286372                                $message .= " deleted. ";?
    287?                                ?
    ?373?
    288374                        }//endif removedCount?
    289375?
    ? ? ?
    294380                                $message .= "(Addresses marked primary or default ship to cannot be removed.)";?
    295381                        return $message;?
    296?                        ?
    ?382?
    297383                }//end method - delete?
    298384?
    299?                ?
    ?385?
    300386                function markPrimary(){?
    301?                ?
    ?387?
    302388                        return $this->_markAs("primary")." primary address.";?
    303?                ?
    ?389?
    304390                }//end method - markPrimary?
    305?                ?
    306?                ?
    ?391?
    ?392?
    307393                function markDefaultShipTo(){?
    308394?
    ? ? ?
    323409                                WHERE?
    324410                                        id =".((int) $this->idsArray[0]);?
    325?                        ?
    ?411?
    326412                        $relatedInfo = $this->db->fetchArray($this->db->query($querystatement));?
    327?                        ?
    ?413?
    328414                        //Next, mark all addresses associated with record as false?
    329415                        $updatestatement = "?
    ? ? ?
    335421                                        tabledefid = ".$relatedInfo["tabledefid"]."?
    336422                                        AND recordid = ".$relatedInfo["recordid"];?
    337?                                        ?
    ?423?
    338424                        $this->db->query($updatestatement);?
    339?                        ?
    ?425?
    340426                        //Finally, mark the first record.?
    341427                        $updatestatement = "?
    ? ? ?
    346432                                WHERE?
    347433                                        id = ".((int) $this->idsArray[0]);?
    348?                        ?
    ?434?
    349435                        $this->db->query($updatestatement);?
    350436?
    ? ? ?
    357443?
    358444                        return $message;?
    359?                        ?
    ?445?
    360446                }//end method _markAs?
    361447?
  • trunk/phpbms/modules/bms/include/clients.php

    r431 r485 ?
    4040if(class_exists("phpbmsTable")){?
    4141        class clients extends phpbmsTable{?
    42?        ?
    ?42?
    ?43                var $availablePaymentMethodIDs = array();?
    ?44                var $availableShippingMethodIDs = array();?
    ?45                var $availableDiscountIDs = array();?
    ?46                var $availableTaxIDs = array();?
    ?47                var $availableUserIDs = array();?
    ?48                var $verifyErrors = array();?
    ?49?
    4350                function checkForInvoices($id){?
    4451                        $querystatement="SELECT id FROM invoices WHERE clientid=".((int) $id);?
    4552                        $queryresult = $this->db->query($querystatement);?
    46?        ?
    ?53?
    4754                        return !($this->db->numRows($queryresult)===0);?
    4855                }//end method?
    49?        ?
    50?        ?
    ?56?
    ?57?
    5158                // CLASS OVERRIDES ===================================================================?
    5259                // ===================================================================================?
    5360?
    5461                function clients($db,$tabledefid = 0,$backurl = NULL){?
    55?                        ?
    ?62?
    5663                        $this->phpbmsTable($db,$tabledefid,$backurl);?
    57?                        ?
    ?64?
    5865                        $this->address = new addresstorecord($db, 306);?
    59?                        ?
    ?66?
    6067                }//end function - init?
    61?                ?
    ?68?
    6269?
    6370                function getDefaults(){?
    ? ? ?
    6673?
    6774                        $therecord["type"] = DEFAULT_CLIENTTYPE;?
    68?                        ?
    ?75?
    6976                        if($therecord["type"] == "client") {?
    7077?
    ? ? ?
    7481?
    7582                        }//end if?
    76?                        ?
    ?83?
    7784                        $therecord["webaddress"] = "http://";?
    78?                        ?
    ?85?
    7986                        //now for the address information.?
    8087                        $addressinfo = $this->address->getDefaults();?
    8188                        unset($addressinfo["id"], $addressinfo["createdby"], $addressinfo["creationdate"], $addressinfo["modifiedby"], $addressinfo["modifieddate"]);?
    8289                        $addressinfo["addressid"] = NULL;?
    83?                        ?
    ?90?
    8491                        return array_merge($therecord, $addressinfo);?
    85?                                                ?
    ?92?
    8693                }//end function - getDefaults?
    87?                ?
    88?        ?
    ?94?
    ?95?
    8996                function getRecord($id){?
    9097?
    9198                        $id = (int) $id;?
    92?                        ?
    ?99?
    93100                        $therecord = parent::getRecord($id);?
    94?                        ?
    ?101?
    95102                        if($therecord["id"]){?
    96103                                //need to grab the address as well?
    97?                                ?
    ?104?
    98105                                $querystatement = "?
    99106                                        SELECT?
    ? ? ?
    107114?
    108115                                $queryresult = $this->db->query($querystatement);?
    109?                                ?
    ?116?
    110117                                $addressinfo = $this->db->fetchArray($queryresult);?
    111118?
    112119                                if($addressinfo) {?
    113?                                        ?
    ?120?
    114121                                        $addressinfo = $this->address->getRecord($addressinfo["id"]);?
    115?                                ?
    ?122?
    116123                                } else {?
    117124?
    118125                                        $addressinfo = $this->address->getDefaults();?
    119126                                        $addressinfo["addressid"] = NULL;?
    120?                                        ?
    121?                                }//endif                        ?
    ?127?
    ?128                                }//endif?
    122129?
    123130                                unset($addressinfo["id"], $addressinfo["notes"], $addressinfo["email"], $addressinfo["createdby"], $addressinfo["creationdate"], $addressinfo["modifiedby"], $addressinfo["modifieddate"]);?
    124131?
    125132                                $therecord = array_merge($therecord, $addressinfo);?
    126?                        ?
    ?133?
    127134                        }//endif?
    128?                        ?
    ?135?
    129136                        return $therecord;?
    130?                ?
    ?137?
    131138                }//end function - getRecord?
    132?                ?
    ?139?
    ?140?
    ?141                function populatePaymentMethodArray(){?
    ?142?
    ?143                        $this->availablePaymentMethodIDs = array();?
    ?144?
    ?145                        $querystatement = "?
    ?146                                SELECT?
    ?147                                        `id`?
    ?148                                FROM?
    ?149                                        `paymentmethods`;?
    ?150                                ";?
    ?151?
    ?152                        $queryresult = $this->db->query($querystatement);?
    ?153?
    ?154                        $this->availablePaymentMethodIDs[] = 0;//for none?
    ?155?
    ?156                        while($therecord = $this->db->fetchArray($queryresult))?
    ?157                                $this->availablePaymentMethodIDs[] = $therecord["id"];?
    ?158?
    ?159                }//end method --populatePaymentMethodArray--?
    ?160?
    ?161?
    ?162                function populateShippingMethodArray(){?
    ?163?
    ?164                        $this->availableShippingMethodIDs = array();?
    ?165?
    ?166                        $querystatement = "?
    ?167                                SELECT?
    ?168                                        `id`?
    ?169                                FROM?
    ?170                                        `shippingmethods`;?
    ?171                                ";?
    ?172?
    ?173                        $queryresult = $this->db->query($querystatement);?
    ?174?
    ?175                        $this->availableShippingMethodIDs[] = 0;//for none?
    ?176?
    ?177                        while($therecord = $this->db->fetchArray($queryresult))?
    ?178                                $this->availableShippingMethodIDs[] = $therecord["id"];?
    ?179?
    ?180                }//end method --populateShippingMethodArray--?
    ?181?
    ?182?
    ?183                function populateDiscountArray(){?
    ?184?
    ?185                        $this->availableDiscountIDs = array();?
    ?186?
    ?187                        $querystatement = "?
    ?188                                SELECT?
    ?189                                        `id`?
    ?190                                FROM?
    ?191                                        `discounts`;?
    ?192                                ";?
    ?193?
    ?194                        $queryresult = $this->db->query($querystatement);?
    ?195?
    ?196                        $this->availableDiscountIDs[] = 0;//for none?
    ?197?
    ?198                        while($therecord = $this->db->fetchArray($queryresult))?
    ?199                                $this->availableDiscountIDs[] = $therecord["id"];?
    ?200?
    ?201                }//end method  --populateDiscountArray--?
    ?202?
    ?203?
    ?204                function populateTaxArray(){?
    ?205?
    ?206                        $this->availableTaxIDs = array();?
    ?207?
    ?208                        $querystatement = "?
    ?209                                SELECT?
    ?210                                        `id`?
    ?211                                FROM?
    ?212                                        `tax`;?
    ?213                                ";?
    ?214?
    ?215                        $queryresult = $this->db->query($querystatement);?
    ?216?
    ?217                        $this->availableTaxIDs[] = 0;//for none?
    ?218?
    ?219                        while($therecord = $this->db->fetchArray($queryresult))?
    ?220                                $this->availableTaxIDs[] = $therecord["id"];?
    ?221?
    ?222                }//end method  --populateTaxArray--?
    ?223?
    ?224?
    ?225                function populateUserArray(){?
    ?226?
    ?227                        $this->availableUserIDs = array();?
    ?228?
    ?229                        $querystatement = "?
    ?230                                SELECT?
    ?231                                        `id`?
    ?232                                FROM?
    ?233                                        `users`;?
    ?234                                ";?
    ?235?
    ?236                        $queryresult = $this->db->query($querystatement);?
    ?237?
    ?238                        $this->availableUserIDs[] = 0;//for none?
    ?239?
    ?240                        while($therecord = $this->db->fetchArray($queryresult))?
    ?241                                $this->availableUserIDs[] = $therecord["id"];?
    ?242?
    ?243                }//end method  --populateUserArray--?
    ?244?
    ?245?
    ?246                function verifyVariables($variables){?
    ?247?
    ?248                        if(isset($variables["type"])){?
    ?249                                switch($variables["type"]){?
    ?250?
    ?251                                        case "prospect":?
    ?252?
    ?253                                                if(isset($variables["becameclient"])){?
    ?254                                                        if($variables["becameclient"] !== "" || $variables["becameclient"] !== NULL)?
    ?255                                                                $this->verifyErrors[] = "Records with `type` of 'prospect'?
    ?256                                                                        must have the `becameclient` field kept blank.";?
    ?257                                                }//end if?
    ?258?
    ?259                                                if(isset($variables["hascredit"])){?
    ?260                                                        if($variables["hascredit"])?
    ?261                                                                $this->verifyErrors[] = "Records with `type` of 'prospect'?
    ?262                                                                        must have the `hascredit` field kept blank or 0.";?
    ?263                                                }//end if?
    ?264?
    ?265                                                if(isset($variables["creditlimit"])){?
    ?266                                                        if($variables["creditlimit"])?
    ?267                                                                $this->verifyErrors[] = "Records with `type` of 'prospect'?
    ?268                                                                        must have the `creditlimit` field kept blank or 0.";?
    ?269                                                }//end if?
    ?270?
    ?271                                        break;?
    ?272?
    ?273                                        case "client":?
    ?274                                                if(isset($variables["becameclient"])){?
    ?275                                                        //Possibly run through string to date functions?
    ?276                                                        if(!$variables["becameclient"])?
    ?277                                                                $this->verifyErrors[] = "Records with `type` of 'client'?
    ?278                                                                        must have not have the `becameclient` field blank.";?
    ?279                                                }else?
    ?280                                                        $this->verifyErrors[] = "Records with `type` of 'client'?
    ?281                                                                must set the `becameclient` field.";?
    ?282                                        break;?
    ?283?
    ?284                                        default:?
    ?285                                                $this->verifyErrors[] = "The value of the `type` field is invalid.?
    ?286                                                        It must either be 'prospect' or 'client'.";?
    ?287                                        break;?
    ?288?
    ?289                                }//end switch?
    ?290                        }else?
    ?291                                $this->verifyErrors[] = "The `type` field must be set.";?
    ?292?
    ?293                        //check for currency on credit limit (((real value) >= 0 ... non-negative)?
    ?294                        if(isset($variables["creditlimit"]))?
    ?295                                if(!is_numeric($variables["creditlimit"]) && $variables["creditlimit"])?
    ?296                                        $this->verifyErrors[] = "The `creditlimit` field must be a real number or equivalent to zero.";?
    ?297?
    ?298                        //----------------[ phone & email ]------------------------------------------------------?
    ?299                        //check valid email?
    ?300                        if(isset($variables["email"]))?
    ?301                                if( $variables["email"] !== NULL && $variables["email"] !== "" && !validateEmail($variables["email"]))?
    ?302                                        $this->verifyErrors[] = "The `email` field must have a valid email or must be left blank.";?
    ?303?
    ?304                        //check valid homephone?
    ?305                        if(isset($variables["homephone"]))?
    ?306                                if( $variables["homephone"] !== NULL && $variables["homephone"] !== "" && !validatePhone($variables["homephone"]))?
    ?307                                        $this->verifyErrors[] = "The `homephone` field must have a valid phone number (as set in configuration) or must be left blank.";?
    ?308?
    ?309                        //check valid workphone?
    ?310                        if(isset($variables["workphone"]))?
    ?311                                if( $variables["workphone"] !== NULL && $variables["workphone"] !== "" && !validatePhone($variables["workphone"]))?
    ?312                                        $this->verifyErrors[] = "The `workphone` field must have a valid phone number (as set in configuration) or must be left blank.";?
    ?313?
    ?314                        //check valid mobilephone?
    ?315                        if(isset($variables["mobilephone"]))?
    ?316                                if( $variables["mobilephone"] !== NULL && $variables["mobilephone"] !== "" && !validatePhone($variables["mobilephone"]))?
    ?317                                        $this->verifyErrors[] = "The `mobilephone` field must have a valid phone number (as set in configuration) or must be left blank.";?
    ?318?
    ?319                        //check valid fax?
    ?320                        if(isset($variables["fax"]))?
    ?321                                if( $variables["fax"] !== NULL && $variables["fax"] !== "" && !validatePhone($variables["fax"]))?
    ?322                                        $this->verifyErrors[] = "The `fax` field must have a valid phone number (as set in configuration) or must be left blank.";?
    ?323?
    ?324                        //check valid otherphone?
    ?325                        if(isset($variables["otherphone"]))?
    ?326                                if( $variables["otherphone"] !== NULL && $variables["otherphone"] !== "" && !validatePhone($variables["otherphone"]))?
    ?327                                        $this->verifyErrors[] = "The `otherphone` field must have a valid phone number (as set in configuration) or must be left blank.";?
    ?328?
    ?329                        //check bool on has credit?
    ?330                        if(isset($variables["hascredit"]))?
    ?331                                if($variables["hascredit"] && $variables["hascredit"] != 1)?
    ?332                                        $this->verifyErrors[] = "The `hascredit` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?333?
    ?334?
    ?335                        //----------------[ Order Defaults]------------------------------------------------------?
    ?336?
    ?337                        //Payement Method?
    ?338                        if(isset($variables["paymentmethodid"])){?
    ?339?
    ?340                                if( !$variables["paymentmethodid"] || ((int)$variables["paymentmethodid"]) > 0 ){?
    ?341?
    ?342                                        if(!count($this->availablePaymentMethodIDs))?
    ?343                                                $this->populatePaymentMethodArray();?
    ?344?
    ?345                                        if(!in_array($variables["paymentmethodid"], $this->availablePaymentMethodIDs))?
    ?346                                                $this->verifyErrors[] = "The `paymentmethodid` field does not give an existing/acceptable payment method id number.";?
    ?347?
    ?348                                }else?
    ?349                                        $this->verifyErrors[] = "The `addroleid` field must be a non-negative number or equivalent to 0.";?
    ?350?
    ?351                        }//end if?
    ?352?
    ?353                        if(isset($variables["shippingmethodid"])){?
    ?354?
    ?355                                if( !$variables["shippingmethodid"] || ((int)$variables["shippingmethodid"]) > 0){?
    ?356?
    ?357                                        if(!count($this->availableShippingMethodIDs))?
    ?358                                                $this->populateShippingMethodArray();?
    ?359?
    ?360                                        if(!in_array($variables["shippingmethodid"], $this->availableShippingMethodIDs))?
    ?361                                                $this->verifyErrors[] = "The `shippingmethodid` field does not give an existing/acceptable shipping method id number.";?
    ?362?
    ?363                                }else?
    ?364                                        $this->verifyErrors[] = "The `shippingmethodid` field must be a non-negative number or equivalent to 0.";?
    ?365?
    ?366                        }//end if?
    ?367?
    ?368                        if(isset($variables["discountid"])){?
    ?369?
    ?370                                if( !$variables["discountid"] || ((int)$variables["discountid"]) > 0){?
    ?371?
    ?372                                        if(!count($this->availableDiscountIDs))?
    ?373                                                $this->populateDiscountArray();?
    ?374?
    ?375                                        if(!in_array($variables["discountid"], $this->availableDiscountIDs))?
    ?376                                                $this->verifyErrors[] = "The `discount` field does not give an existing/acceptable discount id number.";?
    ?377?
    ?378                                }else?
    ?379                                        $this->verifyErrors[] = "The `discountid` field must be a non-negative number or equivalent to 0.";?
    ?380?
    ?381                        }//end if?
    ?382?
    ?383                        if(isset($variables["taxareaid"])){?
    ?384?
    ?385                                if( !$variables["taxareaid"] || ((int)$variables["taxareaid"]) > 0){?
    ?386?
    ?387                                        if(!count($this->availableTaxIDs))?
    ?388                                                $this->populateTaxArray();?
    ?389?
    ?390                                        if(!in_array($variables["taxareaid"], $this->availableTaxIDs))?
    ?391                                                $this->verifyErrors[] = "The `taxareaid` field does not give an existing/acceptable tax id number.";?
    ?392?
    ?393                                }else?
    ?394                                        $this->verifyErrors[] = "The `taxareaid` field must be a non-negative number or equivalent to 0.";?
    ?395?
    ?396                        }//end if?
    ?397?
    ?398                        //---------------------[ end order defaults ]----------------------------------------?
    ?399?
    ?400                        //check sales manager id?
    ?401                        if(isset($variables["salesmanagerid"])){?
    ?402?
    ?403                                if( !$variables["salesmanagerid"] || ((int)$variables["salesmanagerid"]) > 0 ){?
    ?404?
    ?405                                        if(!count($this->availableUserIDs))?
    ?406                                                $this->populateUserArray();?
    ?407?
    ?408                                        if(!in_array($variables["salesmanagerid"], $this->availableUserIDs))?
    ?409                                                $this->verifyErrors[] = "The `salesmanagerid` field does not give an existing/acceptable user id number.";?
    ?410?
    ?411                                }else?
    ?412                                        $this->verifyErrors[] = "The `salesmanagerid` field must be a non-negative number or equivalent to 0.";?
    ?413?
    ?414                        }//end if?
    ?415?
    ?416?
    ?417                        return parent::verifyVariables($variables);?
    ?418?
    ?419                }//end method?
    ?420?
    133421?
    134422                function prepareVariables($variables){?
    135?                ?
    ?423?
    136424                        if(isset($variables["webaddress"]))?
    137?                                if ($variables["webaddress"]=="http://") ?
    ?425                                if ($variables["webaddress"]=="http://")?
    138426                                        $variables["webaddress"] = NULL;?
    139427?
    140428                        if(!isset($variables["type"]))?
    141429                                $variables["type"] = "client";?
    142?                                ?
    ?430?
    143431                        if($variables["type"] == "prospect"){?
    144432?
    ? ? ?
    149437                                $variables["type"] = "client";?
    150438                                if(!isset($variables["becameclient"]))?
    ?439                                        $variables["becameclient"] = NULL;?
    ?440                                if(!$variables["becameclient"])?
    151441                                        $variables["becameclient"] = dateToString(mktime());?
    152442                        }//end if?
    153443?
    154444                        return $variables;?
    155?                        ?
    ?445?
    156446                }//end method?
    157?                ?
    158?        ?
    ?447?
    ?448?
    159449                function updateRecord($variables, $modifiedby = NULL){?
    160?                        ?
    161?                        $variables = $this->prepareVariables($variables);?
    162?                        ?
    ?450?
    ?451                        //$variables = $this->prepareVariables($variables);?
    ?452?
    163453                        $thereturn = parent::updateRecord($variables, $modifiedby);?
    164?                        ?
    ?454?
    ?455                        $variables["recordid"] = $variables["id"];//here to pass addresstorecord validation?
    ?456                        $variables["tabledefid"] = 2;//here to pass addresstorecord validation?
    165457                        //need to update the address?
    166458                        $variables["id"] = $variables["addressid"];?
    ? ? ?
    174466                        unset($this->address->fields["creationdate"]);?
    175467?
    176?                        $this->address->updateRecord($variables, $modifiedby);?
    ?468                        $variables = $this->address->prepareVariables($variables);?
    ?469                        $errorArray = $this->address->verifyVariables($variables);?
    ?470                        if(!count($errorArray)){?
    ?471                                $this->address->updateRecord($variables, $modifiedby);?
    ?472                        }else{?
    ?473                                foreach($errorArray as $error)?
    ?474                                        $logError = new appError(-910, $error, "Address Verification Error");?
    ?475                        }//end if?
    177476?
    178477                        //restore the fields?
    179478                        $this->address->getTableInfo();?
    180?                        ?
    ?479?
    181480                        return $thereturn;?
    182?                        ?
    ?481?
    183482                }//end method - updateRecord?
    184?                ?
    185?                ?
    ?483?
    ?484?
    186485                function insertRecord($variables, $createdby = NULL){?
    187?                        ?
    188?                        $variables = $this->prepareVariables($variables);?
    189?                        ?
    ?486?
    ?487                        //$variables = $this->prepareVariables($variables);?
    ?488?
    190489                        $newid = parent::insertRecord($variables, $createdby);?
    191?                        ?
    ?490?
    192491                        //need to create the address and addresstorecord id?
    193492                        // make sure we are not setting extra info?
    ? ? ?
    200499                        $variables["defaultshipto"] = 1;?
    201500                        $variables["primary"] = 1;?
    202?                        ?
    203?                        $this->address->insertRecord($variables, $createdby);?
    ?501?
    ?502                        $variables = $this->address->prepareVariables($variables);?
    ?503                        $errorArray = $this->address->verifyVariables($variables);?
    ?504                        if(!count($errorArray)){?
    ?505                                $this->address->insertRecord($variables, $createdby);?
    ?506                        }else{?
    ?507                                foreach($errorArray as $error)?
    ?508                                        $logError = new appError(-910, $error, "Address Verification Error");?
    ?509                        }//end if?
    204510?
    205511                        //restore the fields?
    206512                        $this->address->getTableInfo();?
    207?                        ?
    ?513?
    208514                        return $newid;?
    209?                        ?
    ?515?
    210516                }//end method - insertRecord?
    211?                ?
    ?517?
    212518        }//end class?
    213?        ?
    ?519?
    214520}//end if?
    215521?
    ? ? ?
    219525?
    220526                function mark_asclient(){?
    221?                ?
    ?527?
    222528                        //passed variable is array of user ids to be revoked?
    223?                        $whereclause = $this->buildWhereClause();       ?
    224?                ?
    ?529                        $whereclause = $this->buildWhereClause();?
    ?530?
    225531                        $querystatement = "UPDATE clients SET clients.type=\"client\",modifiedby=\"".$_SESSION["userinfo"]["id"]."\" WHERE (".$whereclause.");";?
    226532                        $queryresult = $this->db->query($querystatement);?
    227?                        ?
    ?533?
    228534                        $message = $this->buildStatusMessage();?
    229535                        $message.=" converted to client.";?
    230536                        return $message;?
    231537                }?
    232?                ?
    233?                ?
    ?538?
    ?539?
    234540                //Stamp Comments Field with info packet sent?
    235541                function stamp_infosent(){?
    236?                ?
    ?542?
    237543                        //passed variable is array of user ids to be revoked?
    238544                        $whereclause = $this->buildWhereClause();?
    239?                ?
    ?545?
    240546                        $querystatement = "?
    241547                                UPDATE?
    242?                                        clients ?
    ?548                                        clients?
    243549                                SET?
    244?                                        clients.comments = concat('Information Packet Sent', char(10), clients.comments), ?
    ?550                                        clients.comments = concat('Information Packet Sent', char(10), clients.comments),?
    245551                                        clients.modifiedby=".$_SESSION["userinfo"]["id"].",?
    246552                                        clients.modifieddate = NOW()?
    247553                                WHERE (".$whereclause.") AND clients.comments IS NOT NULL";?
    248554                        $queryresult = $this->db->query($querystatement);?
    249?                        ?
    ?555?
    250556                        $affected = $this->db->affectedRows();?
    251557?
    252558                        $querystatement = "?
    253559                                UPDATE?
    254?                                        clients ?
    ?560                                        clients?
    255561                                SET?
    256?                                        clients.comments = 'Information Packet Sent', ?
    ?562                                        clients.comments = 'Information Packet Sent',?
    257563                                        clients.modifiedby=".$_SESSION["userinfo"]["id"].",?
    258564                                        clients.modifieddate = NOW()?
    ? ? ?
    261567?
    262568                        $affected += $this->db->affectedRows();?
    263?                        ?
    ?569?
    264570                        $message = $this->buildStatusMessage($affected);?
    265571                        $message.=" marked as info packet sent.";?
    266572                        return $message;?
    267573                }?
    268?                ?
    269?                ?
    ?574?
    ?575?
    270576                //remove prospects?
    271577                function delete_prospects(){?
    272?                ?
    ?578?
    273579                        //passed variable is array of user ids to be revoked?
    274580                        $clientWhereClause = $this->buildWhereClause();?
    ? ? ?
    282588                                        (".$clientWhereClause.")?
    283589                                        AND clients.type = 'prospect'";?
    284?                                        ?
    ?590?
    285591                        $queryresult = $this->db->query($querystatement);?
    286?                        ?
    ?592?
    287593                        //build array of ids to be removed?
    288594                        $deleteIDs = array();?
    ? ? ?
    291597?
    292598                        if(count($deleteIDs)){?
    293?                        ?
    ?599?
    294600                                $a2rWhere = $this->buildWhereClause("recordid", $deleteIDs);?
    295601?
    ? ? ?
    303609                                                tabledefid = 2?
    304610                                                AND (".$a2rWhere.")";?
    305?                                                ?
    ?611?
    306612                                $a2rResult = $this->db->query($querystatement);?
    307?                                ?
    ?613?
    308614                                $addressIDs = array();?
    309615                                while($a2r = $this->db->fetchArray($a2rResult))?
    310616                                        array_push($addressIDs, $a2r["addressid"]);?
    311?                                        ?
    312?                                // delete all a2r records for prospect  ?
    ?617?
    ?618                                // delete all a2r records for prospect?
    313619                                $deletestatement = "?
    314620                                        DELETE FROM?
    ? ? ?
    317623                                                tabledefid = 2?
    318624                                                AND (".$a2rWhere.")";?
    319?                                                ?
    ?625?
    320626                                $this->db->query($deletestatement);?
    321?                                ?
    ?627?
    322628                                //now go get a list of orphaned addresses?
    323629                                $querystatement = "?
    324?                                        SELECT ?
    325?                                                addresses.id, ?
    326?                                                addresstorecord.id as a2rid ?
    327?                                        FROM ?
    ?630                                        SELECT?
    ?631                                                addresses.id,?
    ?632                                                addresstorecord.id as a2rid?
    ?633                                        FROM?
    328634                                                addresses LEFT JOIN addresstorecord ON addresstorecord.addressid = addresses.id?
    329635                                        WHERE?
    330636                                                ".$this->buildWhereClause("addresses.id", $addressIDs);?
    331?                                                ?
    ?637?
    332638                                $addressResult = $this->db->query($querystatement);?
    333?                                ?
    ?639?
    334640                                $addressIDs = array();?
    335641                                while($address = $this->db->fetchArray($addressResult))?
    336642                                        if(!$address["a2rid"])?
    337643                                                array_push($addressIDs, $address["id"]);?
    338?                                                ?
    ?644?
    339645                                if(count($addressIDs)){?
    340?                                ?
    341?                                        //delete orphaned addresses             ?
    ?646?
    ?647                                        //delete orphaned addresses?
    342648                                        $deletestatement = "?
    343?                                                DELETE FROM ?
    ?649                                                DELETE FROM?
    344650                                                        addresses?
    345651                                                WHERE?
    346652                                                        ".$this->buildWhereClause("addresses.id", $addressIDs);?
    347?                                                        ?
    ?653?
    348654                                        $this->db->query($deletestatement);?
    349?                                        ?
    ?655?
    350656                                }//endif - addressids?
    351657?
    ? ? ?
    359665                                        WHERE?
    360666                                                ".$invoiceWhereClause;?
    361?                                                ?
    ?667?
    362668                                $invoiceresult = $this->db->query($invoicestatement);?
    363?                                ?
    ?669?
    364670                                //build invoice id array?
    365671                                $invoiceids = array();?
    366672                                while($therecord = $this->db->fetchArray($invoiceresult))?
    367673                                        array_push($invoiceids, $therecord["id"]);?
    368?                                ?
    ?674?
    369675                                if(count($invoiceids)) {?
    370676                                        $invoiceWhereClause = $this->buildWhereClause("invoices.id", $invoiceids);?
    371?                                        ?
    ?677?
    372678                                        $lineitemWhereClause = $this->buildWhereClause("invoiceid", $invoiceids);?
    373?                ?
    ?679?
    374680                                        $lineItemDeleteStatement = "?
    375681                                                DELETE FROM?
    ? ? ?
    377683                                                WHERE?
    378684                                                        ".$lineitemWhereClause;?
    379?                ?
    ?685?
    380686                                        $queryresult = $this->db->query($lineItemDeleteStatement);?
    381?                ?
    ?687?
    382688                                        $statushistoryDeleteStatement = "?
    383689                                                DELETE FROM?
    ? ? ?
    385691                                                WHERE?
    386692                                                        ".$lineitemWhereClause;?
    387?                ?
    ?693?
    388694                                        $queryresult = $this->db->query($statushistoryDeleteStatement);?
    389?                                        ?
    ?695?
    390696                                        $invoiceDeleteStatement = "?
    391697                                                DELETE FROM?
    392698                                                        invoices?
    393?                                                WHERE                                   ?
    ?699                                                WHERE?
    394700                                                        ".$invoiceWhereClause;?
    395?        ?
    ?701?
    396702                                        $queryresult = $this->db->query($invoiceDeleteStatement);?
    397?        ?
    ?703?
    398704                                }//end if?
    399705?
    ? ? ?
    402708?
    403709                                $deletestatement = "?
    404?                                        DELETE FROM ?
    ?710                                        DELETE FROM?
    405711                                                clients?
    406?                                        WHERE ?
    ?712                                        WHERE?
    407713                                                ".$delWhere;?
    408?                                                ?
    ?714?
    409715                                $this->db->query($deletestatement);?
    410?                                                        ?
    411?                        }//endif - count deleteIDS                                                                                              ?
    412??
    413?                ?
    ?716?
    ?717                        }//endif - count deleteIDS?
    ?718?
    ?719?
    414720                        $message = $this->buildStatusMessage(count($deleteIDs));?
    415721                        $message.=" deleted.";?
    416?                        return $message;        ?
    417?                        ?
    ?722                        return $message;?
    ?723?
    418724                }// end method - delete_prospects?
    419?                ?
    420?                ?
    ?725?
    ?726?
    421727                function massEmail(){?
    422728                        if(DEMO_ENABLED != "true"){?
    ? ? ?
    428734                }?
    429735?
    430?        ?
    ?736?
    431737        }//end class?
    432738}//end if?
    433739if(class_exists("phpbmsImport")){?
    434740        class clientsImport extends phpbmsImport{?
    435?                ?
    436?                ?
    ?741?
    ?742?
    437743                function clientsImport($table, $importType = "csv"){?
    438?                        ?
    ?744?
    439745                        if($importType == "sugarcrm"){?
    440?                                ?
    ?746?
    441747                                $importType = "csv";?
    442748                                $switchedFrom = "sugarcrm";?
    443?                                ?
    ?749?
    444750                        }//end if?
    445?                        ?
    ?751?
    446752                        parent::phpbmsImport($table, $importType);?
    447?                        ?
    ?753?
    448754                        if(isset($switchedFrom))?
    449755                                $this->importType = $switchedFrom;?
    450?                        ?
    ?756?
    451757                }//end method --clientsImport--?
    452?                ?
    453?                ?
    ?758?
    ?759?
    454760                function _parseFromData($data){?
    455?                        ?
    ?761?
    456762                        if($this->importType == "sugarcrm"){?
    457?                                ?
    ?763?
    458764                                $this->importType = "csv";?
    459765                                $switchedFrom = "sugarcrm";?
    460?                                ?
    ?766?
    461767                        }//end if?
    462?                        ?
    ?768?
    463769                        $thereturn = parent::_parseFromData($data);?
    464?                        ?
    ?770?
    465771                        if(isset($switchedFrom))?
    466772                                $this->importType = $switchedFrom;?
    467?                        ?
    ?773?
    468774                        return $thereturn;?
    469?                ?
    ?775?
    470776                }//end method --_parseFromFile--?
    471?                ?
    472?                ?
    ?777?
    ?778?
    473779                function _formatSugarVariables($rows, $titles){?
    474?                        ?
    ?780?
    475781                        //Replace the titles with valid ones?
    476782                        //(At the moment we only really need?
    ? ? ?
    480786                        $newTitles = array();?
    481787                        foreach($titles as $index => $name){?
    482?                                ?
    ?788?
    483789                                switch($name){?
    484?                                        ?
    ?790?
    485791                                        case "name":?
    486792                                                $newTitles[] = "company";?
    487793                                        break;?
    488?                                        ?
    ?794?
    489795                                        case "date_entered":?
    490796                                                $newTitles[] = "becameclient";?
    491797                                        break;?
    492?                                        ?
    ?798?
    493799                                        case "description":?
    494800                                                $newTitles[] = "comments";?
    495801                                        break;?
    496?                                        ?
    ?802?
    497803                                        case "deleted":?
    498804                                                $newTitles[] = "inactive";?
    499805                                        break;?
    500?                                        ?
    ?806?
    501807                                        case "account_type":?
    502808                                                $newTitles[] = "type";?
    503809                                        break;?
    504?                                        ?
    ?810?
    505811                                        case "industry":?
    506812                                                $newTitles[] = "category";?
    507813                                        break;?
    508?                                        ?
    ?814?
    509815                                        case "phone_fax":?
    510816                                                $newTitles[] = "fax";?
    511817                                        break;?
    512?                                        ?
    ?818?
    513819                                        case "billing_address_street":?
    514820                                                $newTitles[] = "address1";?
    515821                                        break;?
    516?                                        ?
    ?822?
    517823                                        case "billing_address_city":?
    518824                                                $newTitles[] = "city";?
    519825                                        break;?
    520?                                        ?
    ?826?
    521827                                        case "billing_address_state":?
    522828                                                $newTitles[] = "state";?
    523829                                        break;?
    524?                                        ?
    ?830?
    525831                                        case "billing_address_postalcode":?
    526832                                                $newTitles[] = "postalcode";?
    527833                                        break;?
    528?                                        ?
    ?834?
    529835                                        case "billing_address_country":?
    530836                                                $newTitles[] = "country";?
    531837                                        break;?
    532?                                        ?
    ?838?
    533839                                        case "phone_office":?
    534840                                                $newTitles[] = "workphone";?
    535841                                        break;?
    536?                                        ?
    ?842?
    537843                                        case "phone_alternate":?
    538844                                                $newTitles[] = "otherphone";?
    539845                                        break;?
    540?                                        ?
    ?846?
    541847                                        case "website":?
    542848                                                $newTitles[] = "webaddress";?
    543849                                        break;?
    544?                                        ?
    ?850?
    545851                                        case "shipping_address_street":?
    546852                                                $newTitles[] = "shipaddress1";?
    547853                                        break;?
    548?                                        ?
    ?854?
    549855                                        case "shipping_address_city":?
    550856                                                $newTitles[] = "shipcity";?
    551857                                        break;?
    552?                                        ?
    ?858?
    553859                                        case "shipping_address_state":?
    554860                                                $newTitles[] = "shipstate";?
    555861                                        break;?
    556?                                        ?
    ?862?
    557863                                        case "shipping_address_postalcode":?
    558864                                                $newTitles[] = "shippostalcode";?
    559865                                        break;?
    560?                                        ?
    ?866?
    561867                                        case "shipping_address_country":?
    562868                                                $newTitles[] = "shipcountry";?
    563869                                        break;?
    564?                                        ?
    ?870?
    565871                                }//end switch?
    566?                                ?
    ?872?
    567873                        }//end foreach?
    568?                        ?
    569?                        ?
    ?874?
    ?875?
    570876                        $newRows = array();?
    571877                        foreach($rows as $rowData){?
    572?                                ?
    ?878?
    573879                                $newRowData = array();?
    574880                                $addComments = "";?
    575881                                foreach($rowData as $name => $data){?
    576?                                        ?
    ?882?
    577883                                        switch($name){?
    578?                                        ?
    ?884?
    579885                                                case "name":?
    580886                                                        $newRowData["company"] = trim($data);?
    581887                                                break;?
    582?                                                ?
    ?888?
    583889                                                case "date_entered":?
    584890                                                        $newRowData["becameclient"] = trim($data);?
    585891                                                break;?
    586?                                                ?
    ?892?
    587893                                                case "description":?
    588894                                                        $newRowData["comments"] = trim($data);?
    589895                                                break;?
    590?                                                ?
    ?896?
    591897                                                case "deleted":?
    592898                                                        $newRowData["inactive"] = trim($data);?
    593899                                                break;?
    594?                                                ?
    ?900?
    595901                                                case "industry":?
    596902                                                        $newRowData["category"] = trim($data);?
    597903                                                break;?
    598?                                                ?
    ?904?
    599905                                                case "account_type":?
    600906                                                        $newRowData["type"] = trim($data);?
    601907                                                break;?
    602?                                                ?
    ?908?
    603909                                                case "phone_fax":?
    604910                                                        $newRowData["fax"] = trim($data);?
    605911                                                break;?
    606?                                                ?
    ?912?
    607913                                                case "billing_address_street":?
    608914                                                        $newRowData["address1"] = trim($data);?
    609915                                                break;?
    610?                                                ?
    ?916?
    611917                                                case "billing_address_city":?
    612918                                                        $newRowData["city"] = trim($data);?
    613919                                                break;?
    614?                                                ?
    ?920?
    615921                                                case "billing_address_state":?
    616922                                                        $newRowData["state"] = trim($data);?
    617923                                                break;?
    618?                                                ?
    ?924?
    619925                                                case "billing_address_postalcode":?
    620926                                                        $newRowData["postalcode"] = trim($data);?
    621927                                                break;?
    622?                                                ?
    ?928?
    623929                                                case "billing_address_country":?
    624930                                                        $newRowData["country"] = trim($data);?
    625931                                                break;?
    626?                                                ?
    ?932?
    627933                                                case "phone_office":?
    628934                                                        $newRowData["workphone"] = trim($data);?
    629935                                                break;?
    630?                                                ?
    ?936?
    631937                                                case "phone_alternate":?
    632938                                                        $newRowData["otherphone"] = trim($data);?
    633939                                                break;?
    634?                                                ?
    ?940?
    635941                                                case "website":?
    636942                                                        $newRowData["webaddress"] = trim($data);?
    637943                                                break;?
    638?                                                ?
    ?944?
    639945                                                case "shipping_address_street":?
    640946                                                        $newRowData["shipaddress1"] = trim($data);?
    641947                                                break;?
    642?                                                ?
    ?948?
    643949                                                case "shipping_address_city":?
    644950                                                        $newRowData["shipcity"] = trim($data);?
    645951                                                break;?
    646?                                                ?
    ?952?
    647953                                                case "shipping_address_state":?
    648954                                                        $newRowData["shipstate"] = trim($data);?
    649955                                                break;?
    650?                                                ?
    ?956?
    651957                                                case "shipping_address_postalcode":?
    652958                                                        $newRowData["shippostalcode"] = trim($data);?
    653959                                                break;?
    654?                                                ?
    ?960?
    655961                                                case "shipping_address_country":?
    656962                                                        $newRowData["shipcountry"] = trim($data);?
    657963                                                break;?
    658?                                                ?
    ?964?
    659965                                                case "annual_revenue":?
    660966                                                case "rating":?
    ? ? ?
    665971                                                                $addComments .= "\n".str_replace("_"," ",$name).": ".trim($data);?
    666972                                                break;?
    667?                                                ?
    ?973?
    668974                                        }//end switch?
    669?                                        ?
    ?975?
    670976                                }//end foreach?
    671?                                ?
    ?977?
    672978                                if($newRowData["type"] == "prospect")?
    673979                                        $newRowData["becameclient"] = NULL;?
    674?                                ?
    ?980                                else?
    ?981                                        $newRowData["type"] = "client";?
    ?982?
    675983                                $newRowData["comments"] .= $addComments;?
    676984                                $newRows[] = $newRowData;?
    677?                                ?
    ?985?
    678986                        }//end foreach?
    679?                        ?
    ?987?
    680988                        $thereturn["rows"] = $newRows;?
    681989                        $thereturn["titles"] = $newTitles;?
    682990                        return $thereturn;?
    683?                        ?
    ?991?
    684992                }//end method --_formatSugarvariables--?
    685?                ?
    686?                ?
    ?993?
    ?994?
    687995                function importRecords($rows, $titles){?
    688?                        ?
    ?996?
    689997                        switch($this->importType){?
    690?                                ?
    ?998?
    691999                                case "sugarcrm":?
    6921000                                        $thereturn = $this->_formatSugarVariables($rows, $titles);?
    6931001                                        $rows = $thereturn["rows"];?
    6941002                                        $titles = $thereturn["titles"];?
    695?                                ?
    696?                                case "csv":                     ?
    ?1003?
    ?1004                                case "csv":?
    6971005                                        //count total fieldnames (top row of csv document)?
    6981006                                        $fieldNum = count($titles);?
    699?                                        ?
    ?1007?
    7001008                                        //the file starts at line number 1, but since line 1 is?
    7011009                                        //supposed to be the fieldnames in the table(s), the lines?
    7021010                                        //being insereted start @ 2.?
    7031011                                        $rowNum = 2;?
    704?                                        ?
    ?1012?
    7051013                                        //get the data one row at a time?
    7061014                                        foreach($rows as $rowData){?
    707?                                                ?
    708?                                                $theid = 0;?
    709?                                                ?
    ?1015?
    ?1016                                                $theid = 0; // set for when verifification does not pass?
    ?1017                                                $verify = array(); //set for when number of field rows does not match number of titles?
    ?1018?
    7101019                                                //trim off leading/trailing spaces?
    7111020                                                $trimmedRowData = array();?
    7121021                                                foreach($rowData as $name => $data)?
    7131022                                                        $trimmedRowData[$name] = trim($data);?
    714?                                                ?
    ?1023?
    7151024                                                //check to see if number of fieldnames is consistent for each row?
    7161025                                                $rowFieldNum = count($trimmedRowData);?
    717?                                                ?
    ?1026?
    7181027                                                //if valid, insert, if not, log error and don't insert.?
    719?                                                if($rowFieldNum == $fieldNum)?
    720?                                                        $theid = $this->table->insertRecord($trimmedRowData);?
    721?                                                else?
    ?1028                                                if($rowFieldNum == $fieldNum){?
    ?1029                                                        //$trimmedRowData = $this->table->prepareVariables($trimmedRowData);?
    ?1030                                                        $verify = $this->table->verifyVariables($trimmedRowData);?
    ?1031                                                        if(!count($verify))?
    ?1032                                                                $theid = $this->table->insertRecord($trimmedRowData);?
    ?1033                                                }else?
    7221034                                                        $this->error .= '<li> incorrect amount of fields for line number '.$rowNum.'.</li>';?
    723?                                                ?
    ?1035?
    7241036                                                if($theid){?
    7251037                                                        //keep track of the ids in the transaction to be able to select them?
    7261038                                                        //for preview purposes?
    7271039                                                        $this->transactionIDs[] = $theid;?
    728?                                                        ?
    ?1040?
    7291041                                                        //get first id to correct auto increment?
    7301042                                                        if(!$this->revertID)?
    7311043                                                                $this->revertID = $theid;?
    732?                                                        ?
    ?1044?
    7331045                                                        //If it is a sugarcrm import, insert the shipping address as well?
    ?1046                                                        $addressVerify = array();?
    7341047                                                        if($this->importType == "sugarcrm"){?
    735?                                                                ?
    736?                                                                ?
    ?1048?
    ?1049?
    7371050                                                                $variables = array();?
    7381051                                                                if($trimmedRowData["shipaddress1"]) $variables["address1"] = $trimmedRowData["shipaddress1"];?
    ? ? ?
    7401053                                                                if($trimmedRowData["shipstate"]) $variables["state"] = $trimmedRowData["shipstate"];?
    7411054                                                                if($trimmedRowData["shipcountry"]) $variables["country"] = $trimmedRowData["shipcountry"];?
    742?                                                                ?
    ?1055?
    7431056                                                                //check to see if there is a shipping address?
    7441057                                                                if(count($variables)){?
    745?                                                                        ?
    ?1058?
    7461059                                                                        //If there is a shipping address, we need to make any others'?
    7471060                                                                        //`defaultshipto` to 0?
    748?                                                                        ?
    ?1061?
    7491062                                                                        $querystatement = "?
    7501063                                                                                UPDATE?
    ? ? ?
    7571070                                                                                        `addresstorecord`.`tabledefid` = '2';?
    7581071                                                                                ";?
    759?                                                                                ?
    ?1072?
    7601073                                                                        $this->table->db->query($querystatement);?
    761?                                                                        ?
    ?1074?
    7621075                                                                        $variables["title"] = "Main Shipping Addresss";?
    7631076                                                                        $variables["tabledefid"] = 2;?
    ? ? ?
    7651078                                                                        $variables["defaultshipto"] = 1;?
    7661079                                                                        $variables["primary"] = 0;?
    767?                                                                        ?
    768?                                                                        $this->table->address->insertRecord($variables);?
    769?                                                                        ?
    ?1080                                                                        $variables["existingaddressid"] = false;?
    ?1081?
    ?1082                                                                        $addressVerify = $this->table->address->verifyVariables($variables);//verify address?
    ?1083                                                                        if(!count($addressVerify))//check for errors?
    ?1084                                                                                $this->table->address->insertRecord($variables);//insert if no errors?
    ?1085?
    7701086                                                                }//end if?
    771?                                                                ?
    ?1087?
    7721088                                                        }//end if?
    7731089                                                }else?
    7741090                                                        $this->error .= '<li> failed insert for line number '.$rowNum.'.</li>';?
    775?                                                ?
    ?1091?
    ?1092                                                        foreach($verify as $error)//log verify errors for display?
    ?1093                                                                $this->error .= '<li class="subError">'.$error.'</li>';?
    ?1094?
    ?1095                                                        if(isset($addressVerify))?
    ?1096                                                                        foreach($addressVerify as $error)//log address verify errors for display?
    ?1097                                                                                $this->error .= '<li class="subError">'.$error.'</li>';?
    ?1098?
    7761099                                                $rowNum++;?
    777?                                                ?
    ?1100?
    7781101                                        }//end foreach?
    7791102                                break;?
    780?                                ?
    ?1103?
    7811104                        }//end switch?
    782?                        ?
    ?1105?
    7831106                }//end method --importRecords--?
    784?                ?
    785?                ?
    ?1107?
    ?1108?
    7861109                function _getTransactionData(){?
    787?                        ?
    ?1110?
    7881111                        $inStatement = "";?
    7891112                        foreach($this->transactionIDs as $theid)?
    ? ? ?
    7921115                        if($inStatement)?
    7931116                                $inStatement = substr($inStatement, 0, -1);?
    794?                        ?
    ?1117                        else?
    ?1118                                $inStatement = "0";?
    ?1119?
    7951120                        //There are two cases to minimize joins for csv files?
    7961121                        switch($this->importType){?
    797?                                ?
    ?1122?
    7981123                                case "sugarcrm":?
    7991124                                        $querystatement = "?
    ? ? ?
    8541179                                                ";?
    8551180                                break;?
    856?                                ?
    ?1181?
    8571182                                case "csv":?
    8581183                                        $querystatement = "?
    ? ? ?
    8951220                                                        `addresses`.`postalcode`,?
    8961221                                                        `addresses`.`country`,?
    897?                                                        `addresses`.`phone`,?
    898?                                                        `addresses`.`email`?
    ?1222                                                        `addresses`.`phone`?
    8991223                                                FROM?
    9001224                                                        ((clients INNER JOIN addresstorecord ON clients.id = addresstorecord.recordid AND addresstorecord.tabledefid=2 AND addresstorecord.primary=1) INNER JOIN addresses ON  addresstorecord.addressid = addresses.id)?
    ? ? ?
    9051229                                                ";?
    9061230                                break;?
    907?                        ?
    ?1231?
    9081232                        }//end switch?
    909?                        ?
    ?1233?
    9101234                        $queryresult = $this->table->db->query($querystatement);?
    911?                        ?
    ?1235?
    9121236                        while($therecord = $this->table->db->fetchArray($queryresult))?
    9131237                                $this->transactionRecords[] = $therecord;?
    914?                        ?
    915?                        ?
    ?1238?
    ?1239?
    9161240                }//end method --_gettransactionData--?
    917?                ?
    918?                ?
    ?1241?
    ?1242?
    9191243                function displayTransaction($recordsArray, $fieldsArray){?
    920?                        ?
    ?1244?
    9211245                        if(count($recordsArray) && count($fieldsArray)){?
    922?                                ?
    ?1246?
    9231247                                //Need to include addresses in the fieldArray?
    924?                                ?
    ?1248?
    9251249                                //list of values that should not be displayed?
    9261250                                $removalArray = array("id", "modifiedby", "modifieddate", "createdby", "creationdate", "notes", "title", "shiptoname");?
    9271251                                //gets the address table's columnnames/information (fields)?
    9281252                                $addressArray = $this->table->address->fields;?
    929?                                ?
    ?1253?
    9301254                                //gets rid of the values that should not be displayed?
    9311255                                foreach($removalArray as $removalField){?
    932?                                        ?
    ?1256?
    9331257                                        if(isset($addressArray[$removalField])){?
    934?                                                ?
    ?1258?
    9351259                                                unset($addressArray[$removalField]);?
    936?                                                ?
    ?1260?
    9371261                                        }//end if?
    938?                                        ?
    ?1262?
    9391263                                }//end foreach?
    940?                                ?
    ?1264?
    9411265                                //get rid of stuff that should only be in addresses but is present in clients?
    9421266                                foreach($addressArray as $removalField => $junk){?
    943?                                        ?
    ?1267?
    9441268                                        if(isset($fieldsArray[$removalField])){?
    945?                                                ?
    ?1269?
    9461270                                                unset($fieldsArray[$removalField]);?
    947?                                                ?
    ?1271?
    9481272                                        }//end if?
    949?                                        ?
    ?1273?
    9501274                                }//end foreach?
    951?                                ?
    ?1275?
    9521276                                //need to get two sets of address fields, one named main* and the other ship*.?
    9531277                                if($this->importType == "sugarcrm"){?
    954?                                        ?
    ?1278?
    9551279                                        foreach($addressArray as $field => $junk){?
    956?                                                ?
    ?1280?
    9571281                                                $mainAddressArray["main".$field] = $junk;?
    9581282                                                $shipAddressArray["ship".$field] = $junk;?
    959?                                                ?
    ?1283?
    9601284                                        }//end foreach?
    961?                                        ?
    ?1285?
    9621286                                        $addressArray = $mainAddressArray + $shipAddressArray;?
    963?                                        ?
    ?1287?
    9641288                                }//end if?
    965?                                ?
    ?1289?
    9661290                                $fieldsArray = $fieldsArray + $addressArray;?
    967?                                ?
    ?1291?
    9681292                                parent::displayTransaction($recordsArray, $fieldsArray);?
    969?                                ?
    ?1293?
    9701294                        }//end if?
    971?                        ?
    ?1295?
    9721296                }//end method --displayTransaction--?
    973?                ?
    ?1297?
    9741298        }//end class --clientsImport--?
    9751299}//end if?
  • trunk/phpbms/modules/bms/include/discounts.php

    r285 r485 ?
    3939if(class_exists("phpbmsTable")){?
    4040        class discounts extends phpbmsTable{?
    41?        ?
    ?41?
    4242                function getDefaults(){?
    43?                        ?
    ?43?
    4444                        $therecord = parent::getDefaults();?
    45?                        ?
    ?45?
    4646                        $therecord["type"]="percent";?
    47?                        ?
    ?47?
    4848                        return $therecord;?
    4949                }?
    50?        ?
    51?                ?
    52?                function formatValue($variables){?
    53?                ?
    ?50?
    ?51?
    ?52                function verifyVariables($variables){?
    ?53?
    ?54                        //table's default is fine?
    ?55                        if(isset($variables["type"])){?
    ?56?
    ?57                                switch($variables["type"]){?
    ?58?
    ?59                                        case "percent":?
    ?60                                        case "amount":?
    ?61                                        break;?
    ?62?
    ?63                                        default:?
    ?64                                                $this->verifyErrors[] = "The value of the `type` field is invalid.?
    ?65                                                        It must be either 'percent' or 'amount'.";?
    ?66                                        break;?
    ?67?
    ?68                                }//end switch?
    ?69?
    ?70                        }//end if?
    ?71?
    ?72                        return parent::verifyVariables($variables);?
    ?73?
    ?74                }//end method --verifyVariables--?
    ?75?
    ?76?
    ?77                function prepareVariables($variables){?
    ?78?
    5479                        if($variables["type"] == "percent")?
    5580                                $variables["value"] = ((real) str_replace("%","",$variables["percentvalue"]));?
    56?                        else ?
    ?81                        else?
    5782                                $variables["value"] =  currencyToNumber($variables["amountvalue"]);?
    58?                ?
    ?83?
    5984                        return $variables;?
    6085                }?
    61?        ?
    62?                ?
    63?                function updateRecord($variables, $modifiedby = NULL){?
    64?                        ?
    65?                        $variables = $this->formatValue($variables);?
    66?                                                ?
    67?                        parent::updateRecord($variables,$modifiedby);?
    68?                }?
    69?        ?
    70?        ?
    71?                function insertRecord($variables,$createdby = NULL){?
    72?                ?
    73?                        $variables = $this->formatValue($variables);?
    74?                        return parent::insertRecord($variables,$createdby);?
    75?                }?
    76?                ?
    77?        ?
    ?86?
    ?87?
    7888                function getTotals($id=0){?
    79?                ?
    ?89?
    8090                        $returnArray["Invoice"]["total"]=0;?
    8191                        $returnArray["Invoice"]["sum"]=0;?
    8292                        $returnArray["Order"]["total"]=0;?
    8393                        $returnArray["Order"]["sum"]=0;?
    84?                        ?
    ?94?
    8595                        if($id>0){?
    8696                                $querystatement="SELECT invoices.type,count(invoices.id) as total,sum(discountamount) as sum?
    87?                                                                FROM discounts inner join invoices on discounts.id=invoices.discountid ?
    ?97                                                                FROM discounts inner join invoices on discounts.id=invoices.discountid?
    8898                                                                WHERE discounts.id=".((int) $id)." and (invoices.type=\"Order\" or invoices.type=\"Invoice\") GROUP BY invoices.type";?
    8999                                $queryresult = $this->db->query($querystatement);?
    90?        ?
    ?100?
    91101                                while($therecord=$this->db->fetchArray($queryresult)){?
    92102                                        $returnArray[$therecord["type"]]["total"]=$therecord["total"];?
    93103                                        $returnArray[$therecord["type"]]["sum"]=$therecord["sum"];?
    94104                                }?
    95?                                ?
    ?105?
    96106                        }?
    97?        ?
    ?107?
    98108                        return $returnArray;?
    99?        ?
    ?109?
    100110                }//end function?
    101?                ?
    ?111?
    102112        }//end class?
    103113}//end if?
  • trunk/phpbms/modules/bms/include/invoices.php

    r451 r485 ?
    4040        class invoices extends phpbmsTable{?
    4141?
    ?42                var $availableClientIDs = array();?
    ?43                var $availableUserIDs = array();?
    ?44                var $availableStatusIDs = array();?
    ?45?
    4246                function showClientType($id){?
    4347?
    ? ? ?
    437441                }?
    438442?
    ?443                /*------[verification related functions]---------------------------*/?
    ?444?
    ?445                function populateClientArray(){?
    ?446?
    ?447                        $this->availableClientIDs = array();?
    ?448?
    ?449                        $querystatement = "?
    ?450                                SELECT?
    ?451                                        `id`?
    ?452                                FROM?
    ?453                                        `clients`;?
    ?454                                ";?
    ?455?
    ?456                        $queryresult = $this->db->query($querystatement);?
    ?457?
    ?458                        if($this->db->numRows($queryresult)){?
    ?459                                while($therecord = $this->db->fetchArray($queryresult))?
    ?460                                        $this->availableClientIDs[] = $therecord["id"];?
    ?461                        }else{?
    ?462                                $this->availableClientIDs[] = "none";?
    ?463                        }//end if?
    ?464?
    ?465                }//end method --populateClientArray--?
    ?466?
    ?467?
    ?468                function populateUserArray(){?
    ?469?
    ?470                        $this->availableUserIDs = array();?
    ?471?
    ?472                        $querystatement = "?
    ?473                                SELECT?
    ?474                                        `id`?
    ?475                                FROM?
    ?476                                        `users`;?
    ?477                                ";?
    ?478?
    ?479                        $queryresult = $this->db->query($querystatement);?
    ?480?
    ?481                        $this->availableUserIDs[] = 0;//for none?
    ?482?
    ?483                        while($therecord = $this->db->fetchArray($queryresult))?
    ?484                                $this->availableUserIDs[] = $therecord["id"];?
    ?485?
    ?486                }//end method  --populateUserArray--?
    ?487?
    ?488?
    ?489                function populateInvoiceStatusArray(){?
    ?490?
    ?491                        $this->availableStatusIDs = array();?
    ?492?
    ?493                        $querystatement = "?
    ?494                                SELECT?
    ?495                                        `id`?
    ?496                                FROM?
    ?497                                        `invoicestatuses`;?
    ?498                                ";?
    ?499?
    ?500                        $queryresult = $this->db->query($querystatement);?
    ?501?
    ?502                        if($this->db->numRows($queryresult)){?
    ?503                                while($therecord = $this->db->fetchArray($queryresult))?
    ?504                                        $this->availableStatusIDs[] = $therecord["id"];?
    ?505                        }else{?
    ?506                                $this->availableStatusIDs[] = "none";?
    ?507                        }//end if?
    ?508?
    ?509                }//end method --populateInvoiceStatusArray--?
    ?510?
    ?511?
    ?512                function verifyVariables($variables){?
    ?513?
    ?514                        //must have a client?
    ?515                        if(isset($variables["clientid"])){?
    ?516?
    ?517                                //must be numeric and positive?
    ?518                                if(!$variables["clientid"] || (int)$variables["clientid"] > 0){?
    ?519?
    ?520                                        if(!count($this->availableClientIDs))?
    ?521                                                $this->populateClientArray();?
    ?522?
    ?523                                        if(!in_array(((int)$variables["clientid"]),$this->availableClientIDs))?
    ?524                                                $this->verifyErrors[] = "The `clientid` field does not give an existing/acceptable client id number.";?
    ?525                                }else?
    ?526                                        $this->verifyErrors[] = "The `clientid` field must be a non-negative number or equivalent to 0.";?
    ?527?
    ?528                        }else?
    ?529                                $this->verifyErrors[] = "The `clientid` field must be set.";?
    ?530?
    ?531                        //table default (NULL) is not enough?
    ?532                        if(isset($variables["type"])){?
    ?533?
    ?534                                switch($variables["type"]){?
    ?535?
    ?536                                        case "Quote":?
    ?537                                        case "Order":?
    ?538                                        case "Invoice":?
    ?539                                        case "VOID":?
    ?540                                                break;?
    ?541?
    ?542                                        default:?
    ?543                                                $this->verifyErrors[] = "The value of the `type` field is invalid.  It must be 'Quote',?
    ?544                                                        'Order', 'Invoice', or 'VOID'.";?
    ?545                                                break;?
    ?546?
    ?547                                }//end switch?
    ?548?
    ?549                        }else?
    ?550                                $this->verifyErrors[] = "The `type` field must be set.";?
    ?551?
    ?552                        //check assigned to id?
    ?553                        if(isset($variables["assignedtoid"])){?
    ?554?
    ?555                                //assignedtoid needs to be a non-negative number or equivalent to 0?
    ?556                                if( !$variables["assignedtoid"] || ((int)$variables["assignedtoid"]) > 0 ){?
    ?557?
    ?558                                        if(!count($this->availableUserIDs))?
    ?559                                                $this->populateUserArray();?
    ?560?
    ?561                                        if(!in_array(((int)$variables["assignedtoid"]),$this->availableUserIDs))?
    ?562                                                $this->verifyErrors[] = "The `assignedtoid` field does not give an existing/acceptable user id number.";?
    ?563                                }else?
    ?564                                        $this->verifyErrors[] = "The `assignedtoid` field must be a non-negative number or equivalent to 0.";?
    ?565?
    ?566                        }//end if?
    ?567?
    ?568                        //check status id?
    ?569                        if(isset($variables["statusid"])){?
    ?570?
    ?571                                //assignedtoid needs to be a non-negative number or equivalent to 0?
    ?572                                if( !$variables["statusid"] || ((int)$variables["statusid"]) > 0 ){?
    ?573?
    ?574                                        if(!count($this->availableStatusIDs))?
    ?575                                                $this->populateInvoiceStatusArray();?
    ?576?
    ?577                                        if(!in_array(((int)$variables["statusid"]),$this->availableStatusIDs))?
    ?578                                                $this->verifyErrors[] = "The `statusid` field does not give an existing/acceptable status id number.";?
    ?579                                }else?
    ?580                                        $this->verifyErrors[] = "The `statusid` field must be a non-negative number or equivalent to 0.";?
    ?581?
    ?582                        }//end if?
    ?583?
    ?584                        //check booleans?
    ?585                                //readytopost?
    ?586                                if(isset($variables["readytopost"]))?
    ?587                                        if($variables["readytopost"] && $variables["readytopost"] != 1)?
    ?588                                                $this->verifyErrors[] = "The `readytopost` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?589?
    ?590                                //weborder?
    ?591                                if(isset($variables["weborder"]))?
    ?592                                        if($variables["weborder"] && $variables["weborder"] != 1)?
    ?593                                                $this->verifyErrors[] = "The `weborder` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?594?
    ?595                                //shiptosameasbilling?
    ?596                                if(isset($variables["shiptosameasbilling"]))?
    ?597                                        if($variables["shiptosameasbilling"] && $variables["shiptosameasbilling"] != 1)?
    ?598                                                $this->verifyErrors[] = "The `shiptosameasbilling` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?599                        //check addresss ids?
    ?600                        //check secondary line item ids?
    ?601?
    ?602                        return parent::verifyVariables($variables);?
    ?603?
    ?604                }//end method?
    ?605?
    439606?
    440607                function prepareVariables($variables){?
    ? ? ?
    544711                function updateRecord($variables, $modifiedby = NULL){?
    545712?
    546?                        if($modifiedby === NULL)?
    547?                                $modifiedby = $_SESSION["userinfo"]["id"];?
    ?713                        //if($modifiedby === NULL)?
    ?714                        //      $modifiedby = $_SESSION["userinfo"]["id"];?
    548715?
    549716?
    ? ? ?
    551718                                return false;?
    552719?
    553?                        $variables = $this->prepareVariables($variables);?
    ?720                        //$variables = $this->prepareVariables($variables);?
    554721?
    555722                        if(!hasRights(20)){?
    ? ? ?
    606773                                $createdby = $_SESSION["userinfo"]["id"];?
    607774?
    608?                        $variables = $this->prepareVariables($variables);?
    ?775                        //$variables = $this->prepareVariables($variables);?
    609776?
    610777                        $newid = parent::insertRecord($variables, $createdby);?
  • trunk/phpbms/modules/bms/include/invoicestatuses.php

    r285 r485 ?
    4040if(class_exists("phpbmsTable")){?
    4141        class invoiceStatus extends phpbmsTable {?
    42?        ?
    ?42?
    ?43                var $availableUserIDs = array();?
    ?44?
    ?45                function populateUserArray(){?
    ?46?
    ?47                        $querystatement = "?
    ?48                                SELECT?
    ?49                                        `id`?
    ?50                                FROM?
    ?51                                        `users`;?
    ?52                                ";?
    ?53?
    ?54                        $queryresult = $this->db->query($querystatement);?
    ?55?
    ?56                        $this->availableUserIDs[] = 0;//for everyone?
    ?57?
    ?58                        while($therecord = $this->db->fetchArray($queryresult))?
    ?59                                $this->availableUserIDs[] = $therecord["id"];?
    ?60?
    ?61                }//end method --populateUserArray--?
    ?62?
    ?63?
    ?64                function verifyVariables($variables){?
    ?65?
    ?66                        if(isset($variables["setreadytopost"]))?
    ?67                                if($variables["setreadytopost"] && $variables["setreadytopost"] != 1)?
    ?68                                        $this->verifyErrors[] = "The `setreadytopost` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?69?
    ?70                        if(isset($variables["invoicedefault"]))?
    ?71                                if($variables["invoicedefault"] && $variables["invoicedefault"] != 1)?
    ?72                                        $this->verifyErrors[] = "The `invoicedefault` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?73?
    ?74                        if(isset($variables["defaultassignedtoid"])){?
    ?75?
    ?76                                if( !$variables["defaultassignedtoid"] || ((int)$variables["defaultassignedtoid"]) > 0 ){?
    ?77?
    ?78                                        if(!count($this->availableUserIDs))?
    ?79                                                $this->populateUserArray();?
    ?80?
    ?81                                        if(!in_array(((int)$variables["defaultassignedtoid"]), $this->availableUserIDs))?
    ?82                                                $this->verifyErrors[] = "The `defaultassignedtoid` field does not give an existing/acceptable user id number.";?
    ?83?
    ?84                                }else?
    ?85                                        $this->verifyErrors[] = "The `defaultassignedtoid` field must be a non-negative number or equivalent to 0.";?
    ?86?
    ?87                        }//end if?
    ?88?
    ?89                        return parent::verifyVariables($variables);?
    ?90?
    ?91                }//end method --verifyVariables--?
    ?92?
    ?93?
    4394                function updateRecord($variables, $modifiedby = NULL){?
    4495                        if(isset($variables["invoicedefault"]))?
    4596                                $this->updateInvoiceDefault();?
    46?                ?
    ?97?
    4798                        parent::updateRecord($variables, $modifiedby = NULL);?
    48?                } ?
    49?                ?
    ?99                }?
    ?100?
    50101                function updateInvoiceDefault(){?
    51102                        $querystatement="UPDATE `".$this->maintable."` SET `invoicedefault` = 0";?
    ? ? ?
    59110?
    60111                function delete_record(){?
    61?                ?
    ?112?
    62113                        $whereclause = $this->buildWhereClause($theids,"invoicestatuses.id");?
    63?                        ?
    ?114?
    64115                        $querystatement = "UPDATE invoicestatuses SET inactive=1,modifiedby=".$_SESSION["userinfo"]["id"]." WHERE (".$whereclause.") AND invoicedefault=0;";?
    65116                        $queryresult = $this->db->query($querystatement);?
    66?                        ?
    ?117?
    67118                        $message = $this->buildStatusMessage();?
    68119                        $message.=" marked inactive.";?
  • trunk/phpbms/modules/bms/include/products.php

    r427 r485 ?
    4040if(class_exists("phpbmsTable")){?
    4141        class products extends phpbmsTable{?
    42?        ?
    ?42?
    ?43                var $availableCategoryIDs = array();?
    ?44                var $availableProducts = array();?
    ?45?
    4346                function getDefaults(){?
    4447                        $therecord = parent::getDefaults();?
    45?                        ?
    ?48?
    4649                        $therecord["type"]="Inventory";?
    47?                        $therecord["status"]="In Stock";                ?
    ?50                        $therecord["status"]="In Stock";?
    4851                        $therecord["taxable"]=1;?
    49?                        ?
    ?52?
    5053                        return $therecord;?
    5154                }?
    52?        ?
    ?55?
    5356                function getPicture($name){?
    5457                        if (function_exists('file_get_contents')) {?
    ? ? ?
    5861                                $file = addslashes(fread(fopen($_FILES[$name]['tmp_name'], 'r'), filesize($_FILES[$name]['tmp_name'])));?
    5962                        }?
    60?                        ?
    ?63?
    6164                        return $file;?
    6265                }?
    63?                ?
    64?                //This method is for when there is not categoryid specified?
    65?                function _getCategoryID(){?
    66?                        ?
    ?66?
    ?67?
    ?68                function populateCategoryArray(){?
    ?69?
    ?70                        $this->availableCategoryIDs = array();?
    ?71?
    6772                        $querystatement = "?
    6873                                SELECT?
    6974                                        `id`?
    7075                                FROM?
    71?                                        `productcategories`?
    72?                                ORDER BY?
    73?                                        `inactive` ASC?
    74?                                LIMIT 1;?
    ?76                                        `productcategories`;?
    7577                                ";?
    ?78?
    ?79                        $queryresult = $this->db->query($querystatement);?
    ?80?
    ?81                        if($this->db->numRows($queryresult)){?
    ?82                                while($therecord = $this->db->fetchArray($queryresult))?
    ?83                                        $this->availableCategoryIDs[] = $therecord["id"];?
    ?84                        }else?
    ?85                                $this->availableCategoryIDs[] = "none";?
    ?86?
    ?87                }//end method --populateCategoryArray--?
    ?88?
    ?89?
    ?90                function populateProductArray(){?
    ?91?
    ?92                        // I need id as well to let updates work with our verify function?
    ?93                        // i.e. if its an update on existing record, its ok if the productnumber?
    ?94                        // is not unique iff its already associated to the record being updated?
    ?95                        $this->availableProducts = array();?
    ?96?
    ?97                        $querystatement = "?
    ?98                                SELECT?
    ?99                                        `id`,?
    ?100                                        `partnumber`?
    ?101                                FROM?
    ?102                                        `products`;?
    ?103                                ";?
    ?104?
    ?105                        $queryresult = $this->db->query($querystatement);?
    ?106?
    ?107                        if($this->db->numRows($queryresult)){?
    ?108?
    ?109                                while($therecord = $this->db->fetchArray($queryresult)){?
    ?110                                        $partnumber = $therecord["partnumber"];?
    ?111                                        $id = $therecord["id"];?
    ?112?
    ?113                                        $this->availableProducts[$partnumber]["id"] = $id;?
    ?114                                }//end while?
    ?115?
    ?116                        }else{?
    ?117                                $partnumber = "NoT a REAl parTNuMBE|7 DU|\/|MY!";//put in an impossible partnumber?
    ?118                                $id = -1;//put in an impossible product id?
    ?119?
    ?120                                $this->availableProducts[$partnumber]["id"] = $id;?
    ?121                        }//end if?
    ?122?
    ?123                }//end method --populateProductArray--?
    ?124?
    ?125?
    ?126                function verifyVariables($variables){?
    ?127?
    ?128                        //must have a partnumber...table default is not enough?
    ?129                        if(isset($variables["partnumber"])){?
    ?130?
    ?131                                //must have some sort of partnumber?
    ?132                                if($variables["partnumber"] !== "" || $variables["partnumber"] !== NULL){?
    ?133?
    ?134                                        if(!count($this->availableProducts))?
    ?135                                                $this->populateProductArray();?
    ?136?
    ?137                                        //can't have this partnumber already chosen?
    ?138                                        if(!isset($variables["id"]))?
    ?139                                                $variables["id"] = 0;?
    ?140?
    ?141                                        if($variables["id"] < 0)?
    ?142                                                $variables["id"] = 0;?
    ?143?
    ?144                                        $temppartnumber = $variables["partnumber"];// using this because it looks ugly to but the brackets within brackets?
    ?145                                        if( array_key_exists($variables["partnumber"], $this->availableProducts) ){?
    ?146?
    ?147                                                if( $this->availableProducts[$temppartnumber]["id"] !== $variables["id"] )?
    ?148                                                        $this->verifyErrors[] = "The `partnumber` field must give an unique part number.";?
    ?149?
    ?150                                        }else{?
    ?151                                                $this->availableProducts[$temppartnumber]["id"] = -1;// impossible id put in?
    ?152                                        }//end if?
    ?153?
    ?154                                }else?
    ?155                                        $this->verifyErrors[] = "The `partnumber` field must not be blank.";?
    ?156?
    ?157                        }else?
    ?158                                $this->verifyErrors[] = "The `partnumber` field must be set.";?
    ?159?
    ?160?
    ?161                        //STORE CATEGORY IDS, DON'T SELECT EVERY TIME?
    ?162                        if(isset($variables["categoryid"])){?
    ?163?
    ?164                                if(((int) $variables["categoryid"]) > 0){?
    ?165?
    ?166                                        if(!count($this->availableCategoryIDs))?
    ?167                                                $this->populateCategoryArray();?
    ?168?
    ?169                                        if( !in_array(((int) $variables["categoryid"]), $this->availableCategoryIDs) )?
    ?170                                                $this->verifyErrors[] = "The `categoryid` field does not give an existing/acceptable category id number.";?
    ?171?
    ?172                                }else?
    ?173                                        $this->verifyErrors[] = "The `categoryid` field must be a positive number.";?
    ?174?
    ?175                        }else?
    ?176                                $this->verifyErrors[] = "The `categoryid` must be set.";?
    ?177?
    ?178?
    ?179                        if(isset($variables["status"])){?
    ?180?
    ?181                                switch($variables["status"]){?
    ?182?
    ?183                                        case "In Stock":?
    ?184                                        case "Out of Stock":?
    ?185                                        case "Backordered":?
    ?186                                                break;?
    ?187?
    ?188                                        default:?
    ?189                                                $this->verifyErrors[] = "The value of the `status` field is invalid.?
    ?190                                                        It must be 'In Stock', 'Out of Stock', or 'Backordered'.";?
    ?191                                                break;?
    ?192?
    ?193                                }//end switch?
    ?194?
    ?195                        }//end if?
    ?196?
    ?197?
    ?198                        if(isset($variables["type"])){?
    ?199?
    ?200                                switch($variables["type"]){?
    ?201?
    ?202                                        case "Inventory":?
    ?203                                        case "Non-Inventory":?
    ?204                                        case "Service":?
    ?205                                        case "Kit":?
    ?206                                        case "Assembly":?
    ?207                                                break;?
    ?208?
    ?209                                        default:?
    ?210                                                $this->verifyErrors[] = "The value of the `type` field is invalid.?
    ?211                                                        It must be 'Inventory', 'Non-Inventory', 'Service', 'Kit', or 'Assembly'.";?
    ?212                                                break;?
    ?213?
    ?214                                }//end switch?
    ?215?
    ?216                        }//end if?
    ?217?
    ?218                        //check boolean?
    ?219                        if(isset($variables["webenabled"]))?
    ?220                                if($variables["webenabled"] && $variables["webenabled"] != 1)?
    ?221                                        $this->verifyErrors[] = "The `webenabled` field must be a boolean (equivalent to 0 or exactly 1).";?
    76222                        ?
    77?                        $queryresult = $this->db->query($querystatement);?
    78?                        $therecord = $this->db->fetchArray($queryresult);?
    79?                        ?
    80?                        if(!isset($therecord["id"]))?
    81?                                $therecord["id"] = 0;?
    82?                        ?
    83?                        if(!$therecord["id"]){?
    84?                                ?
    85?                                $querystatement = "?
    86?                                        INSERT INTO?
    87?                                                `productcategories`?
    88?                                                (?
    89?                                                        `name`,?
    90?                                                        `inactive`,?
    91?                                                        `description`,?
    92?                                                        `webenabled`,?
    93?                                                        `webdisplayname`,?
    94?                                                        `createdby`,?
    95?                                                        `creationdate`,?
    96?                                                        `modifiedby`,?
    97?                                                        `modifieddate`?
    98?                                                )VALUES(?
    99?                                                        'import_category',?
    100?                                                        '0',?
    101?                                                        'This category was automatically created by an import routine.  Please replace with a more applicable record',?
    102?                                                        '0',?
    103?                                                        '',?
    104?                                                        '".((int) $_SESSION["userinfo"]["id"])."',?
    105?                                                        NOW(),?
    106?                                                        '".((int) $_SESSION["userinfo"]["id"])."',?
    107?                                                        NOW()?
    108?                                                );?
    109?                                        ";?
    110?                                ?
    111?                                $queryresult = $this->db->query($querystatement);?
    112?                                $therecord["id"] = $this->db->insertId();?
    113?                                ?
    114?                        }//end if?
    115?                        ?
    116?                        return $therecord["id"];?
    117?                        ?
    118?                }//end method --_getCategoryID--?
    119?                ?
    120?                function formatVariables($variables){?
    121?                        ?
    ?223                        if(isset($variables["isoversized"]))?
    ?224                                if($variables["isoversized"] && $variables["isoversized"] != 1)?
    ?225                                        $this->verifyErrors[] = "The `isoversized` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?226?
    ?227                        if(isset($variables["isprepackaged"]))?
    ?228                                if($variables["isprepackaged"] && $variables["isprepackaged"] != 1)?
    ?229                                        $this->verifyErrors[] = "The `isprepackaged` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?230?
    ?231                        if(isset($variables["taxable"]))?
    ?232                                if($variables["taxable"] && $variables["taxable"] != 1)?
    ?233                                        $this->verifyErrors[] = "The `taxable` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?234?
    ?235                        return parent::verifyVariables($variables);?
    ?236?
    ?237                }//end method --verifyVariables--?
    ?238?
    ?239?
    ?240                function _commonPrepareVariables($variables){?
    ?241?
    122242                        if(!isset($variables["unitprice"]))?
    123243                                $variables["thumchange"] = 0;?
    124?                        ?
    ?244?
    125245                        if(!isset($variables["unitcost"]))?
    126246                                $variables["thumchange"] = 0;?
    127?                        ?
    ?247?
    128248                        $variables["unitprice"] = currencyToNumber($variables["unitprice"]);?
    129249                        $variables["unitcost"] = currencyToNumber($variables["unitcost"]);?
    130?                        ?
    ?250?
    131251                        if(!isset($variables["thumbchange"]))?
    132252                                $variables["thumbchange"] = NULL;?
    133?                        ?
    ?253?
    134254                        if($variables["thumbchange"]){?
    135?        ?
    ?255?
    136256                                if($variables["thumbchange"] == "upload"){?
    137257                                        $variables["thumbnail"] = $this->getPicture("thumbnailupload");?
    138?                                        $variables["thumbnailmime"] = $_FILES['thumbnailupload']['type'];                                       ?
    ?258                                        $variables["thumbnailmime"] = $_FILES['thumbnailupload']['type'];?
    139259                                } else {?
    140260                                        //delete?
    ? ? ?
    142262                                        $variables["thumbnailmime"] = NULL;?
    143263                                }?
    144?                        ?
    ?264?
    145265                        } // end thumbnail picture change if?
    146?                        ?
    147?                        ?
    ?266?
    ?267?
    148268                        if(!isset($variables["picturechange"]))?
    149269                                $variables["picturechange"] = NULL;?
    150?                        ?
    ?270?
    151271                        if($variables["picturechange"]){?
    152?        ?
    ?272?
    153273                                if($variables["picturechange"] == "upload"){?
    154274                                        $variables["picture"] = $this->getPicture("pictureupload");?
    155?                                        $variables["picturemime"] = $_FILES['pictureupload']['type'];                                   ?
    ?275                                        $variables["picturemime"] = $_FILES['pictureupload']['type'];?
    156276                                } else {?
    157277                                        //delete?
    ? ? ?
    159279                                        $variables["picturemime"] = NULL;?
    160280                                }?
    161?        ?
    162?                        }//end main picture change if                   ?
    163?                        ?
    164?                        if(!isset($variables["categoryid"]))?
    165?                                $variables["categoryid"] = 0;?
    166??
    167?                        if(!$variables["categoryid"])?
    168?                                $variables["categoryid"] = $this->_getCategoryID();?
    169?                        ?
    ?281?
    ?282                        }//end main picture change if?
    ?283?
    170284                        return $variables;?
    171?                ?
    ?285?
    ?286                }//end method --_commonPrepareVariables--?
    ?287?
    ?288?
    ?289                function prepareVariables($variables){?
    ?290?
    ?291                        switch($variables["id"]){?
    ?292?
    ?293                                case "":?
    ?294                                case NULL:?
    ?295                                case 0:?
    ?296                                        if(!hasRights(20)){?
    ?297                                                unset($this->fields["partnumber"]);?
    ?298                                                unset($this->fields["partname"]);?
    ?299                                                unset($this->fields["upc"]);?
    ?300                                                unset($this->fields["description"]);?
    ?301                                                unset($this->fields["inactive"]);?
    ?302                                                unset($this->fields["taxable"]);?
    ?303                                                unset($this->fields["unitprice"]);?
    ?304                                                unset($this->fields["unitcost"]);?
    ?305                                                unset($this->fields["unitofmeasure"]);?
    ?306                                                unset($this->fields["type"]);?
    ?307                                                unset($this->fields["categoryid"]);?
    ?308?
    ?309                                                unset($this->fields["webenabled"]);?
    ?310                                                unset($this->fields["keywords"]);?
    ?311                                                unset($this->fields["webdescription"]);?
    ?312?
    ?313                                        } else {?
    ?314?
    ?315                                                //user has rights.  Let's format everything.?
    ?316                                                $variables = $this->_commonPrepareVariables($variables);?
    ?317?
    ?318                                        }//end if?
    ?319?
    ?320                                        if($variables["packagesperitem"])?
    ?321                                                $variables["packagesperitem"]=1/$variables["packagesperitem"];?
    ?322?
    ?323                                        break;?
    ?324?
    ?325                                default:?
    ?326                                        $variables = $this->_commonPrepareVariables($variables);?
    ?327                                        if(isset($variables["packagesperitem"]))?
    ?328                                                if($variables["packagesperitem"])?
    ?329                                                        $variables["packagesperitem"] = 1 / $variables["packagesperitem"];?
    ?330                                        break;?
    ?331?
    ?332                        }//end switch?
    ?333?
    ?334                        return $variables;?
    ?335?
    172336                }//end function?
    173?                ?
    174?        ?
    ?337?
    ?338?
    175339                function updateRecord($variables, $modifiedby = NULL){?
    176?        ?
    177?                        //need to override field information if they don't have the rights?
    178?                        if(!hasRights(20)){?
    179?                                unset($this->fields["partnumber"]);?
    180?                                unset($this->fields["partname"]);?
    181?                                unset($this->fields["upc"]);?
    182?                                unset($this->fields["description"]);?
    183?                                unset($this->fields["inactive"]);?
    184?                                unset($this->fields["taxable"]);?
    185?                                unset($this->fields["unitprice"]);?
    186?                                unset($this->fields["unitcost"]);?
    187?                                unset($this->fields["unitofmeasure"]);?
    188?                                unset($this->fields["type"]);?
    189?                                unset($this->fields["categoryid"]);                     ?
    190?        ?
    191?                                unset($this->fields["webenabled"]);                     ?
    192?                                unset($this->fields["keywords"]);                       ?
    193?                                unset($this->fields["webdescription"]);?
    194?        ?
    195?                        } else {?
    196?                                //user has rights.  Let's format everything.?
    197?        ?
    198?                                $variables = $this->formatVariables($variables);?
    199?        ?
    200?                ?
    201?                        }               ?
    202?                        ?
    203?                        if($variables["packagesperitem"])?
    204?                                $variables["packagesperitem"]=1/$variables["packagesperitem"];?
    205?        ?
    206?        ?
    ?340?
    207341                        parent::updateRecord($variables, $modifiedby);?
    208?        ?
    ?342?
    209343                        //need to reset the field information.  If they did not have rights?
    210344                        // we temporarilly removed the fields to be updated.?
    211345                        $this->getTableInfo();?
    212346                }?
    213?        ?
    214?        ?
    215?                function insertRecord($variables, $createdby = NULL){?
    216??
    217?                ?
    218?                        $variables = $this->formatVariables($variables);?
    219?                        ?
    220?                        if(isset($variables["packagesperitem"]))?
    221?                                if($variables["packagesperitem"])?
    222?                                        $variables["packagesperitem"]=1/$variables["packagesperitem"];?
    223??
    224?                        $newid = parent::insertRecord($variables, $createdby);?
    225?                        ?
    226?                        return $newid;?
    227?                }?
    228?        ?
    229?        ?
    ?347?
    ?348?
    230349                function checkNumberCategories(){?
    231350                        $querystatement="SELECT count(id) AS thecount FROM productcategories WHERE inactive=0";?
    232351                        $queryresult=$this->db->query($querystatement);?
    233352                        $therecord=$this->db->fetchArray($queryresult);?
    234?        ?
    ?353?
    235354                        return $therecord["thecount"];?
    236355                }?
    237?        ?
    238?        ?
    ?356?
    ?357?
    239358                function displayProductCategories($categoryid){?
    240359                        $querystatement="SELECT `id`,`name` FROM `productcategories` WHERE `inactive` =0 OR `id` =".((int) $categoryid)." ORDER BY `name`";?
    241360                        $queryresult=$this->db->query($querystatement);?
    242?        ?
    ?361?
    243362                        ?><select name="categoryid" id="categoryid">?
    244?                                <?php ?
    ?363                                <?php?
    245364                                        while($therecord = $this->db->fetchArray($queryresult)){?
    246365                                                ?><option value="<?php echo $therecord["id"]?>" <?php if($categoryid==$therecord["id"]) echo "selected=\"selected\""?>><?php echo $therecord["name"];?></option>?
    ? ? ?
    249368                                ?>?
    250369                        </select><?php?
    251?                        ?
    252?                }?
    253?        ?
    ?370?
    ?371                }?
    ?372?
    254373        }//end products class?
    255374}//end if?
  • trunk/phpbms/modules/bms/include/receipts.php

    r384 r485 ?
    4040?
    4141        class receiptitems{?
    42?        ?
    ?42?
    4343                function receiptitems($db){?
    44?                        ?
    ?44?
    4545                        $this->db = $db;?
    46?                        ?
    47?                }//end method?
    48?                ?
    ?46?
    ?47                }//end method?
    ?48?
    4949                function get($receiptid){?
    5050?
    ? ? ?
    6767                                        aritems.type,?
    6868                                        aritems.itemdate";?
    69?                                        ?
    ?69?
    7070                                return $this->db->query($querystatement);?
    71?                ?
    ?71?
    7272                }//end function?
    73?                ?
    74?                ?
    ?73?
    ?74?
    7575                function show($queryresult, $receiptPosted, $receiptid){?
    76?                        ?
    ?76?
    7777                        $count = 1;?
    78?                ?
    ?78?
    7979                        while($therecord = $this->db->fetchArray($queryresult)){?
    80?                                ?
    ?80?
    8181                                $recID = "i".$count;?
    82?                                                                ?
    ?82?
    8383                                if($therecord["type"] == "invoice"){?
    84?                                ?
    ?84?
    8585                                        $tempDate = stringToDate($therecord["itemdate"], "SQL");?
    8686                                        $dueDate = dateToString( strtotime(TERM1_DAYS." days", $tempDate) );?
    87?                                ?
    88?                                } else ?
    ?87?
    ?88                                } else?
    8989                                        $dueDate = "&nbsp;";?
    90?                                ?
    ?90?
    9191                                if($therecord["type"] == "deposit" && $therecord["relatedid"] == $receiptid){?
    9292                                        $therecord["relatedid"] = "";?
    ? ? ?
    9494                                        $therecord["aritemid"] = 0;?
    9595                                }?
    96?                                ?
    97?                                if($receiptPosted)                                      ?
    98?                                        $docDue = $therecord["amount"] - $therecord["paid"];                                    ?
    ?96?
    ?97                                if($receiptPosted)?
    ?98                                        $docDue = $therecord["amount"] - $therecord["paid"];?
    9999                                elseif($therecord["relatedid"])?
    100?                                        $docDue = $therecord["amount"] - $therecord["paid"] - $therecord["applied"] - $therecord["discount"] - $therecord["taxadjustment"];     ?
    ?100                                        $docDue = $therecord["amount"] - $therecord["paid"] - $therecord["applied"] - $therecord["discount"] - $therecord["taxadjustment"];?
    101101                                else?
    102102                                        $docDue = 0;?
    103?                                ?
    104?                                ?
    ?103?
    ?104?
    105105                                ?>?
    106106?
    ? ? ?
    122122                                        <td><input id="<?php echo $recID?>TaxAdj" class="currency" value="<?php echo formatVariable($therecord["taxadjustment"], "currency")?>" size="10" maxlength="12"/></td>?
    123123                                        <td><button type="button" id="<?php echo $recID?>RemoveARItemButton" class="graphicButtons buttonMinus" title="remove item"><span>-</span></button></td>?
    124?                                </tr>                           ?
    125?                                ?
    ?124                                </tr>?
    ?125?
    126126                                <?php?
    127?                                ?
    ?127?
    128128                                $count++;?
    129129                        }//endwhile?
    130?                ?
    131?                ?
    132?                }//end method?
    133??
    134?                ?
    ?130?
    ?131?
    ?132                }//end method?
    ?133?
    ?134?
    135135                function set($itemlist, $receiptid, $clientid, $userid){?
    136?                        ?
    ?136?
    137137                        //remove any exisiting items?
    138138                        $deletestatement = "DELETE FROM receiptitems WHERE receiptid =".((int) $receiptid);?
    139139                        $this->db->query($deletestatement);?
    140?                        ?
    ?140?
    141141                        //remove any ar deposits created by ths receipt?
    142142                        $deletestatement = "DELETE FROM aritems WHERE relatedid = ".((int) $receiptid)." AND `type` = 'deposit'";?
    ? ? ?
    146146?
    147147                        foreach($itemsArray as $item){?
    148?                        ?
    ?148?
    149149                                $itemRecord = explode("::", $item);?
    150?                                ?
    ?150?
    151151                                if(count($itemRecord) > 1){?
    152152?
    153153                                        //if no ar id, or the deposit is from this record, we need to create the ar item?
    154154                                        if(!$itemRecord[0] || ($itemRecord[1] == $receiptid && $itemRecord[2] == "deposit") ){?
    155?                                        ?
    ?155?
    156156                                                $arrecord = array();?
    157157                                                $arrecord["type"] = "deposit";?
    158158                                                $arrecord["status"] = "open";?
    159159                                                $arrecord["posted"] = 0;?
    160?                                                $arrecord["amount"] = -1 * currencyToNumber($itemRecord[8]);                                            ?
    ?160                                                $arrecord["amount"] = -1 * currencyToNumber($itemRecord[8]);?
    161161                                                $arrecord["itemdate"] = $itemRecord[3];?
    162162                                                $arrecord["clientid"] = $clientid;?
    163163                                                $arrecord["relatedid"] = $receiptid;?
    164?        ?
    165?        ?
    ?164?
    ?165?
    166166                                                if(!isset($aritems))?
    167167                                                        $aritems = new phpbmsTable($this->db, 303);?
    168?                                                ?
    ?168?
    169169                                                $aritems->insertRecord($arrecord, $userid);?
    170?                                                ?
    ?170?
    171171                                                $itemRecord[0] = $this->db->insertId();?
    172?                                                ?
    ?172?
    173173                                        }//end if?
    174?                                        ?
    ?174?
    175175                                        $insertstatement ="?
    176176                                        INSERT INTO?
    ? ? ?
    184184                                                ".currencyToNumber($itemRecord[10])."?
    185185                                        )";?
    186?                                ?
    ?186?
    187187                                        $this->db->query($insertstatement);?
    188188?
    189189                                }//endif?
    190?                                ?
    ?190?
    191191                        }//endforeach?
    192?                ?
    193?                }//end method?
    194?        ?
    ?192?
    ?193                }//end method?
    ?194?
    195195        }// end class?
    196196?
    ? ? ?
    199199        //======================================================================?
    200200        class receipts extends phpbmsTable{?
    201?                ?
    ?201?
    ?202                var $availableClientIDs = array();?
    ?203                var $availablePaymentMethodIDs = array();?
    202204?
    203205                function showPaymentOptions($selectedid){?
    204?                ?
    ?206?
    205207                        global $phpbms;?
    206?                        ?
    ?208?
    207209                        $querystatement = "?
    208210                                SELECT?
    ? ? ?
    221223                                        priority,?
    222224                                        name";?
    223?                        ?
    ?225?
    224226                        $queryresult = $this->db->query($querystatement);?
    225?                ?
    ?227?
    226228                        ?>?
    227229                        <label for="paymentmethodid">payment type</label><br />?
    228230                        <select id="paymentmethodid" name="paymentmethodid">?
    229?                                <?php ?
    ?231                                <?php?
    230232                                        $phpbms->bottomJS[] = 'paymentTypes = Array()';?
    231233                                        $phpbms->bottomJS[] = 'paymentTypes["s-1"] = Array();';?
    ? ? ?
    233235                                        $phpbms->bottomJS[] = 'paymentTypes["s-1"]["onlineprocess"] = 0';?
    234236                                        $phpbms->bottomJS[] = 'paymentTypes["s-1"]["onlineprocess"] = null';?
    235?                                ?
    ?237?
    236238                                        while($therecord = $this->db->fetchArray($queryresult)){?
    237239?
    ? ? ?
    240242                                                $phpbms->bottomJS[] = 'paymentTypes["s'.$therecord["id"].'"]["onlineprocess"] = "'.$therecord["onlineprocess"].'";';?
    241243                                                $phpbms->bottomJS[] = 'paymentTypes["s'.$therecord["id"].'"]["processscript"] = "'.$therecord["processscript"].'";';?
    242?                                        ?
    243?                                                ?><option value="<?php echo $therecord["id"]?>" <?php if($therecord["id"] == $selectedid) echo 'selected="selected"'?>><?php echo $therecord["name"]?></option><?php ?
    ?244?
    ?245                                                ?><option value="<?php echo $therecord["id"]?>" <?php if($therecord["id"] == $selectedid) echo 'selected="selected"'?>><?php echo $therecord["name"]?></option><?php?
    244246                                                echo "\n";?
    245?                                        ?
    ?247?
    246248                                        }//endwhile?
    247?                                        ?
    ?249?
    248250                                ?>?
    249251                                <option value="-1" <?php if($selectedid == -1) echo 'selected="selected"'?>>Other...</option>?
    250?                        </select><?php ?
    251??
    252?                        ?
    253?                }//end method?
    254?                ?
    ?252                        </select><?php?
    ?253?
    ?254?
    ?255                }//end method?
    ?256?
    255257                // CLASS OVERRIDES ======================================================================================?
    256?                ?
    ?258?
    257259                function getDefaults(){?
    258260                        $therecord = parent::getDefaults();?
    259?                        ?
    ?261?
    260262                        $therecord["clientid"] = "";?
    261263                        $therecord["status"] = "open";?
    262264                        $therecord["receiptdate"] = dateToString(mktime(),"SQL");?
    263?                        ?
    ?265?
    264266                        return $therecord;?
    265267                }?
    266?                                                ?
    267?                ?
    ?268?
    ?269?
    ?270                function populateClientArray(){?
    ?271?
    ?272                        $this->availableClientIDs = array();?
    ?273?
    ?274                        $querystatement = "?
    ?275                                SELECT?
    ?276                                        `id`?
    ?277                                FROM?
    ?278                                        `clients`;?
    ?279                                ";?
    ?280?
    ?281                        $queryresult = $this->db->query($querystatement);?
    ?282?
    ?283                        if($this->db->numRows($queryresult)){?
    ?284                                while($therecord = $this->db->fetchArray($queryresult))?
    ?285                                        $this->availableClientIDs[] = $therecord["id"];?
    ?286                        }else?
    ?287                                $this->availableClientIDs[] = "none";?
    ?288?
    ?289                }//end method --populateClientArray--?
    ?290?
    ?291?
    ?292                function populatePaymentArray(){?
    ?293?
    ?294                        $this->availablePaymentMethodIDs = array();?
    ?295?
    ?296                        $querystatement = "?
    ?297                                SELECT?
    ?298                                        `id`?
    ?299                                FROM?
    ?300                                        `paymentmethods`;?
    ?301                                ";?
    ?302?
    ?303                        $queryresult = $this->db->query($querystatement);?
    ?304?
    ?305                        //for the "other" choice on receipts?
    ?306                        $this->availablePaymentMethodIDs[] = -1;?
    ?307?
    ?308                        while($therecord = $this->db->fetchArray($queryresult))?
    ?309                                $this->availablePaymentMethodIDs[] = $therecord["id"];?
    ?310?
    ?311                }//end method --populatePaymentArray--?
    ?312?
    ?313?
    ?314                function verifyVariables($variables){?
    ?315?
    ?316                        //default not sufficient?
    ?317                        if(isset($variables["clientid"])){?
    ?318?
    ?319                                if(((int) $variables["clientid"]) > 0){?
    ?320?
    ?321                                        if(!count($this->availableClientIDs))?
    ?322                                                $this->populateClientArray();?
    ?323?
    ?324                                        if(!in_array(((int)$variables["clientid"]),$this->availableClientIDs))?
    ?325                                                $this->verifyErrors[] = "The `clientid` field does not give an existing/acceptable client id number.";?
    ?326                                }else?
    ?327                                        $this->verifyErrors[] = "The `clientid` field must be a positive number.";?
    ?328?
    ?329                        }else?
    ?330                                $this->verifyErrors[] = "The `clientid` field must be set.";?
    ?331?
    ?332                        //because enum, default not sufficient?
    ?333                        if(isset($variables["status"])){?
    ?334                                switch($variables["status"]){?
    ?335?
    ?336                                        case "open":?
    ?337                                        case "collected":?
    ?338                                                break;?
    ?339?
    ?340                                        default:?
    ?341                                                $this->verifyErrors[] = "The value of the `status` field is invalid.  It must?
    ?342                                                        be either 'open' or 'closed'.";?
    ?343                                        break;?
    ?344?
    ?345                                }//end switch?
    ?346                        }else?
    ?347                                $this->verifyErrors[] = "The `status` field must be set.";?
    ?348?
    ?349                        // Default is not sufficient?
    ?350                        if(isset($variables["paymentmethodid"])){?
    ?351?
    ?352                                if(is_numeric($variables["paymentmethodid"])){?
    ?353?
    ?354                                        if(!count($this->availablePaymentMethodIDs))?
    ?355                                                $this->populatePaymentArray();?
    ?356?
    ?357                                        if(!in_array(((int)$variables["paymentmethodid"]),$this->availablePaymentMethodIDs))?
    ?358                                                $this->verifyErrors[] = "The `paymentmethod` field does not give an existing/accpetable payment method id number.";?
    ?359                                }else?
    ?360                                        $this->verifyErrors[] = "The `paymentmethodid` field must be numeric.";?
    ?361?
    ?362                        }else?
    ?363                                $this->verifyErrors[] = "The `paymentmethodid` field must be set.";?
    ?364?
    ?365                        //check booleans?
    ?366                        if(isset($variables["readytopost"]))?
    ?367                                if($variables["readytopost"] && $variables["readytopost"] != 1)?
    ?368                                        $this->verifyErrors[] = "The `readytopost` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?369?
    ?370                        if(isset($variables["posted"]))?
    ?371                                if($variables["posted"] && $variables["posted"] != 1)?
    ?372                                        $this->verifyErrors[] = "The `posted` field must be a boolean (equivalent to 0 or exactly 1).";?
    ?373?
    ?374                        return parent::verifyVariables($variables);?
    ?375?
    ?376                }//end method --verifyVariables--?
    ?377?
    ?378?
    268379                function prepareVariables($variables){?
    269?                                        ?
    ?380?
    270381                        $variables["amount"] = currencyToNumber($variables["amount"]);?
    271?                                ?
    ?382?
    272383                        return $variables;?
    273384                }?
    274?                ?
    275?                ?
    ?385?
    ?386?
    276387                function updateRecord($variables, $modifiedby = NULL){?
    277?        ?
    278?                        if($modifiedby === NULL)?
    279?                                $modifiedby = $_SESSION["userinfo"]["id"];?
    280?                        ?
    281?                        $variables = $this->prepareVariables($variables);?
    282?                ?
    ?388?
    283389                        if(parent::updateRecord($variables, $modifiedby)){?
    284?                                ?
    ?390?
    285391                                if($variables["itemschanged"]==1){?
    286?                                ?
    ?392?
    287393                                        $items = new receiptitems($this->db);?
    288?        ?
    ?394?
    289395                                        $items->set($variables["itemslist"], $variables["id"], $variables["clientid"], $modifiedby);?
    290?                                ?
    ?396?
    291397                                }//end if?
    292?                                                                ?
    ?398?
    293399                        }//end if?
    294400?
    295401                }//end method?
    296?        ?
    297?        ?
    298?        ?
    ?402?
    ?403?
    ?404?
    299405                function insertRecord($variables, $createdby = NULL){?
    300?        ?
    301?                        if($createdby === NULL)?
    302?                                $createdby = $_SESSION["userinfo"]["id"];?
    303?        ?
    304?                        $variables = $this->prepareVariables($variables);?
    305?        ?
    ?406?
    306407                        $newid = parent::insertRecord($variables, $createdby);?
    307?        ?
    ?408?
    308409                        if($variables["itemschanged"]==1){?
    309?                                ?
    ?410?
    310411                                $items = new receiptitems($this->db);?
    311412?
    312413                                $items->set($variables["itemslist"], $newid, $variables["clientid"], $createdby);?
    313?                        ?
    ?414?
    314415                        }//end if?
    315?                        ?
    ?416?
    316417                        return $newid;?
    317418                }?
    ? ? ?
    322423if(class_exists("searchFunctions")){?
    323424        class receiptsSearchFunctions extends searchFunctions{?
    324?        ?
    ?425?
    325426                function post(){?
    326?                ?
    ?427?
    327428                        $whereclause = $this->buildWhereClause();?
    328?                ?
    ?429?
    329430                        include_once("include/post_class.php");?
    330431                        defineReceiptPost();?
    331?                        ?
    ?432?
    332433                        $receiptPost = new receiptPost($this->db);?
    333?                        ?
    ?434?
    334435                        $count = $receiptPost->post($whereclause);?
    335?                ?
    ?436?
    336437                        $message = $this->buildStatusMessage($count);?
    337438                        $message .= " posted.";?
    338?                        ?
    ?439?
    339440                        return $message;?
    340441                }//end method?
    341?                ?
    342?        ?
    ?442?
    ?443?
    343444                function delete_record(){?
    344?                                        ?
    ?445?
    345446                        //passed variable is array of user ids to be revoked?
    346447                        $whereclause = $this->buildWhereClause();?
    347?                        ?
    ?448?
    348449                        $querystatement ="?
    349?                                SELECT ?
    ?450                                SELECT?
    350451                                        id?
    351452                                FROM?
    ? ? ?
    357458?
    358459                        $queryresult = $this->db->query($querystatement);?
    359?                        ?
    ?460?
    360461                        $count = $this->db->numRows($queryresult);?
    361?                        ?
    ?462?
    362463                        $newWhere = "";?
    363464                        while($therecord = $this->db->fetchArray($queryresult))?
    364465                                $newWhere .= " OR id = ".$therecord["id"];?
    365?                                ?
    ?466?
    366467                        if(strlen($newWhere))?
    367468                                $newWhere = substr($newWhere, 4);?
    368469                        else?
    369470                                $newWhere = "id = -1974";?
    370?                        ?
    ?471?
    371472                        $deletestatement = "?
    372473                                DELETE FROM?
    ? ? ?
    375476                                        `type` = 'deposit'?
    376477                                        AND (".str_replace("id =", "relatedid =", $newWhere).")";?
    377?                                        ?
    ?478?
    378479                        $this->db->query($deletestatement);?
    379?                        ?
    ?480?
    380481                        $deletestatement = "?
    381482                                DELETE FROM?
    ? ? ?
    383484                                WHERE?
    384485                                        ".str_replace("id =", "receiptid =", $newWhere);?
    385?                                        ?
    ?486?
    386487                        $this->db->query($deletestatement);?
    387488?
    ? ? ?
    391492                                WHERE?
    392493                                        ".$newWhere;?
    393?                                        ?
    394?                        $this->db->query($deletestatement);                                     ?
    395?                                                ?
    ?494?
    ?495                        $this->db->query($deletestatement);?
    ?496?
    396497                        $message = $this->buildStatusMessage($count);?
    397498                        $message.=" deleted.";?
    398?                ?
    ?499?
    399500                        return $message;?
    400501                }//end method?
    401?                ?
    402?                ?
    ?502?
    ?503?
    403504                function _getFullyDistributed(){?
    404505?
    405506                        $whereclause = $this->buildWhereClause();?
    406?                        ?
    ?507?
    407508                        $querystatement = "?
    408509                                SELECT?
    ? ? ?
    420521                        $count = 0;?
    421522                        while($therecord = $this->db->fetchArray($queryresult)){?
    422?                        ?
    ?523?
    423524                                $querystatement = "?
    424525                                        SELECT?
    ? ? ?
    432533?
    433534                                $checkrecord = $this->db->fetchArray($checkresult);?
    434?                                ?
    ?535?
    435536                                if($therecord["amount"] == $checkrecord["thesum"]){?
    436537                                        $newWhere .= " OR id = ".$therecord["id"];?
    437538                                        $count++;?
    438?                                        ?
    ?539?
    439540                                }//endif?
    440?                                ?
    ?541?
    441542                        }//endif?
    442543?
    ? ? ?
    445546                        else?
    446547                                $newWhere = "id = -1974";?
    447?                        ?
    ?548?
    448549                        return array("clause" => $newWhere, "count" => $count);?
    449?                                        ?
    450?                }//end method?
    451?                ?
    452?                ?
    ?550?
    ?551                }//end method?
    ?552?
    ?553?
    453554                function mark_rtp(){?
    454?                ?
    ?555?
    455556                        $where = $this->_getFullyDistributed();?
    456?                        ?
    ?557?
    457558                        $updatestatement="?
    458559                                UPDATE?
    ? ? ?
    462563                                        readytopost = 1,?
    463564                                        modifiedby = ".$_SESSION["userinfo"]["id"].",?
    464?                                        modifieddate = NOW()                                    ?
    ?565                                        modifieddate = NOW()?
    465566                                WHERE?
    466567                                        ".$where["clause"];?
    467?                                        ?
    ?568?
    468569                        $this->db->query($updatestatement);?
    469570?
    470571                        $message = $this->buildStatusMessage($where["count"]);?
    471572                        $message.=" marked ready to post.";?
    472?                ?
    ?573?
    473574                        return $message;?
    474575                }//end method?
    475?                ?
    476?                ?
    ?576?
    ?577?
    477578                function mark_collected(){?
    478?                ?
    ?579?
    479580                        $where = $this->_getFullyDistributed();?
    480?                        ?
    ?581?
    481582                        $updatestatement="?
    482583                                UPDATE?
    ? ? ?
    488589                                WHERE?
    489590                                        ".$where["clause"];?
    490?                                        ?
    ?591?
    491592                        $this->db->query($updatestatement);?
    492593?
    493594                        $message = $this->buildStatusMessage($where["count"]);?
    494595                        $message.=" marked collected.";?
    495?                ?
    ?596?
    496597                        return $message;?
    497598                }//end method?
    498?        ?
    ?599?
    499600        }//end class?
    500601}//end if?
    ? ? ?
    504605?
    505606        class receiptPost extends tablePost{?
    506?                ?
    ?607?
    507608                function receiptPost($db, $modifiedby = NULL){?
    508?                        ?
    ?609?
    509610                        parent::tablePost($db, $modifiedby);?
    510?                        ?
    ?611?
    511612                }//end method?
    512613?
    513614?
    514615                function prepareWhere($whereclause=NULL){?
    515?                        ?
    ?616?
    516617                        $this->whereclause = "";?
    517?                        ?
    518?                        if($whereclause)                        ?
    ?618?
    ?619                        if($whereclause)?
    519620                                $this->whereclause = "(".$whereclause.") AND ";?
    520?                        ?
    ?621?
    521622                        $this->whereclause .= "receipts.posted = 0 AND receipts.readytopost = 1";?
    522?                ?
    523?                }//end method?
    524?                ?
    525?                ?
    ?623?
    ?624                }//end method?
    ?625?
    ?626?
    526627                function post($whereclause=NULL){?
    527?                        ?
    ?628?
    528629                        if($whereclause)?
    529630                                $this->prepareWhere($whereclause);?
    530?                        ?
    ?631?
    531632?
    532633                        $querystatement = "?
    ? ? ?
    537638                                WHERE?
    538639                                        ".$this->whereclause;?
    539?                                        ?
    ?640?
    540641                        $queryresult = $this->db->query($querystatement);?
    541?                        ?
    ?642?
    542643                        $count = $this->db->numRows($queryresult);?
    543644                        $newWhere = "";?
    544645                        while($therecord = $this->db->fetchArray($queryresult)){?
    545?                        ?
    ?646?
    546647                                $querystatement = "?
    547648                                        SELECT?
    ? ? ?
    559660                                        WHERE?
    560661                                                receiptitems.receiptid = ".$therecord["id"];?
    561?                                ?
    ?662?
    562663                                $itemsresult = $this->db->query($querystatement);?
    563?                                ?
    ?664?
    564665                                while($itemrecord = $this->db->fetchArray($itemsresult)){?
    565?                                ?
    ?666?
    566667                                        if($itemrecord["relatedid"] == $therecord["id"] && $itemrecord["type"] == "deposit")?
    567668                                                $paid = $itemrecord["paid"];?
    ? ? ?
    573674                                        else?
    574675                                                $status = "open";?
    575?                                ?
    ?676?
    576677                                        $updatestatement ="?
    577678                                                UPDATE?
    ? ? ?
    582683                                                        `status` = '".$status."',?
    583684                                                        modifiedby = ".$_SESSION["userinfo"]["id"].",?
    584?                                                        modifieddate = NOW()                                                    ?
    ?685                                                        modifieddate = NOW()?
    585686                                                WHERE?
    586687                                                        id = ".$itemrecord["aritemid"];?
    587?                                        ?
    ?688?
    588689                                        $this->db->query($updatestatement);?
    589?                                        ?
    ?690?
    590691                                        if($itemrecord["type"] == "invoice"){?
    591?                                                ?
    ?692?
    592693                                                $updatestatement = "?
    593?                                                        UPDATE ?
    ?694                                                        UPDATE?
    594695                                                                invoices?
    595696                                                        SET?
    ? ? ?
    601702?
    602703                                                        $this->db->query($updatestatement);?
    603?                                                        ?
    ?704?
    604705                                        }//endif?
    605?                                ?
    ?706?
    606707                                }//endwhile?
    607708?
    ? ? ?
    611712                        if(strlen($newWhere))?
    612713                                $newWhere = substr($newWhere, 4);?
    613?                        ?
    ?714?
    614715                        if($newWhere){?
    615?                        ?
    ?716?
    616717                                $updatestatement = "?
    617718                                        UPDATE?
    ? ? ?
    628729                                                ccnumber = LPAD(SUBSTRING(ccnumber,-4),LENGTH(ccnumber),'*'),?
    629730                                        ";?
    630?                                }//endif                                                ?
    631?                                                ?
    ?731                                }//endif?
    ?732?
    632733                                $updatestatement .="?
    633734                                                modifiedby = ".$_SESSION["userinfo"]["id"].",?
    ? ? ?
    635736                                        WHERE?
    636737                                                ".$newWhere;?
    637?        ?
    ?738?
    638739                                $this->db->query($updatestatement);?
    639?        ?
    ?740?
    640741?
    641742                        }//endif?
    642?                        ?
    ?743?
    643744                        return $count;?
    644?                        ?
    645?                }//end method?
    646?                ?
    ?745?
    ?746                }//end method?
    ?747?
    647748        }//end class invoicePost?
    648749?
  • trunk/phpbms/modules/bms/install/install.php

    r384 r485 ?
    3737 +-------------------------------------------------------------------------+?
    3838*/?
    39?error_reporting(E_ALL);?
    40?define("APP_DEBUG",false);?
    41?define("noStartup",true);?
    42?include("../../../install/install_include.php");?
    43?include("../../../include/session.php");?
    44??
    45?        $phpbmsSession = new phpbmsSession;?
    46?        $success = $phpbmsSession->loadDBSettings(false);?
    47?        include_once("include/db.php");?
    48?        $db = new db(false);?
    49?        $db->stopOnError = false;?
    50?        $db->showError = false;?
    51?        $db->logError = false;?
    52??
    53?        if($success !== false){?
    54?                ?
    55?                if(!$db->connect())?
    56?                        $thereturn = "Could Not Establish Connection To MySQL Server: Check server, user name, and password.";                  ?
    57?                else {?
    58?                        if(!$db->selectSchema())?
    59?                                $thereturn = "Database (schema) ".MYSQL_DATABASE." could not be selected";                      ?
    60?                        else {?
    61??
    62?                                $thereturn = "Business Management System Installation\n";?
    63?                                $thereturn .= "_______________________________________\n";?
    64?                                ?
    65?                                $tempreturn = createTables($db,"createtables.sql");?
    66?                                ?
    67?                                if($tempreturn === true){?
    68?                                        ?
    69?                                        $thereturn.= "Done Creating Tables \n";?
    70?                                        ?
    71?                                        $tables = array(?
    72?                                                "choices",?
    73?                                                "menu",?
    74?                                                "tabs",?
    75?                                                "roles",?
    76?                                                "modules",?
    77?                                                "smartsearches",?
    78?                                                "relationships",?
    79?                                                "reports",?
    80?                                                "tablecolumns",?
    81?                                                "tabledefs",?
    82?                                                "tablegroupings",?
    83?                                                "tablefindoptions",?
    84?                                                "tableoptions",?
    85?                                                "tablesearchablefields",?
    86?                                                "usersearches",?
    87?                                                "settings",?
    88?                                                "shippingmethods",?
    89?                                                "paymentmethods",               ?
    90?                                                "invoicestatuses",              ?
    91?                                        );?
    92?                                        foreach($tables as $table){?
    93?                                                ?
    94?                                                $failure = false;?
    95?                                                $tempreturn = importData($db,$table);?
    96?                                                $thereturn .= $tempreturn;?
    97?                                                if(!strpos($tempreturn,"complete.") === false){?
    98?                                                        $failed = true;?
    99?                                                }?
    100?                                                ?
    101?                                        }//end foreach?
    102?                                        ?
    103?                                        if(!$failure){?
    104?                                                $thereturn .= "________________________\n";                     ?
    105?                                                $thereturn .= "Done Installing BMS Data\n";?
    106?                                        }?
    107?                                } else?
    108?                                        $thereturn = $tempreturn;                               ?
    109?                        }               ?
    110?                }?
    111?        } else?
    112?                $thereturn = "Could not access settings.php";?
    113?                ?
    114?                ?
    115?                header('Content-Type: text/xml');?
    116?                ?><?php echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'; ?>?
    117?<response><?php echo $thereturn?></response>?
    ?39$theModule = new installModuleAjax($this->db, $this->phpbmsSession, "../modules/bms/install/");?
    ?40$theModule->tables = array(?
    ?41                        "choices",?
    ?42                        "menu",?
    ?43                        "tabs",?
    ?44                        "roles",?
    ?45                        "modules",?
    ?46                        "smartsearches",?
    ?47                        "relationships",?
    ?48                        "reports",?
    ?49                        "tablecolumns",?
    ?50                        "tabledefs",?
    ?51                        "tablegroupings",?
    ?52                        "tablefindoptions",?
    ?53                        "tableoptions",?
    ?54                        "tablesearchablefields",?
    ?55                        "usersearches",?
    ?56                        "settings",?
    ?57                        "shippingmethods",?
    ?58                        "paymentmethods",?
    ?59                        "invoicestatuses",?
    ?60                        );?
  • trunk/phpbms/modules/bms/install/reports.sql

    r408 r485 ?
    2626INSERT INTO `reports` (`name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('Summary', 'report', '303', '10', '80', 'modules/bms/report/aritems_summary.php', 'Items grouped and totaled by clients, with grand totals.', 1, NOW(), 1, NOW());?
    2727INSERT INTO `reports` (`name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('Payment Type Totals', 'report', '304', '10', '80', 'modules/bms/report/receipts_pttotals.php', 'Totals grouped by payment method.', 1, NOW(), 1, NOW());?
    ?28INSERT INTO `reports` (`name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('Incoming Cash Flow', 'report', '3', '55', '50', 'modules/bms/report/incoming_cashflow.php', 'This report shows total incoming monies for a time period from both posted sales orders AND posted receipts. It can be grouped by week, month, quarter and year.\r\n\r\nThis report runs is unaffected by selected records, search or sort parameters.  It requires input of it\'s own start and end dates.', 1, NOW(), 1, NOW());?
  • trunk/phpbms/modules/bms/install/tablecolumns.sql

    r442 r485 ?
    44INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'type', 'clients.type', 'left', '', '0', '', '0', '', NULL, '0');?
    55INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'phone', 'IF(clients.workphone != \'\' OR clients.homephone != \'\' OR clients.mobilephone != \'\' OR clients.otherphone != \'\',IF(clients.workphone != \'\', concat(clients.workphone, \' (w)\'), IF(clients.homephone != \'\', concat(clients.homephone, \' (h)\'), IF(clients.mobilephone != \'\', concat(clients.mobilephone, \' (m)\'), IF(clients.otherphone != \'\', concat(clients.otherphone, \' (o)\'), \'\')))) ,\'\')', 'left', '', '4', 'concat(clients.workphone, clients.homephone, clients.mobilephone,clients.otherphone)', '0', '', NULL, '0');?
    6?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'id','invoices.id','left','',0,'',0,'',NULL,0);?
    7?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'type','invoices.type','left','',2,'',0,'',NULL,0);?
    8?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'status','invoicestatuses.name','left','',3,'',0,'',NULL,0);?
    9?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'date','if(invoices.type=\"Invoice\",invoices.invoicedate,invoices.orderdate)','left','',5,'',0,'','date',0);?
    10?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'client name / company','concat(\"<strong>\",if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company),\"</strong>\")','left','',6,NULL,0,'100%','noencoding',0);?
    11?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'total','if(invoices.type!=\"VOID\",invoices.totalti,\"-----\")','right','sum(if(invoices.type!=\"VOID\",invoices.totalti,0))',8,'if(invoices.type!=\"VOID\",invoices.totalti,0)',0,'','currency',0);?
    12?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'due','if(invoices.type!=\"VOID\",invoices.totalti-invoices.amountpaid,\"-----\")','right','sum(if(invoices.type!=\"VOID\",(invoices.totalti-invoices.amountpaid),0))',9,'if(invoices.type!=\"VOID\",invoices.totalti-invoices.amountpaid,0)',0,'','currency',0);?
    13?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'web','invoices.weborder','center','',4,'',0,'','boolean',0);?
    14?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'RTP','invoices.readytopost','center','',1,'',0,'','boolean',0);?
    15?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'payment','paymentmethods.name','left','',7,'',0,'',NULL,0);?
    16?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (4,'part number','products.partnumber','left','',0,'',0,'',NULL,0);?
    17?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (4,'name','products.partname','left','',1,'',1,'100%',NULL,0);?
    18?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (4,'status','products.status','left','',3,'',0,'',NULL,0);?
    19?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (4,'unit price','products.unitprice','right','',4,'',0,'','currency',0);?
    20?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (4,'type','products.type','left','',2,'',0,'',NULL,0);?
    21?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'id','lineitems.id','left','',0,'',0,'',NULL,0);?
    22?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'invoice id','lineitems.invoiceid','left','',1,'',0,'',NULL,0);?
    23?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'part #','products.partnumber','left','',4,'',0,'',NULL,0);?
    24?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'name','products.partname','left','',5,'',1,'100%',NULL,0);?
    25?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'unit price','lineitems.unitprice','right','sum(lineitems.unitprice)',6,'lineitems.unitprice',0,'','currency',0);?
    26?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'qty','format(lineitems.quantity,2)','center','format(sum(lineitems.quantity),2)',7,'lineitemd.quantity',0,'',NULL,0);?
    27?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'price ext.','lineitems.unitprice*lineitems.quantity','right','sum(lineitems.unitprice*lineitems.quantity)',8,'',0,'','currency',0);?
    28?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'cost ext.','lineitems.unitcost*lineitems.quantity','right','sum(lineitems.unitcost*lineitems.quantity)',9,'',0,'','currency',0);?
    29?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'total wt.','format((lineitems.unitweight*lineitems.quantity),2)','right','format(sum(lineitems.unitweight*lineitems.quantity),2)',11,'lineitems.unitweight*lineitems.quantity',0,'',NULL,0);?
    30?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'type','invoices.type','left','',2,'',0,'',NULL,0);?
    31?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'date','if(invoices.type=\"Invoice\",invoices.invoicedate,invoices.orderdate)\r\n','left','',3,'',1,'','date',0);?
    32?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (5,'tax','lineitems.taxable','center','',10,'',0,'','boolean',0);?
    33?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (6,'id','tax.id','center','',0,'',0,'',NULL,0);?
    34?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (6,'name','concat(\"<strong>\",tax.name,\"</strong>\")','left','',1,NULL,0,'','noencoding',0);?
    35?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (6,'percentage','concat(tax.percentage,\"%\")','left','',2,'tax.percentage',0,'98%',NULL,0);?
    36?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (7,'id','productcategories.id','center','',0,'',0,'',NULL,0);?
    37?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (7,'name','productcategories.name','left','',1,'',0,'100%',NULL,0);?
    38?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (7,'date created','productcategories.creationdate','left','',2,'productcategories.creationdate',0,'','datetime',0);?
    39?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (8,'name','childproducts.partname','left','',1,'',1,'100%',NULL,0);?
    40?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (8,'part number','childproducts.partnumber','left','',0,'',0,'',NULL,0);?
    ?6INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('3', 'id', 'invoices.id', 'left', '', '0', '', '0', '', NULL, '0');?
    ?7INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('3', 'type', 'invoices.type', 'left', '', '2', '', '0', '', NULL, '0');?
    ?8INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('3', 'status', 'invoicestatuses.name', 'left', '', '3', '', '0', '', NULL, '0');?
    ?9INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('3', 'date', 'if(invoices.type=\"Invoice\",invoices.invoicedate,invoices.orderdate)', 'left', '', '5', '', '0', '', 'date', '0');?
    ?10INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('3', 'client name / company', 'concat(\"<strong>\",if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company),\"</strong>\")', 'left', '', '6', NULL, '0', '100%', 'noencoding', '0');?
    ?11INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('3', 'total', 'if(invoices.type!=\"VOID\",invoices.totalti,\"-----\")', 'right', 'sum(if(invoices.type!=\"VOID\",invoices.totalti,0))', '8', 'if(invoices.type!=\"VOID\",invoices.totalti,0)', '0', '', 'currency', '0');?
    ?12INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('3', 'due', 'if(invoices.type!=\"VOID\",invoices.totalti-invoices.amountpaid,\"-----\")', 'right', 'sum(if(invoices.type!=\"VOID\",(invoices.totalti-invoices.amountpaid),0))', '9', 'if(invoices.type!=\"VOID\",invoices.totalti-invoices.amountpaid,0)', '0', '', 'currency', '0');?
    ?13INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('3', 'web', 'invoices.weborder', 'center', '', '4', '', '0', '', 'boolean', '0');?
    ?14INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('3', 'RTP', 'invoices.readytopost', 'center', '', '1', '', '0', '', 'boolean', '0');?
    ?15INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('3', 'payment', 'paymentmethods.name', 'left', '', '7', '', '0', '', NULL, '0');?
    ?16INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('4', 'part number', 'products.partnumber', 'left', '', '0', '', '0', '', NULL, '0');?
    ?17INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('4', 'name', 'products.partname', 'left', '', '1', '', '1', '100%', NULL, '0');?
    ?18INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('4', 'status', 'products.status', 'left', '', '3', '', '0', '', NULL, '0');?
    ?19INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('4', 'unit price', 'products.unitprice', 'right', '', '4', '', '0', '', 'currency', '0');?
    ?20INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('4', 'type', 'products.type', 'left', '', '2', '', '0', '', NULL, '0');?
    ?21INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'id', 'lineitems.id', 'left', '', '0', '', '0', '', NULL, '0');?
    ?22INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'invoice id', 'lineitems.invoiceid', 'left', '', '1', '', '0', '', NULL, '0');?
    ?23INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'part #', 'products.partnumber', 'left', '', '4', '', '0', '', NULL, '0');?
    ?24INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'name', 'products.partname', 'left', '', '5', '', '1', '100%', NULL, '0');?
    ?25INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'unit price', 'lineitems.unitprice', 'right', 'sum(lineitems.unitprice)', '6', 'lineitems.unitprice', '0', '', 'currency', '0');?
    ?26INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'qty', 'format(lineitems.quantity,2)', 'center', 'format(sum(lineitems.quantity),2)', '7', 'lineitemd.quantity', '0', '', NULL, '0');?
    ?27INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'price ext.', 'lineitems.unitprice*lineitems.quantity', 'right', 'sum(lineitems.unitprice*lineitems.quantity)', '8', '', '0', '', 'currency', '0');?
    ?28INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'cost ext.', 'lineitems.unitcost*lineitems.quantity', 'right', 'sum(lineitems.unitcost*lineitems.quantity)', '9', '', '0', '', 'currency', '0');?
    ?29INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'total wt.', 'format((lineitems.unitweight*lineitems.quantity),2)', 'right', 'format(sum(lineitems.unitweight*lineitems.quantity),2)', '11', 'lineitems.unitweight*lineitems.quantity', '0', '', NULL, '0');?
    ?30INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'type', 'invoices.type', 'left', '', '2', '', '0', '', NULL, '0');?
    ?31INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'date', 'if(invoices.type=\"Invoice\",invoices.invoicedate,invoices.orderdate)\r\n', 'left', '', '3', '', '1', '', 'date', '0');?
    ?32INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('5', 'tax', 'lineitems.taxable', 'center', '', '10', '', '0', '', 'boolean', '0');?
    ?33INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('6', 'id', 'tax.id', 'center', '', '0', '', '0', '', NULL, '0');?
    ?34INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('6', 'name', 'concat(\"<strong>\",tax.name,\"</strong>\")', 'left', '', '1', NULL, '0', '', 'noencoding', '0');?
    ?35INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('6', 'percentage', 'concat(tax.percentage,\"%\")', 'left', '', '2', 'tax.percentage', '0', '98%', NULL, '0');?
    ?36INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('7', 'id', 'productcategories.id', 'center', '', '0', '', '0', '', NULL, '0');?
    ?37INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('7', 'name', 'productcategories.name', 'left', '', '1', '', '0', '100%', NULL, '0');?
    ?38INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('7', 'date created', 'productcategories.creationdate', 'left', '', '2', 'productcategories.creationdate', '0', '', 'datetime', '0');?
    ?39INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('8', 'name', 'childproducts.partname', 'left', '', '1', '', '1', '100%', NULL, '0');?
    ?40INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('8', 'part number', 'childproducts.partnumber', 'left', '', '0', '', '0', '', NULL, '0');?
    4141INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('18', 'id', 'clients.id', 'center', '', '0', '', '0', '', NULL, '0');?
    4242INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('18', 'type', 'clients.type', 'left', '', '1', '', '0', '', NULL, '0');?
    4343INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('18', 'name', 'IF(clients.company != \'\', CONCAT(clients.company,IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(\' (\',if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\'),\')\'), \'\')), IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\')), \'\'))', 'left', '', '2', 'concat(clients.company,clients.lastname,clients.firstname)', '1', '100%', NULL, '0');?
    44?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (22,'name','clientemailprojects.name','left','',0,'',0,'100%',NULL,0);?
    45?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (22,'last run','clientemailprojects.lastrun','right','',1,'',0,'','datetime',0);?
    46?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (25,'amount/percent','discounts.value','right','',2,'',0,'',NULL,0);?
    47?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (25,'type','discounts.type','left','',1,'',0,'',NULL,0);?
    48?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (25,'name','discounts.name','left','',0,'',0,'100%',NULL,0);?
    49?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (300,'name','shippingmethods.name','left','',1,'',0,'99%',NULL,0);?
    50?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (300,'estimate','shippingmethods.canestimate','center','',2,'',0,'','boolean',0);?
    51?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (300,'priority','shippingmethods.priority','right','',0,'',0,'',NULL,0);?
    52?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (301,'name','paymentmethods.name','left','',1,'',0,'99%',NULL,0);?
    53?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (301,'type','paymentmethods.type','left','',2,'',0,'',NULL,0);?
    54?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (301,'id','paymentmethods.id','center','',0,'',0,'',NULL,0);?
    55?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (301,'priority','paymentmethods.priority','center','',3,'',0,'',NULL,0);?
    56?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (301,'online process','paymentmethods.onlineprocess','center','',4,'',0,'','boolean',0);?
    57?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (302,'name','invoicestatuses.name','left','',0,'',1,'99%',NULL,0);?
    58?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (302,'priority','invoicestatuses.priority','right','',1,'',0,'',NULL,0);?
    59?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (302,'inactive','invoicestatuses.inactive','center','',2,'',0,'','boolean',0);?
    60?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (303,'type','aritems.type','left','',1,'',0,'',NULL,0);?
    61?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (303,'date','aritems.itemdate','left','',3,'',0,'','date',0);?
    62?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (303,'client','if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)','left','',4,'',1,'100%',NULL,0);?
    63?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (303,'doc amt','aritems.amount','right','SUM(aritems.amount)',5,'',0,'','currency',0);?
    64?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (303,'amt due','aritems.amount-aritems.paid','right','SUM(aritems.amount-aritems.paid)',6,'',0,'','currency',0);?
    65?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (303,'doc ref','aritems.relatedid','left','',2,'',0,'',NULL,0);?
    66?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (303,'status','aritems.status','left','',0,'',0,'',NULL,0);?
    67?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (304,'id','receipts.id','left','',0,'',0,'',NULL,0);?
    68?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (304,'client','if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)','left','',4,'',1,'100%',NULL,0);?
    69?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (304,'RTP','receipts.readytopost','center','',1,'',0,'','boolean',0);?
    70?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (304,'amount','receipts.amount','right','sum(receipts.amount)',6,'',0,'','currency',0);?
    71?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (304,'payment','IF(receipts.paymentmethodid = -1,concat( concat("Other... (", receipts.paymentother), ")"), paymentmethods.name)','left','',5,'',0,'',NULL,0);?
    72?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (304,'date','receipts.receiptdate','left','',3,'',0,'','date',0);?
    73?INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (304,'status','receipts.status','left','',2,'',0,'',NULL,0);?
    ?44INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('22', 'name', 'clientemailprojects.name', 'left', '', '0', '', '0', '100%', NULL, '0');?
    ?45INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('22', 'last run', 'clientemailprojects.lastrun', 'right', '', '1', '', '0', '', 'datetime', '0');?
    ?46INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('25', 'amount/percent', 'discounts.value', 'right', '', '2', '', '0', '', NULL, '0');?
    ?47INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('25', 'type', 'discounts.type', 'left', '', '1', '', '0', '', NULL, '0');?
    ?48INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('25', 'name', 'discounts.name', 'left', '', '0', '', '0', '100%', NULL, '0');?
    ?49INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('300', 'name', 'shippingmethods.name', 'left', '', '1', '', '0', '99%', NULL, '0');?
    ?50INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('300', 'estimate', 'shippingmethods.canestimate', 'center', '', '2', '', '0', '', 'boolean', '0');?
    ?51INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('300', 'priority', 'shippingmethods.priority', 'right', '', '0', '', '0', '', NULL, '0');?
    ?52INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('301', 'name', 'paymentmethods.name', 'left', '', '1', '', '0', '99%', NULL, '0');?
    ?53INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('301', 'type', 'paymentmethods.type', 'left', '', '2', '', '0', '', NULL, '0');?
    ?54INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('301', 'id', 'paymentmethods.id', 'center', '', '0', '', '0', '', NULL, '0');?
    ?55INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('301', 'priority', 'paymentmethods.priority', 'center', '', '3', '', '0', '', NULL, '0');?
    ?56INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('301', 'online process', 'paymentmethods.onlineprocess', 'center', '', '4', '', '0', '', 'boolean', '0');?
    ?57INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('302', 'name', 'invoicestatuses.name', 'left', '', '0', '', '1', '99%', NULL, '0');?
    ?58INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('302', 'priority', 'invoicestatuses.priority', 'right', '', '1', '', '0', '', NULL, '0');?
    ?59INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('302', 'inactive', 'invoicestatuses.inactive', 'center', '', '2', '', '0', '', 'boolean', '0');?
    ?60INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('303', 'type', 'aritems.type', 'left', '', '1', '', '0', '', NULL, '0');?
    ?61INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('303', 'date', 'aritems.itemdate', 'left', '', '3', '', '0', '', 'date', '0');?
    ?62INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('303', 'client', 'if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)', 'left', '', '4', '', '1', '100%', NULL, '0');?
    ?63INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('303', 'doc amt', 'aritems.amount', 'right', 'SUM(aritems.amount)', '5', '', '0', '', 'currency', '0');?
    ?64INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('303', 'amt due', 'aritems.amount-aritems.paid', 'right', 'SUM(aritems.amount-aritems.paid)', '6', '', '0', '', 'currency', '0');?
    ?65INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('303', 'doc ref', 'aritems.relatedid', 'left', '', '2', '', '0', '', NULL, '0');?
    ?66INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('303', 'status', 'aritems.status', 'left', '', '0', '', '0', '', NULL, '0');?
    ?67INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('304', 'id', 'receipts.id', 'left', '', '0', '', '0', '', NULL, '0');?
    ?68INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('304', 'client', 'if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)', 'left', '', '4', '', '1', '100%', NULL, '0');?
    ?69INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('304', 'RTP', 'receipts.readytopost', 'center', '', '1', '', '0', '', 'boolean', '0');?
    ?70INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('304', 'amount', 'receipts.amount', 'right', 'sum(receipts.amount)', '6', '', '0', '', 'currency', '0');?
    ?71INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('304', 'payment', 'IF(receipts.paymentmethodid = -1,concat( concat(\"Other... (\", receipts.paymentother), \")\"), paymentmethods.name)', 'left', '', '5', '', '0', '', NULL, '0');?
    ?72INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('304', 'date', 'receipts.receiptdate', 'left', '', '3', '', '0', '', 'date', '0');?
    ?73INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('304', 'status', 'receipts.status', 'left', '', '2', '', '0', '', NULL, '0');?
    7474INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'address', 'concat(if(addresses.title != \'\',concat(\'[b]\',addresses.title,\'[/b][br]\'),\'\'),IF(addresses.address1!=\'\',addresses.address1,\'\'),if(addresses.address2 != \'\',concat(\'[br]\', addresses.address2),\'\'),if(addresses.city != \'\',concat(\'[br]\',addresses.city,\', \',if(addresses.state != \'\',addresses.state, \'\'),\' \',if(addresses.postalcode != \'\', addresses.postalcode, \'\')),\'\'),if(addresses.country != \'\',concat(\'[br]\',addresses.country),\'\'))', 'left', '', '0', '', '1', '100%', 'bbcode', '0');?
    7575INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'default ship to', 'addresstorecord.defaultshipto', 'center', '', '4', '', '0', '', 'boolean', '0');?
  • trunk/phpbms/modules/bms/install/tabledefs.sql

    r427 r485 ?
    11INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('2', 'Clients', 'table', '2', 'clients', '((clients INNER JOIN addresstorecord on clients.id = addresstorecord.recordid AND addresstorecord.tabledefid=2 AND addresstorecord.primary=1) INNER JOIN addresses ON  addresstorecord.addressid = addresses.id)', 'modules/bms/clients_addedit.php', '0', 'modules/bms/clients_addedit.php', '0', 'modules/bms/clients_import.php', '-100', '0', '-100', '-100', 'inactivate', 'clients.id=-100', 'clients.company, clients.lastname, clients.firstname', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    22INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('3', 'Sales Orders', 'table', '2', 'invoices', '(((invoices INNER JOIN clients ON invoices.clientid=clients.id) INNER JOIN invoicestatuses ON invoices.statusid=invoicestatuses.id) LEFT JOIN paymentmethods ON invoices.paymentmethodid = paymentmethods.id)', 'modules/bms/invoices_addedit.php', '0', 'modules/bms/invoices_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'void', 'invoices.type+0<3 OR (invoices.type = \'Invoice\' AND invoices.totalti != invoices.amountpaid)', 'invoices.id', '', '', '', 1, NOW(), 1, NOW());?
    3?INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('4', 'Products', 'table', '2', 'products', '(products inner join productcategories on products.categoryid=productcategories.id)', 'modules/bms/products_addedit.php', '0', 'modules/bms/products_addedit.php', '0', 'modules/bms/products_import.php', '-100', '0', '-100', '-100', 'inactivate', 'products.id =-100', 'products.partnumber', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    ?3INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('4', 'Products', 'table', '2', 'products', '(products inner join productcategories on products.categoryid=productcategories.id)', 'modules/bms/products_addedit.php', '0', 'modules/bms/products_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'inactivate', 'products.id =-100', 'products.partnumber', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    44INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('5', 'Line Items', 'table', '2', 'lineitems', '((lineitems left join products on lineitems.productid=products.id) inner join invoices on lineitems.invoiceid=invoices.id)', 'N/A', '0', 'N/A', '0', NULL, '-100', '0', '-100', '-100', 'NA', 'lineitems.id =-1', 'lineitems.invoiceid,lineitems.id', '', '', '', 1, NOW(), 1, NOW());?
    55INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('6', 'Tax Areas', 'table', '2', 'tax', 'tax', 'modules/bms/tax_addedit.php', '0', 'modules/bms/tax_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'inactivate', 'tax.inactive=0', 'tax.name', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    ? ? ?
    1111INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `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', NULL, '-100', '30', '30', '-100', 'inactivate', 'shippingmethods.inactive!=0', 'shippingmethods.priority, shippingmethods.name', '', '', '', 1, NOW(), 1, NOW());?
    1212INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('301', 'Payment Methods', 'table', '2', 'paymentmethods', 'paymentmethods', 'modules/bms/paymentmethods_addedit.php', '30', 'modules/bms/paymentmethods_addedit.php', '30', NULL, '-100', '30', '30', '-100', 'inactivate', 'paymentmethods.inactive=0', 'paymentmethods.priority,paymentmethods.name', '', '', '', 1, NOW(), 1, NOW());?
    13?INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `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', NULL, '-100', '30', '-100', '-100', 'inactivate', 'invoicestatuses.inactive=0', 'invoicestatuses.priority,invoicestatuses.name', '', '', '', 1, NOW(), 1, NOW());?
    ?13INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `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', NULL, '-100', '30', '-100', '-100', 'inactivate', 'invoicestatuses.inactive=0', 'invoicestatuses.priority,invoicestatuses.name', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    1414INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('303', 'AR Items', 'table', '2', 'aritems', '(aritems INNER JOIN clients ON aritems.clientid = clients.id)', 'modules/bms/aritems_view.php', '0', 'NA', '0', NULL, '-100', '0', '-100', '-100', 'NA', 'aritems.posted=1 AND aritems.status = \'open\'', 'aritems.itemdate, aritems.status, aritems.id', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
    1515INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('304', 'Receipts', 'table', '2', 'receipts', '((receipts INNER JOIN clients ON receipts.clientid = clients.id) LEFT JOIN paymentmethods ON receipts.paymentmethodid = paymentmethods.id)', 'modules/bms/receipts_addedit.php', '80', 'modules/bms/receipts_addedit.php', '80', NULL, '-100', '80', '-100', '-100', 'delete', 'receipts.posted=0', 'receipts.receiptdate', NULL, NULL, NULL, 1, NOW(), 1, NOW());?
  • trunk/phpbms/modules/bms/install/tablegroupings.sql

    r323 r485 ?
    1?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (2,'clients.type',1,1,'',0);?
    2?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (3,'concat(invoices.type,\"s\")',1,1,'',0);?
    3?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (4,'productcategories.name',1,1,'',0);?
    4?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (8,'concat(products.partnumber,\' - \',products.partname)',1,1,'',0);?
    5?INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES (22,'if(clientemailprojects.userid=0, \"global\", concat( users.firstname,\" \", users.lastname))',1,1,'',0);?
    ?1INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('2', 'clients.type', '1', '1', '', '0');?
    ?2INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('3', 'concat(invoices.type,\"s\")', '1', '1', '', '0');?
    ?3INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('4', 'productcategories.name', '1', '1', '', '0');?
    ?4INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('8', 'concat(products.partnumber,\' - \',products.partname)', '1', '1', '', '0');?
    ?5INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('22', 'if(clientemailprojects.userid=0, \"global\", concat( users.firstname,\" \", users.lastname))', '1', '1', '', '0');?
    66INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('303', 'if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)', '1', '1', '', '0');?
    77INSERT INTO `tablegroupings` (`tabledefid`, `field`, `displayorder`, `ascending`, `name`, `roleid`) VALUES ('304', 'if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)', '1', '1', '', '0');?
  • trunk/phpbms/modules/bms/install/tableoptions.sql

    r427 r485 ?
    7676INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('303', 'import', '0', '0', '0', '-100', '0');?
    7777INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('303', 'printex', '1', '0', '0', '0', '0');?
    78?INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('303', 'run_aging', 'run aging', '1', '1', '80', '0');?
    ?78INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('303', 'run_aging', 'run aging', '0', '1', '80', '0');?
    7979INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('303', 'new', '0', '0', '0', '0', '0');?
    8080INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('303', 'edit', '1', '1', '0', '0', '0');?
  • trunk/phpbms/modules/bms/install/tablesearchablefields.sql

    r385 r485 ?
    11INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', '(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")', ' name', '0', 'whereclause');?
    ?2INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', '(clients.homephone like \"{{value}}%\" or clients.workphone like \"{{value}}%\" or clients.mobilephone like \"{{value}}%\" or clients.otherphone like \"{{value}}%\" or clients.fax like \"{{value}}%\")', 'phone', '1', 'whereclause');?
    ?3INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'addresses.city', 'city', '2', 'field');?
    ?4INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'addresses.state', 'state/province', '3', 'field');?
    ?5INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'addresses.postalcode', 'postal code', '4', 'field');?
    ?6INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'clients.email', 'e-mail', '5', 'field');?
    ?7INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'clients.leadsource', 'lead source', '6', 'field');?
    28INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'clients.id', 'id', '7', 'field');?
    3?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'clients.leadsource', 'lead source', '6', 'field');?
    4?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'clients.email', 'e-mail', '5', 'field');?
    5?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'addresses.postalcode', 'postal code', '4', 'field');?
    6?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'addresses.state', 'state/province', '3', 'field');?
    7?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'addresses.city', 'city', '2', 'field');?
    8?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', '(clients.homephone like \"{{value}}%\" or clients.workphone like \"{{value}}%\" or clients.mobilephone like \"{{value}}%\" or clients.otherphone like \"{{value}}%\" or clients.fax like \"{{value}}%\")', 'phone', '1', 'whereclause');?
    9?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (3,'invoices.orderdate','order date',2,'field');?
    10?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (3,'invoices.invoicedate','invoice date',3,'field');?
    11?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (3,'(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")','company / name',1,'whereclause');?
    12?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (3,'invoices.id','id',0,'field');?
    13?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (4,'products.partnumber','part number',0,'field');?
    14?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (4,'products.partname','part name',1,'field');?
    15?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (4,'products.unitprice','unit price',2,'field');?
    16?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (4,'products.id','id',3,'field');?
    17?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (5,'products.partnumber','part number',0,'field');?
    18?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (5,'lineitems.invoiceid','invoice id',2,'field');?
    19?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (5,'lineitems.id','id',8,'field');?
    20?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (5,'invoices.orderdate','order date',3,'field');?
    21?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (5,'invoices.invoicedate','invoice date',4,'field');?
    22?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (5,'products.partname','part name',1,'field');?
    23?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (6,'tax.name','name',0,'field');?
    24?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (6,'tax.id','id',1,'field');?
    25?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (7,'productcategories.name','name',0,'field');?
    26?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (7,'productcategories.id','id',1,'field');?
    27?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (8,'products.partnumber','part number',0,'field');?
    28?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (8,'products.partname','part name',1,'field');?
    29?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (8,'childproducts.partnumber','dependent part number',2,'field');?
    30?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (8,'childproducts.partname','dependent name',3,'field');?
    31?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (8,'prerequisites.id','id',4,'field');?
    ?9INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('3', 'invoices.orderdate', 'order date', '2', 'field');?
    ?10INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('3', 'invoices.invoicedate', 'invoice date', '3', 'field');?
    ?11INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('3', '(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")', 'company / name', '1', 'whereclause');?
    ?12INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('3', 'invoices.id', 'id', '0', 'field');?
    ?13INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('4', 'products.id', 'id', '3', 'field');?
    ?14INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('4', 'products.unitprice', 'unit price', '2', 'field');?
    ?15INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('4', 'products.partname', 'part name', '1', 'field');?
    ?16INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('4', 'products.partnumber', 'part number', '0', 'field');?
    ?17INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('5', 'products.partname', 'part name', '1', 'field');?
    ?18INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('5', 'invoices.invoicedate', 'invoice date', '4', 'field');?
    ?19INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('5', 'invoices.orderdate', 'order date', '3', 'field');?
    ?20INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('5', 'lineitems.id', 'id', '8', 'field');?
    ?21INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('5', 'lineitems.invoiceid', 'invoice id', '2', 'field');?
    ?22INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('5', 'products.partnumber', 'part number', '0', 'field');?
    ?23INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('6', 'tax.name', 'name', '0', 'field');?
    ?24INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('6', 'tax.id', 'id', '1', 'field');?
    ?25INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('7', 'productcategories.id', 'id', '1', 'field');?
    ?26INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('7', 'productcategories.name', 'name', '0', 'field');?
    ?27INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('8', 'products.partnumber', 'part number', '0', 'field');?
    ?28INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('8', 'products.partname', 'part name', '1', 'field');?
    ?29INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('8', 'childproducts.partnumber', 'dependent part number', '2', 'field');?
    ?30INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('8', 'childproducts.partname', 'dependent name', '3', 'field');?
    ?31INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('8', 'prerequisites.id', 'id', '4', 'field');?
    ?32INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('18', 'clients.id', 'id', '6', 'field');?
    ?33INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('18', 'clients.email', 'e-mail', '5', 'field');?
    ?34INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('18', '(clients.homephone like \"{{value}}%\" or clients.workphone like \"{{value}}%\" or clients.mobilephone like \"{{value}}%\" or clients.otherphone like \"{{value}}%\" or clients.fax like \"{{value}}%\")', 'phone', '1', 'whereclause');?
    3235INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('18', '(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")', 'name', '0', 'whereclause');?
    33?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('18', '(clients.homephone like \"{{value}}%\" or clients.workphone like \"{{value}}%\" or clients.mobilephone like \"{{value}}%\" or clients.otherphone like \"{{value}}%\" or clients.fax like \"{{value}}%\")', 'phone', '1', 'whereclause');?
    34?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('18', 'clients.email', 'e-mail', '5', 'field');?
    35?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('18', 'clients.id', 'id', '6', 'field');?
    36?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (22,'clientemailprojects.name','name',0,'field');?
    37?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (22,'users.firstname like \"{{value}}%\" or users.lastname like \"{{value}}%\"','user',1,'whereclause');?
    38?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (25,'discounts.name','name',0,'field');?
    39?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (300,'shippingmethods.name','name',0,'field');?
    40?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (301,'paymentmethods.name','name',0,'field');?
    41?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (302,'invoicestatuses.name','name',0,'field');?
    42?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (303,'aritems.id','id',4,'field');?
    43?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (303,'aritems.relatedid','invoice id',2,'field');?
    44?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (303,'aritems.amount','amount',3,'field');?
    45?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (303,'(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")','client',1,'whereclause');?
    46?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (304,'receipts.id','id',2,'field');?
    47?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (304,'(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")','client',1,'whereclause');?
    48?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (304,'paymentmethods.name','payment',3,'field');?
    49?INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (304,'receipts.amount','amount',4,'field');?
    ?36INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('22', 'clientemailprojects.name', 'name', '0', 'field');?
    ?37INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('22', 'users.firstname like \"{{value}}%\" or users.lastname like \"{{value}}%\"', 'user', '1', 'whereclause');?
    ?38INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('25', 'discounts.name', 'name', '0', 'field');?
    ?39INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('300', 'shippingmethods.name', 'name', '0', 'field');?
    ?40INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('301', 'paymentmethods.name', 'name', '0', 'field');?
    ?41INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('302', 'invoicestatuses.name', 'name', '0', 'field');?
    ?42INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('303', 'aritems.id', 'id', '4', 'field');?
    ?43INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('303', 'aritems.relatedid', 'invoice id', '2', 'field');?
    ?44INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('303', 'aritems.amount', 'amount', '3', 'field');?
    ?45INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('303', '(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")', 'client', '1', 'whereclause');?
    ?46INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('304', 'receipts.amount', 'amount', '4', 'field');?
    ?47INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('304', 'paymentmethods.name', 'payment', '3', 'field');?
    ?48INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('304', '(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")', 'client', '1', 'whereclause');?
    ?49INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('304', 'receipts.id', 'id', '2', 'field');?
    5050INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('305', 'addresstorecord.id', 'id', '1', 'field');?
    5151INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('306', 'addresses.id', 'id', '1', 'field');?
  • trunk/phpbms/modules/bms/install/update.php

    r419 r485 ?
    3737 +-------------------------------------------------------------------------+?
    3838*/?
    39?error_reporting(E_ALL);?
    40?define("APP_DEBUG",false);?
    41?define("noStartup",true);?
    42??
    43?include("../../../install/install_include.php");?
    44?include("../../../include/session.php");?
    45??
    46?        function doUpdate($db) {?
    47?                $thereturn="Updating Business Management System Module\n";?
    48?                ?
    49?                if(!verifyAdminLogin($db,$_GET["u"],$_GET["p"])){?
    50?                        $thereturn="Update Requires Administrative Access.\n\n";?
    51?                        return $thereturn;?
    52?                }?
    53?                                ?
    54?                $newVersion = $_GET["v"];?
    55?                ?
    56?                $querystatement="SELECT version FROM modules WHERE name=\"bms\"";?
    57?                $queryresult=$db->query($querystatement);?
    58?                if(!$queryresult) {?
    59?                        $thereturn="Error Accessing module table in database.\n\n";?
    60?                        return $thereturn;?
    61?                }?
    62?                ?
    63?                $ver=$db->fetchArray($queryresult);?
    64??
    65?                while($ver["version"] != $newVersion){?
    66?                        switch($ver["version"]){?
    67?                                // ================================================================================================?
    68?                                case "0.5":?
    69?                                        $thereturn.="Updating BMS Module to 0.51\n";?
    70?                ?
    71?                                        //Updating Module Table?
    72?                                        $querystatement="UPDATE modules SET version=\"0.51\" WHERE name=\"bms\";";?
    73?                                        $queryresult=$db->query($querystatement);?
    74?                                        $thereturn.=" - modified bms record in modules table\n";?
    75?                                        ?
    76?                                        $thereturn.="Update to 0.51 Finished\n\n";?
    77?                        ?
    78?                                        $ver["version"]="0.51";?
    79?                                break;?
    80?                                // ================================================================================================?
    81?                                case "0.51":?
    82?                                        $thereturn.="Updating BMS Module to 0.6\n";?
    83?                                                        ?
    84?                                        $thereturn.=processSQLfile($db,"updatev0.6.sql");?
    85?                                        ?
    86?                                        $thereturn.=importData($db,"choices");?
    87?                                        $thereturn.=importData($db,"menu");?
    88?                                        $thereturn.=importData($db,"reports");?
    89?                                        $thereturn.=importData($db,"tablecolumns");?
    90?                                        $thereturn.=importData($db,"tabledefs");?
    91?                                        $thereturn.=importData($db,"tablefindoptions");?
    92?                                        $thereturn.=importData($db,"tableoptions");?
    93?                                        $thereturn.=importData($db,"tablesearchablefields");?
    94??
    95?                                        $querystatement="SELECT clients.id,DATE_FORMAT(clients.creationdate,\"%Y-%m-%d\") as creationdate,max(invoices.orderdate) as orderdate?
    96?                                                                        FROM `clients` LEFT JOIN invoices on clients.id=invoices.clientid ?
    97?                                                                        WHERE clients.type=\"client\" GROUP BY clients.id;";?
    98?                                        $queryresult=$db->query($querystatement);?
    99??
    100?                                        while($therecord=$db->fetchArray($queryresult,$dblink)){?
    101?                                                $querystatement="UPDATE clients set becameclient=\"";?
    102?                                                if($therecord["orderdate"])?
    103?                                                        $querystatement.=$therecord["orderdate"];?
    104?                                                else?
    105?                                                        $querystatement.=$therecord["creationdate"];?
    106?                                                $querystatement.="\" WHERE id=".$therecord["id"];?
    107?                                                $updateresult=$db->query($querystatement);?
    108?                                        }?
    109?                                        $thereturn.=" - set intitial client becamclient field\n";?
    110?                                        ?
    111??
    112?                                        //Updating Module Table?
    113?                                        $querystatement="UPDATE modules SET version=\"0.6\" WHERE name=\"bms\";";?
    114?                                        $updateresult=$db->query($querystatement);?
    115?                                        $thereturn.=" - modified bms record in modules table\n";?
    116??
    117?                                        $thereturn.="Update to 0.6 Finished\n\n";?
    118?                        ?
    119?                                        $ver["version"]="0.6";?
    120?                                break;?
    121?                                // ================================================================================================?
    122?                                case "0.6";?
    123?                                        $thereturn.="Updating BMS Module to 0.601\n";?
    124??
    125?                                        $querystatement="SELECT invoices.id,tax.percentage FROM invoices INNER JOIN tax on invoices.taxareaid=tax.id";?
    126?                                        $queryresult=$db->query($querystatement);?
    127?                                        ?
    128?                                        ?
    129?                                        while($therecord=$db->fetchArray($queryresult)){?
    130?                                                $querystatement="UPDATE invoices SET taxpercentage=".$therecord["percentage"]."WHERE id=".$therecord["id"];?
    131?                                                $updateresult=$db->query($querystatement);?
    132?                                        }?
    133?                                        $thereturn.=" - set taxpercentage on invoices\n";?
    134??
    135?                                        //Updating Module Table?
    136?                                        $querystatement="UPDATE modules SET version=\"0.601\" WHERE name=\"bms\";";?
    137?                                        $updateresult=$db->query($querystatement);?
    138?                                        $thereturn.=" - modified bms record in modules table\n";?
    139??
    140??
    141?                                        $thereturn.="Update to 0.601 Finished\n\n";?
    142?                        ?
    143?                                        $ver["version"]="0.601";?
    144??
    145?                                break;?
    146?                                // ================================================================================================?
    147?                                case "0.601";?
    148?                                        $thereturn.="Updating BMS Module to 0.602\n";?
    149??
    150?                                        //Updating Module Table?
    151?                                        $querystatement="UPDATE modules SET version=\"0.602\" WHERE name=\"bms\";";?
    152?                                        $updateresult=$db->query($querystatement);?
    153?                                        $thereturn.=" - modified bms record in modules table\n";?
    154??
    155?                                        $thereturn.="Update to 0.602 Finished\n\n";?
    156?                        ?
    157?                                        $ver["version"]="0.602";?
    158?                                // ================================================================================================?
    159?                                case "0.602";?
    160?                                        $thereturn.="Updating BMS Module to 0.61\n";?
    161??
    162?                                        $thereturn.=processSQLfile($db,"updatev0.61.sql");?
    163??
    164?                                        //Updating Module Table?
    165?                                        $querystatement="UPDATE modules SET version=\"0.61\" WHERE name=\"bms\";";?
    166?                                        $updateresult=$db->query($querystatement);?
    167?                                        $thereturn.=" - modified bms record in modules table\n";?
    168??
    169?                                        $thereturn.="Update to 0.61 Finished\n\n";?
    170?                        ?
    171?                                        $ver["version"]="0.61";?
    172?                                break;?
    173?                                // ================================================================================================?
    174?                                case "0.61";?
    175?                                        $thereturn.="Updating BMS Module to 0.62\n";?
    176??
    177?                                        //Updating Module Table?
    178?                                        $querystatement="UPDATE modules SET version=\"0.62\" WHERE name=\"bms\";";?
    179?                                        $updateresult=$db->query($querystatement);?
    180?                                        $thereturn.=" - modified bms record in modules table\n";?
    181??
    182?                                        $thereturn.="Update to 0.62 Finished\n\n";?
    183?                        ?
    184?                                        $ver["version"]="0.62";?
    185?                                break;?
    186?                                // ================================================================================================?
    187?                                case "0.62";?
    188?                                        $thereturn.="Updating BMS Module to 0.7\n";?
    189?                                        ?
    190?                                        $thereturn.=processSQLfile($db,"updatev0.70.sql");?
    191?                                        ?
    192?                                        //update to new status system?
    193?                                        $result=updateInvoiceStatus($db);?
    194?                                        if($result===true)?
    195?                                                $thereturn.=" - Updated to new invoice status system\n";?
    196?                                        else?
    197?                                                $thereturn.=" - Failed to updated to new invoice status system\n".$result."\n\n";                                       ?
    198?                                        ?
    199?                                        //Update shipping from invoices?
    200?                                        $result=moveShipping($db);?
    201?                                        if($result===true)?
    202?                                                $thereturn.=" - Created default Shipping Methods\n";?
    203?                                        else?
    204?                                                $thereturn.=" - Failed to create default shipping methods\n".$result."\n\n";?
    205?                                        ?
    206?                                        //update payment From invoices?
    207?                                        $result=movePayments($db);?
    208?                                        if($result===true)?
    209?                                                $thereturn.=" - Created default payment methods\n";?
    210?                                        else?
    211?                                                $thereturn.=" - Failed to create default payment Methods\n".$result."\n\n";?
    212?                                        ?
    213?                                        //Updating Module Table?
    214?                                        $querystatement="UPDATE modules SET version=\"0.7\" WHERE name=\"bms\";";?
    215?                                        $updateresult=$db->query($querystatement);?
    216?                                        $thereturn.=" - Updated bms module record with new version\n";?
    217??
    218?                                        $thereturn.="Update to 0.7 Finished\n\n";?
    219?                        ?
    220?                                        $ver["version"]="0.7";?
    221?                                break;?
    222??
    223?                                // ================================================================================================?
    224?                                case "0.7";?
    225??
    226?                                        $thereturn.= processSQLfile($db,"updatev0.80.sql");?
    227??
    228?                                        //Updating Module Table?
    229?                                        $querystatement="UPDATE modules SET version=\"0.8\" WHERE name=\"bms\";";?
    230?                                        $updateresult=$db->query($querystatement);?
    231??
    232?                                        $thereturn.="Update of Business Management System Module to 0.8 Finished\n\n";?
    233?                                        $ver["version"]="0.8";?
    234?                                break;?
    235??
    236?                                // ================================================================================================?
    237?                                case "0.8";?
    238??
    239?                                        $thereturn.= processSQLfile($db,"updatev0.90.sql");?
    240??
    241?                                        //Updating Module Table?
    242?                                        $querystatement = "?
    243?                                                UPDATE ?
    244?                                                        modules ?
    245?                                                SET ?
    246?                                                        version='0.9' ?
    247?                                                WHERE ?
    248?                                                        name='bms';";?
    249??
    250?                                        $updateresult = $db->query($querystatement);?
    251??
    252?                                        $thereturn .= "Update of Business Management System Module to 0.9 Finished\n\n";?
    253??
    254?                                        $ver["version"] = "0.9";?
    255??
    256?                                        break;?
    257?                                        ?
    258?                                // ================================================================================================?
    259?                                case "0.9";?
    260??
    261?                                        $thereturn.= processSQLfile($db,"updatev0.92.sql");?
    262??
    263?                                        //Updating Module Table?
    264?                                        $updatestatement = "?
    265?                                                UPDATE ?
    266?                                                        modules ?
    267?                                                SET ?
    268?                                                        version='0.92' ?
    269?                                                WHERE ?
    270?                                                        name='bms';";?
    271??
    272?                                        $db->query($updatestatement);?
    273??
    274?                                        $thereturn .= "Update of Business Management System Module to 0.92 Finished\n\n";?
    275??
    276?                                        $ver["version"] = "0.92";?
    277??
    278?                                        break;?
    279??
    280?                                // ================================================================================================?
    281?                                case "0.92";?
    282??
    283?                                        $thereturn.= processSQLfile($db,"updatev0.94.sql");?
    284??
    285?                                        //Updating Module Table?
    286?                                        $updatestatement = "?
    287?                                                UPDATE ?
    288?                                                        modules ?
    289?                                                SET ?
    290?                                                        version='0.94' ?
    291?                                                WHERE ?
    292?                                                        name='bms';";?
    293??
    294?                                        $db->query($updatestatement);?
    295??
    296?                                        $thereturn .= "Update of Business Management System Module to 0.94 Finished\n\n";?
    297??
    298?                                        $ver["version"] = "0.94";?
    299??
    300?                                        break;?
    301??
    302?                                // ================================================================================================?
    303?                                case "0.94";?
    304??
    305?                                        $thereturn.= processSQLfile($db,"updatev0.96.sql");?
    306?                                        ?
    307?                                        if(v096updateInvoiceAddresses($db))?
    308?                                                $thereturn .= "Updating invoice addresses.\n\n";                                        ?
    309??
    310?                                        if(v096transferClientAddresses($db))?
    311?                                                $thereturn .= "Transfer client addresses.\n\n";                                 ?
    312??
    313?                                        //Updating Module Table?
    314?                                        $updatestatement = "?
    315?                                                UPDATE ?
    316?                                                        modules ?
    317?                                                SET ?
    318?                                                        version='0.96' ?
    319?                                                WHERE ?
    320?                                                        name='bms';";?
    321??
    322?                                        $db->query($updatestatement);?
    323??
    324?                                        $thereturn .= "Update of Business Management System Module to 0.96 Finished\n\n";?
    325??
    326?                                        $ver["version"] = "0.96";?
    327??
    328?                                        break;?
    329?                                ?
    330?                                // ================================================================================================?
    331?                                case "0.96";?
    332??
    333?                                        $thereturn.= processSQLfile($db,"updatev0.98.sql");?
    334?                                        ?
    335?                                        //Updating Module Table?
    336?                                        $updatestatement = "?
    337?                                                UPDATE ?
    338?                                                        modules ?
    339?                                                SET ?
    340?                                                        version='0.98' ?
    341?                                                WHERE ?
    342?                                                        name='bms';";?
    343??
    344?                                        $db->query($updatestatement);?
    345??
    346?                                        $thereturn .= "Update of Business Management System Module to 0.98 Finished\n\n";?
    347??
    348?                                        $ver["version"] = "0.98";?
    349??
    350?                                        break;?
    351??
    352?                        }//end switch?
    353?                }//end while?
    354?                return $thereturn;?
    355??
    356?        }//end update?
    357??
    358??
    359?        function moveShipping($db){?
    360?                $querystatement="SELECT DISTINCT shippingmethod FROM invoices WHERE shippingmethod!=\"\" ORDER BY shippingmethod";?
    361?                $queryresult=$db->query($querystatement);?
    362?                ?
    363?                while($therecord=$db->fetchArray($queryresult)){?
    364?                        $querystatement="INSERT INTO `shippingmethods` (name,createdby,creationdate) VALUES (\"".$therecord["shippingmethod"]."\",1,NOW())";?
    365?                        $updatequery=$db->query($querystatement);?
    366?                }?
    367??
    368?                $querystatement="SELECT id,name FROM shippingmethods";?
    369?                $queryresult=$db->query($querystatement);?
    370??
    371?                while($therecord=$db->fetchArray($queryresult)){?
    372?                        $querystatement="UPDATE invoices SET shippingmethodid=".$therecord["id"]."?
    373?                                                        WHERE shippingmethod=\"".$therecord["name"]."\"";?
    374?                        $updatequery=$db->query($querystatement);?
    375?                }?
    376?                $querystatement="ALTER TABLE invoices DROP shippingmethod";?
    377?                $updatequery=$db->query($querystatement);?
    378?                ?
    379?                return true;             ?
    380?        }?
    381??
    382??
    383?        function movePayments($db){?
    384?                $querystatement="SELECT DISTINCT paymentmethod FROM invoices WHERE paymentmethod!=\"\" ORDER BY paymentmethod";?
    385?                $queryresult=$db->query($querystatement);?
    386??
    387?                while($therecord=$db->fetchArray($queryresult)){?
    388?                        switch($therecord["paymentmethod"]){?
    389?                                case "VISA":?
    390?                                case "VISA - Debit": ?
    391?                                case "American Express":?
    392?                                case "Master Card":?
    393?                                case "MasterCard":?
    394?                                case "Discover Card":?
    395?                                        $type="\"charge\"";?
    396?                                break;?
    397?                                ?
    398?                                case "Personal Check":?
    399?                                case "Check":?
    400?                                case "Cashiers Check":?
    401?                                case "check":?
    402?                                        $type="\"draft\"";?
    403?                                break;                          ?
    404?                                ?
    405?                                default:?
    406?                                        $type="NULL";?
    407?                                break;?
    408?                        }?
    409?                        ?
    410?                        $querystatement="INSERT INTO `paymentmethods` (name,`type`,createdby,creationdate) VALUES (\"".$therecord["paymentmethod"]."\",".$type.",1,NOW())";?
    411?                        $updatequery=$db->query($querystatement);?
    412?                }?
    413??
    414?                $querystatement="SELECT id,name FROM paymentmethods";?
    415?                $queryresult=$db->query($querystatement);?
    416?                while($therecord=$db->fetchArray($queryresult)){?
    417?                        $querystatement="UPDATE invoices SET paymentmethodid=".$therecord["id"]."?
    418?                                                        WHERE paymentmethod=\"".$therecord["name"]."\"";?
    419?                        $updatequery=$db->query($querystatement);?
    420?                }?
    421?                $querystatement="ALTER TABLE invoices DROP paymentmethod";?
    422?                $updatequery=$db->query($querystatement);?
    423?                ?
    424?                return true;?
    425?        }?
    426??
    427?        function updateInvoiceStatus($db){?
    428?                $querystatement="SELECT id,status,statusdate,orderdate,invoicedate,type FROM invoices";?
    429?                $queryresult=$db->query($querystatement);?
    430?                ?
    431?                while($therecord=$db->fetchArray($queryresult)){?
    432?                                ?
    433?                        $newstatus=1;                   ?
    434?                        switch($therecord["status"]){?
    435?                                case "Open":?
    436?                                        $newstatus=1;?
    437?                                        $statusdate=$therecord["orderdate"];?
    438?                                break;?
    439?                                case "Committed":?
    440?                                        $newstatus=2;?
    441?                                        $statusdate=$therecord["orderdate"];                                    ?
    442?                                break;?
    443?                                case "Packed":?
    444?                                        $newstatus=3;?
    445?                                        $statusdate=$therecord["orderdate"];                                    ?
    446?                                break;?
    447?                                case "Shipped":?
    448?                                        $newstatus=4;?
    449?                                        if($therecord["statusdate"])?
    450?                                                $statusdate=$therecord["statusdate"];?
    451?                                        elseif($therecord["invoicedate"])?
    452?                                                $statusdate=$therecord["invoicedate"];?
    453?                                        else?
    454?                                                $statusdate=$therecord["orderdate"];?
    455?                                break;?
    456?                        }//end switch                   ?
    457??
    458?                        if($therecord["type"]=="Invoice")?
    459?                                $statusdate=$therecord["invoicedate"];?
    460?                        ?
    461?                        $querystatement="UPDATE invoices SET statusid=".$newstatus.", statusdate=\"".$statusdate."\" WHERE id=".$therecord["id"];?
    462?                        $updatequery=$db->query($querystatement);?
    463??
    464?                        //now create the history?
    465?                        $querystatement="INSERT INTO invoicestatushistory (invoiceid,invoicestatusid,statusdate)VALUES(".$therecord["id"].",".$newstatus.",\"".$statusdate."\")";?
    466?                        $insertquery=$db->query($querystatement);?
    467?                        ?
    468?                }?
    469?                $querystatement="ALTER TABLE `invoices` DROP COLUMN `status`";?
    470?                $dropcolumnquery=$db->query($querystatement);?
    471?                ?
    472?                return true;?
    473?        }//end funtion?
    474??
    475??
    476?        function v096updateInvoiceAddresses($db){?
    477?        ?
    ?39?
    ?40// Need custom class for upgrade because?
    ?41// some BMS upgrades require more than just?
    ?42// version SQL file processing?
    ?43class updateBMS extends updateModuleAjax{?
    ?44?
    ?45        function updateBMS($db, $phpbmsSession, $moduleName, $pathToModule){?
    ?46?
    ?47                $this->updateModuleAjax($db, $phpbmsSession, $moduleName, $pathToModule);?
    ?48?
    ?49        }//end function init?
    ?50?
    ?51        //override function for custom upgrading?
    ?52        function update(){?
    ?53?
    ?54                if(!$this->db->connect())?
    ?55                        return $this->returnJSON(false, "Could not connect to database ".$this->db->getError());?
    ?56?
    ?57                if(!$this->db->selectSchema())?
    ?58                        return $this->returnJSON(false, "Could not open database schema '".MYSQL_DATABASE."'");?
    ?59?
    ?60                $updater = new installer($this->db);?
    ?61?
    ?62                include("../modules/bms/version.php");?
    ?63                $newVersion = $modules["bms"]["version"];?
    ?64                $currentVersion = $this->currentVersion;?
    ?65?
    ?66                //next we loop through each upgrade process?
    ?67                while($currentVersion != $newVersion){?
    ?68?
    ?69                        switch($currentVersion){?
    ?70?
    ?71                                // ================================================================================================?
    ?72                                case 0.8:?
    ?73?
    ?74                                        $version = 0.9;?
    ?75                                        //Processing Data Structure Changes?
    ?76                                        $thereturn = $updater->processSQLfile("../modules/bms/install/updatev".$version.".sql");?
    ?77                                        if($thereturn !== true)?
    ?78                                                return $this->returnJSON(false, $thereturn);?
    ?79?
    ?80                                        //Updating Module Table?
    ?81                                        $thereturn = $this->updateModuleVersion("bms", $version);?
    ?82                                        if($thereturn !== true)?
    ?83                                                return $this->returnJSON(false, $thereturn);?
    ?84?
    ?85                                        $currentVersion = $version;?
    ?86?
    ?87                                        break;?
    ?88?
    ?89                                // ================================================================================================?
    ?90                                case 0.9:?
    ?91?
    ?92                                        $version = 0.92;?
    ?93                                        //Processing Data Structure Changes?
    ?94                                        $thereturn = $updater->processSQLfile("../modules/bms/install/updatev".$version.".sql");?
    ?95                                        if($thereturn !== true)?
    ?96                                                return $this->returnJSON(false, $thereturn);?
    ?97?
    ?98                                        //Updating Module Table?
    ?99                                        $thereturn = $this->updateModuleVersion("bms", $version);?
    ?100                                        if($thereturn !== true)?
    ?101                                                return $this->returnJSON(false, $thereturn);?
    ?102?
    ?103                                        $currentVersion = $version;?
    ?104?
    ?105                                        break;?
    ?106?
    ?107                                // ================================================================================================?
    ?108                                case 0.92:?
    ?109?
    ?110                                        $version = 0.94;?
    ?111                                        //Processing Data Structure Changes?
    ?112                                        $thereturn = $updater->processSQLfile("../modules/bms/install/updatev".$version.".sql");?
    ?113                                        if($thereturn !== true)?
    ?114                                                return $this->returnJSON(false, $thereturn);?
    ?115?
    ?116                                        //Updating Module Table?
    ?117                                        $thereturn = $this->updateModuleVersion("bms", $version);?
    ?118                                        if($thereturn !== true)?
    ?119                                                return $this->returnJSON(false, $thereturn);?
    ?120?
    ?121                                        $currentVersion = $version;?
    ?122?
    ?123                                        break;?
    ?124?
    ?125                                // ================================================================================================?
    ?126                                case 0.94:?
    ?127?
    ?128                                        $version = 0.96;?
    ?129                                        //Processing Data Structure Changes?
    ?130                                        $thereturn = $updater->processSQLfile("../modules/bms/install/updatev".$version.".sql");?
    ?131                                        if($thereturn !== true)?
    ?132                                                return $this->returnJSON(false, $thereturn);?
    ?133?
    ?134                                        if(!$this->v096updateInvoiceAddresses())?
    ?135                                                return $this->returnJSON(false, "v0.96 Invoice Addresses Movement Failed");?
    ?136?
    ?137                                        if(!$this->v096transferClientAddresses())?
    ?138                                                return $this->returnJSON(false, "v0.96 Client Addresses Movement Failed");?
    ?139?
    ?140                                        //Updating Module Table?
    ?141                                        $thereturn = $this->updateModuleVersion("bms", $version);?
    ?142                                        if($thereturn !== true)?
    ?143                                                return $this->returnJSON(false, $thereturn);?
    ?144?
    ?145                                        $currentVersion = $version;?
    ?146?
    ?147                                        break;?
    ?148?
    ?149                                // ================================================================================================?
    ?150                                case 0.96:?
    ?151?
    ?152                                        $version = 0.98;?
    ?153                                        //Processing Data Structure Changes?
    ?154                                        $thereturn = $updater->processSQLfile("../modules/bms/install/updatev".$version.".sql");?
    ?155                                        if($thereturn !== true)?
    ?156                                                return $this->returnJSON(false, $thereturn);?
    ?157?
    ?158                                        //Updating Module Table?
    ?159                                        $thereturn = $this->updateModuleVersion("bms", $version);?
    ?160                                        if($thereturn !== true)?
    ?161                                                return $this->returnJSON(false, $thereturn);?
    ?162?
    ?163                                        $currentVersion = $version;?
    ?164?
    ?165                                        break;?
    ?166?
    ?167                        }//endswitch currentVersion?
    ?168?
    ?169                }//endwhile currentversion/newversion?
    ?170?
    ?171?
    ?172                return $this->returnJSON(true, "Module '".$this->moduleName."' Updated");?
    ?173?
    ?174        }//end function update?
    ?175?
    ?176?
    ?177//==== v0.96 Specific Function =================================================?
    ?178?
    ?179        function v096updateInvoiceAddresses(){?
    ?180?
    478181                $querystatement = "?
    479182                        SELECT?
    ? ? ?
    487190                        FROM?
    488191                                invoices INNER JOIN clients ON invoices.clientid = clients.id";?
    489?                                ?
    490?                $queryresult = $db->query($querystatement);?
    491?                ?
    492?                while($therecord = $db->fetchArray($queryresult)){?
    493?                ?
    ?192?
    ?193                $queryresult = $this->db->query($querystatement);?
    ?194?
    ?195                while($therecord = $this->db->fetchArray($queryresult)){?
    ?196?
    494197                        $updatestatement = "?
    495198                                UPDATE?
    ? ? ?
    511214                                        id = ".$therecord["id"];?
    512215?
    513?                                $db->query($updatestatement);?
    514?                ?
    ?216                                $this->db->query($updatestatement);?
    ?217?
    515218                }//endwhile - record?
    516?        ?
    ?219?
    517220                return true;?
    518?        ?
    ?221?
    519222        }//end function - v096updateInvoiceAddresses?
    520223?
    521224?
    522?        function v096transferClientAddresses($db){?
    523?        ?
    ?225        function v096transferClientAddresses(){?
    ?226?
    524227                //retrieve all client records with ship to addresses?
    525228                $querystatement = "?
    ? ? ?
    540243                        FROM?
    541244                                clients";?
    542?                ?
    543?                $queryresult = $db->query($querystatement);?
    544?                ?
    545?                while($therecord = $db->fetchArray($queryresult)){?
    546?                ?
    ?245?
    ?246                $queryresult = $this->db->query($querystatement);?
    ?247?
    ?248                while($therecord = $this->db->fetchArray($queryresult)){?
    ?249?
    547250                        // for each client with a ship to, we need to create?
    548251                        // an address record (and addresstorecord record)?
    549?                        ?
    ?252?
    550253                        // Create the address record?
    551254                        $address["title"] = "Primary";?
    ? ? ?
    556259                        $address["postalcode"] = $therecord["postalcode"];?
    557260                        $address["country"] = $therecord["country"];?
    558?                        ?
    559?                        $newid = insertAddress($db, $address);                  ?
    560?                        ?
    ?261?
    ?262                        $newid = $this->v096insertAddress($address);?
    ?263?
    561264                        $a2r["clientid"] = $therecord["id"];?
    562265                        $a2r["addressid"] = $newid;?
    563266                        $a2r["primary"] = 1;?
    564?                        ?
    ?267?
    565268                        if($therecord["shiptoaddress1"]){?
    566?                        ?
    ?269?
    567270                                $a2r["defaultshipto"] = 0;?
    568?                                insertA2R($db, $a2r);?
    569?                        ?
    ?271                                $this->v096insertA2R($a2r);?
    ?272?
    570273                                $address["title"] = "Shipping";?
    571274                                $address["address1"] = $therecord["shiptoaddress1"];?
    ? ? ?
    575278                                $address["postalcode"] = $therecord["shiptopostalcode"];?
    576279                                $address["country"] = $therecord["shiptocountry"];?
    577?                                ?
    578?                                $newid = insertAddress($db, $address);                  ?
    579?                                ?
    ?280?
    ?281                                $newid = insertAddress($db, $address);?
    ?282?
    580283                                $a2r["addressid"] = $newid;?
    581284                                $a2r["primary"] = 0;?
    582285                                $a2r["defaultshipto"] = 1;?
    583?                        ?
    ?286?
    584287                        } else {?
    585?                        ?
    ?288?
    586289                                $a2r["defaultshipto"] = 1;?
    587?                                ?
    ?290?
    588291                        }//endif - shiptoaddress1?
    589292?
    590?                        insertA2R($db, $a2r);           ?
    591?                        ?
    ?293                        $this->v096insertA2R($db, $a2r);?
    ?294?
    592295                }//endwhile?
    593?                ?
    ?296?
    594297                //Lastly, we need to remove the shipto fields?
    595298                $alterstatement = "?
    596?                        ALTER TABLE `clients` ?
    ?299                        ALTER TABLE `clients`?
    597300                                DROP COLUMN `address1`,?
    598301                                DROP COLUMN `address2`,?
    ? ? ?
    606309                                DROP COLUMN `shiptostate`,?
    607310                                DROP COLUMN `shiptopostalcode`,?
    608?                                DROP COLUMN `shiptocountry`";   ?
    609??
    610?                $db->query($alterstatement);?
    611?        ?
    ?311                                DROP COLUMN `shiptocountry`";?
    ?312?
    ?313                $this->db->query($alterstatement);?
    ?314?
    612315        }//end function?
    613?        ?
    614?        ?
    615?        function insertA2R($db, $variables){?
    616?        ?
    ?316?
    ?317?
    ?318        function v096insertA2R($variables){?
    ?319?
    617320                // Create the relation record?
    618321                $insertstatement = "?
    ? ? ?
    640343                                NOW()?
    641344                        )";?
    642?                ?
    643?                $db->query($insertstatement);   ?
    644?                        ?
    ?345?
    ?346                $this->db->query($insertstatement);?
    ?347?
    645348        }//end function - insertA2R?
    646?        ?
    647?        ?
    648?        function insertAddress($db, $variables){?
    649?        ?
    ?349?
    ?350?
    ?351        function v096insertAddress($variables){?
    ?352?
    650353                        $insertaddress = "?
    651354                                INSERT INTO?
    652?                                        addresses ?
    ?355                                        addresses?
    653356                                (?
    654357                                        title,?
    ? ? ?
    677380                                )?
    678381                        ";?
    679?                        ?
    680?                        $db->query($insertaddress);?
    681?                        ?
    ?382?
    ?383                        $this->db->query($insertaddress);?
    ?384?
    682385                        //make sure to get the new address id?
    683?                        return $db->insertId();         ?
    684?        ?
    ?386                        return $this->db->insertId();?
    ?387?
    685388        }//end function - insertAddress?
    686?                ?
    687?        ?
    688??
    689??
    690?        //=========================================================?
    691?        // Processor?
    692?        //=========================================================?
    693?        $phpbmsSession = new phpbmsSession;?
    694?        $success = $phpbmsSession->loadDBSettings(false);?
    695??
    696?        include_once("include/db.php");?
    697?        $db = new db(false);?
    698?        $db->stopOnError = false;?
    699?        $db->showError = false;?
    700?        $db->logError = false;?
    701??
    702?        if($success !== false){?
    703?                ?
    704?                if(!$db->connect())?
    705?                        $thereturn = "Could Not Establish Connection To MySQL Server: Check server, user name, and password.";                  ?
    706?                else {?
    707?                        if(!$db->selectSchema())?
    708?                                $thereturn = "Database (schema) ".MYSQL_DATABASE." could not be selected";                      ?
    709?                        else {?
    710??
    711?                                $phpbmsSession->db = $db;?
    712?                                $phpbmsSession->loadSettings();?
    713?                                ?
    714?                                $thereturn=doUpdate($db);       ?
    715??
    716?                        }               ?
    717?                }?
    718?        } else?
    719?                $thereturn = "Could not access settings.php";   ?
    720?                                ?
    721??
    722??
    723?                header('Content-Type: text/xml');?
    724?                ?><?php echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'; ?>?
    725?<response><?php echo $thereturn?></response>?
    ?389?
    ?390}//end class updateBMS?
    ?391?
    ?392// Processor?
    ?393//=========================================================?
    ?394$theModule = new updateBMS($this->db, $this->phpbmsSession, "bms", "../modules/bms/install/");?
  • trunk/phpbms/modules/bms/install/updatev0.98.sql

    r438 r485 ?
    33ALTER TABLE `aritems` ENGINE=INNODB;?
    44ALTER TABLE `clientemailprojects` ENGINE=INNODB;?
    5?ALTER TABLE `clients` ADD COLUMN `taxid` VARCHAR(64) default NULL AFTER `webaddress`;?
    65ALTER TABLE `clients` ENGINE=INNODB;?
    7?INSERT INTO `settings` (`name`, `value`) VALUES ('company_taxid', '');?
    8?UPDATE `tabledefs` SET `deletebutton` = 'inactivate' WHERE `displayname` = 'Tax Areas';?
    96ALTER TABLE `discounts` ENGINE=INNODB;?
    107ALTER TABLE `attachments` ENGINE=INNODB;?
    ? ? ?
    2017ALTER TABLE `receipts` ENGINE=INNODB;?
    2118ALTER TABLE `shippingmethods` ENGINE=INNODB;?
    ?19ALTER TABLE `clients` ADD COLUMN `taxid` VARCHAR(64) default NULL AFTER `webaddress`;?
    ?20ALTER TABLE `receipts` MODIFY COLUMN `paymentmethodid` INTEGER NOT NULL DEFAULT 0;?
    2221INSERT INTO `settings` (`name`, `value`) VALUES ('company_taxid', '');?
    2322UPDATE `tabledefs` SET `deletebutton` = 'inactivate' WHERE `id` IN (6, 7);?
    2423UPDATE `tabledefs` SET `importfile` = 'modules/bms/clients_import.php' WHERE `id` = 2;?
    25?UPDATE `tabledefs` SET `importfile` = 'modules/bms/products_import.php' WHERE `id` = 4;?
    2624UPDATE `tabledefs` SET `defaultcriteriafindoptions` = 'Active Records', `defaultcriteriaselection` = 'name' WHERE `id` = 25;?
    ?25UPDATE `tabledefs` SET `deletebutton` = 'inactivate' WHERE `displayname` = 'Tax Areas';?
    2726INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'import', '1', '0', '0', '-100', '0');?
    2827INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('3', 'import', '0', '0', '0', '-100', '0');?
    ? ? ?
    4342INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('306', 'import', '0', '0', '0', '-100', '0');?
    4443UPDATE `tableoptions` SET `needselect` = 0 WHERE `tabledefid` = 2 AND `name` = 'massEmail';?
    ?44UPDATE `tableoptions` SET `needselect` = 0 WHERE `tabledefid` = 303 AND `name` = 'run_aging';?
    4545INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('25', 'Active Records', 'discounts.inactive=0', '0', '0');?
    4646UPDATE `tablefindoptions` SET `displayorder` = 0 WHERE `tabledefid` = 25 AND `name` = 'all records';?
    4747UPDATE `tablefindoptions` SET `search`= 'clients.firstname=dclients.firstname AND clients.lastname=dclients.lastname AND addresses.postalcode = daddresses.postalcode AND clients.lastname != \'\' AND clients.firstname != \'\' AND addresses.postalcode != \'\' AND clients.id<>dclients.ID' WHERE `name` = 'match names and postal code' AND `tabledefid` = '18';?
    4848UPDATE `tablefindoptions` SET `search`= 'addresses.address1=daddresses.address1 AND clients.id<>dclients.id' WHERE `name` = 'match addresses' AND `tabledefid` = '18';?
    49?ALTER TABLE `receipts` MODIFY COLUMN `paymentmethodid` INTEGER NOT NULL DEFAULT 0;?
    50?UPDATE `tablecolumns` SET `column`='IF(receipts.paymentmethodid = '-1',concat( concat("Other... (", receipts.paymentother), ")"), paymentmethods.name)' WHERE `tabledefid` = '304' AND `name` = 'payment';?
    ?49UPDATE `tablecolumns` SET `column`='IF(receipts.paymentmethodid = -1,concat( concat("Other... (", receipts.paymentother), ")"), paymentmethods.name)' WHERE `tabledefid` = '304' AND `name` = 'payment';?
    ?50INSERT INTO `reports` (`name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('Incoming Cash Flow', 'report', '3', '55', '50', 'modules/bms/report/incoming_cashflow.php', 'This report shows total incoming monies for a time period from both posted sales orders AND posted receipts. It can be grouped by week, month, quarter and year.\r\n\r\nThis report runs is unaffected by selected records, search or sort parameters.  It requires input of it\'s own start and end dates.', 1, NOW(), 1, NOW());?
  • trunk/phpbms/modules/bms/invoices_attachments.php

    r285 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev$ | $LastChangedBy$?
    ? ? ?
    3939?
    4040        include("../../include/session.php");?
    41?        ?
    ?41?
    4242?
    4343        require_once("../../include/search_class.php");?
    44?                ?
    ?44?
    4545?
    4646        //set the table passing stuff?
    ? ? ?
    4949        $refid=(integer) $_GET["id"];?
    5050        $securitywhere="";?
    51?        if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0)               ?
    52?                $securitywhere=" AND files.roleid IN (".implode(",",$_SESSION["userinfo"]["roles"]).",0)";      ?
    ?51        if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0)?
    ?52                $securitywhere=" AND files.roleid IN (".implode(",",$_SESSION["userinfo"]["roles"]).",0)";?
    5353        $whereclause="attachments.tabledefid=".$tabledefid." AND attachments.recordid=".$refid.$securitywhere;?
    5454        $backurl="../bms/invoices_attachments.php";?
    ? ? ?
    6060?
    6161        $refquery="SELECT?
    62?                           invoices.id, if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company) as name ?
    63?                           FROM invoices INNER JOIN clients ON invoices.clientid=clients.id ?
    ?62                           invoices.id, if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company) as name?
    ?63                           FROM invoices INNER JOIN clients ON invoices.clientid=clients.id?
    6464                           WHERE invoices.id=".$refid;?
    6565        $refquery=$db->query($refquery);?
    66?        $refrecord=$db->fetchArray($refquery);  ?
    67?        ?
    68?        $pageTitle="Attachments: ".$refrecord["id"].", ".$refrecord["name"];?
    ?66        $refrecord=$db->fetchArray($refquery);?
    ?67?
    ?68        $pageTitle="Attachments: ".$refrecord["id"];?
    ?69        if($refrecord["name"] !== "")?
    ?70                $pageTitle .= ", ".$refrecord["name"];?
    6971?
    7072        $tabgroup="invoices entry";?
    7173        $selectedtabid=17;?
    72?        ?
    ?74?
    7375        include("../base/attachments_records.php");?
    74?        ?
    ?76?
    7577?>?
  • trunk/phpbms/modules/bms/invoices_notes.php

    r285 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev$ | $LastChangedBy$?
    ? ? ?
    3939?
    4040        include("../../include/session.php");?
    41?        ?
    ?41?
    4242?
    4343        require_once("../../include/search_class.php");?
    44?                ?
    ?44?
    4545?
    4646        //set the table passing stuff?
    ? ? ?
    5353?
    5454        $refquery="SELECT?
    55?                           invoices.id, if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company) as name ?
    56?                           FROM invoices INNER JOIN clients ON invoices.clientid=clients.id ?
    ?55                           invoices.id, if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company) as name?
    ?56                           FROM invoices INNER JOIN clients ON invoices.clientid=clients.id?
    5757                           WHERE invoices.id=".$refid;?
    5858        $refquery=$db->query($refquery);?
    59?        $refrecord=$db->fetchArray($refquery);  ?
    60?        ?
    61?        $pageTitle="Notes/Tasks/Events: ".$refrecord["id"].", ".$refrecord["name"];?
    ?59        $refrecord=$db->fetchArray($refquery);?
    ?60?
    ?61        $pageTitle="Notes/Tasks/Events: ".$refrecord["id"];?
    ?62        if($refrecord["name"] !== "")?
    ?63                $pageTitle .= ", ".$refrecord["name"];?
    6264?
    6365        $tabgroup="invoices entry";?
    6466        $selectedtabid=18;?
    65?        ?
    ?67?
    6668        include("../base/notes_records.php");?
    6769        //===================================================================================?
    6870        //==  THAT's IT                                                                    ==?
    6971        //===================================================================================?
    70?        ?
    ?72?
    7173?>?
  • trunk/phpbms/modules/bms/javascript/aritem_aging.js

    r311 r485 ?
    11aging = {?
    2?        ?
    ?2?
    33        submitForm: function(e){?
    4?                ?
    ?4?
    55                var thebutton = e.src();?
    66                var theform = getObjectFromID("record");?
    7?                ?
    ?7?
    88                var command = getObjectFromID("command");?
    9?                ?
    ?9?
    1010                if(thebutton.id == "runButton"){?
    11?                        ?
    ?11?
    1212                        if(!validateForm(theform))?
    1313                                return false;?
    1414?
    1515                        command.value = "run";?
    16?                        ?
    ?16?
    1717                } else?
    1818                        command.value = "cancel";?
    1919?
    2020                theform.submit();?
    21?                ?
    ?21?
    ?22                return true;?
    ?23?
    2224        }//end method?
    23?        ?
    ?25?
    2426}//end class?
    2527?
    ? ? ?
    2931?
    3032connect(window,"onload",function() {?
    31?                                                                        ?
    ?33?
    3234        var runButton = getObjectFromID("runButton");?
    3335        if(runButton)?
    3436                connect(runButton, "onclick", aging.submitForm);?
    35?        ?
    ?37?
    3638        var cancelButton = getObjectFromID("cancelButton");?
    3739        if(cancelButton)?
    3840                connect(cancelButton, "onclick", aging.submitForm);?
    39?                ?
    ?41?
    4042        var printStatements = getObjectFromID("printClientStatements");?
    4143        if(printStatements){?
    4244?
    4345                var theURL;?
    44?                var printSummary = getObjectFromID("printSummary");             ?
    ?46                var printSummary = getObjectFromID("printSummary");?
    4547                var agingdate = getObjectFromID("agingdate")?
    46?                ?
    ?48?
    4749                var ts = new Date();?
    4850                ts = ts.getTime();?
    49?                ?
    ?51?
    5052                if(printStatements.value == 1){?
    51?                        ?
    ?53?
    5254                        theURL = APP_PATH+"modules/bms/report/aritems_clientstatement.php?cmd=print&sd="+encodeURIComponent(agingdate.value)+"&ts="+ts+"&ext=.pdf";?
    5355                        window.open(theURL, 'phpBMSprint1');?
    54?                        ?
    ?56?
    5557                }//endif?
    56?                ?
    ?58?
    5759                if(printSummary.value == 1){?
    58?                        ?
    ?60?
    5961                        theURL = APP_PATH+"modules/bms/report/aritems_summary.php?cmd=print&sd="+encodeURIComponent(agingdate.value)+"&ts="+ts;?
    6062                        window.open(theURL, 'phpBMSprint2');?
    61?                        ?
    ?63?
    6264                }//endif?
    63?                ?
    ?65?
    6466        }//end if?
    65?        ?
    ?67?
    6668})?
  • trunk/phpbms/modules/bms/javascript/totalreports.js

    r373 r485 ?
    3838?
    3939report = {?
    40?    ?
    ?40?
    4141    cancel: function(){?
    42?        ?
    ?42?
    4343        window.close();?
    44?        ?
    45?    },//endmethod?
    46?    ?
    ?44?
    ?45    },//endmethod?
    ?46?
    4747    validateForm: function (){?
    48?        ?
    ?48?
    4949        if(report.prepareGroupings() && report.prepareColumns()){?
    50?            ?
    ?50?
    5151            var theForm = getObjectFromID("GroupForm");?
    5252            theForm.submit();?
    53?            ?
    ?53?
    5454        }else{?
    55?            ?
    ?55?
    5656            alert("Make sure you have selected unique groups and columns for each line.");?
    57?            ?
    ?57?
    5858        }?
    59?        ?
    60?    },//endmethod?
    61?    ?
    ?59?
    ?60    },//endmethod?
    ?61?
    6262    prepareGroupings: function (){?
    63?        ?
    ?63?
    6464        var groupArray = new Array();?
    65?        ?
    ?65?
    6666        for(var i=0; i<GroupParams.length; i++){?
    67?            ?
    ?67?
    6868            var groupField = getObjectFromID("Group"+GroupParams[i]+"Field");?
    6969            if(groupField.value == "0"){?
    70?                ?
    71?                ?
    ?70?
    ?71?
    7272            }else{?
    73?                ?
    ?73?
    7474                for(var j=0; j<groupArray.length; j++){?
    75?                    ?
    ?75?
    7676                    if(groupField.value == groupArray[j]+1){?
    77?                        ?
    ?77?
    7878                        return false;?
    79?                        ?
    ?79?
    8080                    }//endif?
    81?                    ?
    ?81?
    8282                }//endfor?
    83?                ?
    ?83?
    8484                groupArray[groupArray.length] = groupField.value-1;?
    85?                ?
    ?85?
    8686            }//endif?
    87?            ?
    88?        }//endfor?
    89?        ?
    ?87?
    ?88        }//endfor?
    ?89?
    9090        var hiddenGroupings = getObjectFromID("groupings");?
    9191        hiddenGroupings.value = groupArray.join("::");?
    92?        ?
    93?        return true;?
    94?        ?
    95?    },//endmethod?
    96?    ?
    ?92?
    ?93        return true;?
    ?94?
    ?95    },//endmethod?
    ?96?
    9797    prepareColumns: function (){?
    98?        ?
    ?98?
    9999        var columnArray = new Array();?
    100?        ?
    ?100?
    101101        for(var i=0; i<ColumnParams.length; i++){?
    102?            ?
    ?102?
    103103            var columnField = getObjectFromID("Column"+ColumnParams[i]+"Field");?
    104?            ?
    ?104?
    105105            if(columnField.value == "0"){?
    106?                ?
    ?106?
    107107                return false;?
    108?                ?
    ?108?
    109109            }else{?
    110?                ?
    ?110?
    111111                for(var j=0; j<columnArray.length; j++){?
    112?                    ?
    ?112?
    113113                    if(columnField.value == columnArray[j]+1){?
    114?                        ?
    ?114?
    115115                        return false;?
    116?                        ?
    ?116?
    117117                    }//endif?
    118?                    ?
    ?118?
    119119                }//endfor?
    120?                ?
    ?120?
    121121                columnArray[columnArray.length] = columnField.value-1;?
    122?                ?
    ?122?
    123123            }//endif?
    124?            ?
    125?        }//endfor?
    126?        ?
    ?124?
    ?125        }//endfor?
    ?126?
    127127        var hiddenColumns = getObjectFromID("columns");?
    128128        hiddenColumns.value = columnArray.join("::");?
    129?        ?
    130?        return true;?
    131?        ?
    ?129?
    ?130        return true;?
    ?131?
    132132    },//endmethod?
    133133?
    134134    groupAddLine: function (){?
    135?        ?
    ?135?
    136136        var tempMinus = getObjectFromID("Group"+GroupParams[0]+"Minus");?
    137137        if(tempMinus.className == "graphicButtons buttonMinusDisabled")?
    ? ? ?
    143143        var newid = "Group"+(GroupParams[GroupParams.length-1]+1)?
    144144        tempContent = tempContent.replace(REcriteria, newid);?
    145?        ?
    ?145?
    146146        var newDiv = document.createElement("div");?
    147147        newDiv.id = newid;?
    148148        newDiv.innerHTML = tempContent;?
    149?        ?
    ?149?
    150150        var containerDiv = getObjectFromID("theGroups");?
    151151        containerDiv.appendChild(newDiv);?
    152?        ?
    ?152?
    153153        GroupParams[GroupParams.length] = GroupParams[GroupParams.length-1]+1;?
    154?        ?
    155?        ?
    ?154?
    ?155?
    156156        var newPlusButton = getObjectFromID(newid+"Plus");?
    157157        connect(newPlusButton, "onclick", report.groupAddLine);?
    158?        ?
    ?158?
    159159        var newMinusButton = getObjectFromID(newid+"Minus");?
    160160        connect(newMinusButton, "onclick", report.groupRemoveLine);?
    161?        ?
    162?        ?
    163?    },//endmethod?
    164?    ?
    ?161?
    ?162?
    ?163    },//endmethod?
    ?164?
    165165    groupRemoveLine: function (e){?
    166?        ?
    ?166?
    167167        var thebutton = e.src();?
    168?        ?
    ?168?
    169169        if(thebutton.className=="graphicButtons buttonMinusDisabled")?
    170170        return false;?
    171?        ?
    ?171?
    172172        var theDiv = thebutton.parentNode;?
    173?                ?
    ?173?
    174174        var containerDiv = getObjectFromID("theGroups");?
    175175        containerDiv.removeChild(theDiv);?
    176176        var theid = theDiv.id.replace(/Group/g,"");?
    177177        theDiv=null;?
    178?        ?
    ?178?
    179179        for(var i=0;i<GroupParams.length;i++){?
    180?            ?
    ?180?
    181181            if(GroupParams[i]==theid){?
    182?                ?
    ?182?
    183183                GroupParams.splice(i,1);?
    184184                break;?
    185?                ?
    ?185?
    186186            }//endif?
    187?            ?
    188?        }//endfor?
    189?        ?
    ?187?
    ?188        }//endfor?
    ?189?
    190190        if(GroupParams.length==1){?
    191?            ?
    ?191?
    192192            var tempButton = getObjectFromID("Group"+GroupParams[0]+"Minus");?
    193193            tempButton.className="graphicButtons buttonMinusDisabled"?
    194?            ?
    ?194?
    195195        }//endif?
    196?        ?
    197?    },//endmethod?
    198?    ?
    ?196?
    ?197        return true;?
    ?198?
    ?199    },//endmethod?
    ?200?
    199201    columnAddLine: function (){?
    200?        ?
    ?202?
    201203        var tempMinus = getObjectFromID("Column"+ColumnParams[0]+"Minus");?
    202204        if(tempMinus.className == "graphicButtons buttonMinusDisabled")?
    ? ? ?
    207209        var REcriteria = new RegExp("Column"+ColumnParams[0],"g");?
    208210        var newid = "Column"+(ColumnParams[ColumnParams.length-1]+1)?
    209?        ?
    ?211?
    210212        tempContent = tempContent.replace(REcriteria, newid);?
    211?        ?
    ?213?
    212214        var newDiv = document.createElement("div");?
    213215        newDiv.id = newid;?
    214216        newDiv.innerHTML = tempContent;?
    215?        ?
    ?217?
    216218        var containerDiv = getObjectFromID("theColumns");?
    217219        containerDiv.appendChild(newDiv);?
    218?        ?
    ?220?
    219221        ColumnParams[ColumnParams.length] = ColumnParams[ColumnParams.length-1]+1;?
    220?        ?
    221?        ?
    ?222?
    ?223?
    222224        var newPlusButton = getObjectFromID(newid+"Plus");?
    223225        connect(newPlusButton, "onclick", report.columnAddLine);?
    224?        ?
    ?226?
    225227        var newMinusButton = getObjectFromID(newid+"Minus");?
    226228        connect(newMinusButton, "onclick", report.columnRemoveLine);?
    227?        ?
    228?        ?
    229?    },//endmethod?
    230?    ?
    ?229?
    ?230?
    ?231    },//endmethod?
    ?232?
    231233    columnRemoveLine: function (e){?
    232?        ?
    ?234?
    233235        var thebutton = e.src();?
    234?        ?
    ?236?
    235237        if(thebutton.className=="graphicButtons buttonMinusDisabled")?
    236238        return false;?
    237?        ?
    ?239?
    238240        var theDiv = thebutton.parentNode;?
    239?                ?
    ?241?
    240242        var containerDiv = getObjectFromID("theColumns");?
    241243        containerDiv.removeChild(theDiv);?
    242244        var theid = theDiv.id.replace(/Column/g,"");?
    243245        theDiv=null;?
    244?        ?
    ?246?
    245247        for(var i=0;i<ColumnParams.length;i++){?
    246?            ?
    ?248?
    247249            if(ColumnParams[i] == theid){?
    248?                ?
    ?250?
    249251                ColumnParams.splice(i,1);?
    250252                break;?
    251?                ?
    ?253?
    252254            }//endif?
    253?            ?
    254?        }//endfor?
    255?        ?
    ?255?
    ?256        }//endfor?
    ?257?
    256258        if(ColumnParams.length == 1){?
    257?            ?
    ?259?
    258260            var tempButton = getObjectFromID("Column"+ColumnParams[0]+"Minus");?
    259261            tempButton.className="graphicButtons buttonMinusDisabled"?
    260?            ?
    ?262?
    261263        }//endif?
    262?        ?
    ?264?
    ?265        return true;?
    ?266?
    263267    }//endmethod?
    264?    ?
    ?268?
    265269}//end class?
    266270?
    ? ? ?
    269273?
    270274connect(window,"onload",function() {?
    271?        ?
    ?275?
    272276    GroupParams = [1];?
    273277    ColumnParams = [1];?
    274?    ?
    ?278?
    275279    var plusGroupButton = getObjectFromID("Group1Plus");?
    276280    connect(plusGroupButton, "onclick", report.groupAddLine);?
    277?        ?
    ?281?
    278282    var minusGroupButton = getObjectFromID("Group1Minus");?
    279283    connect(minusGroupButton, "onclick", report.groupRemoveLine);?
    280?    ?
    ?284?
    281285    var plusColumnButton = getObjectFromID("Column1Plus");?
    282286    connect(plusColumnButton, "onclick", report.columnAddLine);?
    283?        ?
    ?287?
    284288    var minusColumnButton = getObjectFromID("Column1Minus");?
    285289    connect(minusColumnButton, "onclick", report.columnRemoveLine);?
    286?    ?
    ?290?
    287291    var printButton = getObjectFromID("print");?
    288292    connect(printButton, "onclick", report.validateForm);?
    289?    ?
    ?293?
    290294    var cancelButton = getObjectFromID("cancel");?
    291295    connect(cancelButton, "onclick", report.cancel);?
  • trunk/phpbms/modules/recurringinvoices/install/install.php

    r317 r485 ?
    3737 +-------------------------------------------------------------------------+?
    3838*/?
    39?error_reporting(E_ALL);?
    40?define("APP_DEBUG",false);?
    41?define("noStartup",true);?
    42?include("../../../install/install_include.php");?
    43?include("../../../include/session.php");?
    44??
    45?        $phpbmsSession = new phpbmsSession;?
    46?        $success = $phpbmsSession->loadDBSettings(false);?
    47?        include_once("include/db.php");?
    48?        $db = new db(false);?
    49?        $db->stopOnError = false;?
    50?        $db->showError = false;?
    51?        $db->logError = false;?
    52??
    53?        if($success !== false){?
    54?                ?
    55?                if(!$db->connect())?
    56?                        $thereturn = "Could Not Establish Connection To MySQL Server: Check server, user name, and password.";                  ?
    57?                else {?
    58?                        if(!$db->selectSchema())?
    59?                                $thereturn = "Database (schema) ".MYSQL_DATABASE." could not be selected";                      ?
    60?                        else {?
    61??
    62??
    63?                                // ENTER YOUR MODULE NAME HERE?
    64?                                $thereturn  = "Recurring Invoice Installation\n";?
    65?                                $thereturn .= "______________________________\n";?
    66?                                ?
    67?                                //MAKE SURE THERE IS A createtables.sql FILE?
    68?                                //which houses all your SQL create statements?
    69?                                // for any tables you will create.?
    70?                                $tempreturn = createTables($db,"createtables.sql");?
    71?                                ?
    72?                                if($tempreturn === true){?
    73?                                        ?
    74?                                        $thereturn.= "Done Creating Tables \n";?
    75?                                        ?
    76?                                        ?
    77?                                        // NEXT, DEFINE AN ARRAY OF TABLE NAMES?
    78?                                        // for any tables that need initial data populated. (including existing tables)?
    79?                                        // for each table, make sure there?
    80?                                        // is a corresponding SQL file?
    81?                                        // with insert statements for all the records needing to be imported?
    82?                                        ?
    83?                                        /*?
    84?                                                Need to add entries for tabledefs, tablecolumns, tablefindoptions, tableoptions, and?
    85?                                                tablesearchablefields?
    86?                                        */?
    87?                                        $tables = array(?
    88?                                                "menu",?
    89?                                                "modules",?
    90?                                                "roles",?
    91?                                                "scheduler",?
    92?                                                "tabledefs",?
    93?                                                "tablecolumns",?
    94?                                                "tableoptions",?
    95?                                                "tablefindoptions",?
    96?                                                "tablesearchablefields",?
    97?                                                "tabs",?
    98?                                                "users",?
    99?                                        );?
    100?                                        foreach($tables as $table){?
    101?                                                ?
    102?                                                $failure = false;?
    103?                                                $tempreturn = importData($db,$table);?
    104?                                                $thereturn .= $tempreturn;?
    105?                                                if(!strpos($tempreturn,"complete.") === false){?
    106?                                                        $failed = true;?
    107?                                                }?
    108?                                                ?
    109?                                        }//end foreach?
    110?                                        ?
    111?                                        ?
    112?                                        //MAKE SURE TO set the done message for your module.?
    113?                                        if(!$failure){?
    114?                                                $thereturn .= "______________________________________\n";                       ?
    115?                                                $thereturn .= "Done Installing Recurring Invoice Data\n";?
    116?                                        }?
    117?                                } else?
    118?                                        $thereturn = $tempreturn;                               ?
    119?                        }               ?
    120?                }?
    121?        } else?
    122?                $thereturn = "Could not access settings.php";?
    123?                ?
    124?                ?
    125?                header('Content-Type: text/xml');?
    126?                ?><?php echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'; ?>?
    127?<response><?php echo $thereturn?></response>?
    ?39$theModule = new installModuleAjax($this->db, $this->phpbmsSession, "../modules/recurringinvoices/install/");?
    ?40$theModule->tables = array(?
    ?41                        "menu",?
    ?42                        "modules",?
    ?43                        "roles",?
    ?44                        "scheduler",?
    ?45                        "tabledefs",?
    ?46                        "tablecolumns",?
    ?47                        "tableoptions",?
    ?48                        "tablefindoptions",?
    ?49                        "tablesearchablefields",?
    ?50                        "tabs",?
    ?51                        "users",?
    ?52                        );?
  • trunk/phpbms/modules/recurringinvoices/install/update.php

    r427 r485 ?
    3737 +-------------------------------------------------------------------------+?
    3838*/?
    39?error_reporting(E_ALL);?
    40?define("APP_DEBUG",false);?
    41?define("noStartup",true);?
    42??
    43?include("../../../install/install_include.php");?
    44?include("../../../include/session.php");?
    45??
    46?        function doUpdate($db) {?
    47?        ?
    48?                $module = array(?
    49?                        "title" => "Recurring Invoices",?
    50?                        "name" => "recurringinvoices"?
    51?                );?
    52?        ?
    53?                $thereturn="Updating ".$module["title"]." Module\n";?
    54?                ?
    55?                if(!verifyAdminLogin($db,$_GET["u"],$_GET["p"])){?
    56?                ?
    57?                        $thereturn="Update Requires Administrative Access.\n\n";?
    58?                        return $thereturn;?
    59?                        ?
    60?                }//end if?
    61?                                ?
    62?                $newVersion = $_GET["v"];?
    63?                ?
    64?                $querystatement="SELECT version FROM modules WHERE name = '".$module["name"]."'";?
    65?                $queryresult=$db->query($querystatement);?
    66??
    67?                if($db->numRows($queryresult)) {?
    68?                        ?
    69?                        $ver=$db->fetchArray($queryresult);?
    70?                        while($ver["version"] != $newVersion){?
    71?                        ?
    72?                                switch($ver["version"]){?
    73?                                ?
    74?                                        // ================================================================================================?
    75?                                        case "1.0":?
    76?                                                $nextVersion = "1.01";?
    77?                                                ?
    78?                                                $thereturn.="Updating ".$module["title"]." Module to ".$nextVersion."\n";?
    79?                        ?
    80?                                                $thereturn.= processSQLfile($db,"updatev1.01.sql");?
    81?        ?
    82?                                                //Updating Module Table?
    83?                                                $querystatement="?
    84?                                                        UPDATE ?
    85?                                                                modules ?
    86?                                                        SET ?
    87?                                                                version='".$nextVersion."'?
    88?                                                        WHERE ?
    89?                                                                name = '".$module["name"]."'";?
    90?                                                                ?
    91?                                                $queryresult = $db->query($querystatement);?
    92?                                                ?
    93?                                                $thereturn.=" - Updated module record with new version \n";?
    94?                                                ?
    95?                                                $thereturn.="Update of ".$module["name"]." to ".$nextVersion." Finished\n\n";?
    96?                                ?
    97?                                                $ver["version"] = $nextVersion;?
    98?                ?
    99?                                                break;?
    100?                                                ?
    101?                                        // ================================================================================================?
    102?                                        case "1.01":?
    103?                                                $nextVersion = "1.02";?
    104?                                                ?
    105?                                                $thereturn.="Updating ".$module["title"]." Module to ".$nextVersion."\n";?
    106?                        ?
    107?                                                //$thereturn.= processSQLfile($db,"updatev1.01.sql");?
    108?        ?
    109?                                                //Updating Module Table?
    110?                                                $querystatement="?
    111?                                                        UPDATE ?
    112?                                                                modules ?
    113?                                                        SET ?
    114?                                                                version='".$nextVersion."'?
    115?                                                        WHERE ?
    116?                                                                name = '".$module["name"]."'";?
    117?                                                                ?
    118?                                                $queryresult = $db->query($querystatement);?
    119?                                                ?
    120?                                                $thereturn.=" - Updated module record with new version \n";?
    121?                                                ?
    122?                                                $thereturn.="Update of ".$module["name"]." to ".$nextVersion." Finished\n\n";?
    123?                                ?
    124?                                                $ver["version"] = $nextVersion;?
    125?                ?
    126?                                                break;?
    127?                                        // ================================================================================================?
    128?                                        case "1.02":?
    129?                                                $nextVersion = "1.03";?
    130?                                                ?
    131?                                                $thereturn.="Updating ".$module["title"]." Module to ".$nextVersion."\n";?
    132?                        ?
    133?                                                $thereturn.= processSQLfile($db,"updatev1.03.sql");?
    134?        ?
    135?                                                //Updating Module Table?
    136?                                                $querystatement="?
    137?                                                        UPDATE ?
    138?                                                                modules ?
    139?                                                        SET ?
    140?                                                                version='".$nextVersion."'?
    141?                                                        WHERE ?
    142?                                                                name = '".$module["name"]."'";?
    143?                                                                ?
    144?                                                $queryresult = $db->query($querystatement);?
    145?                                                ?
    146?                                                $thereturn.=" - Updated module record with new version \n";?
    147?                                                ?
    148?                                                $thereturn.="Update of ".$module["name"]." to ".$nextVersion." Finished\n\n";?
    149?                                ?
    150?                                                $ver["version"] = $nextVersion;?
    151?                ?
    152?                                                break;?
    153?                                        ?
    154?                                }//end switch?
    155?                                ?
    156?                        }//end while?
    157?                        ?
    158?                } else ?
    159?                        $thereturn = "Cannot update module ".$module["title"].": Module not installed.";?
    160??
    161?                return $thereturn;?
    162??
    163?        }//end update           ?
    164??
    165?        //PROCESSING?
    166?        // ===================================================================================================?
    167?        ?
    168?        $phpbmsSession = new phpbmsSession;?
    169?        $success = $phpbmsSession->loadDBSettings(false);?
    170??
    171?        include_once("include/db.php");?
    172?        $db = new db(false);?
    173?        $db->stopOnError = false;?
    174?        $db->showError = false;?
    175?        $db->logError = false;?
    176??
    177?        if($success !== false){?
    178?                ?
    179?                if(!$db->connect())?
    180?                        $thereturn = "Could Not Establish Connection To MySQL Server: Check server, user name, and password.";                  ?
    181?                else {?
    182??
    183?                        if(!$db->selectSchema())?
    184?                                $thereturn = "Database (schema) ".MYSQL_DATABASE." could not be selected";                      ?
    185?                        else {?
    186??
    187?                                $phpbmsSession->db = $db;?
    188?                                $phpbmsSession->loadSettings();?
    189?                                ?
    190?                                $thereturn = doUpdate($db);     ?
    191??
    192?                        }//endif?
    193?                        ?
    194?                }//end if?
    195?                ?
    196?        } else?
    197?                $thereturn = "Could not access settings.php";   ?
    198?                                ?
    199?                header('Content-Type: text/xml');?
    200?                ?><?php echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'; ?>?
    201?<response><?php echo $thereturn?></response>?
    ?39$theModule = new updateModuleAjax($this->db, $this->phpbmsSession, "recurringinvoices", "../modules/recurringinvoices/install/");?
    ?40$theModule->updateVersions = array(?
    ?41                                        1.01,?
    ?42                                        1.03?
    ?43                                );?
  • trunk/phpbms/modules/recurringinvoices/scheduler_recurr.php

    r384 r485 ?
    1?<?php ?
    2??
    3?if(!class_exists("appError"))?
    4?        include_once("../../include/session.php");?
    ?1<?php?
    ?2//uncomment for debug purposes?
    ?3//if(!class_exists("appError"))?
    ?4//      include_once("../../include/session.php");?
    55?
    66class recurr{?
    ? ? ?
    1010        }?
    1111?
    12?        ?
    ?12?
    1313        function getInvoicesToRepeat($dateToCheck = NULL){?
    14?                if($dateToCheck == NULL) ?
    ?14                if($dateToCheck == NULL)?
    1515                        $dateToCheck = mktime(0,0,0);?
    16?        ?
    ?16?
    1717                $invoiceList = array();?
    18?        ?
    ?18?
    1919                $querystatement = "SELECT invoiceid,invoices.invoicedate, firstrepeat, lastrepeat,?
    20?                                                        recurringinvoices.`type`,`eachlist`,`every`,`ontheday`,`ontheweek` ?
    ?20                                                        recurringinvoices.`type`,`eachlist`,`every`,`ontheday`,`ontheweek`?
    2121                                                        FROM recurringinvoices INNER JOIN invoices ON recurringinvoices.invoiceid = invoices.id?
    22?                                                        WHERE invoices.invoicedate <= '".dateToString($dateToCheck,"SQL")."' ?
    ?22                                                        WHERE invoices.invoicedate <= '".dateToString($dateToCheck,"SQL")."'?
    2323                                                        AND (recurringinvoices.until IS NULL OR recurringinvoices.until >= '".dateToString($dateToCheck,"SQL")."')?
    2424                                                        AND (recurringinvoices.times IS NULL OR recurringinvoices.times > recurringinvoices.timesrepeated)";?
    2525?
    2626                $queryresult = $this->db->query($querystatement);?
    27?                ?
    ?27?
    2828                while($therecord = $this->db->fetchArray($queryresult)){?
    29?                        ?
    ?29?
    3030                        if($therecord["lastrepeat"])?
    3131                                $startDate = stringToDate($therecord["lastrepeat"],"SQL");?
    3232                        else?
    3333                                $startDate = stringToDate($therecord["invoicedate"],"SQL");?
    34?                        ?
    ?34?
    3535                        $dateArray = $this->getValidInRange($startDate,$dateToCheck,$therecord);?
    3636?
    3737                        if( in_array($dateToCheck, $dateArray))?
    3838                                $invoiceList[] = $therecord["invoiceid"];?
    39?                        ?
    ?39?
    4040                }//end while?
    41?                ?
    ?41?
    4242                return $invoiceList;?
    43?        ?
    ?43?
    4444        }//end method?
    4545?
    ? ? ?
    5050                //should pad the end date to make sure we get all weekly repeats?
    5151                $endDate = strtotime("+7 days",$endDate);?
    52?                ?
    ?52?
    5353                $validDates = array();?
    54?                                ?
    ?54?
    5555                while($nextDate <= $endDate){?
    56?                                        ?
    ?56?
    5757                        switch($therecord["type"]){?
    5858                                case "Daily":?
    ? ? ?
    6161                                        $nextDate = strtotime("+".$therecord["every"]." days",$nextDate);?
    6262                                        break;?
    63?                                        ?
    64?                                case "Weekly":                                                                                  ?
    ?63?
    ?64                                case "Weekly":?
    6565                                        //==================================================================================?
    6666                                        $weekDayArray = explode("::",$therecord["eachlist"]);?
    ? ? ?
    6969                                        $tempDate = strtotime(nl_langinfo( constant("DAY_1") ),$nextDate);?
    7070                                        $tempDate = strtotime("-7 days",$tempDate);?
    71?                                        ?
    ?71?
    7272                                        foreach($weekDayArray as $weekday){?
    7373                                                if($weekday == 7)?
    7474                                                        $validDates[]=$tempDate;?
    7575                                                else{?
    76?                                                        $weekday++; ?
    ?76                                                        $weekday++;?
    7777                                                        $validDates[] = strtotime(nl_langinfo( constant("DAY_".$weekday) ),$tempDate);?
    7878                                                }?
    7979                                        }// endforeach?
    80?                                                                                                                                                                                ?
    81?                                        ?
    ?80?
    ?81?
    8282                                        $nextDate = strtotime("+".$therecord["every"]." week",$nextDate);?
    83?                                        ?
    84?                                        break;?
    85?                                ?
    ?83?
    ?84                                        break;?
    ?85?
    8686                                case "Monthly":?
    8787                                        //==================================================================================?
    88?                                        $dateArray = localtime($nextDate,true);                                         ?
    89?                                        ?
    ?88                                        $dateArray = localtime($nextDate,true);?
    ?89?
    9090                                        if($therecord["eachlist"]){?
    9191                                                $dayArray = explode("::",$therecord["eachlist"]);?
    92?                                                ?
    ?92?
    9393                                                foreach($dayArray as $theday)?
    94?                                                        $validDates[] = mktime(0,0,0,$dateArray["tm_mon"]+1,$theday,$dateArray["tm_year"]+1900);                                                        ?
    95?                                                ?
    ?94                                                        $validDates[] = mktime(0,0,0,$dateArray["tm_mon"]+1,$theday,$dateArray["tm_year"]+1900);?
    ?95?
    9696                                        } else{?
    9797                                                // check for things like second tuesday or last friday;?
    9898                                                $tempDate = mktime(0,0,0,$dateArray["tm_mon"]+1,1,$dateArray["tm_year"]+1900);?
    9999                                                $weekday = $therecord["ontheday"];?
    100?                                                $weekday = ($weekday == 7)? 1: ($weekday+1);                                                    ?
    ?100                                                $weekday = ($weekday == 7)? 1: ($weekday+1);?
    101101                                                if($therecord["ontheday"] != strftime("%u",$tempDate));?
    102102                                                        $tempDate = strtotime(nl_langinfo( constant("DAY_".$weekday) ),$tempDate);?
    103?                                                        ?
    ?103?
    104104                                                while(date("n",$tempDate) == ($dateArray["tm_mon"]+1)){?
    105?                                                ?
    ?105?
    106106                                                        if($therecord["ontheweek"] == 5){?
    107107                                                                // 5 is the "last" option, so we just need to see if?
    ? ? ?
    109109                                                                if($daysInMonth - date("d",$tempDate) < 7)?
    110110                                                                        $validDates[] = $tempDate;?
    111?                                                                        ?
    ?111?
    112112                                                        } else {?
    113113                                                                if( ceil(date("d",$tempDate)/7) == $therecord["ontheweek"])?
    114?                                                                        $validDates[] = $tempDate;                                                                              ?
    ?114                                                                        $validDates[] = $tempDate;?
    115115                                                        }// endif?
    116116?
    ? ? ?
    122122                                        $nextDate = strtotime("+".$therecord["every"]." months",$nextDate);?
    123123                                        break;?
    124?                                        ?
    ?124?
    125125                                case "Yearly":?
    126126                                        //==================================================================================?
    127127                                        $monthArray = explode("::",$therecord["eachlist"]);?
    128128                                        foreach($monthArray as $monthNum){?
    129?                                                $dateArray = localtime($nextDate,true);                                         ?
    ?129                                                $dateArray = localtime($nextDate,true);?
    130130                                                $daysInMonth = date("d", mktime(0,0,0,$monthNum,0,$dateArray["tm_year"]+1900) );?
    131131?
    ? ? ?
    137137                                                        // check for things like second tuesday or last friday;?
    138138                                                        $tempDate = mktime(0,0,0,$monthNum,1,$dateArray["tm_year"]+1900);?
    139?                                                        ?
    ?139?
    140140                                                        $weekday = $therecord["ontheday"];?
    141?                                                        $weekday = ($weekday == 7)? 1: ($weekday+1);                                                    ?
    ?141                                                        $weekday = ($weekday == 7)? 1: ($weekday+1);?
    142142                                                        if($therecord["ontheday"] != strftime("%u",$tempDate));?
    143143                                                                $tempDate = strtotime(nl_langinfo( constant("DAY_".$weekday) ),$tempDate);?
    144?                                                        ?
    145?                                                        ?
    ?144?
    ?145?
    146146                                                        while(date("n",$tempDate) == $monthNum){?
    147147                                                                if($therecord["ontheweek"] == 5){?
    ? ? ?
    150150                                                                        if($daysInMonth - date("d",$tempDate) < 7)?
    151151                                                                                $validDates[] = $tempDate;?
    152?                                                                                ?
    ?152?
    153153                                                                } else {?
    154154                                                                        if( ceil(date("d",$tempDate)/7) == $therecord["ontheweek"])?
    155?                                                                                $validDates[] = $tempDate;                                                                              ?
    ?155                                                                                $validDates[] = $tempDate;?
    156156                                                                }// endif?
    157?        ?
    ?157?
    158158                                                                $tempDate = strtotime("+7 days",$tempDate);?
    159?        ?
    ?159?
    160160                                                        }// endwhile?
    161161?
    162?                                                }//endif                        ?
    ?162                                                }//endif?
    163163?
    164164                                        }//endforeach?
    ? ? ?
    168168                                        break;?
    169169                        }//endswitch?
    170?                                                ?
    ?170?
    171171                }//end while?
    172?                ?
    ?172?
    173173                return $validDates;?
    174?                ?
    175?        }//end method?
    176?        ?
    177?        ?
    ?174?
    ?175        }//end method?
    ?176?
    ?177?
    178178        function copyInvoice($invoiceid){?
    179179                $querystatement = "?
    180?                        SELECT ?
    181?                                invoices.*, ?
    182?                                firstrepeat, ?
    183?                                includepaymenttype, ?
    184?                                includepaymentdetails, ?
    ?180                        SELECT?
    ?181                                invoices.*,?
    ?182                                firstrepeat,?
    ?183                                includepaymenttype,?
    ?184                                includepaymentdetails,?
    185185                                recurringinvoices.id AS recurrid,?
    186?                                recurringinvoices.statusid AS newstatusid, ?
    ?186                                recurringinvoices.statusid AS newstatusid,?
    187187                                recurringinvoices.assignedtoid AS newassignedtoid,?
    188188                                notificationroleid?
    189?                        FROM ?
    ?189                        FROM?
    190190                                invoices INNER JOIN recurringinvoices ON invoices.id = recurringinvoices.invoiceid?
    191?                        WHERE ?
    ?191                        WHERE?
    192192                                invoices.id = ".$invoiceid;?
    193193?
    194194                $queryresult = $this->db->query($querystatement);?
    195?                ?
    ?195?
    196196                $therecord = $this->db->fetchArray($queryresult);?
    197?                ?
    ?197?
    198198                $fieldList = array();?
    199199                foreach($therecord as $name=>$value){?
    ? ? ?
    206206                                case "modifieddate":?
    207207                                case "createdby":?
    208?                                case "creationdate":                            ?
    ?208                                case "creationdate":?
    209209                                case "newstatusid":?
    210210                                case "newassignedtoid":?
    ? ? ?
    212212                                case "recurrid":?
    213213                                        break;?
    214?                                        ?
    ?214?
    215215                                case "checkno":?
    216216                                case "webconfirmationno":?
    ? ? ?
    222222                                        $therecord[$name] = NULL;?
    223223                                        break;?
    224?                                        ?
    ?224?
    225225                                case "statusdate":?
    226226                                case "orderdate":?
    ? ? ?
    250250                                        $therecord[$name] = $therecord["newstatusid"];?
    251251                                        break;?
    252?                                ?
    ?252?
    253253                                case "assignedtoid":?
    254254                                        $fieldlist[] = $name;?
    ? ? ?
    277277?
    278278                $insertstatement = $this->prepareInsert("invoices",$fieldlist,$therecord);?
    279?        ?
    ?279?
    280280                $this->db->query($insertstatement);?
    281?                ?
    ?281?
    282282                $theid = $this->db->insertId();?
    283?                ?
    ?283?
    284284                $this->copyLineItems($therecord["id"],$theid);?
    285285                $this->insertHistory($theid,$therecord["statusid"],$therecord["statusdate"],$therecord["assignedtoid"]);?
    286?                ?
    ?286?
    287287                $this->updateReccurence($therecord["recurrid"],$therecord["firstrepeat"]);?
    288?                ?
    ?288?
    289289                if($therecord["notificationroleid"])?
    290290                        $this->sendNotification($therecord["notificationroleid"],$theid);?
    291?                ?
    292?        }//end method?
    293?        ?
    294?        ?
    ?291?
    ?292        }//end method?
    ?293?
    ?294?
    295295        function copyLineItems($oldInvoiceID, $newInvoiceID){?
    296?                ?
    ?296?
    297297                $querystatement = "SELECT * FROM lineitems WHERE invoiceid = ".$oldInvoiceID;?
    298298                $queryresult = $this->db->query($querystatement);?
    299299?
    300300                while($therecord = $this->db->fetchArray($queryresult)){?
    301?                        ?
    ?301?
    302302                        $fieldlist = array();?
    303?                        ?
    ?303?
    304304                        foreach($therecord as $name=>$value){?
    305305                                switch($name){?
    ? ? ?
    308308                                        case "modifieddate":?
    309309                                        case "createdby":?
    310?                                        case "creationdate":                            ?
    ?310                                        case "creationdate":?
    311311                                                break;?
    312?                                                ?
    ?312?
    313313                                        case "invoiceid":?
    314314                                                $therecord[$name] = $newInvoiceID;?
    315?                                                $fieldlist[] = $name;                                   ?
    ?315                                                $fieldlist[] = $name;?
    316316                                                break;?
    317?                                        ?
    ?317?
    318318                                        default:?
    319?                                                $fieldlist[] = $name;                                   ?
    ?319                                                $fieldlist[] = $name;?
    320320                                }// endswitch?
    321321                        }// endforeach?
    322?                        ?
    ?322?
    323323                        $insertstatement = $this->prepareInsert("lineitems",$fieldlist,$therecord);?
    324?                        ?
    ?324?
    325325                        $this->db->query($insertstatement);?
    326?                        ?
    ?326?
    327327                }// endwhile?
    328?                ?
    329?        }//end method?
    330?        ?
    331?        ?
    ?328?
    ?329        }//end method?
    ?330?
    ?331?
    332332        function prepareInsert($tablename, $fieldlist, $therecord){?
    333333                $insertstatement = "INSERT INTO ".$tablename." (";?
    334?                ?
    ?334?
    335335                foreach($fieldlist as $name)?
    336336                        $insertstatement .= "`".$name."`, ";?
    337337?
    338338                $insertstatement .= " createdby,creationdate) VALUES (";?
    339?                ?
    ?339?
    340340                foreach($fieldlist as $name)?
    341341                        if($therecord[$name] !== NULL)?
    ? ? ?
    343343                        else?
    344344                                $insertstatement .= "NULL, ";?
    345?                                ?
    ?345?
    346346                $insertstatement .="-3, NOW());";?
    347?                ?
    ?347?
    348348                return $insertstatement;?
    349349        }//end method?
    350?        ?
    351?        ?
    ?350?
    ?351?
    352352        function insertHistory($invoiceid, $statusid, $statusdate, $assignedtoid){?
    353353                $insertstatement = "INSERT INTO invoicestatushistory (invoiceid, invoicestatusid, statusdate, assignedtoid) VALUES (";?
    ? ? ?
    356356                $insertstatement .= "'".$statusdate."', ";?
    357357                $insertstatement .= $assignedtoid.")";?
    358?                ?
    ?358?
    359359                $this->db->query($insertstatement);?
    360?                ?
    361?        }//end method?
    362?        ?
    363?        ?
    ?360?
    ?361        }//end method?
    ?362?
    ?363?
    364364        function updateReccurence($recurrid, $firstrepeat){?
    365365                $updatestatement = "UPDATE recurringinvoices SET timesrepeated = timesrepeated+1, lastrepeat=NOW()";?
    366366                if(!$firstrepeat)?
    367367                        $updatestatement .= ", firstrepeat=NOW()";?
    368?                ?
    ?368?
    369369                $updatestatement .= " WHERE id = ".$recurrid;?
    370?        ?
    ?370?
    371371                $this->db->query($updatestatement);?
    372?                ?
    ?372?
    373373        }?
    374?        ?
    375?        ?
    ?374?
    ?375?
    376376        function sendNotification($roleid, $newInvoiceID){?
    377377                if($roleid == -100)?
    ? ? ?
    379379                else?
    380380                        $whereclause = "rolestousers.roleid = ".$roleid;?
    381?                        ?
    ?381?
    382382                $querystatement = "SELECT email FROM rolestousers INNER JOIN users ON rolestousers.userid = users.id?
    383383                                                        WHERE email != '' AND ".$whereclause;?
    384384?
    385385                $queryresult = $this->db->query($querystatement);?
    386?                ?
    ?386?
    387387                $subject = APPLICATION_NAME." recurring invoice notification.";?
    388388                $message = APPLICATION_NAME." has created a new order from a recurring invoice.  The new order id is ".$newInvoiceID;?
    ? ? ?
    394394                        @ mail ($to,$subject,$message,$headers);?
    395395                }// endwhile?
    396?                ?
    ?396?
    397397        }//end method?
    398398}//end class?
  • trunk/phpbms/modules/sample/install/install.php

    r285 r485 ?
    11<?php?
    2?/*?
    3? $Rev: 265 $ | $LastChangedBy: brieb $?
    4? $LastChangedDate: 2007-08-13 21:33:23 -0600 (Mon, 13 Aug 2007) $?
    5? +-------------------------------------------------------------------------+?
    6? | Copyright (c) 2004 - 2007, Kreotek LLC                                  |?
    7? | All rights reserved.                                                    |?
    8? +-------------------------------------------------------------------------+?
    9? |                                                                         |?
    10? | Redistribution and use in source and binary forms, with or without      |?
    11? | modification, are permitted provided that the following conditions are  |?
    12? | met:                                                                    |?
    13? |                                                                         |?
    14? | - Redistributions of source code must retain the above copyright        |?
    15? |   notice, this list of conditions and the following disclaimer.         |?
    16? |                                                                         |?
    17? | - Redistributions in binary form must reproduce the above copyright     |?
    18? |   notice, this list of conditions and the following disclaimer in the   |?
    19? |   documentation and/or other materials provided with the distribution.  |?
    20? |                                                                         |?
    21? | - Neither the name of Kreotek LLC nor the names of its contributore may |?
    22? |   be used to endorse or promote products derived from this software     |?
    23? |   without specific prior written permission.                            |?
    24? |                                                                         |?
    25? | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS     |?
    26? | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT       |?
    27? | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |?
    28? | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      |?
    29? | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   |?
    30? | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT        |?
    31? | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,   |?
    32? | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY   |?
    33? | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT     |?
    34? | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   |?
    35? | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    |?
    36? |                                                                         |?
    37? +-------------------------------------------------------------------------+?
    38?*/?
    39?error_reporting(E_ALL);?
    40?define("APP_DEBUG",false);?
    41?define("noStartup",true);?
    42?include("../../../install/install_include.php");?
    43?include("../../../include/session.php");?
    ?2// The install proceess is typically simple, but if you have some complex?
    ?3// installation procedures not covered by the installModuleAjax (located in the?
    ?4// main install/installajax.php file) You can override the class.?
    ?5//?
    ?6// Just make sure your class has an 'install' method, and spits back JSON paired?
    ?7// results?
    448?
    45?        $phpbmsSession = new phpbmsSession;?
    46?        $success = $phpbmsSession->loadDBSettings(false);?
    47?        include_once("include/db.php");?
    48?        $db = new db(false);?
    49?        $db->stopOnError = false;?
    50?        $db->showError = false;?
    51?        $db->logError = false;?
    ?9// Always instanciate the class to the variable $theModule. include the?
    ?10// encapsulating objects db and phpbmsSession variables as well?
    ?11// as the path form the application to the modules's install folder?
    ?12$theModule = new installModuleAjax($this->db, $this->phpbmsSession, "../modules/sample/install/");?
    5213?
    53?        if($success !== false){?
    54?                ?
    55?                if(!$db->connect())?
    56?                        $thereturn = "Could Not Establish Connection To MySQL Server: Check server, user name, and password.";                  ?
    57?                else {?
    58?                        if(!$db->selectSchema())?
    59?                                $thereturn = "Database (schema) ".MYSQL_DATABASE." could not be selected";                      ?
    60?                        else {?
    ?14// by default the install class will try to run a createtables.sql file located?
    ?15// in the modules install directory.  In addition, it will run individual?
    ?16// SQL files that match table name entries in the tables array (defined below)?
    ?17// that should also be located in the module's install folder.?
    ?18$theModule->tables = array(?
    ?19                        "menu",?
    ?20                        "modules",?
    ?21                        "roles",?
    ?22                        "scheduler",?
    ?23                        "tabledefs",?
    ?24                        "tablecolumns",?
    ?25                        "tableoptions",?
    ?26                        "tablefindoptions",?
    ?27                        "tablesearchablefields",?
    ?28                        "tabs",?
    ?29                        "users",?
    ?30                        );?
    6131?
    62??
    63?                                // ENTER YOUR MODULE NAME HERE?
    64?                                $thereturn = "Business Management System Installation\n";?
    65?                                $thereturn .= "_______________________________________\n";?
    66?                                ?
    67?                                //MAKE SURE THERE IS A createtables.sql FILE?
    68?                                //which houses all your SQL create statements?
    69?                                // for any tables you will create.?
    70?                                $tempreturn = createTables($db,"createtables.sql");?
    71?                                ?
    72?                                if($tempreturn === true){?
    73?                                        ?
    74?                                        $thereturn.= "Done Creating Tables \n";?
    75?                                        ?
    76?                                        ?
    77?                                        // NEXT, DEFINE AN ARRAY OF TABLE NAMES?
    78?                                        // for any tables that need initial data populated. (including existing tables)?
    79?                                        // for each table, make sure there?
    80?                                        // is a corresponding SQL file?
    81?                                        // with insert statements for all the records needing to be imported?
    82?                                        $tables = array(?
    83?                                                "choices",?
    84?                                                "menu",?
    85?                                                "tabs",?
    86?                                                "modules",?
    87?                                                "relationships",?
    88?                                                "reports",?
    89?                                                "tablecolumns",?
    90?                                                "tabledefs",?
    91?                                                "tablefindoptions",?
    92?                                                "tableoptions",?
    93?                                                "tablesearchablefields",?
    94?                                                "usersearches",?
    95?                                                "settings",?
    96?                                                "shippingmethods",?
    97?                                                "paymentmethods",               ?
    98?                                                "invoicestatuses",              ?
    99?                                        );?
    100?                                        foreach($tables as $table){?
    101?                                                ?
    102?                                                $failure = false;?
    103?                                                $tempreturn = importData($db,$table);?
    104?                                                $thereturn .= $tempreturn;?
    105?                                                if(!strpos($tempreturn,"complete.") === false){?
    106?                                                        $failed = true;?
    107?                                                }?
    108?                                                ?
    109?                                        }//end foreach?
    110?                                        ?
    111?                                        ?
    112?                                        //MAKE SURE TO set the done message for your module.?
    113?                                        if(!$failure){?
    114?                                                $thereturn .= "________________________\n";                     ?
    115?                                                $thereturn .= "Done Installing BMS Data\n";?
    116?                                        }?
    117?                                } else?
    118?                                        $thereturn = $tempreturn;                               ?
    119?                        }               ?
    120?                }?
    121?        } else?
    122?                $thereturn = "Could not access settings.php";?
    123?                ?
    124?                ?
    125?                header('Content-Type: text/xml');?
    126?                ?><?php echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'; ?>?
    127?<response><?php echo $thereturn?></response>?
    ?32?>?
  • trunk/phpbms/modules/sample/install/update.php

    r285 r485 ?
    11<?php?
    2?/*?
    3? $Rev: 265 $ | $LastChangedBy: brieb $?
    4? $LastChangedDate: 2007-08-13 21:33:23 -0600 (Mon, 13 Aug 2007) $?
    5? +-------------------------------------------------------------------------+?
    6? | Copyright (c) 2004 - 2007, Kreotek LLC                                  |?
    7? | All rights reserved.                                                    |?
    8? +-------------------------------------------------------------------------+?
    9? |                                                                         |?
    10? | Redistribution and use in source and binary forms, with or without      |?
    11? | modification, are permitted provided that the following conditions are  |?
    12? | met:                                                                    |?
    13? |                                                                         |?
    14? | - Redistributions of source code must retain the above copyright        |?
    15? |   notice, this list of conditions and the following disclaimer.         |?
    16? |                                                                         |?
    17? | - Redistributions in binary form must reproduce the above copyright     |?
    18? |   notice, this list of conditions and the following disclaimer in the   |?
    19? |   documentation and/or other materials provided with the distribution.  |?
    20? |                                                                         |?
    21? | - Neither the name of Kreotek LLC nor the names of its contributore may |?
    22? |   be used to endorse or promote products derived from this software     |?
    23? |   without specific prior written permission.                            |?
    24? |                                                                         |?
    25? | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS     |?
    26? | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT       |?
    27? | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |?
    28? | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      |?
    29? | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   |?
    30? | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT        |?
    31? | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,   |?
    32? | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY   |?
    33? | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT     |?
    34? | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   |?
    35? | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    |?
    36? |                                                                         |?
    37? +-------------------------------------------------------------------------+?
    38?*/?
    39?error_reporting(E_ALL);?
    40?define("APP_DEBUG",false);?
    41?define("noStartup",true);?
    ?2// The update proceess is typically simple, but if you have some complex?
    ?3// update procedures (like the BMS module) not covered by the updateModuleAjax?
    ?4// (located in the main install/installajax.php file) You can override the class.?
    ?5//?
    ?6// Just make sure your class has an 'update' method, and spits back JSON paired?
    ?7// results?
    428?
    43?include("../../../install/install_include.php");?
    44?include("../../../include/session.php");?
    ?9// Always instanciate the class to the variable $theModule. include the?
    ?10// encapsulating objects db and phpbmsSession variables as well?
    ?11// as the module name, and the path form the application to the modules's?
    ?12// install folder?
    ?13$theModule = new updateModuleAjax($this->db, $this->phpbmsSession, "recurringinvoices", "../modules/recurringinvoices/install/");?
    4514?
    46?        function doUpdate($db) {?
    47?                $thereturn="Updating Business Management System Module\n";?
    48?                ?
    49?                if(!verifyAdminLogin($db,$_GET["u"],$_GET["p"])){?
    50?                        $thereturn="Update Requires Administrative Access.\n\n";?
    51?                        return $thereturn;?
    52?                }?
    53?                                ?
    54?                $newVersion = $_GET["v"];?
    55?                ?
    56?                $querystatement="SELECT version FROM modules WHERE name=\"bms\"";?
    57?                $queryresult=$db->query($querystatement);?
    58?                if(!$queryresult) {?
    59?                        $thereturn="Error Accessing module table in database.\n\n";?
    60?                        return $thereturn;?
    61?                }?
    62?                ?
    63?                $ver=$db->fetchArray($queryresult);?
    ?15// Next define all the updates that are possible.  Each version?
    ?16// corresponds to a sql file in the install folder named 'updatev[version].sql'?
    ?17// that will be run while updating.?
    ?18//?
    ?19// List *all* the versions to update. The update process will ONLY run?
    ?20// applicable upgrades, ignoring older versions not needed to upgrade.?
    ?21$theModule->updateVersions = array(?
    ?22                                        1.01,?
    ?23                                        1.02,?
    ?24                                        1.03?
    ?25                                );?
    6426?
    65?                while($ver["version"] != $newVersion){?
    66?                        switch($ver["version"]){?
    67?                                // ================================================================================================?
    68?                                case "0.5":?
    69?                                        $thereturn.="Updating BMS Module to 0.51\n";?
    70?                ?
    71?                                        //Updating Module Table?
    72?                                        $querystatement="UPDATE modules SET version=\"0.51\" WHERE name=\"bms\";";?
    73?                                        $queryresult=$db->query($querystatement);?
    74?                                        $thereturn.=" - modified bms record in modules table\n";?
    75?                                        ?
    76?                                        $thereturn.="Update to 0.51 Finished\n\n";?
    77?                        ?
    78?                                        $ver["version"]="0.51";?
    79?                                break;?
    80?                                // ================================================================================================?
    81?                                case "0.51":?
    82?                                        $thereturn.="Updating BMS Module to 0.6\n";?
    83?                                                        ?
    84?                                        $thereturn.=processSQLfile($db,"updatev0.6.sql");?
    85?                                        ?
    86?                                        $thereturn.=importData($db,"choices");?
    87?                                        $thereturn.=importData($db,"menu");?
    88?                                        $thereturn.=importData($db,"reports");?
    89?                                        $thereturn.=importData($db,"tablecolumns");?
    90?                                        $thereturn.=importData($db,"tabledefs");?
    91?                                        $thereturn.=importData($db,"tablefindoptions");?
    92?                                        $thereturn.=importData($db,"tableoptions");?
    93?                                        $thereturn.=importData($db,"tablesearchablefields");?
    94??
    95?                                        $querystatement="SELECT clients.id,DATE_FORMAT(clients.creationdate,\"%Y-%m-%d\") as creationdate,max(invoices.orderdate) as orderdate?
    96?                                                                        FROM `clients` LEFT JOIN invoices on clients.id=invoices.clientid ?
    97?                                                                        WHERE clients.type=\"client\" GROUP BY clients.id;";?
    98?                                        $queryresult=$db->query($querystatement);?
    99??
    100?                                        while($therecord=$db->fetchArray($queryresult,$dblink)){?
    101?                                                $querystatement="UPDATE clients set becameclient=\"";?
    102?                                                if($therecord["orderdate"])?
    103?                                                        $querystatement.=$therecord["orderdate"];?
    104?                                                else?
    105?                                                        $querystatement.=$therecord["creationdate"];?
    106?                                                $querystatement.="\" WHERE id=".$therecord["id"];?
    107?                                                $updateresult=$db->query($querystatement);?
    108?                                        }?
    109?                                        $thereturn.=" - set intitial client becamclient field\n";?
    110?                                        ?
    111??
    112?                                        //Updating Module Table?
    113?                                        $querystatement="UPDATE modules SET version=\"0.6\" WHERE name=\"bms\";";?
    114?                                        $updateresult=$db->query($querystatement);?
    115?                                        $thereturn.=" - modified bms record in modules table\n";?
    116??
    117?                                        $thereturn.="Update to 0.6 Finished\n\n";?
    118?                        ?
    119?                                        $ver["version"]="0.6";?
    120?                                break;?
    121?                                // ================================================================================================?
    122?                                case "0.6";?
    123?                                        $thereturn.="Updating BMS Module to 0.601\n";?
    124??
    125?                                        $querystatement="SELECT invoices.id,tax.percentage FROM invoices INNER JOIN tax on invoices.taxareaid=tax.id";?
    126?                                        $queryresult=$db->query($querystatement);?
    127?                                        ?
    128?                                        ?
    129?                                        while($therecord=$db->fetchArray($queryresult)){?
    130?                                                $querystatement="UPDATE invoices SET taxpercentage=".$therecord["percentage"]."WHERE id=".$therecord["id"];?
    131?                                                $updateresult=$db->query($querystatement);?
    132?                                        }?
    133?                                        $thereturn.=" - set taxpercentage on invoices\n";?
    134??
    135?                                        //Updating Module Table?
    136?                                        $querystatement="UPDATE modules SET version=\"0.601\" WHERE name=\"bms\";";?
    137?                                        $updateresult=$db->query($querystatement);?
    138?                                        $thereturn.=" - modified bms record in modules table\n";?
    139??
    140??
    141?                                        $thereturn.="Update to 0.601 Finished\n\n";?
    142?                        ?
    143?                                        $ver["version"]="0.601";?
    144??
    145?                                break;?
    146?                                // ================================================================================================?
    147?                                case "0.601";?
    148?                                        $thereturn.="Updating BMS Module to 0.602\n";?
    149??
    150?                                        //Updating Module Table?
    151?                                        $querystatement="UPDATE modules SET version=\"0.602\" WHERE name=\"bms\";";?
    152?                                        $updateresult=$db->query($querystatement);?
    153?                                        $thereturn.=" - modified bms record in modules table\n";?
    154??
    155?                                        $thereturn.="Update to 0.602 Finished\n\n";?
    156?                        ?
    157?                                        $ver["version"]="0.602";?
    158?                                // ================================================================================================?
    159?                                case "0.602";?
    160?                                        $thereturn.="Updating BMS Module to 0.61\n";?
    161??
    162?                                        $thereturn.=processSQLfile($db,"updatev0.61.sql");?
    163??
    164?                                        //Updating Module Table?
    165?                                        $querystatement="UPDATE modules SET version=\"0.61\" WHERE name=\"bms\";";?
    166?                                        $updateresult=$db->query($querystatement);?
    167?                                        $thereturn.=" - modified bms record in modules table\n";?
    168??
    169?                                        $thereturn.="Update to 0.61 Finished\n\n";?
    170?                        ?
    171?                                        $ver["version"]="0.61";?
    172?                                break;?
    173?                                // ================================================================================================?
    174?                                case "0.61";?
    175?                                        $thereturn.="Updating BMS Module to 0.62\n";?
    176??
    177?                                        $thereturn.=processSQLfile($db,"updatev0.62.sql");?
    178??
    179?                                        //Updating Module Table?
    180?                                        $querystatement="UPDATE modules SET version=\"0.62\" WHERE name=\"bms\";";?
    181?                                        $updateresult=$db->query($querystatement);?
    182?                                        $thereturn.=" - modified bms record in modules table\n";?
    183??
    184?                                        $thereturn.="Update to 0.62 Finished\n\n";?
    185?                        ?
    186?                                        $ver["version"]="0.62";?
    187?                                break;?
    188?                                // ================================================================================================?
    189?                                case "0.62";?
    190?                                        $thereturn.="Updating BMS Module to 0.7\n";?
    191?                                        ?
    192?                                        $thereturn.=processSQLfile($db,"updatev0.70.sql");?
    193?                                        ?
    194?                                        //update to new status system?
    195?                                        $result=updateInvoiceStatus($db);?
    196?                                        if($result===true)?
    197?                                                $thereturn.=" - Updated to new invoice status system\n";?
    198?                                        else?
    199?                                                $thereturn.=" - Failed to updated to new invoice status system\n".$result."\n\n";                                       ?
    200?                                        ?
    201?                                        //Update shipping from invoices?
    202?                                        $result=moveShipping($db);?
    203?                                        if($result===true)?
    204?                                                $thereturn.=" - Created default Shipping Methods\n";?
    205?                                        else?
    206?                                                $thereturn.=" - Failed to create default shipping methods\n".$result."\n\n";?
    207?                                        ?
    208?                                        //update payment From invoices?
    209?                                        $result=movePayments($db);?
    210?                                        if($result===true)?
    211?                                                $thereturn.=" - Created default payment methods\n";?
    212?                                        else?
    213?                                                $thereturn.=" - Failed to create default payment Methods\n".$result."\n\n";?
    214?                                        ?
    215?                                        //Updating Module Table?
    216?                                        $querystatement="UPDATE modules SET version=\"0.7\" WHERE name=\"bms\";";?
    217?                                        $updateresult=$db->query($querystatement);?
    218?                                        $thereturn.=" - Updated bms module record with new version\n";?
    219??
    220?                                        $thereturn.="Update to 0.7 Finished\n\n";?
    221?                        ?
    222?                                        $ver["version"]="0.7";?
    223?                                break;?
    224??
    225?                                // ================================================================================================?
    226?                                case "0.7";?
    227??
    228?                                        $thereturn.= processSQLfile($db,"updatev0.8.sql");?
    229??
    230?                                        //Updating Module Table?
    231?                                        $querystatement="UPDATE modules SET version=\"0.8\" WHERE name=\"bms\";";?
    232?                                        $updateresult=$db->query($querystatement);?
    233??
    234?                                        $thereturn.="Update of Business Management System Module to 0.8 Finished\n\n";?
    235?                                        $ver["version"]="0.8";?
    236?                                break;?
    237?                        }//end switch?
    238?                }//end while?
    239?                return $thereturn;?
    240??
    241?        }//end update           ?
    242??
    243?        function moveShipping($db){?
    244?                $querystatement="SELECT DISTINCT shippingmethod FROM invoices WHERE shippingmethod!=\"\" ORDER BY shippingmethod";?
    245?                $queryresult=$db->query($querystatement);?
    246?                ?
    247?                while($therecord=$db->fetchArray($queryresult)){?
    248?                        $querystatement="INSERT INTO `shippingmethods` (name,createdby,creationdate) VALUES (\"".$therecord["shippingmethod"]."\",1,NOW())";?
    249?                        $updatequery=$db->query($querystatement);?
    250?                }?
    251??
    252?                $querystatement="SELECT id,name FROM shippingmethods";?
    253?                $queryresult=$db->query($querystatement);?
    254??
    255?                while($therecord=$db->fetchArray($queryresult)){?
    256?                        $querystatement="UPDATE invoices SET shippingmethodid=".$therecord["id"]."?
    257?                                                        WHERE shippingmethod=\"".$therecord["name"]."\"";?
    258?                        $updatequery=$db->query($querystatement);?
    259?                }?
    260?                $querystatement="ALTER TABLE invoices DROP shippingmethod";?
    261?                $updatequery=$db->query($querystatement);?
    262?                ?
    263?                return true;             ?
    264?        }?
    265??
    266?        function movePayments($db){?
    267?                $querystatement="SELECT DISTINCT paymentmethod FROM invoices WHERE paymentmethod!=\"\" ORDER BY paymentmethod";?
    268?                $queryresult=$db->query($querystatement);?
    269??
    270?                while($therecord=$db->fetchArray($queryresult)){?
    271?                        switch($therecord["paymentmethod"]){?
    272?                                case "VISA":?
    273?                                case "VISA - Debit": ?
    274?                                case "American Express":?
    275?                                case "Master Card":?
    276?                                case "MasterCard":?
    277?                                case "Discover Card":?
    278?                                        $type="\"charge\"";?
    279?                                break;?
    280?                                ?
    281?                                case "Personal Check":?
    282?                                case "Check":?
    283?                                case "Cashiers Check":?
    284?                                case "check":?
    285?                                        $type="\"draft\"";?
    286?                                break;                          ?
    287?                                ?
    288?                                default:?
    289?                                        $type="NULL";?
    290?                                break;?
    291?                        }?
    292?                        ?
    293?                        $querystatement="INSERT INTO `paymentmethods` (name,`type`,createdby,creationdate) VALUES (\"".$therecord["paymentmethod"]."\",".$type.",1,NOW())";?
    294?                        $updatequery=$db->query($querystatement);?
    295?                }?
    296??
    297?                $querystatement="SELECT id,name FROM paymentmethods";?
    298?                $queryresult=$db->query($querystatement);?
    299?                while($therecord=$db->fetchArray($queryresult)){?
    300?                        $querystatement="UPDATE invoices SET paymentmethodid=".$therecord["id"]."?
    301?                                                        WHERE paymentmethod=\"".$therecord["name"]."\"";?
    302?                        $updatequery=$db->query($querystatement);?
    303?                }?
    304?                $querystatement="ALTER TABLE invoices DROP paymentmethod";?
    305?                $updatequery=$db->query($querystatement);?
    306?                ?
    307?                return true;?
    308?        }?
    309??
    310?        function updateInvoiceStatus($db){?
    311?                $querystatement="SELECT id,status,statusdate,orderdate,invoicedate,type FROM invoices";?
    312?                $queryresult=$db->query($querystatement);?
    313?                ?
    314?                while($therecord=$db->fetchArray($queryresult)){?
    315?                        $newstatus=1;?
    316?                        switch($therecord["status"]){?
    317?                                case "Open":?
    318?                                        $newstatus=1;?
    319?                                        $statusdate=$therecord["orderdate"];?
    320?                                break;?
    321?                                case "Committed":?
    322?                                        $newstatus=2;?
    323?                                        $statusdate=$therecord["orderdate"];                                    ?
    324?                                break;?
    325?                                case "Packed":?
    326?                                        $newstatus=3;?
    327?                                break;?
    328?                                case "Shipped":?
    329?                                        $newstatus=4;?
    330?                                        if($therecord["statusdate"])?
    331?                                                $statusdate=$therecord["statusdate"];?
    332?                                        elseif($therecord["invoicedate"])?
    333?                                                $statusdate=$therecord["invoicedate"];?
    334?                                        else?
    335?                                                $statusdate=$therecord["orderdate"];?
    336?                                break;?
    337?                                if($therecord["type"]=="Invoice")?
    338?                                        $statusdate=$therecord["invoicedate"];?
    339?                        }?
    340?                        $querystatement="UPDATE invoices SET statusid=".$newstatus.", statusdate=\"".$statusdate."\" WHERE id=".$therecord["id"];?
    341?                        $updatequery=$db->query($querystatement);?
    342??
    343?                        //now create the history?
    344?                        $querystatement="INSERT INTO invoicestatushistory (invoiceid,invoicestatusid,statusdate)VALUES(".$therecord["id"].",".$newstatus.",\"".$statusdate."\")";?
    345?                        $insertquery=$db->query($querystatement);?
    346?                        ?
    347?                }?
    348?                $querystatement="ALTER TABLE `invoices` DROP COLUMN `status`";?
    349?                $dropcolumnquery=$db->query($querystatement);?
    350?                ?
    351?                return true;?
    352?        }//end funtion?
    353??
    354?        ?
    355?        $phpbmsSession = new phpbmsSession;?
    356?        $success = $phpbmsSession->loadDBSettings(false);?
    357??
    358?        include_once("include/db.php");?
    359?        $db = new db(false);?
    360?        $db->stopOnError = false;?
    361?        $db->showError = false;?
    362?        $db->logError = false;?
    363??
    364?        if($success !== false){?
    365?                ?
    366?                if(!$db->connect())?
    367?                        $thereturn = "Could Not Establish Connection To MySQL Server: Check server, user name, and password.";                  ?
    368?                else {?
    369?                        if(!$db->selectSchema())?
    370?                                $thereturn = "Database (schema) ".MYSQL_DATABASE." could not be selected";                      ?
    371?                        else {?
    372??
    373?                                $phpbmsSession->db = $db;?
    374?                                $phpbmsSession->loadSettings();?
    375?                                ?
    376?                                $thereturn=doUpdate($db);       ?
    377??
    378?                        }               ?
    379?                }?
    380?        } else?
    381?                $thereturn = "Could not access settings.php";   ?
    382?                                ?
    383??
    384??
    385?                header('Content-Type: text/xml');?
    386?                ?><?php echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'; ?>?
    387?<response><?php echo $thereturn?></response>?
    ?27?>?
  • trunk/phpbms/modules/sample/sampletable_addedit.php

    r384 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev: 258 $ | $LastChangedBy: brieb $?
    ? ? ?
    4141        include("include/tables.php");?
    4242        include("include/fields.php");?
    43?        ?
    ?43?
    4444        //if you need to ovveride the phpbmsTable class make sure to include the modules file?
    4545        include("modules/[modulename]/include/[tablename].php");?
    4646?
    4747?
    48?        //If the addedit page will be accessd directly from a page other than the ?
    ?48        //If the addedit page will be accessd directly from a page other than the?
    4949        // basic search results page, you may want to grab and pass the previous URL?
    5050        //with the following code?
    5151?
    5252        //===================================================?
    53?        if(!isset($_GET["backurl"])) ?
    54?                $backurl = NULL; ?
    55?        else{ ?
    ?53        if(!isset($_GET["backurl"]))?
    ?54                $backurl = NULL;?
    ?55        else{?
    5656                $backurl = $_GET["backurl"];?
    5757                if(isset($_GET["refid"]))?
    ? ? ?
    6363        //Here you invoke the table class.  If you are going to use the standard phpbmsTable class?
    6464        // for updates and the such you would access it like this?
    65?        ?
    ?65?
    6666        //              $thetable = new phpbmsTable($db,[table definition id]);?
    67?        ?
    68?        //if you are going to overide the class you would instantiate?
    69?        // like this?
    70?        ?
    71?        //              $thetable = new [tablename]($db,[table definition id],$backurl);?
    72?        ?
    ?67?
    ?68        // if you are going to overide the class you would instantiate?
    ?69        // your overriden class like this?
    ?70?
    ?71        //              $thetable = new [tablename]($db,[table definition id]);?
    ?72?
    7373        //and if you are setting the backurl, make sure you pass that as well?
    7474        // like this:?
    7575        //              $thetable = new [tablename]($db,[table definition id],$backurl);?
    76?        ?
    77?        ?
    78?        //Next we process the form (if submitted) and ?
    ?76?
    ?77?
    ?78        // Next we process the form (if submitted) and?
    7979        // return the current record as an array ($therecord)?
    8080        // or if this is a new record, it returns the defaults?
    ? ? ?
    8787?
    8888        $pageTitle = "[tablename]";?
    89?        ?
    ?89?
    9090        // Next, we set up to include any?
    9191        // additional css or javascript files we will be using?
    ? ? ?
    9393        // as they are automatically icluded when you define the special fields you?
    9494        // will be using below.?
    95?        $phpbms->cssIncludes[] = "pages/[tablename].css";?
    ?95        $phpbms->cssIncludes[] = "pages/[modulename]/[tablename].css";?
    9696        $phpbms->jsIncludes[] = "modules/[modulename]/javascript/[tablename].js";?
    9797?
    ?98        // DEPRECIATED: ?
    9899        // if you need to define a body onlload function, do so with the phpbms property?
    99100        $phpbms->onload[] = "initializePage()";?
    ? ? ?
    102103        // Next we need to define any special fields that will be used in the form?
    103104        // A list of field objects (with documentation)is available in the /include/fields.php?
    104?        // file.  ?
    105?        ?
    ?105        // file.?
    ?106?
    106107        // We need to define them here in the head?
    107108        // so that any necessay javascript is loaded appropriately.?
    108?        ?
    ?109?
    109110                //Form Elements?
    110111                //==============================================================?
    111?                ?
    ?112?
    112113                // Create the form?
    113114                $theform = new phpbmsForm();?
    114115                //if you need to set specific form vaiables (like enctype, or extra onsubmit?
    115116                // you can set those form properties here.?
    116?                ?
    117?                // for each field we will use, create the field object and add it to ?
    ?117?
    ?118                // for each field we will use, create the field object and add it to?
    118119                // the forms list.?
    119120                $theinput = new inputDatePicker("orderdate", $therecord["orderdate"], "order date");?
    120121                $theform->addField($theinput);?
    121?        ?
    ?122?
    122123                $theinput = new inputCheckBox("weborder",$therecord["weborder"],NULL, false, false);?
    123124                $theform->addField($theinput);?
    ? ? ?
    136137                $theform->jsMerge();?
    137138                //==============================================================?
    138?                //End Form Elements     ?
    ?139                //End Form Elements?
    139140?
    140?        include("header.php");  ?
    141?        ?
    ?141        include("header.php");?
    ?142?
    142143?><div class="bodyline">?
    143?        <!-- ?
    ?144        <!--?
    144145                Next we start the form.  This also prints the H1 with title, and top save,cancel buttons?
    145146                If you need to have other buttons, or need a specific top, you will need to create your form manually.?
    ? ? ?
    151152                <p>?
    152153                        <label for="id">id</label><br />?
    153?                        <input name="id" id="id" type="text" value="<?php echo $therecord["id"]; ?>" size="5" maxlength="5" readonly="readonly" class="uneditable" />           ?
    ?154                        <input name="id" id="id" type="text" value="<?php echo $therecord["id"]; ?>" size="5" maxlength="5" readonly="readonly" class="uneditable" />?
    154155                </p>?
    155?                <p><?php $theform->showField("inactive");?></p>         ?
    ?156                <p><?php $theform->showField("inactive");?></p>?
    156157        </fieldset>?
    157158?
    ? ? ?
    166167                </fieldset>?
    167168        </div>?
    168?        <?php ?
    ?169        <?php?
    169170                //Last, we show the create/modifiy with the bottom save and cancel buttons?
    170171                // and then close the form.?
  • trunk/phpbms/modules/sample/snapshot.php

    r285 r485 ?
    4040/*?
    4141?
    42?        Here you can define and display information from your module that will show up on the snapshot ?
    43?        (default) page.?
    ?42        Here you can define and display information from your module that?
    ?43        will show up on the snapshot (default) page.?
    4444?
    4545*/?
  • trunk/phpbms/requirements.php

    r285 r485 ?
    1?<?php ?
    ?1<?php?
    22/*?
    33 $Rev$ | $LastChangedBy$?
    ? ? ?
    4040        $loginNoDisplayError=true;;?
    4141        require("include/session.php");?
    42?        ?
    ?42?
    4343        $pageTitle = "phpBMS Browser Requirements";?
    44?        ?
    ?44?
    4545        $phpbms->cssIncludes[] = "pages/requirements.css";?
    46?        ?
    ?46?
    4747        $phpbms->showMenu = false;?
    4848        $phpbms->showFooter = false;?
    49?        ?
    ?49?
    5050        include("header.php")?
    51??><div class="bodyline" id="container"> ?
    52?        <div class="box" id="logo" style=""><span>phpBMS</span></div>?
    ?51?><div class="bodyline" id="container">?
    ?52?
    5353        <h1>phpBMS Browser Requirements</h1>?
    54?        <h2 id="cba">Client Browser Aplication</h2>?
    5554?
    56?        <h3>JavaScript v2.0</h3>?
    57?        <p>This application makes heavy use of newer JavaScript functions, including the paradigm known as AJAX. Without Javascript, enabled, phpBMS will not run correctly.</p>?
    ?55        <ul>?
    5856?
    59?        <h3>Window pop-ups:</h3>?
    60?        <p>This application utilizes JavaScript to open new windows. If you disable Javascript window opening (like in Firefox or Opera) or are utilizing a 3rd-party application to stop Internet Explorer  from opening unwanted windows, this application might not work correctly.</p>?
    ?57                <li>?
    ?58                        <h3>Enabled JavaScript v2.0 or higher processing</h3>?
    ?59                        <p>?
    ?60                                phpBMS heavily uses JavaScript, including newer functions only found in version 2.0 or higher.?
    ?61                                Most newer browsers support this, but make sure that JavaScript is enabled for this web application?
    ?62                        </p>?
    ?63                </li>?
    6164?
    62?        <h3>Cookies</h3>?
    63?        <p>A single cookie is set to identify the user during a session.</p>?
    ?65                <li>?
    ?66                        <h3>Allow window pop-ups</h3>?
    ?67                        <p>?
    ?68                                This application sparingly uses JavaScript to open multiple windows when printing.  If your browser?
    ?69                                or third-party browser plug in prohibits pop-ups from this application, printing reports will not?
    ?70                                be displayed.?
    ?71                        </p>?
    ?72                </li>?
    6473?
    65?        <h3>Style Sheets (CSS) v1.1</h3>?
    66?        <p>Your browser must support the rendering of Cascading Style Sheets. Without this support, the application will not work correctly.</p>?
    ?74                <li>?
    ?75                        <h3>Cookie support</h3>?
    ?76                        <p>?
    ?77                                phpBMS sets a single cookie to track your login.  Cookie suport for this site?
    ?78                                must be enabled in order for the application to allow you to log in?
    ?79                        </p>?
    ?80                </li>?
    ?81?
    ?82                <li>?
    ?83                        <h3>Full Casscading Style Sheet (CSS) v1.2 support</h3>?
    ?84                        <p>?
    ?85                                phpBMS takes advantage of CSS v1.2 to render pages.  Without this?
    ?86                                support, the application may not look correct, and can even break some?
    ?87                                functionality.?
    ?88                        </p>?
    ?89                </li>?
    ?90        </ul>?
    6791?
    6892        <h2>Tested Browsers</h2>?
    69?        <table border="0" cellpadding="0" cellspacing="0" class="querytable" id="browserTable">?
    70?        <tr>?
    71?                <th class="queryheader" nowrap="nowrap">Browser Application</th>?
    72?                <th class="queryheader">Version</th>?
    73?                <th class="queryheader">Platform(s)</th>?
    74?                <th align="center" class="queryheader">Compatibility</th>?
    75?                </tr>?
    76?        <tr class="row2">?
    77?                <td>Firefox</td>?
    78?                <td>1.5.0.7</td>?
    79?                <td>Windows/Macintosh</td>?
    80?                <td align="center" class="important">X</td>?
    81?                </tr>           ?
    82?        <tr class="row1">?
    83?                <td>Internet Explorer</td>?
    84?                <td>6.0.2900.2190</td>?
    85?                <td>Windows</td>?
    86?                <td align="center" class="important">X</td>?
    87?                </tr>?
    88?        <tr class="row2">?
    89?                <td>Opera</td>?
    90?                <td>9.02</td>?
    91?                <td>Windows</td>?
    92?                <td align="center" class="important">X</td>?
    93?                </tr>?
    94?        <tr class="row1">?
    95?                <td>Internet Explorer</td>?
    96?                <td>6.0.2900.2190</td>?
    97?                <td>Windows</td>?
    98?                <td align="center" class="important">X</td>?
    99?                </tr>?
    100?                <tr class="queryfooter"><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>?
    101?        </table>?
    ?93?
    ?94        <p>?
    ?95                This is a list of tested browsers known to work with the current version of phpBMS.  If you successfully?
    ?96                test another browser with this version, please report it on our forums at <a href="http://phpbms.org">http://phpbms.org</a>?
    ?97                so we can add it to the list.  Be sure to report the phpBMS version, browser name, browser version, and?
    ?98                operating system.?
    ?99        </p>?
    ?100?
    ?101        <ul>?
    ?102                <li>Firefox v3.07 for Macintosh</li>?
    ?103                <li>Firefox v3.07 for Windows</li>?
    ?104                <li>Safari v3.2.1 for Macintosh</li>?
    ?105                <li>Internet Explorer v7.0.5730.13 for Windows</li>?
    ?106                <li>Opera v9.64 for Windows</li>?
    ?107        </ul>?
    ?108?
    102109        <p align="right">?
    103110                <input type="button" value="Log In" class="Buttons" onclick="document.location='./'" id="loginButton"/>?
  • trunk/phpbms/THANKS.txt

    r396 r485 ?
    1?This file will contain all the people who have contributed to phpBMS?
    2?====================================================================?
    ?1This file will contain all the people and companies who have contributed to?
    ?2phpBMS?
    ?3================================================================================?
    34?
    45 * Hauge Quality Water - http://haguekc.com/?
    5? * Black Tie: Audio, Lighting & Video - http://blacktie.com.mx?
    ?6 * Black Tie: Audio, Lighting & Video - http://blacktie.com.mx/?
    67 * Concept Z Performance - http://www.conceptzperformance.com/?
    ?8 * Dahl Photography - http://www.dahlphotographers.com/?
phpBMS vulnerability assesment provided by Orvant Inc. Copyright ? 2010 Kreotek, LLC. All Rights reserved.